@forms.expert/sdk 0.1.12 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -529,7 +529,7 @@ function useForm(options) {
529
529
 
530
530
  // react/forms-expert-form.tsx
531
531
  import { useState as useState2, useEffect as useEffect2, useRef, useMemo as useMemo2 } from "react";
532
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
532
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
533
533
  var defaultStyling = {
534
534
  theme: "light",
535
535
  primaryColor: "#3b82f6",
@@ -981,27 +981,69 @@ function FormsExpertForm({
981
981
  )),
982
982
  form.honeypotEnabled && /* @__PURE__ */ jsx2("div", { style: { position: "absolute", left: "-9999px", opacity: 0, height: 0, overflow: "hidden" }, "aria-hidden": "true", children: /* @__PURE__ */ jsx2("input", { type: "text", name: "_hp", tabIndex: -1, autoComplete: "off" }) }),
983
983
  form.requiresCaptcha && form.captchaProvider !== "recaptcha" && /* @__PURE__ */ jsx2("div", { ref: captchaContainerRef, style: { marginTop: "1rem" } }),
984
- /* @__PURE__ */ jsx2("div", { style: { display: "flex", justifyContent: btnAlign, marginTop: "1rem" }, children: /* @__PURE__ */ jsx2(
985
- "button",
986
- {
987
- type: "submit",
988
- disabled: form.isLoading,
989
- style: {
990
- ...styling.buttonAlign ? {} : { width: "100%" },
991
- padding: "0.625rem 1.25rem",
992
- fontWeight: 500,
993
- fontSize,
994
- fontFamily: "inherit",
995
- borderRadius: btnRadius,
996
- cursor: form.isLoading ? "not-allowed" : "pointer",
997
- opacity: form.isLoading ? 0.5 : 1,
998
- background: styling.buttonStyle === "filled" ? btnBgColor : "transparent",
999
- color: styling.buttonStyle === "filled" ? btnTextColor || "white" : btnBgColor,
1000
- border: styling.buttonStyle === "filled" ? "none" : `2px solid ${btnBgColor}`
1001
- },
1002
- children: form.isLoading ? "Submitting..." : resolvedButtonText
1003
- }
1004
- ) }),
984
+ (() => {
985
+ const btnSizeMap = {
986
+ small: { px: "0.75rem", py: "0.375rem", fs: "0.875rem" },
987
+ medium: { px: "1.25rem", py: "0.625rem", fs: "1rem" },
988
+ large: { px: "1.75rem", py: "0.875rem", fs: "1.125rem" }
989
+ };
990
+ const btnSize = btnSizeMap[styling.buttonSize || "medium"];
991
+ const btnPx = styling.buttonPaddingX != null ? `${styling.buttonPaddingX}px` : btnSize.px;
992
+ const btnPy = styling.buttonPaddingY != null ? `${styling.buttonPaddingY}px` : btnSize.py;
993
+ const btnBg = styling.buttonGradient || (styling.buttonStyle === "filled" ? btnBgColor : "transparent");
994
+ const sec = styling.secondaryButton;
995
+ const secColor = sec?.color || btnBgColor;
996
+ const secStyle = sec?.enabled ? {
997
+ display: "inline-flex",
998
+ alignItems: "center",
999
+ justifyContent: "center",
1000
+ padding: `${btnPy} ${btnPx}`,
1001
+ fontWeight: 500,
1002
+ fontSize: btnSize.fs,
1003
+ fontFamily: "inherit",
1004
+ borderRadius: btnRadius,
1005
+ cursor: "pointer",
1006
+ textDecoration: sec.style === "link" ? "underline" : "none",
1007
+ background: sec.style === "filled" ? secColor : "transparent",
1008
+ color: sec.textColor || (sec.style === "filled" ? "#ffffff" : secColor),
1009
+ border: sec.style === "outlined" ? `2px solid ${secColor}` : "none",
1010
+ marginTop: sec.marginTop != null ? `${sec.marginTop}px` : void 0,
1011
+ marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0
1012
+ } : void 0;
1013
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1014
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: btnAlign, marginTop: "1rem", gap: "0.5rem", flexWrap: "wrap" }, children: [
1015
+ sec?.enabled && secStyle && sec.position === "left" && /* @__PURE__ */ jsx2("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: secStyle, children: sec.text || "Learn More" }),
1016
+ /* @__PURE__ */ jsx2(
1017
+ "button",
1018
+ {
1019
+ type: "submit",
1020
+ disabled: form.isLoading,
1021
+ style: {
1022
+ ...styling.buttonFullWidth ? { width: "100%" } : styling.buttonAlign ? {} : { width: "100%" },
1023
+ padding: `${btnPy} ${btnPx}`,
1024
+ fontWeight: 500,
1025
+ fontSize: btnSize.fs,
1026
+ fontFamily: "inherit",
1027
+ borderRadius: btnRadius,
1028
+ cursor: form.isLoading ? "not-allowed" : "pointer",
1029
+ opacity: form.isLoading ? 0.5 : 1,
1030
+ background: btnBg,
1031
+ color: styling.buttonStyle === "filled" ? btnTextColor || "white" : btnBgColor,
1032
+ border: styling.buttonStyle === "filled" ? "none" : `2px solid ${btnBgColor}`
1033
+ },
1034
+ children: form.isLoading ? "Submitting..." : resolvedButtonText
1035
+ }
1036
+ ),
1037
+ sec?.enabled && secStyle && sec.position !== "left" && sec.position !== "below" && /* @__PURE__ */ jsx2("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: secStyle, children: sec.text || "Learn More" })
1038
+ ] }),
1039
+ sec?.enabled && secStyle && sec.position === "below" && /* @__PURE__ */ jsx2("div", { style: {
1040
+ display: "flex",
1041
+ justifyContent: sec.align === "center" ? "center" : sec.align === "right" ? "flex-end" : sec.align === "left" ? "flex-start" : btnAlign,
1042
+ marginTop: sec.marginTop != null ? `${sec.marginTop}px` : "0.5rem",
1043
+ marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0
1044
+ }, children: /* @__PURE__ */ jsx2("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, marginTop: 0, marginBottom: 0 }, children: sec.text || "Learn More" }) })
1045
+ ] });
1046
+ })(),
1005
1047
  showBranding && /* @__PURE__ */ jsx2(
1006
1048
  "div",
1007
1049
  {