@forms.expert/sdk 0.2.11 → 0.2.13
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 +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +46 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +46 -2
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/index.cjs +28 -28
- package/dist/vanilla/index.cjs.map +1 -1
- package/dist/vanilla/index.d.cts +1 -0
- package/dist/vanilla/index.d.ts +1 -0
- package/dist/vanilla/index.global.js +28 -28
- package/dist/vanilla/index.global.js.map +1 -1
- package/dist/vanilla/index.js +22 -22
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -555,6 +555,22 @@ function getBorderRadius(radius) {
|
|
|
555
555
|
return "0.375rem";
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
+
function getFieldBorderRadius(radius) {
|
|
559
|
+
switch (radius) {
|
|
560
|
+
case "none":
|
|
561
|
+
return "0";
|
|
562
|
+
case "small":
|
|
563
|
+
return "0.25rem";
|
|
564
|
+
case "medium":
|
|
565
|
+
return "0.375rem";
|
|
566
|
+
case "large":
|
|
567
|
+
return "0.75rem";
|
|
568
|
+
case "full":
|
|
569
|
+
return "9999px";
|
|
570
|
+
default:
|
|
571
|
+
return "0.375rem";
|
|
572
|
+
}
|
|
573
|
+
}
|
|
558
574
|
function getButtonRadius(radius) {
|
|
559
575
|
switch (radius) {
|
|
560
576
|
case "none":
|
|
@@ -793,7 +809,34 @@ function FormsExpertForm({
|
|
|
793
809
|
const resolvedButtonText = styling.buttonText || submitText;
|
|
794
810
|
const googleFonts = ["Inter", "Roboto", "Open Sans", "Lato", "Poppins", "Montserrat", "Nunito", "Source Sans Pro", "Raleway", "Ubuntu", "Playfair Display", "Merriweather"];
|
|
795
811
|
const fontToLoad = styling.fontFamily?.split(",")[0]?.trim();
|
|
796
|
-
const
|
|
812
|
+
const hasExistingFonts = useMemo2(() => {
|
|
813
|
+
if (typeof document === "undefined") return false;
|
|
814
|
+
const links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
815
|
+
for (const link of links) {
|
|
816
|
+
const href = link.href || "";
|
|
817
|
+
if (href.includes("fonts.googleapis.com") || href.includes("fonts.gstatic.com") || href.includes("typekit") || href.includes("fonts.")) {
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
try {
|
|
822
|
+
for (const sheet of document.styleSheets) {
|
|
823
|
+
try {
|
|
824
|
+
const rules = sheet.cssRules || sheet.rules;
|
|
825
|
+
if (rules) {
|
|
826
|
+
for (const rule of rules) {
|
|
827
|
+
if (rule instanceof CSSFontFaceRule) {
|
|
828
|
+
return true;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
} catch {
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
} catch {
|
|
836
|
+
}
|
|
837
|
+
return false;
|
|
838
|
+
}, []);
|
|
839
|
+
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
840
|
const handleSubmit = async (e) => {
|
|
798
841
|
e.preventDefault();
|
|
799
842
|
const result = await form.submit(captchaToken || void 0);
|
|
@@ -1151,6 +1194,7 @@ function FormFieldInput({
|
|
|
1151
1194
|
phFontSize
|
|
1152
1195
|
}) {
|
|
1153
1196
|
const radius = getBorderRadius(styling.borderRadius);
|
|
1197
|
+
const fieldRadius = getFieldBorderRadius(styling.fieldBorderRadius);
|
|
1154
1198
|
const fontSize = getFontSize(styling.fontSize);
|
|
1155
1199
|
const isInline = styling.labelPosition === "left" || styling.fieldLayout === "inline";
|
|
1156
1200
|
const isBottomBorder = styling.fieldBorderStyle === "bottom";
|
|
@@ -1159,7 +1203,7 @@ function FormFieldInput({
|
|
|
1159
1203
|
padding: "0.5rem 0.75rem",
|
|
1160
1204
|
border: isBottomBorder ? "none" : `1px solid ${error ? "#ef4444" : styling.theme === "dark" ? "#4b5563" : "#d1d5db"}`,
|
|
1161
1205
|
...isBottomBorder ? { borderBottom: `1px solid ${error ? "#ef4444" : styling.theme === "dark" ? "#4b5563" : "#d1d5db"}` } : {},
|
|
1162
|
-
borderRadius: isBottomBorder ? 0 :
|
|
1206
|
+
borderRadius: isBottomBorder ? 0 : fieldRadius,
|
|
1163
1207
|
fontSize,
|
|
1164
1208
|
fontFamily: "inherit",
|
|
1165
1209
|
backgroundColor: styling.theme === "dark" ? "#374151" : "#ffffff",
|