@forms.expert/sdk 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +3 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +49 -13
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +49 -13
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/index.cjs +19 -19
- package/dist/vanilla/index.cjs.map +1 -1
- package/dist/vanilla/index.d.cts +4 -0
- package/dist/vanilla/index.d.ts +4 -0
- package/dist/vanilla/index.global.js +19 -19
- package/dist/vanilla/index.global.js.map +1 -1
- package/dist/vanilla/index.js +24 -24
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +3 -0
- package/dist/vue/index.d.ts +3 -0
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -793,7 +793,34 @@ function FormsExpertForm({
|
|
|
793
793
|
const resolvedButtonText = styling.buttonText || submitText;
|
|
794
794
|
const googleFonts = ["Inter", "Roboto", "Open Sans", "Lato", "Poppins", "Montserrat", "Nunito", "Source Sans Pro", "Raleway", "Ubuntu", "Playfair Display", "Merriweather"];
|
|
795
795
|
const fontToLoad = styling.fontFamily?.split(",")[0]?.trim();
|
|
796
|
-
const
|
|
796
|
+
const hasExistingFonts = useMemo2(() => {
|
|
797
|
+
if (typeof document === "undefined") return false;
|
|
798
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
799
|
+
for (const link of links) {
|
|
800
|
+
const href = link.href || "";
|
|
801
|
+
if (href.includes("fonts.googleapis.com") || href.includes("fonts.gstatic.com") || href.includes("typekit") || href.includes("fonts.")) {
|
|
802
|
+
return true;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
try {
|
|
806
|
+
for (const sheet of document.styleSheets) {
|
|
807
|
+
try {
|
|
808
|
+
const rules = sheet.cssRules || sheet.rules;
|
|
809
|
+
if (rules) {
|
|
810
|
+
for (const rule of rules) {
|
|
811
|
+
if (rule instanceof CSSFontFaceRule) {
|
|
812
|
+
return true;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
} catch {
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
return false;
|
|
822
|
+
}, []);
|
|
823
|
+
const googleFontUrl = fontToLoad && googleFonts.includes(fontToLoad) && !hasExistingFonts ? `https://fonts.googleapis.com/css2?family=${fontToLoad.replace(/ /g, "+")}:wght@400;500;600;700&display=swap` : null;
|
|
797
824
|
const handleSubmit = async (e) => {
|
|
798
825
|
e.preventDefault();
|
|
799
826
|
const result = await form.submit(captchaToken || void 0);
|
|
@@ -996,7 +1023,7 @@ function FormsExpertForm({
|
|
|
996
1023
|
}
|
|
997
1024
|
}
|
|
998
1025
|
),
|
|
999
|
-
form.config.settings?.showFormName !== false && form.config.name && /* @__PURE__ */ jsx2("
|
|
1026
|
+
form.config.settings?.showFormName !== false && form.config.name && /* @__PURE__ */ jsx2("div", { style: {
|
|
1000
1027
|
fontSize: styling.formNameFontSize != null ? `${styling.formNameFontSize}px` : "1.5rem",
|
|
1001
1028
|
fontWeight: styling.formNameFontWeight === "normal" ? 400 : styling.formNameFontWeight === "medium" ? 500 : styling.formNameFontWeight === "semibold" ? 600 : 700,
|
|
1002
1029
|
marginBottom: "0.5rem",
|
|
@@ -1064,6 +1091,7 @@ function FormsExpertForm({
|
|
|
1064
1091
|
{
|
|
1065
1092
|
type: "submit",
|
|
1066
1093
|
disabled: form.isLoading,
|
|
1094
|
+
className: styling.buttonClassName,
|
|
1067
1095
|
style: {
|
|
1068
1096
|
...styling.buttonFullWidth ? { width: "100%" } : styling.buttonAlign ? {} : { width: "100%" },
|
|
1069
1097
|
padding: `${btnPy} ${btnPx}`,
|
|
@@ -1207,7 +1235,7 @@ function FormFieldInput({
|
|
|
1207
1235
|
style: { width: "1rem", height: "1rem", accentColor: styling.primaryColor }
|
|
1208
1236
|
}
|
|
1209
1237
|
),
|
|
1210
|
-
(field.label || field.type === "consent" && field.consentText) && /* @__PURE__ */ jsxs("label", { htmlFor: field.name, children: [
|
|
1238
|
+
(field.label || field.type === "consent" && field.consentText) && /* @__PURE__ */ jsxs("label", { htmlFor: field.name, className: styling.labelClassName, children: [
|
|
1211
1239
|
field.type === "consent" && field.consentText ? field.consentUrl ? /* @__PURE__ */ jsxs("span", { children: [
|
|
1212
1240
|
field.consentText,
|
|
1213
1241
|
" ",
|
|
@@ -1222,6 +1250,7 @@ function FormFieldInput({
|
|
|
1222
1250
|
"label",
|
|
1223
1251
|
{
|
|
1224
1252
|
htmlFor: field.name,
|
|
1253
|
+
className: styling.labelClassName,
|
|
1225
1254
|
style: {
|
|
1226
1255
|
display: "block",
|
|
1227
1256
|
fontWeight: 500,
|
|
@@ -1245,11 +1274,12 @@ function FormFieldInput({
|
|
|
1245
1274
|
onChange,
|
|
1246
1275
|
placeholder: field.placeholder,
|
|
1247
1276
|
required: field.required,
|
|
1248
|
-
style: { ...inputStyle, minHeight: "100px", resize: "vertical" }
|
|
1277
|
+
style: { ...inputStyle, minHeight: "100px", resize: "vertical" },
|
|
1278
|
+
className: styling.fieldClassName
|
|
1249
1279
|
}
|
|
1250
1280
|
);
|
|
1251
1281
|
} else if (field.type === "select" || field.type === "dropdown") {
|
|
1252
|
-
fieldEl = /* @__PURE__ */ jsxs("select", { id: field.name, name: field.name, value: String(value || ""), onChange, required: field.required, style: inputStyle, children: [
|
|
1282
|
+
fieldEl = /* @__PURE__ */ jsxs("select", { id: field.name, name: field.name, value: String(value || ""), onChange, required: field.required, style: inputStyle, className: styling.fieldClassName, children: [
|
|
1253
1283
|
/* @__PURE__ */ jsx2("option", { value: "", children: "Select an option..." }),
|
|
1254
1284
|
getOpts().map((opt) => /* @__PURE__ */ jsx2("option", { value: opt.value, children: opt.label }, opt.value))
|
|
1255
1285
|
] });
|
|
@@ -1393,7 +1423,8 @@ function FormFieldInput({
|
|
|
1393
1423
|
required: field.required,
|
|
1394
1424
|
accept: field.allowedMimeTypes?.join(","),
|
|
1395
1425
|
multiple: field.multiple,
|
|
1396
|
-
style: inputStyle
|
|
1426
|
+
style: inputStyle,
|
|
1427
|
+
className: styling.fieldClassName
|
|
1397
1428
|
}
|
|
1398
1429
|
);
|
|
1399
1430
|
} else if (field.type === "name") {
|
|
@@ -1406,7 +1437,8 @@ function FormFieldInput({
|
|
|
1406
1437
|
placeholder: labels[nf] || nf,
|
|
1407
1438
|
value: nameVal[nf] || "",
|
|
1408
1439
|
onChange: (e) => onValueChange(field.name, { ...nameVal, [nf]: e.target.value }),
|
|
1409
|
-
style: { ...inputStyle, flex: 1, minWidth: "120px" }
|
|
1440
|
+
style: { ...inputStyle, flex: 1, minWidth: "120px" },
|
|
1441
|
+
className: styling.fieldClassName
|
|
1410
1442
|
},
|
|
1411
1443
|
nf
|
|
1412
1444
|
)) });
|
|
@@ -1420,7 +1452,8 @@ function FormFieldInput({
|
|
|
1420
1452
|
placeholder: labels[af] || af,
|
|
1421
1453
|
value: addr[af] || "",
|
|
1422
1454
|
onChange: (e) => onValueChange(field.name, { ...addr, [af]: e.target.value }),
|
|
1423
|
-
style: inputStyle
|
|
1455
|
+
style: inputStyle,
|
|
1456
|
+
className: styling.fieldClassName
|
|
1424
1457
|
},
|
|
1425
1458
|
af
|
|
1426
1459
|
)) });
|
|
@@ -1439,7 +1472,8 @@ function FormFieldInput({
|
|
|
1439
1472
|
min: field.min,
|
|
1440
1473
|
max: field.max,
|
|
1441
1474
|
required: field.required,
|
|
1442
|
-
style: inputStyle
|
|
1475
|
+
style: inputStyle,
|
|
1476
|
+
className: styling.fieldClassName
|
|
1443
1477
|
}
|
|
1444
1478
|
)
|
|
1445
1479
|
] });
|
|
@@ -1462,16 +1496,17 @@ function FormFieldInput({
|
|
|
1462
1496
|
value: String(value || ""),
|
|
1463
1497
|
onChange: (e) => onValueChange(field.name, e.target.value),
|
|
1464
1498
|
placeholder: "#000000",
|
|
1465
|
-
style: { ...inputStyle, flex: 1 }
|
|
1499
|
+
style: { ...inputStyle, flex: 1 },
|
|
1500
|
+
className: styling.fieldClassName
|
|
1466
1501
|
}
|
|
1467
1502
|
)
|
|
1468
1503
|
] });
|
|
1469
1504
|
} else if (field.type === "dateRange") {
|
|
1470
1505
|
const range = value || {};
|
|
1471
1506
|
fieldEl = /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
1472
|
-
/* @__PURE__ */ jsx2("input", { type: "date", value: range.start || "", onChange: (e) => onValueChange(field.name, { ...range, start: e.target.value }), style: { ...inputStyle, flex: 1 } }),
|
|
1507
|
+
/* @__PURE__ */ jsx2("input", { type: "date", value: range.start || "", onChange: (e) => onValueChange(field.name, { ...range, start: e.target.value }), style: { ...inputStyle, flex: 1 }, className: styling.fieldClassName }),
|
|
1473
1508
|
/* @__PURE__ */ jsx2("span", { children: "to" }),
|
|
1474
|
-
/* @__PURE__ */ jsx2("input", { type: "date", value: range.end || "", onChange: (e) => onValueChange(field.name, { ...range, end: e.target.value }), style: { ...inputStyle, flex: 1 } })
|
|
1509
|
+
/* @__PURE__ */ jsx2("input", { type: "date", value: range.end || "", onChange: (e) => onValueChange(field.name, { ...range, end: e.target.value }), style: { ...inputStyle, flex: 1 }, className: styling.fieldClassName })
|
|
1475
1510
|
] });
|
|
1476
1511
|
} else {
|
|
1477
1512
|
const typeMap = {
|
|
@@ -1498,7 +1533,8 @@ function FormFieldInput({
|
|
|
1498
1533
|
max: field.max,
|
|
1499
1534
|
step: field.step,
|
|
1500
1535
|
maxLength: field.maxLength,
|
|
1501
|
-
style: inputStyle
|
|
1536
|
+
style: inputStyle,
|
|
1537
|
+
className: styling.fieldClassName
|
|
1502
1538
|
}
|
|
1503
1539
|
);
|
|
1504
1540
|
}
|