@vulcantech/forms 0.2.0 → 0.4.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.
package/dist/index.js CHANGED
@@ -109,6 +109,18 @@ var DEFAULT_SPAM_PROTECTION = {
109
109
  honeypot: true,
110
110
  minSubmitTime: 3
111
111
  };
112
+ var FORM_STYLE_COLOR_KEYS = [
113
+ "formBackgroundColor",
114
+ "inputBgColor",
115
+ "inputBorderColor",
116
+ "inputFocusColor",
117
+ "inputTextColor",
118
+ "placeholderColor",
119
+ "labelColor",
120
+ "errorColor",
121
+ "buttonColor",
122
+ "buttonTextColor"
123
+ ];
112
124
  var DEFAULT_FORM_STYLE = {
113
125
  preset: "default",
114
126
  borderRadius: "md",
@@ -464,6 +476,105 @@ function getSafeRedirectUrl(raw) {
464
476
  return null;
465
477
  }
466
478
 
479
+ // src/utils/conversion.ts
480
+ var FORM_SUBMIT_SUCCESS_EVENT = "form_submit_success";
481
+ var FORM_CONVERSION_SEND_TO_GLOBAL = "__vtFormConversionSendTo";
482
+ var ENHANCED_CONVERSIONS_GLOBAL = "__vtEnhancedConversions";
483
+ function toE164(raw) {
484
+ if (typeof raw !== "string" && typeof raw !== "number") return void 0;
485
+ const digits = String(raw).replace(/\D/g, "");
486
+ if (digits.length === 10) return `+1${digits}`;
487
+ if (digits.length === 11 && digits[0] === "1") return `+${digits}`;
488
+ return void 0;
489
+ }
490
+ function buildUserData(input) {
491
+ if (!input) return void 0;
492
+ const email = typeof input.email === "string" ? input.email.trim().toLowerCase() : "";
493
+ const phone = toE164(input.phone);
494
+ if (!email && !phone) return void 0;
495
+ return __spreadValues(__spreadValues({}, email ? { email } : {}), phone ? { phone_number: phone } : {});
496
+ }
497
+ function newTransactionId() {
498
+ try {
499
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
500
+ return crypto.randomUUID();
501
+ }
502
+ } catch (e) {
503
+ }
504
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
505
+ }
506
+ function googleWindow() {
507
+ if (typeof window === "undefined") return void 0;
508
+ return window;
509
+ }
510
+ function pushFormSubmitSuccess(context) {
511
+ const win = googleWindow();
512
+ if (!win) return false;
513
+ try {
514
+ if (!Array.isArray(win.dataLayer)) {
515
+ if (win.dataLayer !== void 0) return false;
516
+ win.dataLayer = [];
517
+ }
518
+ win.dataLayer.push({
519
+ event: FORM_SUBMIT_SUCCESS_EVENT,
520
+ formId: context.formId,
521
+ formName: context.formName,
522
+ formType: context.formType
523
+ });
524
+ return true;
525
+ } catch (e) {
526
+ return false;
527
+ }
528
+ }
529
+ function fireAdsConversion(sendTo, extras = {}) {
530
+ if (typeof sendTo !== "string" || sendTo.trim() === "") return false;
531
+ const win = googleWindow();
532
+ if (!win || typeof win.gtag !== "function") return false;
533
+ try {
534
+ if (win[ENHANCED_CONVERSIONS_GLOBAL] === true) {
535
+ const userData = buildUserData(extras.userData);
536
+ if (userData) win.gtag("set", "user_data", userData);
537
+ }
538
+ win.gtag("event", "conversion", __spreadValues({
539
+ send_to: sendTo.trim()
540
+ }, extras.transactionId ? { transaction_id: extras.transactionId } : {}));
541
+ return true;
542
+ } catch (e) {
543
+ return false;
544
+ }
545
+ }
546
+ function fireGenerateLead(context) {
547
+ const win = googleWindow();
548
+ if (!win || typeof win.gtag !== "function") return false;
549
+ try {
550
+ win.gtag("event", "generate_lead", {
551
+ form_id: context.formId,
552
+ form_type: context.formType
553
+ });
554
+ return true;
555
+ } catch (e) {
556
+ return false;
557
+ }
558
+ }
559
+ function resolveConversionSendTo(formSendTo) {
560
+ var _a;
561
+ if (typeof formSendTo === "string" && formSendTo.trim() !== "") {
562
+ return formSendTo.trim();
563
+ }
564
+ const global = (_a = googleWindow()) == null ? void 0 : _a[FORM_CONVERSION_SEND_TO_GLOBAL];
565
+ if (typeof global === "string" && global.trim() !== "") return global.trim();
566
+ return void 0;
567
+ }
568
+ function trackFormConversion(context, formSendTo, extras = {}) {
569
+ const pushed = pushFormSubmitSuccess(context);
570
+ const conversionFired = fireAdsConversion(
571
+ resolveConversionSendTo(formSendTo),
572
+ extras
573
+ );
574
+ const leadFired = fireGenerateLead(context);
575
+ return { pushed, conversionFired, leadFired };
576
+ }
577
+
467
578
  // src/utils/textTransforms.ts
468
579
  function formatSsn(raw) {
469
580
  const digits = raw.replace(/\D/g, "").slice(0, 9);
@@ -612,6 +723,48 @@ function renderNotificationEmail(template, variables) {
612
723
  };
613
724
  }
614
725
 
726
+ // src/utils/resizeImage.ts
727
+ var RESIZABLE_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/webp"]);
728
+ var ENCODE_QUALITY = 0.85;
729
+ var MAX_DECODE_BYTES = 50 * 1024 * 1024;
730
+ function canResize() {
731
+ return typeof createImageBitmap === "function" && typeof document !== "undefined" && typeof document.createElement === "function";
732
+ }
733
+ function canvasToBlob(canvas, type, quality) {
734
+ return new Promise((resolve) => canvas.toBlob(resolve, type, quality));
735
+ }
736
+ function resizeImageFile(file, maxWidth) {
737
+ return __async(this, null, function* () {
738
+ if (!Number.isFinite(maxWidth) || maxWidth <= 0) return file;
739
+ if (!RESIZABLE_TYPES.has(file.type)) return file;
740
+ if (file.size > MAX_DECODE_BYTES) return file;
741
+ if (!canResize()) return file;
742
+ let bitmap;
743
+ try {
744
+ bitmap = yield createImageBitmap(file, { imageOrientation: "from-image" });
745
+ if (bitmap.width <= maxWidth) return file;
746
+ const width = Math.round(maxWidth);
747
+ const height = Math.max(1, Math.round(bitmap.height * width / bitmap.width));
748
+ const canvas = document.createElement("canvas");
749
+ canvas.width = width;
750
+ canvas.height = height;
751
+ const ctx = canvas.getContext("2d");
752
+ if (!ctx) return file;
753
+ ctx.drawImage(bitmap, 0, 0, width, height);
754
+ const blob = yield canvasToBlob(canvas, file.type, ENCODE_QUALITY);
755
+ if (!blob || blob.size >= file.size) return file;
756
+ return new File([blob], file.name, {
757
+ type: file.type,
758
+ lastModified: file.lastModified
759
+ });
760
+ } catch (e) {
761
+ return file;
762
+ } finally {
763
+ bitmap == null ? void 0 : bitmap.close();
764
+ }
765
+ });
766
+ }
767
+
615
768
  // src/crypto/sensitive.ts
616
769
  function bufferToBase64(buf) {
617
770
  const bytes = new Uint8Array(buf);
@@ -680,14 +833,161 @@ function deriveLast4(plaintext) {
680
833
  const digits = plaintext.replace(/\D/g, "");
681
834
  return digits.slice(-4).padStart(4, "\u2022");
682
835
  }
683
- var FormStyleContext = react.createContext(DEFAULT_FORM_STYLE);
684
- var useFormStyle = () => react.useContext(FormStyleContext);
685
- var FormStyleProvider = FormStyleContext.Provider;
686
- var FormPreviewOverridesContext = react.createContext(
687
- null
688
- );
689
- var useFormPreviewOverrides = () => react.useContext(FormPreviewOverridesContext);
690
- var FormPreviewOverridesProvider = FormPreviewOverridesContext.Provider;
836
+
837
+ // src/tracking/adReferral.ts
838
+ var AD_REFERRAL_COOKIE = "vt_ad_ref";
839
+ var AD_REFERRAL_TTL_DAYS = 30;
840
+ var LANDING_PAGE_MAX = 200;
841
+ function cleanLandingPage(pathname) {
842
+ if (typeof pathname !== "string" || !pathname.startsWith("/")) return void 0;
843
+ return pathname.slice(0, LANDING_PAGE_MAX);
844
+ }
845
+ var CLICK_ID_PARAMS = ["gclid", "gbraid", "wbraid"];
846
+ function isClickIdType(value) {
847
+ return CLICK_ID_PARAMS.includes(value);
848
+ }
849
+ var GOOGLE_AD_PARAMS = ["gad_source", "gad_campaignid"];
850
+ var UTM_PARAMS = [
851
+ ["utm_source", "source"],
852
+ ["utm_medium", "medium"],
853
+ ["utm_campaign", "campaign"],
854
+ ["utm_term", "term"],
855
+ ["utm_content", "content"]
856
+ ];
857
+ function captureAdReferral(search, fallback, now = /* @__PURE__ */ new Date(), pathname) {
858
+ var _a, _b, _c, _d;
859
+ const landingPage = cleanLandingPage(pathname);
860
+ const params = new URLSearchParams(search);
861
+ const utm = {};
862
+ for (const [param, key] of UTM_PARAMS) {
863
+ const value = params.get(param);
864
+ if (value) utm[key] = value;
865
+ }
866
+ let clickId;
867
+ let clickIdType;
868
+ for (const param of CLICK_ID_PARAMS) {
869
+ const value = params.get(param);
870
+ if (value) {
871
+ clickId = value;
872
+ clickIdType = param;
873
+ break;
874
+ }
875
+ }
876
+ const adCampaignId = params.get("gad_campaignid") || void 0;
877
+ const googleAdClick = clickId !== void 0 || GOOGLE_AD_PARAMS.some((p) => params.get(p));
878
+ const hasSignal = Object.keys(utm).length > 0 || googleAdClick;
879
+ if (!hasSignal) {
880
+ if (!fallback) return null;
881
+ return __spreadProps(__spreadValues({
882
+ source: fallback.source,
883
+ medium: fallback.medium,
884
+ campaign: fallback.campaign
885
+ }, landingPage ? { landingPage } : {}), {
886
+ landedAt: now.toISOString()
887
+ });
888
+ }
889
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
890
+ // An auto-tagged click with no UTMs is a Google paid click. Inferring
891
+ // this is what makes `classifySource` bucket it as "paid" rather than
892
+ // leaving the lead unattributed.
893
+ //
894
+ // Tagging that sets only `utm_campaign` (or only term/content) leaves
895
+ // BOTH of these empty, and that is deliberate: the CMS's
896
+ // `deriveLeadSource` only classifies when one of them is non-empty and
897
+ // otherwise returns undefined, so such a lead reads as "unknown". Do not
898
+ // "fix" this by defaulting to "direct" — an honest unknown beats a
899
+ // fabricated bucket, and the campaign still rides along for inspection.
900
+ source: (_a = utm.source) != null ? _a : googleAdClick ? "google" : "",
901
+ medium: (_b = utm.medium) != null ? _b : googleAdClick ? "cpc" : "",
902
+ campaign: (_d = (_c = utm.campaign) != null ? _c : adCampaignId) != null ? _d : googleAdClick ? "(not set)" : ""
903
+ }, utm.term ? { term: utm.term } : {}), utm.content ? { content: utm.content } : {}), clickId ? { clickId, clickIdType } : {}), landingPage ? { landingPage } : {}), {
904
+ landedAt: now.toISOString()
905
+ });
906
+ }
907
+ function readAdReferral(cookieName = AD_REFERRAL_COOKIE) {
908
+ if (typeof document === "undefined") return null;
909
+ for (const cookie of document.cookie.split(";")) {
910
+ const separator = cookie.indexOf("=");
911
+ if (separator === -1) continue;
912
+ if (cookie.slice(0, separator).trim() !== cookieName) continue;
913
+ try {
914
+ const parsed = JSON.parse(
915
+ decodeURIComponent(cookie.slice(separator + 1))
916
+ );
917
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
918
+ return null;
919
+ }
920
+ const _a = parsed, { source, medium, campaign, landedAt, clickIdType } = _a, rest = __objRest(_a, ["source", "medium", "campaign", "landedAt", "clickIdType"]);
921
+ if (typeof source !== "string" || typeof medium !== "string") return null;
922
+ return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
923
+ source,
924
+ medium,
925
+ campaign: typeof campaign === "string" ? campaign : ""
926
+ }), isClickIdType(clickIdType) ? { clickIdType } : {}), {
927
+ landedAt: typeof landedAt === "string" ? landedAt : ""
928
+ });
929
+ } catch (e) {
930
+ return null;
931
+ }
932
+ }
933
+ return null;
934
+ }
935
+ function isSameAdReferralTouch(a, b) {
936
+ return [...Object.keys(a), ...Object.keys(b)].every(
937
+ (key) => key === "landedAt" || a[key] === b[key]
938
+ );
939
+ }
940
+ function writeAdReferral(referral, cookieName = AD_REFERRAL_COOKIE, ttlDays = AD_REFERRAL_TTL_DAYS) {
941
+ if (typeof document === "undefined") return;
942
+ const expires = /* @__PURE__ */ new Date();
943
+ expires.setDate(expires.getDate() + ttlDays);
944
+ const value = encodeURIComponent(JSON.stringify(referral));
945
+ document.cookie = `${cookieName}=${value}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`;
946
+ }
947
+
948
+ // src/tracking/analyticsSession.ts
949
+ var ANALYTICS_SESSION_KEY = "__vt_sid";
950
+ function readAnalyticsSessionId() {
951
+ if (typeof window === "undefined") return void 0;
952
+ try {
953
+ const sid = window.sessionStorage.getItem(ANALYTICS_SESSION_KEY);
954
+ return sid && /^[a-z0-9]{6,64}$/i.test(sid) ? sid : void 0;
955
+ } catch (e) {
956
+ return void 0;
957
+ }
958
+ }
959
+
960
+ // src/utils/colorScheme.ts
961
+ function hasDarkColors(style) {
962
+ const dark = style == null ? void 0 : style.dark;
963
+ if (!dark) return false;
964
+ return FORM_STYLE_COLOR_KEYS.some((key) => Boolean(dark[key]));
965
+ }
966
+ function definitionHasDarkColors(definition) {
967
+ if (hasDarkColors(definition.style)) return true;
968
+ if (definition.defaultTextColorDark) return true;
969
+ return definition.sections.some((section) => Boolean(section.textColorDark));
970
+ }
971
+ function resolveSchemeColors(style, scheme) {
972
+ const dark = scheme === "dark" ? style.dark : void 0;
973
+ const out = {};
974
+ for (const key of FORM_STYLE_COLOR_KEYS) {
975
+ const value = (dark == null ? void 0 : dark[key]) || style[key];
976
+ if (value) out[key] = value;
977
+ }
978
+ return out;
979
+ }
980
+ function resolveSchemeStyle(style, scheme) {
981
+ const structural = __spreadValues({}, style);
982
+ delete structural.dark;
983
+ for (const key of FORM_STYLE_COLOR_KEYS) delete structural[key];
984
+ return __spreadValues(__spreadValues({}, structural), resolveSchemeColors(style, scheme));
985
+ }
986
+ function resolveSectionTextColor(section, formDefaults, scheme) {
987
+ const light = section.textColor || formDefaults.light || void 0;
988
+ if (scheme === "light") return light;
989
+ return section.textColorDark || formDefaults.dark || light;
990
+ }
691
991
 
692
992
  // src/renderer/cssVars.ts
693
993
  var FORM_CSS_VAR = {
@@ -702,6 +1002,31 @@ var FORM_CSS_VAR = {
702
1002
  buttonBg: "--form-button-bg",
703
1003
  buttonText: "--form-button-text"
704
1004
  };
1005
+ var FORM_STRUCT_VAR = {
1006
+ radius: "--form-radius",
1007
+ gap: "--form-gap",
1008
+ focusBorderWidth: "--form-focus-border-width"
1009
+ };
1010
+ var FORM_DEFAULT_RADIUS = "0.375rem";
1011
+ var FORM_RADIUS_VAR = `var(${FORM_STRUCT_VAR.radius}, ${FORM_DEFAULT_RADIUS})`;
1012
+ var FORM_GAP_VAR = `var(${FORM_STRUCT_VAR.gap}, 1rem)`;
1013
+ var FORM_DEFAULT_FOCUS_BORDER_WIDTH = "2px";
1014
+ var FORM_FOCUS_BORDER_WIDTH_VAR = `var(${FORM_STRUCT_VAR.focusBorderWidth}, ${FORM_DEFAULT_FOCUS_BORDER_WIDTH})`;
1015
+ function resolveCustomGap(style) {
1016
+ var _a;
1017
+ const raw = (_a = style.fieldGapValue) == null ? void 0 : _a.trim();
1018
+ return raw ? raw : null;
1019
+ }
1020
+ function resolveCustomRadius(style) {
1021
+ var _a;
1022
+ const raw = (_a = style.borderRadiusValue) == null ? void 0 : _a.trim();
1023
+ return raw ? raw : null;
1024
+ }
1025
+ function resolveCustomFocusBorderWidth(style) {
1026
+ var _a;
1027
+ const raw = (_a = style.inputFocusBorderWidth) == null ? void 0 : _a.trim();
1028
+ return raw ? raw : null;
1029
+ }
705
1030
  var FORM_DEFAULT_COLOR = {
706
1031
  formBg: "transparent",
707
1032
  inputBg: "inherit",
@@ -732,29 +1057,76 @@ var FORM_VAR = {
732
1057
  buttonBg: ref(FORM_CSS_VAR.buttonBg, FORM_DEFAULT_COLOR.buttonBg),
733
1058
  buttonText: ref(FORM_CSS_VAR.buttonText, FORM_DEFAULT_COLOR.buttonText)
734
1059
  };
1060
+ var COLOR_VAR_BY_KEY = {
1061
+ formBackgroundColor: FORM_CSS_VAR.formBg,
1062
+ inputBgColor: FORM_CSS_VAR.inputBg,
1063
+ inputBorderColor: FORM_CSS_VAR.inputBorder,
1064
+ inputFocusColor: FORM_CSS_VAR.inputFocusBorder,
1065
+ inputTextColor: FORM_CSS_VAR.inputText,
1066
+ placeholderColor: FORM_CSS_VAR.placeholder,
1067
+ labelColor: FORM_CSS_VAR.labelText,
1068
+ errorColor: FORM_CSS_VAR.error,
1069
+ buttonColor: FORM_CSS_VAR.buttonBg,
1070
+ buttonTextColor: FORM_CSS_VAR.buttonText
1071
+ };
1072
+ var FORM_DARK_SCOPE_ATTR = "data-vt-form-dark";
1073
+ var FORM_DARK_TEXT_ATTR = "data-vt-text-dark";
1074
+ var FORM_DARK_TEXT_VAR = "--form-text-dark";
1075
+ var FORM_DEFAULT_DARK_SELECTOR = ".dark";
1076
+ var FORM_ROOT_BG_VAR = `var(${FORM_CSS_VAR.formBg}, inherit)`;
1077
+ function darkVarName(name) {
1078
+ return `${name}-dark`;
1079
+ }
1080
+ function buildColorVars(style, scheme, keys = FORM_STYLE_COLOR_KEYS) {
1081
+ const colors = resolveSchemeColors(style, scheme);
1082
+ const out = {};
1083
+ for (const key of keys) {
1084
+ const value = colors[key];
1085
+ if (!value) continue;
1086
+ const name = COLOR_VAR_BY_KEY[key];
1087
+ out[scheme === "dark" ? darkVarName(name) : name] = value;
1088
+ }
1089
+ return out;
1090
+ }
735
1091
  function buildFormCssVars(style, previewBg) {
1092
+ var _a;
1093
+ const light = buildColorVars(style, "light");
736
1094
  const out = {};
737
- const effectiveFormBg = previewBg != null ? previewBg : style.formBackgroundColor;
738
- if (effectiveFormBg) out[FORM_CSS_VAR.formBg] = effectiveFormBg;
739
- const effectiveInputBg = previewBg != null ? previewBg : style.inputBgColor;
740
- if (effectiveInputBg) out[FORM_CSS_VAR.inputBg] = effectiveInputBg;
741
- if (style.inputBorderColor)
742
- out[FORM_CSS_VAR.inputBorder] = style.inputBorderColor;
743
- if (style.inputFocusColor)
744
- out[FORM_CSS_VAR.inputFocusBorder] = style.inputFocusColor;
745
- if (style.inputTextColor)
746
- out[FORM_CSS_VAR.inputText] = style.inputTextColor;
747
- if (style.placeholderColor)
748
- out[FORM_CSS_VAR.placeholder] = style.placeholderColor;
749
- if (style.labelColor) out[FORM_CSS_VAR.labelText] = style.labelColor;
750
- if (style.errorColor) out[FORM_CSS_VAR.error] = style.errorColor;
751
- if (style.buttonColor) out[FORM_CSS_VAR.buttonBg] = style.buttonColor;
752
- if (style.buttonTextColor)
753
- out[FORM_CSS_VAR.buttonText] = style.buttonTextColor;
1095
+ const formBg = (_a = light[FORM_CSS_VAR.formBg]) != null ? _a : previewBg;
1096
+ if (formBg) out[FORM_CSS_VAR.formBg] = formBg;
1097
+ for (const [name, value] of Object.entries(light)) {
1098
+ if (name !== FORM_CSS_VAR.formBg) out[name] = value;
1099
+ }
1100
+ const customRadius = resolveCustomRadius(style);
1101
+ if (customRadius) out[FORM_STRUCT_VAR.radius] = customRadius;
1102
+ const customGap = resolveCustomGap(style);
1103
+ if (customGap) out[FORM_STRUCT_VAR.gap] = customGap;
1104
+ const customFocusBorderWidth = resolveCustomFocusBorderWidth(style);
1105
+ if (customFocusBorderWidth)
1106
+ out[FORM_STRUCT_VAR.focusBorderWidth] = customFocusBorderWidth;
754
1107
  return out;
755
1108
  }
756
-
757
- // src/renderer/fields/useInputStyles.ts
1109
+ function buildFormDarkCssVars(style, keys) {
1110
+ return buildColorVars(style, "dark", keys);
1111
+ }
1112
+ function buildDarkSchemeCss(darkSelector = FORM_DEFAULT_DARK_SELECTOR) {
1113
+ const swaps = Object.values(FORM_CSS_VAR).map((name) => `${name}:var(${darkVarName(name)})!important`).join(";");
1114
+ const scope = `${darkSelector} [${FORM_DARK_SCOPE_ATTR}]`;
1115
+ return `${scope}{${swaps}}${scope} [${FORM_DARK_TEXT_ATTR}]{color:var(${FORM_DARK_TEXT_VAR})!important}`;
1116
+ }
1117
+ var FORM_MUTED_TEXT_CLASS = "text-current/65";
1118
+ var FORM_FAINT_TEXT_CLASS = "text-current/45";
1119
+ var FORM_SUBTLE_BORDER_CLASS = "border-current/20";
1120
+ var FORM_SUBTLE_FILL_CLASS = "bg-current/10";
1121
+ var FORM_SUBTLE_HOVER_FILL_CLASS = "hover:bg-current/10";
1122
+ var FormStyleContext = react.createContext(DEFAULT_FORM_STYLE);
1123
+ var useFormStyle = () => react.useContext(FormStyleContext);
1124
+ var FormStyleProvider = FormStyleContext.Provider;
1125
+ var FormColorSchemeContext = react.createContext({
1126
+ darkEnabled: false
1127
+ });
1128
+ var useFormColorScheme = () => react.useContext(FormColorSchemeContext);
1129
+ var FormColorSchemeProvider = FormColorSchemeContext.Provider;
758
1130
  var placeholderClass = "placeholder:[color:var(--form-placeholder,#9ca3af)]";
759
1131
  var textClass = "text-[color:var(--form-input-text,inherit)]";
760
1132
  function getVariantClasses(style) {
@@ -791,7 +1163,7 @@ function getVariantClasses(style) {
791
1163
  case "underlined":
792
1164
  return {
793
1165
  inputClass: tailwindMerge.twMerge(
794
- "rounded-none bg-transparent px-1 py-1.5 text-base transition ease-in-out placeholder:opacity-0 focus:outline-none focus:placeholder:opacity-100 disabled:cursor-not-allowed",
1166
+ "rounded-none bg-inherit px-1 py-1.5 text-base transition ease-in-out placeholder:opacity-0 focus:outline-none focus:placeholder:opacity-100 disabled:cursor-not-allowed",
795
1167
  textClass,
796
1168
  placeholderClass
797
1169
  ),
@@ -807,7 +1179,7 @@ function getVariantClasses(style) {
807
1179
  default:
808
1180
  return {
809
1181
  inputClass: tailwindMerge.twMerge(
810
- "rounded px-3 py-1.5 text-base transition ease-in-out placeholder:opacity-0 focus:outline-none focus:placeholder:opacity-100 disabled:cursor-not-allowed bg-transparent",
1182
+ "rounded px-3 py-1.5 text-base transition ease-in-out placeholder:opacity-0 focus:outline-none focus:placeholder:opacity-100 disabled:cursor-not-allowed bg-inherit",
811
1183
  textClass,
812
1184
  placeholderClass
813
1185
  ),
@@ -816,19 +1188,23 @@ function getVariantClasses(style) {
816
1188
  borderWidth: 1,
817
1189
  borderColor: FORM_VAR.inputBorder
818
1190
  },
819
- // Label must paint a solid bg on top of the input border. `bg-inherit`
820
- // doesn't work — wrapper divs between the form root and the label
821
- // have transparent bgs, so `inherit` resolves to transparent. Read
822
- // from `--form-input-bg`, which DynamicForm publishes on the form
823
- // root from the resolved input background (or the editor preview
824
- // override). The fallback matches FORM_DEFAULT_COLOR.inputBg.
1191
+ // Label must paint a solid bg on top of the input border. It reads
1192
+ // `--form-input-bg`, which DynamicForm publishes on the form root
1193
+ // from the resolved input background (or the editor preview
1194
+ // override). The fallback is `inherit`, and it now resolves to a
1195
+ // real color: every element from the form root down to this span
1196
+ // carries `bg-inherit`, so an unstyled form picks up whatever
1197
+ // background the consumer's container paints. See the chain note in
1198
+ // DynamicForm.
825
1199
  labelClass: "absolute left-2 top-2 z-10 flex min-h-[1ch] w-min -translate-y-[18px] cursor-text flex-col justify-around whitespace-nowrap rounded-md bg-[var(--form-input-bg,inherit)] px-1 text-sm transition-transform group-focus-within:-translate-y-[18px] peer-placeholder-shown:translate-y-0 peer-focus:-translate-y-[18px]"
826
1200
  };
827
1201
  }
828
1202
  }
829
1203
  function getFocusStyle(style) {
830
1204
  if (style.inputVariant === "filled" || style.inputVariant === "underlined") {
831
- return { borderBottomColor: FORM_VAR.inputFocusBorder };
1205
+ return __spreadValues({
1206
+ borderBottomColor: FORM_VAR.inputFocusBorder
1207
+ }, resolveCustomFocusBorderWidth(style) ? { borderBottomWidth: FORM_FOCUS_BORDER_WIDTH_VAR } : {});
832
1208
  }
833
1209
  if (style.inputVariant === "stacked") {
834
1210
  return {
@@ -842,13 +1218,19 @@ function useInputStyles() {
842
1218
  const style = useFormStyle();
843
1219
  const variant = getVariantClasses(style);
844
1220
  const isStacked = style.inputVariant === "stacked";
1221
+ const customRadius = resolveCustomRadius(style);
1222
+ const radiusStyle = customRadius ? { borderRadius: FORM_RADIUS_VAR } : {};
1223
+ const radiusClass = customRadius ? "rounded-none" : "";
845
1224
  return {
846
- wrapperClass: isStacked ? "flex w-full flex-col" : "group relative flex w-full flex-col pt-3",
847
- inputClass: isStacked ? tailwindMerge.twMerge("block w-full", variant.inputClass) : tailwindMerge.twMerge(
1225
+ // `bg-inherit` keeps the form root's background flowing down to the
1226
+ // inputs and floating labels, which resolve theirs with `inherit`.
1227
+ wrapperClass: isStacked ? "flex w-full flex-col bg-inherit" : "group relative flex w-full flex-col pt-3 bg-inherit",
1228
+ inputClass: isStacked ? tailwindMerge.twMerge("block w-full", variant.inputClass, radiusClass) : tailwindMerge.twMerge(
848
1229
  "peer m-0 mb-3 block min-h-8 w-full overflow-hidden",
849
- variant.inputClass
1230
+ variant.inputClass,
1231
+ radiusClass
850
1232
  ),
851
- inputStyle: variant.inputStyle,
1233
+ inputStyle: __spreadValues(__spreadValues({}, variant.inputStyle), radiusStyle),
852
1234
  inputFocusStyle: getFocusStyle(style),
853
1235
  labelClass: variant.labelClass,
854
1236
  labelStyle: { color: FORM_VAR.labelText },
@@ -857,8 +1239,9 @@ function useInputStyles() {
857
1239
  isStacked
858
1240
  };
859
1241
  }
860
- function getErrorOutlineStyle(hasError, variant) {
1242
+ function getErrorOutlineStyle(hasError, style) {
861
1243
  if (!hasError) return {};
1244
+ const variant = style.inputVariant;
862
1245
  if (variant === "stacked") {
863
1246
  return {
864
1247
  outline: `2px solid ${FORM_VAR.error}`,
@@ -872,9 +1255,9 @@ function getErrorOutlineStyle(hasError, variant) {
872
1255
  borderColor: FORM_VAR.error
873
1256
  };
874
1257
  }
875
- return {
1258
+ return __spreadValues({
876
1259
  borderBottomColor: FORM_VAR.error
877
- };
1260
+ }, resolveCustomFocusBorderWidth(style) ? { borderBottomWidth: FORM_FOCUS_BORDER_WIDTH_VAR } : {});
878
1261
  }
879
1262
  var StyledInput = ({
880
1263
  id,
@@ -892,7 +1275,7 @@ var StyledInput = ({
892
1275
  const style = useFormStyle();
893
1276
  const styles = useInputStyles();
894
1277
  const hasError = !!(error && touched);
895
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, style.inputVariant));
1278
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, style));
896
1279
  if (styles.isStacked) {
897
1280
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapperClass, children: [
898
1281
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: styles.labelClass, style: styles.labelStyle, children: label }),
@@ -918,7 +1301,7 @@ var StyledInput = ({
918
1301
  hasError && /* @__PURE__ */ jsxRuntime.jsx(
919
1302
  "span",
920
1303
  {
921
- className: tailwindMerge.twMerge("mt-1 text-xs", "text-red-600 dark:text-red-400"),
1304
+ className: "mt-1 text-xs",
922
1305
  style: styles.errorStyle,
923
1306
  children: error
924
1307
  }
@@ -926,7 +1309,7 @@ var StyledInput = ({
926
1309
  ] });
927
1310
  }
928
1311
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapperClass, children: [
929
- /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: "relative inline-block", children: [
1312
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: "relative inline-block bg-inherit", children: [
930
1313
  /* @__PURE__ */ jsxRuntime.jsx(
931
1314
  "input",
932
1315
  {
@@ -948,7 +1331,7 @@ var StyledInput = ({
948
1331
  ),
949
1332
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: label })
950
1333
  ] }),
951
- hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: error })
1334
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: error })
952
1335
  ] });
953
1336
  };
954
1337
  var TextField = ({ field: fieldDef, disabled }) => {
@@ -997,7 +1380,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
997
1380
  const formStyle = useFormStyle();
998
1381
  const styles = useInputStyles();
999
1382
  const hasError = !!(meta.error && meta.touched);
1000
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant));
1383
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
1001
1384
  const handleChange = (e) => {
1002
1385
  helpers.setValue(formatUsPhone(e.target.value));
1003
1386
  };
@@ -1034,7 +1417,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
1034
1417
  hasError && /* @__PURE__ */ jsxRuntime.jsx(
1035
1418
  "span",
1036
1419
  {
1037
- className: tailwindMerge.twMerge("mt-1 text-xs", "text-red-600 dark:text-red-400"),
1420
+ className: "mt-1 text-xs",
1038
1421
  style: styles.errorStyle,
1039
1422
  children: meta.error
1040
1423
  }
@@ -1063,7 +1446,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
1063
1446
  ),
1064
1447
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label })
1065
1448
  ] }),
1066
- hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
1449
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
1067
1450
  ] });
1068
1451
  };
1069
1452
  var UrlField = ({ field: fieldDef, disabled }) => {
@@ -1095,7 +1478,7 @@ var AddressField = ({ field: fieldDef, disabled }) => {
1095
1478
  const formStyle = useFormStyle();
1096
1479
  const styles = useInputStyles();
1097
1480
  const hasError = !!(meta.error && meta.touched);
1098
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant));
1481
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
1099
1482
  const placeholder = fieldDef.placeholder || "123 Main St, City, State 12345";
1100
1483
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles.wrapperClass} pb-5 lg:pb-0`, children: [
1101
1484
  /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block bg-inherit", children: [
@@ -1136,7 +1519,7 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
1136
1519
  const styles = useInputStyles();
1137
1520
  const hasError = !!(meta.error && meta.touched);
1138
1521
  const value = (_a = field.value) != null ? _a : "";
1139
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant));
1522
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
1140
1523
  if (styles.isStacked) {
1141
1524
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(styles.wrapperClass, "relative"), children: [
1142
1525
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1167,11 +1550,20 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
1167
1550
  }
1168
1551
  }
1169
1552
  ),
1170
- fieldDef.characterCounter && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-1 text-right text-xs text-gray-500 dark:text-zinc-400", children: value.length }),
1553
+ fieldDef.characterCounter && /* @__PURE__ */ jsxRuntime.jsx(
1554
+ "span",
1555
+ {
1556
+ className: tailwindMerge.twMerge(
1557
+ "mt-1 text-right text-xs",
1558
+ FORM_MUTED_TEXT_CLASS
1559
+ ),
1560
+ children: value.length
1561
+ }
1562
+ ),
1171
1563
  hasError && /* @__PURE__ */ jsxRuntime.jsx(
1172
1564
  "span",
1173
1565
  {
1174
- className: tailwindMerge.twMerge("mt-1 text-xs", "text-red-600 dark:text-red-400"),
1566
+ className: "mt-1 text-xs",
1175
1567
  style: styles.errorStyle,
1176
1568
  children: meta.error
1177
1569
  }
@@ -1179,7 +1571,7 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
1179
1571
  ] });
1180
1572
  }
1181
1573
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(styles.wrapperClass, "pb-5 lg:pb-0"), children: [
1182
- /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block", children: [
1574
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block bg-inherit", children: [
1183
1575
  /* @__PURE__ */ jsxRuntime.jsx(
1184
1576
  "textarea",
1185
1577
  {
@@ -1205,20 +1597,29 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
1205
1597
  hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", style: styles.errorStyle, children: meta.error })
1206
1598
  ] });
1207
1599
  };
1600
+ var POPOVER_COLOR_KEYS = [
1601
+ "inputBgColor",
1602
+ "inputBorderColor",
1603
+ "inputTextColor",
1604
+ "inputFocusColor"
1605
+ ];
1208
1606
  var SelectField = ({ field: fieldDef, disabled }) => {
1209
1607
  var _a;
1210
1608
  const [field, meta, helpers] = formik.useField(fieldDef.id);
1211
1609
  const [focused, setFocused] = react.useState(false);
1212
1610
  const formStyle = useFormStyle();
1611
+ const { darkEnabled } = useFormColorScheme();
1213
1612
  const styles = useInputStyles();
1214
1613
  const hasError = !!(meta.error && meta.touched);
1614
+ const popoverVars = __spreadValues(__spreadValues({}, buildColorVars(formStyle, "light", POPOVER_COLOR_KEYS)), darkEnabled ? buildColorVars(formStyle, "dark", POPOVER_COLOR_KEYS) : {});
1615
+ const popoverScopeAttr = darkEnabled ? { [FORM_DARK_SCOPE_ATTR]: "" } : {};
1215
1616
  const [currentValue, setCurrentValue] = react.useState(field.value || "");
1216
1617
  react.useEffect(() => {
1217
1618
  setCurrentValue(field.value || "");
1218
1619
  }, [field.value]);
1219
1620
  const options = (fieldDef.options || []).filter((opt) => opt.value !== "");
1220
1621
  const displayName = ((_a = options.find((opt) => opt.value === currentValue)) == null ? void 0 : _a.label) || "";
1221
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant));
1622
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
1222
1623
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapperClass, children: [
1223
1624
  /* @__PURE__ */ jsxRuntime.jsxs(
1224
1625
  radixUi.Select.Root,
@@ -1230,43 +1631,43 @@ var SelectField = ({ field: fieldDef, disabled }) => {
1230
1631
  },
1231
1632
  value: currentValue,
1232
1633
  children: [
1233
- /* @__PURE__ */ jsxRuntime.jsx(
1634
+ /* @__PURE__ */ jsxRuntime.jsxs(
1234
1635
  "label",
1235
1636
  {
1236
1637
  htmlFor: fieldDef.id,
1237
1638
  className: "relative block bg-inherit",
1238
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1239
- radixUi.Select.Trigger,
1240
- {
1241
- className: `${styles.inputClass} cursor-pointer text-left`,
1242
- style: borderStyle,
1243
- "aria-label": fieldDef.label,
1244
- onFocus: () => setFocused(true),
1245
- onBlur: () => {
1246
- setFocused(false);
1247
- helpers.setTouched(true);
1248
- },
1249
- children: [
1250
- /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Value, { placeholder: "Choose an option", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate", children: displayName }) }),
1251
- /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Icon, { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(bs.BsChevronDown, { style: { color: FORM_VAR.placeholder } }) }),
1252
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label })
1253
- ]
1254
- }
1255
- )
1639
+ children: [
1640
+ /* @__PURE__ */ jsxRuntime.jsxs(
1641
+ radixUi.Select.Trigger,
1642
+ {
1643
+ className: `${styles.inputClass} relative cursor-pointer text-left`,
1644
+ style: borderStyle,
1645
+ "aria-label": fieldDef.label,
1646
+ onFocus: () => setFocused(true),
1647
+ onBlur: () => {
1648
+ setFocused(false);
1649
+ helpers.setTouched(true);
1650
+ },
1651
+ children: [
1652
+ /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Value, { placeholder: "Choose an option", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate", children: displayName }) }),
1653
+ /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Icon, { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(bs.BsChevronDown, { style: { color: FORM_VAR.placeholder } }) })
1654
+ ]
1655
+ }
1656
+ ),
1657
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label })
1658
+ ]
1256
1659
  }
1257
1660
  ),
1258
1661
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1259
1662
  radixUi.Select.Content,
1260
- {
1663
+ __spreadProps(__spreadValues({
1261
1664
  className: "z-20 rounded-md border p-3 shadow-lg",
1262
- style: {
1263
- // Portal renders outside the form DOM tree, so CSS variables
1264
- // from the form wrapper don't cascade. Use resolved style
1265
- // values from the form context instead.
1266
- backgroundColor: formStyle.inputBgColor || "#ffffff",
1267
- borderColor: formStyle.inputBorderColor || "#e5e7eb",
1268
- color: formStyle.inputTextColor || "#1f2937"
1269
- },
1665
+ style: __spreadProps(__spreadValues({}, popoverVars), {
1666
+ backgroundColor: `var(${FORM_CSS_VAR.inputBg}, #ffffff)`,
1667
+ borderColor: `var(${FORM_CSS_VAR.inputBorder}, #e5e7eb)`,
1668
+ color: `var(${FORM_CSS_VAR.inputText}, #1f2937)`
1669
+ })
1670
+ }, popoverScopeAttr), {
1270
1671
  children: [
1271
1672
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ScrollUpButton, { children: /* @__PURE__ */ jsxRuntime.jsx(bs.BsChevronDown, { className: "rotate-180" }) }),
1272
1673
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Viewport, { children: /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Group, { children: options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1274,7 +1675,7 @@ var SelectField = ({ field: fieldDef, disabled }) => {
1274
1675
  {
1275
1676
  className: "relative m-1 flex cursor-pointer select-none justify-between rounded p-1 pr-8 hover:ring-1 focus:ring-1",
1276
1677
  style: {
1277
- "--tw-ring-color": formStyle.inputFocusColor || "#2563eb"
1678
+ "--tw-ring-color": `var(${FORM_CSS_VAR.inputFocusBorder}, #2563eb)`
1278
1679
  },
1279
1680
  value: opt.value,
1280
1681
  children: [
@@ -1286,7 +1687,7 @@ var SelectField = ({ field: fieldDef, disabled }) => {
1286
1687
  )) }) }),
1287
1688
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ScrollDownButton, { children: /* @__PURE__ */ jsxRuntime.jsx(bs.BsChevronDown, {}) })
1288
1689
  ]
1289
- }
1690
+ })
1290
1691
  ) })
1291
1692
  ]
1292
1693
  }
@@ -1299,11 +1700,19 @@ var CheckboxField = ({ field: fieldDef }) => {
1299
1700
  const formStyle = useFormStyle();
1300
1701
  const isChecked = field.value === true;
1301
1702
  const isStacked = formStyle.inputVariant === "stacked";
1302
- const checkboxStyle = isChecked ? { borderColor: FORM_VAR.inputFocusBorder, backgroundColor: FORM_VAR.inputFocusBorder } : { borderColor: FORM_VAR.inputBorder, backgroundColor: FORM_VAR.inputBg };
1703
+ const radiusStyle = resolveCustomRadius(formStyle) ? { borderRadius: FORM_RADIUS_VAR } : {};
1704
+ const checkboxStyle = isChecked ? __spreadProps(__spreadValues({}, radiusStyle), {
1705
+ borderColor: FORM_VAR.inputFocusBorder,
1706
+ backgroundColor: FORM_VAR.inputFocusBorder
1707
+ }) : __spreadProps(__spreadValues({}, radiusStyle), {
1708
+ borderColor: FORM_VAR.inputBorder,
1709
+ backgroundColor: FORM_VAR.inputBg
1710
+ });
1303
1711
  return /* @__PURE__ */ jsxRuntime.jsxs(
1304
1712
  "div",
1305
1713
  {
1306
1714
  className: tailwindMerge.twMerge(
1715
+ "bg-inherit",
1307
1716
  isStacked ? "flex items-start gap-3" : "flex items-center gap-3 pt-3"
1308
1717
  ),
1309
1718
  children: [
@@ -1317,8 +1726,8 @@ var CheckboxField = ({ field: fieldDef }) => {
1317
1726
  helpers.setTouched(true, false);
1318
1727
  },
1319
1728
  className: tailwindMerge.twMerge(
1320
- "flex h-5 w-5 items-center justify-center rounded border",
1321
- isStacked && "mt-0.5 shrink-0"
1729
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded border",
1730
+ isStacked && "mt-0.5"
1322
1731
  ),
1323
1732
  style: checkboxStyle,
1324
1733
  children: /* @__PURE__ */ jsxRuntime.jsx(radixUi.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(bs.BsCheck, { className: "text-white" }) })
@@ -1328,7 +1737,7 @@ var CheckboxField = ({ field: fieldDef }) => {
1328
1737
  "label",
1329
1738
  {
1330
1739
  htmlFor: fieldDef.id,
1331
- className: "cursor-pointer text-sm",
1740
+ className: "min-w-0 cursor-pointer text-sm",
1332
1741
  style: { color: FORM_VAR.labelText },
1333
1742
  children: fieldDef.label
1334
1743
  }
@@ -1340,7 +1749,7 @@ var CheckboxField = ({ field: fieldDef }) => {
1340
1749
  };
1341
1750
  var RadioField = ({ field: fieldDef, disabled }) => {
1342
1751
  const [field, meta, helpers] = formik.useField(fieldDef.id);
1343
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-3", children: [
1752
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-inherit pt-3", children: [
1344
1753
  /* @__PURE__ */ jsxRuntime.jsx(
1345
1754
  "span",
1346
1755
  {
@@ -1358,10 +1767,10 @@ var RadioField = ({ field: fieldDef, disabled }) => {
1358
1767
  helpers.setValue(value);
1359
1768
  helpers.setTouched(true, false);
1360
1769
  },
1361
- className: "flex flex-col gap-2",
1770
+ className: "flex flex-col gap-2 bg-inherit",
1362
1771
  children: (fieldDef.options || []).map((opt) => {
1363
1772
  const isSelected = field.value === opt.value;
1364
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1773
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 bg-inherit", children: [
1365
1774
  /* @__PURE__ */ jsxRuntime.jsx(
1366
1775
  radixUi.RadioGroup.Item,
1367
1776
  {
@@ -1420,13 +1829,126 @@ function nextBusinessDay(from) {
1420
1829
  while (dateFns.isWeekend(d)) d = dateFns.addDays(d, 1);
1421
1830
  return d;
1422
1831
  }
1423
- function buildDateFilter(config) {
1832
+ function timeOnDay(value, onDay) {
1833
+ const parsed = dateFns.parse(value, "HH:mm", onDay);
1834
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
1835
+ }
1836
+ function minutesOfDay(d) {
1837
+ return d.getHours() * 60 + d.getMinutes();
1838
+ }
1839
+ function minutesOfString(value) {
1840
+ const m = /^(\d{2}):(\d{2})$/.exec(value);
1841
+ if (!m) return null;
1842
+ const mins = Number(m[1]) * 60 + Number(m[2]);
1843
+ return Number.isFinite(mins) ? mins : null;
1844
+ }
1845
+ function windowOnDay(config, day) {
1846
+ const base = dateFns.set(day, { seconds: 0, milliseconds: 0 });
1847
+ const min = (config == null ? void 0 : config.minTime) ? timeOnDay(config.minTime, base) : dateFns.set(base, { hours: 0, minutes: 0 });
1848
+ const max = (config == null ? void 0 : config.maxTime) ? timeOnDay(config.maxTime, base) : dateFns.set(base, { hours: 23, minutes: 59 });
1849
+ if (!min || !max || max < min) return null;
1850
+ return { min, max };
1851
+ }
1852
+ function lastSlotOnDay(config, day) {
1853
+ var _a;
1854
+ const bounds = windowOnDay(config, day);
1855
+ if (!bounds) return null;
1856
+ const intervalMs = Math.max(1, (_a = config == null ? void 0 : config.timeIntervals) != null ? _a : 30) * 6e4;
1857
+ const steps = Math.floor(
1858
+ (bounds.max.getTime() - bounds.min.getTime()) / intervalMs
1859
+ );
1860
+ return new Date(bounds.min.getTime() + steps * intervalMs);
1861
+ }
1862
+ function rangesOnDay(config, day) {
1863
+ const ranges = config == null ? void 0 : config.excludeTimeRanges;
1864
+ if (!ranges || ranges.length === 0) return [];
1865
+ const key = dateFns.format(day, "yyyy-MM-dd");
1866
+ return ranges.filter((r) => r && r.date === key);
1867
+ }
1868
+ function isTimeExcluded(config, slot) {
1869
+ const ranges = rangesOnDay(config, slot);
1870
+ if (ranges.length === 0) return false;
1871
+ const at = minutesOfDay(slot);
1872
+ return ranges.some((r) => {
1873
+ const from = minutesOfString(r.from);
1874
+ const to = minutesOfString(r.to);
1875
+ if (from === null || to === null || to <= from) return false;
1876
+ return at >= from && at < to;
1877
+ });
1878
+ }
1879
+ function hasSelectableSlot(config, day, options = {}, now = /* @__PURE__ */ new Date()) {
1880
+ var _a, _b, _c;
1881
+ const bounds = windowOnDay(config, day);
1882
+ if (!bounds) return true;
1883
+ const filterPast = (_b = (_a = options.filterPastTimes) != null ? _a : config == null ? void 0 : config.filterPastTimes) != null ? _b : true;
1884
+ const intervalMs = Math.max(1, (_c = config == null ? void 0 : config.timeIntervals) != null ? _c : 30) * 6e4;
1885
+ const last = lastSlotOnDay(config, day);
1886
+ if (!last) return true;
1887
+ for (let t = bounds.min.getTime(); t <= last.getTime(); t += intervalMs) {
1888
+ const slot = new Date(t);
1889
+ if (filterPast && slot.getTime() < now.getTime()) continue;
1890
+ if (isTimeExcluded(config, slot)) continue;
1891
+ return true;
1892
+ }
1893
+ return false;
1894
+ }
1895
+ function isDayExcluded(config, date, now = /* @__PURE__ */ new Date()) {
1424
1896
  var _a, _b, _c, _d;
1897
+ if (((_a = config == null ? void 0 : config.excludeWeekends) != null ? _a : false) && dateFns.isWeekend(date)) return true;
1898
+ if (((_b = config == null ? void 0 : config.excludeToday) != null ? _b : false) && dateFns.isSameDay(date, now)) return true;
1899
+ if (((_c = config == null ? void 0 : config.excludeTomorrow) != null ? _c : false) && dateFns.isSameDay(date, dateFns.addDays(now, 1))) {
1900
+ return true;
1901
+ }
1902
+ if (((_d = config == null ? void 0 : config.excludeNextBusinessDay) != null ? _d : false) && dateFns.isSameDay(date, nextBusinessDay(now))) {
1903
+ return true;
1904
+ }
1905
+ const named = config == null ? void 0 : config.excludeDates;
1906
+ if (named && named.length > 0) {
1907
+ const key = dateFns.format(date, "yyyy-MM-dd");
1908
+ if (named.some((d) => d === key)) return true;
1909
+ }
1910
+ return false;
1911
+ }
1912
+ function buildTimeFilter(config, options = {}) {
1913
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1914
+ if (!((_b = (_a = options.showTimeSelect) != null ? _a : config == null ? void 0 : config.showTimeSelect) != null ? _b : true)) return void 0;
1915
+ const filterPast = (_d = (_c = options.filterPastTimes) != null ? _c : config == null ? void 0 : config.filterPastTimes) != null ? _d : true;
1916
+ const hasRanges = ((_f = (_e = config == null ? void 0 : config.excludeTimeRanges) == null ? void 0 : _e.length) != null ? _f : 0) > 0;
1917
+ const hasDayRules = ((_g = config == null ? void 0 : config.excludeWeekends) != null ? _g : false) || ((_h = config == null ? void 0 : config.excludeToday) != null ? _h : false) || ((_i = config == null ? void 0 : config.excludeTomorrow) != null ? _i : false) || ((_j = config == null ? void 0 : config.excludeNextBusinessDay) != null ? _j : false) || ((_l = (_k = config == null ? void 0 : config.excludeDates) == null ? void 0 : _k.length) != null ? _l : 0) > 0;
1918
+ if (!filterPast && !hasRanges && !hasDayRules) return void 0;
1919
+ return (time) => {
1920
+ const now = /* @__PURE__ */ new Date();
1921
+ if (filterPast && time.getTime() < now.getTime()) return false;
1922
+ if (hasDayRules && isDayExcluded(config, time, now)) return false;
1923
+ if (hasRanges && isTimeExcluded(config, time)) return false;
1924
+ return true;
1925
+ };
1926
+ }
1927
+ function firstSelectableDay(config, options = {}, from = /* @__PURE__ */ new Date(), limit = 370) {
1928
+ const filter = buildDateFilter(config, options);
1929
+ let day = new Date(from.getFullYear(), from.getMonth(), from.getDate());
1930
+ for (let i = 0; i < limit; i += 1) {
1931
+ if (!filter || filter(day)) return day;
1932
+ day = dateFns.addDays(day, 1);
1933
+ }
1934
+ return null;
1935
+ }
1936
+ function buildDateFilter(config, options = {}) {
1937
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1425
1938
  const excludeWeekends = (_a = config == null ? void 0 : config.excludeWeekends) != null ? _a : false;
1426
1939
  const excludeToday = (_b = config == null ? void 0 : config.excludeToday) != null ? _b : false;
1427
1940
  const excludeTomorrow = (_c = config == null ? void 0 : config.excludeTomorrow) != null ? _c : false;
1428
1941
  const excludeNext = (_d = config == null ? void 0 : config.excludeNextBusinessDay) != null ? _d : false;
1429
- if (!excludeWeekends && !excludeToday && !excludeTomorrow && !excludeNext) {
1942
+ const excludedDays = new Set(
1943
+ ((_e = config == null ? void 0 : config.excludeDates) != null ? _e : []).filter(
1944
+ (d) => typeof d === "string" && d.length === 10
1945
+ )
1946
+ );
1947
+ const timeSelect = (_g = (_f = options.showTimeSelect) != null ? _f : config == null ? void 0 : config.showTimeSelect) != null ? _g : true;
1948
+ const filterPast = (_i = (_h = options.filterPastTimes) != null ? _h : config == null ? void 0 : config.filterPastTimes) != null ? _i : true;
1949
+ const hasRanges = ((_k = (_j = config == null ? void 0 : config.excludeTimeRanges) == null ? void 0 : _j.length) != null ? _k : 0) > 0;
1950
+ const checkSlots = timeSelect && (filterPast || hasRanges);
1951
+ if (!excludeWeekends && !excludeToday && !excludeTomorrow && !excludeNext && !checkSlots && excludedDays.size === 0) {
1430
1952
  return void 0;
1431
1953
  }
1432
1954
  return (date) => {
@@ -1435,6 +1957,15 @@ function buildDateFilter(config) {
1435
1957
  if (excludeToday && dateFns.isSameDay(date, now)) return false;
1436
1958
  if (excludeTomorrow && dateFns.isSameDay(date, dateFns.addDays(now, 1))) return false;
1437
1959
  if (excludeNext && dateFns.isSameDay(date, nextBusinessDay(now))) return false;
1960
+ if (excludedDays.size > 0 && excludedDays.has(dateFns.format(date, "yyyy-MM-dd"))) {
1961
+ return false;
1962
+ }
1963
+ if (checkSlots) {
1964
+ const needsCheck = filterPast && dateFns.isSameDay(date, now) || hasRanges && rangesOnDay(config, date).length > 0;
1965
+ if (needsCheck && !hasSelectableSlot(config, date, options, now)) {
1966
+ return false;
1967
+ }
1968
+ }
1438
1969
  return true;
1439
1970
  };
1440
1971
  }
@@ -1458,7 +1989,7 @@ var DateTimeField = ({
1458
1989
  dateOnly = false,
1459
1990
  disabled
1460
1991
  }) => {
1461
- var _a, _b, _c, _d, _e, _f, _g, _h;
1992
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1462
1993
  const [field, meta, helpers] = formik.useField(fieldDef.id);
1463
1994
  const [focused, setFocused] = react.useState(false);
1464
1995
  const formStyle = useFormStyle();
@@ -1475,11 +2006,15 @@ var DateTimeField = ({
1475
2006
  const maxTime = showTimeSelect ? parseTimeString(config.maxTime, 23, 59) : void 0;
1476
2007
  const minDate = excludePastDates ? /* @__PURE__ */ new Date() : void 0;
1477
2008
  const selected = parseStoredValue(field.value);
1478
- const filterDate = buildDateFilter(config);
1479
- const filterTime = (time) => {
1480
- if (!filterPastTimes) return true;
1481
- return time.getTime() >= Date.now();
1482
- };
2009
+ const filterDate = buildDateFilter(config, {
2010
+ showTimeSelect,
2011
+ filterPastTimes
2012
+ });
2013
+ const filterTime = buildTimeFilter(config, {
2014
+ showTimeSelect,
2015
+ filterPastTimes
2016
+ });
2017
+ const openToDate = selected || !filterDate ? void 0 : (_i = firstSelectableDay(config, { showTimeSelect, filterPastTimes })) != null ? _i : void 0;
1483
2018
  const handleChange = (date) => {
1484
2019
  if (!date) {
1485
2020
  helpers.setValue("");
@@ -1487,11 +2022,15 @@ var DateTimeField = ({
1487
2022
  }
1488
2023
  helpers.setValue(dateOnly ? dateFns.format(date, "yyyy-MM-dd") : date.toISOString());
1489
2024
  };
1490
- const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant));
1491
- const pickerProps = {
2025
+ const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
2026
+ const pickerProps = __spreadProps(__spreadValues({
1492
2027
  id: fieldDef.id,
1493
2028
  name: fieldDef.id,
1494
2029
  wrapperClassName: "block w-full",
2030
+ // react-datepicker's stylesheet pins the popper at z-index 1, below the
2031
+ // z-10 floating labels in useInputStyles — neighboring fields' labels
2032
+ // would paint over the open calendar.
2033
+ popperClassName: "!z-50",
1495
2034
  disabled,
1496
2035
  selected,
1497
2036
  onChange: handleChange,
@@ -1502,15 +2041,16 @@ var DateTimeField = ({
1502
2041
  },
1503
2042
  showTimeSelect,
1504
2043
  timeIntervals,
1505
- minDate,
2044
+ minDate
2045
+ }, openToDate ? { openToDate } : {}), {
1506
2046
  minTime,
1507
2047
  maxTime,
1508
2048
  filterDate,
1509
- filterTime: showTimeSelect && filterPastTimes ? filterTime : void 0,
2049
+ filterTime,
1510
2050
  dateFormat,
1511
2051
  placeholderText,
1512
2052
  autoComplete: "off"
1513
- };
2053
+ });
1514
2054
  if (styles.isStacked) {
1515
2055
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.wrapperClass, children: [
1516
2056
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1537,7 +2077,7 @@ var DateTimeField = ({
1537
2077
  hasError && /* @__PURE__ */ jsxRuntime.jsx(
1538
2078
  "span",
1539
2079
  {
1540
- className: tailwindMerge.twMerge("mt-1 text-xs", "text-red-600 dark:text-red-400"),
2080
+ className: "mt-1 text-xs",
1541
2081
  style: styles.errorStyle,
1542
2082
  children: meta.error
1543
2083
  }
@@ -1575,7 +2115,7 @@ var DateTimeField = ({
1575
2115
  }
1576
2116
  )
1577
2117
  ] }),
1578
- hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
2118
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
1579
2119
  ] });
1580
2120
  };
1581
2121
  var DateField = ({ field, disabled }) => {
@@ -1601,13 +2141,12 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1601
2141
  );
1602
2142
  helpers.setValue(next);
1603
2143
  };
1604
- const borderStyle = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle.inputVariant)), {
2144
+ const borderStyle = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle)), {
1605
2145
  paddingRight: "2.75rem"
1606
2146
  });
1607
2147
  const inputType = reveal ? "text" : "password";
1608
2148
  const inputProps = {
1609
2149
  id: fieldDef.id,
1610
- name: fieldDef.id,
1611
2150
  type: inputType,
1612
2151
  disabled,
1613
2152
  autoComplete: "off",
@@ -1616,9 +2155,9 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1616
2155
  value: field.value,
1617
2156
  onChange: handleChange,
1618
2157
  onFocus: () => setFocused(true),
1619
- onBlur: (e) => {
2158
+ onBlur: () => {
1620
2159
  setFocused(false);
1621
- field.onBlur(e);
2160
+ helpers.setTouched(true);
1622
2161
  },
1623
2162
  "aria-describedby": `${fieldDef.id}-secure`,
1624
2163
  "data-sensitive": "true"
@@ -1635,7 +2174,11 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1635
2174
  {
1636
2175
  type: "button",
1637
2176
  onClick: () => setReveal((r) => !r),
1638
- className: "flex h-7 w-7 items-center justify-center rounded text-gray-600 hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 dark:text-zinc-400 dark:hover:bg-zinc-700",
2177
+ className: tailwindMerge.twMerge(
2178
+ "flex h-7 w-7 items-center justify-center rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60",
2179
+ FORM_MUTED_TEXT_CLASS,
2180
+ FORM_SUBTLE_HOVER_FILL_CLASS
2181
+ ),
1639
2182
  "aria-pressed": reveal,
1640
2183
  "aria-label": reveal ? "Hide value" : "Show value",
1641
2184
  children: reveal ? /* @__PURE__ */ jsxRuntime.jsx(fi.FiEyeOff, { size: 16, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(fi.FiEye, { size: 16, "aria-hidden": "true" })
@@ -1648,7 +2191,8 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1648
2191
  {
1649
2192
  id: `${fieldDef.id}-secure`,
1650
2193
  className: tailwindMerge.twMerge(
1651
- "flex items-center gap-1 text-xs text-gray-500 dark:text-zinc-400",
2194
+ "flex items-center gap-1 text-xs",
2195
+ FORM_MUTED_TEXT_CLASS,
1652
2196
  className
1653
2197
  ),
1654
2198
  children: [
@@ -1672,14 +2216,14 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1672
2216
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldDef.id, className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label }),
1673
2217
  renderSecureHint("mb-1")
1674
2218
  ] }),
1675
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2219
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative bg-inherit", children: [
1676
2220
  /* @__PURE__ */ jsxRuntime.jsx("input", __spreadValues({ className: styles.inputClass, style: borderStyle }, inputProps)),
1677
2221
  renderToggle()
1678
2222
  ] }),
1679
2223
  hasError && /* @__PURE__ */ jsxRuntime.jsx(
1680
2224
  "span",
1681
2225
  {
1682
- className: tailwindMerge.twMerge("mt-1 text-xs", "text-red-600 dark:text-red-400"),
2226
+ className: "mt-1 text-xs",
1683
2227
  style: styles.errorStyle,
1684
2228
  children: meta.error
1685
2229
  }
@@ -1693,9 +2237,13 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
1693
2237
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label }),
1694
2238
  renderToggle("mb-3")
1695
2239
  ] }),
1696
- hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
2240
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
1697
2241
  ] });
1698
2242
  };
2243
+ var FormFileUploadContext = react.createContext({});
2244
+ var useFormFileUpload = () => react.useContext(FormFileUploadContext);
2245
+ var FormFileUploadProvider = FormFileUploadContext.Provider;
2246
+ var NO_UPLOADER_MESSAGE = "File uploads aren't configured for this form.";
1699
2247
  function formatBytes(bytes) {
1700
2248
  if (bytes < 1024) return `${bytes} B`;
1701
2249
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
@@ -1715,21 +2263,36 @@ function matchesAccept(file, accept) {
1715
2263
  });
1716
2264
  }
1717
2265
  var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1718
- var _a, _b, _c, _d;
2266
+ var _a, _b, _c, _d, _e, _f;
1719
2267
  const [, meta, helpers] = formik.useField(fieldDef.id);
1720
2268
  const { setFieldTouched } = formik.useFormikContext();
2269
+ const { upload: contextUpload, allowObjectUrlFallback } = useFormFileUpload();
1721
2270
  const inputRef = react.useRef(null);
1722
2271
  const [uploading, setUploading] = react.useState(false);
1723
2272
  const [uploadError, setUploadError] = react.useState(null);
1724
2273
  const [files, setFiles] = react.useState([]);
2274
+ const uploader = onUpload != null ? onUpload : contextUpload;
2275
+ const uploadsUnavailable = !uploader && !allowObjectUrlFallback;
2276
+ react.useEffect(() => {
2277
+ if (!uploadsUnavailable) return;
2278
+ console.warn(
2279
+ `[forms] Field "${fieldDef.id}" is a file field but no upload path is configured. Pass onFileUpload or fileUploadRoute to <DynamicForm> (or onUpload to <FileField>) to enable it.`
2280
+ );
2281
+ }, [uploadsUnavailable, fieldDef.id]);
1725
2282
  const config = __spreadValues(__spreadValues({}, DEFAULT_FILE_FIELD_CONFIG), fieldDef.fileConfig);
1726
2283
  const maxSizeBytes = (_a = config.maxSizeBytes) != null ? _a : 10 * 1024 * 1024;
1727
2284
  const multiple = (_b = config.multiple) != null ? _b : false;
1728
2285
  const maxFiles = (_c = config.maxFiles) != null ? _c : 5;
2286
+ const resizeImages = (_d = config.resizeImages) != null ? _d : true;
2287
+ const maxImageWidth = (_e = config.maxImageWidth) != null ? _e : 1600;
1729
2288
  const handleFiles = react.useCallback(
1730
2289
  (fileList) => __async(null, null, function* () {
1731
2290
  var _a2, _b2;
1732
2291
  if (!fileList || fileList.length === 0) return;
2292
+ if (uploadsUnavailable) {
2293
+ setUploadError(NO_UPLOADER_MESSAGE);
2294
+ return;
2295
+ }
1733
2296
  setUploadError(null);
1734
2297
  const toUpload = Array.from(fileList);
1735
2298
  if (multiple && files.length + toUpload.length > maxFiles) {
@@ -1742,24 +2305,20 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1742
2305
  setUploadError(`"${file.name}" is not an accepted file type.`);
1743
2306
  continue;
1744
2307
  }
1745
- if (file.size > maxSizeBytes) {
1746
- setUploadError(
1747
- `"${file.name}" exceeds ${formatBytes(maxSizeBytes)} limit.`
1748
- );
1749
- continue;
1750
- }
1751
2308
  setUploading(true);
1752
2309
  try {
1753
- let result;
1754
- if (onUpload) {
1755
- result = yield onUpload(file, config);
1756
- } else {
1757
- result = {
1758
- url: URL.createObjectURL(file),
1759
- name: file.name,
1760
- size: file.size
1761
- };
2310
+ const prepared = resizeImages ? yield resizeImageFile(file, maxImageWidth) : file;
2311
+ if (prepared.size > maxSizeBytes) {
2312
+ setUploadError(
2313
+ `"${file.name}" exceeds ${formatBytes(maxSizeBytes)} limit.`
2314
+ );
2315
+ continue;
1762
2316
  }
2317
+ const result = uploader ? yield uploader(prepared, config) : {
2318
+ url: URL.createObjectURL(prepared),
2319
+ name: prepared.name,
2320
+ size: prepared.size
2321
+ };
1763
2322
  current = multiple ? [...current, result] : [result];
1764
2323
  } catch (err) {
1765
2324
  setUploadError(`Upload failed: ${err.message}`);
@@ -1778,8 +2337,11 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1778
2337
  multiple,
1779
2338
  maxFiles,
1780
2339
  maxSizeBytes,
2340
+ resizeImages,
2341
+ maxImageWidth,
1781
2342
  config,
1782
- onUpload,
2343
+ uploader,
2344
+ uploadsUnavailable,
1783
2345
  helpers,
1784
2346
  fieldDef.id,
1785
2347
  setFieldTouched
@@ -1794,7 +2356,8 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1794
2356
  [files, multiple, helpers]
1795
2357
  );
1796
2358
  const hasError = meta.touched && meta.error;
1797
- const isRequired = (_d = fieldDef.validation) == null ? void 0 : _d.some((v) => v.type === "required");
2359
+ const isRequired = (_f = fieldDef.validation) == null ? void 0 : _f.some((v) => v.type === "required");
2360
+ const pickerDisabled = disabled || uploadsUnavailable;
1798
2361
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1799
2362
  /* @__PURE__ */ jsxRuntime.jsxs(
1800
2363
  "label",
@@ -1812,19 +2375,21 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1812
2375
  "p",
1813
2376
  {
1814
2377
  className: "mb-2 text-xs",
1815
- style: { color: "var(--form-placeholder-color, #9ca3af)" },
2378
+ style: { color: FORM_VAR.placeholder },
1816
2379
  children: fieldDef.helpText
1817
2380
  }
1818
2381
  ),
1819
2382
  /* @__PURE__ */ jsxRuntime.jsxs(
1820
2383
  "div",
1821
2384
  {
1822
- className: `relative rounded-lg border-2 border-dashed p-6 text-center transition-colors ${hasError ? "border-red-400" : "border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"}`,
2385
+ className: `relative rounded-lg border-2 border-dashed p-6 text-center transition-colors ${hasError ? "border-red-400" : pickerDisabled ? "border-current/10" : "border-current/25 hover:border-current/40"}`,
1823
2386
  onDragOver: (e) => {
2387
+ if (pickerDisabled) return;
1824
2388
  e.preventDefault();
1825
2389
  e.stopPropagation();
1826
2390
  },
1827
2391
  onDrop: (e) => {
2392
+ if (pickerDisabled) return;
1828
2393
  e.preventDefault();
1829
2394
  e.stopPropagation();
1830
2395
  handleFiles(e.dataTransfer.files);
@@ -1838,7 +2403,7 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1838
2403
  type: "file",
1839
2404
  accept: config.accept,
1840
2405
  multiple,
1841
- disabled,
2406
+ disabled: pickerDisabled,
1842
2407
  onChange: (e) => {
1843
2408
  handleFiles(e.target.files);
1844
2409
  e.target.value = "";
@@ -1847,9 +2412,15 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1847
2412
  }
1848
2413
  ),
1849
2414
  uploading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1850
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-1/3 animate-pulse rounded-full bg-indigo-500" }) }),
1851
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500", children: "Uploading\u2026" })
1852
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
2415
+ /* @__PURE__ */ jsxRuntime.jsx(
2416
+ "div",
2417
+ {
2418
+ className: `mx-auto h-1.5 w-32 overflow-hidden rounded-full ${FORM_SUBTLE_FILL_CLASS}`,
2419
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-1/3 animate-pulse rounded-full bg-indigo-500" })
2420
+ }
2421
+ ),
2422
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-sm ${FORM_MUTED_TEXT_CLASS}`, children: "Uploading\u2026" })
2423
+ ] }) : uploadsUnavailable ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-sm ${FORM_MUTED_TEXT_CLASS}`, children: NO_UPLOADER_MESSAGE }) : /* @__PURE__ */ jsxRuntime.jsxs(
1853
2424
  "button",
1854
2425
  {
1855
2426
  type: "button",
@@ -1858,12 +2429,12 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1858
2429
  return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
1859
2430
  },
1860
2431
  disabled,
1861
- className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:text-gray-200",
2432
+ className: `cursor-pointer text-sm ${FORM_MUTED_TEXT_CLASS} hover:text-current disabled:cursor-not-allowed disabled:opacity-50`,
1862
2433
  children: [
1863
2434
  /* @__PURE__ */ jsxRuntime.jsx(
1864
2435
  "svg",
1865
2436
  {
1866
- className: "mx-auto mb-2 h-8 w-8 text-gray-400",
2437
+ className: `mx-auto mb-2 h-8 w-8 ${FORM_FAINT_TEXT_CLASS}`,
1867
2438
  fill: "none",
1868
2439
  viewBox: "0 0 24 24",
1869
2440
  strokeWidth: 1.5,
@@ -1881,7 +2452,7 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1881
2452
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Click to upload" }),
1882
2453
  " or drag and drop",
1883
2454
  /* @__PURE__ */ jsxRuntime.jsx("br", {}),
1884
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-gray-400", children: [
2455
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `text-xs ${FORM_FAINT_TEXT_CLASS}`, children: [
1885
2456
  "Max ",
1886
2457
  formatBytes(maxSizeBytes),
1887
2458
  multiple && ` \xB7 Up to ${maxFiles} files`
@@ -1895,7 +2466,7 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1895
2466
  files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 space-y-2", children: files.map((f, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1896
2467
  "div",
1897
2468
  {
1898
- className: "flex items-center gap-3 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 dark:border-gray-700 dark:bg-gray-800",
2469
+ className: `flex items-center gap-3 rounded-md border ${FORM_SUBTLE_BORDER_CLASS} ${FORM_SUBTLE_FILL_CLASS} px-3 py-2`,
1899
2470
  children: [
1900
2471
  f.url && f.name.match(/\.(jpg|jpeg|png|webp|gif|svg)$/i) && // eslint-disable-next-line @next/next/no-img-element
1901
2472
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1907,15 +2478,15 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
1907
2478
  }
1908
2479
  ),
1909
2480
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
1910
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium text-gray-900 dark:text-gray-100", children: f.name }),
1911
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500", children: formatBytes(f.size) })
2481
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium", children: f.name }),
2482
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-xs ${FORM_MUTED_TEXT_CLASS}`, children: formatBytes(f.size) })
1912
2483
  ] }),
1913
2484
  /* @__PURE__ */ jsxRuntime.jsx(
1914
2485
  "button",
1915
2486
  {
1916
2487
  type: "button",
1917
2488
  onClick: () => removeFile(i),
1918
- className: "cursor-pointer text-gray-400 hover:text-red-500",
2489
+ className: `cursor-pointer ${FORM_FAINT_TEXT_CLASS} hover:text-red-500`,
1919
2490
  "aria-label": `Remove ${f.name}`,
1920
2491
  children: /* @__PURE__ */ jsxRuntime.jsx(
1921
2492
  "svg",
@@ -1960,6 +2531,8 @@ var fieldComponents = {
1960
2531
  datetime: DateTimeField,
1961
2532
  hidden: HiddenField,
1962
2533
  sensitive: SensitiveField,
2534
+ // Its `onUpload`/`projectId` props are optional and normally arrive by
2535
+ // context (see FileUploadContext), so it fits the shared signature.
1963
2536
  file: FileField
1964
2537
  };
1965
2538
  var DynamicFormField = ({ field, mirrored, mirrorBehavior }) => {
@@ -1991,12 +2564,13 @@ var DynamicFormField = ({ field, mirrored, mirrorBehavior }) => {
1991
2564
  };
1992
2565
  const widthClass = widthClasses[((_a = field.layout) == null ? void 0 : _a.width) || "full"] || "md:col-span-6";
1993
2566
  const description = (_b = field.description) != null ? _b : field.helpText;
1994
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: widthClass, children: [
2567
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(widthClass, "bg-inherit"), children: [
1995
2568
  /* @__PURE__ */ jsxRuntime.jsx(Component, { field, disabled: locked }),
1996
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("mt-1 text-xs", "text-gray-500 dark:text-zinc-400"), children: description })
2569
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("mt-1 text-xs", FORM_MUTED_TEXT_CLASS), children: description })
1997
2570
  ] });
1998
2571
  };
1999
2572
  var spacingGap = {
2573
+ none: "gap-4",
2000
2574
  compact: "gap-2",
2001
2575
  normal: "gap-4",
2002
2576
  relaxed: "gap-6"
@@ -2005,12 +2579,12 @@ var DynamicFormSection = ({
2005
2579
  section,
2006
2580
  isLast,
2007
2581
  formDefaultTextColor,
2582
+ formDefaultTextColorDark,
2008
2583
  inlineSubmit
2009
2584
  }) => {
2010
- var _a, _b;
2585
+ var _a;
2011
2586
  const style = useFormStyle();
2012
- const previewOverrides = useFormPreviewOverrides();
2013
- const previewTextColor = previewOverrides == null ? void 0 : previewOverrides.textColor;
2587
+ const { forced, darkEnabled } = useFormColorScheme();
2014
2588
  const { values, setFieldValue } = formik.useFormikContext();
2015
2589
  const sameAs = section.sameAs;
2016
2590
  const toggleKey = sameAs ? sameAsToggleKey(section.id) : "";
@@ -2029,35 +2603,44 @@ var DynamicFormSection = ({
2029
2603
  setFieldValue(targetId, (_a2 = values[sourceId]) != null ? _a2 : "");
2030
2604
  }
2031
2605
  }, [toggleOn, sourceSignature]);
2032
- const effectiveTextColor = (_b = previewTextColor != null ? previewTextColor : section.textColor) != null ? _b : formDefaultTextColor;
2606
+ const formDefaults = {
2607
+ light: formDefaultTextColor,
2608
+ dark: formDefaultTextColorDark
2609
+ };
2610
+ const effectiveTextColor = resolveSectionTextColor(
2611
+ section,
2612
+ formDefaults,
2613
+ forced != null ? forced : "light"
2614
+ );
2615
+ const darkTextColor = darkEnabled && (section.textColorDark || formDefaultTextColorDark) ? resolveSectionTextColor(section, formDefaults, "dark") : void 0;
2033
2616
  const sortedFields = [...section.fields].sort(
2034
2617
  (a, b) => {
2035
- var _a2, _b2, _c, _d;
2036
- return ((_b2 = (_a2 = a.layout) == null ? void 0 : _a2.order) != null ? _b2 : 0) - ((_d = (_c = b.layout) == null ? void 0 : _c.order) != null ? _d : 0);
2618
+ var _a2, _b, _c, _d;
2619
+ return ((_b = (_a2 = a.layout) == null ? void 0 : _a2.order) != null ? _b : 0) - ((_d = (_c = b.layout) == null ? void 0 : _c.order) != null ? _d : 0);
2037
2620
  }
2038
2621
  );
2039
- const gap = spacingGap[style.spacing || "normal"];
2622
+ const customGap = resolveCustomGap(style);
2623
+ const gap = customGap ? "gap-0" : spacingGap[style.spacing || "normal"];
2624
+ const gapStyle = customGap ? { gap: FORM_GAP_VAR } : {};
2040
2625
  const divider = style.sectionDividers && !isLast;
2041
2626
  const isStacked = style.inputVariant === "stacked";
2042
2627
  const sectionWrapperClass = tailwindMerge.twMerge(
2628
+ "bg-inherit",
2043
2629
  isStacked ? "space-y-4" : "mb-6",
2044
- divider && "border-b border-gray-200 dark:border-zinc-700 pb-6"
2045
- );
2046
- const titleClass = tailwindMerge.twMerge(
2047
- "text-lg font-semibold",
2048
- effectiveTextColor ? "" : "text-gray-800 dark:text-zinc-100",
2049
- !isStacked && "mb-1"
2630
+ divider && `border-b ${FORM_SUBTLE_BORDER_CLASS} pb-6`
2050
2631
  );
2632
+ const titleClass = tailwindMerge.twMerge("text-lg font-semibold", !isStacked && "mb-1");
2051
2633
  const descriptionClass = tailwindMerge.twMerge(
2052
2634
  "text-sm",
2053
- effectiveTextColor ? "" : "text-gray-500 dark:text-zinc-400",
2635
+ effectiveTextColor ? "" : FORM_MUTED_TEXT_CLASS,
2054
2636
  !isStacked && "mb-4"
2055
2637
  );
2056
- const textStyle = effectiveTextColor ? { color: effectiveTextColor } : void 0;
2638
+ const textStyle = effectiveTextColor || darkTextColor ? __spreadValues(__spreadValues({}, effectiveTextColor ? { color: effectiveTextColor } : {}), darkTextColor ? { [FORM_DARK_TEXT_VAR]: darkTextColor } : {}) : void 0;
2639
+ const darkTextAttr = darkTextColor ? { [FORM_DARK_TEXT_ATTR]: "" } : {};
2057
2640
  return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: sectionWrapperClass, children: [
2058
- section.title && /* @__PURE__ */ jsxRuntime.jsx("legend", { className: titleClass, style: textStyle, children: section.title }),
2059
- section.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: descriptionClass, style: textStyle, children: section.description }),
2060
- sameAs && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 flex items-center gap-3", children: [
2641
+ section.title && /* @__PURE__ */ jsxRuntime.jsx("legend", __spreadProps(__spreadValues({ className: titleClass, style: textStyle }, darkTextAttr), { children: section.title })),
2642
+ section.description && /* @__PURE__ */ jsxRuntime.jsx("p", __spreadProps(__spreadValues({ className: descriptionClass, style: textStyle }, darkTextAttr), { children: section.description })),
2643
+ sameAs && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 flex items-center gap-3 bg-inherit", children: [
2061
2644
  /* @__PURE__ */ jsxRuntime.jsx(
2062
2645
  radixUi.Checkbox.Root,
2063
2646
  {
@@ -2084,10 +2667,11 @@ var DynamicFormSection = ({
2084
2667
  "div",
2085
2668
  {
2086
2669
  className: tailwindMerge.twMerge(
2087
- "grid grid-cols-1 md:grid-cols-6",
2670
+ "grid grid-cols-1 bg-inherit md:grid-cols-6",
2088
2671
  gap,
2089
2672
  inlineSubmit && "min-w-0 flex-auto"
2090
2673
  ),
2674
+ style: gapStyle,
2091
2675
  children: sortedFields.map((field, i) => /* @__PURE__ */ jsxRuntime.jsx(
2092
2676
  DynamicFormField,
2093
2677
  {
@@ -2099,17 +2683,108 @@ var DynamicFormSection = ({
2099
2683
  ))
2100
2684
  }
2101
2685
  );
2102
- return inlineSubmit ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
2686
+ return inlineSubmit ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 bg-inherit", children: [
2103
2687
  fieldsGrid,
2104
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex-none", !isStacked && "pt-3"), children: inlineSubmit })
2688
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex-none bg-inherit", !isStacked && "pt-3"), children: inlineSubmit })
2105
2689
  ] }) : fieldsGrid;
2106
2690
  })()
2107
2691
  ] });
2108
2692
  };
2693
+ var COOLDOWN_MS = 2e3;
2694
+ function useSuccessFeedback(isSuccess) {
2695
+ const bannerRef = react.useRef(null);
2696
+ const [cooldown, setCooldown] = react.useState(false);
2697
+ const [submittedSnapshot, setSubmittedSnapshot] = react.useState(null);
2698
+ react.useEffect(() => {
2699
+ if (!isSuccess) return;
2700
+ setCooldown(true);
2701
+ const timer = setTimeout(() => setCooldown(false), COOLDOWN_MS);
2702
+ const node = bannerRef.current;
2703
+ if (node && typeof node.scrollIntoView === "function") {
2704
+ const reduceMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2705
+ node.scrollIntoView({
2706
+ behavior: reduceMotion ? "auto" : "smooth",
2707
+ block: "center"
2708
+ });
2709
+ }
2710
+ return () => clearTimeout(timer);
2711
+ }, [isSuccess]);
2712
+ return {
2713
+ bannerRef,
2714
+ cooldown,
2715
+ submittedSnapshot,
2716
+ markSubmitted: (values) => setSubmittedSnapshot(JSON.stringify(values)),
2717
+ clearSubmitted: () => setSubmittedSnapshot(null)
2718
+ };
2719
+ }
2720
+ function ValuesObserver({ onChange }) {
2721
+ const { values } = formik.useFormikContext();
2722
+ const mounted = react.useRef(false);
2723
+ react.useEffect(() => {
2724
+ if (!mounted.current) {
2725
+ mounted.current = true;
2726
+ return;
2727
+ }
2728
+ onChange(values);
2729
+ }, [values, onChange]);
2730
+ return null;
2731
+ }
2109
2732
  function globalTracker() {
2110
2733
  if (typeof window === "undefined") return void 0;
2111
2734
  return window.__vtTrack;
2112
2735
  }
2736
+ function createRouteFileUploader(route, formId) {
2737
+ return (file) => __async(null, null, function* () {
2738
+ const body = new FormData();
2739
+ body.append("file", file);
2740
+ body.append("formId", formId);
2741
+ const res = yield fetch(route, { method: "POST", body });
2742
+ if (!res.ok) {
2743
+ const errBody = yield res.json().catch(() => null);
2744
+ throw new Error((errBody == null ? void 0 : errBody.error) || `Upload failed (${res.status})`);
2745
+ }
2746
+ const data = yield res.json().catch(() => null);
2747
+ if (!data || typeof data.url !== "string" || data.url.length === 0) {
2748
+ throw new Error("Upload route did not return a url");
2749
+ }
2750
+ if (isUnresolvedUploadUrl(data.url)) {
2751
+ throw new Error("Upload route returned a temporary, non-durable url");
2752
+ }
2753
+ return {
2754
+ url: data.url,
2755
+ name: typeof data.name === "string" ? data.name : file.name,
2756
+ size: typeof data.size === "number" ? data.size : file.size
2757
+ };
2758
+ });
2759
+ }
2760
+ function isUnresolvedUploadUrl(value) {
2761
+ return typeof value === "string" && (value.startsWith("blob:") || value.startsWith("data:"));
2762
+ }
2763
+ function findUnresolvedUploads(payload) {
2764
+ const ids = [];
2765
+ for (const [key, value] of Object.entries(payload)) {
2766
+ if (Array.isArray(value)) {
2767
+ if (value.some(isUnresolvedUploadUrl)) ids.push(key);
2768
+ } else if (isUnresolvedUploadUrl(value)) {
2769
+ ids.push(key);
2770
+ }
2771
+ }
2772
+ return ids;
2773
+ }
2774
+ function getConversionUserData(definition, values) {
2775
+ const out = {};
2776
+ for (const section of definition.sections) {
2777
+ for (const field of section.fields) {
2778
+ if (field.type === "email" && out.email === void 0 && values[field.id]) {
2779
+ out.email = values[field.id];
2780
+ }
2781
+ if (field.type === "phone" && out.phone === void 0 && values[field.id]) {
2782
+ out.phone = values[field.id];
2783
+ }
2784
+ }
2785
+ }
2786
+ return out;
2787
+ }
2113
2788
  function getSensitiveFieldIds(definition) {
2114
2789
  const ids = [];
2115
2790
  for (const section of definition.sections) {
@@ -2151,9 +2826,9 @@ function fetchTransportKey(endpoint) {
2151
2826
  var presetNonBgClasses = {
2152
2827
  default: "",
2153
2828
  minimal: "",
2154
- bordered: "border border-gray-200",
2829
+ bordered: "border border-current/15",
2155
2830
  shadow: "shadow-lg",
2156
- card: "shadow-lg border border-gray-200",
2831
+ card: "shadow-lg border border-current/15",
2157
2832
  dark: ""
2158
2833
  };
2159
2834
  var radiusClasses = {
@@ -2164,12 +2839,23 @@ var radiusClasses = {
2164
2839
  full: "rounded-2xl"
2165
2840
  };
2166
2841
  var spacingClasses = {
2842
+ // "none" exists for forms dropped into a page that owns its own layout —
2843
+ // without it a consumer had to neutralise the padding with a `p-0` class
2844
+ // override from the outside.
2845
+ none: "p-0",
2167
2846
  compact: "p-3",
2168
2847
  normal: "p-6",
2169
2848
  relaxed: "p-8"
2170
2849
  };
2850
+ function getRadiusClass(style, fallback = "rounded-md") {
2851
+ if (resolveCustomRadius(style)) return "rounded-none";
2852
+ return radiusClasses[style.borderRadius] || fallback;
2853
+ }
2854
+ function getRadiusStyle(style) {
2855
+ return resolveCustomRadius(style) ? { borderRadius: FORM_RADIUS_VAR } : {};
2856
+ }
2171
2857
  function getButtonClasses(style) {
2172
- const radius = radiusClasses[style.borderRadius] || "rounded-md";
2858
+ const radius = getRadiusClass(style);
2173
2859
  const weight = style.inputVariant === "stacked" ? "font-semibold" : "font-medium";
2174
2860
  switch (style.buttonVariant) {
2175
2861
  case "outline":
@@ -2182,17 +2868,18 @@ function getButtonClasses(style) {
2182
2868
  }
2183
2869
  }
2184
2870
  function getButtonStyle(style) {
2871
+ const radius = getRadiusStyle(style);
2185
2872
  switch (style.buttonVariant) {
2186
2873
  case "outline":
2187
- return { borderColor: FORM_VAR.buttonBg, color: FORM_VAR.buttonBg };
2874
+ return __spreadProps(__spreadValues({}, radius), { borderColor: FORM_VAR.buttonBg, color: FORM_VAR.buttonBg });
2188
2875
  case "ghost":
2189
- return { color: FORM_VAR.buttonBg };
2876
+ return __spreadProps(__spreadValues({}, radius), { color: FORM_VAR.buttonBg });
2190
2877
  case "filled":
2191
2878
  default:
2192
- return {
2879
+ return __spreadProps(__spreadValues({}, radius), {
2193
2880
  backgroundColor: FORM_VAR.buttonBg,
2194
2881
  color: FORM_VAR.buttonText
2195
- };
2882
+ });
2196
2883
  }
2197
2884
  }
2198
2885
  function interpolateSuccessMessage(template, response) {
@@ -2306,9 +2993,14 @@ var ErrorBanner = ({
2306
2993
  var DynamicForm = ({
2307
2994
  definition,
2308
2995
  apiRoute,
2996
+ submit,
2997
+ initialValues: initialValueOverrides,
2998
+ onValuesChange,
2309
2999
  onSuccess,
2310
3000
  onError,
2311
3001
  extraData,
3002
+ onFileUpload,
3003
+ fileUploadRoute,
2312
3004
  className,
2313
3005
  onFormView,
2314
3006
  onFormSubmit: onFormSubmitCallback,
@@ -2317,17 +3009,19 @@ var DynamicForm = ({
2317
3009
  previewTouchAllSignal,
2318
3010
  previewUntouchAllSignal,
2319
3011
  previewBg,
2320
- previewTextColor
3012
+ previewTextColor,
3013
+ previewColorScheme,
3014
+ darkModeSelector = FORM_DEFAULT_DARK_SELECTOR
2321
3015
  }) => {
2322
- var _a, _b, _c;
3016
+ var _a, _b, _c, _d;
2323
3017
  const [submitStatus, setSubmitStatus] = react.useState("idle");
2324
- const [postSuccessCooldown, setPostSuccessCooldown] = react.useState(false);
2325
- react.useEffect(() => {
2326
- if (submitStatus !== "success") return;
2327
- setPostSuccessCooldown(true);
2328
- const t = setTimeout(() => setPostSuccessCooldown(false), 2e3);
2329
- return () => clearTimeout(t);
2330
- }, [submitStatus]);
3018
+ const {
3019
+ bannerRef,
3020
+ cooldown: postSuccessCooldown,
3021
+ submittedSnapshot,
3022
+ markSubmitted,
3023
+ clearSubmitted
3024
+ } = useSuccessFeedback(submitStatus === "success");
2331
3025
  const [responseData, setResponseData] = react.useState(
2332
3026
  null
2333
3027
  );
@@ -2349,8 +3043,15 @@ var DynamicForm = ({
2349
3043
  mountTimeRef.current = Date.now();
2350
3044
  }, [definition.id]);
2351
3045
  const validationSchema = react.useMemo(() => buildYupSchema(definition), [definition]);
3046
+ react.useEffect(() => {
3047
+ var _a2;
3048
+ void ((_a2 = formikRef.current) == null ? void 0 : _a2.validateForm());
3049
+ }, [validationSchema]);
2352
3050
  const initialValues = react.useMemo(() => {
2353
3051
  const base = buildInitialValues(definition);
3052
+ for (const [key, value] of Object.entries(initialValueOverrides != null ? initialValueOverrides : {})) {
3053
+ if (key in base && value !== void 0) base[key] = value;
3054
+ }
2354
3055
  if (honeypotEnabled) {
2355
3056
  base[HONEYPOT_FIELD_NAME] = "";
2356
3057
  }
@@ -2360,6 +3061,13 @@ var DynamicForm = ({
2360
3061
  () => [...definition.sections].sort((a, b) => a.order - b.order),
2361
3062
  [definition.sections]
2362
3063
  );
3064
+ const fileUploadValue = react.useMemo(
3065
+ () => ({
3066
+ upload: onFileUpload != null ? onFileUpload : fileUploadRoute ? createRouteFileUploader(fileUploadRoute, definition.id) : void 0,
3067
+ allowObjectUrlFallback: Boolean(previewState)
3068
+ }),
3069
+ [onFileUpload, fileUploadRoute, definition.id, previewState]
3070
+ );
2363
3071
  react.useEffect(() => {
2364
3072
  if (previewTouchAllSignal === void 0 || !formikRef.current) return;
2365
3073
  const touched = {};
@@ -2374,19 +3082,34 @@ var DynamicForm = ({
2374
3082
  if (previewUntouchAllSignal === void 0 || !formikRef.current) return;
2375
3083
  formikRef.current.setTouched({}, false);
2376
3084
  }, [previewUntouchAllSignal]);
2377
- const style = __spreadValues(__spreadValues({}, DEFAULT_FORM_STYLE), definition.style);
3085
+ const rawStyle = __spreadValues(__spreadValues({}, DEFAULT_FORM_STYLE), definition.style);
3086
+ const style = previewColorScheme ? resolveSchemeStyle(rawStyle, previewColorScheme) : rawStyle;
3087
+ const darkEnabled = !previewColorScheme && definitionHasDarkColors(definition);
3088
+ const colorSchemeState = {
3089
+ forced: previewColorScheme,
3090
+ darkEnabled
3091
+ };
2378
3092
  const isStacked = style.inputVariant === "stacked";
2379
3093
  const isCard = style.preset === "card";
2380
3094
  const submittingText = (_b = definition.submitConfig.submittingText) != null ? _b : "Submitting...";
2381
- const successBehavior = (_c = definition.submitConfig.successBehavior) != null ? _c : "message";
2382
- const hasPreviewOverride = Boolean(previewBg || previewTextColor);
2383
- const previewOverrides = hasPreviewOverride ? { backgroundColor: previewBg, textColor: previewTextColor } : null;
2384
- const cssVarStyle = buildFormCssVars(style, previewBg);
2385
- const effectiveFormBg = previewBg != null ? previewBg : style.formBackgroundColor;
2386
- const formInlineStyle = __spreadValues(__spreadValues(__spreadValues({}, cssVarStyle), effectiveFormBg ? { backgroundColor: effectiveFormBg } : {}), previewTextColor ? { color: previewTextColor } : {});
3095
+ const submittedText = (_c = definition.submitConfig.submittedText) != null ? _c : "Sent";
3096
+ const successBehavior = (_d = definition.submitConfig.successBehavior) != null ? _d : "message";
3097
+ const cssVarStyle = __spreadValues(__spreadValues({}, buildFormCssVars(style, previewBg)), darkEnabled ? buildFormDarkCssVars(style) : {});
3098
+ const effectiveFormBg = style.formBackgroundColor || previewBg;
3099
+ const rootBgStyle = darkEnabled ? { backgroundColor: FORM_ROOT_BG_VAR } : effectiveFormBg ? { backgroundColor: effectiveFormBg } : {};
3100
+ const formInlineStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, cssVarStyle), getRadiusStyle(style)), rootBgStyle), previewTextColor ? { color: previewTextColor } : {});
3101
+ const darkScopeAttr = darkEnabled ? { [FORM_DARK_SCOPE_ATTR]: "" } : {};
3102
+ const darkStyleSheet = darkEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
3103
+ "style",
3104
+ {
3105
+ "data-vt-forms-dark": "",
3106
+ dangerouslySetInnerHTML: { __html: buildDarkSchemeCss(darkModeSelector) }
3107
+ }
3108
+ ) : null;
2387
3109
  const formClasses = tailwindMerge.twMerge(
3110
+ "bg-inherit",
2388
3111
  presetNonBgClasses[style.preset] || "",
2389
- radiusClasses[style.borderRadius] || "rounded-md",
3112
+ getRadiusClass(style),
2390
3113
  isCard ? "p-8" : spacingClasses[style.spacing] || "p-6",
2391
3114
  isStacked ? "space-y-8" : "",
2392
3115
  className
@@ -2399,24 +3122,29 @@ var DynamicForm = ({
2399
3122
  responseData
2400
3123
  );
2401
3124
  if (successBehavior === "replace" && effectiveSubmitStatus === "success") {
2402
- return /* @__PURE__ */ jsxRuntime.jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsxRuntime.jsx(FormPreviewOverridesProvider, { value: previewOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(
3125
+ return /* @__PURE__ */ jsxRuntime.jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsxRuntime.jsx(FormColorSchemeProvider, { value: colorSchemeState, children: /* @__PURE__ */ jsxRuntime.jsxs(
2403
3126
  "div",
2404
- {
3127
+ __spreadProps(__spreadValues({
3128
+ ref: bannerRef,
2405
3129
  className: formClasses,
2406
3130
  style: formInlineStyle,
2407
- "data-form-version": definition.version,
2408
- children: /* @__PURE__ */ jsxRuntime.jsx(SuccessBanner, { message: successMessage })
2409
- }
3131
+ "data-form-version": definition.version
3132
+ }, darkScopeAttr), {
3133
+ children: [
3134
+ darkStyleSheet,
3135
+ /* @__PURE__ */ jsxRuntime.jsx(SuccessBanner, { message: successMessage })
3136
+ ]
3137
+ })
2410
3138
  ) }) });
2411
3139
  }
2412
- return /* @__PURE__ */ jsxRuntime.jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsxRuntime.jsx(FormPreviewOverridesProvider, { value: previewOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(
3140
+ return /* @__PURE__ */ jsxRuntime.jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsxRuntime.jsx(FormColorSchemeProvider, { value: colorSchemeState, children: /* @__PURE__ */ jsxRuntime.jsx(FormFileUploadProvider, { value: fileUploadValue, children: /* @__PURE__ */ jsxRuntime.jsx(
2413
3141
  formik.Formik,
2414
3142
  {
2415
3143
  innerRef: formikRef,
2416
3144
  initialValues,
2417
3145
  validationSchema,
2418
3146
  onSubmit: (_0, _1) => __async(null, [_0, _1], function* (values, { setSubmitting, resetForm }) {
2419
- var _a2, _b2, _d, _e, _f;
3147
+ var _a2, _b2, _d2, _e, _f, _g;
2420
3148
  if (previewState) {
2421
3149
  setSubmitting(false);
2422
3150
  return;
@@ -2431,6 +3159,7 @@ var DynamicForm = ({
2431
3159
  console.debug(`[forms] Spam detected: ${reason}`);
2432
3160
  }
2433
3161
  setResponseData(null);
3162
+ markSubmitted(values);
2434
3163
  setSubmitStatus("success");
2435
3164
  if (successBehavior === "reset" || successBehavior === "replace") {
2436
3165
  resetForm();
@@ -2442,7 +3171,9 @@ var DynamicForm = ({
2442
3171
  setSubmitStatus("idle");
2443
3172
  try {
2444
3173
  const _c2 = values, { [_b2 = HONEYPOT_FIELD_NAME]: _hp } = _c2, cleanValues = __objRest(_c2, [__restKey(_b2)]);
2445
- const payload = __spreadProps(__spreadValues(__spreadValues({}, cleanValues), extraData), {
3174
+ const adReferral = readAdReferral();
3175
+ const analyticsSessionId = readAnalyticsSessionId();
3176
+ const payload = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, cleanValues), adReferral ? { adReferral } : {}), analyticsSessionId ? { analyticsSessionId } : {}), extraData), {
2446
3177
  formId: definition.id
2447
3178
  });
2448
3179
  for (const hiddenId of getHiddenFieldIds(definition, cleanValues)) {
@@ -2451,6 +3182,12 @@ var DynamicForm = ({
2451
3182
  for (const toggleKey of getSameAsToggleKeys(definition)) {
2452
3183
  delete payload[toggleKey];
2453
3184
  }
3185
+ const unresolved = findUnresolvedUploads(payload);
3186
+ if (unresolved.length > 0) {
3187
+ throw new Error(
3188
+ `File upload did not complete for: ${unresolved.join(", ")}. Remove the file and add it again.`
3189
+ );
3190
+ }
2454
3191
  const sensitiveIds = getSensitiveFieldIds(definition);
2455
3192
  if (sensitiveIds.length > 0) {
2456
3193
  const transportKey = yield fetchTransportKey(transportKeyEndpoint);
@@ -2466,29 +3203,49 @@ var DynamicForm = ({
2466
3203
  );
2467
3204
  }
2468
3205
  }
2469
- const res = yield fetch(apiRoute, {
2470
- method: "POST",
2471
- headers: { "Content-Type": "application/json" },
2472
- body: JSON.stringify(payload)
2473
- });
2474
- if (!res.ok) {
2475
- const errBody = yield res.json().catch(() => null);
2476
- throw new Error(
2477
- (errBody == null ? void 0 : errBody.error) || `Submission failed (${res.status})`
2478
- );
2479
- }
2480
3206
  let body = null;
2481
- try {
2482
- body = yield res.json();
2483
- } catch (e) {
2484
- body = null;
3207
+ if (submit) {
3208
+ const result = yield submit(payload);
3209
+ body = result && typeof result === "object" ? result : null;
3210
+ } else {
3211
+ const res = yield fetch(apiRoute, {
3212
+ method: "POST",
3213
+ headers: { "Content-Type": "application/json" },
3214
+ body: JSON.stringify(payload)
3215
+ });
3216
+ if (!res.ok) {
3217
+ const errBody = yield res.json().catch(() => null);
3218
+ throw new Error(
3219
+ (errBody == null ? void 0 : errBody.error) || `Submission failed (${res.status})`
3220
+ );
3221
+ }
3222
+ try {
3223
+ body = yield res.json();
3224
+ } catch (e) {
3225
+ body = null;
3226
+ }
2485
3227
  }
2486
3228
  setResponseData(body);
3229
+ const submissionType = (_d2 = extraData == null ? void 0 : extraData.submissionType) != null ? _d2 : "contact";
3230
+ const serverId = body == null ? void 0 : body.submissionId;
3231
+ trackFormConversion(
3232
+ {
3233
+ formId: definition.id,
3234
+ formName: definition.name,
3235
+ formType: submissionType
3236
+ },
3237
+ (_e = definition.submitConfig.conversion) == null ? void 0 : _e.sendTo,
3238
+ {
3239
+ transactionId: typeof serverId === "string" && serverId ? serverId : newTransactionId(),
3240
+ userData: getConversionUserData(definition, values)
3241
+ }
3242
+ );
3243
+ markSubmitted(values);
2487
3244
  setSubmitStatus("success");
2488
- (_f = onFormSubmitCallback != null ? onFormSubmitCallback : (_d = globalTracker()) == null ? void 0 : _d.trackFormSubmit) == null ? void 0 : _f(
3245
+ (_g = onFormSubmitCallback != null ? onFormSubmitCallback : (_f = globalTracker()) == null ? void 0 : _f.trackFormSubmit) == null ? void 0 : _g(
2489
3246
  definition.id,
2490
3247
  definition.name,
2491
- (_e = extraData == null ? void 0 : extraData.submissionType) != null ? _e : "contact"
3248
+ submissionType
2492
3249
  );
2493
3250
  if (successBehavior === "reset" || successBehavior === "replace") {
2494
3251
  resetForm();
@@ -2502,23 +3259,29 @@ var DynamicForm = ({
2502
3259
  }
2503
3260
  } catch (err) {
2504
3261
  setResponseData(null);
3262
+ clearSubmitted();
2505
3263
  setSubmitStatus("error");
2506
3264
  onError == null ? void 0 : onError(err instanceof Error ? err : new Error("Submission failed"));
2507
3265
  } finally {
2508
3266
  setSubmitting(false);
2509
3267
  }
2510
3268
  }),
2511
- children: ({ isSubmitting, getFieldProps }) => {
3269
+ children: ({ isSubmitting, getFieldProps, values }) => {
2512
3270
  const showSubmitting = isSubmitting || previewSubmitting;
2513
3271
  const isDisabled = successBehavior === "disable" && effectiveSubmitStatus === "success";
2514
- const submitLocked = showSubmitting || postSuccessCooldown || previewState === "success";
3272
+ const unchangedSinceSuccess = effectiveSubmitStatus === "success" && submittedSnapshot !== null && JSON.stringify(values) === submittedSnapshot;
3273
+ const submitLocked = showSubmitting || postSuccessCooldown || unchangedSinceSuccess || previewState === "success";
2515
3274
  return /* @__PURE__ */ jsxRuntime.jsxs(
2516
3275
  formik.Form,
2517
- {
3276
+ __spreadProps(__spreadValues({
3277
+ method: "post",
2518
3278
  className: formClasses,
2519
3279
  style: formInlineStyle,
2520
- "data-form-version": definition.version,
3280
+ "data-form-version": definition.version
3281
+ }, darkScopeAttr), {
2521
3282
  children: [
3283
+ darkStyleSheet,
3284
+ onValuesChange && /* @__PURE__ */ jsxRuntime.jsx(ValuesObserver, { onChange: onValuesChange }),
2522
3285
  honeypotEnabled && /* @__PURE__ */ jsxRuntime.jsxs(
2523
3286
  "div",
2524
3287
  {
@@ -2548,7 +3311,7 @@ var DynamicForm = ({
2548
3311
  ]
2549
3312
  }
2550
3313
  ),
2551
- effectiveSubmitStatus === "success" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: bannerWrapperClass, children: /* @__PURE__ */ jsxRuntime.jsx(SuccessBanner, { message: successMessage }) }),
3314
+ effectiveSubmitStatus === "success" && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: bannerRef, className: bannerWrapperClass, children: /* @__PURE__ */ jsxRuntime.jsx(SuccessBanner, { message: successMessage }) }),
2552
3315
  effectiveSubmitStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: bannerWrapperClass, children: /* @__PURE__ */ jsxRuntime.jsx(
2553
3316
  ErrorBanner,
2554
3317
  {
@@ -2562,7 +3325,7 @@ var DynamicForm = ({
2562
3325
  disabled: isDisabled,
2563
3326
  "aria-disabled": isDisabled,
2564
3327
  className: tailwindMerge.twMerge(
2565
- "min-w-0 border-0 p-0",
3328
+ "min-w-0 border-0 bg-inherit p-0",
2566
3329
  isStacked ? "space-y-8" : "",
2567
3330
  isDisabled ? "pointer-events-none opacity-60" : ""
2568
3331
  ),
@@ -2581,7 +3344,7 @@ var DynamicForm = ({
2581
3344
  "aria-busy": showSubmitting,
2582
3345
  children: [
2583
3346
  showSubmitting && /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}),
2584
- showSubmitting ? submittingText : definition.submitConfig.buttonText
3347
+ showSubmitting ? submittingText : unchangedSinceSuccess ? submittedText : definition.submitConfig.buttonText
2585
3348
  ]
2586
3349
  }
2587
3350
  );
@@ -2594,6 +3357,7 @@ var DynamicForm = ({
2594
3357
  section,
2595
3358
  isLast,
2596
3359
  formDefaultTextColor: definition.defaultTextColor,
3360
+ formDefaultTextColorDark: definition.defaultTextColorDark,
2597
3361
  inlineSubmit: inlineButton && isLast ? submitButton : void 0
2598
3362
  },
2599
3363
  section.id
@@ -2605,12 +3369,31 @@ var DynamicForm = ({
2605
3369
  }
2606
3370
  )
2607
3371
  ]
2608
- }
3372
+ })
2609
3373
  );
2610
3374
  }
2611
3375
  }
2612
- ) }) });
3376
+ ) }) }) });
2613
3377
  };
3378
+ function AdReferralTracker({
3379
+ fallback,
3380
+ cookieName = AD_REFERRAL_COOKIE,
3381
+ ttlDays = AD_REFERRAL_TTL_DAYS
3382
+ } = {}) {
3383
+ react.useEffect(() => {
3384
+ const referral = captureAdReferral(
3385
+ window.location.search,
3386
+ fallback,
3387
+ /* @__PURE__ */ new Date(),
3388
+ window.location.pathname
3389
+ );
3390
+ if (!referral) return;
3391
+ const existing = readAdReferral(cookieName);
3392
+ if (existing && isSameAdReferralTouch(existing, referral)) return;
3393
+ writeAdReferral(referral, cookieName, ttlDays);
3394
+ }, []);
3395
+ return null;
3396
+ }
2614
3397
  function buildQueryString(opts) {
2615
3398
  const params = new URLSearchParams({
2616
3399
  projectId: opts.projectId,
@@ -2872,7 +3655,10 @@ function useDragReorder({
2872
3655
  });
2873
3656
  }
2874
3657
 
3658
+ exports.AD_REFERRAL_COOKIE = AD_REFERRAL_COOKIE;
3659
+ exports.AD_REFERRAL_TTL_DAYS = AD_REFERRAL_TTL_DAYS;
2875
3660
  exports.APPLICATION_STATUS_KEYS = APPLICATION_STATUS_KEYS;
3661
+ exports.AdReferralTracker = AdReferralTracker;
2876
3662
  exports.CORE_EMAIL_TEMPLATE_VARIABLES = CORE_EMAIL_TEMPLATE_VARIABLES;
2877
3663
  exports.DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES = DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES;
2878
3664
  exports.DEFAULT_FILE_FIELD_CONFIG = DEFAULT_FILE_FIELD_CONFIG;
@@ -2885,9 +3671,24 @@ exports.DEFAULT_SPAM_PROTECTION = DEFAULT_SPAM_PROTECTION;
2885
3671
  exports.DynamicForm = DynamicForm;
2886
3672
  exports.DynamicFormField = DynamicFormField;
2887
3673
  exports.DynamicFormSection = DynamicFormSection;
3674
+ exports.ENHANCED_CONVERSIONS_GLOBAL = ENHANCED_CONVERSIONS_GLOBAL;
3675
+ exports.FORM_CONVERSION_SEND_TO_GLOBAL = FORM_CONVERSION_SEND_TO_GLOBAL;
2888
3676
  exports.FORM_CSS_VAR = FORM_CSS_VAR;
3677
+ exports.FORM_DARK_SCOPE_ATTR = FORM_DARK_SCOPE_ATTR;
3678
+ exports.FORM_DARK_TEXT_ATTR = FORM_DARK_TEXT_ATTR;
3679
+ exports.FORM_DARK_TEXT_VAR = FORM_DARK_TEXT_VAR;
2889
3680
  exports.FORM_DEFAULT_COLOR = FORM_DEFAULT_COLOR;
3681
+ exports.FORM_DEFAULT_DARK_SELECTOR = FORM_DEFAULT_DARK_SELECTOR;
3682
+ exports.FORM_DEFAULT_RADIUS = FORM_DEFAULT_RADIUS;
3683
+ exports.FORM_GAP_VAR = FORM_GAP_VAR;
3684
+ exports.FORM_RADIUS_VAR = FORM_RADIUS_VAR;
3685
+ exports.FORM_ROOT_BG_VAR = FORM_ROOT_BG_VAR;
3686
+ exports.FORM_STRUCT_VAR = FORM_STRUCT_VAR;
3687
+ exports.FORM_STYLE_COLOR_KEYS = FORM_STYLE_COLOR_KEYS;
3688
+ exports.FORM_SUBMIT_SUCCESS_EVENT = FORM_SUBMIT_SUCCESS_EVENT;
2890
3689
  exports.FORM_VAR = FORM_VAR;
3690
+ exports.FileField = FileField;
3691
+ exports.FormFileUploadProvider = FormFileUploadProvider;
2891
3692
  exports.HONEYPOT_FIELD_NAME = HONEYPOT_FIELD_NAME;
2892
3693
  exports.NEWSLETTER_ALLOWED_FIELD_TYPES = NEWSLETTER_ALLOWED_FIELD_TYPES;
2893
3694
  exports.SAME_AS_TOGGLE_PREFIX = SAME_AS_TOGGLE_PREFIX;
@@ -2896,24 +3697,49 @@ exports.applyTextTransform = applyTextTransform;
2896
3697
  exports.applyTransform = applyTransform;
2897
3698
  exports.base64ToBuffer = base64ToBuffer;
2898
3699
  exports.bufferToBase64 = bufferToBase64;
3700
+ exports.buildColorVars = buildColorVars;
3701
+ exports.buildDarkSchemeCss = buildDarkSchemeCss;
2899
3702
  exports.buildEmailTemplateVariables = buildEmailTemplateVariables;
2900
3703
  exports.buildFormCssVars = buildFormCssVars;
3704
+ exports.buildFormDarkCssVars = buildFormDarkCssVars;
2901
3705
  exports.buildInitialValues = buildInitialValues;
3706
+ exports.buildUserData = buildUserData;
2902
3707
  exports.buildYupSchema = buildYupSchema;
3708
+ exports.captureAdReferral = captureAdReferral;
3709
+ exports.darkVarName = darkVarName;
3710
+ exports.definitionHasDarkColors = definitionHasDarkColors;
2903
3711
  exports.deriveLast4 = deriveLast4;
2904
3712
  exports.encryptSensitiveValue = encryptSensitiveValue;
3713
+ exports.fireAdsConversion = fireAdsConversion;
3714
+ exports.fireGenerateLead = fireGenerateLead;
2905
3715
  exports.formatSsn = formatSsn;
2906
3716
  exports.formatUsPhone = formatUsPhone;
2907
3717
  exports.getFormDefinition = getFormDefinition;
2908
3718
  exports.getSafeRedirectUrl = getSafeRedirectUrl;
3719
+ exports.hasDarkColors = hasDarkColors;
3720
+ exports.isSameAdReferralTouch = isSameAdReferralTouch;
2909
3721
  exports.isVisibilityConditionMet = isVisibilityConditionMet;
3722
+ exports.newTransactionId = newTransactionId;
2910
3723
  exports.parseFormDefinition = parseFormDefinition;
3724
+ exports.pushFormSubmitSuccess = pushFormSubmitSuccess;
3725
+ exports.readAdReferral = readAdReferral;
2911
3726
  exports.renderEmailTemplate = renderEmailTemplate;
2912
3727
  exports.renderNotificationEmail = renderNotificationEmail;
3728
+ exports.resizeImageFile = resizeImageFile;
3729
+ exports.resolveConversionSendTo = resolveConversionSendTo;
3730
+ exports.resolveCustomGap = resolveCustomGap;
3731
+ exports.resolveCustomRadius = resolveCustomRadius;
3732
+ exports.resolveSchemeColors = resolveSchemeColors;
3733
+ exports.resolveSchemeStyle = resolveSchemeStyle;
3734
+ exports.resolveSectionTextColor = resolveSectionTextColor;
2913
3735
  exports.sameAsToggleKey = sameAsToggleKey;
3736
+ exports.toE164 = toE164;
3737
+ exports.trackFormConversion = trackFormConversion;
2914
3738
  exports.useDragReorder = useDragReorder;
2915
3739
  exports.useFormDefinition = useFormDefinition;
3740
+ exports.useFormFileUpload = useFormFileUpload;
2916
3741
  exports.useUndoRedo = useUndoRedo;
2917
3742
  exports.useUndoRedoShortcuts = useUndoRedoShortcuts;
3743
+ exports.writeAdReferral = writeAdReferral;
2918
3744
  //# sourceMappingURL=index.js.map
2919
3745
  //# sourceMappingURL=index.js.map