fansunited-widgets-cdn 0.0.85 → 0.0.86-RC2
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/chunks/Alert-CuOsmojH.js +149 -0
- package/chunks/AspectRatio-D3Sgxj7p.js +125 -0
- package/chunks/Avatar-BTsEKfhc.js +186 -0
- package/chunks/Button-BV7YIFkS.js +858 -0
- package/chunks/Card-DRIT0wtY.js +129 -0
- package/chunks/CardContent-CD-WZh1l.js +60 -0
- package/chunks/ChevronRight-BrCKlr3T.js +11 -0
- package/chunks/Chip-6HLNTHMI.js +281 -0
- package/chunks/ClassicQuizWrapper-t04e9_6c.js +4883 -0
- package/chunks/CollectLeadForm-DtmR2Vuf-B_3JkHJC.js +1560 -0
- package/chunks/CollectLeadWrapper-CVAVswua.js +1294 -0
- package/chunks/DialogActions-C5kAgHal.js +45 -0
- package/chunks/DialogContent-MIXff4nd.js +60 -0
- package/chunks/EitherOrById-CAo8gPjm.js +1496 -0
- package/chunks/EitherOrPreviewWrapper-DFi2bviS.js +47 -0
- package/chunks/Error-DhQL89pn-BwTV1meb.js +418 -0
- package/chunks/EventGameWrapper-BxyLL3eA.js +7633 -0
- package/chunks/Grid-Dpv_ZL23.js +279 -0
- package/chunks/IconButton-Lt9Xks7c.js +207 -0
- package/chunks/Link-DLuj1USf.js +228 -0
- package/chunks/List-DLPlZGTP.js +397 -0
- package/chunks/ListItemDecorator-CE2eQLip.js +1882 -0
- package/chunks/MatchPredictionContainer-Ct6gXvLw.js +751 -0
- package/chunks/MatchQuizWrapper-Fu6RfWVn.js +11046 -0
- package/chunks/ModalDialog-Ci3hulZA.js +619 -0
- package/chunks/NotFoundSkeleton-BYJTzYJR-Be3R34nS.js +2764 -0
- package/chunks/OverlayLeadAfterCollection-DnqztPJ5-CpELr0AC.js +896 -0
- package/chunks/OverlayScoreStateSkeleton-C9FUhcnd-DMFELrvA.js +146 -0
- package/chunks/PersonalityQuizWrapper-MpUK4n3Y.js +34374 -0
- package/chunks/PlayerOfTheMatch-D4vuR7pz.js +1406 -0
- package/chunks/PollWrapper-CzKj8xxE.js +4198 -0
- package/chunks/Portal-BWqqFvVm-TuHZWjxn.js +12717 -0
- package/chunks/Portal-DA1mxzSo.js +41 -0
- package/chunks/PreviewQuizById-WWS_LyJR.js +4864 -0
- package/chunks/Select-p_cHpLhi.js +3418 -0
- package/chunks/Sheet-BaCzogZK.js +167 -0
- package/chunks/Snackbar-DHxnbCA3.js +358 -0
- package/chunks/Stack-Dgf2LXN0.js +117 -0
- package/chunks/Tabs-CSu_cWNi.js +784 -0
- package/chunks/TeamNextMatchPrediction-C7HilNqW.js +6 -0
- package/chunks/Tutorial-DFNZxmAx.js +427 -0
- package/chunks/createLucideIcon-B6NxpYkb.js +79 -0
- package/chunks/createSvgIcon-7h7XC877.js +119 -0
- package/chunks/createSvgIcon-DVA0KIUd.js +2490 -0
- package/chunks/dataAttributeParser-CF9vxaVN.js +28 -0
- package/chunks/default-quiz-bg-CTzaADn7.js +4 -0
- package/chunks/getReactElementRef-BD-S8A24.js +25 -0
- package/chunks/index-24AwmTVJ.js +85 -0
- package/chunks/index-3vJS8JzK.js +63 -0
- package/chunks/index-BSD7mvEU.js +57 -0
- package/chunks/index-BU6iona7.js +57 -0
- package/chunks/index-BqCHiyI6.js +59 -0
- package/chunks/index-C5qRf4TV.js +20 -0
- package/chunks/index-C9MpfjqV.js +35 -0
- package/chunks/index-CMmQs5A5.js +56 -0
- package/chunks/index-CicEY2Jv.js +5 -0
- package/chunks/index-DNeawo0R.js +17 -0
- package/chunks/index-DePIySlY.js +29 -0
- package/chunks/index-DoRYU_1L.js +41 -0
- package/chunks/index-DvgG9XJj.js +20 -0
- package/chunks/index-QpZE-92Y.js +33 -0
- package/chunks/index-rgFj976B.js +17 -0
- package/chunks/index-tzsdMoo-.js +16 -0
- package/chunks/index.es-CHqz6mjo.js +6162 -0
- package/chunks/init-BEkECL0v.js +32 -0
- package/chunks/main-XP7dqk6g.js +39843 -0
- package/chunks/resolveProps-BfYZubfk.js +37 -0
- package/chunks/users-D_xgC4iQ.js +16 -0
- package/chunks/variantColorInheritance-DI3wUohX.js +28 -0
- package/fu-widgets-loader.es.js +73 -0
- package/fu-widgets-loader.js +1 -0
- package/fu-widgets.es.js +4 -0
- package/fu-widgets.iife.js +621 -682
- package/manifest.json +84 -0
- package/package.json +9 -2
|
@@ -0,0 +1,1560 @@
|
|
|
1
|
+
import { r as P, Z as Me, w as z, _ as Fe, $ as we, j as r, G as Ve, F as qe, v as Je, a0 as io, x as ee, y as oe, z as ce, D as Ge, B as ve } from "./main-XP7dqk6g.js";
|
|
2
|
+
import { e as Ze, J as Qe, G as Ke, $ as Xe, h as Be, Z as so, s as Le, v as We, w as Ae, x as co, z as uo, A as po } from "./Portal-BWqqFvVm-TuHZWjxn.js";
|
|
3
|
+
import { S as He } from "./Stack-Dgf2LXN0.js";
|
|
4
|
+
import { a as mo, b as ho, T as G, B as Pe } from "./Button-BV7YIFkS.js";
|
|
5
|
+
import { b as xo, F as vo, c as bo, u as Re, I as se, S as Oe, a as Ee } from "./Select-p_cHpLhi.js";
|
|
6
|
+
import { F as J, a as re, A as go, b as fo, L as Co, c as yo } from "./ListItemDecorator-CE2eQLip.js";
|
|
7
|
+
import { o as Ue } from "./Portal-DA1mxzSo.js";
|
|
8
|
+
import { c as Ye } from "./createSvgIcon-7h7XC877.js";
|
|
9
|
+
import { L as xe } from "./Link-DLuj1USf.js";
|
|
10
|
+
function ko(o, e = 166) {
|
|
11
|
+
let l;
|
|
12
|
+
function t(...i) {
|
|
13
|
+
const n = () => {
|
|
14
|
+
o.apply(this, i);
|
|
15
|
+
};
|
|
16
|
+
clearTimeout(l), l = setTimeout(n, e);
|
|
17
|
+
}
|
|
18
|
+
return t.clear = () => {
|
|
19
|
+
clearTimeout(l);
|
|
20
|
+
}, t;
|
|
21
|
+
}
|
|
22
|
+
function To(o) {
|
|
23
|
+
const {
|
|
24
|
+
checked: e,
|
|
25
|
+
defaultChecked: l,
|
|
26
|
+
disabled: t,
|
|
27
|
+
onBlur: i,
|
|
28
|
+
onChange: n,
|
|
29
|
+
onFocus: b,
|
|
30
|
+
onFocusVisible: g,
|
|
31
|
+
readOnly: k,
|
|
32
|
+
required: j
|
|
33
|
+
} = o, [I, c] = xo({
|
|
34
|
+
controlled: e,
|
|
35
|
+
default: !!l,
|
|
36
|
+
name: "Switch",
|
|
37
|
+
state: "checked"
|
|
38
|
+
}), S = (v) => (C) => {
|
|
39
|
+
var d;
|
|
40
|
+
C.nativeEvent.defaultPrevented || (c(C.target.checked), n == null || n(C), (d = v.onChange) == null || d.call(v, C));
|
|
41
|
+
}, {
|
|
42
|
+
isFocusVisibleRef: f,
|
|
43
|
+
onBlur: $,
|
|
44
|
+
onFocus: N,
|
|
45
|
+
ref: F
|
|
46
|
+
} = mo(), [x, p] = P.useState(!1);
|
|
47
|
+
t && x && p(!1), P.useEffect(() => {
|
|
48
|
+
f.current = x;
|
|
49
|
+
}, [x, f]);
|
|
50
|
+
const s = P.useRef(null), a = (v) => (C) => {
|
|
51
|
+
var d;
|
|
52
|
+
s.current || (s.current = C.currentTarget), N(C), f.current === !0 && (p(!0), g == null || g(C)), b == null || b(C), (d = v.onFocus) == null || d.call(v, C);
|
|
53
|
+
}, D = (v) => (C) => {
|
|
54
|
+
var d;
|
|
55
|
+
$(C), f.current === !1 && p(!1), i == null || i(C), (d = v.onBlur) == null || d.call(v, C);
|
|
56
|
+
}, H = Me(F, s);
|
|
57
|
+
return {
|
|
58
|
+
checked: I,
|
|
59
|
+
disabled: !!t,
|
|
60
|
+
focusVisible: x,
|
|
61
|
+
getInputProps: (v = {}) => z({
|
|
62
|
+
checked: e,
|
|
63
|
+
defaultChecked: l,
|
|
64
|
+
disabled: t,
|
|
65
|
+
readOnly: k,
|
|
66
|
+
ref: H,
|
|
67
|
+
required: j,
|
|
68
|
+
type: "checkbox",
|
|
69
|
+
role: "switch",
|
|
70
|
+
"aria-checked": e
|
|
71
|
+
}, v, {
|
|
72
|
+
onChange: S(v),
|
|
73
|
+
onFocus: a(v),
|
|
74
|
+
onBlur: D(v)
|
|
75
|
+
}),
|
|
76
|
+
inputRef: H,
|
|
77
|
+
readOnly: !!k
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const $o = ["onChange", "maxRows", "minRows", "style", "value"];
|
|
81
|
+
function ge(o) {
|
|
82
|
+
return parseInt(o, 10) || 0;
|
|
83
|
+
}
|
|
84
|
+
const No = {
|
|
85
|
+
shadow: {
|
|
86
|
+
// Visibility needed to hide the extra text area on iPads
|
|
87
|
+
visibility: "hidden",
|
|
88
|
+
// Remove from the content flow
|
|
89
|
+
position: "absolute",
|
|
90
|
+
// Ignore the scrollbar width
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
height: 0,
|
|
93
|
+
top: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
// Create a new layer, increase the isolation of the computed values
|
|
96
|
+
transform: "translateZ(0)"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function zo(o) {
|
|
100
|
+
return o == null || Object.keys(o).length === 0 || o.outerHeightStyle === 0 && !o.overflowing;
|
|
101
|
+
}
|
|
102
|
+
const jo = /* @__PURE__ */ P.forwardRef(function(e, l) {
|
|
103
|
+
const {
|
|
104
|
+
onChange: t,
|
|
105
|
+
maxRows: i,
|
|
106
|
+
minRows: n = 1,
|
|
107
|
+
style: b,
|
|
108
|
+
value: g
|
|
109
|
+
} = e, k = Fe(e, $o), {
|
|
110
|
+
current: j
|
|
111
|
+
} = P.useRef(g != null), I = P.useRef(null), c = Me(l, I), S = P.useRef(null), f = P.useRef(null), $ = P.useCallback(() => {
|
|
112
|
+
const x = I.current, s = Ue(x).getComputedStyle(x);
|
|
113
|
+
if (s.width === "0px")
|
|
114
|
+
return {
|
|
115
|
+
outerHeightStyle: 0,
|
|
116
|
+
overflowing: !1
|
|
117
|
+
};
|
|
118
|
+
const a = f.current;
|
|
119
|
+
a.style.width = s.width, a.value = x.value || e.placeholder || "x", a.value.slice(-1) === `
|
|
120
|
+
` && (a.value += " ");
|
|
121
|
+
const D = s.boxSizing, H = ge(s.paddingBottom) + ge(s.paddingTop), R = ge(s.borderBottomWidth) + ge(s.borderTopWidth), v = a.scrollHeight;
|
|
122
|
+
a.value = "x";
|
|
123
|
+
const C = a.scrollHeight;
|
|
124
|
+
let d = v;
|
|
125
|
+
n && (d = Math.max(Number(n) * C, d)), i && (d = Math.min(Number(i) * C, d)), d = Math.max(d, C);
|
|
126
|
+
const V = d + (D === "border-box" ? H + R : 0), m = Math.abs(d - v) <= 1;
|
|
127
|
+
return {
|
|
128
|
+
outerHeightStyle: V,
|
|
129
|
+
overflowing: m
|
|
130
|
+
};
|
|
131
|
+
}, [i, n, e.placeholder]), N = P.useCallback(() => {
|
|
132
|
+
const x = $();
|
|
133
|
+
if (zo(x))
|
|
134
|
+
return;
|
|
135
|
+
const p = x.outerHeightStyle, s = I.current;
|
|
136
|
+
S.current !== p && (S.current = p, s.style.height = `${p}px`), s.style.overflow = x.overflowing ? "hidden" : "";
|
|
137
|
+
}, [$]);
|
|
138
|
+
we(() => {
|
|
139
|
+
const x = () => {
|
|
140
|
+
N();
|
|
141
|
+
};
|
|
142
|
+
let p;
|
|
143
|
+
const s = ko(x), a = I.current, D = Ue(a);
|
|
144
|
+
D.addEventListener("resize", s);
|
|
145
|
+
let H;
|
|
146
|
+
return typeof ResizeObserver < "u" && (H = new ResizeObserver(x), H.observe(a)), () => {
|
|
147
|
+
s.clear(), cancelAnimationFrame(p), D.removeEventListener("resize", s), H && H.disconnect();
|
|
148
|
+
};
|
|
149
|
+
}, [$, N]), we(() => {
|
|
150
|
+
N();
|
|
151
|
+
});
|
|
152
|
+
const F = (x) => {
|
|
153
|
+
j || N(), t && t(x);
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ r.jsxs(P.Fragment, {
|
|
156
|
+
children: [/* @__PURE__ */ r.jsx("textarea", z({
|
|
157
|
+
value: g,
|
|
158
|
+
onChange: F,
|
|
159
|
+
ref: c,
|
|
160
|
+
rows: n,
|
|
161
|
+
style: b
|
|
162
|
+
}, k)), /* @__PURE__ */ r.jsx("textarea", {
|
|
163
|
+
"aria-hidden": !0,
|
|
164
|
+
className: e.className,
|
|
165
|
+
readOnly: !0,
|
|
166
|
+
ref: f,
|
|
167
|
+
tabIndex: -1,
|
|
168
|
+
style: z({}, No.shadow, b, {
|
|
169
|
+
paddingTop: 0,
|
|
170
|
+
paddingBottom: 0
|
|
171
|
+
})
|
|
172
|
+
})]
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
function Io(o) {
|
|
176
|
+
return qe("MuiCheckbox", o);
|
|
177
|
+
}
|
|
178
|
+
const de = Ve("MuiCheckbox", ["root", "checkbox", "action", "input", "label", "checked", "disabled", "focusVisible", "indeterminate", "colorPrimary", "colorDanger", "colorNeutral", "colorSuccess", "colorWarning", "colorContext", "sizeSm", "sizeMd", "sizeLg", "variantOutlined", "variantSoft", "variantSolid"]), So = Ye(/* @__PURE__ */ r.jsx("path", {
|
|
179
|
+
d: "M9 16.17 5.53 12.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.9959.9959 0 0 0-1.41 0L9 16.17z"
|
|
180
|
+
}), "Check"), Po = Ye(/* @__PURE__ */ r.jsx("path", {
|
|
181
|
+
d: "M19 13H5c-.55 0-1-.45-1-1s.45-1 1-1h14c.55 0 1 .45 1 1s-.45 1-1 1z"
|
|
182
|
+
}), "HorizontalRule"), Fo = ["checked", "uncheckedIcon", "checkedIcon", "label", "defaultChecked", "disabled", "disableIcon", "overlay", "id", "indeterminate", "indeterminateIcon", "name", "onBlur", "onChange", "onFocus", "onFocusVisible", "readOnly", "required", "value", "color", "variant", "size", "component", "slots", "slotProps"], Bo = (o) => {
|
|
183
|
+
const {
|
|
184
|
+
checked: e,
|
|
185
|
+
disabled: l,
|
|
186
|
+
disableIcon: t,
|
|
187
|
+
focusVisible: i,
|
|
188
|
+
color: n,
|
|
189
|
+
variant: b,
|
|
190
|
+
size: g,
|
|
191
|
+
indeterminate: k
|
|
192
|
+
} = o, j = {
|
|
193
|
+
root: ["root", e && "checked", l && "disabled", i && "focusVisible", b && `variant${ce(b)}`, n && `color${ce(n)}`, g && `size${ce(g)}`],
|
|
194
|
+
checkbox: [
|
|
195
|
+
"checkbox",
|
|
196
|
+
e && "checked",
|
|
197
|
+
k && "indeterminate",
|
|
198
|
+
l && "disabled"
|
|
199
|
+
// disabled class is necessary for displaying global variant
|
|
200
|
+
],
|
|
201
|
+
action: [
|
|
202
|
+
"action",
|
|
203
|
+
e && "checked",
|
|
204
|
+
t && l && "disabled",
|
|
205
|
+
// add disabled class to action element for displaying global variant
|
|
206
|
+
i && "focusVisible"
|
|
207
|
+
],
|
|
208
|
+
input: ["input"],
|
|
209
|
+
label: ["label"]
|
|
210
|
+
};
|
|
211
|
+
return Ge(j, Io, {});
|
|
212
|
+
}, Ho = oe("span", {
|
|
213
|
+
name: "JoyCheckbox",
|
|
214
|
+
slot: "Root",
|
|
215
|
+
overridesResolver: (o, e) => e.root
|
|
216
|
+
})(({
|
|
217
|
+
ownerState: o,
|
|
218
|
+
theme: e
|
|
219
|
+
}) => {
|
|
220
|
+
var l, t, i;
|
|
221
|
+
return z({
|
|
222
|
+
"--Icon-fontSize": "var(--Checkbox-size)"
|
|
223
|
+
}, o.size === "sm" && {
|
|
224
|
+
"--Checkbox-size": "1rem",
|
|
225
|
+
"& ~ *": {
|
|
226
|
+
"--FormHelperText-margin": "0 0 0 1.5rem"
|
|
227
|
+
},
|
|
228
|
+
fontSize: e.vars.fontSize.sm,
|
|
229
|
+
gap: "var(--Checkbox-gap, 0.5rem)"
|
|
230
|
+
}, o.size === "md" && {
|
|
231
|
+
"--Checkbox-size": "1.25rem",
|
|
232
|
+
"& ~ *": {
|
|
233
|
+
"--FormHelperText-margin": "0.25rem 0 0 1.875rem"
|
|
234
|
+
},
|
|
235
|
+
fontSize: e.vars.fontSize.md,
|
|
236
|
+
gap: "var(--Checkbox-gap, 0.625rem)"
|
|
237
|
+
}, o.size === "lg" && {
|
|
238
|
+
"--Checkbox-size": "1.5rem",
|
|
239
|
+
"& ~ *": {
|
|
240
|
+
"--FormHelperText-margin": "0.375rem 0 0 2.25rem"
|
|
241
|
+
},
|
|
242
|
+
fontSize: e.vars.fontSize.lg,
|
|
243
|
+
gap: "var(--Checkbox-gap, 0.75rem)"
|
|
244
|
+
}, {
|
|
245
|
+
position: o.overlay ? "initial" : "relative",
|
|
246
|
+
display: "inline-flex",
|
|
247
|
+
fontFamily: e.vars.fontFamily.body,
|
|
248
|
+
lineHeight: "var(--Checkbox-size)",
|
|
249
|
+
color: e.vars.palette.text.primary,
|
|
250
|
+
[`&.${de.disabled}`]: {
|
|
251
|
+
color: (l = e.variants.plainDisabled) == null || (l = l[o.color]) == null ? void 0 : l.color
|
|
252
|
+
}
|
|
253
|
+
}, o.disableIcon && {
|
|
254
|
+
color: (t = e.variants[o.variant]) == null || (t = t[o.color]) == null ? void 0 : t.color,
|
|
255
|
+
[`&.${de.disabled}`]: {
|
|
256
|
+
color: (i = e.variants[`${o.variant}Disabled`]) == null || (i = i[o.color]) == null ? void 0 : i.color
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}), Ro = oe("span", {
|
|
260
|
+
name: "JoyCheckbox",
|
|
261
|
+
slot: "Checkbox",
|
|
262
|
+
overridesResolver: (o, e) => e.checkbox
|
|
263
|
+
})(({
|
|
264
|
+
theme: o,
|
|
265
|
+
ownerState: e
|
|
266
|
+
}) => {
|
|
267
|
+
var l, t, i, n, b;
|
|
268
|
+
const g = (l = o.variants[`${e.variant}`]) == null ? void 0 : l[e.color];
|
|
269
|
+
return [z({
|
|
270
|
+
"--Icon-color": e.color !== "neutral" || e.variant === "solid" ? "currentColor" : o.vars.palette.text.icon,
|
|
271
|
+
boxSizing: "border-box",
|
|
272
|
+
borderRadius: `min(${o.vars.radius.sm}, 0.25rem)`,
|
|
273
|
+
width: "var(--Checkbox-size)",
|
|
274
|
+
height: "var(--Checkbox-size)",
|
|
275
|
+
display: "inline-flex",
|
|
276
|
+
justifyContent: "center",
|
|
277
|
+
alignItems: "center",
|
|
278
|
+
flexShrink: 0
|
|
279
|
+
}, e.disableIcon && {
|
|
280
|
+
display: "contents"
|
|
281
|
+
}, {
|
|
282
|
+
[`&.${de.checked}, &.${de.indeterminate}`]: {
|
|
283
|
+
"--Icon-color": "currentColor"
|
|
284
|
+
}
|
|
285
|
+
}), ...e.disableIcon ? [] : [z({}, g, {
|
|
286
|
+
backgroundColor: (t = g == null ? void 0 : g.backgroundColor) != null ? t : o.vars.palette.background.surface
|
|
287
|
+
}), {
|
|
288
|
+
"&:hover": {
|
|
289
|
+
"@media (hover: hover)": (i = o.variants[`${e.variant}Hover`]) == null ? void 0 : i[e.color]
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
"&:active": (n = o.variants[`${e.variant}Active`]) == null ? void 0 : n[e.color]
|
|
293
|
+
}, {
|
|
294
|
+
[`&.${de.disabled}`]: (b = o.variants[`${e.variant}Disabled`]) == null ? void 0 : b[e.color]
|
|
295
|
+
}]];
|
|
296
|
+
}), _o = oe("span", {
|
|
297
|
+
name: "JoyCheckbox",
|
|
298
|
+
slot: "Action",
|
|
299
|
+
overridesResolver: (o, e) => e.action
|
|
300
|
+
})(({
|
|
301
|
+
theme: o,
|
|
302
|
+
ownerState: e
|
|
303
|
+
}) => {
|
|
304
|
+
var l, t, i, n;
|
|
305
|
+
return [{
|
|
306
|
+
borderRadius: `var(--Checkbox-actionRadius, ${e.overlay ? "var(--unstable_actionRadius, inherit)" : "inherit"})`,
|
|
307
|
+
textAlign: "left",
|
|
308
|
+
// prevent text-align inheritance
|
|
309
|
+
position: "absolute",
|
|
310
|
+
top: "calc(-1 * var(--variant-borderWidth, 0px))",
|
|
311
|
+
// clickable on the border and focus outline does not move when checked/unchecked
|
|
312
|
+
left: "calc(-1 * var(--variant-borderWidth, 0px))",
|
|
313
|
+
bottom: "calc(-1 * var(--variant-borderWidth, 0px))",
|
|
314
|
+
right: "calc(-1 * var(--variant-borderWidth, 0px))",
|
|
315
|
+
zIndex: 1,
|
|
316
|
+
// The action element usually cover the area of nearest positioned parent
|
|
317
|
+
[o.focus.selector]: o.focus.default
|
|
318
|
+
}, ...e.disableIcon ? [(l = o.variants[e.variant]) == null ? void 0 : l[e.color], {
|
|
319
|
+
"&:hover": (t = o.variants[`${e.variant}Hover`]) == null ? void 0 : t[e.color]
|
|
320
|
+
}, {
|
|
321
|
+
"&:active": (i = o.variants[`${e.variant}Active`]) == null ? void 0 : i[e.color]
|
|
322
|
+
}, {
|
|
323
|
+
[`&.${de.disabled}`]: (n = o.variants[`${e.variant}Disabled`]) == null ? void 0 : n[e.color]
|
|
324
|
+
}] : []];
|
|
325
|
+
}), Do = oe("input", {
|
|
326
|
+
name: "JoyCheckbox",
|
|
327
|
+
slot: "Input",
|
|
328
|
+
overridesResolver: (o, e) => e.input
|
|
329
|
+
})(() => ({
|
|
330
|
+
margin: 0,
|
|
331
|
+
opacity: 0,
|
|
332
|
+
position: "absolute",
|
|
333
|
+
width: "100%",
|
|
334
|
+
height: "100%",
|
|
335
|
+
cursor: "pointer"
|
|
336
|
+
})), wo = oe("label", {
|
|
337
|
+
name: "JoyCheckbox",
|
|
338
|
+
slot: "Label",
|
|
339
|
+
overridesResolver: (o, e) => e.label
|
|
340
|
+
})(({
|
|
341
|
+
ownerState: o
|
|
342
|
+
}) => z({
|
|
343
|
+
flex: 1,
|
|
344
|
+
minWidth: 0
|
|
345
|
+
}, o.disableIcon && {
|
|
346
|
+
zIndex: 1,
|
|
347
|
+
// label should stay on top of the action.
|
|
348
|
+
pointerEvents: "none"
|
|
349
|
+
// makes hover ineffect.
|
|
350
|
+
})), Lo = /* @__PURE__ */ r.jsx(So, {}), Wo = /* @__PURE__ */ r.jsx(Po, {}), eo = /* @__PURE__ */ P.forwardRef(function(e, l) {
|
|
351
|
+
var t, i, n, b, g;
|
|
352
|
+
const k = Je({
|
|
353
|
+
props: e,
|
|
354
|
+
name: "JoyCheckbox"
|
|
355
|
+
}), {
|
|
356
|
+
checked: j,
|
|
357
|
+
uncheckedIcon: I,
|
|
358
|
+
checkedIcon: c = Lo,
|
|
359
|
+
label: S,
|
|
360
|
+
defaultChecked: f,
|
|
361
|
+
disabled: $,
|
|
362
|
+
disableIcon: N = !1,
|
|
363
|
+
overlay: F,
|
|
364
|
+
id: x,
|
|
365
|
+
indeterminate: p = !1,
|
|
366
|
+
indeterminateIcon: s = Wo,
|
|
367
|
+
name: a,
|
|
368
|
+
onBlur: D,
|
|
369
|
+
onChange: H,
|
|
370
|
+
onFocus: R,
|
|
371
|
+
onFocusVisible: v,
|
|
372
|
+
readOnly: C,
|
|
373
|
+
required: d,
|
|
374
|
+
value: V,
|
|
375
|
+
color: m,
|
|
376
|
+
variant: y,
|
|
377
|
+
size: B = "md",
|
|
378
|
+
component: E,
|
|
379
|
+
slots: Z = {},
|
|
380
|
+
slotProps: W = {}
|
|
381
|
+
} = k, A = Fe(k, Fo), _ = P.useContext(vo), ue = (t = (i = e.disabled) != null ? i : _ == null ? void 0 : _.disabled) != null ? t : $, T = (n = (b = e.size) != null ? b : _ == null ? void 0 : _.size) != null ? n : B, w = io(x ?? (_ == null ? void 0 : _.htmlFor)), U = {
|
|
382
|
+
checked: j,
|
|
383
|
+
defaultChecked: f,
|
|
384
|
+
disabled: ue,
|
|
385
|
+
onBlur: D,
|
|
386
|
+
onChange: H,
|
|
387
|
+
onFocus: R,
|
|
388
|
+
onFocusVisible: v
|
|
389
|
+
}, {
|
|
390
|
+
getInputProps: pe,
|
|
391
|
+
checked: Q,
|
|
392
|
+
disabled: me,
|
|
393
|
+
focusVisible: q
|
|
394
|
+
} = To(U), O = Q || p, u = O ? y || "solid" : y || "outlined", be = e.color || (_ != null && _.error ? "danger" : (g = _ == null ? void 0 : _.color) != null ? g : m), M = z({}, k, {
|
|
395
|
+
checked: Q,
|
|
396
|
+
disabled: me,
|
|
397
|
+
disableIcon: N,
|
|
398
|
+
overlay: F,
|
|
399
|
+
focusVisible: q,
|
|
400
|
+
color: O ? be || "primary" : be || "neutral",
|
|
401
|
+
variant: u,
|
|
402
|
+
size: T
|
|
403
|
+
}), Y = Bo(M), te = z({}, A, {
|
|
404
|
+
component: E,
|
|
405
|
+
slots: Z,
|
|
406
|
+
slotProps: W
|
|
407
|
+
}), [fe, Ce] = ee("root", {
|
|
408
|
+
ref: l,
|
|
409
|
+
className: Y.root,
|
|
410
|
+
elementType: Ho,
|
|
411
|
+
externalForwardedProps: te,
|
|
412
|
+
ownerState: M
|
|
413
|
+
}), [ye, ke] = ee("checkbox", {
|
|
414
|
+
className: Y.checkbox,
|
|
415
|
+
elementType: Ro,
|
|
416
|
+
externalForwardedProps: te,
|
|
417
|
+
ownerState: M
|
|
418
|
+
}), [Te, $e] = ee("action", {
|
|
419
|
+
className: Y.action,
|
|
420
|
+
elementType: _o,
|
|
421
|
+
externalForwardedProps: te,
|
|
422
|
+
ownerState: M
|
|
423
|
+
}), [Ne, ze] = ee("input", {
|
|
424
|
+
additionalProps: z({
|
|
425
|
+
id: w,
|
|
426
|
+
name: a,
|
|
427
|
+
value: V,
|
|
428
|
+
readOnly: C,
|
|
429
|
+
role: void 0,
|
|
430
|
+
required: d ?? (_ == null ? void 0 : _.required),
|
|
431
|
+
"aria-describedby": _ == null ? void 0 : _["aria-describedby"]
|
|
432
|
+
}, p && {
|
|
433
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked#values
|
|
434
|
+
"aria-checked": "mixed"
|
|
435
|
+
}),
|
|
436
|
+
className: Y.input,
|
|
437
|
+
elementType: Do,
|
|
438
|
+
externalForwardedProps: te,
|
|
439
|
+
getSlotProps: pe,
|
|
440
|
+
ownerState: M
|
|
441
|
+
}), [je, Ie] = ee("label", {
|
|
442
|
+
additionalProps: {
|
|
443
|
+
htmlFor: w
|
|
444
|
+
},
|
|
445
|
+
className: Y.label,
|
|
446
|
+
elementType: wo,
|
|
447
|
+
externalForwardedProps: te,
|
|
448
|
+
ownerState: M
|
|
449
|
+
});
|
|
450
|
+
let ie = I;
|
|
451
|
+
return N ? ie = null : p ? ie = s : Q && (ie = c), /* @__PURE__ */ r.jsxs(fe, z({}, Ce, {
|
|
452
|
+
children: [/* @__PURE__ */ r.jsxs(ye, z({}, ke, {
|
|
453
|
+
children: [/* @__PURE__ */ r.jsx(Te, z({}, $e, {
|
|
454
|
+
children: /* @__PURE__ */ r.jsx(Ne, z({}, ze))
|
|
455
|
+
})), ie]
|
|
456
|
+
})), S && /* @__PURE__ */ r.jsx(ho.Provider, {
|
|
457
|
+
value: !0,
|
|
458
|
+
children: /* @__PURE__ */ r.jsx(je, z({}, Ie, {
|
|
459
|
+
children: S
|
|
460
|
+
}))
|
|
461
|
+
})]
|
|
462
|
+
}));
|
|
463
|
+
});
|
|
464
|
+
function Ao(o) {
|
|
465
|
+
return qe("MuiTextarea", o);
|
|
466
|
+
}
|
|
467
|
+
const oo = Ve("MuiTextarea", ["root", "textarea", "startDecorator", "endDecorator", "formControl", "disabled", "error", "focused", "colorPrimary", "colorNeutral", "colorDanger", "colorSuccess", "colorWarning", "colorContext", "sizeSm", "sizeMd", "sizeLg", "variantPlain", "variantOutlined", "variantSoft"]), Oo = ["propsToForward", "rootStateClasses", "inputStateClasses", "getRootProps", "getInputProps", "formControl", "focused", "error", "disabled", "size", "color", "variant", "startDecorator", "endDecorator", "minRows", "maxRows", "component", "slots", "slotProps"], Eo = (o) => {
|
|
468
|
+
const {
|
|
469
|
+
disabled: e,
|
|
470
|
+
variant: l,
|
|
471
|
+
color: t,
|
|
472
|
+
size: i
|
|
473
|
+
} = o, n = {
|
|
474
|
+
root: ["root", e && "disabled", l && `variant${ce(l)}`, t && `color${ce(t)}`, i && `size${ce(i)}`],
|
|
475
|
+
textarea: ["textarea"],
|
|
476
|
+
startDecorator: ["startDecorator"],
|
|
477
|
+
endDecorator: ["endDecorator"]
|
|
478
|
+
};
|
|
479
|
+
return Ge(n, Ao, {});
|
|
480
|
+
}, Uo = oe("div", {
|
|
481
|
+
name: "JoyTextarea",
|
|
482
|
+
slot: "Root",
|
|
483
|
+
overridesResolver: (o, e) => e.root
|
|
484
|
+
})(({
|
|
485
|
+
theme: o,
|
|
486
|
+
ownerState: e
|
|
487
|
+
}) => {
|
|
488
|
+
var l, t, i, n, b, g;
|
|
489
|
+
const k = (l = o.variants[`${e.variant}`]) == null ? void 0 : l[e.color];
|
|
490
|
+
return [z({
|
|
491
|
+
"--Textarea-radius": o.vars.radius.sm,
|
|
492
|
+
"--Textarea-gap": "0.5rem",
|
|
493
|
+
"--Textarea-placeholderColor": "inherit",
|
|
494
|
+
"--Textarea-placeholderOpacity": 0.64,
|
|
495
|
+
"--Textarea-decoratorColor": o.vars.palette.text.icon,
|
|
496
|
+
"--Textarea-focused": "0",
|
|
497
|
+
"--Textarea-focusedThickness": o.vars.focus.thickness,
|
|
498
|
+
"--Textarea-focusedHighlight": (t = o.vars.palette[e.color === "neutral" ? "primary" : e.color]) == null ? void 0 : t[500],
|
|
499
|
+
'&:not([data-inverted-colors="false"])': z({}, e.instanceColor && {
|
|
500
|
+
"--_Textarea-focusedHighlight": (i = o.vars.palette[e.instanceColor === "neutral" ? "primary" : e.instanceColor]) == null ? void 0 : i[500]
|
|
501
|
+
}, {
|
|
502
|
+
"--Textarea-focusedHighlight": `var(--_Textarea-focusedHighlight, ${o.vars.palette.focusVisible})`
|
|
503
|
+
})
|
|
504
|
+
}, e.size === "sm" && {
|
|
505
|
+
"--Textarea-minHeight": "2rem",
|
|
506
|
+
"--Textarea-paddingBlock": "calc(0.375rem - 0.5px - var(--variant-borderWidth, 0px))",
|
|
507
|
+
// to match Input because <textarea> does not center the text at the middle like <input>
|
|
508
|
+
"--Textarea-paddingInline": "0.5rem",
|
|
509
|
+
"--Textarea-decoratorChildHeight": "min(1.5rem, var(--Textarea-minHeight))",
|
|
510
|
+
"--Icon-fontSize": o.vars.fontSize.xl
|
|
511
|
+
}, e.size === "md" && {
|
|
512
|
+
"--Textarea-minHeight": "2.25rem",
|
|
513
|
+
"--Textarea-paddingBlock": "calc(0.375rem - var(--variant-borderWidth, 0px))",
|
|
514
|
+
"--Textarea-paddingInline": "0.75rem",
|
|
515
|
+
"--Textarea-decoratorChildHeight": "min(1.75rem, var(--Textarea-minHeight))",
|
|
516
|
+
"--Icon-fontSize": o.vars.fontSize.xl2
|
|
517
|
+
}, e.size === "lg" && {
|
|
518
|
+
"--Textarea-minHeight": "3rem",
|
|
519
|
+
"--Textarea-paddingBlock": "calc(0.75rem - var(--variant-borderWidth, 0px))",
|
|
520
|
+
"--Textarea-paddingInline": "1rem",
|
|
521
|
+
"--Textarea-gap": "0.75rem",
|
|
522
|
+
"--Textarea-decoratorChildHeight": "min(2.375rem, var(--Textarea-minHeight))",
|
|
523
|
+
"--Icon-fontSize": o.vars.fontSize.xl2
|
|
524
|
+
}, {
|
|
525
|
+
// variables for controlling child components
|
|
526
|
+
"--_Textarea-paddingBlock": "max((var(--Textarea-minHeight) - 2 * var(--variant-borderWidth, 0px) - var(--Textarea-decoratorChildHeight)) / 2, 0px)",
|
|
527
|
+
"--Textarea-decoratorChildRadius": "max(var(--Textarea-radius) - var(--variant-borderWidth, 0px) - var(--_Textarea-paddingBlock), min(var(--_Textarea-paddingBlock) + var(--variant-borderWidth, 0px), var(--Textarea-radius) / 2))",
|
|
528
|
+
"--Button-minHeight": "var(--Textarea-decoratorChildHeight)",
|
|
529
|
+
"--Button-paddingBlock": "0px",
|
|
530
|
+
// to ensure that the height of the button is equal to --Button-minHeight
|
|
531
|
+
"--IconButton-size": "var(--Textarea-decoratorChildHeight)",
|
|
532
|
+
"--Button-radius": "var(--Textarea-decoratorChildRadius)",
|
|
533
|
+
"--IconButton-radius": "var(--Textarea-decoratorChildRadius)",
|
|
534
|
+
boxSizing: "border-box"
|
|
535
|
+
}, e.variant !== "plain" && {
|
|
536
|
+
boxShadow: o.shadow.xs
|
|
537
|
+
}, {
|
|
538
|
+
minWidth: 0,
|
|
539
|
+
minHeight: "var(--Textarea-minHeight)",
|
|
540
|
+
cursor: "text",
|
|
541
|
+
position: "relative",
|
|
542
|
+
display: "flex",
|
|
543
|
+
flexDirection: "column",
|
|
544
|
+
paddingInlineStart: "var(--Textarea-paddingInline)",
|
|
545
|
+
// the paddingInlineEnd is added to the textarea. It looks better when the scrollbar appears.
|
|
546
|
+
paddingBlock: "var(--Textarea-paddingBlock)",
|
|
547
|
+
borderRadius: "var(--Textarea-radius)"
|
|
548
|
+
}, o.typography[`body-${e.size}`], k, {
|
|
549
|
+
backgroundColor: (n = k == null ? void 0 : k.backgroundColor) != null ? n : o.vars.palette.background.surface,
|
|
550
|
+
"&::before": {
|
|
551
|
+
boxSizing: "border-box",
|
|
552
|
+
content: '""',
|
|
553
|
+
display: "block",
|
|
554
|
+
position: "absolute",
|
|
555
|
+
pointerEvents: "none",
|
|
556
|
+
top: 0,
|
|
557
|
+
left: 0,
|
|
558
|
+
right: 0,
|
|
559
|
+
bottom: 0,
|
|
560
|
+
zIndex: 1,
|
|
561
|
+
borderRadius: "inherit",
|
|
562
|
+
margin: "calc(var(--variant-borderWidth, 0px) * -1)",
|
|
563
|
+
// for outlined variant
|
|
564
|
+
boxShadow: "var(--Textarea-focusedInset, inset) 0 0 0 calc(var(--Textarea-focused) * var(--Textarea-focusedThickness)) var(--Textarea-focusedHighlight)"
|
|
565
|
+
}
|
|
566
|
+
}), {
|
|
567
|
+
"&:hover": z({}, (b = o.variants[`${e.variant}Hover`]) == null ? void 0 : b[e.color], {
|
|
568
|
+
backgroundColor: null,
|
|
569
|
+
// it is not common to change background on hover for Textarea
|
|
570
|
+
cursor: "text"
|
|
571
|
+
}),
|
|
572
|
+
[`&.${oo.disabled}`]: (g = o.variants[`${e.variant}Disabled`]) == null ? void 0 : g[e.color],
|
|
573
|
+
"&:focus-within::before": {
|
|
574
|
+
"--Textarea-focused": "1"
|
|
575
|
+
}
|
|
576
|
+
}];
|
|
577
|
+
}), Mo = oe(jo, {
|
|
578
|
+
name: "JoyTextarea",
|
|
579
|
+
slot: "Textarea",
|
|
580
|
+
overridesResolver: (o, e) => e.textarea
|
|
581
|
+
})({
|
|
582
|
+
resize: "none",
|
|
583
|
+
border: "none",
|
|
584
|
+
// remove the native textarea width
|
|
585
|
+
minWidth: 0,
|
|
586
|
+
// remove the native textarea width
|
|
587
|
+
outline: 0,
|
|
588
|
+
// remove the native textarea outline
|
|
589
|
+
padding: 0,
|
|
590
|
+
// remove the native textarea padding
|
|
591
|
+
paddingInlineEnd: "var(--Textarea-paddingInline)",
|
|
592
|
+
flex: "auto",
|
|
593
|
+
alignSelf: "stretch",
|
|
594
|
+
color: "inherit",
|
|
595
|
+
backgroundColor: "transparent",
|
|
596
|
+
fontFamily: "inherit",
|
|
597
|
+
fontSize: "inherit",
|
|
598
|
+
fontStyle: "inherit",
|
|
599
|
+
fontWeight: "inherit",
|
|
600
|
+
lineHeight: "inherit",
|
|
601
|
+
"&::-webkit-input-placeholder": {
|
|
602
|
+
color: "var(--Textarea-placeholderColor)",
|
|
603
|
+
opacity: "var(--Textarea-placeholderOpacity)"
|
|
604
|
+
},
|
|
605
|
+
"&::-moz-placeholder": {
|
|
606
|
+
// Firefox 19+
|
|
607
|
+
color: "var(--Textarea-placeholderColor)",
|
|
608
|
+
opacity: "var(--Textarea-placeholderOpacity)"
|
|
609
|
+
},
|
|
610
|
+
"&:-ms-input-placeholder": {
|
|
611
|
+
// IE11
|
|
612
|
+
color: "var(--Textarea-placeholderColor)",
|
|
613
|
+
opacity: "var(--Textarea-placeholderOpacity)"
|
|
614
|
+
},
|
|
615
|
+
"&::-ms-input-placeholder": {
|
|
616
|
+
// Edge
|
|
617
|
+
color: "var(--Textarea-placeholderColor)",
|
|
618
|
+
opacity: "var(--Textarea-placeholderOpacity)"
|
|
619
|
+
}
|
|
620
|
+
}), Vo = oe("div", {
|
|
621
|
+
name: "JoyTextarea",
|
|
622
|
+
slot: "StartDecorator",
|
|
623
|
+
overridesResolver: (o, e) => e.startDecorator
|
|
624
|
+
})({
|
|
625
|
+
display: "flex",
|
|
626
|
+
marginInlineStart: "calc(var(--Textarea-paddingBlock) - var(--Textarea-paddingInline))",
|
|
627
|
+
marginInlineEnd: "var(--Textarea-paddingBlock)",
|
|
628
|
+
marginBlockEnd: "var(--Textarea-gap)",
|
|
629
|
+
color: "var(--Textarea-decoratorColor)",
|
|
630
|
+
cursor: "initial"
|
|
631
|
+
}), qo = oe("div", {
|
|
632
|
+
name: "JoyTextarea",
|
|
633
|
+
slot: "EndDecorator",
|
|
634
|
+
overridesResolver: (o, e) => e.endDecorator
|
|
635
|
+
})({
|
|
636
|
+
display: "flex",
|
|
637
|
+
marginInlineStart: "calc(var(--Textarea-paddingBlock) - var(--Textarea-paddingInline))",
|
|
638
|
+
marginInlineEnd: "var(--Textarea-paddingBlock)",
|
|
639
|
+
marginBlockStart: "var(--Textarea-gap)",
|
|
640
|
+
color: "var(--Textarea-decoratorColor)",
|
|
641
|
+
cursor: "initial"
|
|
642
|
+
}), Jo = /* @__PURE__ */ P.forwardRef(function(e, l) {
|
|
643
|
+
var t, i, n, b, g, k, j, I;
|
|
644
|
+
const c = Je({
|
|
645
|
+
props: e,
|
|
646
|
+
name: "JoyTextarea"
|
|
647
|
+
}), S = bo(c, oo), {
|
|
648
|
+
propsToForward: f,
|
|
649
|
+
rootStateClasses: $,
|
|
650
|
+
inputStateClasses: N,
|
|
651
|
+
getRootProps: F,
|
|
652
|
+
getInputProps: x,
|
|
653
|
+
formControl: p,
|
|
654
|
+
focused: s,
|
|
655
|
+
error: a = !1,
|
|
656
|
+
disabled: D = !1,
|
|
657
|
+
size: H = "md",
|
|
658
|
+
color: R = "neutral",
|
|
659
|
+
variant: v = "outlined",
|
|
660
|
+
startDecorator: C,
|
|
661
|
+
endDecorator: d,
|
|
662
|
+
minRows: V,
|
|
663
|
+
maxRows: m,
|
|
664
|
+
component: y,
|
|
665
|
+
slots: B = {},
|
|
666
|
+
slotProps: E = {}
|
|
667
|
+
} = S, Z = Fe(S, Oo), W = (t = (i = e.disabled) != null ? i : p == null ? void 0 : p.disabled) != null ? t : D, A = (n = (b = e.error) != null ? b : p == null ? void 0 : p.error) != null ? n : a, _ = (g = (k = e.size) != null ? k : p == null ? void 0 : p.size) != null ? g : H, ue = (j = e.color) != null ? j : A ? "danger" : (I = p == null ? void 0 : p.color) != null ? I : R, T = z({
|
|
668
|
+
instanceColor: A ? "danger" : e.color
|
|
669
|
+
}, c, {
|
|
670
|
+
color: ue,
|
|
671
|
+
disabled: W,
|
|
672
|
+
error: A,
|
|
673
|
+
focused: s,
|
|
674
|
+
size: _,
|
|
675
|
+
variant: v
|
|
676
|
+
}), w = Eo(T), U = z({}, Z, {
|
|
677
|
+
component: y,
|
|
678
|
+
slots: B,
|
|
679
|
+
slotProps: E
|
|
680
|
+
}), [pe, Q] = ee("root", {
|
|
681
|
+
ref: l,
|
|
682
|
+
className: [w.root, $],
|
|
683
|
+
elementType: Uo,
|
|
684
|
+
externalForwardedProps: U,
|
|
685
|
+
getSlotProps: F,
|
|
686
|
+
ownerState: T
|
|
687
|
+
}), [me, q] = ee("textarea", {
|
|
688
|
+
additionalProps: {
|
|
689
|
+
id: p == null ? void 0 : p.htmlFor,
|
|
690
|
+
"aria-describedby": p == null ? void 0 : p["aria-describedby"]
|
|
691
|
+
},
|
|
692
|
+
className: [w.textarea, N],
|
|
693
|
+
elementType: Mo,
|
|
694
|
+
internalForwardedProps: z({}, f, {
|
|
695
|
+
minRows: V,
|
|
696
|
+
maxRows: m
|
|
697
|
+
}),
|
|
698
|
+
externalForwardedProps: U,
|
|
699
|
+
getSlotProps: x,
|
|
700
|
+
ownerState: T
|
|
701
|
+
}), [O, le] = ee("startDecorator", {
|
|
702
|
+
className: w.startDecorator,
|
|
703
|
+
elementType: Vo,
|
|
704
|
+
externalForwardedProps: U,
|
|
705
|
+
ownerState: T
|
|
706
|
+
}), [ne, u] = ee("endDecorator", {
|
|
707
|
+
className: w.endDecorator,
|
|
708
|
+
elementType: qo,
|
|
709
|
+
externalForwardedProps: U,
|
|
710
|
+
ownerState: T
|
|
711
|
+
});
|
|
712
|
+
return /* @__PURE__ */ r.jsxs(pe, z({}, Q, {
|
|
713
|
+
children: [C && /* @__PURE__ */ r.jsx(O, z({}, le, {
|
|
714
|
+
children: C
|
|
715
|
+
})), /* @__PURE__ */ r.jsx(me, z({}, q)), d && /* @__PURE__ */ r.jsx(ne, z({}, u, {
|
|
716
|
+
children: d
|
|
717
|
+
}))]
|
|
718
|
+
}));
|
|
719
|
+
});
|
|
720
|
+
function Go(o) {
|
|
721
|
+
const {
|
|
722
|
+
sdk: e,
|
|
723
|
+
fields: l = ["fullName", "email"],
|
|
724
|
+
campaignId: t = "",
|
|
725
|
+
campaignName: i = "",
|
|
726
|
+
contentType: n = "",
|
|
727
|
+
contentId: b = "",
|
|
728
|
+
contentName: g = "",
|
|
729
|
+
syncWithProfile: k = !1
|
|
730
|
+
} = o, { leadPhoneCountryCode: j, language: I } = Ke(Xe), [c, S] = P.useState({
|
|
731
|
+
firstName: "",
|
|
732
|
+
lastName: "",
|
|
733
|
+
fullName: "",
|
|
734
|
+
email: "",
|
|
735
|
+
gender: "",
|
|
736
|
+
country: "",
|
|
737
|
+
phoneCountryCode: j ? We(j) : Ae(I || "en"),
|
|
738
|
+
phoneNumber: "",
|
|
739
|
+
customFields: {}
|
|
740
|
+
});
|
|
741
|
+
P.useEffect(() => {
|
|
742
|
+
const m = j ? We(j) : Ae(I || "en");
|
|
743
|
+
S((y) => !y.phoneNumber || !y.phoneCountryCode ? { ...y, phoneCountryCode: m } : y);
|
|
744
|
+
}, [j, I]);
|
|
745
|
+
const [f, $] = P.useState({}), [N, F] = P.useState(!1), [x, p] = P.useState(!1), [s, a] = P.useState(null), D = () => a(null), H = (m) => (y) => {
|
|
746
|
+
S((B) => ({
|
|
747
|
+
...B,
|
|
748
|
+
[m]: y.target.value
|
|
749
|
+
}));
|
|
750
|
+
}, R = (m) => (y) => {
|
|
751
|
+
const B = y.target.value;
|
|
752
|
+
$((E) => ({ ...E, [m]: B }));
|
|
753
|
+
}, v = (m, y) => {
|
|
754
|
+
S((B) => ({
|
|
755
|
+
...B,
|
|
756
|
+
phoneCountryCode: y
|
|
757
|
+
}));
|
|
758
|
+
}, C = (m, y) => {
|
|
759
|
+
S((B) => ({
|
|
760
|
+
...B,
|
|
761
|
+
country: y || ""
|
|
762
|
+
}));
|
|
763
|
+
}, d = (m, y) => {
|
|
764
|
+
S((B) => ({
|
|
765
|
+
...B,
|
|
766
|
+
gender: y || ""
|
|
767
|
+
}));
|
|
768
|
+
}, V = async () => {
|
|
769
|
+
if (k)
|
|
770
|
+
try {
|
|
771
|
+
const m = e.profile.getOwn();
|
|
772
|
+
if (c.fullName && l.includes("fullName") ? m.setName(c.fullName.trim()) : c.firstName && l.includes("firstName") && c.lastName && l.includes("lastName") ? m.setName(
|
|
773
|
+
c.firstName.trim() + " " + c.lastName.trim()
|
|
774
|
+
) : c.firstName && l.includes("firstName") ? m.setName(c.firstName.trim()) : c.lastName && l.includes("lastName") && m.setName(c.lastName.trim()), c.email && l.includes("email") && m.setEmail(c.email.trim()), c.gender && l.includes("gender") && m.setGender(c.gender), c.country && l.includes("country")) {
|
|
775
|
+
const y = await e.profile.getCountries(), B = po(c.country), E = y.find((Z) => Z.name === (B == null ? void 0 : B.label));
|
|
776
|
+
E && m.setCountry(E.id);
|
|
777
|
+
}
|
|
778
|
+
c.phoneCountryCode && l.includes("phoneCountryCode") && m.setPhoneCountryCode(
|
|
779
|
+
"+" + c.phoneCountryCode.phone
|
|
780
|
+
), c.phoneNumber && l.includes("phoneNumber") && m.setPhoneNumber(c.phoneNumber.trim()), await m.update();
|
|
781
|
+
} catch (m) {
|
|
782
|
+
console.warn("[LeadForm] Failed to sync profile data:", m);
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
return {
|
|
786
|
+
formData: c,
|
|
787
|
+
setFormData: S,
|
|
788
|
+
isLoading: N,
|
|
789
|
+
isSuccess: x,
|
|
790
|
+
error: s,
|
|
791
|
+
clearError: D,
|
|
792
|
+
handleInputChange: H,
|
|
793
|
+
handleCustomFieldChange: R,
|
|
794
|
+
customFieldsData: f,
|
|
795
|
+
handlePhoneCountryChange: v,
|
|
796
|
+
handleCountryChange: C,
|
|
797
|
+
handleGenderChange: d,
|
|
798
|
+
handleSubmit: async (m) => {
|
|
799
|
+
var y;
|
|
800
|
+
m && m.preventDefault(), a(null);
|
|
801
|
+
const B = {
|
|
802
|
+
firstName: c.firstName,
|
|
803
|
+
lastName: c.lastName,
|
|
804
|
+
fullName: c.fullName,
|
|
805
|
+
email: c.email,
|
|
806
|
+
gender: c.gender,
|
|
807
|
+
country: c.country,
|
|
808
|
+
phoneCountryCode: "+" + (((y = c.phoneCountryCode) == null ? void 0 : y.phone) ?? ""),
|
|
809
|
+
phoneNumber: c.phoneNumber,
|
|
810
|
+
campaignId: t,
|
|
811
|
+
campaignName: i,
|
|
812
|
+
contentType: n,
|
|
813
|
+
contentId: b,
|
|
814
|
+
contentName: g,
|
|
815
|
+
customFields: f
|
|
816
|
+
}, E = [
|
|
817
|
+
"firstName",
|
|
818
|
+
"lastName",
|
|
819
|
+
"fullName",
|
|
820
|
+
"email",
|
|
821
|
+
"gender",
|
|
822
|
+
"country",
|
|
823
|
+
"phoneCountryCode",
|
|
824
|
+
"phoneNumber",
|
|
825
|
+
"customFields"
|
|
826
|
+
], Z = Object.fromEntries(
|
|
827
|
+
Object.entries(B).map(([W, A]) => E.includes(W) ? W === "customFields" ? [W, A] : l.includes(W) && A !== "" && A !== null ? [W, A] : [W, null] : [W, A])
|
|
828
|
+
);
|
|
829
|
+
F(!0);
|
|
830
|
+
try {
|
|
831
|
+
await e.profile.collectLead(Z), await V(), p(!0);
|
|
832
|
+
} catch {
|
|
833
|
+
a("leads.form.error");
|
|
834
|
+
} finally {
|
|
835
|
+
F(!1);
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
countries: co
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
const Zo = (o) => {
|
|
842
|
+
const e = Re(), { t: l } = Be();
|
|
843
|
+
if (!o.brandingUrls)
|
|
844
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, {});
|
|
845
|
+
const { privacyPolicyUrl: t, termsAndConditionsUrl: i } = o.brandingUrls;
|
|
846
|
+
if (!t && !i)
|
|
847
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, {});
|
|
848
|
+
const n = () => t && !i ? /* @__PURE__ */ r.jsxs(G, { children: [
|
|
849
|
+
l("common.labels.iAgreeToThe"),
|
|
850
|
+
" ",
|
|
851
|
+
/* @__PURE__ */ r.jsx(
|
|
852
|
+
xe,
|
|
853
|
+
{
|
|
854
|
+
href: t,
|
|
855
|
+
target: "_blank",
|
|
856
|
+
rel: "noopener noreferrer",
|
|
857
|
+
sx: {
|
|
858
|
+
color: o.primaryColor,
|
|
859
|
+
textDecorationColor: o.primaryColor
|
|
860
|
+
},
|
|
861
|
+
children: l("leads.form.privacyPolicy")
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
] }) : !t && i ? /* @__PURE__ */ r.jsxs(G, { children: [
|
|
865
|
+
l("common.labels.iAgreeToThe"),
|
|
866
|
+
" ",
|
|
867
|
+
/* @__PURE__ */ r.jsx(
|
|
868
|
+
xe,
|
|
869
|
+
{
|
|
870
|
+
href: i,
|
|
871
|
+
target: "_blank",
|
|
872
|
+
rel: "noopener noreferrer",
|
|
873
|
+
sx: {
|
|
874
|
+
color: o.primaryColor,
|
|
875
|
+
textDecorationColor: o.primaryColor
|
|
876
|
+
},
|
|
877
|
+
children: l("leads.form.termsAndConditions")
|
|
878
|
+
}
|
|
879
|
+
)
|
|
880
|
+
] }) : /* @__PURE__ */ r.jsxs(G, { children: [
|
|
881
|
+
l("common.labels.iAgreeToThe"),
|
|
882
|
+
" ",
|
|
883
|
+
/* @__PURE__ */ r.jsx(
|
|
884
|
+
xe,
|
|
885
|
+
{
|
|
886
|
+
href: t,
|
|
887
|
+
target: "_blank",
|
|
888
|
+
rel: "noopener noreferrer",
|
|
889
|
+
sx: {
|
|
890
|
+
color: o.primaryColor,
|
|
891
|
+
textDecorationColor: o.primaryColor
|
|
892
|
+
},
|
|
893
|
+
children: l("leads.form.privacyPolicy")
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
" ",
|
|
897
|
+
l("common.labels.andThe"),
|
|
898
|
+
" ",
|
|
899
|
+
/* @__PURE__ */ r.jsx(
|
|
900
|
+
xe,
|
|
901
|
+
{
|
|
902
|
+
href: i,
|
|
903
|
+
target: "_blank",
|
|
904
|
+
rel: "noopener noreferrer",
|
|
905
|
+
sx: {
|
|
906
|
+
color: o.primaryColor,
|
|
907
|
+
textDecorationColor: o.primaryColor
|
|
908
|
+
},
|
|
909
|
+
children: l("leads.form.termsAndConditions")
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
] });
|
|
913
|
+
return /* @__PURE__ */ r.jsx(J, { required: !0, disabled: o.isDisabled, size: "sm", children: /* @__PURE__ */ r.jsxs(ve, { sx: { display: "inline-flex", alignItems: "center", gap: "8px" }, children: [
|
|
914
|
+
/* @__PURE__ */ r.jsx(
|
|
915
|
+
eo,
|
|
916
|
+
{
|
|
917
|
+
slotProps: {
|
|
918
|
+
input: {
|
|
919
|
+
sx: {}
|
|
920
|
+
},
|
|
921
|
+
checkbox: {
|
|
922
|
+
sx: {
|
|
923
|
+
"&.Mui-checked": {
|
|
924
|
+
bgcolor: o.primaryColor,
|
|
925
|
+
"--Icon-color": "#FFF"
|
|
926
|
+
},
|
|
927
|
+
"&:not(.Mui-checked):not(.Mui-disabled):hover": {
|
|
928
|
+
bgcolor: e.colorSchemes.light.palette.neutral.outlinedHoverBg
|
|
929
|
+
},
|
|
930
|
+
bgcolor: e.colorSchemes.light.palette.background.surface
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
n()
|
|
937
|
+
] }) });
|
|
938
|
+
}, Qo = (o) => {
|
|
939
|
+
const { consents: e, isDisabled: l, primaryColor: t, brandingUrls: i, labels: n, onChange: b } = o, g = Re(), { t: k } = Be(), [j, I] = P.useState({}), c = (f) => ($) => {
|
|
940
|
+
const N = { ...j, [f]: $.target.checked };
|
|
941
|
+
I(N), b == null || b(N);
|
|
942
|
+
}, S = (f) => {
|
|
943
|
+
const $ = [], N = /\{\{(privacyPolicyUrl|termsAndConditionsUrl)\}\}/g;
|
|
944
|
+
let F = 0, x;
|
|
945
|
+
for (; (x = N.exec(f)) !== null; ) {
|
|
946
|
+
const s = f.slice(F, x.index);
|
|
947
|
+
s && $.push(
|
|
948
|
+
/* @__PURE__ */ r.jsx(G, { component: "span", children: s }, `text-${F}`)
|
|
949
|
+
);
|
|
950
|
+
const a = x[1], D = i == null ? void 0 : i[a], H = a === "privacyPolicyUrl" ? (n == null ? void 0 : n.privacyPolicyUrlLabel) || k("leads.form.privacyPolicy") : (n == null ? void 0 : n.termsAndConditionsUrlLabel) || k("leads.form.termsAndConditions");
|
|
951
|
+
D ? $.push(
|
|
952
|
+
/* @__PURE__ */ r.jsx(
|
|
953
|
+
xe,
|
|
954
|
+
{
|
|
955
|
+
href: D,
|
|
956
|
+
target: "_blank",
|
|
957
|
+
rel: "noopener noreferrer",
|
|
958
|
+
sx: { color: t, textDecorationColor: t },
|
|
959
|
+
children: H
|
|
960
|
+
},
|
|
961
|
+
`link-${$.length}`
|
|
962
|
+
)
|
|
963
|
+
) : (console.warn(
|
|
964
|
+
`[CollectLead] Consent label contains {{${a}}} but branding.urls.${a} is not provided.`
|
|
965
|
+
), $.push(
|
|
966
|
+
/* @__PURE__ */ r.jsx(G, { component: "span", children: H }, `plain-${$.length}`)
|
|
967
|
+
)), F = N.lastIndex;
|
|
968
|
+
}
|
|
969
|
+
const p = f.slice(F);
|
|
970
|
+
return p && $.push(
|
|
971
|
+
/* @__PURE__ */ r.jsx(G, { component: "span", children: p }, "text-after")
|
|
972
|
+
), /* @__PURE__ */ r.jsx(G, { component: "span", children: $ });
|
|
973
|
+
};
|
|
974
|
+
return /* @__PURE__ */ r.jsx(He, { spacing: 1, children: e.map((f) => /* @__PURE__ */ r.jsx(
|
|
975
|
+
J,
|
|
976
|
+
{
|
|
977
|
+
disabled: l,
|
|
978
|
+
size: "sm",
|
|
979
|
+
children: /* @__PURE__ */ r.jsxs(
|
|
980
|
+
ve,
|
|
981
|
+
{
|
|
982
|
+
sx: { display: "inline-flex", alignItems: "center", gap: "8px" },
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ r.jsx(
|
|
985
|
+
eo,
|
|
986
|
+
{
|
|
987
|
+
checked: !!j[f.id],
|
|
988
|
+
onChange: c(f.id),
|
|
989
|
+
slotProps: {
|
|
990
|
+
checkbox: {
|
|
991
|
+
sx: {
|
|
992
|
+
"&.Mui-checked": {
|
|
993
|
+
bgcolor: t,
|
|
994
|
+
"--Icon-color": "#FFF"
|
|
995
|
+
},
|
|
996
|
+
"&:not(.Mui-checked):not(.Mui-disabled):hover": {
|
|
997
|
+
bgcolor: g.colorSchemes.light.palette.neutral.outlinedHoverBg
|
|
998
|
+
},
|
|
999
|
+
bgcolor: g.colorSchemes.light.palette.background.surface
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
S(f.label)
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
},
|
|
1010
|
+
`consent-${f.id}`
|
|
1011
|
+
)) });
|
|
1012
|
+
}, Ko = [
|
|
1013
|
+
"fullName",
|
|
1014
|
+
"firstName",
|
|
1015
|
+
"lastName",
|
|
1016
|
+
"email",
|
|
1017
|
+
"gender",
|
|
1018
|
+
"country",
|
|
1019
|
+
"phoneCountryCode",
|
|
1020
|
+
"phoneNumber"
|
|
1021
|
+
], ae = {
|
|
1022
|
+
phoneContainer: { display: "flex", gap: 1 },
|
|
1023
|
+
countrySelect: { width: "45%" },
|
|
1024
|
+
phoneInput: { width: "100%" },
|
|
1025
|
+
listItemContent: { fontSize: "sm" },
|
|
1026
|
+
submitButton: { mt: 2 }
|
|
1027
|
+
}, Xo = (o) => {
|
|
1028
|
+
var e, l, t, i, n, b;
|
|
1029
|
+
const [g, k] = P.useState({}), {
|
|
1030
|
+
sdk: j,
|
|
1031
|
+
brandingColors: I,
|
|
1032
|
+
brandingUrls: c,
|
|
1033
|
+
fields: S = ["fullName", "email"],
|
|
1034
|
+
campaignId: f = "",
|
|
1035
|
+
campaignName: $ = "",
|
|
1036
|
+
contentType: N = "",
|
|
1037
|
+
contentId: F = "",
|
|
1038
|
+
contentName: x = "",
|
|
1039
|
+
formCustomFields: p,
|
|
1040
|
+
onSuccessCta: s,
|
|
1041
|
+
labels: a,
|
|
1042
|
+
syncWithProfile: D = !1,
|
|
1043
|
+
isSubmittingParticipation: H = !1
|
|
1044
|
+
} = o, R = S.map((h) => h && h.trim()).filter((h) => Ko.includes(h)), {
|
|
1045
|
+
formData: v,
|
|
1046
|
+
isLoading: C,
|
|
1047
|
+
isSuccess: d,
|
|
1048
|
+
error: V,
|
|
1049
|
+
handleInputChange: m,
|
|
1050
|
+
handleCustomFieldChange: y,
|
|
1051
|
+
customFieldsData: B,
|
|
1052
|
+
handlePhoneCountryChange: E,
|
|
1053
|
+
handleCountryChange: Z,
|
|
1054
|
+
handleGenderChange: W,
|
|
1055
|
+
handleSubmit: A,
|
|
1056
|
+
countries: _
|
|
1057
|
+
} = Go({
|
|
1058
|
+
sdk: j,
|
|
1059
|
+
fields: R,
|
|
1060
|
+
campaignId: f,
|
|
1061
|
+
campaignName: $,
|
|
1062
|
+
contentType: N,
|
|
1063
|
+
contentId: F,
|
|
1064
|
+
contentName: x,
|
|
1065
|
+
syncWithProfile: D
|
|
1066
|
+
}), { shadowRootElement: ue } = Ke(Xe), { t: T } = Be(), w = Re(), U = Ze(), pe = so(), Q = Qe().primary, me = U.textPrimary, q = (I == null ? void 0 : I.primaryColor) || ((l = (e = U.palette) == null ? void 0 : e.primary) == null ? void 0 : l.plainColor), O = (i = (t = U.palette) == null ? void 0 : t.primary) == null ? void 0 : i.onPrimary, le = (I == null ? void 0 : I.primaryColor) || ((b = (n = U.palette) == null ? void 0 : n.primary) == null ? void 0 : b.primaryContainer), ne = pe.sm, u = {
|
|
1067
|
+
background: {
|
|
1068
|
+
surface: w.colorSchemes.light.palette.background.surface,
|
|
1069
|
+
popup: w.colorSchemes.light.palette.background.popup
|
|
1070
|
+
},
|
|
1071
|
+
neutral: {
|
|
1072
|
+
outlinedBorder: w.colorSchemes.light.palette.neutral.outlinedBorder,
|
|
1073
|
+
outlinedColor: w.colorSchemes.light.palette.neutral.outlinedColor,
|
|
1074
|
+
outlinedHoverBg: w.colorSchemes.light.palette.neutral.outlinedHoverBg,
|
|
1075
|
+
plainActiveBg: w.colorSchemes.light.palette.neutral.plainActiveBg,
|
|
1076
|
+
plainHoverBg: w.colorSchemes.light.palette.neutral.plainHoverBg,
|
|
1077
|
+
plainHoverColor: w.colorSchemes.light.palette.neutral.plainHoverColor
|
|
1078
|
+
}
|
|
1079
|
+
}, be = [
|
|
1080
|
+
{ value: "male", label: T("leads.form.genderOptions.male") },
|
|
1081
|
+
{ value: "female", label: T("leads.form.genderOptions.female") },
|
|
1082
|
+
{ value: "other", label: T("leads.form.genderOptions.other") },
|
|
1083
|
+
{ value: "prefer_not_to_say", label: T("leads.form.genderOptions.notSay") }
|
|
1084
|
+
], K = {
|
|
1085
|
+
color: `${me} !important`,
|
|
1086
|
+
fontSize: "0.875em"
|
|
1087
|
+
}, X = {
|
|
1088
|
+
fontFamily: Q,
|
|
1089
|
+
borderRadius: ne,
|
|
1090
|
+
bgcolor: u.background.surface,
|
|
1091
|
+
borderColor: u.neutral.outlinedBorder,
|
|
1092
|
+
color: u.neutral.outlinedColor,
|
|
1093
|
+
fontSize: "1em",
|
|
1094
|
+
lineHeight: "2.25em",
|
|
1095
|
+
"&:hover": {
|
|
1096
|
+
bgcolor: u.neutral.outlinedHoverBg
|
|
1097
|
+
},
|
|
1098
|
+
"&.Mui-disabled": {
|
|
1099
|
+
borderColor: u.neutral.outlinedBorder
|
|
1100
|
+
},
|
|
1101
|
+
"& input:-webkit-autofill": {
|
|
1102
|
+
WebkitBoxShadow: `0 0 0 1000px ${u.background.surface} inset !important`,
|
|
1103
|
+
WebkitTextFillColor: `${u.neutral.outlinedColor} !important`,
|
|
1104
|
+
caretColor: u.neutral.outlinedColor,
|
|
1105
|
+
borderRadius: ne
|
|
1106
|
+
},
|
|
1107
|
+
"& input:-webkit-autofill:hover": {
|
|
1108
|
+
WebkitBoxShadow: `0 0 0 1000px ${u.background.surface} inset !important`,
|
|
1109
|
+
WebkitTextFillColor: `${u.neutral.outlinedColor} !important`
|
|
1110
|
+
},
|
|
1111
|
+
"& input:-webkit-autofill:focus": {
|
|
1112
|
+
WebkitBoxShadow: `0 0 0 1000px ${u.background.surface} inset !important`,
|
|
1113
|
+
WebkitTextFillColor: `${u.neutral.outlinedColor} !important`
|
|
1114
|
+
},
|
|
1115
|
+
"& input:-webkit-autofill:active": {
|
|
1116
|
+
WebkitBoxShadow: `0 0 0 1000px ${u.background.surface} inset !important`,
|
|
1117
|
+
WebkitTextFillColor: `${u.neutral.outlinedColor} !important`
|
|
1118
|
+
},
|
|
1119
|
+
"& input:-moz-autofill": {
|
|
1120
|
+
backgroundColor: `${u.background.surface} !important`,
|
|
1121
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
1122
|
+
},
|
|
1123
|
+
"& input:autofill": {
|
|
1124
|
+
backgroundColor: `${u.background.surface} !important`,
|
|
1125
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
1126
|
+
}
|
|
1127
|
+
}, M = {
|
|
1128
|
+
root: {
|
|
1129
|
+
sx: {
|
|
1130
|
+
...X,
|
|
1131
|
+
"&:hover": { bgcolor: u.neutral.outlinedHoverBg }
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
listbox: {
|
|
1135
|
+
container: ue,
|
|
1136
|
+
sx: {
|
|
1137
|
+
zIndex: 10,
|
|
1138
|
+
bgcolor: u.background.popup,
|
|
1139
|
+
border: `1px solid ${u.neutral.outlinedBorder}`,
|
|
1140
|
+
borderRadius: ne,
|
|
1141
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}, Y = {
|
|
1145
|
+
fontFamily: Q,
|
|
1146
|
+
color: `${u.neutral.outlinedColor} !important`,
|
|
1147
|
+
bgcolor: "transparent",
|
|
1148
|
+
"&:hover": {
|
|
1149
|
+
bgcolor: `${u.neutral.plainHoverBg} !important`,
|
|
1150
|
+
color: `${u.neutral.plainHoverColor} !important`
|
|
1151
|
+
},
|
|
1152
|
+
"&.Mui-selected": {
|
|
1153
|
+
bgcolor: `${u.neutral.plainActiveBg} !important`,
|
|
1154
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
1155
|
+
},
|
|
1156
|
+
"&.Mui-selected:hover": {
|
|
1157
|
+
bgcolor: `${u.neutral.plainActiveBg} !important`,
|
|
1158
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
1159
|
+
}
|
|
1160
|
+
}, te = (a == null ? void 0 : a.fullNameLabel) || T("leads.form.fullName"), fe = (a == null ? void 0 : a.fullNamePlaceholder) || T("leads.form.fullNamePlaceholder"), Ce = (a == null ? void 0 : a.firstNameLabel) || T("leads.form.firstName"), ye = (a == null ? void 0 : a.firstNamePlaceholder) || T("leads.form.firstNamePlaceholder"), ke = (a == null ? void 0 : a.lastNameLabel) || T("leads.form.lastName"), Te = (a == null ? void 0 : a.lastNamePlaceholder) || T("leads.form.lastNamePlaceholder"), $e = (a == null ? void 0 : a.emailLabel) || T("leads.form.email"), Ne = (a == null ? void 0 : a.genderLabel) || T("leads.form.gender"), ze = (a == null ? void 0 : a.genderPlaceholder) || T("leads.form.genderPlaceholder"), je = (a == null ? void 0 : a.countryLabel) || T("leads.form.country"), Ie = (a == null ? void 0 : a.countryPlaceholder) || T("leads.form.countryPlaceholder"), ie = (a == null ? void 0 : a.phoneNumberLabel) || T("leads.form.phone"), ro = (a == null ? void 0 : a.phoneNumberPlaceholder) || T("leads.form.phonePlaceholder"), ao = (h) => {
|
|
1161
|
+
const L = (a == null ? void 0 : a.privacyPolicyUrlLabel) || "Privacy Policy", he = (a == null ? void 0 : a.termsAndConditionsUrlLabel) || "Terms and Conditions";
|
|
1162
|
+
return h.replace(/\{\{privacyPolicyUrl\}\}/g, L).replace(/\{\{termsAndConditionsUrl\}\}/g, he);
|
|
1163
|
+
}, lo = (h) => {
|
|
1164
|
+
k(h);
|
|
1165
|
+
}, to = async (h) => {
|
|
1166
|
+
await A(h);
|
|
1167
|
+
try {
|
|
1168
|
+
const L = (o.consents || []).filter(
|
|
1169
|
+
(he) => g[he.id]
|
|
1170
|
+
);
|
|
1171
|
+
if (L.length > 0) {
|
|
1172
|
+
const he = L.map((_e) => {
|
|
1173
|
+
const Se = {
|
|
1174
|
+
consentId: _e.id,
|
|
1175
|
+
content: ao(_e.label)
|
|
1176
|
+
};
|
|
1177
|
+
F && (Se.entityId = F);
|
|
1178
|
+
const De = uo(N);
|
|
1179
|
+
return De && (Se.entityType = De), Se;
|
|
1180
|
+
});
|
|
1181
|
+
await j.profile.collectConsents(he);
|
|
1182
|
+
}
|
|
1183
|
+
} catch (L) {
|
|
1184
|
+
console.warn("[CollectLead] Failed to collect consents", L);
|
|
1185
|
+
}
|
|
1186
|
+
}, no = () => s != null && s.component ? s.component : s != null && s.onClick ? /* @__PURE__ */ r.jsx(
|
|
1187
|
+
Pe,
|
|
1188
|
+
{
|
|
1189
|
+
size: "lg",
|
|
1190
|
+
loading: H,
|
|
1191
|
+
sx: {
|
|
1192
|
+
...ae.submitButton,
|
|
1193
|
+
bgcolor: q,
|
|
1194
|
+
color: O,
|
|
1195
|
+
":hover": {
|
|
1196
|
+
bgcolor: le,
|
|
1197
|
+
color: O
|
|
1198
|
+
},
|
|
1199
|
+
fontSize: "1em"
|
|
1200
|
+
},
|
|
1201
|
+
onClick: s.onClick,
|
|
1202
|
+
children: s.defaultLabel
|
|
1203
|
+
}
|
|
1204
|
+
) : s != null && s.url ? typeof window > "u" ? /* @__PURE__ */ r.jsx(
|
|
1205
|
+
ve,
|
|
1206
|
+
{
|
|
1207
|
+
component: "a",
|
|
1208
|
+
href: s.url,
|
|
1209
|
+
target: (s == null ? void 0 : s.target) || "_self",
|
|
1210
|
+
sx: {
|
|
1211
|
+
...ae.submitButton,
|
|
1212
|
+
bgcolor: q,
|
|
1213
|
+
color: O,
|
|
1214
|
+
":hover": {
|
|
1215
|
+
bgcolor: le,
|
|
1216
|
+
color: O
|
|
1217
|
+
},
|
|
1218
|
+
fontSize: "1em",
|
|
1219
|
+
textDecoration: "none",
|
|
1220
|
+
display: "inline-flex",
|
|
1221
|
+
alignItems: "center",
|
|
1222
|
+
justifyContent: "center"
|
|
1223
|
+
},
|
|
1224
|
+
children: s.defaultLabel
|
|
1225
|
+
}
|
|
1226
|
+
) : /* @__PURE__ */ r.jsx(
|
|
1227
|
+
Pe,
|
|
1228
|
+
{
|
|
1229
|
+
size: "lg",
|
|
1230
|
+
sx: {
|
|
1231
|
+
...ae.submitButton,
|
|
1232
|
+
bgcolor: q,
|
|
1233
|
+
color: O,
|
|
1234
|
+
":hover": {
|
|
1235
|
+
bgcolor: le,
|
|
1236
|
+
color: O
|
|
1237
|
+
},
|
|
1238
|
+
fontSize: "1em"
|
|
1239
|
+
},
|
|
1240
|
+
onClick: () => {
|
|
1241
|
+
(s == null ? void 0 : s.target) === "_blank" ? window.open(s == null ? void 0 : s.url, "_blank") : window.location.href = s == null ? void 0 : s.url;
|
|
1242
|
+
},
|
|
1243
|
+
children: s.defaultLabel
|
|
1244
|
+
}
|
|
1245
|
+
) : /* @__PURE__ */ r.jsx(r.Fragment, {});
|
|
1246
|
+
return /* @__PURE__ */ r.jsx("form", { onSubmit: to, children: /* @__PURE__ */ r.jsxs(He, { spacing: 2, sx: { fontFamily: Q }, children: [
|
|
1247
|
+
R.includes("fullName") && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1248
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: te }),
|
|
1249
|
+
/* @__PURE__ */ r.jsx(
|
|
1250
|
+
se,
|
|
1251
|
+
{
|
|
1252
|
+
value: v.fullName,
|
|
1253
|
+
onChange: m("fullName"),
|
|
1254
|
+
placeholder: fe,
|
|
1255
|
+
sx: X
|
|
1256
|
+
}
|
|
1257
|
+
)
|
|
1258
|
+
] }),
|
|
1259
|
+
R.includes("firstName") && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1260
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: Ce }),
|
|
1261
|
+
/* @__PURE__ */ r.jsx(
|
|
1262
|
+
se,
|
|
1263
|
+
{
|
|
1264
|
+
value: v.firstName,
|
|
1265
|
+
onChange: m("firstName"),
|
|
1266
|
+
placeholder: ye,
|
|
1267
|
+
sx: X
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] }),
|
|
1271
|
+
R.includes("lastName") && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1272
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: ke }),
|
|
1273
|
+
/* @__PURE__ */ r.jsx(
|
|
1274
|
+
se,
|
|
1275
|
+
{
|
|
1276
|
+
value: v.lastName,
|
|
1277
|
+
onChange: m("lastName"),
|
|
1278
|
+
placeholder: Te,
|
|
1279
|
+
sx: X
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
] }),
|
|
1283
|
+
R.includes("email") && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1284
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: $e }),
|
|
1285
|
+
/* @__PURE__ */ r.jsx(
|
|
1286
|
+
se,
|
|
1287
|
+
{
|
|
1288
|
+
type: "email",
|
|
1289
|
+
value: v.email,
|
|
1290
|
+
onChange: m("email"),
|
|
1291
|
+
placeholder: "your.email@example.com",
|
|
1292
|
+
sx: X
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] }),
|
|
1296
|
+
R.includes("gender") && /* @__PURE__ */ r.jsxs(J, { disabled: d, children: [
|
|
1297
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: Ne }),
|
|
1298
|
+
/* @__PURE__ */ r.jsx(
|
|
1299
|
+
Oe,
|
|
1300
|
+
{
|
|
1301
|
+
value: v.gender,
|
|
1302
|
+
onChange: W,
|
|
1303
|
+
placeholder: ze,
|
|
1304
|
+
slotProps: M,
|
|
1305
|
+
children: be.map((h) => /* @__PURE__ */ r.jsx(
|
|
1306
|
+
Ee,
|
|
1307
|
+
{
|
|
1308
|
+
value: h.value,
|
|
1309
|
+
sx: Y,
|
|
1310
|
+
children: h.label
|
|
1311
|
+
},
|
|
1312
|
+
h.value
|
|
1313
|
+
))
|
|
1314
|
+
}
|
|
1315
|
+
)
|
|
1316
|
+
] }),
|
|
1317
|
+
R.includes("country") && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1318
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: je }),
|
|
1319
|
+
/* @__PURE__ */ r.jsx(
|
|
1320
|
+
Oe,
|
|
1321
|
+
{
|
|
1322
|
+
value: v.country,
|
|
1323
|
+
onChange: Z,
|
|
1324
|
+
placeholder: Ie,
|
|
1325
|
+
slotProps: M,
|
|
1326
|
+
children: _.map((h) => /* @__PURE__ */ r.jsx(
|
|
1327
|
+
Ee,
|
|
1328
|
+
{
|
|
1329
|
+
value: h.code,
|
|
1330
|
+
sx: Y,
|
|
1331
|
+
children: h.label
|
|
1332
|
+
},
|
|
1333
|
+
`${h.code}-${h.label}`
|
|
1334
|
+
))
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
] }),
|
|
1338
|
+
(R.includes("phoneCountryCode") || R.includes("phoneNumber")) && /* @__PURE__ */ r.jsxs(J, { required: !0, disabled: d, children: [
|
|
1339
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: ie }),
|
|
1340
|
+
/* @__PURE__ */ r.jsxs(ve, { sx: ae.phoneContainer, children: [
|
|
1341
|
+
R.includes("phoneCountryCode") && /* @__PURE__ */ r.jsx(
|
|
1342
|
+
go,
|
|
1343
|
+
{
|
|
1344
|
+
value: v.phoneCountryCode,
|
|
1345
|
+
onChange: E,
|
|
1346
|
+
slotProps: {
|
|
1347
|
+
input: { autoComplete: "new-phone-country-code" },
|
|
1348
|
+
listbox: M.listbox,
|
|
1349
|
+
root: M.root,
|
|
1350
|
+
clearIndicator: {
|
|
1351
|
+
sx: {
|
|
1352
|
+
"&:hover": {
|
|
1353
|
+
bgcolor: u.neutral.plainHoverBg,
|
|
1354
|
+
color: u.neutral.plainHoverColor
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
popupIndicator: {
|
|
1359
|
+
sx: {
|
|
1360
|
+
"&:hover": {
|
|
1361
|
+
bgcolor: u.neutral.plainHoverBg,
|
|
1362
|
+
color: u.neutral.plainHoverColor
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
sx: ae.countrySelect,
|
|
1368
|
+
options: _,
|
|
1369
|
+
autoHighlight: !0,
|
|
1370
|
+
getOptionLabel: (h) => `+${h.phone}`,
|
|
1371
|
+
renderOption: (h, L) => /* @__PURE__ */ P.createElement(
|
|
1372
|
+
fo,
|
|
1373
|
+
{
|
|
1374
|
+
...h,
|
|
1375
|
+
key: `autocomplete-${L.code}-${L.label}`,
|
|
1376
|
+
sx: {
|
|
1377
|
+
...Y,
|
|
1378
|
+
"&[aria-selected='true']": {
|
|
1379
|
+
bgcolor: u.neutral.plainActiveBg
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
},
|
|
1383
|
+
/* @__PURE__ */ r.jsx(Co, { children: /* @__PURE__ */ r.jsx(
|
|
1384
|
+
"img",
|
|
1385
|
+
{
|
|
1386
|
+
loading: "lazy",
|
|
1387
|
+
width: "20",
|
|
1388
|
+
srcSet: `https://flagcdn.com/w40/${L.code.toLowerCase()}.png 2x`,
|
|
1389
|
+
src: `https://flagcdn.com/w20/${L.code.toLowerCase()}.png`,
|
|
1390
|
+
alt: ""
|
|
1391
|
+
}
|
|
1392
|
+
) }),
|
|
1393
|
+
/* @__PURE__ */ r.jsxs(yo, { sx: ae.listItemContent, children: [
|
|
1394
|
+
L.label,
|
|
1395
|
+
/* @__PURE__ */ r.jsxs(G, { level: "body-xs", children: [
|
|
1396
|
+
"+",
|
|
1397
|
+
L.phone
|
|
1398
|
+
] })
|
|
1399
|
+
] })
|
|
1400
|
+
)
|
|
1401
|
+
}
|
|
1402
|
+
),
|
|
1403
|
+
R.includes("phoneNumber") && /* @__PURE__ */ r.jsx(
|
|
1404
|
+
se,
|
|
1405
|
+
{
|
|
1406
|
+
value: v.phoneNumber,
|
|
1407
|
+
onChange: m("phoneNumber"),
|
|
1408
|
+
placeholder: ro,
|
|
1409
|
+
sx: {
|
|
1410
|
+
...ae.phoneInput,
|
|
1411
|
+
...X
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
)
|
|
1415
|
+
] })
|
|
1416
|
+
] }),
|
|
1417
|
+
p && p.length > 0 ? p.map((h, L) => /* @__PURE__ */ r.jsxs(
|
|
1418
|
+
J,
|
|
1419
|
+
{
|
|
1420
|
+
disabled: d,
|
|
1421
|
+
required: h.required || !1,
|
|
1422
|
+
children: [
|
|
1423
|
+
/* @__PURE__ */ r.jsx(re, { sx: K, children: h.label }),
|
|
1424
|
+
h.type === "textarea" ? /* @__PURE__ */ r.jsx(
|
|
1425
|
+
Jo,
|
|
1426
|
+
{
|
|
1427
|
+
value: B[h.key] || "",
|
|
1428
|
+
onChange: y(h.key),
|
|
1429
|
+
placeholder: h.placeholder || "",
|
|
1430
|
+
sx: X,
|
|
1431
|
+
minRows: 3
|
|
1432
|
+
}
|
|
1433
|
+
) : /* @__PURE__ */ r.jsx(
|
|
1434
|
+
se,
|
|
1435
|
+
{
|
|
1436
|
+
value: B[h.key] || "",
|
|
1437
|
+
onChange: y(h.key),
|
|
1438
|
+
placeholder: h.placeholder,
|
|
1439
|
+
sx: X
|
|
1440
|
+
}
|
|
1441
|
+
)
|
|
1442
|
+
]
|
|
1443
|
+
},
|
|
1444
|
+
`custom-field-${h.key}-${L}`
|
|
1445
|
+
)) : null,
|
|
1446
|
+
o.consents && o.consents.length > 0 ? /* @__PURE__ */ r.jsx(
|
|
1447
|
+
Qo,
|
|
1448
|
+
{
|
|
1449
|
+
consents: o.consents,
|
|
1450
|
+
isDisabled: d,
|
|
1451
|
+
primaryColor: q,
|
|
1452
|
+
brandingUrls: c,
|
|
1453
|
+
labels: a,
|
|
1454
|
+
onChange: lo
|
|
1455
|
+
}
|
|
1456
|
+
) : /* @__PURE__ */ r.jsx(
|
|
1457
|
+
Zo,
|
|
1458
|
+
{
|
|
1459
|
+
primaryColor: q,
|
|
1460
|
+
brandingUrls: c,
|
|
1461
|
+
isDisabled: d
|
|
1462
|
+
}
|
|
1463
|
+
),
|
|
1464
|
+
V && /* @__PURE__ */ r.jsx(Le, { variant: "error", message: T(V) }),
|
|
1465
|
+
d ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1466
|
+
a != null && a.successTitle || a != null && a.successDescription ? /* @__PURE__ */ r.jsx(
|
|
1467
|
+
Le,
|
|
1468
|
+
{
|
|
1469
|
+
variant: "success",
|
|
1470
|
+
title: a == null ? void 0 : a.successTitle,
|
|
1471
|
+
description: a == null ? void 0 : a.successDescription
|
|
1472
|
+
}
|
|
1473
|
+
) : /* @__PURE__ */ r.jsx(r.Fragment, {}),
|
|
1474
|
+
no()
|
|
1475
|
+
] }) : /* @__PURE__ */ r.jsx(
|
|
1476
|
+
Pe,
|
|
1477
|
+
{
|
|
1478
|
+
type: "submit",
|
|
1479
|
+
loading: C,
|
|
1480
|
+
size: "lg",
|
|
1481
|
+
sx: {
|
|
1482
|
+
...ae.submitButton,
|
|
1483
|
+
bgcolor: q,
|
|
1484
|
+
color: O,
|
|
1485
|
+
":hover": { bgcolor: le, color: O },
|
|
1486
|
+
fontSize: "0.8125em"
|
|
1487
|
+
},
|
|
1488
|
+
children: a == null ? void 0 : a.submitButtonLabel
|
|
1489
|
+
}
|
|
1490
|
+
)
|
|
1491
|
+
] }) });
|
|
1492
|
+
}, sr = ({
|
|
1493
|
+
sdk: o,
|
|
1494
|
+
content: e,
|
|
1495
|
+
campaign: l,
|
|
1496
|
+
branding: t,
|
|
1497
|
+
fields: i = ["fullName", "email"],
|
|
1498
|
+
labels: n,
|
|
1499
|
+
onSuccessCta: b,
|
|
1500
|
+
customFields: g,
|
|
1501
|
+
consents: k,
|
|
1502
|
+
syncWithProfile: j = !1,
|
|
1503
|
+
isSubmittingParticipation: I = !1
|
|
1504
|
+
}) => {
|
|
1505
|
+
var c;
|
|
1506
|
+
const S = Ze(), f = S.textColor, $ = ((c = t == null ? void 0 : t.colors) == null ? void 0 : c.secondaryColor) || S.textColor, N = Qe().primary, F = i.map((x) => x && x.trim());
|
|
1507
|
+
return /* @__PURE__ */ r.jsxs(He, { spacing: 2, zIndex: 10, width: "100%", children: [
|
|
1508
|
+
n != null && n.title || n != null && n.description ? /* @__PURE__ */ r.jsxs(ve, { children: [
|
|
1509
|
+
n != null && n.title ? /* @__PURE__ */ r.jsx(
|
|
1510
|
+
G,
|
|
1511
|
+
{
|
|
1512
|
+
level: "h4",
|
|
1513
|
+
sx: {
|
|
1514
|
+
fontFamily: N,
|
|
1515
|
+
color: f,
|
|
1516
|
+
fontSize: "1.25em"
|
|
1517
|
+
},
|
|
1518
|
+
children: n.title
|
|
1519
|
+
}
|
|
1520
|
+
) : /* @__PURE__ */ r.jsx(r.Fragment, {}),
|
|
1521
|
+
n != null && n.description ? /* @__PURE__ */ r.jsx(
|
|
1522
|
+
G,
|
|
1523
|
+
{
|
|
1524
|
+
level: "body-sm",
|
|
1525
|
+
sx: {
|
|
1526
|
+
fontFamily: N,
|
|
1527
|
+
color: $,
|
|
1528
|
+
opacity: 0.6,
|
|
1529
|
+
fontSize: "0.875em"
|
|
1530
|
+
},
|
|
1531
|
+
children: n == null ? void 0 : n.description
|
|
1532
|
+
}
|
|
1533
|
+
) : /* @__PURE__ */ r.jsx(r.Fragment, {})
|
|
1534
|
+
] }) : /* @__PURE__ */ r.jsx(r.Fragment, {}),
|
|
1535
|
+
/* @__PURE__ */ r.jsx(
|
|
1536
|
+
Xo,
|
|
1537
|
+
{
|
|
1538
|
+
sdk: o,
|
|
1539
|
+
brandingColors: t == null ? void 0 : t.colors,
|
|
1540
|
+
brandingUrls: t == null ? void 0 : t.urls,
|
|
1541
|
+
campaignId: l == null ? void 0 : l.id,
|
|
1542
|
+
campaignName: l == null ? void 0 : l.name,
|
|
1543
|
+
contentName: e == null ? void 0 : e.name,
|
|
1544
|
+
contentType: e == null ? void 0 : e.type,
|
|
1545
|
+
contentId: e == null ? void 0 : e.id,
|
|
1546
|
+
onSuccessCta: b,
|
|
1547
|
+
fields: F,
|
|
1548
|
+
labels: n,
|
|
1549
|
+
formCustomFields: g,
|
|
1550
|
+
consents: k,
|
|
1551
|
+
syncWithProfile: j,
|
|
1552
|
+
isSubmittingParticipation: I
|
|
1553
|
+
}
|
|
1554
|
+
)
|
|
1555
|
+
] });
|
|
1556
|
+
};
|
|
1557
|
+
export {
|
|
1558
|
+
eo as C,
|
|
1559
|
+
sr as p
|
|
1560
|
+
};
|