@levo-so/studio 0.1.90 → 0.1.91
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/{BillingStep-DVKPpBT9.js → BillingStep-o2yIMjLk.js} +1 -1
- package/{Button-vQpIKPk7.js → Button-_hpg7Rxx.js} +6 -6
- package/{EntryCard-UWxVYAD_.js → EntryCard-B-feJvrB.js} +13 -13
- package/{LoginCard-BKq_s4ZT.js → LoginCard-CF9JbU-y.js} +3 -3
- package/{LoginForm-54dtpOlx.js → LoginForm-CdpNCQJa.js} +10 -10
- package/{LoginModal-DTSAYZLC.js → LoginModal-ngTHCyli.js} +4 -4
- package/{MessageCard-YUS-pnpe.js → MessageCard-D2uja800.js} +2 -2
- package/{MessageFooter-DrJ6jZ_n.js → MessageFooter-Bu-jyPkJ.js} +1 -1
- package/{ModalManager-DLxbnq-i.js → ModalManager-B7pCzvK1.js} +1 -1
- package/{PendingApprovalCard-BnteoK24.js → PendingApprovalCard-Dut-Xiw1.js} +20 -20
- package/{bookingCard-CPYdqA8t.js → bookingCard-CGV9svhn.js} +4 -4
- package/collection.d.ts +360 -0
- package/collection.js +28 -0
- package/dist-DDKHTnIW.js +3653 -0
- package/index.d.ts +101 -2
- package/index.js +1419 -1453
- package/package.json +14 -3
- package/studio.css +1 -1
- package/utils-KqbqLlMF.js +5 -0
- package/widgets-B84lq4lO.js +351 -0
- /package/{AuthProvider-Ch5Ny0il.js → AuthProvider-56TywIOB.js} +0 -0
- /package/{Beams-BqUps11n.js → Beams-CCNNOvfW.js} +0 -0
- /package/{Dots-BKqlE-Rv.js → Dots-89WGkd-z.js} +0 -0
- /package/{Gradient-hC5P0PfD.js → Gradient-vTa_uWCj.js} +0 -0
- /package/{Grid-DqZKCasl.js → Grid-CrtztrxK.js} +0 -0
- /package/{StripePaymentModal-Kk0GUsIU.js → StripePaymentModal-CajqohNM.js} +0 -0
- /package/{Waves-CzQRk01F.js → Waves-BhA6CLEI.js} +0 -0
- /package/{card-oIl95-_C.js → card-DCbhJCO9.js} +0 -0
- /package/{dialog-BRgfpVtv.js → dialog-CILIXExr.js} +0 -0
package/dist-DDKHTnIW.js
ADDED
|
@@ -0,0 +1,3653 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { _ as e, f as t, g as n, i as r, m as i, n as a, p as o, r as s, s as c, t as l } from "./widgets-B84lq4lO.js";
|
|
3
|
+
import * as u from "react";
|
|
4
|
+
import d, { Suspense as f, createContext as p, forwardRef as m, lazy as h, useCallback as g, useContext as _, useEffect as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
5
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
6
|
+
import { FieldInterfaces as E, LevoError as D, MediaKindList as O, getLevoError as k } from "@levo-so/core";
|
|
7
|
+
import { errorHandler as ee, errorToast as A, mediaMimetypeByKind as te, successToast as j, useLevo as M } from "@levo-so/react";
|
|
8
|
+
import ne from "dayjs";
|
|
9
|
+
import { ArrowLeft as N, Calendar as re, Check as ie, ChevronDown as P, ChevronLeft as ae, ChevronRight as oe, LoaderCircle as se, Plus as ce, Upload as le, X as ue } from "lucide-react";
|
|
10
|
+
import { Checkbox as de, Dialog as F, Popover as fe, RadioGroup as pe, Slot as me, Switch as he, Tabs as ge, Tooltip as _e } from "radix-ui";
|
|
11
|
+
import { assignInlineVars as ve } from "@vanilla-extract/dynamic";
|
|
12
|
+
import I from "clsx";
|
|
13
|
+
import { useDebouncedCallback as ye } from "use-debounce";
|
|
14
|
+
import { DragHandle as be } from "@tiptap/extension-drag-handle-react";
|
|
15
|
+
import { CodeBlockLowlight as xe } from "@tiptap/extension-code-block-lowlight";
|
|
16
|
+
import { FileHandler as Se } from "@tiptap/extension-file-handler";
|
|
17
|
+
import { Details as Ce } from "@tiptap/extension-details";
|
|
18
|
+
import { DetailsContent as we } from "@tiptap/extension-details-content";
|
|
19
|
+
import { DetailsSummary as Te } from "@tiptap/extension-details-summary";
|
|
20
|
+
import { Emoji as Ee } from "@tiptap/extension-emoji";
|
|
21
|
+
import { TextStyle as De } from "@tiptap/extension-text-style";
|
|
22
|
+
import { HorizontalRule as Oe } from "@tiptap/extension-horizontal-rule";
|
|
23
|
+
import { Image as ke } from "@tiptap/extension-image";
|
|
24
|
+
import { Table as Ae, TableCell as je, TableHeader as Me, TableRow as Ne } from "@tiptap/extension-table";
|
|
25
|
+
import { CharacterCount as Pe } from "@tiptap/extension-character-count";
|
|
26
|
+
import { Color as Fe } from "@tiptap/extension-color";
|
|
27
|
+
import { Focus as Ie } from "@tiptap/extension-focus";
|
|
28
|
+
import { Highlight as Le } from "@tiptap/extension-highlight";
|
|
29
|
+
import { Subscript as Re } from "@tiptap/extension-subscript";
|
|
30
|
+
import { Superscript as ze } from "@tiptap/extension-superscript";
|
|
31
|
+
import { Typography as Be } from "@tiptap/extension-typography";
|
|
32
|
+
import { UniqueID as Ve } from "@tiptap/extension-unique-id";
|
|
33
|
+
import { Youtube as He } from "@tiptap/extension-youtube";
|
|
34
|
+
import { Mention as Ue } from "@tiptap/extension-mention";
|
|
35
|
+
import { DayPicker as We, getDefaultClassNames as Ge } from "react-day-picker";
|
|
36
|
+
import Ke, { isSupportedCountry as qe } from "react-phone-number-input";
|
|
37
|
+
import Je from "react-select";
|
|
38
|
+
import { cva as Ye } from "class-variance-authority";
|
|
39
|
+
import { FormProvider as Xe, get as Ze, useController as L, useFieldArray as Qe, useForm as $e, useFormContext as et, useWatch as tt } from "react-hook-form";
|
|
40
|
+
import { BiAlignJustify as nt, BiAlignLeft as rt, BiAlignMiddle as it, BiAlignRight as at, BiBold as ot, BiChevronLeft as st, BiChevronRight as ct, BiItalic as lt, BiLink as ut, BiListOl as dt, BiListUl as ft, BiStrikethrough as pt, BiUnderline as mt, BiUnlink as ht } from "react-icons/bi";
|
|
41
|
+
import { HiHashtag as gt, HiPlus as _t } from "react-icons/hi";
|
|
42
|
+
import { RxChevronLeft as vt, RxChevronRight as yt, RxDoubleArrowLeft as bt, RxDoubleArrowRight as xt } from "react-icons/rx";
|
|
43
|
+
import { NumericFormat as St } from "react-number-format";
|
|
44
|
+
import { GoCheckCircle as Ct, GoMail as wt, GoPencil as Tt } from "react-icons/go";
|
|
45
|
+
import Et from "react-select/async";
|
|
46
|
+
import { IoCheckmarkOutline as Dt } from "react-icons/io5";
|
|
47
|
+
import { BulletList as Ot } from "@tiptap/extension-bullet-list";
|
|
48
|
+
import { CodeBlock as kt } from "@tiptap/extension-code-block";
|
|
49
|
+
import { Document as At } from "@tiptap/extension-document";
|
|
50
|
+
import { DragHandle as jt } from "@tiptap/extension-drag-handle";
|
|
51
|
+
import { Dropcursor as Mt } from "@tiptap/extension-dropcursor";
|
|
52
|
+
import { Gapcursor as Nt } from "@tiptap/extension-gapcursor";
|
|
53
|
+
import { HardBreak as Pt } from "@tiptap/extension-hard-break";
|
|
54
|
+
import { Heading as Ft } from "@tiptap/extension-heading";
|
|
55
|
+
import { Link as It } from "@tiptap/extension-link";
|
|
56
|
+
import { ListItem as Lt } from "@tiptap/extension-list-item";
|
|
57
|
+
import { ListKeymap as Rt } from "@tiptap/extension-list-keymap";
|
|
58
|
+
import { OrderedList as zt } from "@tiptap/extension-ordered-list";
|
|
59
|
+
import { Paragraph as Bt } from "@tiptap/extension-paragraph";
|
|
60
|
+
import { Text as Vt } from "@tiptap/extension-text";
|
|
61
|
+
import { TextAlign as Ht } from "@tiptap/extension-text-align";
|
|
62
|
+
import { Underline as Ut } from "@tiptap/extension-underline";
|
|
63
|
+
import { AiOutlineRedo as Wt, AiOutlineUndo as Gt } from "react-icons/ai";
|
|
64
|
+
import { RiFormatClear as Kt } from "react-icons/ri";
|
|
65
|
+
import { BsFileEarmark as qt } from "react-icons/bs";
|
|
66
|
+
import { useDropzone as Jt } from "react-dropzone";
|
|
67
|
+
//#region \0rolldown/runtime.js
|
|
68
|
+
var Yt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Zt = Object.getOwnPropertyNames, Qt = Object.prototype.hasOwnProperty, $t = (e, t) => {
|
|
69
|
+
let n = {};
|
|
70
|
+
for (var r in e) Yt(n, r, {
|
|
71
|
+
get: e[r],
|
|
72
|
+
enumerable: !0
|
|
73
|
+
});
|
|
74
|
+
return t || Yt(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
75
|
+
}, en = (e, t, n, r) => {
|
|
76
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = Zt(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Qt.call(e, s) && s !== n && Yt(e, s, {
|
|
77
|
+
get: ((e) => t[e]).bind(null, s),
|
|
78
|
+
enumerable: !(r = Xt(t, s)) || r.enumerable
|
|
79
|
+
});
|
|
80
|
+
return e;
|
|
81
|
+
}, tn = (e, t, n) => (en(e, t, "default"), n && en(n, t, "default")), nn = { baseSpacing: "var(--_1wlnmgm0)" }, rn = (e, t) => {
|
|
82
|
+
let n = {};
|
|
83
|
+
for (let r of Object.keys(t)) {
|
|
84
|
+
let i = t[r], a = e[r];
|
|
85
|
+
if (!(i === void 0 || a === void 0)) if (typeof i == "object" && i && !Array.isArray(i)) {
|
|
86
|
+
let e = rn(a, i);
|
|
87
|
+
Object.assign(n, e);
|
|
88
|
+
} else typeof a == "string" && (n[a] = String(i));
|
|
89
|
+
}
|
|
90
|
+
return n;
|
|
91
|
+
}, an = ((e) => (t) => t ? ve(rn(e, t)) : {})(nn), on = { spin: "_spin_1m7wt_7" }, sn = ({ size: e = "20px", className: t, ...n }) => /* @__PURE__ */ w(se, {
|
|
92
|
+
className: I(on.spin, t),
|
|
93
|
+
size: e,
|
|
94
|
+
...n
|
|
95
|
+
}), R = {
|
|
96
|
+
button: "_button_11egm_2",
|
|
97
|
+
variantDefault: "_variantDefault_11egm_28",
|
|
98
|
+
schemeDefault: "_schemeDefault_11egm_32",
|
|
99
|
+
schemeSecondary: "_schemeSecondary_11egm_41",
|
|
100
|
+
schemeDestructive: "_schemeDestructive_11egm_50",
|
|
101
|
+
variantOutline: "_variantOutline_11egm_59",
|
|
102
|
+
variantGhost: "_variantGhost_11egm_81",
|
|
103
|
+
variantLink: "_variantLink_11egm_107",
|
|
104
|
+
sizeDefault: "_sizeDefault_11egm_125",
|
|
105
|
+
sizeXs: "_sizeXs_11egm_131",
|
|
106
|
+
sizeSm: "_sizeSm_11egm_137",
|
|
107
|
+
sizeLg: "_sizeLg_11egm_143",
|
|
108
|
+
sizeIcon: "_sizeIcon_11egm_149",
|
|
109
|
+
sizeIconSmall: "_sizeIconSmall_11egm_155"
|
|
110
|
+
}, cn = Ye(R.button, {
|
|
111
|
+
variants: {
|
|
112
|
+
variant: {
|
|
113
|
+
default: R.variantDefault,
|
|
114
|
+
outline: R.variantOutline,
|
|
115
|
+
ghost: R.variantGhost,
|
|
116
|
+
link: R.variantLink
|
|
117
|
+
},
|
|
118
|
+
scheme: {
|
|
119
|
+
default: R.schemeDefault,
|
|
120
|
+
secondary: R.schemeSecondary,
|
|
121
|
+
destructive: R.schemeDestructive
|
|
122
|
+
},
|
|
123
|
+
size: {
|
|
124
|
+
default: R.sizeDefault,
|
|
125
|
+
xs: R.sizeXs,
|
|
126
|
+
sm: R.sizeSm,
|
|
127
|
+
lg: R.sizeLg,
|
|
128
|
+
icon: R.sizeIcon,
|
|
129
|
+
"icon-small": R.sizeIconSmall
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: {
|
|
133
|
+
variant: "default",
|
|
134
|
+
size: "default",
|
|
135
|
+
scheme: "default"
|
|
136
|
+
}
|
|
137
|
+
}), z = u.forwardRef(({ className: e, variant: t, size: n, scheme: r, asChild: i = !1, isLoading: a = !1, loadingText: o, disabled: s, children: c, leftIcon: l, rightIcon: u, ...d }, f) => /* @__PURE__ */ T(i ? me.Root : "button", {
|
|
138
|
+
className: I(cn({
|
|
139
|
+
variant: t,
|
|
140
|
+
size: n,
|
|
141
|
+
scheme: r,
|
|
142
|
+
className: e
|
|
143
|
+
})),
|
|
144
|
+
ref: f,
|
|
145
|
+
disabled: s || a,
|
|
146
|
+
type: "button",
|
|
147
|
+
...d,
|
|
148
|
+
children: [
|
|
149
|
+
a ? /* @__PURE__ */ w(C, { children: /* @__PURE__ */ w(sn, { size: 20 }) }) : l,
|
|
150
|
+
a && o ? o : c,
|
|
151
|
+
u
|
|
152
|
+
]
|
|
153
|
+
}));
|
|
154
|
+
z.displayName = "Button";
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../../libraries/react-collection/dist/styles/theme.module.css.js
|
|
157
|
+
var ln = {
|
|
158
|
+
defaultTheme: "_defaultTheme_dq4ji_1",
|
|
159
|
+
singleFieldDefaultTheme: "_singleFieldDefaultTheme_dq4ji_62",
|
|
160
|
+
reset: "_reset_dq4ji_82"
|
|
161
|
+
}, un = p({ themeClass: "" }), dn = ({ children: e, className: t, style: n, cssReset: r, variant: i }) => {
|
|
162
|
+
let a = I(r && ln.reset, ln.defaultTheme, (i === "single-field" || i === "steps-2") && ln.singleFieldDefaultTheme, t);
|
|
163
|
+
return /* @__PURE__ */ w(un.Provider, {
|
|
164
|
+
value: {
|
|
165
|
+
themeClass: a,
|
|
166
|
+
style: n,
|
|
167
|
+
cssReset: r
|
|
168
|
+
},
|
|
169
|
+
children: /* @__PURE__ */ w("div", {
|
|
170
|
+
className: a,
|
|
171
|
+
style: n,
|
|
172
|
+
children: e
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
}, fn = () => {
|
|
176
|
+
try {
|
|
177
|
+
return _(un);
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}, pn = { text: "_text_ridnf_1" }, mn = ({ children: e }) => /* @__PURE__ */ w("p", {
|
|
182
|
+
className: pn.text,
|
|
183
|
+
children: e
|
|
184
|
+
}), hn = {
|
|
185
|
+
label: "_label_1ddgp_1",
|
|
186
|
+
dot: "_dot_1ddgp_13"
|
|
187
|
+
}, B = ({ children: e, isRequired: t, className: n, ...r }) => /* @__PURE__ */ T("label", {
|
|
188
|
+
className: I(hn.label, n),
|
|
189
|
+
...r,
|
|
190
|
+
children: [
|
|
191
|
+
e,
|
|
192
|
+
" ",
|
|
193
|
+
t && /* @__PURE__ */ w("span", {
|
|
194
|
+
className: hn.dot,
|
|
195
|
+
children: "*"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}), gn = {
|
|
199
|
+
tabsList: "_tabsList_1ntc2_1",
|
|
200
|
+
tabsTrigger: "_tabsTrigger_1ntc2_12",
|
|
201
|
+
tabsContent: "_tabsContent_1ntc2_47"
|
|
202
|
+
}, _n = ge.Root, vn = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(ge.List, {
|
|
203
|
+
ref: n,
|
|
204
|
+
className: I(gn.tabsList, e),
|
|
205
|
+
...t
|
|
206
|
+
}));
|
|
207
|
+
vn.displayName = ge.List.displayName;
|
|
208
|
+
var yn = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(ge.Trigger, {
|
|
209
|
+
ref: n,
|
|
210
|
+
className: I(gn.tabsTrigger, e),
|
|
211
|
+
...t
|
|
212
|
+
}));
|
|
213
|
+
yn.displayName = ge.Trigger.displayName;
|
|
214
|
+
var bn = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(ge.Content, {
|
|
215
|
+
ref: n,
|
|
216
|
+
className: I(gn.tabsContent, e),
|
|
217
|
+
...t
|
|
218
|
+
}));
|
|
219
|
+
bn.displayName = ge.Content.displayName;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region ../../libraries/react-collection/dist/form/renderer/renderer.module.css.js
|
|
222
|
+
var V = {
|
|
223
|
+
wrapper: "_wrapper_1x68h_1",
|
|
224
|
+
tabs: "_tabs_1x68h_7",
|
|
225
|
+
tabsWrapper: "_tabsWrapper_1x68h_11",
|
|
226
|
+
tabsList: "_tabsList_1x68h_18",
|
|
227
|
+
addBtn: "_addBtn_1x68h_27",
|
|
228
|
+
btnIcon: "_btnIcon_1x68h_32",
|
|
229
|
+
tabsContent: "_tabsContent_1x68h_37",
|
|
230
|
+
fieldsWrapper: "_fieldsWrapper_1x68h_42",
|
|
231
|
+
itemBtnWrapper: "_itemBtnWrapper_1x68h_49",
|
|
232
|
+
itemBtn: "_itemBtn_1x68h_49",
|
|
233
|
+
itemBtnRemove: "_itemBtnRemove_1x68h_62",
|
|
234
|
+
recordFieldsWrapper: "_recordFieldsWrapper_1x68h_67",
|
|
235
|
+
textWrapper: "_textWrapper_1x68h_77"
|
|
236
|
+
}, xn = ({ field: e, schema: t, ...n }) => {
|
|
237
|
+
let { key: r = "", label: i = "", field_interface: a = "", fields: o = [] } = e, [l, u] = S("0"), { formState: d } = et(), { fields: f, ...p } = Qe({
|
|
238
|
+
name: r,
|
|
239
|
+
rules: s(e)
|
|
240
|
+
}), m = Ze(d.errors, r)?.root?.message;
|
|
241
|
+
return !a || !r ? null : /* @__PURE__ */ T("div", {
|
|
242
|
+
className: V.wrapper,
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ w(B, {
|
|
245
|
+
isRequired: e?.required,
|
|
246
|
+
children: i
|
|
247
|
+
}),
|
|
248
|
+
f && Array.isArray(f) ? /* @__PURE__ */ T(_n, {
|
|
249
|
+
value: l,
|
|
250
|
+
onValueChange: u,
|
|
251
|
+
className: V.tabs,
|
|
252
|
+
children: [/* @__PURE__ */ T("div", {
|
|
253
|
+
className: V.tabsWrapper,
|
|
254
|
+
children: [f.length ? /* @__PURE__ */ w(vn, {
|
|
255
|
+
className: V.tabsList,
|
|
256
|
+
children: f?.map((t, n) => /* @__PURE__ */ w(yn, {
|
|
257
|
+
id: `${e?.key}-${n}`,
|
|
258
|
+
value: n.toString(),
|
|
259
|
+
children: n + 1
|
|
260
|
+
}, `array-widget-tab-${e?.id}-${n}`))
|
|
261
|
+
}) : null, /* @__PURE__ */ T(z, {
|
|
262
|
+
variant: "ghost",
|
|
263
|
+
size: "xs",
|
|
264
|
+
className: V.addBtn,
|
|
265
|
+
onClick: () => {
|
|
266
|
+
p.append(c(o)), u((f?.length ?? 0).toString());
|
|
267
|
+
},
|
|
268
|
+
children: [/* @__PURE__ */ w(_t, {
|
|
269
|
+
className: V.btnIcon,
|
|
270
|
+
size: "14px"
|
|
271
|
+
}), "Add"]
|
|
272
|
+
})]
|
|
273
|
+
}), f?.map((i, a) => /* @__PURE__ */ T(bn, {
|
|
274
|
+
className: V.tabsContent,
|
|
275
|
+
value: a.toString(),
|
|
276
|
+
children: [/* @__PURE__ */ w("div", {
|
|
277
|
+
className: V.fieldsWrapper,
|
|
278
|
+
children: o.map((e) => /* @__PURE__ */ w(Zr, {
|
|
279
|
+
field: {
|
|
280
|
+
...e,
|
|
281
|
+
key: `${r}.${a}.${e?.key}`
|
|
282
|
+
},
|
|
283
|
+
schema: t ?? null,
|
|
284
|
+
...n
|
|
285
|
+
}, `common-fields-${e?.id}`))
|
|
286
|
+
}), /* @__PURE__ */ T("div", {
|
|
287
|
+
className: V.itemBtnWrapper,
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ w(z, {
|
|
290
|
+
onClick: () => {
|
|
291
|
+
u((a - 1).toString()), p.move(a, a - 1);
|
|
292
|
+
},
|
|
293
|
+
disabled: a === 0,
|
|
294
|
+
size: "icon",
|
|
295
|
+
className: V.itemBtn,
|
|
296
|
+
children: /* @__PURE__ */ w(st, { size: "24px" })
|
|
297
|
+
}),
|
|
298
|
+
/* @__PURE__ */ w(z, {
|
|
299
|
+
className: V.itemBtnRemove,
|
|
300
|
+
variant: "link",
|
|
301
|
+
onClick: () => {
|
|
302
|
+
u((a - 1).toString()), p.remove(a);
|
|
303
|
+
},
|
|
304
|
+
children: "Remove Item"
|
|
305
|
+
}),
|
|
306
|
+
/* @__PURE__ */ w(z, {
|
|
307
|
+
className: V.itemBtn,
|
|
308
|
+
onClick: () => {
|
|
309
|
+
u((a + 1).toString()), p.move(a, a + 1);
|
|
310
|
+
},
|
|
311
|
+
disabled: a >= f.length - 1,
|
|
312
|
+
size: "icon",
|
|
313
|
+
children: /* @__PURE__ */ w(ct, { size: "24px" })
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
})]
|
|
317
|
+
}, `array-widget-tab-content-${e?.id}-${a}`))]
|
|
318
|
+
}) : /* @__PURE__ */ T(z, {
|
|
319
|
+
variant: "ghost",
|
|
320
|
+
size: "xs",
|
|
321
|
+
onClick: () => {
|
|
322
|
+
p.append(c(o)), u("0");
|
|
323
|
+
},
|
|
324
|
+
children: [/* @__PURE__ */ w(_t, {
|
|
325
|
+
className: V.btnIcon,
|
|
326
|
+
size: "14px"
|
|
327
|
+
}), "Add"]
|
|
328
|
+
}),
|
|
329
|
+
!!m && /* @__PURE__ */ w("div", {
|
|
330
|
+
className: V.textWrapper,
|
|
331
|
+
children: /* @__PURE__ */ w(mn, { children: m })
|
|
332
|
+
})
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
}, Sn = { input: "_input_3nf3f_1" }, Cn = { text: "_text_uy016_1" }, wn = ({ children: e }) => /* @__PURE__ */ w("p", {
|
|
336
|
+
className: Cn.text,
|
|
337
|
+
children: e
|
|
338
|
+
}), Tn = {
|
|
339
|
+
wrapper: "_wrapper_1vhoh_1",
|
|
340
|
+
readOnly: "_readOnly_1vhoh_5",
|
|
341
|
+
container: "_container_1vhoh_9",
|
|
342
|
+
topTextWrapper: "_topTextWrapper_1vhoh_13",
|
|
343
|
+
textWrapper: "_textWrapper_1vhoh_18"
|
|
344
|
+
}, H = m(({ error: e, helperText: t, topHelperText: n, containerStyles: r, readOnly: i, label: a, labelStyles: o, isRequired: s, htmlFor: c, children: l }, u) => /* @__PURE__ */ w("div", {
|
|
345
|
+
className: I(Tn.wrapper, i ? Tn.readOnly : "", r),
|
|
346
|
+
ref: u,
|
|
347
|
+
children: /* @__PURE__ */ T("div", {
|
|
348
|
+
className: Tn.container,
|
|
349
|
+
children: [
|
|
350
|
+
!!a && /* @__PURE__ */ w(B, {
|
|
351
|
+
className: o,
|
|
352
|
+
htmlFor: c,
|
|
353
|
+
isRequired: s,
|
|
354
|
+
children: a
|
|
355
|
+
}),
|
|
356
|
+
!!n && /* @__PURE__ */ w("div", {
|
|
357
|
+
className: Tn.topTextWrapper,
|
|
358
|
+
children: /* @__PURE__ */ w(wn, { children: n })
|
|
359
|
+
}),
|
|
360
|
+
l,
|
|
361
|
+
!!e && /* @__PURE__ */ w("div", {
|
|
362
|
+
className: Tn.textWrapper,
|
|
363
|
+
children: /* @__PURE__ */ w(mn, { children: e })
|
|
364
|
+
}),
|
|
365
|
+
!!t && /* @__PURE__ */ w("div", {
|
|
366
|
+
className: Tn.textWrapper,
|
|
367
|
+
children: /* @__PURE__ */ w(wn, { children: t })
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
})
|
|
371
|
+
}));
|
|
372
|
+
H.displayName = "FieldWrapper";
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region ../../libraries/react-collection/dist/styles/select.module.css.js
|
|
375
|
+
var U = {
|
|
376
|
+
container: "_container_mce6z_1",
|
|
377
|
+
controlDisabled: "_controlDisabled_mce6z_8",
|
|
378
|
+
controlFocused: "_controlFocused_mce6z_13",
|
|
379
|
+
controlMulti: "_controlMulti_mce6z_17",
|
|
380
|
+
controlSingle: "_controlSingle_mce6z_22",
|
|
381
|
+
valueContainer: "_valueContainer_mce6z_27",
|
|
382
|
+
loadingMessage: "_loadingMessage_mce6z_35",
|
|
383
|
+
multiValue: "_multiValue_mce6z_39",
|
|
384
|
+
multiValueRemove: "_multiValueRemove_mce6z_48",
|
|
385
|
+
clearIndicator: "_clearIndicator_mce6z_60",
|
|
386
|
+
dropdownIndicator: "_dropdownIndicator_mce6z_71",
|
|
387
|
+
menu: "_menu_mce6z_77",
|
|
388
|
+
menuPortal: "_menuPortal_mce6z_85",
|
|
389
|
+
groupHeading: "_groupHeading_mce6z_90",
|
|
390
|
+
placeholder: "_placeholder_mce6z_98",
|
|
391
|
+
option: "_option_mce6z_105",
|
|
392
|
+
optionFocused: "_optionFocused_mce6z_114",
|
|
393
|
+
optionSelected: "_optionSelected_mce6z_122",
|
|
394
|
+
noOptionsMessage: "_noOptionsMessage_mce6z_127"
|
|
395
|
+
}, En = {
|
|
396
|
+
container: () => U.container,
|
|
397
|
+
control: ({ isFocused: e, isMulti: t, isDisabled: n }) => I(Sn.input, t ? U.controlMulti : U.controlSingle, e && U.controlFocused, n && U.controlDisabled),
|
|
398
|
+
input: () => "",
|
|
399
|
+
valueContainer: () => U.valueContainer,
|
|
400
|
+
loadingMessage: () => U.loadingMessage,
|
|
401
|
+
singleValue: () => "",
|
|
402
|
+
multiValue: () => U.multiValue,
|
|
403
|
+
multiValueRemove: () => U.multiValueRemove,
|
|
404
|
+
indicatorsContainer: () => "",
|
|
405
|
+
clearIndicator: () => U.clearIndicator,
|
|
406
|
+
indicatorSeparator: () => "",
|
|
407
|
+
dropdownIndicator: () => U.dropdownIndicator,
|
|
408
|
+
menu: () => U.menu,
|
|
409
|
+
groupHeading: () => U.groupHeading,
|
|
410
|
+
placeholder: () => U.placeholder,
|
|
411
|
+
option: ({ isSelected: e, isFocused: t }) => I(U.option, t && U.optionFocused, e && U.optionSelected),
|
|
412
|
+
noOptionsMessage: () => U.noOptionsMessage,
|
|
413
|
+
menuPortal: () => U.menuPortal
|
|
414
|
+
}, Dn = d.lazy(() => import("react-select-async-paginate").then((e) => ({ default: e.AsyncPaginate }))), On = (e) => /* @__PURE__ */ w(Dn, {
|
|
415
|
+
isClearable: !0,
|
|
416
|
+
menuPlacement: "auto",
|
|
417
|
+
isSearchable: !0,
|
|
418
|
+
unstyled: !0,
|
|
419
|
+
classNames: En,
|
|
420
|
+
loadingMessage: () => /* @__PURE__ */ w(sn, {}),
|
|
421
|
+
...e
|
|
422
|
+
}), kn = {
|
|
423
|
+
tooltipContent: "_tooltipContent_s2a3f_1",
|
|
424
|
+
fadeOut: "_fadeOut_s2a3f_1",
|
|
425
|
+
zoomOut: "_zoomOut_s2a3f_1",
|
|
426
|
+
fadeIn: "_fadeIn_s2a3f_1",
|
|
427
|
+
zoomIn: "_zoomIn_s2a3f_1",
|
|
428
|
+
slideFromTop: "_slideFromTop_s2a3f_1",
|
|
429
|
+
slideFromBottom: "_slideFromBottom_s2a3f_1",
|
|
430
|
+
slideFromRight: "_slideFromRight_s2a3f_1",
|
|
431
|
+
slideFromLeft: "_slideFromLeft_s2a3f_1"
|
|
432
|
+
}, An = _e.Provider, jn = _e.Root, Mn = _e.Trigger, Nn = _e.Portal, Pn = u.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__PURE__ */ w(_e.Content, {
|
|
433
|
+
ref: r,
|
|
434
|
+
sideOffset: t,
|
|
435
|
+
className: I(kn.tooltipContent, e),
|
|
436
|
+
...n
|
|
437
|
+
}));
|
|
438
|
+
Pn.displayName = _e.Content.displayName;
|
|
439
|
+
var Fn = ({ children: e, label: t, className: n, asChild: r = !0, contentProps: i = {} }) => /* @__PURE__ */ T(jn, { children: [t && /* @__PURE__ */ w(Nn, { children: /* @__PURE__ */ w(Pn, {
|
|
440
|
+
className: I(ln.defaultTheme, n?.label),
|
|
441
|
+
...i,
|
|
442
|
+
children: /* @__PURE__ */ w("p", {
|
|
443
|
+
className: n?.content,
|
|
444
|
+
children: t
|
|
445
|
+
})
|
|
446
|
+
}) }), /* @__PURE__ */ w(Mn, {
|
|
447
|
+
asChild: r,
|
|
448
|
+
children: e
|
|
449
|
+
})] }), In = (e) => e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : "", W = {
|
|
450
|
+
wrapper: "_wrapper_4yrz7_1",
|
|
451
|
+
valueWrapper: "_valueWrapper_4yrz7_9",
|
|
452
|
+
listingHeading: "_listingHeading_4yrz7_16",
|
|
453
|
+
loaderSmall: "_loaderSmall_4yrz7_25",
|
|
454
|
+
loadingWrapper: "_loadingWrapper_4yrz7_30",
|
|
455
|
+
loader: "_loader_4yrz7_25",
|
|
456
|
+
listContainer: "_listContainer_4yrz7_42",
|
|
457
|
+
listItem: "_listItem_4yrz7_48",
|
|
458
|
+
itemText: "_itemText_4yrz7_59",
|
|
459
|
+
paginationContainer: "_paginationContainer_4yrz7_66",
|
|
460
|
+
infoText: "_infoText_4yrz7_73",
|
|
461
|
+
controlsWrapper: "_controlsWrapper_4yrz7_79",
|
|
462
|
+
pageInfo: "_pageInfo_4yrz7_91",
|
|
463
|
+
buttonGroup: "_buttonGroup_4yrz7_100",
|
|
464
|
+
icon: "_icon_4yrz7_106",
|
|
465
|
+
selectSmall: "_selectSmall_4yrz7_111"
|
|
466
|
+
}, Ln = ({ field: e, settings: t }) => {
|
|
467
|
+
let { collection: n } = M(), [r, i] = S(!1), [a, o] = S(!1), [c, l] = S([]), [u, d] = S(1), [f, p] = S(5), [m, h] = S(0), [g, _] = S(0), { key: y = "", label: b = "", helper_text: x = "", readonly: E = !1 } = e, D = y, O = e?.options?.collection_key || "", k = e?.options?.label_field_key || "", { field: { value: A, onChange: te, ref: j }, fieldState: ne } = L({
|
|
468
|
+
name: D,
|
|
469
|
+
rules: s(e)
|
|
470
|
+
}), N = !!e?.required, re = ne?.error?.message, ie = async () => {
|
|
471
|
+
i(!0);
|
|
472
|
+
try {
|
|
473
|
+
let e = await n?.getCollectionContentList({
|
|
474
|
+
collection_key: O,
|
|
475
|
+
page: u,
|
|
476
|
+
limit: f,
|
|
477
|
+
where: { _id: { in: A } }
|
|
478
|
+
}), t = e?.content?.data ?? [], r = e?.content?.meta?.pages ?? 0;
|
|
479
|
+
h(e?.content?.meta?.total ?? 0), _(r), u > r && d(r), l(t);
|
|
480
|
+
} catch (e) {
|
|
481
|
+
ee(e);
|
|
482
|
+
} finally {
|
|
483
|
+
i(!1);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
return v(() => {
|
|
487
|
+
A?.length > 0 && ie();
|
|
488
|
+
}, [
|
|
489
|
+
A,
|
|
490
|
+
u,
|
|
491
|
+
f
|
|
492
|
+
]), /* @__PURE__ */ T("div", {
|
|
493
|
+
className: W.wrapper,
|
|
494
|
+
children: [/* @__PURE__ */ w(H, {
|
|
495
|
+
ref: j,
|
|
496
|
+
error: re,
|
|
497
|
+
helperText: x,
|
|
498
|
+
readOnly: E,
|
|
499
|
+
label: b,
|
|
500
|
+
htmlFor: D,
|
|
501
|
+
isRequired: N,
|
|
502
|
+
children: /* @__PURE__ */ w(On, {
|
|
503
|
+
id: D,
|
|
504
|
+
value: [],
|
|
505
|
+
onChange: (e) => {
|
|
506
|
+
e?.value?._id && te([...A, e?.value?._id]);
|
|
507
|
+
},
|
|
508
|
+
placeholder: Array.isArray(A) && A?.length > 0 ? "Select more" : "Select",
|
|
509
|
+
filterOption: (e) => !A?.includes(e?.value?._id),
|
|
510
|
+
loadOptions: async (e, t, { page: r = 1 }) => {
|
|
511
|
+
o(!0);
|
|
512
|
+
try {
|
|
513
|
+
let t = (await n?.getCollectionContentList({
|
|
514
|
+
collection_key: O,
|
|
515
|
+
page: r,
|
|
516
|
+
search: e,
|
|
517
|
+
limit: 10,
|
|
518
|
+
where: { _id: { not_in: A } }
|
|
519
|
+
}))?.content?.data, i = (t || []).map((e) => {
|
|
520
|
+
let t = e?.[k] ? e?.[k] : In(e?.slug ?? "");
|
|
521
|
+
return {
|
|
522
|
+
value: {
|
|
523
|
+
_id: e?._id,
|
|
524
|
+
slug: e?.slug,
|
|
525
|
+
[k]: e?.[k]
|
|
526
|
+
},
|
|
527
|
+
label: t
|
|
528
|
+
};
|
|
529
|
+
});
|
|
530
|
+
return {
|
|
531
|
+
options: Array.isArray(i) ? i : [],
|
|
532
|
+
hasMore: t && !(t?.length < 10),
|
|
533
|
+
additional: { page: r + 1 }
|
|
534
|
+
};
|
|
535
|
+
} catch {
|
|
536
|
+
return {
|
|
537
|
+
options: [],
|
|
538
|
+
hasMore: !1,
|
|
539
|
+
additional: { page: r }
|
|
540
|
+
};
|
|
541
|
+
} finally {
|
|
542
|
+
o(!1);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
debounceTimeout: 500,
|
|
546
|
+
getOptionLabel: (e) => e?.label,
|
|
547
|
+
getOptionValue: (e) => e?.value,
|
|
548
|
+
isLoading: a,
|
|
549
|
+
additional: { page: 1 },
|
|
550
|
+
cacheUniqs: [O],
|
|
551
|
+
minMenuHeight: 250
|
|
552
|
+
})
|
|
553
|
+
}), Array.isArray(A) && A?.length > 0 && /* @__PURE__ */ T("div", {
|
|
554
|
+
className: W.valueWrapper,
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ T("h4", {
|
|
557
|
+
className: W.listingHeading,
|
|
558
|
+
children: [/* @__PURE__ */ w("span", { children: "Selected" }), r && c?.length > 0 && /* @__PURE__ */ w(sn, { className: W.loaderSmall })]
|
|
559
|
+
}),
|
|
560
|
+
/* @__PURE__ */ w("div", {
|
|
561
|
+
className: I(W.listContainer),
|
|
562
|
+
children: c.map((e) => /* @__PURE__ */ T("div", {
|
|
563
|
+
className: W.listItem,
|
|
564
|
+
children: [/* @__PURE__ */ w("div", {
|
|
565
|
+
className: W.itemText,
|
|
566
|
+
children: e?.[k]
|
|
567
|
+
}), /* @__PURE__ */ w(z, {
|
|
568
|
+
disabled: r,
|
|
569
|
+
size: "icon-small",
|
|
570
|
+
scheme: "secondary",
|
|
571
|
+
variant: "ghost",
|
|
572
|
+
children: /* @__PURE__ */ w(ue, {
|
|
573
|
+
size: 16,
|
|
574
|
+
onClick: () => {
|
|
575
|
+
te(A?.filter((t) => t !== e?._id));
|
|
576
|
+
}
|
|
577
|
+
})
|
|
578
|
+
})]
|
|
579
|
+
}, e?._id))
|
|
580
|
+
}),
|
|
581
|
+
r && c?.length === 0 ? /* @__PURE__ */ w("div", {
|
|
582
|
+
className: W.loadingWrapper,
|
|
583
|
+
children: /* @__PURE__ */ w(sn, { className: W.loader })
|
|
584
|
+
}) : null,
|
|
585
|
+
A?.length > 5 && /* @__PURE__ */ T("div", {
|
|
586
|
+
className: W.paginationContainer,
|
|
587
|
+
children: [
|
|
588
|
+
/* @__PURE__ */ T("div", {
|
|
589
|
+
className: W.infoText,
|
|
590
|
+
children: [
|
|
591
|
+
"Showing",
|
|
592
|
+
" ",
|
|
593
|
+
m ? /* @__PURE__ */ T(C, { children: [
|
|
594
|
+
f * (u - 1) + 1,
|
|
595
|
+
"-",
|
|
596
|
+
Math.min(f * u, m),
|
|
597
|
+
" of",
|
|
598
|
+
" "
|
|
599
|
+
] }) : null,
|
|
600
|
+
" ",
|
|
601
|
+
m,
|
|
602
|
+
" items"
|
|
603
|
+
]
|
|
604
|
+
}),
|
|
605
|
+
/* @__PURE__ */ w("div", {
|
|
606
|
+
style: { width: "fit-content" },
|
|
607
|
+
children: /* @__PURE__ */ T("select", {
|
|
608
|
+
className: I(Sn.input, W.selectSmall),
|
|
609
|
+
value: f,
|
|
610
|
+
onChange: (e) => {
|
|
611
|
+
d(1), p(Number(e.target.value));
|
|
612
|
+
},
|
|
613
|
+
style: { cursor: "pointer" },
|
|
614
|
+
children: [
|
|
615
|
+
/* @__PURE__ */ w("option", {
|
|
616
|
+
value: 5,
|
|
617
|
+
children: "5"
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ w("option", {
|
|
620
|
+
value: 10,
|
|
621
|
+
children: "10"
|
|
622
|
+
}),
|
|
623
|
+
/* @__PURE__ */ w("option", {
|
|
624
|
+
value: 25,
|
|
625
|
+
children: "25"
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ w("option", {
|
|
628
|
+
value: 50,
|
|
629
|
+
children: "50"
|
|
630
|
+
})
|
|
631
|
+
]
|
|
632
|
+
})
|
|
633
|
+
}),
|
|
634
|
+
/* @__PURE__ */ w("div", {
|
|
635
|
+
className: W.controlsWrapper,
|
|
636
|
+
children: /* @__PURE__ */ w(An, { children: /* @__PURE__ */ T("div", {
|
|
637
|
+
className: W.buttonGroup,
|
|
638
|
+
children: [
|
|
639
|
+
/* @__PURE__ */ w(Fn, {
|
|
640
|
+
label: "Go to first page",
|
|
641
|
+
children: /* @__PURE__ */ w(z, {
|
|
642
|
+
onClick: () => d(1),
|
|
643
|
+
disabled: u === 1,
|
|
644
|
+
variant: "ghost",
|
|
645
|
+
size: "icon-small",
|
|
646
|
+
children: /* @__PURE__ */ w(bt, { className: W.icon })
|
|
647
|
+
})
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ w(Fn, {
|
|
650
|
+
label: "Go to previous page",
|
|
651
|
+
children: /* @__PURE__ */ w(z, {
|
|
652
|
+
disabled: u === 1,
|
|
653
|
+
onClick: () => d(u - 1),
|
|
654
|
+
variant: "ghost",
|
|
655
|
+
size: "icon-small",
|
|
656
|
+
children: /* @__PURE__ */ w(vt, { className: W.icon })
|
|
657
|
+
})
|
|
658
|
+
}),
|
|
659
|
+
/* @__PURE__ */ w(Fn, {
|
|
660
|
+
label: "Go to next page",
|
|
661
|
+
children: /* @__PURE__ */ w(z, {
|
|
662
|
+
onClick: () => d(u + 1),
|
|
663
|
+
disabled: u === g,
|
|
664
|
+
variant: "ghost",
|
|
665
|
+
size: "icon-small",
|
|
666
|
+
children: /* @__PURE__ */ w(yt, { className: W.icon })
|
|
667
|
+
})
|
|
668
|
+
}),
|
|
669
|
+
/* @__PURE__ */ w(Fn, {
|
|
670
|
+
label: "Go to last page",
|
|
671
|
+
children: /* @__PURE__ */ w(z, {
|
|
672
|
+
onClick: () => d(g),
|
|
673
|
+
disabled: u === g,
|
|
674
|
+
variant: "ghost",
|
|
675
|
+
size: "icon-small",
|
|
676
|
+
children: /* @__PURE__ */ w(xt, { className: W.icon })
|
|
677
|
+
})
|
|
678
|
+
})
|
|
679
|
+
]
|
|
680
|
+
}) })
|
|
681
|
+
})
|
|
682
|
+
]
|
|
683
|
+
}),
|
|
684
|
+
" "
|
|
685
|
+
]
|
|
686
|
+
})]
|
|
687
|
+
});
|
|
688
|
+
}, Rn = ({ field: e, settings: t }) => {
|
|
689
|
+
let { collection: n } = M(), [r, i] = S(!1), { key: a = "", label: o = "", helper_text: c = "", readonly: l = !1 } = e, u = a, d = e?.options?.collection_key || "", f = e?.options?.label_field_key || "", { field: { value: p, onBlur: m, onChange: h, ref: g, disabled: _, ...v }, fieldState: y } = L({
|
|
690
|
+
name: u,
|
|
691
|
+
rules: s(e)
|
|
692
|
+
}), b = !!e?.required, x = y?.error?.message, C = async (e, t, { page: r = 1 }) => {
|
|
693
|
+
i(!0);
|
|
694
|
+
try {
|
|
695
|
+
let t = (await n?.getCollectionContentList({
|
|
696
|
+
collection_key: d,
|
|
697
|
+
page: r,
|
|
698
|
+
search: e,
|
|
699
|
+
limit: 10
|
|
700
|
+
}))?.content?.data, i = (t || []).map((e) => {
|
|
701
|
+
let t = e?.[f] ? e?.[f] : In(e?.slug || "");
|
|
702
|
+
return {
|
|
703
|
+
value: {
|
|
704
|
+
_id: e?._id,
|
|
705
|
+
slug: e?.slug,
|
|
706
|
+
[f]: e?.[f]
|
|
707
|
+
},
|
|
708
|
+
label: t
|
|
709
|
+
};
|
|
710
|
+
});
|
|
711
|
+
return {
|
|
712
|
+
options: Array.isArray(i) ? i : [],
|
|
713
|
+
hasMore: t && !(t?.length < 10),
|
|
714
|
+
additional: { page: r + 1 }
|
|
715
|
+
};
|
|
716
|
+
} catch {
|
|
717
|
+
return {
|
|
718
|
+
options: [],
|
|
719
|
+
hasMore: !1,
|
|
720
|
+
additional: { page: r }
|
|
721
|
+
};
|
|
722
|
+
} finally {
|
|
723
|
+
i(!1);
|
|
724
|
+
}
|
|
725
|
+
}, E = p ? {
|
|
726
|
+
label: p?.[f] ? p?.[f] : p?.slug ? In(p?.slug || "") : "",
|
|
727
|
+
value: {
|
|
728
|
+
_id: p?._id,
|
|
729
|
+
slug: p?.slug,
|
|
730
|
+
[f]: p?.[f]
|
|
731
|
+
}
|
|
732
|
+
} : null;
|
|
733
|
+
return /* @__PURE__ */ T(H, {
|
|
734
|
+
ref: g,
|
|
735
|
+
error: x,
|
|
736
|
+
helperText: c,
|
|
737
|
+
readOnly: l,
|
|
738
|
+
children: [o && /* @__PURE__ */ w(B, {
|
|
739
|
+
htmlFor: u,
|
|
740
|
+
isRequired: b,
|
|
741
|
+
children: o
|
|
742
|
+
}), /* @__PURE__ */ w(On, {
|
|
743
|
+
id: u,
|
|
744
|
+
value: E,
|
|
745
|
+
onChange: (e) => {
|
|
746
|
+
h(e?.value || null);
|
|
747
|
+
},
|
|
748
|
+
onBlur: () => {
|
|
749
|
+
m();
|
|
750
|
+
},
|
|
751
|
+
loadOptions: C,
|
|
752
|
+
debounceTimeout: 500,
|
|
753
|
+
getOptionLabel: (e) => e?.label,
|
|
754
|
+
getOptionValue: (e) => e?.value,
|
|
755
|
+
isLoading: r,
|
|
756
|
+
additional: { page: 1 },
|
|
757
|
+
cacheUniqs: [d],
|
|
758
|
+
minMenuHeight: 250,
|
|
759
|
+
isDisabled: _,
|
|
760
|
+
...v
|
|
761
|
+
})]
|
|
762
|
+
});
|
|
763
|
+
}, zn = (e) => {
|
|
764
|
+
let { field: t, ...n } = e, { field_interface: r, key: i, options: a = {} } = t;
|
|
765
|
+
return !r || !i ? null : !a?.collection_key || !a?.label_field_key ? (console.error("[LevoCollection]: Error while rendering collection widget. Collection key of label field key is required."), null) : a?.current_have_many_connected && !a?.connected_have_many_current ? (console.error("[LevoCollection]: O2M is not supported"), null) : a?.current_have_many_connected && a?.connected_have_many_current ? /* @__PURE__ */ w(Ln, {
|
|
766
|
+
...e,
|
|
767
|
+
schema: null
|
|
768
|
+
}) : /* @__PURE__ */ w(Rn, {
|
|
769
|
+
...e,
|
|
770
|
+
schema: null
|
|
771
|
+
});
|
|
772
|
+
}, Bn = {
|
|
773
|
+
checkbox: "_checkbox_e0hf5_1",
|
|
774
|
+
checkboxIndicator: "_checkboxIndicator_e0hf5_26",
|
|
775
|
+
checkboxCheck: "_checkboxCheck_e0hf5_33"
|
|
776
|
+
}, Vn = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(de.Root, {
|
|
777
|
+
ref: n,
|
|
778
|
+
className: I(Bn.checkbox, e),
|
|
779
|
+
...t,
|
|
780
|
+
children: /* @__PURE__ */ w(de.Indicator, {
|
|
781
|
+
className: Bn.checkboxIndicator,
|
|
782
|
+
children: /* @__PURE__ */ w(ie, { className: Bn.checkboxCheck })
|
|
783
|
+
})
|
|
784
|
+
}));
|
|
785
|
+
Vn.displayName = de.Root.displayName;
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region ../../libraries/react-collection/dist/components/Input/index.module.css.js
|
|
788
|
+
var Hn = {
|
|
789
|
+
inputWithLeftIcon: "_inputWithLeftIcon_f9cme_1",
|
|
790
|
+
inputWithRightIcon: "_inputWithRightIcon_f9cme_6",
|
|
791
|
+
wrapper: "_wrapper_f9cme_11",
|
|
792
|
+
iconBox: "_iconBox_f9cme_19",
|
|
793
|
+
leftIconBox: "_leftIconBox_f9cme_33",
|
|
794
|
+
rightIconBox: "_rightIconBox_f9cme_41"
|
|
795
|
+
}, G = d.forwardRef(({ className: e, leftIcon: t, rightIcon: n, leftIconBoxStyles: r, rightIconBoxStyles: i, containerStyles: a, ...o }, s) => /* @__PURE__ */ T("div", {
|
|
796
|
+
className: I(Hn.wrapper, a),
|
|
797
|
+
children: [
|
|
798
|
+
t ? /* @__PURE__ */ w("div", {
|
|
799
|
+
className: I(Hn.iconBox, Hn.leftIconBox, r),
|
|
800
|
+
children: t
|
|
801
|
+
}) : null,
|
|
802
|
+
/* @__PURE__ */ w("input", {
|
|
803
|
+
ref: s,
|
|
804
|
+
className: I(Sn.input, !!t && Hn.inputWithLeftIcon, !!n && Hn.inputWithRightIcon, e),
|
|
805
|
+
...o
|
|
806
|
+
}),
|
|
807
|
+
n ? /* @__PURE__ */ w("div", {
|
|
808
|
+
className: I(Hn.iconBox, Hn.rightIconBox, i),
|
|
809
|
+
children: n
|
|
810
|
+
}) : null
|
|
811
|
+
]
|
|
812
|
+
}));
|
|
813
|
+
G.displayName = "Input";
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region ../../libraries/react-collection/dist/widgets/checkboxWidget/index.module.css.js
|
|
816
|
+
var K = {
|
|
817
|
+
groupWrapper: "_groupWrapper_tchwr_1",
|
|
818
|
+
readOnly: "_readOnly_tchwr_10",
|
|
819
|
+
checkboxWrapper: "_checkboxWrapper_tchwr_15",
|
|
820
|
+
checkboxLabel: "_checkboxLabel_tchwr_23",
|
|
821
|
+
checkboxReset: "_checkboxReset_tchwr_29",
|
|
822
|
+
customInputWrapper: "_customInputWrapper_tchwr_33",
|
|
823
|
+
customInputCheckboxWrapper: "_customInputCheckboxWrapper_tchwr_42",
|
|
824
|
+
customInput: "_customInput_tchwr_33"
|
|
825
|
+
}, Un = ({ field: e }) => {
|
|
826
|
+
let [t, n] = S(""), [r, i] = S(!1), { key: a = "", label: o = "", helper_text: c = "", readonly: l = !1, values: u = [], options: d = {} } = e, { field: { name: f, onBlur: p, onChange: m, value: h, ref: g, disabled: _ }, fieldState: { error: y } } = L({
|
|
827
|
+
name: a,
|
|
828
|
+
rules: s(e)
|
|
829
|
+
}), b = (e) => {
|
|
830
|
+
let t = Array.isArray(h || null) ? [...h] : [];
|
|
831
|
+
t.includes(e) ? t = t?.filter((t) => t !== e) : t.push(e), m(t);
|
|
832
|
+
}, x = !!d?.custom_input;
|
|
833
|
+
return v(() => {
|
|
834
|
+
if (x) {
|
|
835
|
+
let e = !1;
|
|
836
|
+
(h ?? []).forEach((t) => {
|
|
837
|
+
u.includes(t) || (e = !0, n(t));
|
|
838
|
+
}), i(!!e);
|
|
839
|
+
}
|
|
840
|
+
}, [h, u]), /* @__PURE__ */ T(H, {
|
|
841
|
+
error: y?.message,
|
|
842
|
+
helperText: c,
|
|
843
|
+
readOnly: l,
|
|
844
|
+
label: o,
|
|
845
|
+
htmlFor: f,
|
|
846
|
+
isRequired: e?.required,
|
|
847
|
+
ref: g,
|
|
848
|
+
children: [/* @__PURE__ */ w("div", {
|
|
849
|
+
className: I(K.groupWrapper, l && K.readOnly),
|
|
850
|
+
children: u?.map((e, t) => /* @__PURE__ */ T("div", {
|
|
851
|
+
className: K.checkboxWrapper,
|
|
852
|
+
children: [/* @__PURE__ */ w(Vn, {
|
|
853
|
+
className: K.checkboxReset,
|
|
854
|
+
id: `${e}-${t}`,
|
|
855
|
+
name: f,
|
|
856
|
+
checked: h ? h?.includes(e) : !1,
|
|
857
|
+
onCheckedChange: () => b(e),
|
|
858
|
+
onBlur: () => {
|
|
859
|
+
p();
|
|
860
|
+
},
|
|
861
|
+
disabled: _
|
|
862
|
+
}), /* @__PURE__ */ w(B, {
|
|
863
|
+
htmlFor: `${e}-${t}`,
|
|
864
|
+
className: K.checkboxLabel,
|
|
865
|
+
children: e
|
|
866
|
+
})]
|
|
867
|
+
}, `${e}-${t}`))
|
|
868
|
+
}), x && /* @__PURE__ */ T("div", {
|
|
869
|
+
className: K.customInputWrapper,
|
|
870
|
+
children: [/* @__PURE__ */ T("div", {
|
|
871
|
+
className: K.customInputCheckboxWrapper,
|
|
872
|
+
children: [/* @__PURE__ */ w(Vn, {
|
|
873
|
+
className: K.checkboxReset,
|
|
874
|
+
name: `${f}-other`,
|
|
875
|
+
id: `${f}-other`,
|
|
876
|
+
disabled: _,
|
|
877
|
+
checked: r,
|
|
878
|
+
onCheckedChange: (e) => {
|
|
879
|
+
i(!!e), e ? Array.isArray(h) ? m?.([...h, t]) : m?.([t]) : m?.((h ?? [])?.filter((e) => e !== t));
|
|
880
|
+
},
|
|
881
|
+
onBlur: () => {
|
|
882
|
+
p && p();
|
|
883
|
+
}
|
|
884
|
+
}), /* @__PURE__ */ T(B, {
|
|
885
|
+
htmlFor: `${f}-other`,
|
|
886
|
+
className: K.checkboxLabel,
|
|
887
|
+
children: ["Other:", " "]
|
|
888
|
+
})]
|
|
889
|
+
}), /* @__PURE__ */ w(G, {
|
|
890
|
+
name: `other-checkbox-${f}`,
|
|
891
|
+
containerStyles: K.customInput,
|
|
892
|
+
value: t,
|
|
893
|
+
onChange: (e) => {
|
|
894
|
+
let r = 0;
|
|
895
|
+
m?.(h?.map((n) => n === t && !r ? (r = 1, e.target.value) : n)), n(e.target.value);
|
|
896
|
+
},
|
|
897
|
+
disabled: !r || _,
|
|
898
|
+
placeholder: "Please specify"
|
|
899
|
+
})]
|
|
900
|
+
})]
|
|
901
|
+
});
|
|
902
|
+
}, Wn = ({ field: e, ...t }) => {
|
|
903
|
+
let { key: n = "", label: r = "", helper_text: i = "", readonly: a = !1 } = e, o = n, { field: { value: c, onBlur: l, onChange: u, ref: d, ...f }, fieldState: p } = L({
|
|
904
|
+
name: o,
|
|
905
|
+
rules: s(e)
|
|
906
|
+
}), m = !!e?.required, h = p?.error?.message, g = e?.options?.currency_code;
|
|
907
|
+
return /* @__PURE__ */ w(H, {
|
|
908
|
+
error: h,
|
|
909
|
+
helperText: i,
|
|
910
|
+
readOnly: a,
|
|
911
|
+
ref: d,
|
|
912
|
+
htmlFor: o,
|
|
913
|
+
isRequired: m,
|
|
914
|
+
label: r,
|
|
915
|
+
children: /* @__PURE__ */ w(St, {
|
|
916
|
+
thousandSeparator: !0,
|
|
917
|
+
prefix: g || "$",
|
|
918
|
+
thousandsGroupStyle: g === "₹" ? "lakh" : "thousand",
|
|
919
|
+
suffix: "",
|
|
920
|
+
allowNegative: !1,
|
|
921
|
+
id: o,
|
|
922
|
+
onValueChange: (e) => {
|
|
923
|
+
let { value: t } = e;
|
|
924
|
+
u && u(t);
|
|
925
|
+
},
|
|
926
|
+
onBlur: () => {
|
|
927
|
+
l && l();
|
|
928
|
+
},
|
|
929
|
+
value: c,
|
|
930
|
+
readOnly: a,
|
|
931
|
+
className: Sn.input,
|
|
932
|
+
...f,
|
|
933
|
+
...t
|
|
934
|
+
})
|
|
935
|
+
});
|
|
936
|
+
}, q = {
|
|
937
|
+
container: "_container_686h5_1",
|
|
938
|
+
inputWrapper: "_inputWrapper_686h5_7",
|
|
939
|
+
wrapper: "_wrapper_686h5_13",
|
|
940
|
+
iconWrapper: "_iconWrapper_686h5_17",
|
|
941
|
+
icon: "_icon_686h5_17",
|
|
942
|
+
datePicker: "_datePicker_686h5_38",
|
|
943
|
+
clearButton: "_clearButton_686h5_44",
|
|
944
|
+
popoverContent: "_popoverContent_686h5_75",
|
|
945
|
+
fadeIn: "_fadeIn_686h5_1",
|
|
946
|
+
calendarContainer: "_calendarContainer_686h5_99",
|
|
947
|
+
withTime: "_withTime_686h5_105",
|
|
948
|
+
calendar: "_calendar_686h5_99",
|
|
949
|
+
months: "_months_686h5_114",
|
|
950
|
+
month: "_month_686h5_114",
|
|
951
|
+
monthCaption: "_monthCaption_686h5_126",
|
|
952
|
+
dropdowns: "_dropdowns_686h5_133",
|
|
953
|
+
dropdownRoot: "_dropdownRoot_686h5_140",
|
|
954
|
+
dropdown: "_dropdown_686h5_133",
|
|
955
|
+
captionLabel: "_captionLabel_686h5_151",
|
|
956
|
+
nav: "_nav_686h5_168",
|
|
957
|
+
navButton: "_navButton_686h5_179",
|
|
958
|
+
weekdays: "_weekdays_686h5_207",
|
|
959
|
+
weekday: "_weekday_686h5_207",
|
|
960
|
+
week: "_week_686h5_207",
|
|
961
|
+
day: "_day_686h5_226",
|
|
962
|
+
dayButton: "_dayButton_686h5_232",
|
|
963
|
+
daySelected: "_daySelected_686h5_255",
|
|
964
|
+
dayToday: "_dayToday_686h5_261",
|
|
965
|
+
dayOutside: "_dayOutside_686h5_266",
|
|
966
|
+
dayDisabled: "_dayDisabled_686h5_271",
|
|
967
|
+
timePicker: "_timePicker_686h5_278",
|
|
968
|
+
timeHeader: "_timeHeader_686h5_286",
|
|
969
|
+
timeList: "_timeList_686h5_293",
|
|
970
|
+
timeOption: "_timeOption_686h5_319",
|
|
971
|
+
timeOptionSelected: "_timeOptionSelected_686h5_344"
|
|
972
|
+
}, Gn = (e) => {
|
|
973
|
+
if (e) {
|
|
974
|
+
let t = new Date(e);
|
|
975
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
976
|
+
}
|
|
977
|
+
return null;
|
|
978
|
+
}, Kn = (e, t) => e ? t ? ne(e).format("D MMMM, YYYY h:mm A") : ne(e).format("D MMMM, YYYY") : "", qn = ({ value: e, onChange: t }) => {
|
|
979
|
+
let [n, r] = S(-1), i = x(null), a = g(() => {
|
|
980
|
+
if (!e) return -1;
|
|
981
|
+
let t = e.getHours(), n = e.getMinutes(), r = Math.floor(n / 15);
|
|
982
|
+
return t * 4 + r;
|
|
983
|
+
}, [e]);
|
|
984
|
+
v(() => {
|
|
985
|
+
let e = a();
|
|
986
|
+
e >= 0 && i.current && i.current.querySelector(`[data-time-index="${e}"]`)?.scrollIntoView({
|
|
987
|
+
block: "center",
|
|
988
|
+
behavior: "smooth"
|
|
989
|
+
});
|
|
990
|
+
}, [a]);
|
|
991
|
+
let o = (n, i) => {
|
|
992
|
+
let a = i * 15, o = e ? new Date(e) : /* @__PURE__ */ new Date();
|
|
993
|
+
o.setHours(n, a, 0, 0), t(o), r(n * 4 + i);
|
|
994
|
+
}, s = (e) => {
|
|
995
|
+
e.stopPropagation();
|
|
996
|
+
let t = () => {
|
|
997
|
+
let e = n + 1 >= 96 ? 0 : n + 1;
|
|
998
|
+
r(e);
|
|
999
|
+
let t = i.current?.querySelector(`[data-time-index="${e}"]`);
|
|
1000
|
+
t?.scrollIntoView({
|
|
1001
|
+
block: "center",
|
|
1002
|
+
behavior: "smooth"
|
|
1003
|
+
}), t?.focus();
|
|
1004
|
+
}, a = () => {
|
|
1005
|
+
let e = n - 1 < 0 ? 95 : n - 1;
|
|
1006
|
+
r(e);
|
|
1007
|
+
let t = i.current?.querySelector(`[data-time-index="${e}"]`);
|
|
1008
|
+
t?.scrollIntoView({
|
|
1009
|
+
block: "center",
|
|
1010
|
+
behavior: "smooth"
|
|
1011
|
+
}), t?.focus();
|
|
1012
|
+
}, s = () => {
|
|
1013
|
+
n >= 0 && o(Math.floor(n / 4), n % 4);
|
|
1014
|
+
};
|
|
1015
|
+
switch (e.key) {
|
|
1016
|
+
case "ArrowUp":
|
|
1017
|
+
e.preventDefault(), a();
|
|
1018
|
+
break;
|
|
1019
|
+
case "ArrowDown":
|
|
1020
|
+
e.preventDefault(), t();
|
|
1021
|
+
break;
|
|
1022
|
+
case "Enter":
|
|
1023
|
+
e.preventDefault(), s();
|
|
1024
|
+
break;
|
|
1025
|
+
case "Escape":
|
|
1026
|
+
r(-1);
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
}, c = a();
|
|
1030
|
+
return /* @__PURE__ */ T("div", {
|
|
1031
|
+
className: q.timePicker,
|
|
1032
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1033
|
+
className: q.timeHeader,
|
|
1034
|
+
children: "Time"
|
|
1035
|
+
}), /* @__PURE__ */ w("div", {
|
|
1036
|
+
ref: i,
|
|
1037
|
+
className: q.timeList,
|
|
1038
|
+
onKeyDown: s,
|
|
1039
|
+
tabIndex: 0,
|
|
1040
|
+
role: "listbox",
|
|
1041
|
+
"aria-label": "Select time",
|
|
1042
|
+
children: Array.from({ length: 24 }).map((e, t) => {
|
|
1043
|
+
let n = t === 0 ? 12 : t > 12 ? t - 12 : t, r = t >= 12 ? "PM" : "AM";
|
|
1044
|
+
return Array.from({ length: 4 }).map((e, i) => {
|
|
1045
|
+
let a = i * 15, s = t * 4 + i, l = s === c, u = `${n}:${a.toString().padStart(2, "0")} ${r}`;
|
|
1046
|
+
return /* @__PURE__ */ w("button", {
|
|
1047
|
+
type: "button",
|
|
1048
|
+
role: "option",
|
|
1049
|
+
"aria-selected": l,
|
|
1050
|
+
"data-time-index": s,
|
|
1051
|
+
className: I(q.timeOption, l && q.timeOptionSelected),
|
|
1052
|
+
onClick: () => o(t, i),
|
|
1053
|
+
tabIndex: l ? 0 : -1,
|
|
1054
|
+
children: u
|
|
1055
|
+
}, s);
|
|
1056
|
+
});
|
|
1057
|
+
})
|
|
1058
|
+
})]
|
|
1059
|
+
});
|
|
1060
|
+
}, Jn = ({ field: e }) => {
|
|
1061
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, a = t, [o, c] = S(!1), l = fn(), { field: { value: u, onBlur: d, onChange: f, ref: p, ...m }, fieldState: h } = L({
|
|
1062
|
+
name: a,
|
|
1063
|
+
rules: s(e)
|
|
1064
|
+
}), g = !!e?.required, _ = h?.error?.message, v = e?.field_interface === E.DateTimeWidget, y = Gn(u), b = Kn(y, v), x = Ge(), C = (e) => {
|
|
1065
|
+
e && (v && y && e.setHours(y.getHours(), y.getMinutes(), 0, 0), f(e.toISOString()), v || c(!1));
|
|
1066
|
+
}, D = (e) => {
|
|
1067
|
+
f(e.toISOString());
|
|
1068
|
+
}, O = (e) => {
|
|
1069
|
+
e.preventDefault(), e.stopPropagation(), f(null);
|
|
1070
|
+
};
|
|
1071
|
+
return /* @__PURE__ */ w(H, {
|
|
1072
|
+
helperText: r,
|
|
1073
|
+
readOnly: i,
|
|
1074
|
+
error: _,
|
|
1075
|
+
htmlFor: a,
|
|
1076
|
+
isRequired: g,
|
|
1077
|
+
label: n,
|
|
1078
|
+
children: /* @__PURE__ */ T("div", {
|
|
1079
|
+
className: q.container,
|
|
1080
|
+
children: [/* @__PURE__ */ T(fe.Root, {
|
|
1081
|
+
open: o,
|
|
1082
|
+
onOpenChange: c,
|
|
1083
|
+
children: [/* @__PURE__ */ w(fe.Trigger, {
|
|
1084
|
+
asChild: !0,
|
|
1085
|
+
children: /* @__PURE__ */ T("div", {
|
|
1086
|
+
className: q.inputWrapper,
|
|
1087
|
+
children: [/* @__PURE__ */ w(G, {
|
|
1088
|
+
id: a,
|
|
1089
|
+
ref: p,
|
|
1090
|
+
value: b,
|
|
1091
|
+
readOnly: !0,
|
|
1092
|
+
className: I(Sn.input, q.datePicker),
|
|
1093
|
+
autoComplete: "off",
|
|
1094
|
+
onBlur: d,
|
|
1095
|
+
...m
|
|
1096
|
+
}), /* @__PURE__ */ w("div", {
|
|
1097
|
+
className: q.iconWrapper,
|
|
1098
|
+
children: /* @__PURE__ */ w(re, {
|
|
1099
|
+
size: "20px",
|
|
1100
|
+
className: q.icon
|
|
1101
|
+
})
|
|
1102
|
+
})]
|
|
1103
|
+
})
|
|
1104
|
+
}), /* @__PURE__ */ w(fe.Portal, { children: /* @__PURE__ */ w(fe.Content, {
|
|
1105
|
+
className: I(l?.themeClass, q.popoverContent),
|
|
1106
|
+
style: l?.style,
|
|
1107
|
+
align: "start",
|
|
1108
|
+
sideOffset: 4,
|
|
1109
|
+
children: /* @__PURE__ */ T("div", {
|
|
1110
|
+
className: I(q.calendarContainer, v && q.withTime),
|
|
1111
|
+
children: [/* @__PURE__ */ w(We, {
|
|
1112
|
+
mode: "single",
|
|
1113
|
+
selected: y || void 0,
|
|
1114
|
+
onSelect: C,
|
|
1115
|
+
captionLayout: "dropdown",
|
|
1116
|
+
startMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() - 100, 0),
|
|
1117
|
+
endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11),
|
|
1118
|
+
showOutsideDays: !0,
|
|
1119
|
+
classNames: {
|
|
1120
|
+
root: I(q.calendar, x.root),
|
|
1121
|
+
months: I(q.months, x.months),
|
|
1122
|
+
month: I(q.month, x.month),
|
|
1123
|
+
month_caption: I(q.monthCaption, x.month_caption),
|
|
1124
|
+
dropdowns: I(q.dropdowns, x.dropdowns),
|
|
1125
|
+
dropdown: I(q.dropdown, x.dropdown),
|
|
1126
|
+
dropdown_root: I(q.dropdownRoot, x.dropdown_root),
|
|
1127
|
+
caption_label: I(q.captionLabel, x.caption_label),
|
|
1128
|
+
nav: I(q.nav, x.nav),
|
|
1129
|
+
button_previous: I(q.navButton, x.button_previous),
|
|
1130
|
+
button_next: I(q.navButton, x.button_next),
|
|
1131
|
+
weekdays: I(q.weekdays, x.weekdays),
|
|
1132
|
+
weekday: I(q.weekday, x.weekday),
|
|
1133
|
+
week: I(q.week, x.week),
|
|
1134
|
+
day: I(q.day, x.day),
|
|
1135
|
+
day_button: I(q.dayButton, x.day_button),
|
|
1136
|
+
selected: q.daySelected,
|
|
1137
|
+
today: q.dayToday,
|
|
1138
|
+
outside: q.dayOutside,
|
|
1139
|
+
disabled: q.dayDisabled
|
|
1140
|
+
},
|
|
1141
|
+
components: { Chevron: ({ orientation: e }) => e === "left" ? /* @__PURE__ */ w(ae, { size: 16 }) : e === "right" ? /* @__PURE__ */ w(oe, { size: 16 }) : /* @__PURE__ */ w(P, { size: 14 }) }
|
|
1142
|
+
}), v && /* @__PURE__ */ w(qn, {
|
|
1143
|
+
value: y,
|
|
1144
|
+
onChange: D
|
|
1145
|
+
})]
|
|
1146
|
+
})
|
|
1147
|
+
}) })]
|
|
1148
|
+
}), u && /* @__PURE__ */ w("div", {
|
|
1149
|
+
className: q.clearButton,
|
|
1150
|
+
children: /* @__PURE__ */ w("button", {
|
|
1151
|
+
type: "button",
|
|
1152
|
+
onClick: O,
|
|
1153
|
+
"aria-label": "Clear date",
|
|
1154
|
+
children: /* @__PURE__ */ w(ue, {
|
|
1155
|
+
size: "20px",
|
|
1156
|
+
className: q.icon
|
|
1157
|
+
})
|
|
1158
|
+
})
|
|
1159
|
+
})]
|
|
1160
|
+
})
|
|
1161
|
+
});
|
|
1162
|
+
}, Yn = {
|
|
1163
|
+
label: "Other",
|
|
1164
|
+
value: "other_internal"
|
|
1165
|
+
}, Xn = ({ field: e, ...t }) => {
|
|
1166
|
+
let [n, r] = S(void 0), [i, a] = S([]), { key: o = "", label: c = "", helper_text: l = "", readonly: u = !1, values: d = [], options: f = {} } = e, p = o, { field: { value: m, onBlur: h, onChange: g, disabled: _, ...b }, fieldState: x } = L({
|
|
1167
|
+
name: p,
|
|
1168
|
+
rules: s(e)
|
|
1169
|
+
}), [C, E] = S(""), [D, O] = S(!1), k = !!e?.required, ee = x?.error?.message, A = !!f?.custom_input;
|
|
1170
|
+
return v(() => {
|
|
1171
|
+
if (d?.length) {
|
|
1172
|
+
let e = [...d?.map((e) => ({
|
|
1173
|
+
label: e,
|
|
1174
|
+
value: e
|
|
1175
|
+
}))];
|
|
1176
|
+
A && e.push(Yn), a(e);
|
|
1177
|
+
}
|
|
1178
|
+
}, [d, A]), v(() => {
|
|
1179
|
+
!t?.isMulti && A && typeof m == "string" && m && (i.some((e) => e.value !== Yn.value && e.value === m) ? O(!1) : (O(!0), E(m)));
|
|
1180
|
+
}, [
|
|
1181
|
+
m,
|
|
1182
|
+
i,
|
|
1183
|
+
A
|
|
1184
|
+
]), y(() => {
|
|
1185
|
+
typeof document < "u" && document?.body && r(document?.body);
|
|
1186
|
+
}, []), /* @__PURE__ */ T(H, {
|
|
1187
|
+
error: ee,
|
|
1188
|
+
helperText: l,
|
|
1189
|
+
readOnly: u,
|
|
1190
|
+
label: c,
|
|
1191
|
+
htmlFor: p,
|
|
1192
|
+
isRequired: k,
|
|
1193
|
+
children: [/* @__PURE__ */ w(Je, {
|
|
1194
|
+
id: p,
|
|
1195
|
+
value: D ? Yn : m ? t?.isMulti ? i?.filter((e) => m?.includes(e?.value)) : i?.find((e) => e?.value === m) : null,
|
|
1196
|
+
onChange: (e) => {
|
|
1197
|
+
A && e?.value === Yn.value && e?.label === Yn.label ? (O(!0), E(""), g("")) : (O(!1), t?.isMulti ? g(e?.map((e) => e?.value)) : g(e?.value));
|
|
1198
|
+
},
|
|
1199
|
+
onBlur: () => h(),
|
|
1200
|
+
options: i,
|
|
1201
|
+
isDisabled: _,
|
|
1202
|
+
menuPlacement: "auto",
|
|
1203
|
+
menuPortalTarget: n,
|
|
1204
|
+
isClearable: !0,
|
|
1205
|
+
...b,
|
|
1206
|
+
...t,
|
|
1207
|
+
unstyled: !0,
|
|
1208
|
+
classNames: En
|
|
1209
|
+
}), D && /* @__PURE__ */ w("div", {
|
|
1210
|
+
className: "w-full",
|
|
1211
|
+
children: /* @__PURE__ */ w(G, {
|
|
1212
|
+
name: `select-other-${p}`,
|
|
1213
|
+
value: C,
|
|
1214
|
+
onChange: (e) => {
|
|
1215
|
+
g?.(e.target.value), E(e.target.value);
|
|
1216
|
+
},
|
|
1217
|
+
className: "mt-4",
|
|
1218
|
+
placeholder: "Other, Please Specify"
|
|
1219
|
+
})
|
|
1220
|
+
})]
|
|
1221
|
+
});
|
|
1222
|
+
}, Zn = {
|
|
1223
|
+
overlay: "_overlay_7olxp_1",
|
|
1224
|
+
fadeIn: "_fadeIn_7olxp_1",
|
|
1225
|
+
fadeOut: "_fadeOut_7olxp_1",
|
|
1226
|
+
content: "_content_7olxp_25",
|
|
1227
|
+
zoomIn: "_zoomIn_7olxp_1",
|
|
1228
|
+
zoomOut: "_zoomOut_7olxp_1",
|
|
1229
|
+
closeButton: "_closeButton_7olxp_80",
|
|
1230
|
+
header: "_header_7olxp_104",
|
|
1231
|
+
title: "_title_7olxp_111",
|
|
1232
|
+
description: "_description_7olxp_118",
|
|
1233
|
+
headerWrapper: "_headerWrapper_7olxp_161",
|
|
1234
|
+
contentWrapper: "_contentWrapper_7olxp_168"
|
|
1235
|
+
}, Qn = F.Root;
|
|
1236
|
+
F.Trigger;
|
|
1237
|
+
var $n = F.Portal;
|
|
1238
|
+
F.Close;
|
|
1239
|
+
var er = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(F.Overlay, {
|
|
1240
|
+
ref: n,
|
|
1241
|
+
className: I(Zn.overlay, e),
|
|
1242
|
+
...t
|
|
1243
|
+
}));
|
|
1244
|
+
er.displayName = F.Overlay.displayName;
|
|
1245
|
+
var tr = u.forwardRef(({ className: e, children: t, hideCloseButton: n, overlayStyles: r, ...i }, a) => /* @__PURE__ */ w($n, { children: /* @__PURE__ */ w(er, {
|
|
1246
|
+
className: r,
|
|
1247
|
+
children: /* @__PURE__ */ T(F.Content, {
|
|
1248
|
+
ref: a,
|
|
1249
|
+
className: I(Zn.content, e),
|
|
1250
|
+
...i,
|
|
1251
|
+
children: [t, !n && /* @__PURE__ */ T(F.Close, {
|
|
1252
|
+
type: "button",
|
|
1253
|
+
className: Zn.closeButton,
|
|
1254
|
+
children: [/* @__PURE__ */ w(ue, { className: "h-4 w-4" }), /* @__PURE__ */ w("span", {
|
|
1255
|
+
className: "sr-only",
|
|
1256
|
+
children: "Close"
|
|
1257
|
+
})]
|
|
1258
|
+
})]
|
|
1259
|
+
})
|
|
1260
|
+
}) }));
|
|
1261
|
+
tr.displayName = F.Content.displayName;
|
|
1262
|
+
var nr = ({ className: e, ...t }) => /* @__PURE__ */ w("div", {
|
|
1263
|
+
className: I(Zn.header, e),
|
|
1264
|
+
...t
|
|
1265
|
+
});
|
|
1266
|
+
nr.displayName = "DialogHeader";
|
|
1267
|
+
var rr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(F.Title, {
|
|
1268
|
+
ref: n,
|
|
1269
|
+
className: I(Zn.title, e),
|
|
1270
|
+
...t
|
|
1271
|
+
}));
|
|
1272
|
+
rr.displayName = F.Title.displayName;
|
|
1273
|
+
var ir = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(F.Description, {
|
|
1274
|
+
ref: n,
|
|
1275
|
+
className: I(Zn.description, e),
|
|
1276
|
+
...t
|
|
1277
|
+
}));
|
|
1278
|
+
ir.displayName = F.Description.displayName;
|
|
1279
|
+
var ar = ({ isOpen: e, onClose: t, children: n, title: r, description: i, size: a = "xl", className: o, portalContainer: s, modal: c = !0 }) => {
|
|
1280
|
+
let l = fn();
|
|
1281
|
+
return /* @__PURE__ */ w(Qn, {
|
|
1282
|
+
open: e,
|
|
1283
|
+
onOpenChange: t,
|
|
1284
|
+
modal: c,
|
|
1285
|
+
children: /* @__PURE__ */ w($n, {
|
|
1286
|
+
container: s,
|
|
1287
|
+
children: /* @__PURE__ */ w(er, {
|
|
1288
|
+
className: I(l?.themeClass, o?.overlay),
|
|
1289
|
+
style: l?.style,
|
|
1290
|
+
children: /* @__PURE__ */ T(F.Content, {
|
|
1291
|
+
className: I(Zn.content),
|
|
1292
|
+
"data-size": a,
|
|
1293
|
+
children: [/* @__PURE__ */ T("div", {
|
|
1294
|
+
className: Zn.headerWrapper,
|
|
1295
|
+
children: [/* @__PURE__ */ w("div", { children: r && /* @__PURE__ */ T(nr, {
|
|
1296
|
+
className: o?.header,
|
|
1297
|
+
children: [/* @__PURE__ */ w(rr, { children: r }), i && /* @__PURE__ */ w(ir, { children: i })]
|
|
1298
|
+
}) }), /* @__PURE__ */ w(F.Close, {
|
|
1299
|
+
asChild: !0,
|
|
1300
|
+
className: o?.closeButton,
|
|
1301
|
+
children: /* @__PURE__ */ w(z, {
|
|
1302
|
+
variant: "ghost",
|
|
1303
|
+
size: "icon",
|
|
1304
|
+
children: /* @__PURE__ */ w(ue, { size: 16 })
|
|
1305
|
+
})
|
|
1306
|
+
})]
|
|
1307
|
+
}), /* @__PURE__ */ w("div", {
|
|
1308
|
+
className: I(Zn.contentWrapper, o?.content),
|
|
1309
|
+
children: n
|
|
1310
|
+
})]
|
|
1311
|
+
})
|
|
1312
|
+
})
|
|
1313
|
+
})
|
|
1314
|
+
});
|
|
1315
|
+
}, or = {
|
|
1316
|
+
container: "_container_f12eq_1",
|
|
1317
|
+
text: "_text_f12eq_7",
|
|
1318
|
+
link: "_link_f12eq_12",
|
|
1319
|
+
inputWrapper: "_inputWrapper_f12eq_23",
|
|
1320
|
+
actions: "_actions_f12eq_29",
|
|
1321
|
+
resendContainer: "_resendContainer_f12eq_36"
|
|
1322
|
+
}, sr = ({ isOpen: e, onClose: t, value: n, type: r = "email", onVerifySuccess: i }) => {
|
|
1323
|
+
let { membership: a } = M(), [o, s] = S(""), [c, l] = S(!1), [u, d] = S(!1), [f, p] = S(30);
|
|
1324
|
+
return v(() => {
|
|
1325
|
+
let t;
|
|
1326
|
+
return e && f > 0 && (t = setInterval(() => {
|
|
1327
|
+
p((e) => e - 1);
|
|
1328
|
+
}, 1e3)), () => clearInterval(t);
|
|
1329
|
+
}, [e, f]), v(() => {
|
|
1330
|
+
e && (s(""), p(30), l(!1), d(!1));
|
|
1331
|
+
}, [e]), /* @__PURE__ */ w(ar, {
|
|
1332
|
+
isOpen: e,
|
|
1333
|
+
onClose: (e) => {
|
|
1334
|
+
e || t();
|
|
1335
|
+
},
|
|
1336
|
+
title: `Verify ${r === "email" ? "Email" : "Phone"}`,
|
|
1337
|
+
description: "",
|
|
1338
|
+
size: "xs",
|
|
1339
|
+
children: /* @__PURE__ */ T("div", {
|
|
1340
|
+
className: or.container,
|
|
1341
|
+
children: [
|
|
1342
|
+
/* @__PURE__ */ T("div", {
|
|
1343
|
+
className: or.text,
|
|
1344
|
+
children: [
|
|
1345
|
+
"Enter the 4-digit code sent to ",
|
|
1346
|
+
/* @__PURE__ */ w("strong", { children: n }),
|
|
1347
|
+
".",
|
|
1348
|
+
" ",
|
|
1349
|
+
/* @__PURE__ */ w("button", {
|
|
1350
|
+
onClick: () => t(),
|
|
1351
|
+
className: or.link,
|
|
1352
|
+
children: "Change?"
|
|
1353
|
+
})
|
|
1354
|
+
]
|
|
1355
|
+
}),
|
|
1356
|
+
/* @__PURE__ */ w("div", {
|
|
1357
|
+
className: or.inputWrapper,
|
|
1358
|
+
children: /* @__PURE__ */ w(G, {
|
|
1359
|
+
value: o,
|
|
1360
|
+
onChange: (e) => {
|
|
1361
|
+
s(e.target.value.replace(/\D/g, "").slice(0, 4));
|
|
1362
|
+
},
|
|
1363
|
+
placeholder: "0000",
|
|
1364
|
+
maxLength: 4,
|
|
1365
|
+
containerStyles: "text-center text-lg tracking-widest"
|
|
1366
|
+
})
|
|
1367
|
+
}),
|
|
1368
|
+
/* @__PURE__ */ T("div", {
|
|
1369
|
+
className: or.actions,
|
|
1370
|
+
children: [/* @__PURE__ */ w(z, {
|
|
1371
|
+
onClick: async () => {
|
|
1372
|
+
if (!(!o || o.length !== 4)) {
|
|
1373
|
+
l(!0);
|
|
1374
|
+
try {
|
|
1375
|
+
await a?.signInWithOtp({
|
|
1376
|
+
content: n,
|
|
1377
|
+
code: o
|
|
1378
|
+
}), j("Verification successful"), i(n), t();
|
|
1379
|
+
} catch (e) {
|
|
1380
|
+
let t = e;
|
|
1381
|
+
A(t?.message || "Invalid OTP", t?.title || "Verification Failed");
|
|
1382
|
+
} finally {
|
|
1383
|
+
l(!1);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
isLoading: c,
|
|
1388
|
+
loadingText: "Verifying...",
|
|
1389
|
+
disabled: o.length !== 4,
|
|
1390
|
+
className: "w-full",
|
|
1391
|
+
children: "Verify"
|
|
1392
|
+
}), /* @__PURE__ */ w("div", {
|
|
1393
|
+
className: or.resendContainer,
|
|
1394
|
+
children: f > 0 ? /* @__PURE__ */ T("span", { children: [
|
|
1395
|
+
"Resend code in ",
|
|
1396
|
+
f,
|
|
1397
|
+
"s"
|
|
1398
|
+
] }) : /* @__PURE__ */ w("button", {
|
|
1399
|
+
onClick: async () => {
|
|
1400
|
+
if (!(f > 0)) {
|
|
1401
|
+
d(!0);
|
|
1402
|
+
try {
|
|
1403
|
+
await a?.requestOtp({
|
|
1404
|
+
content: n,
|
|
1405
|
+
medium: r === "phone" ? "whatsapp" : "email"
|
|
1406
|
+
}), j("OTP resent successfully"), p(30);
|
|
1407
|
+
} catch (e) {
|
|
1408
|
+
let t = e;
|
|
1409
|
+
A(t?.message || "Failed to resend OTP", t?.title || "Error");
|
|
1410
|
+
} finally {
|
|
1411
|
+
d(!1);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
disabled: u,
|
|
1416
|
+
className: or.link,
|
|
1417
|
+
children: u ? "Resending..." : "Resend Code"
|
|
1418
|
+
})
|
|
1419
|
+
})]
|
|
1420
|
+
})
|
|
1421
|
+
]
|
|
1422
|
+
})
|
|
1423
|
+
});
|
|
1424
|
+
}, cr = {
|
|
1425
|
+
verifiedBadge: "_verifiedBadge_eg3d2_1",
|
|
1426
|
+
verifiedText: "_verifiedText_eg3d2_12",
|
|
1427
|
+
icon: "_icon_eg3d2_21"
|
|
1428
|
+
}, lr = ({ value: e, type: t, isVerified: n, onVerifySuccess: r, onStateChange: i }) => {
|
|
1429
|
+
let { membership: a } = M(), [o, s] = S(!1), [c, l] = S(!1), u = (e) => {
|
|
1430
|
+
i && i(e);
|
|
1431
|
+
}, d = async () => {
|
|
1432
|
+
let n = e?.trim()?.toLowerCase();
|
|
1433
|
+
if (!n) {
|
|
1434
|
+
A(`Please enter a ${t}`);
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
if (t === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)) {
|
|
1438
|
+
A("Please enter a valid email address");
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
l(!0), u(!0);
|
|
1442
|
+
try {
|
|
1443
|
+
await a?.requestOtp({
|
|
1444
|
+
content: n,
|
|
1445
|
+
medium: t === "phone" ? "whatsapp" : "email"
|
|
1446
|
+
}), s(!0);
|
|
1447
|
+
} catch (e) {
|
|
1448
|
+
let t = e;
|
|
1449
|
+
A(t?.message || "Failed to send OTP", t?.title || "Error"), u(!1);
|
|
1450
|
+
} finally {
|
|
1451
|
+
l(!1);
|
|
1452
|
+
}
|
|
1453
|
+
}, f = () => {
|
|
1454
|
+
s(!1), u(!1);
|
|
1455
|
+
};
|
|
1456
|
+
return n ? /* @__PURE__ */ T("div", {
|
|
1457
|
+
className: cr.verifiedBadge,
|
|
1458
|
+
children: [/* @__PURE__ */ w(Ct, { className: cr.icon }), /* @__PURE__ */ w("span", {
|
|
1459
|
+
className: cr.verifiedText,
|
|
1460
|
+
children: "Verified"
|
|
1461
|
+
})]
|
|
1462
|
+
}) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(z, {
|
|
1463
|
+
size: "default",
|
|
1464
|
+
variant: "ghost",
|
|
1465
|
+
onClick: d,
|
|
1466
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1467
|
+
isLoading: c,
|
|
1468
|
+
disabled: !e || c,
|
|
1469
|
+
type: "button",
|
|
1470
|
+
children: "Verify"
|
|
1471
|
+
}), o && /* @__PURE__ */ w(sr, {
|
|
1472
|
+
isOpen: o,
|
|
1473
|
+
onClose: f,
|
|
1474
|
+
value: e?.trim()?.toLowerCase() || "",
|
|
1475
|
+
type: t,
|
|
1476
|
+
onVerifySuccess: (e) => {
|
|
1477
|
+
r(e), f();
|
|
1478
|
+
}
|
|
1479
|
+
})] });
|
|
1480
|
+
}, ur = {
|
|
1481
|
+
container: "_container_blgxp_1",
|
|
1482
|
+
inputWrapper: "_inputWrapper_blgxp_8",
|
|
1483
|
+
buttonWrapper: "_buttonWrapper_blgxp_12",
|
|
1484
|
+
verifiedBadge: "_verifiedBadge_blgxp_16",
|
|
1485
|
+
verifiedText: "_verifiedText_blgxp_27",
|
|
1486
|
+
icon: "_icon_blgxp_36",
|
|
1487
|
+
editButton: "_editButton_blgxp_40"
|
|
1488
|
+
}, dr = ({ field: e, settings: t, ...n }) => {
|
|
1489
|
+
let { key: r = "", label: i = "", helper_text: a = "", readonly: o = !1 } = e, c = r, l = !!e.options?.verification && !!t?.enableVerification, [u, d] = S(null), [f, p] = S(!1), { field: { value: m, onBlur: h, onChange: g, ..._ }, fieldState: v } = L({
|
|
1490
|
+
name: c,
|
|
1491
|
+
rules: b(() => s(e, (e) => f ? !0 : l && (!u || u !== e) ? "Email verification required" : !0), [
|
|
1492
|
+
e,
|
|
1493
|
+
l,
|
|
1494
|
+
u,
|
|
1495
|
+
f
|
|
1496
|
+
])
|
|
1497
|
+
}), y = !!e?.required, x = v?.error?.message, E = !!u && !!m && u === m?.trim()?.toLowerCase(), D = (e) => {
|
|
1498
|
+
d(e), g(e);
|
|
1499
|
+
};
|
|
1500
|
+
return /* @__PURE__ */ w(C, { children: /* @__PURE__ */ w(H, {
|
|
1501
|
+
error: x,
|
|
1502
|
+
helperText: a,
|
|
1503
|
+
label: i,
|
|
1504
|
+
htmlFor: c,
|
|
1505
|
+
isRequired: y,
|
|
1506
|
+
children: /* @__PURE__ */ T("div", {
|
|
1507
|
+
className: ur.container,
|
|
1508
|
+
children: [/* @__PURE__ */ w(G, {
|
|
1509
|
+
containerStyles: ur.inputWrapper,
|
|
1510
|
+
id: c,
|
|
1511
|
+
type: "email",
|
|
1512
|
+
leftIcon: /* @__PURE__ */ w(wt, { size: "20px" }),
|
|
1513
|
+
rightIcon: E ? /* @__PURE__ */ w("button", {
|
|
1514
|
+
type: "button",
|
|
1515
|
+
onClick: () => d(null),
|
|
1516
|
+
className: ur.editButton,
|
|
1517
|
+
title: "Change email",
|
|
1518
|
+
children: /* @__PURE__ */ w(Tt, { size: 14 })
|
|
1519
|
+
}) : null,
|
|
1520
|
+
value: m || "",
|
|
1521
|
+
onChange: (e) => g(e?.target?.value?.trim()?.toLocaleLowerCase()),
|
|
1522
|
+
onBlur: h,
|
|
1523
|
+
readOnly: o || E,
|
|
1524
|
+
..._,
|
|
1525
|
+
...n
|
|
1526
|
+
}), l && /* @__PURE__ */ w("div", {
|
|
1527
|
+
className: ur.buttonWrapper,
|
|
1528
|
+
children: /* @__PURE__ */ w(lr, {
|
|
1529
|
+
value: m,
|
|
1530
|
+
type: "email",
|
|
1531
|
+
isVerified: E,
|
|
1532
|
+
onVerifySuccess: D,
|
|
1533
|
+
onStateChange: p
|
|
1534
|
+
})
|
|
1535
|
+
})]
|
|
1536
|
+
})
|
|
1537
|
+
}) });
|
|
1538
|
+
}, fr = (e) => e ? {
|
|
1539
|
+
value: e,
|
|
1540
|
+
label: e?.place_name || e?.formatted_address || e?.name
|
|
1541
|
+
} : null, pr = ({ field: e }) => {
|
|
1542
|
+
let [t, n] = S(!1), [r, i] = S(!1), a = M(), { key: o = "", label: c = "", helper_text: l = "", readonly: u = !1 } = e, { field: { value: d, onBlur: f, onChange: p, disabled: m, ...h }, fieldState: g } = L({
|
|
1543
|
+
name: o,
|
|
1544
|
+
rules: s(e)
|
|
1545
|
+
}), _ = !!e?.required, v = g?.error?.message, y = (e) => {
|
|
1546
|
+
e && e?.place_id !== d?.place_id ? (i(!0), a?.fetch.url(`/v1/bevy/content/location/${e?.place_id}/get-location-details`).get().json().then((e) => {
|
|
1547
|
+
p && p(e?.content?.data);
|
|
1548
|
+
}).catch((e) => {
|
|
1549
|
+
console.log("Could not fetch location details:", k(e).message);
|
|
1550
|
+
}).finally(() => i(!1))) : p(null);
|
|
1551
|
+
}, b = (t, r) => {
|
|
1552
|
+
n(!0);
|
|
1553
|
+
let i = {};
|
|
1554
|
+
e?.options?.location_type && (i.location_type = e?.options?.location_type), e?.options?.country && (i.country = e?.options?.country), a?.fetch.url("/v1/bevy/content/location/search-location").post({
|
|
1555
|
+
search: t,
|
|
1556
|
+
where: i
|
|
1557
|
+
}).json().then((e) => {
|
|
1558
|
+
r(e?.content?.data?.map((e) => ({
|
|
1559
|
+
label: e?.description,
|
|
1560
|
+
value: e
|
|
1561
|
+
})));
|
|
1562
|
+
}).catch(() => {
|
|
1563
|
+
r([]);
|
|
1564
|
+
}).finally(() => n(!1));
|
|
1565
|
+
};
|
|
1566
|
+
return /* @__PURE__ */ w(H, {
|
|
1567
|
+
error: v,
|
|
1568
|
+
helperText: l,
|
|
1569
|
+
readOnly: u,
|
|
1570
|
+
label: c,
|
|
1571
|
+
htmlFor: o,
|
|
1572
|
+
isRequired: _,
|
|
1573
|
+
children: /* @__PURE__ */ w(Et, {
|
|
1574
|
+
id: o,
|
|
1575
|
+
value: fr(d),
|
|
1576
|
+
defaultOptions: d ? [fr(d)] : void 0,
|
|
1577
|
+
onChange: (e) => {
|
|
1578
|
+
y(e?.value);
|
|
1579
|
+
},
|
|
1580
|
+
onBlur: f,
|
|
1581
|
+
isDisabled: m || r,
|
|
1582
|
+
menuPlacement: "auto",
|
|
1583
|
+
...h,
|
|
1584
|
+
unstyled: !0,
|
|
1585
|
+
classNames: En,
|
|
1586
|
+
loadOptions: b,
|
|
1587
|
+
isLoading: t || r,
|
|
1588
|
+
isClearable: !0,
|
|
1589
|
+
noOptionsMessage: ({ inputValue: e }) => e ? "No results found. Try searching something else" : "Start typing to search"
|
|
1590
|
+
})
|
|
1591
|
+
});
|
|
1592
|
+
}, mr = {
|
|
1593
|
+
wrapper: "_wrapper_ubir2_1",
|
|
1594
|
+
container: "_container_ubir2_6",
|
|
1595
|
+
btn: "_btn_ubir2_12",
|
|
1596
|
+
plusIcon: "_plusIcon_ubir2_18"
|
|
1597
|
+
}, hr = ({ field: e }) => {
|
|
1598
|
+
let { key: t = "", label: n = "" } = e, { fields: r, ...i } = Qe({ name: t });
|
|
1599
|
+
return /* @__PURE__ */ T("div", {
|
|
1600
|
+
className: mr.wrapper,
|
|
1601
|
+
children: [n && /* @__PURE__ */ w(B, {
|
|
1602
|
+
htmlFor: t,
|
|
1603
|
+
children: n
|
|
1604
|
+
}), /* @__PURE__ */ T("div", {
|
|
1605
|
+
className: mr.container,
|
|
1606
|
+
children: [r?.map((n, r) => /* @__PURE__ */ w(pr, { field: {
|
|
1607
|
+
...e,
|
|
1608
|
+
key: `${t}.${r}`,
|
|
1609
|
+
label: ""
|
|
1610
|
+
} }, n.id)), /* @__PURE__ */ T(z, {
|
|
1611
|
+
variant: "ghost",
|
|
1612
|
+
size: "xs",
|
|
1613
|
+
className: mr.btn,
|
|
1614
|
+
onClick: () => {
|
|
1615
|
+
i.append(null);
|
|
1616
|
+
},
|
|
1617
|
+
children: [/* @__PURE__ */ w(ce, {
|
|
1618
|
+
className: mr.plusIcon,
|
|
1619
|
+
size: "14px"
|
|
1620
|
+
}), "Add"]
|
|
1621
|
+
})]
|
|
1622
|
+
})]
|
|
1623
|
+
}, t);
|
|
1624
|
+
}, gr = {
|
|
1625
|
+
tagsContainer: "_tagsContainer_jx9kq_1",
|
|
1626
|
+
tag: "_tag_jx9kq_1",
|
|
1627
|
+
tagIn: "_tagIn_jx9kq_1",
|
|
1628
|
+
tagText: "_tagText_jx9kq_58",
|
|
1629
|
+
tagRemove: "_tagRemove_jx9kq_64",
|
|
1630
|
+
input: "_input_jx9kq_92"
|
|
1631
|
+
}, _r = /[\n\t,]+/, vr = ({ field: e }) => {
|
|
1632
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, a = t, { field: { value: o, onChange: c, onBlur: l, ref: u }, fieldState: d } = L({
|
|
1633
|
+
name: a,
|
|
1634
|
+
rules: s(e)
|
|
1635
|
+
}), f = !!e?.required, p = d?.error?.message, m = Array.isArray(o) ? o : [], [h, _] = S(""), [v, y] = S(-1), b = x(null), C = g((e) => {
|
|
1636
|
+
b.current = e, typeof u == "function" && u(e);
|
|
1637
|
+
}, [u]), E = g((e) => {
|
|
1638
|
+
c(m.filter((t, n) => n !== e));
|
|
1639
|
+
}, [m, c]), D = g(() => {
|
|
1640
|
+
if (!h.trim()) return;
|
|
1641
|
+
let e = h.split(_r), t = [...m];
|
|
1642
|
+
for (let n of e) {
|
|
1643
|
+
let e = n.trim();
|
|
1644
|
+
e && !t.includes(e) && t.push(e);
|
|
1645
|
+
}
|
|
1646
|
+
c(t), _("");
|
|
1647
|
+
}, [
|
|
1648
|
+
h,
|
|
1649
|
+
m,
|
|
1650
|
+
c
|
|
1651
|
+
]), O = g((e) => {
|
|
1652
|
+
let t = e.currentTarget;
|
|
1653
|
+
switch (e.key) {
|
|
1654
|
+
case "Enter":
|
|
1655
|
+
h.trim() && (e.preventDefault(), D());
|
|
1656
|
+
break;
|
|
1657
|
+
case "Backspace":
|
|
1658
|
+
t.selectionStart === 0 && t.selectionEnd === 0 && m.length > 0 && (v >= 0 ? (E(v), y(v > 0 ? v - 1 : -1)) : y(m.length - 1));
|
|
1659
|
+
break;
|
|
1660
|
+
case "Delete":
|
|
1661
|
+
v >= 0 && v < m.length && (E(v), y(v < m.length - 1 ? v : -1));
|
|
1662
|
+
break;
|
|
1663
|
+
case "ArrowLeft":
|
|
1664
|
+
t.selectionStart === 0 && m.length > 0 && (e.preventDefault(), y(v > 0 ? v - 1 : v === -1 ? m.length - 1 : 0));
|
|
1665
|
+
break;
|
|
1666
|
+
case "ArrowRight":
|
|
1667
|
+
v >= 0 && (e.preventDefault(), v < m.length - 1 ? y(v + 1) : y(-1));
|
|
1668
|
+
break;
|
|
1669
|
+
case "Escape":
|
|
1670
|
+
y(-1);
|
|
1671
|
+
break;
|
|
1672
|
+
default:
|
|
1673
|
+
v >= 0 && y(-1);
|
|
1674
|
+
break;
|
|
1675
|
+
}
|
|
1676
|
+
}, [
|
|
1677
|
+
h,
|
|
1678
|
+
m,
|
|
1679
|
+
v,
|
|
1680
|
+
D,
|
|
1681
|
+
E
|
|
1682
|
+
]), k = g((e) => {
|
|
1683
|
+
let t = e.clipboardData.getData("text");
|
|
1684
|
+
if (_r.test(t)) {
|
|
1685
|
+
e.preventDefault();
|
|
1686
|
+
let n = t.split(_r), r = [...m];
|
|
1687
|
+
for (let e of n) {
|
|
1688
|
+
let t = e.trim();
|
|
1689
|
+
t && !r.includes(t) && r.push(t);
|
|
1690
|
+
}
|
|
1691
|
+
c(r), _("");
|
|
1692
|
+
}
|
|
1693
|
+
}, [m, c]), ee = g(() => {
|
|
1694
|
+
b.current?.focus(), y(-1);
|
|
1695
|
+
}, []), A = g(() => {
|
|
1696
|
+
D(), y(-1), l();
|
|
1697
|
+
}, [D, l]);
|
|
1698
|
+
return /* @__PURE__ */ w(H, {
|
|
1699
|
+
error: p,
|
|
1700
|
+
helperText: r,
|
|
1701
|
+
label: n,
|
|
1702
|
+
htmlFor: a,
|
|
1703
|
+
isRequired: f,
|
|
1704
|
+
children: /* @__PURE__ */ T("div", {
|
|
1705
|
+
className: gr.tagsContainer,
|
|
1706
|
+
"data-readonly": i,
|
|
1707
|
+
onClick: ee,
|
|
1708
|
+
children: [m.map((e, t) => /* @__PURE__ */ T("span", {
|
|
1709
|
+
className: gr.tag,
|
|
1710
|
+
"data-active": v === t,
|
|
1711
|
+
children: [/* @__PURE__ */ w("span", {
|
|
1712
|
+
className: gr.tagText,
|
|
1713
|
+
children: e
|
|
1714
|
+
}), !i && /* @__PURE__ */ w("button", {
|
|
1715
|
+
type: "button",
|
|
1716
|
+
className: gr.tagRemove,
|
|
1717
|
+
onClick: (e) => {
|
|
1718
|
+
e.stopPropagation(), E(t), b.current?.focus();
|
|
1719
|
+
},
|
|
1720
|
+
"aria-label": `Remove ${e}`,
|
|
1721
|
+
tabIndex: -1,
|
|
1722
|
+
children: /* @__PURE__ */ w(ue, {})
|
|
1723
|
+
})]
|
|
1724
|
+
}, `${e}-${t}`)), /* @__PURE__ */ w("input", {
|
|
1725
|
+
ref: C,
|
|
1726
|
+
id: a,
|
|
1727
|
+
className: gr.input,
|
|
1728
|
+
type: "text",
|
|
1729
|
+
value: h,
|
|
1730
|
+
onChange: (e) => _(e.target.value),
|
|
1731
|
+
onKeyDown: O,
|
|
1732
|
+
onPaste: k,
|
|
1733
|
+
onBlur: A,
|
|
1734
|
+
placeholder: m.length === 0 ? e.placeholder || "Type and press Enter" : "",
|
|
1735
|
+
readOnly: i,
|
|
1736
|
+
disabled: i,
|
|
1737
|
+
autoComplete: "off"
|
|
1738
|
+
})]
|
|
1739
|
+
})
|
|
1740
|
+
});
|
|
1741
|
+
}, yr = {
|
|
1742
|
+
phoneInput: "_phoneInput_2dxtd_1",
|
|
1743
|
+
container: "_container_2dxtd_17",
|
|
1744
|
+
inputWrapper: "_inputWrapper_2dxtd_24",
|
|
1745
|
+
buttonWrapper: "_buttonWrapper_2dxtd_28",
|
|
1746
|
+
editButton: "_editButton_2dxtd_32"
|
|
1747
|
+
}, br = ({ field: e, settings: t }) => {
|
|
1748
|
+
let { key: n = "", label: r = "", helper_text: i = "", readonly: a = !1, options: o } = e, c = n, l = !!o?.verification && !!t?.enableVerification, [u, d] = S(null), [f, p] = S(!1), { field: { value: m, onBlur: h, onChange: _, ...v }, fieldState: { error: y } } = L({
|
|
1749
|
+
name: c,
|
|
1750
|
+
rules: b(() => s(e, (e) => f ? !0 : l && (!u || u !== e) ? "Phone verification required" : !0), [
|
|
1751
|
+
e,
|
|
1752
|
+
l,
|
|
1753
|
+
u,
|
|
1754
|
+
f
|
|
1755
|
+
])
|
|
1756
|
+
}), x = !!e?.required, C = y?.message, E = !!u && !!m && u === m, D = g(() => {
|
|
1757
|
+
let e = o?.country;
|
|
1758
|
+
if (e && typeof e == "string") {
|
|
1759
|
+
let t = e?.toUpperCase();
|
|
1760
|
+
if (qe(t)) return t;
|
|
1761
|
+
}
|
|
1762
|
+
return "IN";
|
|
1763
|
+
}, [o]), O = (e) => {
|
|
1764
|
+
d(e), _(e);
|
|
1765
|
+
};
|
|
1766
|
+
return /* @__PURE__ */ w(H, {
|
|
1767
|
+
error: C,
|
|
1768
|
+
helperText: i,
|
|
1769
|
+
readOnly: a,
|
|
1770
|
+
label: r,
|
|
1771
|
+
htmlFor: c,
|
|
1772
|
+
isRequired: x,
|
|
1773
|
+
children: /* @__PURE__ */ T("div", {
|
|
1774
|
+
className: yr.container,
|
|
1775
|
+
children: [/* @__PURE__ */ w("div", {
|
|
1776
|
+
className: yr.inputWrapper,
|
|
1777
|
+
children: /* @__PURE__ */ w(Ke, {
|
|
1778
|
+
value: m ?? "",
|
|
1779
|
+
international: !0,
|
|
1780
|
+
inputComponent: G,
|
|
1781
|
+
defaultCountry: D(),
|
|
1782
|
+
onChange: (e) => {
|
|
1783
|
+
_?.(e ?? "");
|
|
1784
|
+
},
|
|
1785
|
+
onBlur: () => {
|
|
1786
|
+
h?.();
|
|
1787
|
+
},
|
|
1788
|
+
className: yr.phoneInput,
|
|
1789
|
+
readOnly: a || E,
|
|
1790
|
+
rightIcon: E ? /* @__PURE__ */ w("button", {
|
|
1791
|
+
type: "button",
|
|
1792
|
+
onClick: () => d(null),
|
|
1793
|
+
className: yr.editButton,
|
|
1794
|
+
title: "Change phone number",
|
|
1795
|
+
children: /* @__PURE__ */ w(Tt, { size: 14 })
|
|
1796
|
+
}) : null,
|
|
1797
|
+
...v
|
|
1798
|
+
})
|
|
1799
|
+
}), l && /* @__PURE__ */ w("div", {
|
|
1800
|
+
className: yr.buttonWrapper,
|
|
1801
|
+
children: /* @__PURE__ */ w(lr, {
|
|
1802
|
+
value: m,
|
|
1803
|
+
type: "phone",
|
|
1804
|
+
isVerified: E,
|
|
1805
|
+
onVerifySuccess: O,
|
|
1806
|
+
onStateChange: p
|
|
1807
|
+
})
|
|
1808
|
+
})]
|
|
1809
|
+
})
|
|
1810
|
+
});
|
|
1811
|
+
}, J = {
|
|
1812
|
+
radioGroup: "_radioGroup_f4auz_1",
|
|
1813
|
+
readOnly: "_readOnly_f4auz_9",
|
|
1814
|
+
radioFlex: "_radioFlex_f4auz_14",
|
|
1815
|
+
radioLabel: "_radioLabel_f4auz_20",
|
|
1816
|
+
customInputWrapper: "_customInputWrapper_f4auz_26",
|
|
1817
|
+
customInput: "_customInput_f4auz_26",
|
|
1818
|
+
radio: "_radio_f4auz_1",
|
|
1819
|
+
indicator: "_indicator_f4auz_59",
|
|
1820
|
+
icon: "_icon_f4auz_65"
|
|
1821
|
+
}, xr = ({ field: e }) => {
|
|
1822
|
+
let [t, n] = u.useState(""), [r, i] = u.useState(!1), { key: a = "", label: o = "", helper_text: c = "", readonly: l = !1, values: d = [], options: f = {} } = e, { custom_input: p } = f, m = a, { field: { value: h, onBlur: g, onChange: _, ...v }, fieldState: y } = L({
|
|
1823
|
+
name: m,
|
|
1824
|
+
rules: s(e)
|
|
1825
|
+
}), b = !!e?.required, x = y?.error?.message;
|
|
1826
|
+
return u.useEffect(() => {
|
|
1827
|
+
r || h && d?.findIndex((e) => e === h) === -1 && (i(!0), n(h));
|
|
1828
|
+
}, [h]), /* @__PURE__ */ w(H, {
|
|
1829
|
+
error: x,
|
|
1830
|
+
helperText: c,
|
|
1831
|
+
readOnly: l,
|
|
1832
|
+
label: o,
|
|
1833
|
+
htmlFor: m,
|
|
1834
|
+
isRequired: b,
|
|
1835
|
+
children: /* @__PURE__ */ T(pe.Root, {
|
|
1836
|
+
id: m,
|
|
1837
|
+
className: I(J.radioGroup, l && J.readOnly),
|
|
1838
|
+
onValueChange: (e) => {
|
|
1839
|
+
_ && (e === "Other" ? (i(!0), _(t)) : (i(!1), _(e)));
|
|
1840
|
+
},
|
|
1841
|
+
onBlur: () => {
|
|
1842
|
+
g && g();
|
|
1843
|
+
},
|
|
1844
|
+
value: r ? "Other" : h ?? "",
|
|
1845
|
+
...v,
|
|
1846
|
+
children: [d?.map((e, t) => /* @__PURE__ */ T("div", {
|
|
1847
|
+
className: J.radioFlex,
|
|
1848
|
+
children: [/* @__PURE__ */ w(Sr, {
|
|
1849
|
+
id: `${m}-${e}-${t}`,
|
|
1850
|
+
value: e,
|
|
1851
|
+
children: e
|
|
1852
|
+
}), /* @__PURE__ */ w(B, {
|
|
1853
|
+
htmlFor: `${m}-${e}-${t}`,
|
|
1854
|
+
className: J.radioLabel,
|
|
1855
|
+
children: e
|
|
1856
|
+
})]
|
|
1857
|
+
}, `${e}-${t}`)), !!p && /* @__PURE__ */ T("div", {
|
|
1858
|
+
className: J.customInputWrapper,
|
|
1859
|
+
children: [
|
|
1860
|
+
/* @__PURE__ */ w(Sr, {
|
|
1861
|
+
id: `${m}-other`,
|
|
1862
|
+
value: "Other"
|
|
1863
|
+
}),
|
|
1864
|
+
/* @__PURE__ */ w(B, {
|
|
1865
|
+
className: J.radioLabel,
|
|
1866
|
+
htmlFor: `${m}-other`,
|
|
1867
|
+
children: "Other:"
|
|
1868
|
+
}),
|
|
1869
|
+
/* @__PURE__ */ w(G, {
|
|
1870
|
+
className: J.customInput,
|
|
1871
|
+
name: `radio-other-${m}`,
|
|
1872
|
+
value: t,
|
|
1873
|
+
onChange: (e) => {
|
|
1874
|
+
_?.(e?.target?.value), n(e.target.value);
|
|
1875
|
+
},
|
|
1876
|
+
disabled: !r,
|
|
1877
|
+
placeholder: "Please specify"
|
|
1878
|
+
})
|
|
1879
|
+
]
|
|
1880
|
+
})]
|
|
1881
|
+
})
|
|
1882
|
+
});
|
|
1883
|
+
};
|
|
1884
|
+
xr.displayName = pe.Root.displayName;
|
|
1885
|
+
var Sr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(pe.Item, {
|
|
1886
|
+
ref: n,
|
|
1887
|
+
className: I(J.radio, e),
|
|
1888
|
+
...t,
|
|
1889
|
+
children: /* @__PURE__ */ w(pe.Indicator, {
|
|
1890
|
+
className: J.indicator,
|
|
1891
|
+
children: /* @__PURE__ */ w(Dt, { className: J.icon })
|
|
1892
|
+
})
|
|
1893
|
+
}));
|
|
1894
|
+
Sr.displayName = pe.Item.displayName;
|
|
1895
|
+
//#endregion
|
|
1896
|
+
//#region ../../libraries/react-collection/dist/widgets/richTextWidget/index.module.css.js
|
|
1897
|
+
var Y = {
|
|
1898
|
+
toolbarBtn: "_toolbarBtn_1vbje_2",
|
|
1899
|
+
toolbarBtnSelected: "_toolbarBtnSelected_1vbje_17",
|
|
1900
|
+
menuGroup: "_menuGroup_1vbje_22",
|
|
1901
|
+
menuBarWrapper: "_menuBarWrapper_1vbje_30",
|
|
1902
|
+
editorMenu: "_editorMenu_1vbje_39",
|
|
1903
|
+
readOnly: "_readOnly_1vbje_47",
|
|
1904
|
+
disabled: "_disabled_1vbje_51",
|
|
1905
|
+
editorWrapper: "_editorWrapper_1vbje_57",
|
|
1906
|
+
editor: "_editor_1vbje_39",
|
|
1907
|
+
wrapper: "_wrapper_1vbje_73"
|
|
1908
|
+
}, Cr = /* @__PURE__ */ $t({
|
|
1909
|
+
BulletList: () => Ot,
|
|
1910
|
+
CharacterCount: () => Pe,
|
|
1911
|
+
CodeBlock: () => kt,
|
|
1912
|
+
CodeBlockLowlight: () => xe,
|
|
1913
|
+
Color: () => Fe,
|
|
1914
|
+
Details: () => Ce,
|
|
1915
|
+
DetailsContent: () => we,
|
|
1916
|
+
DetailsSummary: () => Te,
|
|
1917
|
+
Document: () => At,
|
|
1918
|
+
DragHandle: () => jt,
|
|
1919
|
+
DragHandleReact: () => be,
|
|
1920
|
+
Dropcursor: () => Mt,
|
|
1921
|
+
Emoji: () => Ee,
|
|
1922
|
+
FileHandler: () => Se,
|
|
1923
|
+
Focus: () => Ie,
|
|
1924
|
+
Gapcursor: () => Nt,
|
|
1925
|
+
HardBreak: () => Pt,
|
|
1926
|
+
Heading: () => Ft,
|
|
1927
|
+
Highlight: () => Le,
|
|
1928
|
+
HorizontalRule: () => Oe,
|
|
1929
|
+
Image: () => ke,
|
|
1930
|
+
Link: () => It,
|
|
1931
|
+
ListItem: () => Lt,
|
|
1932
|
+
ListKeymap: () => Rt,
|
|
1933
|
+
Mention: () => Ue,
|
|
1934
|
+
OrderedList: () => zt,
|
|
1935
|
+
Paragraph: () => Bt,
|
|
1936
|
+
Subscript: () => Re,
|
|
1937
|
+
Superscript: () => ze,
|
|
1938
|
+
Table: () => Ae,
|
|
1939
|
+
TableCell: () => je,
|
|
1940
|
+
TableHeader: () => Me,
|
|
1941
|
+
TableRow: () => Ne,
|
|
1942
|
+
Text: () => Vt,
|
|
1943
|
+
TextAlign: () => Ht,
|
|
1944
|
+
TextStyle: () => De,
|
|
1945
|
+
Typography: () => Be,
|
|
1946
|
+
Underline: () => Ut,
|
|
1947
|
+
UniqueID: () => Ve,
|
|
1948
|
+
Youtube: () => He
|
|
1949
|
+
});
|
|
1950
|
+
import * as wr from "@tiptap/react";
|
|
1951
|
+
tn(Cr, wr);
|
|
1952
|
+
import * as Tr from "@tiptap/core";
|
|
1953
|
+
tn(Cr, Tr);
|
|
1954
|
+
import * as Er from "@tiptap/extensions";
|
|
1955
|
+
tn(Cr, Er);
|
|
1956
|
+
import * as Dr from "@tiptap/starter-kit";
|
|
1957
|
+
tn(Cr, Dr);
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region ../../libraries/react-collection/dist/widgets/richTextWidget/RichTextWidget.js
|
|
1960
|
+
var X = ({ isSelected: e, className: t, children: n, ...r }) => /* @__PURE__ */ w("button", {
|
|
1961
|
+
className: I(Y.toolbarBtn, e && Y.toolbarBtnSelected, t),
|
|
1962
|
+
type: "button",
|
|
1963
|
+
...r,
|
|
1964
|
+
children: n
|
|
1965
|
+
}), Or = ({ children: e }) => /* @__PURE__ */ w("div", {
|
|
1966
|
+
className: Y.menuGroup,
|
|
1967
|
+
children: e
|
|
1968
|
+
}), kr = ({ editor: e }) => {
|
|
1969
|
+
let t = (0, Cr.useEditorState)({
|
|
1970
|
+
editor: e,
|
|
1971
|
+
selector: ({ editor: e }) => ({
|
|
1972
|
+
isBold: e?.isActive("bold") ?? !1,
|
|
1973
|
+
isItalic: e?.isActive("italic") ?? !1,
|
|
1974
|
+
isUnderline: e?.isActive("underline") ?? !1,
|
|
1975
|
+
isStrike: e?.isActive("strike") ?? !1,
|
|
1976
|
+
isBulletList: e?.isActive("bulletList") ?? !1,
|
|
1977
|
+
isOrderedList: e?.isActive("orderedList") ?? !1,
|
|
1978
|
+
isLink: e?.isActive("link") ?? !1,
|
|
1979
|
+
linkHref: e?.getAttributes("link").href,
|
|
1980
|
+
alignLeft: e?.isActive({ textAlign: "left" }) ?? !1,
|
|
1981
|
+
alignCenter: e?.isActive({ textAlign: "center" }) ?? !1,
|
|
1982
|
+
alignRight: e?.isActive({ textAlign: "right" }) ?? !1,
|
|
1983
|
+
alignJustify: e?.isActive({ textAlign: "justify" }) ?? !1,
|
|
1984
|
+
canUndo: e?.can().chain().focus().undo().run() ?? !1,
|
|
1985
|
+
canRedo: e?.can().chain().focus().redo().run() ?? !1
|
|
1986
|
+
})
|
|
1987
|
+
});
|
|
1988
|
+
if (!e || !t) return null;
|
|
1989
|
+
function n(e) {
|
|
1990
|
+
let t = e.getAttributes("link").href, n = window?.prompt?.("URL", t);
|
|
1991
|
+
if (n !== null) {
|
|
1992
|
+
if (n === "") {
|
|
1993
|
+
e.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
e.chain().focus().extendMarkRange("link").setLink({ href: n }).run();
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
return /* @__PURE__ */ T("div", {
|
|
2000
|
+
className: Y.menuBarWrapper,
|
|
2001
|
+
children: [
|
|
2002
|
+
/* @__PURE__ */ T(Or, { children: [
|
|
2003
|
+
/* @__PURE__ */ w(X, {
|
|
2004
|
+
title: "Bold",
|
|
2005
|
+
isSelected: t.isBold,
|
|
2006
|
+
"aria-label": "bold",
|
|
2007
|
+
onClick: () => e.chain().focus().toggleBold().run(),
|
|
2008
|
+
children: /* @__PURE__ */ w(ot, { size: "1.125rem" })
|
|
2009
|
+
}),
|
|
2010
|
+
/* @__PURE__ */ w(X, {
|
|
2011
|
+
title: "Italic",
|
|
2012
|
+
isSelected: t.isItalic,
|
|
2013
|
+
"aria-label": "italic",
|
|
2014
|
+
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
2015
|
+
children: /* @__PURE__ */ w(lt, { size: "1.125rem" })
|
|
2016
|
+
}),
|
|
2017
|
+
/* @__PURE__ */ w(X, {
|
|
2018
|
+
title: "Underline",
|
|
2019
|
+
isSelected: t.isUnderline,
|
|
2020
|
+
"aria-label": "underline",
|
|
2021
|
+
onClick: () => e.commands.toggleUnderline(),
|
|
2022
|
+
children: /* @__PURE__ */ w(mt, { size: "1.25rem" })
|
|
2023
|
+
}),
|
|
2024
|
+
/* @__PURE__ */ w(X, {
|
|
2025
|
+
title: "Strike",
|
|
2026
|
+
isSelected: t.isStrike,
|
|
2027
|
+
"aria-label": "strike",
|
|
2028
|
+
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
2029
|
+
children: /* @__PURE__ */ w(pt, { size: "1.125rem" })
|
|
2030
|
+
})
|
|
2031
|
+
] }),
|
|
2032
|
+
/* @__PURE__ */ T(Or, { children: [/* @__PURE__ */ w(X, {
|
|
2033
|
+
title: "Bullet list",
|
|
2034
|
+
isSelected: t.isBulletList,
|
|
2035
|
+
"aria-label": "bulletList",
|
|
2036
|
+
onClick: () => e.chain().focus().toggleBulletList().run(),
|
|
2037
|
+
children: /* @__PURE__ */ w(ft, { size: "1.25rem" })
|
|
2038
|
+
}), /* @__PURE__ */ w(X, {
|
|
2039
|
+
title: "Numbered List",
|
|
2040
|
+
isSelected: t.isOrderedList,
|
|
2041
|
+
"aria-label": "numberList",
|
|
2042
|
+
onClick: () => e.chain().focus().toggleOrderedList().run(),
|
|
2043
|
+
children: /* @__PURE__ */ w(dt, { size: "1.25rem" })
|
|
2044
|
+
})] }),
|
|
2045
|
+
/* @__PURE__ */ T(Or, { children: [/* @__PURE__ */ w(X, {
|
|
2046
|
+
title: "Add Link",
|
|
2047
|
+
"aria-label": "link",
|
|
2048
|
+
isSelected: t.isLink,
|
|
2049
|
+
onClick: () => n(e),
|
|
2050
|
+
children: /* @__PURE__ */ w(ut, { size: "1.25rem" })
|
|
2051
|
+
}), /* @__PURE__ */ w(X, {
|
|
2052
|
+
title: "Remove Link",
|
|
2053
|
+
"aria-label": "unlink",
|
|
2054
|
+
disabled: !t.linkHref,
|
|
2055
|
+
onClick: () => e.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
2056
|
+
children: /* @__PURE__ */ w(ht, { size: "1.25rem" })
|
|
2057
|
+
})] }),
|
|
2058
|
+
/* @__PURE__ */ T(Or, { children: [
|
|
2059
|
+
/* @__PURE__ */ w(X, {
|
|
2060
|
+
title: "Left Align",
|
|
2061
|
+
isSelected: t.alignLeft,
|
|
2062
|
+
"aria-label": "leftAlign",
|
|
2063
|
+
onClick: () => e.chain().focus().setTextAlign("left").run(),
|
|
2064
|
+
children: /* @__PURE__ */ w(rt, { size: "1.125rem" })
|
|
2065
|
+
}),
|
|
2066
|
+
/* @__PURE__ */ w(X, {
|
|
2067
|
+
title: "Center Align",
|
|
2068
|
+
isSelected: t.alignCenter,
|
|
2069
|
+
"aria-label": "centerAlign",
|
|
2070
|
+
onClick: () => e.chain().focus().setTextAlign("center").run(),
|
|
2071
|
+
children: /* @__PURE__ */ w(it, { size: "1.125rem" })
|
|
2072
|
+
}),
|
|
2073
|
+
/* @__PURE__ */ w(X, {
|
|
2074
|
+
title: "Right Align",
|
|
2075
|
+
isSelected: t.alignRight,
|
|
2076
|
+
"aria-label": "rightAlign",
|
|
2077
|
+
onClick: () => e.chain().focus().setTextAlign("right").run(),
|
|
2078
|
+
children: /* @__PURE__ */ w(at, { size: "1.125rem" })
|
|
2079
|
+
}),
|
|
2080
|
+
/* @__PURE__ */ w(X, {
|
|
2081
|
+
title: "Justify Align",
|
|
2082
|
+
isSelected: t.alignJustify,
|
|
2083
|
+
"aria-label": "justifyAlign",
|
|
2084
|
+
onClick: () => e.chain().focus().setTextAlign("justify").run(),
|
|
2085
|
+
children: /* @__PURE__ */ w(nt, { size: "1.125rem" })
|
|
2086
|
+
})
|
|
2087
|
+
] }),
|
|
2088
|
+
/* @__PURE__ */ w(Or, { children: /* @__PURE__ */ w(X, {
|
|
2089
|
+
title: "Clear Formatting",
|
|
2090
|
+
"aria-label": "clear-formatting",
|
|
2091
|
+
onClick: () => e.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
2092
|
+
children: /* @__PURE__ */ w(Kt, { size: "1.125rem" })
|
|
2093
|
+
}) }),
|
|
2094
|
+
/* @__PURE__ */ T(Or, { children: [/* @__PURE__ */ w(X, {
|
|
2095
|
+
title: "Undo",
|
|
2096
|
+
"aria-label": "undo",
|
|
2097
|
+
onClick: () => e.chain().focus().undo().run(),
|
|
2098
|
+
disabled: !t.canUndo,
|
|
2099
|
+
children: /* @__PURE__ */ w(Gt, { size: "1.125rem" })
|
|
2100
|
+
}), /* @__PURE__ */ w(X, {
|
|
2101
|
+
title: "Redo",
|
|
2102
|
+
"aria-label": "redo",
|
|
2103
|
+
onClick: () => e.chain().focus().redo().run(),
|
|
2104
|
+
disabled: !t.canRedo,
|
|
2105
|
+
children: /* @__PURE__ */ w(Wt, { size: "1.125rem" })
|
|
2106
|
+
})] })
|
|
2107
|
+
]
|
|
2108
|
+
});
|
|
2109
|
+
}, Ar = ({ field: t }) => {
|
|
2110
|
+
let [r, i] = S(!1), { key: a = "", label: o = "", helper_text: c = "", readonly: l = !1 } = t, u = a, { field: { value: d, onBlur: f, onChange: p, disabled: m }, fieldState: h } = L({
|
|
2111
|
+
name: u,
|
|
2112
|
+
rules: s(t)
|
|
2113
|
+
}), g = !!t?.required, _ = h?.error?.message, y = (0, Cr.useEditor)({
|
|
2114
|
+
editorProps: { attributes: { class: e } },
|
|
2115
|
+
extensions: [
|
|
2116
|
+
Cr.StarterKit.configure({
|
|
2117
|
+
blockquote: !1,
|
|
2118
|
+
codeBlock: !1,
|
|
2119
|
+
horizontalRule: !1,
|
|
2120
|
+
link: {
|
|
2121
|
+
openOnClick: !1,
|
|
2122
|
+
HTMLAttributes: { target: "_blank" }
|
|
2123
|
+
}
|
|
2124
|
+
}),
|
|
2125
|
+
Ht.configure({ types: ["heading", "paragraph"] }),
|
|
2126
|
+
Cr.Placeholder.configure({ placeholder: "Write something ..." })
|
|
2127
|
+
],
|
|
2128
|
+
content: d,
|
|
2129
|
+
editable: !m && !l,
|
|
2130
|
+
onBlur: () => {
|
|
2131
|
+
f();
|
|
2132
|
+
},
|
|
2133
|
+
onUpdate: ({ editor: e }) => {
|
|
2134
|
+
p(e.getHTML());
|
|
2135
|
+
},
|
|
2136
|
+
immediatelyRender: !1
|
|
2137
|
+
});
|
|
2138
|
+
return v(() => {
|
|
2139
|
+
y?.commands && !r && (y.commands.setContent(d || ""), i(!0));
|
|
2140
|
+
}, [d]), /* @__PURE__ */ w(n, {
|
|
2141
|
+
theme: { style: an({ baseSpacing: ".875rem" }) },
|
|
2142
|
+
children: /* @__PURE__ */ w(H, {
|
|
2143
|
+
error: _,
|
|
2144
|
+
helperText: c,
|
|
2145
|
+
readOnly: l,
|
|
2146
|
+
label: o,
|
|
2147
|
+
htmlFor: u,
|
|
2148
|
+
isRequired: g,
|
|
2149
|
+
children: /* @__PURE__ */ T("div", {
|
|
2150
|
+
className: I(Y.wrapper, m && Y.disabled, l && Y.readOnly),
|
|
2151
|
+
children: [/* @__PURE__ */ w("div", {
|
|
2152
|
+
className: Y.editorMenu,
|
|
2153
|
+
children: /* @__PURE__ */ w(kr, { editor: y })
|
|
2154
|
+
}), /* @__PURE__ */ w("div", {
|
|
2155
|
+
className: I(Sn.input, Y.editorWrapper),
|
|
2156
|
+
onClick: () => y?.commands?.focus(),
|
|
2157
|
+
children: /* @__PURE__ */ w(Cr.EditorContent, {
|
|
2158
|
+
id: u,
|
|
2159
|
+
className: Y.editor,
|
|
2160
|
+
name: u,
|
|
2161
|
+
editor: y,
|
|
2162
|
+
readOnly: l,
|
|
2163
|
+
disabled: m
|
|
2164
|
+
})
|
|
2165
|
+
})]
|
|
2166
|
+
})
|
|
2167
|
+
})
|
|
2168
|
+
});
|
|
2169
|
+
}, jr = {
|
|
2170
|
+
switch: "_switch_p86fe_1",
|
|
2171
|
+
switchThumb: "_switchThumb_p86fe_31"
|
|
2172
|
+
}, Mr = u.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ w(he.Root, {
|
|
2173
|
+
className: I(jr.switch, e),
|
|
2174
|
+
...t,
|
|
2175
|
+
ref: n,
|
|
2176
|
+
children: /* @__PURE__ */ w(he.Thumb, { className: jr.switchThumb })
|
|
2177
|
+
}));
|
|
2178
|
+
Mr.displayName = he.Root.displayName;
|
|
2179
|
+
//#endregion
|
|
2180
|
+
//#region ../../libraries/react-collection/dist/widgets/switchWidget/index.module.css.js
|
|
2181
|
+
var Nr = {
|
|
2182
|
+
wrapper: "_wrapper_v4qo4_1",
|
|
2183
|
+
label: "_label_v4qo4_10"
|
|
2184
|
+
}, Pr = ({ field: e }) => {
|
|
2185
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, a = t, { field: { value: o, onBlur: c, onChange: l, ...u }, fieldState: d } = L({
|
|
2186
|
+
name: a,
|
|
2187
|
+
rules: s(e)
|
|
2188
|
+
}), f = !!e?.required, p = d?.error?.message;
|
|
2189
|
+
return /* @__PURE__ */ w(H, {
|
|
2190
|
+
error: p,
|
|
2191
|
+
helperText: r,
|
|
2192
|
+
readOnly: i,
|
|
2193
|
+
children: /* @__PURE__ */ T("div", {
|
|
2194
|
+
className: Nr.wrapper,
|
|
2195
|
+
children: [n && /* @__PURE__ */ w(B, {
|
|
2196
|
+
htmlFor: a,
|
|
2197
|
+
isRequired: f,
|
|
2198
|
+
className: Nr.label,
|
|
2199
|
+
children: n
|
|
2200
|
+
}), /* @__PURE__ */ w(Mr, {
|
|
2201
|
+
id: a,
|
|
2202
|
+
checked: !!o,
|
|
2203
|
+
onCheckedChange: (e) => l?.(e),
|
|
2204
|
+
onBlur: () => c?.(),
|
|
2205
|
+
...u
|
|
2206
|
+
})]
|
|
2207
|
+
})
|
|
2208
|
+
});
|
|
2209
|
+
}, Fr = { textarea: "_textarea_11s7b_1" }, Ir = ({ field: e }) => {
|
|
2210
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, a = t, o = !!e?.required, { field: { value: c, onBlur: l, onChange: u, ref: d, disabled: f, ...p }, fieldState: m } = L({
|
|
2211
|
+
name: a,
|
|
2212
|
+
rules: s(e)
|
|
2213
|
+
}), h = m?.error?.message;
|
|
2214
|
+
return /* @__PURE__ */ w(H, {
|
|
2215
|
+
error: h,
|
|
2216
|
+
helperText: r,
|
|
2217
|
+
label: n,
|
|
2218
|
+
htmlFor: a,
|
|
2219
|
+
isRequired: o,
|
|
2220
|
+
children: /* @__PURE__ */ w("textarea", {
|
|
2221
|
+
id: a,
|
|
2222
|
+
className: I(Sn.input, Fr.textarea),
|
|
2223
|
+
readOnly: i,
|
|
2224
|
+
value: c || "",
|
|
2225
|
+
onChange: u,
|
|
2226
|
+
onBlur: l,
|
|
2227
|
+
ref: d,
|
|
2228
|
+
disabled: f,
|
|
2229
|
+
...p
|
|
2230
|
+
})
|
|
2231
|
+
});
|
|
2232
|
+
}, Lr = ({ field: e, inputStyles: t, ...n }) => {
|
|
2233
|
+
let { key: r = "", label: i = "", helper_text: a = "", readonly: o = !1 } = e, c = r, l = !!e?.required, { field: { value: u, onBlur: d, onChange: f, ref: p, disabled: m, ...h }, fieldState: g } = L({
|
|
2234
|
+
name: c,
|
|
2235
|
+
rules: s(e)
|
|
2236
|
+
}), _ = g?.error?.message;
|
|
2237
|
+
return /* @__PURE__ */ w(H, {
|
|
2238
|
+
error: _,
|
|
2239
|
+
helperText: a,
|
|
2240
|
+
label: i,
|
|
2241
|
+
htmlFor: c,
|
|
2242
|
+
isRequired: l,
|
|
2243
|
+
children: /* @__PURE__ */ w(G, {
|
|
2244
|
+
id: c,
|
|
2245
|
+
className: I(t),
|
|
2246
|
+
readOnly: o,
|
|
2247
|
+
value: u || "",
|
|
2248
|
+
onChange: f,
|
|
2249
|
+
onBlur: d,
|
|
2250
|
+
ref: p,
|
|
2251
|
+
disabled: m,
|
|
2252
|
+
...h,
|
|
2253
|
+
...n
|
|
2254
|
+
})
|
|
2255
|
+
});
|
|
2256
|
+
}, Rr = {
|
|
2257
|
+
container: "_container_wphv6_1",
|
|
2258
|
+
timeInput: "_timeInput_wphv6_8",
|
|
2259
|
+
clearButton: "_clearButton_wphv6_18"
|
|
2260
|
+
}, zr = ({ field: e }) => {
|
|
2261
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, a = t, { field: { value: o, onBlur: c, onChange: l, ref: u }, fieldState: d } = L({
|
|
2262
|
+
name: a,
|
|
2263
|
+
rules: s(e)
|
|
2264
|
+
}), f = !!e?.required, p = d?.error?.message;
|
|
2265
|
+
return /* @__PURE__ */ w(H, {
|
|
2266
|
+
helperText: r,
|
|
2267
|
+
readOnly: i,
|
|
2268
|
+
error: p,
|
|
2269
|
+
htmlFor: a,
|
|
2270
|
+
isRequired: f,
|
|
2271
|
+
label: n,
|
|
2272
|
+
children: /* @__PURE__ */ T("div", {
|
|
2273
|
+
className: Rr.container,
|
|
2274
|
+
children: [/* @__PURE__ */ w("input", {
|
|
2275
|
+
id: a,
|
|
2276
|
+
ref: u,
|
|
2277
|
+
type: "time",
|
|
2278
|
+
value: o || "",
|
|
2279
|
+
onChange: (e) => {
|
|
2280
|
+
l(e.target.value || null);
|
|
2281
|
+
},
|
|
2282
|
+
onBlur: c,
|
|
2283
|
+
readOnly: i,
|
|
2284
|
+
className: I(Sn.input, Rr.timeInput)
|
|
2285
|
+
}), o && !i && /* @__PURE__ */ w("button", {
|
|
2286
|
+
type: "button",
|
|
2287
|
+
onClick: (e) => {
|
|
2288
|
+
e.preventDefault(), e.stopPropagation(), l(null);
|
|
2289
|
+
},
|
|
2290
|
+
className: Rr.clearButton,
|
|
2291
|
+
"aria-label": "Clear time",
|
|
2292
|
+
children: /* @__PURE__ */ w(ue, { size: 16 })
|
|
2293
|
+
})]
|
|
2294
|
+
})
|
|
2295
|
+
});
|
|
2296
|
+
}, Br = {
|
|
2297
|
+
wrapper: "_wrapper_b9ka2_1",
|
|
2298
|
+
checkboxReset: "_checkboxReset_b9ka2_9",
|
|
2299
|
+
label: "_label_b9ka2_13"
|
|
2300
|
+
}, Vr = ({ field: e }) => {
|
|
2301
|
+
let { key: t = "", label: n = "", helper_text: r = "", readonly: i = !1 } = e, { field: { name: a, onBlur: o, onChange: c, ref: l, value: u, disabled: d }, fieldState: { error: f } } = L({
|
|
2302
|
+
name: t,
|
|
2303
|
+
rules: s(e)
|
|
2304
|
+
});
|
|
2305
|
+
return /* @__PURE__ */ w(H, {
|
|
2306
|
+
error: f?.message,
|
|
2307
|
+
helperText: r,
|
|
2308
|
+
readOnly: i,
|
|
2309
|
+
children: /* @__PURE__ */ T("div", {
|
|
2310
|
+
className: Br.wrapper,
|
|
2311
|
+
ref: l,
|
|
2312
|
+
children: [/* @__PURE__ */ w(Vn, {
|
|
2313
|
+
className: Br.checkboxReset,
|
|
2314
|
+
id: a,
|
|
2315
|
+
name: a,
|
|
2316
|
+
checked: !!u,
|
|
2317
|
+
onCheckedChange: (e) => c(e),
|
|
2318
|
+
onBlur: () => {
|
|
2319
|
+
o();
|
|
2320
|
+
},
|
|
2321
|
+
disabled: d
|
|
2322
|
+
}), n && /* @__PURE__ */ w(B, {
|
|
2323
|
+
className: Br.label,
|
|
2324
|
+
htmlFor: a,
|
|
2325
|
+
isRequired: e?.required,
|
|
2326
|
+
children: n
|
|
2327
|
+
})]
|
|
2328
|
+
})
|
|
2329
|
+
});
|
|
2330
|
+
}, Hr = {
|
|
2331
|
+
wrapper: "_wrapper_1czoi_1",
|
|
2332
|
+
btn: "_btn_1czoi_8",
|
|
2333
|
+
container: "_container_1czoi_18",
|
|
2334
|
+
mediaCardGrid: "_mediaCardGrid_1czoi_23"
|
|
2335
|
+
}, Z = {
|
|
2336
|
+
mediaCard: "_mediaCard_1elnt_2",
|
|
2337
|
+
selected: "_selected_1elnt_16",
|
|
2338
|
+
fileIconContainer: "_fileIconContainer_1elnt_24",
|
|
2339
|
+
fileIcon: "_fileIcon_1elnt_24",
|
|
2340
|
+
image: "_image_1elnt_36",
|
|
2341
|
+
hoverOverlay: "_hoverOverlay_1elnt_42",
|
|
2342
|
+
deleteButton: "_deleteButton_1elnt_59",
|
|
2343
|
+
deleteIcon: "_deleteIcon_1elnt_69",
|
|
2344
|
+
checkboxContainer: "_checkboxContainer_1elnt_75",
|
|
2345
|
+
filenameOverlay: "_filenameOverlay_1elnt_85",
|
|
2346
|
+
filename: "_filename_1elnt_85"
|
|
2347
|
+
}, Ur = ({ file: e, onDelete: t, onClick: n, showCheckbox: r = !1, isSelected: i = !1, showDelete: a = !0 }) => {
|
|
2348
|
+
let o = (n) => {
|
|
2349
|
+
n.stopPropagation(), n.preventDefault(), t?.(e.id);
|
|
2350
|
+
}, s = (t) => {
|
|
2351
|
+
if (n) {
|
|
2352
|
+
t.preventDefault(), n(e);
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
e?.location || t.preventDefault();
|
|
2356
|
+
}, c = e?.filename || e?.location?.split("/")?.[e?.location?.split("/").length - 1];
|
|
2357
|
+
return /* @__PURE__ */ T("a", {
|
|
2358
|
+
href: e?.location || void 0,
|
|
2359
|
+
target: "_blank",
|
|
2360
|
+
rel: "noopener noreferrer",
|
|
2361
|
+
className: `${Z.mediaCard} ${i ? Z.selected : ""}`,
|
|
2362
|
+
onClick: s,
|
|
2363
|
+
children: [
|
|
2364
|
+
e?.kind === "image" ? /* @__PURE__ */ w("img", {
|
|
2365
|
+
alt: "uploaded-file-icon",
|
|
2366
|
+
className: Z.image,
|
|
2367
|
+
src: e?.location
|
|
2368
|
+
}) : /* @__PURE__ */ w("div", {
|
|
2369
|
+
className: Z.fileIconContainer,
|
|
2370
|
+
children: /* @__PURE__ */ w(qt, {
|
|
2371
|
+
size: "60px",
|
|
2372
|
+
className: Z.fileIcon
|
|
2373
|
+
})
|
|
2374
|
+
}),
|
|
2375
|
+
/* @__PURE__ */ w("div", { className: Z.hoverOverlay }),
|
|
2376
|
+
r && /* @__PURE__ */ w("div", {
|
|
2377
|
+
className: Z.checkboxContainer,
|
|
2378
|
+
onClick: (e) => {
|
|
2379
|
+
e.preventDefault(), e.stopPropagation();
|
|
2380
|
+
},
|
|
2381
|
+
children: /* @__PURE__ */ w(Vn, {
|
|
2382
|
+
checked: i,
|
|
2383
|
+
onChange: () => {}
|
|
2384
|
+
})
|
|
2385
|
+
}),
|
|
2386
|
+
a && /* @__PURE__ */ w(z, {
|
|
2387
|
+
className: Z.deleteButton,
|
|
2388
|
+
size: "sm",
|
|
2389
|
+
variant: "default",
|
|
2390
|
+
scheme: "secondary",
|
|
2391
|
+
onClick: o,
|
|
2392
|
+
children: /* @__PURE__ */ w(ue, { className: Z.deleteIcon })
|
|
2393
|
+
}),
|
|
2394
|
+
/* @__PURE__ */ w("div", {
|
|
2395
|
+
className: Z.filenameOverlay,
|
|
2396
|
+
children: /* @__PURE__ */ w("p", {
|
|
2397
|
+
className: Z.filename,
|
|
2398
|
+
children: c
|
|
2399
|
+
})
|
|
2400
|
+
})
|
|
2401
|
+
]
|
|
2402
|
+
});
|
|
2403
|
+
}, Q = {
|
|
2404
|
+
commonPreviewWrapper: "_commonPreviewWrapper_32n1f_2",
|
|
2405
|
+
previewText: "_previewText_32n1f_8",
|
|
2406
|
+
saveBtn: "_saveBtn_32n1f_16",
|
|
2407
|
+
fileUploadDropBoxContainer: "_fileUploadDropBoxContainer_32n1f_24",
|
|
2408
|
+
dropzone: "_dropzone_32n1f_30",
|
|
2409
|
+
disabled: "_disabled_32n1f_44",
|
|
2410
|
+
uploadingOverlay: "_uploadingOverlay_32n1f_49",
|
|
2411
|
+
dropText: "_dropText_32n1f_59",
|
|
2412
|
+
buttonContainer: "_buttonContainer_32n1f_67",
|
|
2413
|
+
disabledPointer: "_disabledPointer_32n1f_72",
|
|
2414
|
+
uploadButton: "_uploadButton_32n1f_76",
|
|
2415
|
+
mediaCardGrid: "_mediaCardGrid_32n1f_81"
|
|
2416
|
+
}, Wr = ({ isOpen: e, setIsOpen: t, files: n, kind: r, allowedExtensions: i, isMultiple: a, isLoading: o, handleUploadFiles: s, handleChange: c }) => {
|
|
2417
|
+
let l = () => {
|
|
2418
|
+
t(!1);
|
|
2419
|
+
}, u = n.length, { getRootProps: d, getInputProps: f, isDragActive: p } = Jt({
|
|
2420
|
+
onDrop: (e) => {
|
|
2421
|
+
if (e.length === 0) {
|
|
2422
|
+
A("No file selected. Please select one file.");
|
|
2423
|
+
return;
|
|
2424
|
+
}
|
|
2425
|
+
s(e);
|
|
2426
|
+
},
|
|
2427
|
+
accept: b(() => {
|
|
2428
|
+
let e = r.reduce((e, t) => ({
|
|
2429
|
+
...e,
|
|
2430
|
+
...te[t]
|
|
2431
|
+
}), {});
|
|
2432
|
+
if (!i || i.length === 0) return e;
|
|
2433
|
+
let t = i.map((e) => `.${e}`), n = {};
|
|
2434
|
+
for (let [r, i] of Object.entries(e)) {
|
|
2435
|
+
let e = i.filter((e) => t.includes(e));
|
|
2436
|
+
e.length > 0 && (n[r] = e);
|
|
2437
|
+
}
|
|
2438
|
+
return n;
|
|
2439
|
+
}, [r, i]),
|
|
2440
|
+
multiple: a,
|
|
2441
|
+
maxSize: 25 * 1024 * 1024,
|
|
2442
|
+
disabled: o,
|
|
2443
|
+
onDropRejected: (e) => {
|
|
2444
|
+
e.forEach((e) => {
|
|
2445
|
+
e.errors.forEach((t) => {
|
|
2446
|
+
t.code === "file-too-large" && A(`${e.file.name} is bigger than 25MB`);
|
|
2447
|
+
});
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2451
|
+
return /* @__PURE__ */ T(ar, {
|
|
2452
|
+
isOpen: e,
|
|
2453
|
+
onClose: () => l(),
|
|
2454
|
+
description: "",
|
|
2455
|
+
title: r?.length > 1 ? "Upload file" : `Upload ${r?.[0]}`,
|
|
2456
|
+
size: "lg",
|
|
2457
|
+
children: [/* @__PURE__ */ T(An, { children: [/* @__PURE__ */ w("div", {
|
|
2458
|
+
className: Q.fileUploadDropBoxContainer,
|
|
2459
|
+
children: /* @__PURE__ */ T("div", {
|
|
2460
|
+
className: I(Q.dropzone, o && Q.disabled),
|
|
2461
|
+
...d(),
|
|
2462
|
+
children: [
|
|
2463
|
+
o && /* @__PURE__ */ w("div", {
|
|
2464
|
+
className: Q.uploadingOverlay,
|
|
2465
|
+
children: /* @__PURE__ */ w(sn, {})
|
|
2466
|
+
}),
|
|
2467
|
+
/* @__PURE__ */ w("p", {
|
|
2468
|
+
className: Q.dropText,
|
|
2469
|
+
children: p ? "Drop your files here..." : a && n.length > 0 ? "Drag & Drop here to upload more!" : n?.length > 0 ? "Drag & Drop here to upload another file!" : "Drag & Drop here to upload file!"
|
|
2470
|
+
}),
|
|
2471
|
+
/* @__PURE__ */ w("div", {
|
|
2472
|
+
className: I(Q.buttonContainer, o && Q.disabledPointer),
|
|
2473
|
+
children: /* @__PURE__ */ w(Fn, {
|
|
2474
|
+
label: "Upload",
|
|
2475
|
+
children: /* @__PURE__ */ T(z, {
|
|
2476
|
+
size: "icon",
|
|
2477
|
+
className: Q.uploadButton,
|
|
2478
|
+
children: [/* @__PURE__ */ w("input", { ...f() }), /* @__PURE__ */ w(le, { size: 20 })]
|
|
2479
|
+
})
|
|
2480
|
+
})
|
|
2481
|
+
})
|
|
2482
|
+
]
|
|
2483
|
+
})
|
|
2484
|
+
}), n.length > 0 && /* @__PURE__ */ T("div", {
|
|
2485
|
+
className: Q.commonPreviewWrapper,
|
|
2486
|
+
children: [/* @__PURE__ */ w("h3", {
|
|
2487
|
+
className: Q.previewText,
|
|
2488
|
+
children: "Selected Files"
|
|
2489
|
+
}), /* @__PURE__ */ w("div", {
|
|
2490
|
+
className: Q.mediaCardGrid,
|
|
2491
|
+
children: n.map((e) => /* @__PURE__ */ w(Ur, {
|
|
2492
|
+
file: e,
|
|
2493
|
+
onDelete: (e) => {
|
|
2494
|
+
c(n.filter((t) => t.id !== e));
|
|
2495
|
+
}
|
|
2496
|
+
}, e.id))
|
|
2497
|
+
})]
|
|
2498
|
+
})] }), /* @__PURE__ */ w("div", {
|
|
2499
|
+
className: Q.saveBtn,
|
|
2500
|
+
children: /* @__PURE__ */ T(z, {
|
|
2501
|
+
variant: "default",
|
|
2502
|
+
onClick: l,
|
|
2503
|
+
children: ["Save\xA0", u === 1 ? `${u} file` : `${u} files`]
|
|
2504
|
+
})
|
|
2505
|
+
})]
|
|
2506
|
+
});
|
|
2507
|
+
}, Gr = (e) => Array.isArray(e) && e.every((e) => typeof e == "object" && !!e && "location" in e), Kr = ({ field: e, kind: t = O, isMultiple: n }) => {
|
|
2508
|
+
let r = e.options?.allowed_upload_types, a = r && r.length > 0 ? t.filter((e) => r.includes(e)) : null, o = a && a.length > 0 ? a : t, [c, l] = S(!1), [u, d] = S(!1), { media: f } = M(), { field: { onChange: p, value: m, onBlur: h, disabled: g, ref: _ }, fieldState: v } = L({
|
|
2509
|
+
name: e?.key || "",
|
|
2510
|
+
rules: s(e)
|
|
2511
|
+
}), y = e.options?.allowed_extensions, x = b(() => {
|
|
2512
|
+
let e = o.flatMap((e) => i[e]);
|
|
2513
|
+
return y && y.length > 0 ? e.filter((e) => y.includes(e)) : e;
|
|
2514
|
+
}, [o, y]), E = Array.isArray(m) ? m : m ? [m] : [], D = (e) => {
|
|
2515
|
+
p(n ? e : e?.[0]);
|
|
2516
|
+
}, k = async (e) => {
|
|
2517
|
+
let t = new FormData(), r = n ? e : e.slice(0, 1);
|
|
2518
|
+
if (r.length !== 0) {
|
|
2519
|
+
r.forEach((e) => {
|
|
2520
|
+
let n = e.name.split(".").pop()?.toLowerCase();
|
|
2521
|
+
n && x.includes(n) && t.append("media", e);
|
|
2522
|
+
}), d(!0);
|
|
2523
|
+
try {
|
|
2524
|
+
let e = await f?.mediaBulkUpload(t);
|
|
2525
|
+
if (e?.content?.data && Gr(e.content.data)) {
|
|
2526
|
+
let t = e.content.data;
|
|
2527
|
+
D(n ? [...E, ...t] : t);
|
|
2528
|
+
}
|
|
2529
|
+
} catch (e) {
|
|
2530
|
+
ee(e);
|
|
2531
|
+
} finally {
|
|
2532
|
+
d(!1);
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}, { label: A = "", helper_text: te = "", readonly: j = !1 } = e;
|
|
2536
|
+
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T(H, {
|
|
2537
|
+
error: v?.error?.message,
|
|
2538
|
+
helperText: te,
|
|
2539
|
+
readOnly: j,
|
|
2540
|
+
htmlFor: e.key,
|
|
2541
|
+
isRequired: e?.required,
|
|
2542
|
+
label: A,
|
|
2543
|
+
children: [/* @__PURE__ */ T("div", {
|
|
2544
|
+
className: Hr.wrapper,
|
|
2545
|
+
ref: _,
|
|
2546
|
+
children: [/* @__PURE__ */ w(z, {
|
|
2547
|
+
size: "icon",
|
|
2548
|
+
variant: "outline",
|
|
2549
|
+
disabled: g || j,
|
|
2550
|
+
onClick: () => l(!0),
|
|
2551
|
+
className: Hr.btn,
|
|
2552
|
+
children: /* @__PURE__ */ w(le, { size: 15 })
|
|
2553
|
+
}), /* @__PURE__ */ w(G, {
|
|
2554
|
+
name: "pasteUrl",
|
|
2555
|
+
placeholder: "Paste your files here...",
|
|
2556
|
+
onBlur: () => h(),
|
|
2557
|
+
onPaste: (e) => {
|
|
2558
|
+
let t = [];
|
|
2559
|
+
Array.from(e.clipboardData.items).forEach((e) => {
|
|
2560
|
+
if (e?.kind === "file") {
|
|
2561
|
+
let n = e?.getAsFile();
|
|
2562
|
+
n && t.push(n);
|
|
2563
|
+
}
|
|
2564
|
+
}), t.length > 0 && k(t);
|
|
2565
|
+
},
|
|
2566
|
+
disabled: g,
|
|
2567
|
+
readOnly: j,
|
|
2568
|
+
rightIcon: u && /* @__PURE__ */ w(sn, {})
|
|
2569
|
+
})]
|
|
2570
|
+
}), E.length > 0 && /* @__PURE__ */ w("div", {
|
|
2571
|
+
className: Hr.container,
|
|
2572
|
+
children: /* @__PURE__ */ w("div", {
|
|
2573
|
+
className: Hr.mediaCardGrid,
|
|
2574
|
+
children: E.map((e) => /* @__PURE__ */ w(Ur, {
|
|
2575
|
+
file: e,
|
|
2576
|
+
onDelete: (e) => {
|
|
2577
|
+
D(E.filter((t) => t.id !== e));
|
|
2578
|
+
}
|
|
2579
|
+
}, e.id))
|
|
2580
|
+
})
|
|
2581
|
+
})]
|
|
2582
|
+
}), /* @__PURE__ */ w(Wr, {
|
|
2583
|
+
isOpen: c,
|
|
2584
|
+
setIsOpen: l,
|
|
2585
|
+
files: E,
|
|
2586
|
+
kind: o,
|
|
2587
|
+
allowedExtensions: y,
|
|
2588
|
+
isMultiple: n,
|
|
2589
|
+
isLoading: u,
|
|
2590
|
+
handleUploadFiles: k,
|
|
2591
|
+
handleChange: D
|
|
2592
|
+
})] });
|
|
2593
|
+
}, qr = (e) => /* @__PURE__ */ w(Lr, {
|
|
2594
|
+
leftIcon: /* @__PURE__ */ w(gt, { size: "20px" }),
|
|
2595
|
+
...e
|
|
2596
|
+
}), Jr = {
|
|
2597
|
+
TextWidget: l((e) => /* @__PURE__ */ w(Lr, { ...e })),
|
|
2598
|
+
NumberWidget: l((e) => /* @__PURE__ */ w(Lr, {
|
|
2599
|
+
type: "number",
|
|
2600
|
+
step: "any",
|
|
2601
|
+
...e
|
|
2602
|
+
})),
|
|
2603
|
+
CurrencyWidget: l((e) => /* @__PURE__ */ w(Wn, { ...e })),
|
|
2604
|
+
MultiTextWidget: l((e) => /* @__PURE__ */ w(vr, { ...e })),
|
|
2605
|
+
TextareaWidget: l((e) => /* @__PURE__ */ w(Ir, { ...e })),
|
|
2606
|
+
RichTextWidget: l((e) => /* @__PURE__ */ w(Ar, { ...e })),
|
|
2607
|
+
EmailWidget: l((e) => /* @__PURE__ */ w(dr, { ...e })),
|
|
2608
|
+
PhoneWidget: l((e) => /* @__PURE__ */ w(br, { ...e })),
|
|
2609
|
+
URLWidget: l((e) => /* @__PURE__ */ w(qr, { ...e })),
|
|
2610
|
+
DropdownWidget: l((e) => /* @__PURE__ */ w(Xn, {
|
|
2611
|
+
isMulti: !1,
|
|
2612
|
+
...e
|
|
2613
|
+
})),
|
|
2614
|
+
MultiDropdownWidget: l((e) => /* @__PURE__ */ w(Xn, {
|
|
2615
|
+
isMulti: !0,
|
|
2616
|
+
...e
|
|
2617
|
+
})),
|
|
2618
|
+
RadioWidget: l((e) => /* @__PURE__ */ w(xr, { ...e })),
|
|
2619
|
+
CheckboxWidget: l((e) => /* @__PURE__ */ w(Un, { ...e })),
|
|
2620
|
+
ToggleCheckboxWidget: l((e) => /* @__PURE__ */ w(Vr, { ...e })),
|
|
2621
|
+
SwitchWidget: l((e) => /* @__PURE__ */ w(Pr, { ...e })),
|
|
2622
|
+
DateTimeWidget: l((e) => /* @__PURE__ */ w(Jn, { ...e })),
|
|
2623
|
+
DateWidget: l((e) => /* @__PURE__ */ w(Jn, { ...e })),
|
|
2624
|
+
TimeWidget: l((e) => /* @__PURE__ */ w(zr, { ...e })),
|
|
2625
|
+
GeocoderWidget: l((e) => /* @__PURE__ */ w(pr, { ...e })),
|
|
2626
|
+
MultiGeocoderWidget: l((e) => /* @__PURE__ */ w(hr, { ...e })),
|
|
2627
|
+
ImageUploadWidget: l((e) => /* @__PURE__ */ w(Kr, {
|
|
2628
|
+
kind: ["image"],
|
|
2629
|
+
isMultiple: !1,
|
|
2630
|
+
...e
|
|
2631
|
+
})),
|
|
2632
|
+
MultiImageUploadWidget: l((e) => /* @__PURE__ */ w(Kr, {
|
|
2633
|
+
kind: ["image"],
|
|
2634
|
+
isMultiple: !0,
|
|
2635
|
+
...e
|
|
2636
|
+
})),
|
|
2637
|
+
FileUploadWidget: l((e) => /* @__PURE__ */ w(Kr, {
|
|
2638
|
+
kind: [
|
|
2639
|
+
"audio",
|
|
2640
|
+
"video",
|
|
2641
|
+
"image",
|
|
2642
|
+
"document"
|
|
2643
|
+
],
|
|
2644
|
+
isMultiple: !1,
|
|
2645
|
+
...e
|
|
2646
|
+
})),
|
|
2647
|
+
MultiFileUploadWidget: l((e) => /* @__PURE__ */ w(Kr, {
|
|
2648
|
+
kind: [
|
|
2649
|
+
"audio",
|
|
2650
|
+
"video",
|
|
2651
|
+
"image",
|
|
2652
|
+
"document"
|
|
2653
|
+
],
|
|
2654
|
+
isMultiple: !0,
|
|
2655
|
+
...e
|
|
2656
|
+
}))
|
|
2657
|
+
}, Yr = ({ widgets: e, ...t }) => {
|
|
2658
|
+
let { field: n, schema: r } = t, { field_interface: i, key: a } = n;
|
|
2659
|
+
if (!i || !a) return null;
|
|
2660
|
+
if (e) {
|
|
2661
|
+
let n = e[i];
|
|
2662
|
+
if (n) return /* @__PURE__ */ w(n, { ...t });
|
|
2663
|
+
}
|
|
2664
|
+
let o = Jr[i];
|
|
2665
|
+
return o ? /* @__PURE__ */ w(o, { ...t }) : null;
|
|
2666
|
+
}, Xr = ({ field: e, schema: t, ...n }) => {
|
|
2667
|
+
let { key: r = "", label: i = "", field_interface: a = "", fields: o = [] } = e;
|
|
2668
|
+
return !a || !r ? null : /* @__PURE__ */ T("div", {
|
|
2669
|
+
className: V.wrapper,
|
|
2670
|
+
children: [/* @__PURE__ */ w(B, { children: i }), /* @__PURE__ */ w("div", {
|
|
2671
|
+
className: V.recordFieldsWrapper,
|
|
2672
|
+
children: o.map((i) => /* @__PURE__ */ w(Zr, {
|
|
2673
|
+
field: {
|
|
2674
|
+
...i,
|
|
2675
|
+
key: `${r}.${i?.key}`
|
|
2676
|
+
},
|
|
2677
|
+
schema: t,
|
|
2678
|
+
...n
|
|
2679
|
+
}, `common-fields-${e?.id}-${i?.id}`))
|
|
2680
|
+
})]
|
|
2681
|
+
});
|
|
2682
|
+
}, Zr = ({ widgets: e, ...t }) => {
|
|
2683
|
+
let { field_interface: n = "", key: r = "", hidden: i } = t.field;
|
|
2684
|
+
if (!n || !r || i) return null;
|
|
2685
|
+
switch (n) {
|
|
2686
|
+
case E.ArrayWidget: return /* @__PURE__ */ w(xn, { ...t });
|
|
2687
|
+
case E.RecordWidget: return /* @__PURE__ */ w(Xr, { ...t });
|
|
2688
|
+
case E.CollectionWidget: return /* @__PURE__ */ w(zn, { ...t });
|
|
2689
|
+
default: return /* @__PURE__ */ w(Yr, {
|
|
2690
|
+
widgets: e,
|
|
2691
|
+
...t
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
}, Qr = { wrapper: "_wrapper_b7kmm_1" }, $r = ({ children: e }) => /* @__PURE__ */ w("div", {
|
|
2695
|
+
className: Qr.wrapper,
|
|
2696
|
+
children: e
|
|
2697
|
+
}), ei = {
|
|
2698
|
+
headingWrapper: "_headingWrapper_cbrhn_1",
|
|
2699
|
+
sectionHeading: "_sectionHeading_cbrhn_6",
|
|
2700
|
+
defaultMargin: "_defaultMargin_cbrhn_14",
|
|
2701
|
+
wrapper: "_wrapper_cbrhn_18",
|
|
2702
|
+
form: "_form_cbrhn_23",
|
|
2703
|
+
sectionWrapper: "_sectionWrapper_cbrhn_33",
|
|
2704
|
+
isLoading: "_isLoading_cbrhn_37",
|
|
2705
|
+
heading: "_heading_cbrhn_1",
|
|
2706
|
+
btnWrapper: "_btnWrapper_cbrhn_48"
|
|
2707
|
+
}, ti = ({ hiddenFields: e, isLoading: n, initialValues: r, onSubmit: i, schema: a, uiConfig: s, submitButtonConfig: c, containerStyles: l, isDisabled: u, theme: d, enableVerification: f = !0 }) => {
|
|
2708
|
+
let p = b(() => {
|
|
2709
|
+
if (a) {
|
|
2710
|
+
let t = { ...a };
|
|
2711
|
+
return t.sections = t?.sections?.map((t) => (t.fields = t?.fields?.map((t) => ((e?.includes(t?.key) || e?.includes(t?.id)) && (t.hidden = !0), t)), t)), t;
|
|
2712
|
+
}
|
|
2713
|
+
return null;
|
|
2714
|
+
}, [a]), m = $e({
|
|
2715
|
+
mode: "onTouched",
|
|
2716
|
+
disabled: u,
|
|
2717
|
+
defaultValues: {},
|
|
2718
|
+
resetOptions: { keepErrors: !0 }
|
|
2719
|
+
}), { formState: { isSubmitting: h } } = m, g = (e) => {
|
|
2720
|
+
i && i(e);
|
|
2721
|
+
};
|
|
2722
|
+
v(() => {
|
|
2723
|
+
if (p) {
|
|
2724
|
+
let e = {
|
|
2725
|
+
...t(a),
|
|
2726
|
+
...r
|
|
2727
|
+
};
|
|
2728
|
+
m.reset(e);
|
|
2729
|
+
}
|
|
2730
|
+
}, [p]);
|
|
2731
|
+
let _ = n || h;
|
|
2732
|
+
return p ? /* @__PURE__ */ w(Xe, {
|
|
2733
|
+
...m,
|
|
2734
|
+
children: /* @__PURE__ */ w(dn, {
|
|
2735
|
+
...d || {},
|
|
2736
|
+
children: /* @__PURE__ */ T("div", {
|
|
2737
|
+
className: ei.headingWrapper,
|
|
2738
|
+
children: [s?.hideFormHeading ? null : /* @__PURE__ */ w("h1", {
|
|
2739
|
+
className: I(ei.sectionHeading),
|
|
2740
|
+
children: "Create new"
|
|
2741
|
+
}), /* @__PURE__ */ w("div", {
|
|
2742
|
+
className: I(ei.wrapper, l),
|
|
2743
|
+
children: /* @__PURE__ */ T("form", {
|
|
2744
|
+
className: I(ei.form, n && ei.isLoading),
|
|
2745
|
+
id: "collection-form",
|
|
2746
|
+
onSubmit: m.handleSubmit(g),
|
|
2747
|
+
children: [a?.sections?.map((e) => o(e?.fields || []) ? null : /* @__PURE__ */ T("div", {
|
|
2748
|
+
className: ei.sectionWrapper,
|
|
2749
|
+
children: [!s?.hideSectionHeadings && /* @__PURE__ */ w("p", {
|
|
2750
|
+
className: ei.heading,
|
|
2751
|
+
children: e?.label
|
|
2752
|
+
}), /* @__PURE__ */ w($r, { children: e?.fields?.map((e) => /* @__PURE__ */ w(Zr, {
|
|
2753
|
+
field: e,
|
|
2754
|
+
schema: a,
|
|
2755
|
+
settings: { enableVerification: f }
|
|
2756
|
+
}, e?.key)) })]
|
|
2757
|
+
}, e.id)), c?.show && /* @__PURE__ */ w("div", {
|
|
2758
|
+
className: ei.btnWrapper,
|
|
2759
|
+
children: /* @__PURE__ */ w(z, {
|
|
2760
|
+
className: c?.styles,
|
|
2761
|
+
loadingText: "Saving",
|
|
2762
|
+
isLoading: _,
|
|
2763
|
+
disabled: u || _,
|
|
2764
|
+
type: "submit",
|
|
2765
|
+
children: c?.text || "Save"
|
|
2766
|
+
})
|
|
2767
|
+
})]
|
|
2768
|
+
})
|
|
2769
|
+
})]
|
|
2770
|
+
})
|
|
2771
|
+
})
|
|
2772
|
+
}) : null;
|
|
2773
|
+
}, ni = d.createContext({
|
|
2774
|
+
schema: null,
|
|
2775
|
+
submitButtonConfig: { show: !0 }
|
|
2776
|
+
}), ri = ({ children: e, theme: t, variant: n, ...r }) => /* @__PURE__ */ w(ni.Provider, {
|
|
2777
|
+
value: { ...r },
|
|
2778
|
+
children: /* @__PURE__ */ w(dn, {
|
|
2779
|
+
...t,
|
|
2780
|
+
variant: n,
|
|
2781
|
+
children: e
|
|
2782
|
+
})
|
|
2783
|
+
}), $ = () => d.useContext(ni), ii = {
|
|
2784
|
+
FORM_DIRTY: "form-dirty",
|
|
2785
|
+
FORM_VALUES: "form-values"
|
|
2786
|
+
}, ai = (e) => {
|
|
2787
|
+
let t = localStorage.getItem(`${e}-${ii.FORM_VALUES}`);
|
|
2788
|
+
return t ? JSON.parse(t) : {};
|
|
2789
|
+
}, oi = (e, t) => {
|
|
2790
|
+
localStorage.setItem(`${e}-${ii.FORM_VALUES}`, JSON.stringify(t));
|
|
2791
|
+
}, si = (e) => {
|
|
2792
|
+
localStorage.removeItem(`${e}-${ii.FORM_VALUES}`);
|
|
2793
|
+
}, ci = ({ schema: e, originalSchema: n, saveToRemote: i, onSubmit: o, onSubmitSuccess: s, onSubmitError: c, setFormErrorAfterSubmit: l = !0 }) => {
|
|
2794
|
+
let u = b(() => e, [e]), d = b(() => n || u, [n]), f = M(), { toastConfig: p, onSuccess: m, onError: h, isLoggedIn: g, isDisabled: _, externalInitialValues: y = {}, account: C } = $(), [w, T] = S(null), [E, O] = S(!1), [k, A] = S(!1), [te, ne] = S(!1), N = x({}), re = (e) => {
|
|
2795
|
+
if (!u?.sections) return null;
|
|
2796
|
+
for (let t of u.sections) for (let n of t?.fields ?? []) if (n?.key === e) return n?.kind ?? null;
|
|
2797
|
+
return null;
|
|
2798
|
+
}, ie = () => {
|
|
2799
|
+
let e = {};
|
|
2800
|
+
try {
|
|
2801
|
+
if (typeof window < "u") {
|
|
2802
|
+
let t = new URLSearchParams(window?.location?.search);
|
|
2803
|
+
for (let [n, r] of t.entries()) {
|
|
2804
|
+
let [t, i] = n.split("-");
|
|
2805
|
+
if (t === "lf" && i && r) try {
|
|
2806
|
+
let t = JSON.parse(r), n = re(i);
|
|
2807
|
+
e[i] = typeof t == "number" && !(n === "number" || n === "currency") ? r : t;
|
|
2808
|
+
} catch {
|
|
2809
|
+
e[i] = r;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
} catch {}
|
|
2814
|
+
let n = t(u), r = {};
|
|
2815
|
+
C && u && (u.email_field && C.email && (r[u.email_field] = C.email), u.mobile_field && C.mobile && (r[u.mobile_field] = C.mobile)), N.current = {
|
|
2816
|
+
...n,
|
|
2817
|
+
...y || {},
|
|
2818
|
+
...r,
|
|
2819
|
+
...e,
|
|
2820
|
+
...N.current
|
|
2821
|
+
};
|
|
2822
|
+
}, P = $e({
|
|
2823
|
+
mode: "onTouched",
|
|
2824
|
+
disabled: _
|
|
2825
|
+
}), { formState: ae } = P, oe = P.handleSubmit(async (e) => {
|
|
2826
|
+
if (N.current = {
|
|
2827
|
+
...N.current || {},
|
|
2828
|
+
...e
|
|
2829
|
+
}, i && f?.collection) {
|
|
2830
|
+
if (d) try {
|
|
2831
|
+
let e = r(N?.current, d), t = null;
|
|
2832
|
+
if (t = w ? await f?.collection?.submitDraftEntry(d?.key, e) : await f?.collection?.saveCollectionData({
|
|
2833
|
+
collection_id: d?.id,
|
|
2834
|
+
data: e
|
|
2835
|
+
}), t?.content?.data) {
|
|
2836
|
+
let e = t?.content?.meta?.booking_config?.enabled;
|
|
2837
|
+
p?.showSuccessToast && !(p?.suppressOnBooking && e) && j(p.successToastText || "Form submitted successfully."), N.current = {}, ie(), si(d?.key), T(null), ne(!0), m && m({
|
|
2838
|
+
schemaId: d?.id,
|
|
2839
|
+
response: t?.content?.data,
|
|
2840
|
+
meta: t?.content?.meta
|
|
2841
|
+
}), s && s();
|
|
2842
|
+
return;
|
|
2843
|
+
}
|
|
2844
|
+
throw Error("Failed to save form details, API response invalid");
|
|
2845
|
+
} catch (e) {
|
|
2846
|
+
ee(e), e instanceof D ? (e?.hasFieldErrors && l && a(e?.fieldErrors, P.setError), c && c(e.fieldErrors || []), h && h(e)) : h && h(e?.response?.data || e);
|
|
2847
|
+
}
|
|
2848
|
+
return;
|
|
2849
|
+
}
|
|
2850
|
+
e && o && o(e);
|
|
2851
|
+
});
|
|
2852
|
+
return v(() => {
|
|
2853
|
+
if (u && f?.collection) {
|
|
2854
|
+
if (ie(), !w && u?.allow_draft) {
|
|
2855
|
+
if (g) {
|
|
2856
|
+
O(!0), f?.collection?.getDraftEntry(u?.key).then((e) => {
|
|
2857
|
+
let t = e?.content?.data;
|
|
2858
|
+
if (t === null) {
|
|
2859
|
+
A(!0);
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
A(!1);
|
|
2863
|
+
let n = Array.isArray(t) ? t?.filter((e) => e?._status === "draft") : [];
|
|
2864
|
+
if (n?.length > 0) {
|
|
2865
|
+
let e = n?.[n.length - 1] || null;
|
|
2866
|
+
e?._id && (N.current = {
|
|
2867
|
+
...N.current || {},
|
|
2868
|
+
...e
|
|
2869
|
+
}, T(e?._id));
|
|
2870
|
+
}
|
|
2871
|
+
}).catch((e) => (f?.logger?.error("Failed to get draft entry", e), null)).finally(() => {
|
|
2872
|
+
P.reset({ ...N?.current }), O(!1);
|
|
2873
|
+
});
|
|
2874
|
+
return;
|
|
2875
|
+
}
|
|
2876
|
+
let e = ai(u?.key);
|
|
2877
|
+
e && (N.current = {
|
|
2878
|
+
...N.current || {},
|
|
2879
|
+
...e
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
P.reset({ ...N?.current });
|
|
2883
|
+
}
|
|
2884
|
+
}, [u]), v(() => {
|
|
2885
|
+
let { isSubmitSuccessful: e, isValid: t } = ae;
|
|
2886
|
+
e && t && P.reset({
|
|
2887
|
+
...N?.current,
|
|
2888
|
+
__captcha: "verified"
|
|
2889
|
+
});
|
|
2890
|
+
}, [ae]), v(() => {
|
|
2891
|
+
u && w && si(u?.key);
|
|
2892
|
+
}, [w]), {
|
|
2893
|
+
methods: P,
|
|
2894
|
+
isLoading: E,
|
|
2895
|
+
isError: k,
|
|
2896
|
+
contentId: w,
|
|
2897
|
+
allFormValues: N.current,
|
|
2898
|
+
handleContentId: (e) => {
|
|
2899
|
+
e && e !== w && T(e);
|
|
2900
|
+
},
|
|
2901
|
+
handleSubmit: oe,
|
|
2902
|
+
showSuccessOverlay: te,
|
|
2903
|
+
dismissSuccessOverlay: () => ne(!1)
|
|
2904
|
+
};
|
|
2905
|
+
}, li = { wrapper: "_wrapper_v0w6r_1" }, ui = h(() => import("altcha").then(() => ({ default: function({ widgetRef: e, client: t, onStateChange: n }) {
|
|
2906
|
+
return v(() => {
|
|
2907
|
+
let { current: t } = e;
|
|
2908
|
+
if (t) return t.addEventListener("statechange", n), () => t.removeEventListener("statechange", n);
|
|
2909
|
+
}, [n]), /* @__PURE__ */ w("altcha-widget", {
|
|
2910
|
+
ref: e,
|
|
2911
|
+
style: {
|
|
2912
|
+
"--altcha-max-width": "100%",
|
|
2913
|
+
"--altcha-border-width": "1px",
|
|
2914
|
+
"--altcha-border-radius": "var(--levo-form-border-radius)",
|
|
2915
|
+
"--altcha-color-base": "var(--color-background)",
|
|
2916
|
+
"--altcha-color-border": "var(--levo-input-color-border)",
|
|
2917
|
+
"--altcha-color-border-focus": "var(--levo-input-color-border-focus)",
|
|
2918
|
+
"--altcha-color-text": "var(--color-foreground)"
|
|
2919
|
+
},
|
|
2920
|
+
hidelogo: !0,
|
|
2921
|
+
auto: "onfocus",
|
|
2922
|
+
hidefooter: !0,
|
|
2923
|
+
challengeurl: `${t.apiUrl}/v1/identity/captcha/create-challenge`,
|
|
2924
|
+
verifyurl: `${t.apiUrl}/v1/identity/captcha/verify-challenge`
|
|
2925
|
+
});
|
|
2926
|
+
} }))), di = () => /* @__PURE__ */ w("div", {
|
|
2927
|
+
style: {
|
|
2928
|
+
height: "60px",
|
|
2929
|
+
display: "flex",
|
|
2930
|
+
alignItems: "center",
|
|
2931
|
+
justifyContent: "center",
|
|
2932
|
+
border: "1px solid var(--levo-input-color-border)",
|
|
2933
|
+
borderRadius: "var(--levo-form-border-radius)",
|
|
2934
|
+
backgroundColor: "var(--color-background)"
|
|
2935
|
+
},
|
|
2936
|
+
children: /* @__PURE__ */ w("span", {
|
|
2937
|
+
style: {
|
|
2938
|
+
color: "var(--color-foreground)",
|
|
2939
|
+
fontSize: "14px"
|
|
2940
|
+
},
|
|
2941
|
+
children: "Loading verification..."
|
|
2942
|
+
})
|
|
2943
|
+
}), fi = () => {
|
|
2944
|
+
let { disableCaptcha: e } = $(), t = M(), [n, r] = S(!1), i = x(null), { field: { onChange: a }, fieldState: { error: o } } = L({
|
|
2945
|
+
name: "__captcha",
|
|
2946
|
+
rules: { required: e ? !1 : "Verification is required" }
|
|
2947
|
+
});
|
|
2948
|
+
return v(() => {
|
|
2949
|
+
r(!0);
|
|
2950
|
+
}, []), n ? /* @__PURE__ */ w(H, {
|
|
2951
|
+
error: o?.message,
|
|
2952
|
+
containerStyles: li.wrapper,
|
|
2953
|
+
children: /* @__PURE__ */ w(f, {
|
|
2954
|
+
fallback: /* @__PURE__ */ w(di, {}),
|
|
2955
|
+
children: /* @__PURE__ */ w(ui, {
|
|
2956
|
+
widgetRef: i,
|
|
2957
|
+
client: t,
|
|
2958
|
+
onStateChange: (e) => {
|
|
2959
|
+
"detail" in e && a(e.detail.state || null);
|
|
2960
|
+
}
|
|
2961
|
+
})
|
|
2962
|
+
})
|
|
2963
|
+
}) : /* @__PURE__ */ w(H, {
|
|
2964
|
+
error: o?.message,
|
|
2965
|
+
containerStyles: li.wrapper,
|
|
2966
|
+
children: /* @__PURE__ */ w(di, {})
|
|
2967
|
+
});
|
|
2968
|
+
}, pi = () => {
|
|
2969
|
+
let e = tt(), { formState: t } = et();
|
|
2970
|
+
return v(() => {
|
|
2971
|
+
console.log({
|
|
2972
|
+
values: e,
|
|
2973
|
+
formState: t
|
|
2974
|
+
});
|
|
2975
|
+
}, [e, t]), null;
|
|
2976
|
+
}, mi = { root: "_root_msrlv_1" }, hi = ({ className: e }) => {
|
|
2977
|
+
let { uiConfig: t } = $();
|
|
2978
|
+
return t?.hideFormHeading ? null : /* @__PURE__ */ w("h1", {
|
|
2979
|
+
className: I(mi.root, e),
|
|
2980
|
+
children: "Create new"
|
|
2981
|
+
});
|
|
2982
|
+
}, gi = { label: "_label_1xcnl_1" }, _i = ({ children: e, className: t }) => {
|
|
2983
|
+
let { uiConfig: n } = $();
|
|
2984
|
+
return n?.hideSectionHeadings ? null : /* @__PURE__ */ w("h3", {
|
|
2985
|
+
className: I(gi.label, t),
|
|
2986
|
+
children: e
|
|
2987
|
+
});
|
|
2988
|
+
}, vi = {
|
|
2989
|
+
overlay: "_overlay_12gq5_1",
|
|
2990
|
+
overlayFadeIn: "_overlayFadeIn_12gq5_1",
|
|
2991
|
+
card: "_card_12gq5_10",
|
|
2992
|
+
cardReveal: "_cardReveal_12gq5_1",
|
|
2993
|
+
iconWrapper: "_iconWrapper_12gq5_21",
|
|
2994
|
+
iconPop: "_iconPop_12gq5_1",
|
|
2995
|
+
title: "_title_12gq5_38",
|
|
2996
|
+
textSlideUp: "_textSlideUp_12gq5_1",
|
|
2997
|
+
message: "_message_12gq5_47",
|
|
2998
|
+
actions: "_actions_12gq5_69",
|
|
2999
|
+
redirectText: "_redirectText_12gq5_78"
|
|
3000
|
+
}, yi = 5, bi = "Thank you!", xi = "Your response has been submitted successfully.", Si = () => /* @__PURE__ */ T("svg", {
|
|
3001
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3002
|
+
viewBox: "0 0 24 24",
|
|
3003
|
+
fill: "none",
|
|
3004
|
+
stroke: "currentColor",
|
|
3005
|
+
strokeWidth: "2.5",
|
|
3006
|
+
strokeLinecap: "round",
|
|
3007
|
+
strokeLinejoin: "round",
|
|
3008
|
+
children: [/* @__PURE__ */ w("title", { children: "Check Icon" }), /* @__PURE__ */ w("path", { d: "M20 6 9 17l-5-5" })]
|
|
3009
|
+
}), Ci = ({ onDismiss: e }) => {
|
|
3010
|
+
let { successConfig: t, schema: n } = $(), r = n?.settings?.success_message, [i, a] = S(yi), o = (e) => !e || e.replace(/<[^>]*>/g, "").trim() === "", s = t?.title || r?.title || bi, c = t?.message || r?.message, l = o(c) ? xi : c, u = t?.action || r?.action, d = u?.type ?? "none", f = d === "redirect" ? u?.value : void 0, p = (() => {
|
|
3011
|
+
if (f) {
|
|
3012
|
+
if (f.startsWith("/")) return f;
|
|
3013
|
+
try {
|
|
3014
|
+
let e = new URL(f);
|
|
3015
|
+
if (e.protocol === "http:" || e.protocol === "https:") return f;
|
|
3016
|
+
} catch {}
|
|
3017
|
+
}
|
|
3018
|
+
})();
|
|
3019
|
+
v(() => {
|
|
3020
|
+
if (!p) return;
|
|
3021
|
+
let e = setInterval(() => {
|
|
3022
|
+
a((t) => t <= 1 ? (clearInterval(e), window.location.href = p, 0) : t - 1);
|
|
3023
|
+
}, 1e3);
|
|
3024
|
+
return () => clearInterval(e);
|
|
3025
|
+
}, [p]);
|
|
3026
|
+
let m = g(() => {
|
|
3027
|
+
p && (window.location.href = p);
|
|
3028
|
+
}, [p]);
|
|
3029
|
+
return /* @__PURE__ */ w("div", {
|
|
3030
|
+
className: vi.overlay,
|
|
3031
|
+
children: /* @__PURE__ */ T("div", {
|
|
3032
|
+
className: vi.card,
|
|
3033
|
+
children: [
|
|
3034
|
+
/* @__PURE__ */ w("div", {
|
|
3035
|
+
className: vi.iconWrapper,
|
|
3036
|
+
children: /* @__PURE__ */ w(Si, {})
|
|
3037
|
+
}),
|
|
3038
|
+
/* @__PURE__ */ w("h2", {
|
|
3039
|
+
className: vi.title,
|
|
3040
|
+
children: s
|
|
3041
|
+
}),
|
|
3042
|
+
/* @__PURE__ */ w("div", {
|
|
3043
|
+
className: vi.message,
|
|
3044
|
+
dangerouslySetInnerHTML: { __html: l }
|
|
3045
|
+
}),
|
|
3046
|
+
d === "submit_another" && /* @__PURE__ */ w("div", {
|
|
3047
|
+
className: vi.actions,
|
|
3048
|
+
children: /* @__PURE__ */ w(z, {
|
|
3049
|
+
variant: "default",
|
|
3050
|
+
size: "sm",
|
|
3051
|
+
onClick: e,
|
|
3052
|
+
children: "Submit Another"
|
|
3053
|
+
})
|
|
3054
|
+
}),
|
|
3055
|
+
d === "redirect" && p && /* @__PURE__ */ T("div", {
|
|
3056
|
+
className: vi.actions,
|
|
3057
|
+
children: [/* @__PURE__ */ w(z, {
|
|
3058
|
+
variant: "default",
|
|
3059
|
+
size: "sm",
|
|
3060
|
+
onClick: m,
|
|
3061
|
+
children: "Continue"
|
|
3062
|
+
}), /* @__PURE__ */ T("span", {
|
|
3063
|
+
className: vi.redirectText,
|
|
3064
|
+
children: [
|
|
3065
|
+
"Redirecting in ",
|
|
3066
|
+
i,
|
|
3067
|
+
"s…"
|
|
3068
|
+
]
|
|
3069
|
+
})]
|
|
3070
|
+
})
|
|
3071
|
+
]
|
|
3072
|
+
})
|
|
3073
|
+
});
|
|
3074
|
+
}, wi = ({ isError: e, contentId: t, getContentId: n, allFormValues: r }) => {
|
|
3075
|
+
let { collection: i } = M(), { schema: a, isLoggedIn: o } = $(), { formState: s } = et(), c = tt(), l = ye((r) => {
|
|
3076
|
+
a?.key && !e && a?.allow_draft && (o ? t ? i.editDraftEntry(a?.key, t, r).then((e) => {
|
|
3077
|
+
e?.content?.data?._id && n(e?.content?.data?._id);
|
|
3078
|
+
}).catch(() => {
|
|
3079
|
+
console.error("saving entry failed");
|
|
3080
|
+
}) : i.saveDraftEntry(a?.key, r).then((e) => {
|
|
3081
|
+
e?.content?.data?._id && n(e?.content?.data?._id);
|
|
3082
|
+
}).catch(() => {
|
|
3083
|
+
console.error("saving entry failed");
|
|
3084
|
+
}) : oi(a?.key, r));
|
|
3085
|
+
}, 100), { isDirty: u, isSubmitting: d, isSubmitSuccessful: f } = s;
|
|
3086
|
+
return v(() => {
|
|
3087
|
+
if (d || f) {
|
|
3088
|
+
l.cancel();
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
e || u && Object?.keys(c || {})?.length > 0 && (l.cancel(), l({
|
|
3092
|
+
...r || {},
|
|
3093
|
+
...c
|
|
3094
|
+
}));
|
|
3095
|
+
}, [
|
|
3096
|
+
u,
|
|
3097
|
+
t,
|
|
3098
|
+
e,
|
|
3099
|
+
o,
|
|
3100
|
+
c,
|
|
3101
|
+
d,
|
|
3102
|
+
f
|
|
3103
|
+
]), null;
|
|
3104
|
+
}, Ti = {
|
|
3105
|
+
wrapper: "_wrapper_f35it_1",
|
|
3106
|
+
form: "_form_f35it_6",
|
|
3107
|
+
sectionWrapper: "_sectionWrapper_f35it_16",
|
|
3108
|
+
isLoading: "_isLoading_f35it_20",
|
|
3109
|
+
heading: "_heading_f35it_25",
|
|
3110
|
+
btnWrapper: "_btnWrapper_f35it_31"
|
|
3111
|
+
}, Ei = () => {
|
|
3112
|
+
let { schema: e, containerStyles: t, submitButtonConfig: n, isDisabled: r, widgets: i, disableCaptcha: a, debug: s, enableVerification: c } = $(), { methods: l, isError: u, isLoading: d, contentId: f, handleContentId: p, handleSubmit: m, allFormValues: h, showSuccessOverlay: g, dismissSuccessOverlay: _ } = ci({
|
|
3113
|
+
schema: e,
|
|
3114
|
+
saveToRemote: !0
|
|
3115
|
+
}), { formState: { isSubmitting: v } } = l, y = l.watch("__captcha");
|
|
3116
|
+
return g ? /* @__PURE__ */ w(Ci, { onDismiss: _ }) : /* @__PURE__ */ T(Xe, {
|
|
3117
|
+
...l,
|
|
3118
|
+
children: [
|
|
3119
|
+
s && /* @__PURE__ */ w(pi, {}),
|
|
3120
|
+
/* @__PURE__ */ w(wi, {
|
|
3121
|
+
getContentId: p,
|
|
3122
|
+
isError: u,
|
|
3123
|
+
contentId: f || "",
|
|
3124
|
+
allFormValues: h
|
|
3125
|
+
}),
|
|
3126
|
+
/* @__PURE__ */ T("div", {
|
|
3127
|
+
className: I(Ti.wrapper, t),
|
|
3128
|
+
children: [/* @__PURE__ */ w(hi, {}), /* @__PURE__ */ T("form", {
|
|
3129
|
+
className: I(Ti.form, d && Ti.isLoading),
|
|
3130
|
+
id: "collection-form",
|
|
3131
|
+
onSubmit: m,
|
|
3132
|
+
children: [
|
|
3133
|
+
e?.sections?.map((t) => o(t?.fields || []) ? null : /* @__PURE__ */ T("div", {
|
|
3134
|
+
className: Ti.sectionWrapper,
|
|
3135
|
+
children: [t?.label && /* @__PURE__ */ w(_i, { children: t.label }), /* @__PURE__ */ w($r, { children: t?.fields?.map((t) => /* @__PURE__ */ w(Zr, {
|
|
3136
|
+
field: t,
|
|
3137
|
+
widgets: i,
|
|
3138
|
+
schema: e,
|
|
3139
|
+
settings: { enableVerification: c }
|
|
3140
|
+
}, t?.key)) })]
|
|
3141
|
+
}, t.id)),
|
|
3142
|
+
!a && /* @__PURE__ */ w(fi, {}),
|
|
3143
|
+
n?.show && /* @__PURE__ */ w("div", {
|
|
3144
|
+
className: Ti.btnWrapper,
|
|
3145
|
+
children: /* @__PURE__ */ w(z, {
|
|
3146
|
+
className: n?.styles,
|
|
3147
|
+
loadingText: "Saving",
|
|
3148
|
+
isLoading: v,
|
|
3149
|
+
disabled: r,
|
|
3150
|
+
type: "submit",
|
|
3151
|
+
children: y === "verifying" ? "Verifying..." : n?.text || "Save"
|
|
3152
|
+
})
|
|
3153
|
+
})
|
|
3154
|
+
]
|
|
3155
|
+
})]
|
|
3156
|
+
})
|
|
3157
|
+
]
|
|
3158
|
+
});
|
|
3159
|
+
}, Di = {
|
|
3160
|
+
progressBarWrapper: "_progressBarWrapper_1t5aj_1",
|
|
3161
|
+
progressBarSegment: "_progressBarSegment_1t5aj_7",
|
|
3162
|
+
errorState: "_errorState_1t5aj_16",
|
|
3163
|
+
progressBarFill: "_progressBarFill_1t5aj_20",
|
|
3164
|
+
errorBadge: "_errorBadge_1t5aj_30",
|
|
3165
|
+
segmentWithError: "_segmentWithError_1t5aj_47"
|
|
3166
|
+
}, Oi = ({ totalSteps: e, currentStepIndex: t, hasLevoErrors: n }) => {
|
|
3167
|
+
let { formState: { errors: r } } = et(), i = Object.keys(r || {}).length > 0 || n, a = b(() => Math.floor((t + 1) * 100 / e), [e, t]);
|
|
3168
|
+
return /* @__PURE__ */ w("div", {
|
|
3169
|
+
className: Di.progressBarWrapper,
|
|
3170
|
+
children: /* @__PURE__ */ w("div", {
|
|
3171
|
+
className: I(Di.progressBarSegment, i && Di.errorState),
|
|
3172
|
+
children: /* @__PURE__ */ w("div", {
|
|
3173
|
+
className: I(Di.progressBarFill),
|
|
3174
|
+
style: { width: `${a}%` }
|
|
3175
|
+
})
|
|
3176
|
+
})
|
|
3177
|
+
});
|
|
3178
|
+
}, ki = {
|
|
3179
|
+
headerGroup: "_headerGroup_1ri63_1",
|
|
3180
|
+
container: "_container_1ri63_9",
|
|
3181
|
+
slide: "_slide_1ri63_20",
|
|
3182
|
+
slideInRight: "_slideInRight_1ri63_1",
|
|
3183
|
+
slideInLeft: "_slideInLeft_1ri63_1",
|
|
3184
|
+
slideOutLeft: "_slideOutLeft_1ri63_1",
|
|
3185
|
+
slideOutRight: "_slideOutRight_1ri63_1",
|
|
3186
|
+
formWrapper: "_formWrapper_1ri63_93",
|
|
3187
|
+
buttonWrapper: "_buttonWrapper_1ri63_99",
|
|
3188
|
+
spacer: "_spacer_1ri63_107",
|
|
3189
|
+
buttonGroup: "_buttonGroup_1ri63_111",
|
|
3190
|
+
sectionHeading: "_sectionHeading_1ri63_117",
|
|
3191
|
+
formHeading: "_formHeading_1ri63_128"
|
|
3192
|
+
}, Ai = () => {
|
|
3193
|
+
let { disableCaptcha: e, schema: t, widgets: n, submitButtonConfig: r, containerStyles: i, enableVerification: a } = $(), o = b(() => t?.sections ? t.sections.flatMap((e) => (e.fields?.filter((e) => !e.hidden) || []).map((t) => ({
|
|
3194
|
+
id: t.key,
|
|
3195
|
+
content: t,
|
|
3196
|
+
sectionId: e.id || "",
|
|
3197
|
+
sectionLabel: e.label
|
|
3198
|
+
}))) : [], [t]), [s, c] = S(0), [l, u] = S(0), [d, f] = S({
|
|
3199
|
+
state: "entered",
|
|
3200
|
+
direction: "next"
|
|
3201
|
+
}), [p, m] = S([]), h = d.state === "exiting" ? s : l, _ = l === o.length - 1, y = o[h], { methods: x, handleContentId: C, isError: E, allFormValues: D, contentId: O, isLoading: k, handleSubmit: ee, showSuccessOverlay: A, dismissSuccessOverlay: te } = ci({
|
|
3202
|
+
schema: t,
|
|
3203
|
+
saveToRemote: _,
|
|
3204
|
+
setFormErrorAfterSubmit: !1,
|
|
3205
|
+
onSubmitSuccess: () => {
|
|
3206
|
+
m([]), u(0), f({
|
|
3207
|
+
state: "exiting",
|
|
3208
|
+
direction: "next"
|
|
3209
|
+
});
|
|
3210
|
+
},
|
|
3211
|
+
onSubmit: () => {
|
|
3212
|
+
m((e) => e.filter((e) => e?.param !== y?.content?.key)), re();
|
|
3213
|
+
},
|
|
3214
|
+
onSubmitError: (e) => {
|
|
3215
|
+
m(e);
|
|
3216
|
+
let t = o.findIndex((t) => e.some((e) => e.param === t.content.key));
|
|
3217
|
+
t !== -1 && t !== l && (u(t), f({
|
|
3218
|
+
state: "exiting",
|
|
3219
|
+
direction: "next"
|
|
3220
|
+
}));
|
|
3221
|
+
}
|
|
3222
|
+
}), { setFocus: j, setError: M, formState: { isSubmitting: ne } } = x, re = g(() => {
|
|
3223
|
+
d.state === "entered" && (_ || (u((e) => Math.min(e + 1, o.length - 1)), f({
|
|
3224
|
+
state: "exiting",
|
|
3225
|
+
direction: "next"
|
|
3226
|
+
})));
|
|
3227
|
+
}, [
|
|
3228
|
+
d,
|
|
3229
|
+
_,
|
|
3230
|
+
o.length
|
|
3231
|
+
]), ie = g(() => {
|
|
3232
|
+
d.state === "entered" && (l <= 0 || (u((e) => Math.max(e - 1, 0)), f({
|
|
3233
|
+
state: "exiting",
|
|
3234
|
+
direction: "prev"
|
|
3235
|
+
})));
|
|
3236
|
+
}, [d, l]), P = () => {
|
|
3237
|
+
d.state === "exiting" ? (c(l), f({
|
|
3238
|
+
state: "entering",
|
|
3239
|
+
direction: d.direction
|
|
3240
|
+
})) : d.state === "entering" && (f({
|
|
3241
|
+
state: "entered",
|
|
3242
|
+
direction: d.direction
|
|
3243
|
+
}), y?.content?.key && j(y.content.key));
|
|
3244
|
+
};
|
|
3245
|
+
return v(() => {
|
|
3246
|
+
if (y && p?.length > 0) {
|
|
3247
|
+
let e = p?.find((e) => e?.param === y?.content?.key);
|
|
3248
|
+
e && M(e?.param, {
|
|
3249
|
+
type: "server_error",
|
|
3250
|
+
message: e?.message
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
}, [y, p]), !t || o.length === 0 ? null : A ? /* @__PURE__ */ w(Ci, { onDismiss: te }) : /* @__PURE__ */ T(Xe, {
|
|
3254
|
+
...x,
|
|
3255
|
+
children: [
|
|
3256
|
+
/* @__PURE__ */ w(wi, {
|
|
3257
|
+
getContentId: C,
|
|
3258
|
+
isError: E,
|
|
3259
|
+
contentId: O || "",
|
|
3260
|
+
allFormValues: D
|
|
3261
|
+
}),
|
|
3262
|
+
/* @__PURE__ */ T("div", {
|
|
3263
|
+
className: ki.headerGroup,
|
|
3264
|
+
children: [
|
|
3265
|
+
/* @__PURE__ */ w(hi, { className: ki.formHeading }),
|
|
3266
|
+
/* @__PURE__ */ w(_i, {
|
|
3267
|
+
className: ki.sectionHeading,
|
|
3268
|
+
children: y?.sectionLabel
|
|
3269
|
+
}),
|
|
3270
|
+
/* @__PURE__ */ w(Oi, {
|
|
3271
|
+
currentStepIndex: l,
|
|
3272
|
+
totalSteps: o?.length || 1,
|
|
3273
|
+
hasLevoErrors: Array.isArray(p) && p?.length > 0
|
|
3274
|
+
})
|
|
3275
|
+
]
|
|
3276
|
+
}),
|
|
3277
|
+
/* @__PURE__ */ w("div", {
|
|
3278
|
+
className: I(ki.container, i),
|
|
3279
|
+
children: y && /* @__PURE__ */ w("div", {
|
|
3280
|
+
className: ki.slide,
|
|
3281
|
+
"data-state": d.state,
|
|
3282
|
+
"data-direction": d.direction,
|
|
3283
|
+
onAnimationEnd: P,
|
|
3284
|
+
children: /* @__PURE__ */ T("form", {
|
|
3285
|
+
onSubmit: ee,
|
|
3286
|
+
className: ki.formWrapper,
|
|
3287
|
+
children: [
|
|
3288
|
+
/* @__PURE__ */ w(Zr, {
|
|
3289
|
+
field: y.content,
|
|
3290
|
+
schema: t,
|
|
3291
|
+
widgets: n,
|
|
3292
|
+
settings: { enableVerification: a }
|
|
3293
|
+
}),
|
|
3294
|
+
!e && _ && /* @__PURE__ */ w(fi, {}),
|
|
3295
|
+
/* @__PURE__ */ T("div", {
|
|
3296
|
+
className: ki.buttonWrapper,
|
|
3297
|
+
children: [/* @__PURE__ */ w("div", { className: ki.spacer }), /* @__PURE__ */ T("div", {
|
|
3298
|
+
className: ki.buttonGroup,
|
|
3299
|
+
children: [/* @__PURE__ */ T(z, {
|
|
3300
|
+
type: "button",
|
|
3301
|
+
onClick: ie,
|
|
3302
|
+
size: "lg",
|
|
3303
|
+
disabled: l === 0 || ne || k || d.state !== "entered",
|
|
3304
|
+
variant: "ghost",
|
|
3305
|
+
children: [/* @__PURE__ */ w(N, {
|
|
3306
|
+
size: 18,
|
|
3307
|
+
className: "mr-2"
|
|
3308
|
+
}), "Prev"]
|
|
3309
|
+
}), (!_ || r?.show !== !1) && /* @__PURE__ */ w(z, {
|
|
3310
|
+
type: "submit",
|
|
3311
|
+
size: "lg",
|
|
3312
|
+
className: r?.styles,
|
|
3313
|
+
isLoading: ne || k,
|
|
3314
|
+
disabled: d.state !== "entered",
|
|
3315
|
+
children: _ ? r?.text || "Submit" : "Next"
|
|
3316
|
+
})]
|
|
3317
|
+
})]
|
|
3318
|
+
})
|
|
3319
|
+
]
|
|
3320
|
+
})
|
|
3321
|
+
}, y.id)
|
|
3322
|
+
})
|
|
3323
|
+
]
|
|
3324
|
+
});
|
|
3325
|
+
}, ji = {
|
|
3326
|
+
headerGroup: "_headerGroup_cst6c_1",
|
|
3327
|
+
container: "_container_cst6c_9",
|
|
3328
|
+
slide: "_slide_cst6c_20",
|
|
3329
|
+
slideInRight: "_slideInRight_cst6c_1",
|
|
3330
|
+
slideInLeft: "_slideInLeft_cst6c_1",
|
|
3331
|
+
slideOutLeft: "_slideOutLeft_cst6c_1",
|
|
3332
|
+
slideOutRight: "_slideOutRight_cst6c_1",
|
|
3333
|
+
formWrapper: "_formWrapper_cst6c_93",
|
|
3334
|
+
buttonWrapper: "_buttonWrapper_cst6c_102",
|
|
3335
|
+
spacer: "_spacer_cst6c_110",
|
|
3336
|
+
buttonGroup: "_buttonGroup_cst6c_114",
|
|
3337
|
+
sectionHeading: "_sectionHeading_cst6c_120",
|
|
3338
|
+
formHeading: "_formHeading_cst6c_131"
|
|
3339
|
+
}, Mi = () => {
|
|
3340
|
+
let { disableCaptcha: e, schema: t, widgets: n, submitButtonConfig: r, containerStyles: i, enableVerification: a } = $(), s = b(() => t?.sections?.filter((e) => !o(e?.fields || [])) || [], [t?.sections]), [c, l] = S(0), [u, d] = S(0), [f, p] = S({
|
|
3341
|
+
state: "entered",
|
|
3342
|
+
direction: "next"
|
|
3343
|
+
}), [m, h] = S([]), _ = f.state === "exiting" ? c : u, y = s[_], x = u === s.length - 1, { methods: C, handleContentId: E, isError: D, allFormValues: O, contentId: k, isLoading: ee, handleSubmit: A, showSuccessOverlay: te, dismissSuccessOverlay: j } = ci({
|
|
3344
|
+
schema: b(() => {
|
|
3345
|
+
if (t) {
|
|
3346
|
+
let e = { ...t };
|
|
3347
|
+
return y && e && (e.sections = [y]), e;
|
|
3348
|
+
}
|
|
3349
|
+
return null;
|
|
3350
|
+
}, [y, t]),
|
|
3351
|
+
originalSchema: t,
|
|
3352
|
+
saveToRemote: x,
|
|
3353
|
+
setFormErrorAfterSubmit: !1,
|
|
3354
|
+
onSubmitSuccess: () => {
|
|
3355
|
+
h([]), d(0), p({
|
|
3356
|
+
state: "exiting",
|
|
3357
|
+
direction: "next"
|
|
3358
|
+
});
|
|
3359
|
+
},
|
|
3360
|
+
onSubmit: () => {
|
|
3361
|
+
h((e) => {
|
|
3362
|
+
let t = y?.fields?.map((e) => e.key) || [];
|
|
3363
|
+
return e.filter((e) => !t.includes(e.param));
|
|
3364
|
+
}), P();
|
|
3365
|
+
},
|
|
3366
|
+
onSubmitError: (e) => {
|
|
3367
|
+
if (h(e), Array.isArray(e) && e.length > 0) {
|
|
3368
|
+
let t = s.findIndex((t) => t.fields?.some((t) => e.some((e) => e.param === t.key)));
|
|
3369
|
+
t !== -1 && t !== u && (d(t), p({
|
|
3370
|
+
state: "exiting",
|
|
3371
|
+
direction: "next"
|
|
3372
|
+
}));
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
}), { setFocus: M, setError: ne, formState: { isSubmitting: re } } = C, ie = C.watch("__captcha"), P = g(() => {
|
|
3376
|
+
f.state === "entered" && (x || (d((e) => Math.min(e + 1, s.length - 1)), p({
|
|
3377
|
+
state: "exiting",
|
|
3378
|
+
direction: "next"
|
|
3379
|
+
})));
|
|
3380
|
+
}, [
|
|
3381
|
+
f,
|
|
3382
|
+
x,
|
|
3383
|
+
s.length
|
|
3384
|
+
]), ae = g(() => {
|
|
3385
|
+
f.state === "entered" && (u <= 0 || (d((e) => Math.max(e - 1, 0)), p({
|
|
3386
|
+
state: "exiting",
|
|
3387
|
+
direction: "prev"
|
|
3388
|
+
})));
|
|
3389
|
+
}, [f, u]), oe = g(() => {
|
|
3390
|
+
f.state === "exiting" ? (l(u), p({
|
|
3391
|
+
state: "entering",
|
|
3392
|
+
direction: f.direction
|
|
3393
|
+
})) : f.state === "entering" && (p({
|
|
3394
|
+
state: "entered",
|
|
3395
|
+
direction: f.direction
|
|
3396
|
+
}), y?.fields?.[0]?.key && M(y.fields[0].key));
|
|
3397
|
+
}, [
|
|
3398
|
+
f,
|
|
3399
|
+
u,
|
|
3400
|
+
y,
|
|
3401
|
+
M
|
|
3402
|
+
]);
|
|
3403
|
+
return v(() => {
|
|
3404
|
+
m?.length > 0 && y?.fields && f?.state === "entered" && m.forEach((e) => {
|
|
3405
|
+
y.fields?.some((t) => t.key === e.param) && ne(e?.param, {
|
|
3406
|
+
type: "server_error",
|
|
3407
|
+
message: e?.message
|
|
3408
|
+
});
|
|
3409
|
+
});
|
|
3410
|
+
}, [
|
|
3411
|
+
m,
|
|
3412
|
+
ne,
|
|
3413
|
+
y,
|
|
3414
|
+
f
|
|
3415
|
+
]), !t || s.length === 0 ? null : te ? /* @__PURE__ */ w(Ci, { onDismiss: j }) : /* @__PURE__ */ T(Xe, {
|
|
3416
|
+
...C,
|
|
3417
|
+
children: [
|
|
3418
|
+
/* @__PURE__ */ w(wi, {
|
|
3419
|
+
getContentId: E,
|
|
3420
|
+
isError: D,
|
|
3421
|
+
contentId: k || "",
|
|
3422
|
+
allFormValues: O
|
|
3423
|
+
}),
|
|
3424
|
+
/* @__PURE__ */ T("div", {
|
|
3425
|
+
className: ji.headerGroup,
|
|
3426
|
+
children: [
|
|
3427
|
+
/* @__PURE__ */ w(hi, { className: ji.formHeading }),
|
|
3428
|
+
/* @__PURE__ */ w(_i, {
|
|
3429
|
+
className: ji.sectionHeading,
|
|
3430
|
+
children: y?.label
|
|
3431
|
+
}),
|
|
3432
|
+
/* @__PURE__ */ w(Oi, {
|
|
3433
|
+
currentStepIndex: u,
|
|
3434
|
+
totalSteps: s?.length || 1,
|
|
3435
|
+
hasLevoErrors: Array.isArray(m) && m?.length > 0
|
|
3436
|
+
})
|
|
3437
|
+
]
|
|
3438
|
+
}),
|
|
3439
|
+
/* @__PURE__ */ w("div", {
|
|
3440
|
+
className: I(ji.container, i),
|
|
3441
|
+
children: y && /* @__PURE__ */ w("div", {
|
|
3442
|
+
className: ji.slide,
|
|
3443
|
+
"data-state": f.state,
|
|
3444
|
+
"data-direction": f.direction,
|
|
3445
|
+
onAnimationEnd: oe,
|
|
3446
|
+
children: /* @__PURE__ */ T("form", {
|
|
3447
|
+
onSubmit: A,
|
|
3448
|
+
className: ji.formWrapper,
|
|
3449
|
+
children: [
|
|
3450
|
+
y.fields?.map((e) => e.hidden ? null : /* @__PURE__ */ w(Zr, {
|
|
3451
|
+
field: e,
|
|
3452
|
+
schema: t,
|
|
3453
|
+
widgets: n,
|
|
3454
|
+
settings: { enableVerification: a }
|
|
3455
|
+
}, e.key)),
|
|
3456
|
+
!e && x && /* @__PURE__ */ w(fi, {}),
|
|
3457
|
+
/* @__PURE__ */ T("div", {
|
|
3458
|
+
className: ji.buttonWrapper,
|
|
3459
|
+
children: [/* @__PURE__ */ w("div", { className: ji.spacer }), /* @__PURE__ */ T("div", {
|
|
3460
|
+
className: ji.buttonGroup,
|
|
3461
|
+
children: [/* @__PURE__ */ T(z, {
|
|
3462
|
+
type: "button",
|
|
3463
|
+
onClick: ae,
|
|
3464
|
+
size: "lg",
|
|
3465
|
+
disabled: u === 0 || re || ee || ie === "verifying" && x || f.state !== "entered",
|
|
3466
|
+
variant: "ghost",
|
|
3467
|
+
children: [/* @__PURE__ */ w(N, {
|
|
3468
|
+
size: 18,
|
|
3469
|
+
className: "mr-2"
|
|
3470
|
+
}), "Prev"]
|
|
3471
|
+
}), (!x || r?.show !== !1) && /* @__PURE__ */ w(z, {
|
|
3472
|
+
type: "submit",
|
|
3473
|
+
size: "lg",
|
|
3474
|
+
className: r?.styles,
|
|
3475
|
+
isLoading: re || ee || ie === "verifying" && x,
|
|
3476
|
+
loadingText: ie === "verifying" ? "Verifying..." : "Saving...",
|
|
3477
|
+
disabled: f.state !== "entered",
|
|
3478
|
+
children: x ? r?.text || "Save" : "Next"
|
|
3479
|
+
})]
|
|
3480
|
+
})]
|
|
3481
|
+
})
|
|
3482
|
+
]
|
|
3483
|
+
})
|
|
3484
|
+
}, y.id || _)
|
|
3485
|
+
})
|
|
3486
|
+
]
|
|
3487
|
+
});
|
|
3488
|
+
}, Ni = {
|
|
3489
|
+
fullWidth: "_fullWidth_167cc_1",
|
|
3490
|
+
form: "_form_167cc_5",
|
|
3491
|
+
isLoading: "_isLoading_167cc_12",
|
|
3492
|
+
headingWrapper: "_headingWrapper_167cc_17",
|
|
3493
|
+
heading: "_heading_167cc_17",
|
|
3494
|
+
btnWrapper: "_btnWrapper_167cc_29"
|
|
3495
|
+
}, Pi = () => {
|
|
3496
|
+
let [e, t] = S(0), { containerStyles: n } = $();
|
|
3497
|
+
return /* @__PURE__ */ w(Fi, {
|
|
3498
|
+
currentSectionIndex: e,
|
|
3499
|
+
handleNext: () => {
|
|
3500
|
+
t((e) => e + 1);
|
|
3501
|
+
},
|
|
3502
|
+
handlePrev: () => {
|
|
3503
|
+
t((e) => e - 1);
|
|
3504
|
+
},
|
|
3505
|
+
goToIndex: (e) => {
|
|
3506
|
+
t(e);
|
|
3507
|
+
},
|
|
3508
|
+
containerStyles: n
|
|
3509
|
+
});
|
|
3510
|
+
}, Fi = ({ containerStyles: e, currentSectionIndex: t, handleNext: n, handlePrev: r, goToIndex: i }) => {
|
|
3511
|
+
let { schema: a, disableCaptcha: s, isDisabled: c, submitButtonConfig: l, widgets: u, enableVerification: d } = $(), [f, p] = S([]), m = b(() => a?.sections?.filter((e) => !o(e?.fields || [])) || [], [a?.sections]), h = b(() => m?.[t], [t, m]), g = b(() => {
|
|
3512
|
+
if (a) {
|
|
3513
|
+
let e = { ...a };
|
|
3514
|
+
return h && e && (e.sections = [h]), e;
|
|
3515
|
+
}
|
|
3516
|
+
return null;
|
|
3517
|
+
}, [h, a]), _ = t === Number(m?.length) - 1, { methods: y, handleSubmit: x, isLoading: C, handleContentId: E, isError: D, contentId: O, allFormValues: k, showSuccessOverlay: ee, dismissSuccessOverlay: A } = ci({
|
|
3518
|
+
schema: g,
|
|
3519
|
+
originalSchema: a,
|
|
3520
|
+
saveToRemote: _,
|
|
3521
|
+
setFormErrorAfterSubmit: !1,
|
|
3522
|
+
onSubmit: () => {
|
|
3523
|
+
p((e) => {
|
|
3524
|
+
let t = h?.fields?.map((e) => e.key) || [];
|
|
3525
|
+
return e.filter((e) => !t.includes(e.param));
|
|
3526
|
+
}), n();
|
|
3527
|
+
},
|
|
3528
|
+
onSubmitSuccess: () => {
|
|
3529
|
+
p([]), i(0);
|
|
3530
|
+
},
|
|
3531
|
+
onSubmitError: (e) => {
|
|
3532
|
+
if (p(e), Array.isArray(e) && e.length > 0) {
|
|
3533
|
+
let t = m.findIndex((t) => t.fields?.some((t) => e.some((e) => e.param === t.key)));
|
|
3534
|
+
t !== -1 && i(t);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
}), { setError: te, formState: { isSubmitting: j } } = y, M = y.watch("__captcha");
|
|
3538
|
+
return v(() => {
|
|
3539
|
+
f?.length > 0 && h?.fields && f.forEach((e) => {
|
|
3540
|
+
h.fields?.some((t) => t.key === e.param) && te(e?.param, {
|
|
3541
|
+
type: "server_error",
|
|
3542
|
+
message: e?.message
|
|
3543
|
+
});
|
|
3544
|
+
});
|
|
3545
|
+
}, [
|
|
3546
|
+
f,
|
|
3547
|
+
te,
|
|
3548
|
+
h
|
|
3549
|
+
]), ee ? /* @__PURE__ */ w(Ci, { onDismiss: A }) : /* @__PURE__ */ T(Xe, {
|
|
3550
|
+
...y,
|
|
3551
|
+
children: [/* @__PURE__ */ w(wi, {
|
|
3552
|
+
getContentId: E,
|
|
3553
|
+
isError: D,
|
|
3554
|
+
contentId: O || "",
|
|
3555
|
+
allFormValues: k
|
|
3556
|
+
}), /* @__PURE__ */ T("form", {
|
|
3557
|
+
className: I(Ni.form, e, C && Ni.isLoading),
|
|
3558
|
+
id: "collection-form",
|
|
3559
|
+
onSubmit: x,
|
|
3560
|
+
children: [
|
|
3561
|
+
/* @__PURE__ */ w(hi, {}),
|
|
3562
|
+
/* @__PURE__ */ T(_i, { children: [/* @__PURE__ */ w("span", { children: h?.label || "Details" }), /* @__PURE__ */ T("span", { children: [
|
|
3563
|
+
"Step ",
|
|
3564
|
+
t + 1,
|
|
3565
|
+
"/",
|
|
3566
|
+
m?.length || 1
|
|
3567
|
+
] })] }),
|
|
3568
|
+
/* @__PURE__ */ T($r, { children: [
|
|
3569
|
+
h?.fields?.map((e) => e && !e.hidden ? /* @__PURE__ */ w(Zr, {
|
|
3570
|
+
field: e,
|
|
3571
|
+
widgets: u,
|
|
3572
|
+
schema: a,
|
|
3573
|
+
settings: { enableVerification: d }
|
|
3574
|
+
}, e?.key) : null),
|
|
3575
|
+
!s && _ && /* @__PURE__ */ w(fi, {}),
|
|
3576
|
+
/* @__PURE__ */ T("div", {
|
|
3577
|
+
className: Ni.btnWrapper,
|
|
3578
|
+
children: [t === 0 ? /* @__PURE__ */ w("div", {}) : /* @__PURE__ */ w(z, {
|
|
3579
|
+
type: "button",
|
|
3580
|
+
size: "sm",
|
|
3581
|
+
variant: "default",
|
|
3582
|
+
scheme: "secondary",
|
|
3583
|
+
disabled: M === "verifying" && _,
|
|
3584
|
+
onClick: () => {
|
|
3585
|
+
r();
|
|
3586
|
+
},
|
|
3587
|
+
children: "Prev"
|
|
3588
|
+
}), /* @__PURE__ */ w(z, {
|
|
3589
|
+
type: "submit",
|
|
3590
|
+
loadingText: M === "verifying" ? "Verifying..." : "Saving...",
|
|
3591
|
+
size: "sm",
|
|
3592
|
+
isLoading: j || M === "verifying" && _,
|
|
3593
|
+
disabled: c,
|
|
3594
|
+
className: l?.styles,
|
|
3595
|
+
children: _ ? l?.text || "Save" : "Next"
|
|
3596
|
+
})]
|
|
3597
|
+
})
|
|
3598
|
+
] })
|
|
3599
|
+
]
|
|
3600
|
+
})]
|
|
3601
|
+
});
|
|
3602
|
+
}, Ii = ({ formVariant: e, enableVerification: t = !0, ...n }) => /* @__PURE__ */ w(ri, {
|
|
3603
|
+
...n,
|
|
3604
|
+
enableVerification: t,
|
|
3605
|
+
variant: e,
|
|
3606
|
+
children: w(e === "single-field" ? Ai : e === "steps" ? Pi : e === "steps-2" ? Mi : Ei, {})
|
|
3607
|
+
}), Li = { loadingWrapper: "_loadingWrapper_5clj5_1" }, Ri = ({ collection_id: e, hiddenFields: t, enableVerification: n = !0, ...r }) => {
|
|
3608
|
+
let { collection: i } = M(), [a, o] = S(!0), [s, c] = S(null);
|
|
3609
|
+
return v(() => {
|
|
3610
|
+
e ? i?.getCollectionByIDExpanded(e, { headers: { "Levo-Workspace": r?.workspace_id } }).then((e) => {
|
|
3611
|
+
let n = e?.content?.data;
|
|
3612
|
+
if (n) n.sections = n?.sections?.map((e) => (e.fields = e?.fields?.map((e) => (t?.includes(e?.key) && (e.hidden = !0), e)), e)), c(n);
|
|
3613
|
+
else throw Error(`API response invalid: ${n}`);
|
|
3614
|
+
}).catch((e) => {
|
|
3615
|
+
console.error("Error fetching schema", e);
|
|
3616
|
+
}).finally(() => {
|
|
3617
|
+
o(!1);
|
|
3618
|
+
}) : (console.error("[CollectionFormBuilder] Collection ID or Workspace ID is missing."), o(!1));
|
|
3619
|
+
}, [e]), a ? /* @__PURE__ */ w("div", {
|
|
3620
|
+
className: Li.loadingWrapper,
|
|
3621
|
+
children: /* @__PURE__ */ w(sn, {})
|
|
3622
|
+
}) : s ? /* @__PURE__ */ w(Ii, {
|
|
3623
|
+
schema: s,
|
|
3624
|
+
enableVerification: n,
|
|
3625
|
+
...r
|
|
3626
|
+
}) : null;
|
|
3627
|
+
}, zi = {
|
|
3628
|
+
wrapper: "_wrapper_18maj_1",
|
|
3629
|
+
loadingWrapper: "_loadingWrapper_18maj_6"
|
|
3630
|
+
}, Bi = ({ hiddenFields: e, fetchedSchema: t, isLoading: n, enableVerification: r = !0, ...i }) => {
|
|
3631
|
+
let a = b(() => {
|
|
3632
|
+
let n = { ...t };
|
|
3633
|
+
return n.sections = n?.sections?.map((t) => (t.fields = t?.fields?.map((t) => ((e?.includes(t?.key) || e?.includes(t?.id)) && (t.hidden = !0), t)), t)), n;
|
|
3634
|
+
}, [t]);
|
|
3635
|
+
return n ? /* @__PURE__ */ w("div", {
|
|
3636
|
+
className: zi.loadingWrapper,
|
|
3637
|
+
children: /* @__PURE__ */ w(sn, {})
|
|
3638
|
+
}) : a ? /* @__PURE__ */ w(Ii, {
|
|
3639
|
+
schema: a,
|
|
3640
|
+
enableVerification: r,
|
|
3641
|
+
...i
|
|
3642
|
+
}) : null;
|
|
3643
|
+
}, Vi = /* @__PURE__ */ $t({
|
|
3644
|
+
CollectionForm: () => ti,
|
|
3645
|
+
CollectionFormBuilder: () => Ri,
|
|
3646
|
+
CollectionFormRenderer: () => Bi,
|
|
3647
|
+
FormBuilder: () => Ii,
|
|
3648
|
+
LevoFormProvider: () => ri,
|
|
3649
|
+
useLevoForm: () => ci,
|
|
3650
|
+
useLevoFormContext: () => $
|
|
3651
|
+
});
|
|
3652
|
+
//#endregion
|
|
3653
|
+
export { B as _, ci as a, fn as b, ti as c, Mr as d, G as f, wn as g, H as h, Ii as i, Zr as l, On as m, Bi as n, $ as o, Vn as p, Ri as r, ri as s, Vi as t, Jr as u, mn as v, dn as y };
|