@vulcantech/forms 0.3.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/README.md +97 -2
- package/dist/index.d.mts +715 -22
- package/dist/index.d.ts +715 -22
- package/dist/index.js +913 -209
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +875 -210
- package/dist/index.mjs.map +1 -1
- package/fingerprint.json +4 -0
- package/package.json +12 -4
package/dist/index.mjs
CHANGED
|
@@ -84,6 +84,18 @@ var DEFAULT_SPAM_PROTECTION = {
|
|
|
84
84
|
honeypot: true,
|
|
85
85
|
minSubmitTime: 3
|
|
86
86
|
};
|
|
87
|
+
var FORM_STYLE_COLOR_KEYS = [
|
|
88
|
+
"formBackgroundColor",
|
|
89
|
+
"inputBgColor",
|
|
90
|
+
"inputBorderColor",
|
|
91
|
+
"inputFocusColor",
|
|
92
|
+
"inputTextColor",
|
|
93
|
+
"placeholderColor",
|
|
94
|
+
"labelColor",
|
|
95
|
+
"errorColor",
|
|
96
|
+
"buttonColor",
|
|
97
|
+
"buttonTextColor"
|
|
98
|
+
];
|
|
87
99
|
var DEFAULT_FORM_STYLE = {
|
|
88
100
|
preset: "default",
|
|
89
101
|
borderRadius: "md",
|
|
@@ -439,6 +451,105 @@ function getSafeRedirectUrl(raw) {
|
|
|
439
451
|
return null;
|
|
440
452
|
}
|
|
441
453
|
|
|
454
|
+
// src/utils/conversion.ts
|
|
455
|
+
var FORM_SUBMIT_SUCCESS_EVENT = "form_submit_success";
|
|
456
|
+
var FORM_CONVERSION_SEND_TO_GLOBAL = "__vtFormConversionSendTo";
|
|
457
|
+
var ENHANCED_CONVERSIONS_GLOBAL = "__vtEnhancedConversions";
|
|
458
|
+
function toE164(raw) {
|
|
459
|
+
if (typeof raw !== "string" && typeof raw !== "number") return void 0;
|
|
460
|
+
const digits = String(raw).replace(/\D/g, "");
|
|
461
|
+
if (digits.length === 10) return `+1${digits}`;
|
|
462
|
+
if (digits.length === 11 && digits[0] === "1") return `+${digits}`;
|
|
463
|
+
return void 0;
|
|
464
|
+
}
|
|
465
|
+
function buildUserData(input) {
|
|
466
|
+
if (!input) return void 0;
|
|
467
|
+
const email = typeof input.email === "string" ? input.email.trim().toLowerCase() : "";
|
|
468
|
+
const phone = toE164(input.phone);
|
|
469
|
+
if (!email && !phone) return void 0;
|
|
470
|
+
return __spreadValues(__spreadValues({}, email ? { email } : {}), phone ? { phone_number: phone } : {});
|
|
471
|
+
}
|
|
472
|
+
function newTransactionId() {
|
|
473
|
+
try {
|
|
474
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
475
|
+
return crypto.randomUUID();
|
|
476
|
+
}
|
|
477
|
+
} catch (e) {
|
|
478
|
+
}
|
|
479
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
480
|
+
}
|
|
481
|
+
function googleWindow() {
|
|
482
|
+
if (typeof window === "undefined") return void 0;
|
|
483
|
+
return window;
|
|
484
|
+
}
|
|
485
|
+
function pushFormSubmitSuccess(context) {
|
|
486
|
+
const win = googleWindow();
|
|
487
|
+
if (!win) return false;
|
|
488
|
+
try {
|
|
489
|
+
if (!Array.isArray(win.dataLayer)) {
|
|
490
|
+
if (win.dataLayer !== void 0) return false;
|
|
491
|
+
win.dataLayer = [];
|
|
492
|
+
}
|
|
493
|
+
win.dataLayer.push({
|
|
494
|
+
event: FORM_SUBMIT_SUCCESS_EVENT,
|
|
495
|
+
formId: context.formId,
|
|
496
|
+
formName: context.formName,
|
|
497
|
+
formType: context.formType
|
|
498
|
+
});
|
|
499
|
+
return true;
|
|
500
|
+
} catch (e) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function fireAdsConversion(sendTo, extras = {}) {
|
|
505
|
+
if (typeof sendTo !== "string" || sendTo.trim() === "") return false;
|
|
506
|
+
const win = googleWindow();
|
|
507
|
+
if (!win || typeof win.gtag !== "function") return false;
|
|
508
|
+
try {
|
|
509
|
+
if (win[ENHANCED_CONVERSIONS_GLOBAL] === true) {
|
|
510
|
+
const userData = buildUserData(extras.userData);
|
|
511
|
+
if (userData) win.gtag("set", "user_data", userData);
|
|
512
|
+
}
|
|
513
|
+
win.gtag("event", "conversion", __spreadValues({
|
|
514
|
+
send_to: sendTo.trim()
|
|
515
|
+
}, extras.transactionId ? { transaction_id: extras.transactionId } : {}));
|
|
516
|
+
return true;
|
|
517
|
+
} catch (e) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
function fireGenerateLead(context) {
|
|
522
|
+
const win = googleWindow();
|
|
523
|
+
if (!win || typeof win.gtag !== "function") return false;
|
|
524
|
+
try {
|
|
525
|
+
win.gtag("event", "generate_lead", {
|
|
526
|
+
form_id: context.formId,
|
|
527
|
+
form_type: context.formType
|
|
528
|
+
});
|
|
529
|
+
return true;
|
|
530
|
+
} catch (e) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function resolveConversionSendTo(formSendTo) {
|
|
535
|
+
var _a;
|
|
536
|
+
if (typeof formSendTo === "string" && formSendTo.trim() !== "") {
|
|
537
|
+
return formSendTo.trim();
|
|
538
|
+
}
|
|
539
|
+
const global = (_a = googleWindow()) == null ? void 0 : _a[FORM_CONVERSION_SEND_TO_GLOBAL];
|
|
540
|
+
if (typeof global === "string" && global.trim() !== "") return global.trim();
|
|
541
|
+
return void 0;
|
|
542
|
+
}
|
|
543
|
+
function trackFormConversion(context, formSendTo, extras = {}) {
|
|
544
|
+
const pushed = pushFormSubmitSuccess(context);
|
|
545
|
+
const conversionFired = fireAdsConversion(
|
|
546
|
+
resolveConversionSendTo(formSendTo),
|
|
547
|
+
extras
|
|
548
|
+
);
|
|
549
|
+
const leadFired = fireGenerateLead(context);
|
|
550
|
+
return { pushed, conversionFired, leadFired };
|
|
551
|
+
}
|
|
552
|
+
|
|
442
553
|
// src/utils/textTransforms.ts
|
|
443
554
|
function formatSsn(raw) {
|
|
444
555
|
const digits = raw.replace(/\D/g, "").slice(0, 9);
|
|
@@ -697,14 +808,161 @@ function deriveLast4(plaintext) {
|
|
|
697
808
|
const digits = plaintext.replace(/\D/g, "");
|
|
698
809
|
return digits.slice(-4).padStart(4, "\u2022");
|
|
699
810
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
var
|
|
703
|
-
var
|
|
704
|
-
|
|
705
|
-
)
|
|
706
|
-
|
|
707
|
-
|
|
811
|
+
|
|
812
|
+
// src/tracking/adReferral.ts
|
|
813
|
+
var AD_REFERRAL_COOKIE = "vt_ad_ref";
|
|
814
|
+
var AD_REFERRAL_TTL_DAYS = 30;
|
|
815
|
+
var LANDING_PAGE_MAX = 200;
|
|
816
|
+
function cleanLandingPage(pathname) {
|
|
817
|
+
if (typeof pathname !== "string" || !pathname.startsWith("/")) return void 0;
|
|
818
|
+
return pathname.slice(0, LANDING_PAGE_MAX);
|
|
819
|
+
}
|
|
820
|
+
var CLICK_ID_PARAMS = ["gclid", "gbraid", "wbraid"];
|
|
821
|
+
function isClickIdType(value) {
|
|
822
|
+
return CLICK_ID_PARAMS.includes(value);
|
|
823
|
+
}
|
|
824
|
+
var GOOGLE_AD_PARAMS = ["gad_source", "gad_campaignid"];
|
|
825
|
+
var UTM_PARAMS = [
|
|
826
|
+
["utm_source", "source"],
|
|
827
|
+
["utm_medium", "medium"],
|
|
828
|
+
["utm_campaign", "campaign"],
|
|
829
|
+
["utm_term", "term"],
|
|
830
|
+
["utm_content", "content"]
|
|
831
|
+
];
|
|
832
|
+
function captureAdReferral(search, fallback, now = /* @__PURE__ */ new Date(), pathname) {
|
|
833
|
+
var _a, _b, _c, _d;
|
|
834
|
+
const landingPage = cleanLandingPage(pathname);
|
|
835
|
+
const params = new URLSearchParams(search);
|
|
836
|
+
const utm = {};
|
|
837
|
+
for (const [param, key] of UTM_PARAMS) {
|
|
838
|
+
const value = params.get(param);
|
|
839
|
+
if (value) utm[key] = value;
|
|
840
|
+
}
|
|
841
|
+
let clickId;
|
|
842
|
+
let clickIdType;
|
|
843
|
+
for (const param of CLICK_ID_PARAMS) {
|
|
844
|
+
const value = params.get(param);
|
|
845
|
+
if (value) {
|
|
846
|
+
clickId = value;
|
|
847
|
+
clickIdType = param;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
const adCampaignId = params.get("gad_campaignid") || void 0;
|
|
852
|
+
const googleAdClick = clickId !== void 0 || GOOGLE_AD_PARAMS.some((p) => params.get(p));
|
|
853
|
+
const hasSignal = Object.keys(utm).length > 0 || googleAdClick;
|
|
854
|
+
if (!hasSignal) {
|
|
855
|
+
if (!fallback) return null;
|
|
856
|
+
return __spreadProps(__spreadValues({
|
|
857
|
+
source: fallback.source,
|
|
858
|
+
medium: fallback.medium,
|
|
859
|
+
campaign: fallback.campaign
|
|
860
|
+
}, landingPage ? { landingPage } : {}), {
|
|
861
|
+
landedAt: now.toISOString()
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
865
|
+
// An auto-tagged click with no UTMs is a Google paid click. Inferring
|
|
866
|
+
// this is what makes `classifySource` bucket it as "paid" rather than
|
|
867
|
+
// leaving the lead unattributed.
|
|
868
|
+
//
|
|
869
|
+
// Tagging that sets only `utm_campaign` (or only term/content) leaves
|
|
870
|
+
// BOTH of these empty, and that is deliberate: the CMS's
|
|
871
|
+
// `deriveLeadSource` only classifies when one of them is non-empty and
|
|
872
|
+
// otherwise returns undefined, so such a lead reads as "unknown". Do not
|
|
873
|
+
// "fix" this by defaulting to "direct" — an honest unknown beats a
|
|
874
|
+
// fabricated bucket, and the campaign still rides along for inspection.
|
|
875
|
+
source: (_a = utm.source) != null ? _a : googleAdClick ? "google" : "",
|
|
876
|
+
medium: (_b = utm.medium) != null ? _b : googleAdClick ? "cpc" : "",
|
|
877
|
+
campaign: (_d = (_c = utm.campaign) != null ? _c : adCampaignId) != null ? _d : googleAdClick ? "(not set)" : ""
|
|
878
|
+
}, utm.term ? { term: utm.term } : {}), utm.content ? { content: utm.content } : {}), clickId ? { clickId, clickIdType } : {}), landingPage ? { landingPage } : {}), {
|
|
879
|
+
landedAt: now.toISOString()
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
function readAdReferral(cookieName = AD_REFERRAL_COOKIE) {
|
|
883
|
+
if (typeof document === "undefined") return null;
|
|
884
|
+
for (const cookie of document.cookie.split(";")) {
|
|
885
|
+
const separator = cookie.indexOf("=");
|
|
886
|
+
if (separator === -1) continue;
|
|
887
|
+
if (cookie.slice(0, separator).trim() !== cookieName) continue;
|
|
888
|
+
try {
|
|
889
|
+
const parsed = JSON.parse(
|
|
890
|
+
decodeURIComponent(cookie.slice(separator + 1))
|
|
891
|
+
);
|
|
892
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
895
|
+
const _a = parsed, { source, medium, campaign, landedAt, clickIdType } = _a, rest = __objRest(_a, ["source", "medium", "campaign", "landedAt", "clickIdType"]);
|
|
896
|
+
if (typeof source !== "string" || typeof medium !== "string") return null;
|
|
897
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
|
|
898
|
+
source,
|
|
899
|
+
medium,
|
|
900
|
+
campaign: typeof campaign === "string" ? campaign : ""
|
|
901
|
+
}), isClickIdType(clickIdType) ? { clickIdType } : {}), {
|
|
902
|
+
landedAt: typeof landedAt === "string" ? landedAt : ""
|
|
903
|
+
});
|
|
904
|
+
} catch (e) {
|
|
905
|
+
return null;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
function isSameAdReferralTouch(a, b) {
|
|
911
|
+
return [...Object.keys(a), ...Object.keys(b)].every(
|
|
912
|
+
(key) => key === "landedAt" || a[key] === b[key]
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
function writeAdReferral(referral, cookieName = AD_REFERRAL_COOKIE, ttlDays = AD_REFERRAL_TTL_DAYS) {
|
|
916
|
+
if (typeof document === "undefined") return;
|
|
917
|
+
const expires = /* @__PURE__ */ new Date();
|
|
918
|
+
expires.setDate(expires.getDate() + ttlDays);
|
|
919
|
+
const value = encodeURIComponent(JSON.stringify(referral));
|
|
920
|
+
document.cookie = `${cookieName}=${value}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
// src/tracking/analyticsSession.ts
|
|
924
|
+
var ANALYTICS_SESSION_KEY = "__vt_sid";
|
|
925
|
+
function readAnalyticsSessionId() {
|
|
926
|
+
if (typeof window === "undefined") return void 0;
|
|
927
|
+
try {
|
|
928
|
+
const sid = window.sessionStorage.getItem(ANALYTICS_SESSION_KEY);
|
|
929
|
+
return sid && /^[a-z0-9]{6,64}$/i.test(sid) ? sid : void 0;
|
|
930
|
+
} catch (e) {
|
|
931
|
+
return void 0;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// src/utils/colorScheme.ts
|
|
936
|
+
function hasDarkColors(style) {
|
|
937
|
+
const dark = style == null ? void 0 : style.dark;
|
|
938
|
+
if (!dark) return false;
|
|
939
|
+
return FORM_STYLE_COLOR_KEYS.some((key) => Boolean(dark[key]));
|
|
940
|
+
}
|
|
941
|
+
function definitionHasDarkColors(definition) {
|
|
942
|
+
if (hasDarkColors(definition.style)) return true;
|
|
943
|
+
if (definition.defaultTextColorDark) return true;
|
|
944
|
+
return definition.sections.some((section) => Boolean(section.textColorDark));
|
|
945
|
+
}
|
|
946
|
+
function resolveSchemeColors(style, scheme) {
|
|
947
|
+
const dark = scheme === "dark" ? style.dark : void 0;
|
|
948
|
+
const out = {};
|
|
949
|
+
for (const key of FORM_STYLE_COLOR_KEYS) {
|
|
950
|
+
const value = (dark == null ? void 0 : dark[key]) || style[key];
|
|
951
|
+
if (value) out[key] = value;
|
|
952
|
+
}
|
|
953
|
+
return out;
|
|
954
|
+
}
|
|
955
|
+
function resolveSchemeStyle(style, scheme) {
|
|
956
|
+
const structural = __spreadValues({}, style);
|
|
957
|
+
delete structural.dark;
|
|
958
|
+
for (const key of FORM_STYLE_COLOR_KEYS) delete structural[key];
|
|
959
|
+
return __spreadValues(__spreadValues({}, structural), resolveSchemeColors(style, scheme));
|
|
960
|
+
}
|
|
961
|
+
function resolveSectionTextColor(section, formDefaults, scheme) {
|
|
962
|
+
const light = section.textColor || formDefaults.light || void 0;
|
|
963
|
+
if (scheme === "light") return light;
|
|
964
|
+
return section.textColorDark || formDefaults.dark || light;
|
|
965
|
+
}
|
|
708
966
|
|
|
709
967
|
// src/renderer/cssVars.ts
|
|
710
968
|
var FORM_CSS_VAR = {
|
|
@@ -719,6 +977,31 @@ var FORM_CSS_VAR = {
|
|
|
719
977
|
buttonBg: "--form-button-bg",
|
|
720
978
|
buttonText: "--form-button-text"
|
|
721
979
|
};
|
|
980
|
+
var FORM_STRUCT_VAR = {
|
|
981
|
+
radius: "--form-radius",
|
|
982
|
+
gap: "--form-gap",
|
|
983
|
+
focusBorderWidth: "--form-focus-border-width"
|
|
984
|
+
};
|
|
985
|
+
var FORM_DEFAULT_RADIUS = "0.375rem";
|
|
986
|
+
var FORM_RADIUS_VAR = `var(${FORM_STRUCT_VAR.radius}, ${FORM_DEFAULT_RADIUS})`;
|
|
987
|
+
var FORM_GAP_VAR = `var(${FORM_STRUCT_VAR.gap}, 1rem)`;
|
|
988
|
+
var FORM_DEFAULT_FOCUS_BORDER_WIDTH = "2px";
|
|
989
|
+
var FORM_FOCUS_BORDER_WIDTH_VAR = `var(${FORM_STRUCT_VAR.focusBorderWidth}, ${FORM_DEFAULT_FOCUS_BORDER_WIDTH})`;
|
|
990
|
+
function resolveCustomGap(style) {
|
|
991
|
+
var _a;
|
|
992
|
+
const raw = (_a = style.fieldGapValue) == null ? void 0 : _a.trim();
|
|
993
|
+
return raw ? raw : null;
|
|
994
|
+
}
|
|
995
|
+
function resolveCustomRadius(style) {
|
|
996
|
+
var _a;
|
|
997
|
+
const raw = (_a = style.borderRadiusValue) == null ? void 0 : _a.trim();
|
|
998
|
+
return raw ? raw : null;
|
|
999
|
+
}
|
|
1000
|
+
function resolveCustomFocusBorderWidth(style) {
|
|
1001
|
+
var _a;
|
|
1002
|
+
const raw = (_a = style.inputFocusBorderWidth) == null ? void 0 : _a.trim();
|
|
1003
|
+
return raw ? raw : null;
|
|
1004
|
+
}
|
|
722
1005
|
var FORM_DEFAULT_COLOR = {
|
|
723
1006
|
formBg: "transparent",
|
|
724
1007
|
inputBg: "inherit",
|
|
@@ -749,29 +1032,76 @@ var FORM_VAR = {
|
|
|
749
1032
|
buttonBg: ref(FORM_CSS_VAR.buttonBg, FORM_DEFAULT_COLOR.buttonBg),
|
|
750
1033
|
buttonText: ref(FORM_CSS_VAR.buttonText, FORM_DEFAULT_COLOR.buttonText)
|
|
751
1034
|
};
|
|
1035
|
+
var COLOR_VAR_BY_KEY = {
|
|
1036
|
+
formBackgroundColor: FORM_CSS_VAR.formBg,
|
|
1037
|
+
inputBgColor: FORM_CSS_VAR.inputBg,
|
|
1038
|
+
inputBorderColor: FORM_CSS_VAR.inputBorder,
|
|
1039
|
+
inputFocusColor: FORM_CSS_VAR.inputFocusBorder,
|
|
1040
|
+
inputTextColor: FORM_CSS_VAR.inputText,
|
|
1041
|
+
placeholderColor: FORM_CSS_VAR.placeholder,
|
|
1042
|
+
labelColor: FORM_CSS_VAR.labelText,
|
|
1043
|
+
errorColor: FORM_CSS_VAR.error,
|
|
1044
|
+
buttonColor: FORM_CSS_VAR.buttonBg,
|
|
1045
|
+
buttonTextColor: FORM_CSS_VAR.buttonText
|
|
1046
|
+
};
|
|
1047
|
+
var FORM_DARK_SCOPE_ATTR = "data-vt-form-dark";
|
|
1048
|
+
var FORM_DARK_TEXT_ATTR = "data-vt-text-dark";
|
|
1049
|
+
var FORM_DARK_TEXT_VAR = "--form-text-dark";
|
|
1050
|
+
var FORM_DEFAULT_DARK_SELECTOR = ".dark";
|
|
1051
|
+
var FORM_ROOT_BG_VAR = `var(${FORM_CSS_VAR.formBg}, inherit)`;
|
|
1052
|
+
function darkVarName(name) {
|
|
1053
|
+
return `${name}-dark`;
|
|
1054
|
+
}
|
|
1055
|
+
function buildColorVars(style, scheme, keys = FORM_STYLE_COLOR_KEYS) {
|
|
1056
|
+
const colors = resolveSchemeColors(style, scheme);
|
|
1057
|
+
const out = {};
|
|
1058
|
+
for (const key of keys) {
|
|
1059
|
+
const value = colors[key];
|
|
1060
|
+
if (!value) continue;
|
|
1061
|
+
const name = COLOR_VAR_BY_KEY[key];
|
|
1062
|
+
out[scheme === "dark" ? darkVarName(name) : name] = value;
|
|
1063
|
+
}
|
|
1064
|
+
return out;
|
|
1065
|
+
}
|
|
752
1066
|
function buildFormCssVars(style, previewBg) {
|
|
1067
|
+
var _a;
|
|
1068
|
+
const light = buildColorVars(style, "light");
|
|
753
1069
|
const out = {};
|
|
754
|
-
const
|
|
755
|
-
if (
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
if (
|
|
761
|
-
|
|
762
|
-
if (
|
|
763
|
-
|
|
764
|
-
if (
|
|
765
|
-
out[
|
|
766
|
-
if (style.labelColor) out[FORM_CSS_VAR.labelText] = style.labelColor;
|
|
767
|
-
if (style.errorColor) out[FORM_CSS_VAR.error] = style.errorColor;
|
|
768
|
-
if (style.buttonColor) out[FORM_CSS_VAR.buttonBg] = style.buttonColor;
|
|
769
|
-
if (style.buttonTextColor)
|
|
770
|
-
out[FORM_CSS_VAR.buttonText] = style.buttonTextColor;
|
|
1070
|
+
const formBg = (_a = light[FORM_CSS_VAR.formBg]) != null ? _a : previewBg;
|
|
1071
|
+
if (formBg) out[FORM_CSS_VAR.formBg] = formBg;
|
|
1072
|
+
for (const [name, value] of Object.entries(light)) {
|
|
1073
|
+
if (name !== FORM_CSS_VAR.formBg) out[name] = value;
|
|
1074
|
+
}
|
|
1075
|
+
const customRadius = resolveCustomRadius(style);
|
|
1076
|
+
if (customRadius) out[FORM_STRUCT_VAR.radius] = customRadius;
|
|
1077
|
+
const customGap = resolveCustomGap(style);
|
|
1078
|
+
if (customGap) out[FORM_STRUCT_VAR.gap] = customGap;
|
|
1079
|
+
const customFocusBorderWidth = resolveCustomFocusBorderWidth(style);
|
|
1080
|
+
if (customFocusBorderWidth)
|
|
1081
|
+
out[FORM_STRUCT_VAR.focusBorderWidth] = customFocusBorderWidth;
|
|
771
1082
|
return out;
|
|
772
1083
|
}
|
|
773
|
-
|
|
774
|
-
|
|
1084
|
+
function buildFormDarkCssVars(style, keys) {
|
|
1085
|
+
return buildColorVars(style, "dark", keys);
|
|
1086
|
+
}
|
|
1087
|
+
function buildDarkSchemeCss(darkSelector = FORM_DEFAULT_DARK_SELECTOR) {
|
|
1088
|
+
const swaps = Object.values(FORM_CSS_VAR).map((name) => `${name}:var(${darkVarName(name)})!important`).join(";");
|
|
1089
|
+
const scope = `${darkSelector} [${FORM_DARK_SCOPE_ATTR}]`;
|
|
1090
|
+
return `${scope}{${swaps}}${scope} [${FORM_DARK_TEXT_ATTR}]{color:var(${FORM_DARK_TEXT_VAR})!important}`;
|
|
1091
|
+
}
|
|
1092
|
+
var FORM_MUTED_TEXT_CLASS = "text-current/65";
|
|
1093
|
+
var FORM_FAINT_TEXT_CLASS = "text-current/45";
|
|
1094
|
+
var FORM_SUBTLE_BORDER_CLASS = "border-current/20";
|
|
1095
|
+
var FORM_SUBTLE_FILL_CLASS = "bg-current/10";
|
|
1096
|
+
var FORM_SUBTLE_HOVER_FILL_CLASS = "hover:bg-current/10";
|
|
1097
|
+
var FormStyleContext = createContext(DEFAULT_FORM_STYLE);
|
|
1098
|
+
var useFormStyle = () => useContext(FormStyleContext);
|
|
1099
|
+
var FormStyleProvider = FormStyleContext.Provider;
|
|
1100
|
+
var FormColorSchemeContext = createContext({
|
|
1101
|
+
darkEnabled: false
|
|
1102
|
+
});
|
|
1103
|
+
var useFormColorScheme = () => useContext(FormColorSchemeContext);
|
|
1104
|
+
var FormColorSchemeProvider = FormColorSchemeContext.Provider;
|
|
775
1105
|
var placeholderClass = "placeholder:[color:var(--form-placeholder,#9ca3af)]";
|
|
776
1106
|
var textClass = "text-[color:var(--form-input-text,inherit)]";
|
|
777
1107
|
function getVariantClasses(style) {
|
|
@@ -808,7 +1138,7 @@ function getVariantClasses(style) {
|
|
|
808
1138
|
case "underlined":
|
|
809
1139
|
return {
|
|
810
1140
|
inputClass: twMerge(
|
|
811
|
-
"rounded-none bg-
|
|
1141
|
+
"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",
|
|
812
1142
|
textClass,
|
|
813
1143
|
placeholderClass
|
|
814
1144
|
),
|
|
@@ -824,7 +1154,7 @@ function getVariantClasses(style) {
|
|
|
824
1154
|
default:
|
|
825
1155
|
return {
|
|
826
1156
|
inputClass: twMerge(
|
|
827
|
-
"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-
|
|
1157
|
+
"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",
|
|
828
1158
|
textClass,
|
|
829
1159
|
placeholderClass
|
|
830
1160
|
),
|
|
@@ -833,19 +1163,23 @@ function getVariantClasses(style) {
|
|
|
833
1163
|
borderWidth: 1,
|
|
834
1164
|
borderColor: FORM_VAR.inputBorder
|
|
835
1165
|
},
|
|
836
|
-
// Label must paint a solid bg on top of the input border.
|
|
837
|
-
//
|
|
838
|
-
//
|
|
839
|
-
//
|
|
840
|
-
//
|
|
841
|
-
//
|
|
1166
|
+
// Label must paint a solid bg on top of the input border. It reads
|
|
1167
|
+
// `--form-input-bg`, which DynamicForm publishes on the form root
|
|
1168
|
+
// from the resolved input background (or the editor preview
|
|
1169
|
+
// override). The fallback is `inherit`, and it now resolves to a
|
|
1170
|
+
// real color: every element from the form root down to this span
|
|
1171
|
+
// carries `bg-inherit`, so an unstyled form picks up whatever
|
|
1172
|
+
// background the consumer's container paints. See the chain note in
|
|
1173
|
+
// DynamicForm.
|
|
842
1174
|
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]"
|
|
843
1175
|
};
|
|
844
1176
|
}
|
|
845
1177
|
}
|
|
846
1178
|
function getFocusStyle(style) {
|
|
847
1179
|
if (style.inputVariant === "filled" || style.inputVariant === "underlined") {
|
|
848
|
-
return {
|
|
1180
|
+
return __spreadValues({
|
|
1181
|
+
borderBottomColor: FORM_VAR.inputFocusBorder
|
|
1182
|
+
}, resolveCustomFocusBorderWidth(style) ? { borderBottomWidth: FORM_FOCUS_BORDER_WIDTH_VAR } : {});
|
|
849
1183
|
}
|
|
850
1184
|
if (style.inputVariant === "stacked") {
|
|
851
1185
|
return {
|
|
@@ -859,13 +1193,19 @@ function useInputStyles() {
|
|
|
859
1193
|
const style = useFormStyle();
|
|
860
1194
|
const variant = getVariantClasses(style);
|
|
861
1195
|
const isStacked = style.inputVariant === "stacked";
|
|
1196
|
+
const customRadius = resolveCustomRadius(style);
|
|
1197
|
+
const radiusStyle = customRadius ? { borderRadius: FORM_RADIUS_VAR } : {};
|
|
1198
|
+
const radiusClass = customRadius ? "rounded-none" : "";
|
|
862
1199
|
return {
|
|
863
|
-
|
|
864
|
-
|
|
1200
|
+
// `bg-inherit` keeps the form root's background flowing down to the
|
|
1201
|
+
// inputs and floating labels, which resolve theirs with `inherit`.
|
|
1202
|
+
wrapperClass: isStacked ? "flex w-full flex-col bg-inherit" : "group relative flex w-full flex-col pt-3 bg-inherit",
|
|
1203
|
+
inputClass: isStacked ? twMerge("block w-full", variant.inputClass, radiusClass) : twMerge(
|
|
865
1204
|
"peer m-0 mb-3 block min-h-8 w-full overflow-hidden",
|
|
866
|
-
variant.inputClass
|
|
1205
|
+
variant.inputClass,
|
|
1206
|
+
radiusClass
|
|
867
1207
|
),
|
|
868
|
-
inputStyle: variant.inputStyle,
|
|
1208
|
+
inputStyle: __spreadValues(__spreadValues({}, variant.inputStyle), radiusStyle),
|
|
869
1209
|
inputFocusStyle: getFocusStyle(style),
|
|
870
1210
|
labelClass: variant.labelClass,
|
|
871
1211
|
labelStyle: { color: FORM_VAR.labelText },
|
|
@@ -874,8 +1214,9 @@ function useInputStyles() {
|
|
|
874
1214
|
isStacked
|
|
875
1215
|
};
|
|
876
1216
|
}
|
|
877
|
-
function getErrorOutlineStyle(hasError,
|
|
1217
|
+
function getErrorOutlineStyle(hasError, style) {
|
|
878
1218
|
if (!hasError) return {};
|
|
1219
|
+
const variant = style.inputVariant;
|
|
879
1220
|
if (variant === "stacked") {
|
|
880
1221
|
return {
|
|
881
1222
|
outline: `2px solid ${FORM_VAR.error}`,
|
|
@@ -889,9 +1230,9 @@ function getErrorOutlineStyle(hasError, variant) {
|
|
|
889
1230
|
borderColor: FORM_VAR.error
|
|
890
1231
|
};
|
|
891
1232
|
}
|
|
892
|
-
return {
|
|
1233
|
+
return __spreadValues({
|
|
893
1234
|
borderBottomColor: FORM_VAR.error
|
|
894
|
-
};
|
|
1235
|
+
}, resolveCustomFocusBorderWidth(style) ? { borderBottomWidth: FORM_FOCUS_BORDER_WIDTH_VAR } : {});
|
|
895
1236
|
}
|
|
896
1237
|
var StyledInput = ({
|
|
897
1238
|
id,
|
|
@@ -909,7 +1250,7 @@ var StyledInput = ({
|
|
|
909
1250
|
const style = useFormStyle();
|
|
910
1251
|
const styles = useInputStyles();
|
|
911
1252
|
const hasError = !!(error && touched);
|
|
912
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, style
|
|
1253
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, style));
|
|
913
1254
|
if (styles.isStacked) {
|
|
914
1255
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapperClass, children: [
|
|
915
1256
|
/* @__PURE__ */ jsx("label", { htmlFor: id, className: styles.labelClass, style: styles.labelStyle, children: label }),
|
|
@@ -935,7 +1276,7 @@ var StyledInput = ({
|
|
|
935
1276
|
hasError && /* @__PURE__ */ jsx(
|
|
936
1277
|
"span",
|
|
937
1278
|
{
|
|
938
|
-
className:
|
|
1279
|
+
className: "mt-1 text-xs",
|
|
939
1280
|
style: styles.errorStyle,
|
|
940
1281
|
children: error
|
|
941
1282
|
}
|
|
@@ -943,7 +1284,7 @@ var StyledInput = ({
|
|
|
943
1284
|
] });
|
|
944
1285
|
}
|
|
945
1286
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapperClass, children: [
|
|
946
|
-
/* @__PURE__ */ jsxs("label", { htmlFor: id, className: "relative inline-block", children: [
|
|
1287
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, className: "relative inline-block bg-inherit", children: [
|
|
947
1288
|
/* @__PURE__ */ jsx(
|
|
948
1289
|
"input",
|
|
949
1290
|
{
|
|
@@ -965,7 +1306,7 @@ var StyledInput = ({
|
|
|
965
1306
|
),
|
|
966
1307
|
/* @__PURE__ */ jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: label })
|
|
967
1308
|
] }),
|
|
968
|
-
hasError && /* @__PURE__ */ jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: error })
|
|
1309
|
+
hasError && /* @__PURE__ */ jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: error })
|
|
969
1310
|
] });
|
|
970
1311
|
};
|
|
971
1312
|
var TextField = ({ field: fieldDef, disabled }) => {
|
|
@@ -1014,7 +1355,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
|
|
|
1014
1355
|
const formStyle = useFormStyle();
|
|
1015
1356
|
const styles = useInputStyles();
|
|
1016
1357
|
const hasError = !!(meta.error && meta.touched);
|
|
1017
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
1358
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
|
|
1018
1359
|
const handleChange = (e) => {
|
|
1019
1360
|
helpers.setValue(formatUsPhone(e.target.value));
|
|
1020
1361
|
};
|
|
@@ -1051,7 +1392,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
|
|
|
1051
1392
|
hasError && /* @__PURE__ */ jsx(
|
|
1052
1393
|
"span",
|
|
1053
1394
|
{
|
|
1054
|
-
className:
|
|
1395
|
+
className: "mt-1 text-xs",
|
|
1055
1396
|
style: styles.errorStyle,
|
|
1056
1397
|
children: meta.error
|
|
1057
1398
|
}
|
|
@@ -1080,7 +1421,7 @@ var PhoneField = ({ field: fieldDef, disabled }) => {
|
|
|
1080
1421
|
),
|
|
1081
1422
|
/* @__PURE__ */ jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label })
|
|
1082
1423
|
] }),
|
|
1083
|
-
hasError && /* @__PURE__ */ jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
1424
|
+
hasError && /* @__PURE__ */ jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
1084
1425
|
] });
|
|
1085
1426
|
};
|
|
1086
1427
|
var UrlField = ({ field: fieldDef, disabled }) => {
|
|
@@ -1112,7 +1453,7 @@ var AddressField = ({ field: fieldDef, disabled }) => {
|
|
|
1112
1453
|
const formStyle = useFormStyle();
|
|
1113
1454
|
const styles = useInputStyles();
|
|
1114
1455
|
const hasError = !!(meta.error && meta.touched);
|
|
1115
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
1456
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
|
|
1116
1457
|
const placeholder = fieldDef.placeholder || "123 Main St, City, State 12345";
|
|
1117
1458
|
return /* @__PURE__ */ jsxs("div", { className: `${styles.wrapperClass} pb-5 lg:pb-0`, children: [
|
|
1118
1459
|
/* @__PURE__ */ jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block bg-inherit", children: [
|
|
@@ -1153,7 +1494,7 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
|
|
|
1153
1494
|
const styles = useInputStyles();
|
|
1154
1495
|
const hasError = !!(meta.error && meta.touched);
|
|
1155
1496
|
const value = (_a = field.value) != null ? _a : "";
|
|
1156
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
1497
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
|
|
1157
1498
|
if (styles.isStacked) {
|
|
1158
1499
|
return /* @__PURE__ */ jsxs("div", { className: twMerge(styles.wrapperClass, "relative"), children: [
|
|
1159
1500
|
/* @__PURE__ */ jsx(
|
|
@@ -1184,11 +1525,20 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
|
|
|
1184
1525
|
}
|
|
1185
1526
|
}
|
|
1186
1527
|
),
|
|
1187
|
-
fieldDef.characterCounter && /* @__PURE__ */ jsx(
|
|
1528
|
+
fieldDef.characterCounter && /* @__PURE__ */ jsx(
|
|
1529
|
+
"span",
|
|
1530
|
+
{
|
|
1531
|
+
className: twMerge(
|
|
1532
|
+
"mt-1 text-right text-xs",
|
|
1533
|
+
FORM_MUTED_TEXT_CLASS
|
|
1534
|
+
),
|
|
1535
|
+
children: value.length
|
|
1536
|
+
}
|
|
1537
|
+
),
|
|
1188
1538
|
hasError && /* @__PURE__ */ jsx(
|
|
1189
1539
|
"span",
|
|
1190
1540
|
{
|
|
1191
|
-
className:
|
|
1541
|
+
className: "mt-1 text-xs",
|
|
1192
1542
|
style: styles.errorStyle,
|
|
1193
1543
|
children: meta.error
|
|
1194
1544
|
}
|
|
@@ -1196,7 +1546,7 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
|
|
|
1196
1546
|
] });
|
|
1197
1547
|
}
|
|
1198
1548
|
return /* @__PURE__ */ jsxs("div", { className: twMerge(styles.wrapperClass, "pb-5 lg:pb-0"), children: [
|
|
1199
|
-
/* @__PURE__ */ jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block", children: [
|
|
1549
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: fieldDef.id, className: "relative inline-block bg-inherit", children: [
|
|
1200
1550
|
/* @__PURE__ */ jsx(
|
|
1201
1551
|
"textarea",
|
|
1202
1552
|
{
|
|
@@ -1222,20 +1572,29 @@ var TextAreaField = ({ field: fieldDef, disabled }) => {
|
|
|
1222
1572
|
hasError && /* @__PURE__ */ jsx("span", { className: "text-xs", style: styles.errorStyle, children: meta.error })
|
|
1223
1573
|
] });
|
|
1224
1574
|
};
|
|
1575
|
+
var POPOVER_COLOR_KEYS = [
|
|
1576
|
+
"inputBgColor",
|
|
1577
|
+
"inputBorderColor",
|
|
1578
|
+
"inputTextColor",
|
|
1579
|
+
"inputFocusColor"
|
|
1580
|
+
];
|
|
1225
1581
|
var SelectField = ({ field: fieldDef, disabled }) => {
|
|
1226
1582
|
var _a;
|
|
1227
1583
|
const [field, meta, helpers] = useField(fieldDef.id);
|
|
1228
1584
|
const [focused, setFocused] = useState(false);
|
|
1229
1585
|
const formStyle = useFormStyle();
|
|
1586
|
+
const { darkEnabled } = useFormColorScheme();
|
|
1230
1587
|
const styles = useInputStyles();
|
|
1231
1588
|
const hasError = !!(meta.error && meta.touched);
|
|
1589
|
+
const popoverVars = __spreadValues(__spreadValues({}, buildColorVars(formStyle, "light", POPOVER_COLOR_KEYS)), darkEnabled ? buildColorVars(formStyle, "dark", POPOVER_COLOR_KEYS) : {});
|
|
1590
|
+
const popoverScopeAttr = darkEnabled ? { [FORM_DARK_SCOPE_ATTR]: "" } : {};
|
|
1232
1591
|
const [currentValue, setCurrentValue] = useState(field.value || "");
|
|
1233
1592
|
useEffect(() => {
|
|
1234
1593
|
setCurrentValue(field.value || "");
|
|
1235
1594
|
}, [field.value]);
|
|
1236
1595
|
const options = (fieldDef.options || []).filter((opt) => opt.value !== "");
|
|
1237
1596
|
const displayName = ((_a = options.find((opt) => opt.value === currentValue)) == null ? void 0 : _a.label) || "";
|
|
1238
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
1597
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
|
|
1239
1598
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapperClass, children: [
|
|
1240
1599
|
/* @__PURE__ */ jsxs(
|
|
1241
1600
|
Select.Root,
|
|
@@ -1247,43 +1606,43 @@ var SelectField = ({ field: fieldDef, disabled }) => {
|
|
|
1247
1606
|
},
|
|
1248
1607
|
value: currentValue,
|
|
1249
1608
|
children: [
|
|
1250
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsxs(
|
|
1251
1610
|
"label",
|
|
1252
1611
|
{
|
|
1253
1612
|
htmlFor: fieldDef.id,
|
|
1254
1613
|
className: "relative block bg-inherit",
|
|
1255
|
-
children:
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1614
|
+
children: [
|
|
1615
|
+
/* @__PURE__ */ jsxs(
|
|
1616
|
+
Select.Trigger,
|
|
1617
|
+
{
|
|
1618
|
+
className: `${styles.inputClass} relative cursor-pointer text-left`,
|
|
1619
|
+
style: borderStyle,
|
|
1620
|
+
"aria-label": fieldDef.label,
|
|
1621
|
+
onFocus: () => setFocused(true),
|
|
1622
|
+
onBlur: () => {
|
|
1623
|
+
setFocused(false);
|
|
1624
|
+
helpers.setTouched(true);
|
|
1625
|
+
},
|
|
1626
|
+
children: [
|
|
1627
|
+
/* @__PURE__ */ jsx(Select.Value, { placeholder: "Choose an option", children: /* @__PURE__ */ jsx("span", { className: "block truncate", children: displayName }) }),
|
|
1628
|
+
/* @__PURE__ */ jsx(Select.Icon, { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx(BsChevronDown, { style: { color: FORM_VAR.placeholder } }) })
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
),
|
|
1632
|
+
/* @__PURE__ */ jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label })
|
|
1633
|
+
]
|
|
1273
1634
|
}
|
|
1274
1635
|
),
|
|
1275
1636
|
/* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsxs(
|
|
1276
1637
|
Select.Content,
|
|
1277
|
-
{
|
|
1638
|
+
__spreadProps(__spreadValues({
|
|
1278
1639
|
className: "z-20 rounded-md border p-3 shadow-lg",
|
|
1279
|
-
style: {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
color: formStyle.inputTextColor || "#1f2937"
|
|
1286
|
-
},
|
|
1640
|
+
style: __spreadProps(__spreadValues({}, popoverVars), {
|
|
1641
|
+
backgroundColor: `var(${FORM_CSS_VAR.inputBg}, #ffffff)`,
|
|
1642
|
+
borderColor: `var(${FORM_CSS_VAR.inputBorder}, #e5e7eb)`,
|
|
1643
|
+
color: `var(${FORM_CSS_VAR.inputText}, #1f2937)`
|
|
1644
|
+
})
|
|
1645
|
+
}, popoverScopeAttr), {
|
|
1287
1646
|
children: [
|
|
1288
1647
|
/* @__PURE__ */ jsx(Select.ScrollUpButton, { children: /* @__PURE__ */ jsx(BsChevronDown, { className: "rotate-180" }) }),
|
|
1289
1648
|
/* @__PURE__ */ jsx(Select.Viewport, { children: /* @__PURE__ */ jsx(Select.Group, { children: options.map((opt) => /* @__PURE__ */ jsxs(
|
|
@@ -1291,7 +1650,7 @@ var SelectField = ({ field: fieldDef, disabled }) => {
|
|
|
1291
1650
|
{
|
|
1292
1651
|
className: "relative m-1 flex cursor-pointer select-none justify-between rounded p-1 pr-8 hover:ring-1 focus:ring-1",
|
|
1293
1652
|
style: {
|
|
1294
|
-
"--tw-ring-color":
|
|
1653
|
+
"--tw-ring-color": `var(${FORM_CSS_VAR.inputFocusBorder}, #2563eb)`
|
|
1295
1654
|
},
|
|
1296
1655
|
value: opt.value,
|
|
1297
1656
|
children: [
|
|
@@ -1303,7 +1662,7 @@ var SelectField = ({ field: fieldDef, disabled }) => {
|
|
|
1303
1662
|
)) }) }),
|
|
1304
1663
|
/* @__PURE__ */ jsx(Select.ScrollDownButton, { children: /* @__PURE__ */ jsx(BsChevronDown, {}) })
|
|
1305
1664
|
]
|
|
1306
|
-
}
|
|
1665
|
+
})
|
|
1307
1666
|
) })
|
|
1308
1667
|
]
|
|
1309
1668
|
}
|
|
@@ -1316,11 +1675,19 @@ var CheckboxField = ({ field: fieldDef }) => {
|
|
|
1316
1675
|
const formStyle = useFormStyle();
|
|
1317
1676
|
const isChecked = field.value === true;
|
|
1318
1677
|
const isStacked = formStyle.inputVariant === "stacked";
|
|
1319
|
-
const
|
|
1678
|
+
const radiusStyle = resolveCustomRadius(formStyle) ? { borderRadius: FORM_RADIUS_VAR } : {};
|
|
1679
|
+
const checkboxStyle = isChecked ? __spreadProps(__spreadValues({}, radiusStyle), {
|
|
1680
|
+
borderColor: FORM_VAR.inputFocusBorder,
|
|
1681
|
+
backgroundColor: FORM_VAR.inputFocusBorder
|
|
1682
|
+
}) : __spreadProps(__spreadValues({}, radiusStyle), {
|
|
1683
|
+
borderColor: FORM_VAR.inputBorder,
|
|
1684
|
+
backgroundColor: FORM_VAR.inputBg
|
|
1685
|
+
});
|
|
1320
1686
|
return /* @__PURE__ */ jsxs(
|
|
1321
1687
|
"div",
|
|
1322
1688
|
{
|
|
1323
1689
|
className: twMerge(
|
|
1690
|
+
"bg-inherit",
|
|
1324
1691
|
isStacked ? "flex items-start gap-3" : "flex items-center gap-3 pt-3"
|
|
1325
1692
|
),
|
|
1326
1693
|
children: [
|
|
@@ -1334,8 +1701,8 @@ var CheckboxField = ({ field: fieldDef }) => {
|
|
|
1334
1701
|
helpers.setTouched(true, false);
|
|
1335
1702
|
},
|
|
1336
1703
|
className: twMerge(
|
|
1337
|
-
"flex h-5 w-5 items-center justify-center rounded border",
|
|
1338
|
-
isStacked && "mt-0.5
|
|
1704
|
+
"flex h-5 w-5 shrink-0 items-center justify-center rounded border",
|
|
1705
|
+
isStacked && "mt-0.5"
|
|
1339
1706
|
),
|
|
1340
1707
|
style: checkboxStyle,
|
|
1341
1708
|
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(BsCheck, { className: "text-white" }) })
|
|
@@ -1345,7 +1712,7 @@ var CheckboxField = ({ field: fieldDef }) => {
|
|
|
1345
1712
|
"label",
|
|
1346
1713
|
{
|
|
1347
1714
|
htmlFor: fieldDef.id,
|
|
1348
|
-
className: "cursor-pointer text-sm",
|
|
1715
|
+
className: "min-w-0 cursor-pointer text-sm",
|
|
1349
1716
|
style: { color: FORM_VAR.labelText },
|
|
1350
1717
|
children: fieldDef.label
|
|
1351
1718
|
}
|
|
@@ -1357,7 +1724,7 @@ var CheckboxField = ({ field: fieldDef }) => {
|
|
|
1357
1724
|
};
|
|
1358
1725
|
var RadioField = ({ field: fieldDef, disabled }) => {
|
|
1359
1726
|
const [field, meta, helpers] = useField(fieldDef.id);
|
|
1360
|
-
return /* @__PURE__ */ jsxs("div", { className: "pt-3", children: [
|
|
1727
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-inherit pt-3", children: [
|
|
1361
1728
|
/* @__PURE__ */ jsx(
|
|
1362
1729
|
"span",
|
|
1363
1730
|
{
|
|
@@ -1375,10 +1742,10 @@ var RadioField = ({ field: fieldDef, disabled }) => {
|
|
|
1375
1742
|
helpers.setValue(value);
|
|
1376
1743
|
helpers.setTouched(true, false);
|
|
1377
1744
|
},
|
|
1378
|
-
className: "flex flex-col gap-2",
|
|
1745
|
+
className: "flex flex-col gap-2 bg-inherit",
|
|
1379
1746
|
children: (fieldDef.options || []).map((opt) => {
|
|
1380
1747
|
const isSelected = field.value === opt.value;
|
|
1381
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1748
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 bg-inherit", children: [
|
|
1382
1749
|
/* @__PURE__ */ jsx(
|
|
1383
1750
|
RadioGroup.Item,
|
|
1384
1751
|
{
|
|
@@ -1437,13 +1804,126 @@ function nextBusinessDay(from) {
|
|
|
1437
1804
|
while (isWeekend(d)) d = addDays(d, 1);
|
|
1438
1805
|
return d;
|
|
1439
1806
|
}
|
|
1440
|
-
function
|
|
1807
|
+
function timeOnDay(value, onDay) {
|
|
1808
|
+
const parsed = parse(value, "HH:mm", onDay);
|
|
1809
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
1810
|
+
}
|
|
1811
|
+
function minutesOfDay(d) {
|
|
1812
|
+
return d.getHours() * 60 + d.getMinutes();
|
|
1813
|
+
}
|
|
1814
|
+
function minutesOfString(value) {
|
|
1815
|
+
const m = /^(\d{2}):(\d{2})$/.exec(value);
|
|
1816
|
+
if (!m) return null;
|
|
1817
|
+
const mins = Number(m[1]) * 60 + Number(m[2]);
|
|
1818
|
+
return Number.isFinite(mins) ? mins : null;
|
|
1819
|
+
}
|
|
1820
|
+
function windowOnDay(config, day) {
|
|
1821
|
+
const base = set(day, { seconds: 0, milliseconds: 0 });
|
|
1822
|
+
const min = (config == null ? void 0 : config.minTime) ? timeOnDay(config.minTime, base) : set(base, { hours: 0, minutes: 0 });
|
|
1823
|
+
const max = (config == null ? void 0 : config.maxTime) ? timeOnDay(config.maxTime, base) : set(base, { hours: 23, minutes: 59 });
|
|
1824
|
+
if (!min || !max || max < min) return null;
|
|
1825
|
+
return { min, max };
|
|
1826
|
+
}
|
|
1827
|
+
function lastSlotOnDay(config, day) {
|
|
1828
|
+
var _a;
|
|
1829
|
+
const bounds = windowOnDay(config, day);
|
|
1830
|
+
if (!bounds) return null;
|
|
1831
|
+
const intervalMs = Math.max(1, (_a = config == null ? void 0 : config.timeIntervals) != null ? _a : 30) * 6e4;
|
|
1832
|
+
const steps = Math.floor(
|
|
1833
|
+
(bounds.max.getTime() - bounds.min.getTime()) / intervalMs
|
|
1834
|
+
);
|
|
1835
|
+
return new Date(bounds.min.getTime() + steps * intervalMs);
|
|
1836
|
+
}
|
|
1837
|
+
function rangesOnDay(config, day) {
|
|
1838
|
+
const ranges = config == null ? void 0 : config.excludeTimeRanges;
|
|
1839
|
+
if (!ranges || ranges.length === 0) return [];
|
|
1840
|
+
const key = format(day, "yyyy-MM-dd");
|
|
1841
|
+
return ranges.filter((r) => r && r.date === key);
|
|
1842
|
+
}
|
|
1843
|
+
function isTimeExcluded(config, slot) {
|
|
1844
|
+
const ranges = rangesOnDay(config, slot);
|
|
1845
|
+
if (ranges.length === 0) return false;
|
|
1846
|
+
const at = minutesOfDay(slot);
|
|
1847
|
+
return ranges.some((r) => {
|
|
1848
|
+
const from = minutesOfString(r.from);
|
|
1849
|
+
const to = minutesOfString(r.to);
|
|
1850
|
+
if (from === null || to === null || to <= from) return false;
|
|
1851
|
+
return at >= from && at < to;
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
function hasSelectableSlot(config, day, options = {}, now = /* @__PURE__ */ new Date()) {
|
|
1855
|
+
var _a, _b, _c;
|
|
1856
|
+
const bounds = windowOnDay(config, day);
|
|
1857
|
+
if (!bounds) return true;
|
|
1858
|
+
const filterPast = (_b = (_a = options.filterPastTimes) != null ? _a : config == null ? void 0 : config.filterPastTimes) != null ? _b : true;
|
|
1859
|
+
const intervalMs = Math.max(1, (_c = config == null ? void 0 : config.timeIntervals) != null ? _c : 30) * 6e4;
|
|
1860
|
+
const last = lastSlotOnDay(config, day);
|
|
1861
|
+
if (!last) return true;
|
|
1862
|
+
for (let t = bounds.min.getTime(); t <= last.getTime(); t += intervalMs) {
|
|
1863
|
+
const slot = new Date(t);
|
|
1864
|
+
if (filterPast && slot.getTime() < now.getTime()) continue;
|
|
1865
|
+
if (isTimeExcluded(config, slot)) continue;
|
|
1866
|
+
return true;
|
|
1867
|
+
}
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
function isDayExcluded(config, date, now = /* @__PURE__ */ new Date()) {
|
|
1441
1871
|
var _a, _b, _c, _d;
|
|
1872
|
+
if (((_a = config == null ? void 0 : config.excludeWeekends) != null ? _a : false) && isWeekend(date)) return true;
|
|
1873
|
+
if (((_b = config == null ? void 0 : config.excludeToday) != null ? _b : false) && isSameDay(date, now)) return true;
|
|
1874
|
+
if (((_c = config == null ? void 0 : config.excludeTomorrow) != null ? _c : false) && isSameDay(date, addDays(now, 1))) {
|
|
1875
|
+
return true;
|
|
1876
|
+
}
|
|
1877
|
+
if (((_d = config == null ? void 0 : config.excludeNextBusinessDay) != null ? _d : false) && isSameDay(date, nextBusinessDay(now))) {
|
|
1878
|
+
return true;
|
|
1879
|
+
}
|
|
1880
|
+
const named = config == null ? void 0 : config.excludeDates;
|
|
1881
|
+
if (named && named.length > 0) {
|
|
1882
|
+
const key = format(date, "yyyy-MM-dd");
|
|
1883
|
+
if (named.some((d) => d === key)) return true;
|
|
1884
|
+
}
|
|
1885
|
+
return false;
|
|
1886
|
+
}
|
|
1887
|
+
function buildTimeFilter(config, options = {}) {
|
|
1888
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1889
|
+
if (!((_b = (_a = options.showTimeSelect) != null ? _a : config == null ? void 0 : config.showTimeSelect) != null ? _b : true)) return void 0;
|
|
1890
|
+
const filterPast = (_d = (_c = options.filterPastTimes) != null ? _c : config == null ? void 0 : config.filterPastTimes) != null ? _d : true;
|
|
1891
|
+
const hasRanges = ((_f = (_e = config == null ? void 0 : config.excludeTimeRanges) == null ? void 0 : _e.length) != null ? _f : 0) > 0;
|
|
1892
|
+
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;
|
|
1893
|
+
if (!filterPast && !hasRanges && !hasDayRules) return void 0;
|
|
1894
|
+
return (time) => {
|
|
1895
|
+
const now = /* @__PURE__ */ new Date();
|
|
1896
|
+
if (filterPast && time.getTime() < now.getTime()) return false;
|
|
1897
|
+
if (hasDayRules && isDayExcluded(config, time, now)) return false;
|
|
1898
|
+
if (hasRanges && isTimeExcluded(config, time)) return false;
|
|
1899
|
+
return true;
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
function firstSelectableDay(config, options = {}, from = /* @__PURE__ */ new Date(), limit = 370) {
|
|
1903
|
+
const filter = buildDateFilter(config, options);
|
|
1904
|
+
let day = new Date(from.getFullYear(), from.getMonth(), from.getDate());
|
|
1905
|
+
for (let i = 0; i < limit; i += 1) {
|
|
1906
|
+
if (!filter || filter(day)) return day;
|
|
1907
|
+
day = addDays(day, 1);
|
|
1908
|
+
}
|
|
1909
|
+
return null;
|
|
1910
|
+
}
|
|
1911
|
+
function buildDateFilter(config, options = {}) {
|
|
1912
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1442
1913
|
const excludeWeekends = (_a = config == null ? void 0 : config.excludeWeekends) != null ? _a : false;
|
|
1443
1914
|
const excludeToday = (_b = config == null ? void 0 : config.excludeToday) != null ? _b : false;
|
|
1444
1915
|
const excludeTomorrow = (_c = config == null ? void 0 : config.excludeTomorrow) != null ? _c : false;
|
|
1445
1916
|
const excludeNext = (_d = config == null ? void 0 : config.excludeNextBusinessDay) != null ? _d : false;
|
|
1446
|
-
|
|
1917
|
+
const excludedDays = new Set(
|
|
1918
|
+
((_e = config == null ? void 0 : config.excludeDates) != null ? _e : []).filter(
|
|
1919
|
+
(d) => typeof d === "string" && d.length === 10
|
|
1920
|
+
)
|
|
1921
|
+
);
|
|
1922
|
+
const timeSelect = (_g = (_f = options.showTimeSelect) != null ? _f : config == null ? void 0 : config.showTimeSelect) != null ? _g : true;
|
|
1923
|
+
const filterPast = (_i = (_h = options.filterPastTimes) != null ? _h : config == null ? void 0 : config.filterPastTimes) != null ? _i : true;
|
|
1924
|
+
const hasRanges = ((_k = (_j = config == null ? void 0 : config.excludeTimeRanges) == null ? void 0 : _j.length) != null ? _k : 0) > 0;
|
|
1925
|
+
const checkSlots = timeSelect && (filterPast || hasRanges);
|
|
1926
|
+
if (!excludeWeekends && !excludeToday && !excludeTomorrow && !excludeNext && !checkSlots && excludedDays.size === 0) {
|
|
1447
1927
|
return void 0;
|
|
1448
1928
|
}
|
|
1449
1929
|
return (date) => {
|
|
@@ -1452,6 +1932,15 @@ function buildDateFilter(config) {
|
|
|
1452
1932
|
if (excludeToday && isSameDay(date, now)) return false;
|
|
1453
1933
|
if (excludeTomorrow && isSameDay(date, addDays(now, 1))) return false;
|
|
1454
1934
|
if (excludeNext && isSameDay(date, nextBusinessDay(now))) return false;
|
|
1935
|
+
if (excludedDays.size > 0 && excludedDays.has(format(date, "yyyy-MM-dd"))) {
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1938
|
+
if (checkSlots) {
|
|
1939
|
+
const needsCheck = filterPast && isSameDay(date, now) || hasRanges && rangesOnDay(config, date).length > 0;
|
|
1940
|
+
if (needsCheck && !hasSelectableSlot(config, date, options, now)) {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1455
1944
|
return true;
|
|
1456
1945
|
};
|
|
1457
1946
|
}
|
|
@@ -1475,7 +1964,7 @@ var DateTimeField = ({
|
|
|
1475
1964
|
dateOnly = false,
|
|
1476
1965
|
disabled
|
|
1477
1966
|
}) => {
|
|
1478
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1967
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1479
1968
|
const [field, meta, helpers] = useField(fieldDef.id);
|
|
1480
1969
|
const [focused, setFocused] = useState(false);
|
|
1481
1970
|
const formStyle = useFormStyle();
|
|
@@ -1492,11 +1981,15 @@ var DateTimeField = ({
|
|
|
1492
1981
|
const maxTime = showTimeSelect ? parseTimeString(config.maxTime, 23, 59) : void 0;
|
|
1493
1982
|
const minDate = excludePastDates ? /* @__PURE__ */ new Date() : void 0;
|
|
1494
1983
|
const selected = parseStoredValue(field.value);
|
|
1495
|
-
const filterDate = buildDateFilter(config
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1984
|
+
const filterDate = buildDateFilter(config, {
|
|
1985
|
+
showTimeSelect,
|
|
1986
|
+
filterPastTimes
|
|
1987
|
+
});
|
|
1988
|
+
const filterTime = buildTimeFilter(config, {
|
|
1989
|
+
showTimeSelect,
|
|
1990
|
+
filterPastTimes
|
|
1991
|
+
});
|
|
1992
|
+
const openToDate = selected || !filterDate ? void 0 : (_i = firstSelectableDay(config, { showTimeSelect, filterPastTimes })) != null ? _i : void 0;
|
|
1500
1993
|
const handleChange = (date) => {
|
|
1501
1994
|
if (!date) {
|
|
1502
1995
|
helpers.setValue("");
|
|
@@ -1504,11 +1997,15 @@ var DateTimeField = ({
|
|
|
1504
1997
|
}
|
|
1505
1998
|
helpers.setValue(dateOnly ? format(date, "yyyy-MM-dd") : date.toISOString());
|
|
1506
1999
|
};
|
|
1507
|
-
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
1508
|
-
const pickerProps = {
|
|
2000
|
+
const borderStyle = __spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle));
|
|
2001
|
+
const pickerProps = __spreadProps(__spreadValues({
|
|
1509
2002
|
id: fieldDef.id,
|
|
1510
2003
|
name: fieldDef.id,
|
|
1511
2004
|
wrapperClassName: "block w-full",
|
|
2005
|
+
// react-datepicker's stylesheet pins the popper at z-index 1, below the
|
|
2006
|
+
// z-10 floating labels in useInputStyles — neighboring fields' labels
|
|
2007
|
+
// would paint over the open calendar.
|
|
2008
|
+
popperClassName: "!z-50",
|
|
1512
2009
|
disabled,
|
|
1513
2010
|
selected,
|
|
1514
2011
|
onChange: handleChange,
|
|
@@ -1519,15 +2016,16 @@ var DateTimeField = ({
|
|
|
1519
2016
|
},
|
|
1520
2017
|
showTimeSelect,
|
|
1521
2018
|
timeIntervals,
|
|
1522
|
-
minDate
|
|
2019
|
+
minDate
|
|
2020
|
+
}, openToDate ? { openToDate } : {}), {
|
|
1523
2021
|
minTime,
|
|
1524
2022
|
maxTime,
|
|
1525
2023
|
filterDate,
|
|
1526
|
-
filterTime
|
|
2024
|
+
filterTime,
|
|
1527
2025
|
dateFormat,
|
|
1528
2026
|
placeholderText,
|
|
1529
2027
|
autoComplete: "off"
|
|
1530
|
-
};
|
|
2028
|
+
});
|
|
1531
2029
|
if (styles.isStacked) {
|
|
1532
2030
|
return /* @__PURE__ */ jsxs("div", { className: styles.wrapperClass, children: [
|
|
1533
2031
|
/* @__PURE__ */ jsx(
|
|
@@ -1554,7 +2052,7 @@ var DateTimeField = ({
|
|
|
1554
2052
|
hasError && /* @__PURE__ */ jsx(
|
|
1555
2053
|
"span",
|
|
1556
2054
|
{
|
|
1557
|
-
className:
|
|
2055
|
+
className: "mt-1 text-xs",
|
|
1558
2056
|
style: styles.errorStyle,
|
|
1559
2057
|
children: meta.error
|
|
1560
2058
|
}
|
|
@@ -1592,7 +2090,7 @@ var DateTimeField = ({
|
|
|
1592
2090
|
}
|
|
1593
2091
|
)
|
|
1594
2092
|
] }),
|
|
1595
|
-
hasError && /* @__PURE__ */ jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
2093
|
+
hasError && /* @__PURE__ */ jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
1596
2094
|
] });
|
|
1597
2095
|
};
|
|
1598
2096
|
var DateField = ({ field, disabled }) => {
|
|
@@ -1618,13 +2116,12 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1618
2116
|
);
|
|
1619
2117
|
helpers.setValue(next);
|
|
1620
2118
|
};
|
|
1621
|
-
const borderStyle = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle
|
|
2119
|
+
const borderStyle = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles.inputStyle), focused ? styles.inputFocusStyle : {}), getErrorOutlineStyle(hasError, formStyle)), {
|
|
1622
2120
|
paddingRight: "2.75rem"
|
|
1623
2121
|
});
|
|
1624
2122
|
const inputType = reveal ? "text" : "password";
|
|
1625
2123
|
const inputProps = {
|
|
1626
2124
|
id: fieldDef.id,
|
|
1627
|
-
name: fieldDef.id,
|
|
1628
2125
|
type: inputType,
|
|
1629
2126
|
disabled,
|
|
1630
2127
|
autoComplete: "off",
|
|
@@ -1633,9 +2130,9 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1633
2130
|
value: field.value,
|
|
1634
2131
|
onChange: handleChange,
|
|
1635
2132
|
onFocus: () => setFocused(true),
|
|
1636
|
-
onBlur: (
|
|
2133
|
+
onBlur: () => {
|
|
1637
2134
|
setFocused(false);
|
|
1638
|
-
|
|
2135
|
+
helpers.setTouched(true);
|
|
1639
2136
|
},
|
|
1640
2137
|
"aria-describedby": `${fieldDef.id}-secure`,
|
|
1641
2138
|
"data-sensitive": "true"
|
|
@@ -1652,7 +2149,11 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1652
2149
|
{
|
|
1653
2150
|
type: "button",
|
|
1654
2151
|
onClick: () => setReveal((r) => !r),
|
|
1655
|
-
className:
|
|
2152
|
+
className: twMerge(
|
|
2153
|
+
"flex h-7 w-7 items-center justify-center rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60",
|
|
2154
|
+
FORM_MUTED_TEXT_CLASS,
|
|
2155
|
+
FORM_SUBTLE_HOVER_FILL_CLASS
|
|
2156
|
+
),
|
|
1656
2157
|
"aria-pressed": reveal,
|
|
1657
2158
|
"aria-label": reveal ? "Hide value" : "Show value",
|
|
1658
2159
|
children: reveal ? /* @__PURE__ */ jsx(FiEyeOff, { size: 16, "aria-hidden": "true" }) : /* @__PURE__ */ jsx(FiEye, { size: 16, "aria-hidden": "true" })
|
|
@@ -1665,7 +2166,8 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1665
2166
|
{
|
|
1666
2167
|
id: `${fieldDef.id}-secure`,
|
|
1667
2168
|
className: twMerge(
|
|
1668
|
-
"flex items-center gap-1 text-xs
|
|
2169
|
+
"flex items-center gap-1 text-xs",
|
|
2170
|
+
FORM_MUTED_TEXT_CLASS,
|
|
1669
2171
|
className
|
|
1670
2172
|
),
|
|
1671
2173
|
children: [
|
|
@@ -1689,14 +2191,14 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1689
2191
|
/* @__PURE__ */ jsx("label", { htmlFor: fieldDef.id, className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label }),
|
|
1690
2192
|
renderSecureHint("mb-1")
|
|
1691
2193
|
] }),
|
|
1692
|
-
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2194
|
+
/* @__PURE__ */ jsxs("div", { className: "relative bg-inherit", children: [
|
|
1693
2195
|
/* @__PURE__ */ jsx("input", __spreadValues({ className: styles.inputClass, style: borderStyle }, inputProps)),
|
|
1694
2196
|
renderToggle()
|
|
1695
2197
|
] }),
|
|
1696
2198
|
hasError && /* @__PURE__ */ jsx(
|
|
1697
2199
|
"span",
|
|
1698
2200
|
{
|
|
1699
|
-
className:
|
|
2201
|
+
className: "mt-1 text-xs",
|
|
1700
2202
|
style: styles.errorStyle,
|
|
1701
2203
|
children: meta.error
|
|
1702
2204
|
}
|
|
@@ -1710,7 +2212,7 @@ var SensitiveField = ({ field: fieldDef, disabled }) => {
|
|
|
1710
2212
|
/* @__PURE__ */ jsx("span", { className: styles.labelClass, style: styles.labelStyle, children: fieldDef.label }),
|
|
1711
2213
|
renderToggle("mb-3")
|
|
1712
2214
|
] }),
|
|
1713
|
-
hasError && /* @__PURE__ */ jsx("span", { className: "mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
2215
|
+
hasError && /* @__PURE__ */ jsx("span", { className: "relative mt-[-8px] text-xs", style: styles.errorStyle, children: meta.error })
|
|
1714
2216
|
] });
|
|
1715
2217
|
};
|
|
1716
2218
|
var FormFileUploadContext = createContext({});
|
|
@@ -1848,14 +2350,14 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1848
2350
|
"p",
|
|
1849
2351
|
{
|
|
1850
2352
|
className: "mb-2 text-xs",
|
|
1851
|
-
style: { color:
|
|
2353
|
+
style: { color: FORM_VAR.placeholder },
|
|
1852
2354
|
children: fieldDef.helpText
|
|
1853
2355
|
}
|
|
1854
2356
|
),
|
|
1855
2357
|
/* @__PURE__ */ jsxs(
|
|
1856
2358
|
"div",
|
|
1857
2359
|
{
|
|
1858
|
-
className: `relative rounded-lg border-2 border-dashed p-6 text-center transition-colors ${hasError ? "border-red-400" : pickerDisabled ? "border-
|
|
2360
|
+
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"}`,
|
|
1859
2361
|
onDragOver: (e) => {
|
|
1860
2362
|
if (pickerDisabled) return;
|
|
1861
2363
|
e.preventDefault();
|
|
@@ -1885,9 +2387,15 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1885
2387
|
}
|
|
1886
2388
|
),
|
|
1887
2389
|
uploading ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1888
|
-
/* @__PURE__ */ jsx(
|
|
1889
|
-
|
|
1890
|
-
|
|
2390
|
+
/* @__PURE__ */ jsx(
|
|
2391
|
+
"div",
|
|
2392
|
+
{
|
|
2393
|
+
className: `mx-auto h-1.5 w-32 overflow-hidden rounded-full ${FORM_SUBTLE_FILL_CLASS}`,
|
|
2394
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full w-1/3 animate-pulse rounded-full bg-indigo-500" })
|
|
2395
|
+
}
|
|
2396
|
+
),
|
|
2397
|
+
/* @__PURE__ */ jsx("p", { className: `text-sm ${FORM_MUTED_TEXT_CLASS}`, children: "Uploading\u2026" })
|
|
2398
|
+
] }) : uploadsUnavailable ? /* @__PURE__ */ jsx("p", { className: `text-sm ${FORM_MUTED_TEXT_CLASS}`, children: NO_UPLOADER_MESSAGE }) : /* @__PURE__ */ jsxs(
|
|
1891
2399
|
"button",
|
|
1892
2400
|
{
|
|
1893
2401
|
type: "button",
|
|
@@ -1896,12 +2404,12 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1896
2404
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.click();
|
|
1897
2405
|
},
|
|
1898
2406
|
disabled,
|
|
1899
|
-
className:
|
|
2407
|
+
className: `cursor-pointer text-sm ${FORM_MUTED_TEXT_CLASS} hover:text-current disabled:cursor-not-allowed disabled:opacity-50`,
|
|
1900
2408
|
children: [
|
|
1901
2409
|
/* @__PURE__ */ jsx(
|
|
1902
2410
|
"svg",
|
|
1903
2411
|
{
|
|
1904
|
-
className:
|
|
2412
|
+
className: `mx-auto mb-2 h-8 w-8 ${FORM_FAINT_TEXT_CLASS}`,
|
|
1905
2413
|
fill: "none",
|
|
1906
2414
|
viewBox: "0 0 24 24",
|
|
1907
2415
|
strokeWidth: 1.5,
|
|
@@ -1919,7 +2427,7 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1919
2427
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Click to upload" }),
|
|
1920
2428
|
" or drag and drop",
|
|
1921
2429
|
/* @__PURE__ */ jsx("br", {}),
|
|
1922
|
-
/* @__PURE__ */ jsxs("span", { className:
|
|
2430
|
+
/* @__PURE__ */ jsxs("span", { className: `text-xs ${FORM_FAINT_TEXT_CLASS}`, children: [
|
|
1923
2431
|
"Max ",
|
|
1924
2432
|
formatBytes(maxSizeBytes),
|
|
1925
2433
|
multiple && ` \xB7 Up to ${maxFiles} files`
|
|
@@ -1933,7 +2441,7 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1933
2441
|
files.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-2", children: files.map((f, i) => /* @__PURE__ */ jsxs(
|
|
1934
2442
|
"div",
|
|
1935
2443
|
{
|
|
1936
|
-
className:
|
|
2444
|
+
className: `flex items-center gap-3 rounded-md border ${FORM_SUBTLE_BORDER_CLASS} ${FORM_SUBTLE_FILL_CLASS} px-3 py-2`,
|
|
1937
2445
|
children: [
|
|
1938
2446
|
f.url && f.name.match(/\.(jpg|jpeg|png|webp|gif|svg)$/i) && // eslint-disable-next-line @next/next/no-img-element
|
|
1939
2447
|
/* @__PURE__ */ jsx(
|
|
@@ -1945,15 +2453,15 @@ var FileField = ({ field: fieldDef, onUpload, disabled }) => {
|
|
|
1945
2453
|
}
|
|
1946
2454
|
),
|
|
1947
2455
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1948
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium
|
|
1949
|
-
/* @__PURE__ */ jsx("p", { className:
|
|
2456
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: f.name }),
|
|
2457
|
+
/* @__PURE__ */ jsx("p", { className: `text-xs ${FORM_MUTED_TEXT_CLASS}`, children: formatBytes(f.size) })
|
|
1950
2458
|
] }),
|
|
1951
2459
|
/* @__PURE__ */ jsx(
|
|
1952
2460
|
"button",
|
|
1953
2461
|
{
|
|
1954
2462
|
type: "button",
|
|
1955
2463
|
onClick: () => removeFile(i),
|
|
1956
|
-
className:
|
|
2464
|
+
className: `cursor-pointer ${FORM_FAINT_TEXT_CLASS} hover:text-red-500`,
|
|
1957
2465
|
"aria-label": `Remove ${f.name}`,
|
|
1958
2466
|
children: /* @__PURE__ */ jsx(
|
|
1959
2467
|
"svg",
|
|
@@ -2031,12 +2539,13 @@ var DynamicFormField = ({ field, mirrored, mirrorBehavior }) => {
|
|
|
2031
2539
|
};
|
|
2032
2540
|
const widthClass = widthClasses[((_a = field.layout) == null ? void 0 : _a.width) || "full"] || "md:col-span-6";
|
|
2033
2541
|
const description = (_b = field.description) != null ? _b : field.helpText;
|
|
2034
|
-
return /* @__PURE__ */ jsxs("div", { className: widthClass, children: [
|
|
2542
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(widthClass, "bg-inherit"), children: [
|
|
2035
2543
|
/* @__PURE__ */ jsx(Component, { field, disabled: locked }),
|
|
2036
|
-
description && /* @__PURE__ */ jsx("p", { className: twMerge("mt-1 text-xs",
|
|
2544
|
+
description && /* @__PURE__ */ jsx("p", { className: twMerge("mt-1 text-xs", FORM_MUTED_TEXT_CLASS), children: description })
|
|
2037
2545
|
] });
|
|
2038
2546
|
};
|
|
2039
2547
|
var spacingGap = {
|
|
2548
|
+
none: "gap-4",
|
|
2040
2549
|
compact: "gap-2",
|
|
2041
2550
|
normal: "gap-4",
|
|
2042
2551
|
relaxed: "gap-6"
|
|
@@ -2045,12 +2554,12 @@ var DynamicFormSection = ({
|
|
|
2045
2554
|
section,
|
|
2046
2555
|
isLast,
|
|
2047
2556
|
formDefaultTextColor,
|
|
2557
|
+
formDefaultTextColorDark,
|
|
2048
2558
|
inlineSubmit
|
|
2049
2559
|
}) => {
|
|
2050
|
-
var _a
|
|
2560
|
+
var _a;
|
|
2051
2561
|
const style = useFormStyle();
|
|
2052
|
-
const
|
|
2053
|
-
const previewTextColor = previewOverrides == null ? void 0 : previewOverrides.textColor;
|
|
2562
|
+
const { forced, darkEnabled } = useFormColorScheme();
|
|
2054
2563
|
const { values, setFieldValue } = useFormikContext();
|
|
2055
2564
|
const sameAs = section.sameAs;
|
|
2056
2565
|
const toggleKey = sameAs ? sameAsToggleKey(section.id) : "";
|
|
@@ -2069,35 +2578,44 @@ var DynamicFormSection = ({
|
|
|
2069
2578
|
setFieldValue(targetId, (_a2 = values[sourceId]) != null ? _a2 : "");
|
|
2070
2579
|
}
|
|
2071
2580
|
}, [toggleOn, sourceSignature]);
|
|
2072
|
-
const
|
|
2581
|
+
const formDefaults = {
|
|
2582
|
+
light: formDefaultTextColor,
|
|
2583
|
+
dark: formDefaultTextColorDark
|
|
2584
|
+
};
|
|
2585
|
+
const effectiveTextColor = resolveSectionTextColor(
|
|
2586
|
+
section,
|
|
2587
|
+
formDefaults,
|
|
2588
|
+
forced != null ? forced : "light"
|
|
2589
|
+
);
|
|
2590
|
+
const darkTextColor = darkEnabled && (section.textColorDark || formDefaultTextColorDark) ? resolveSectionTextColor(section, formDefaults, "dark") : void 0;
|
|
2073
2591
|
const sortedFields = [...section.fields].sort(
|
|
2074
2592
|
(a, b) => {
|
|
2075
|
-
var _a2,
|
|
2076
|
-
return ((
|
|
2593
|
+
var _a2, _b, _c, _d;
|
|
2594
|
+
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);
|
|
2077
2595
|
}
|
|
2078
2596
|
);
|
|
2079
|
-
const
|
|
2597
|
+
const customGap = resolveCustomGap(style);
|
|
2598
|
+
const gap = customGap ? "gap-0" : spacingGap[style.spacing || "normal"];
|
|
2599
|
+
const gapStyle = customGap ? { gap: FORM_GAP_VAR } : {};
|
|
2080
2600
|
const divider = style.sectionDividers && !isLast;
|
|
2081
2601
|
const isStacked = style.inputVariant === "stacked";
|
|
2082
2602
|
const sectionWrapperClass = twMerge(
|
|
2603
|
+
"bg-inherit",
|
|
2083
2604
|
isStacked ? "space-y-4" : "mb-6",
|
|
2084
|
-
divider &&
|
|
2085
|
-
);
|
|
2086
|
-
const titleClass = twMerge(
|
|
2087
|
-
"text-lg font-semibold",
|
|
2088
|
-
effectiveTextColor ? "" : "text-gray-800 dark:text-zinc-100",
|
|
2089
|
-
!isStacked && "mb-1"
|
|
2605
|
+
divider && `border-b ${FORM_SUBTLE_BORDER_CLASS} pb-6`
|
|
2090
2606
|
);
|
|
2607
|
+
const titleClass = twMerge("text-lg font-semibold", !isStacked && "mb-1");
|
|
2091
2608
|
const descriptionClass = twMerge(
|
|
2092
2609
|
"text-sm",
|
|
2093
|
-
effectiveTextColor ? "" :
|
|
2610
|
+
effectiveTextColor ? "" : FORM_MUTED_TEXT_CLASS,
|
|
2094
2611
|
!isStacked && "mb-4"
|
|
2095
2612
|
);
|
|
2096
|
-
const textStyle = effectiveTextColor ? { color: effectiveTextColor } : void 0;
|
|
2613
|
+
const textStyle = effectiveTextColor || darkTextColor ? __spreadValues(__spreadValues({}, effectiveTextColor ? { color: effectiveTextColor } : {}), darkTextColor ? { [FORM_DARK_TEXT_VAR]: darkTextColor } : {}) : void 0;
|
|
2614
|
+
const darkTextAttr = darkTextColor ? { [FORM_DARK_TEXT_ATTR]: "" } : {};
|
|
2097
2615
|
return /* @__PURE__ */ jsxs("fieldset", { className: sectionWrapperClass, children: [
|
|
2098
|
-
section.title && /* @__PURE__ */ jsx("legend", { className: titleClass, style: textStyle, children: section.title }),
|
|
2099
|
-
section.description && /* @__PURE__ */ jsx("p", { className: descriptionClass, style: textStyle, children: section.description }),
|
|
2100
|
-
sameAs && /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center gap-3", children: [
|
|
2616
|
+
section.title && /* @__PURE__ */ jsx("legend", __spreadProps(__spreadValues({ className: titleClass, style: textStyle }, darkTextAttr), { children: section.title })),
|
|
2617
|
+
section.description && /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({ className: descriptionClass, style: textStyle }, darkTextAttr), { children: section.description })),
|
|
2618
|
+
sameAs && /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center gap-3 bg-inherit", children: [
|
|
2101
2619
|
/* @__PURE__ */ jsx(
|
|
2102
2620
|
Checkbox.Root,
|
|
2103
2621
|
{
|
|
@@ -2124,10 +2642,11 @@ var DynamicFormSection = ({
|
|
|
2124
2642
|
"div",
|
|
2125
2643
|
{
|
|
2126
2644
|
className: twMerge(
|
|
2127
|
-
"grid grid-cols-1 md:grid-cols-6",
|
|
2645
|
+
"grid grid-cols-1 bg-inherit md:grid-cols-6",
|
|
2128
2646
|
gap,
|
|
2129
2647
|
inlineSubmit && "min-w-0 flex-auto"
|
|
2130
2648
|
),
|
|
2649
|
+
style: gapStyle,
|
|
2131
2650
|
children: sortedFields.map((field, i) => /* @__PURE__ */ jsx(
|
|
2132
2651
|
DynamicFormField,
|
|
2133
2652
|
{
|
|
@@ -2139,13 +2658,52 @@ var DynamicFormSection = ({
|
|
|
2139
2658
|
))
|
|
2140
2659
|
}
|
|
2141
2660
|
);
|
|
2142
|
-
return inlineSubmit ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
2661
|
+
return inlineSubmit ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 bg-inherit", children: [
|
|
2143
2662
|
fieldsGrid,
|
|
2144
|
-
/* @__PURE__ */ jsx("div", { className: twMerge("flex-none", !isStacked && "pt-3"), children: inlineSubmit })
|
|
2663
|
+
/* @__PURE__ */ jsx("div", { className: twMerge("flex-none bg-inherit", !isStacked && "pt-3"), children: inlineSubmit })
|
|
2145
2664
|
] }) : fieldsGrid;
|
|
2146
2665
|
})()
|
|
2147
2666
|
] });
|
|
2148
2667
|
};
|
|
2668
|
+
var COOLDOWN_MS = 2e3;
|
|
2669
|
+
function useSuccessFeedback(isSuccess) {
|
|
2670
|
+
const bannerRef = useRef(null);
|
|
2671
|
+
const [cooldown, setCooldown] = useState(false);
|
|
2672
|
+
const [submittedSnapshot, setSubmittedSnapshot] = useState(null);
|
|
2673
|
+
useEffect(() => {
|
|
2674
|
+
if (!isSuccess) return;
|
|
2675
|
+
setCooldown(true);
|
|
2676
|
+
const timer = setTimeout(() => setCooldown(false), COOLDOWN_MS);
|
|
2677
|
+
const node = bannerRef.current;
|
|
2678
|
+
if (node && typeof node.scrollIntoView === "function") {
|
|
2679
|
+
const reduceMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2680
|
+
node.scrollIntoView({
|
|
2681
|
+
behavior: reduceMotion ? "auto" : "smooth",
|
|
2682
|
+
block: "center"
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
return () => clearTimeout(timer);
|
|
2686
|
+
}, [isSuccess]);
|
|
2687
|
+
return {
|
|
2688
|
+
bannerRef,
|
|
2689
|
+
cooldown,
|
|
2690
|
+
submittedSnapshot,
|
|
2691
|
+
markSubmitted: (values) => setSubmittedSnapshot(JSON.stringify(values)),
|
|
2692
|
+
clearSubmitted: () => setSubmittedSnapshot(null)
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
function ValuesObserver({ onChange }) {
|
|
2696
|
+
const { values } = useFormikContext();
|
|
2697
|
+
const mounted = useRef(false);
|
|
2698
|
+
useEffect(() => {
|
|
2699
|
+
if (!mounted.current) {
|
|
2700
|
+
mounted.current = true;
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
onChange(values);
|
|
2704
|
+
}, [values, onChange]);
|
|
2705
|
+
return null;
|
|
2706
|
+
}
|
|
2149
2707
|
function globalTracker() {
|
|
2150
2708
|
if (typeof window === "undefined") return void 0;
|
|
2151
2709
|
return window.__vtTrack;
|
|
@@ -2188,6 +2746,20 @@ function findUnresolvedUploads(payload) {
|
|
|
2188
2746
|
}
|
|
2189
2747
|
return ids;
|
|
2190
2748
|
}
|
|
2749
|
+
function getConversionUserData(definition, values) {
|
|
2750
|
+
const out = {};
|
|
2751
|
+
for (const section of definition.sections) {
|
|
2752
|
+
for (const field of section.fields) {
|
|
2753
|
+
if (field.type === "email" && out.email === void 0 && values[field.id]) {
|
|
2754
|
+
out.email = values[field.id];
|
|
2755
|
+
}
|
|
2756
|
+
if (field.type === "phone" && out.phone === void 0 && values[field.id]) {
|
|
2757
|
+
out.phone = values[field.id];
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
return out;
|
|
2762
|
+
}
|
|
2191
2763
|
function getSensitiveFieldIds(definition) {
|
|
2192
2764
|
const ids = [];
|
|
2193
2765
|
for (const section of definition.sections) {
|
|
@@ -2229,9 +2801,9 @@ function fetchTransportKey(endpoint) {
|
|
|
2229
2801
|
var presetNonBgClasses = {
|
|
2230
2802
|
default: "",
|
|
2231
2803
|
minimal: "",
|
|
2232
|
-
bordered: "border border-
|
|
2804
|
+
bordered: "border border-current/15",
|
|
2233
2805
|
shadow: "shadow-lg",
|
|
2234
|
-
card: "shadow-lg border border-
|
|
2806
|
+
card: "shadow-lg border border-current/15",
|
|
2235
2807
|
dark: ""
|
|
2236
2808
|
};
|
|
2237
2809
|
var radiusClasses = {
|
|
@@ -2242,12 +2814,23 @@ var radiusClasses = {
|
|
|
2242
2814
|
full: "rounded-2xl"
|
|
2243
2815
|
};
|
|
2244
2816
|
var spacingClasses = {
|
|
2817
|
+
// "none" exists for forms dropped into a page that owns its own layout —
|
|
2818
|
+
// without it a consumer had to neutralise the padding with a `p-0` class
|
|
2819
|
+
// override from the outside.
|
|
2820
|
+
none: "p-0",
|
|
2245
2821
|
compact: "p-3",
|
|
2246
2822
|
normal: "p-6",
|
|
2247
2823
|
relaxed: "p-8"
|
|
2248
2824
|
};
|
|
2825
|
+
function getRadiusClass(style, fallback = "rounded-md") {
|
|
2826
|
+
if (resolveCustomRadius(style)) return "rounded-none";
|
|
2827
|
+
return radiusClasses[style.borderRadius] || fallback;
|
|
2828
|
+
}
|
|
2829
|
+
function getRadiusStyle(style) {
|
|
2830
|
+
return resolveCustomRadius(style) ? { borderRadius: FORM_RADIUS_VAR } : {};
|
|
2831
|
+
}
|
|
2249
2832
|
function getButtonClasses(style) {
|
|
2250
|
-
const radius =
|
|
2833
|
+
const radius = getRadiusClass(style);
|
|
2251
2834
|
const weight = style.inputVariant === "stacked" ? "font-semibold" : "font-medium";
|
|
2252
2835
|
switch (style.buttonVariant) {
|
|
2253
2836
|
case "outline":
|
|
@@ -2260,17 +2843,18 @@ function getButtonClasses(style) {
|
|
|
2260
2843
|
}
|
|
2261
2844
|
}
|
|
2262
2845
|
function getButtonStyle(style) {
|
|
2846
|
+
const radius = getRadiusStyle(style);
|
|
2263
2847
|
switch (style.buttonVariant) {
|
|
2264
2848
|
case "outline":
|
|
2265
|
-
return { borderColor: FORM_VAR.buttonBg, color: FORM_VAR.buttonBg };
|
|
2849
|
+
return __spreadProps(__spreadValues({}, radius), { borderColor: FORM_VAR.buttonBg, color: FORM_VAR.buttonBg });
|
|
2266
2850
|
case "ghost":
|
|
2267
|
-
return { color: FORM_VAR.buttonBg };
|
|
2851
|
+
return __spreadProps(__spreadValues({}, radius), { color: FORM_VAR.buttonBg });
|
|
2268
2852
|
case "filled":
|
|
2269
2853
|
default:
|
|
2270
|
-
return {
|
|
2854
|
+
return __spreadProps(__spreadValues({}, radius), {
|
|
2271
2855
|
backgroundColor: FORM_VAR.buttonBg,
|
|
2272
2856
|
color: FORM_VAR.buttonText
|
|
2273
|
-
};
|
|
2857
|
+
});
|
|
2274
2858
|
}
|
|
2275
2859
|
}
|
|
2276
2860
|
function interpolateSuccessMessage(template, response) {
|
|
@@ -2384,6 +2968,9 @@ var ErrorBanner = ({
|
|
|
2384
2968
|
var DynamicForm = ({
|
|
2385
2969
|
definition,
|
|
2386
2970
|
apiRoute,
|
|
2971
|
+
submit,
|
|
2972
|
+
initialValues: initialValueOverrides,
|
|
2973
|
+
onValuesChange,
|
|
2387
2974
|
onSuccess,
|
|
2388
2975
|
onError,
|
|
2389
2976
|
extraData,
|
|
@@ -2397,17 +2984,19 @@ var DynamicForm = ({
|
|
|
2397
2984
|
previewTouchAllSignal,
|
|
2398
2985
|
previewUntouchAllSignal,
|
|
2399
2986
|
previewBg,
|
|
2400
|
-
previewTextColor
|
|
2987
|
+
previewTextColor,
|
|
2988
|
+
previewColorScheme,
|
|
2989
|
+
darkModeSelector = FORM_DEFAULT_DARK_SELECTOR
|
|
2401
2990
|
}) => {
|
|
2402
|
-
var _a, _b, _c;
|
|
2991
|
+
var _a, _b, _c, _d;
|
|
2403
2992
|
const [submitStatus, setSubmitStatus] = useState("idle");
|
|
2404
|
-
const
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
}
|
|
2993
|
+
const {
|
|
2994
|
+
bannerRef,
|
|
2995
|
+
cooldown: postSuccessCooldown,
|
|
2996
|
+
submittedSnapshot,
|
|
2997
|
+
markSubmitted,
|
|
2998
|
+
clearSubmitted
|
|
2999
|
+
} = useSuccessFeedback(submitStatus === "success");
|
|
2411
3000
|
const [responseData, setResponseData] = useState(
|
|
2412
3001
|
null
|
|
2413
3002
|
);
|
|
@@ -2429,8 +3018,15 @@ var DynamicForm = ({
|
|
|
2429
3018
|
mountTimeRef.current = Date.now();
|
|
2430
3019
|
}, [definition.id]);
|
|
2431
3020
|
const validationSchema = useMemo(() => buildYupSchema(definition), [definition]);
|
|
3021
|
+
useEffect(() => {
|
|
3022
|
+
var _a2;
|
|
3023
|
+
void ((_a2 = formikRef.current) == null ? void 0 : _a2.validateForm());
|
|
3024
|
+
}, [validationSchema]);
|
|
2432
3025
|
const initialValues = useMemo(() => {
|
|
2433
3026
|
const base = buildInitialValues(definition);
|
|
3027
|
+
for (const [key, value] of Object.entries(initialValueOverrides != null ? initialValueOverrides : {})) {
|
|
3028
|
+
if (key in base && value !== void 0) base[key] = value;
|
|
3029
|
+
}
|
|
2434
3030
|
if (honeypotEnabled) {
|
|
2435
3031
|
base[HONEYPOT_FIELD_NAME] = "";
|
|
2436
3032
|
}
|
|
@@ -2461,19 +3057,34 @@ var DynamicForm = ({
|
|
|
2461
3057
|
if (previewUntouchAllSignal === void 0 || !formikRef.current) return;
|
|
2462
3058
|
formikRef.current.setTouched({}, false);
|
|
2463
3059
|
}, [previewUntouchAllSignal]);
|
|
2464
|
-
const
|
|
3060
|
+
const rawStyle = __spreadValues(__spreadValues({}, DEFAULT_FORM_STYLE), definition.style);
|
|
3061
|
+
const style = previewColorScheme ? resolveSchemeStyle(rawStyle, previewColorScheme) : rawStyle;
|
|
3062
|
+
const darkEnabled = !previewColorScheme && definitionHasDarkColors(definition);
|
|
3063
|
+
const colorSchemeState = {
|
|
3064
|
+
forced: previewColorScheme,
|
|
3065
|
+
darkEnabled
|
|
3066
|
+
};
|
|
2465
3067
|
const isStacked = style.inputVariant === "stacked";
|
|
2466
3068
|
const isCard = style.preset === "card";
|
|
2467
3069
|
const submittingText = (_b = definition.submitConfig.submittingText) != null ? _b : "Submitting...";
|
|
2468
|
-
const
|
|
2469
|
-
const
|
|
2470
|
-
const
|
|
2471
|
-
const
|
|
2472
|
-
const
|
|
2473
|
-
const formInlineStyle = __spreadValues(__spreadValues(__spreadValues({}, cssVarStyle),
|
|
3070
|
+
const submittedText = (_c = definition.submitConfig.submittedText) != null ? _c : "Sent";
|
|
3071
|
+
const successBehavior = (_d = definition.submitConfig.successBehavior) != null ? _d : "message";
|
|
3072
|
+
const cssVarStyle = __spreadValues(__spreadValues({}, buildFormCssVars(style, previewBg)), darkEnabled ? buildFormDarkCssVars(style) : {});
|
|
3073
|
+
const effectiveFormBg = style.formBackgroundColor || previewBg;
|
|
3074
|
+
const rootBgStyle = darkEnabled ? { backgroundColor: FORM_ROOT_BG_VAR } : effectiveFormBg ? { backgroundColor: effectiveFormBg } : {};
|
|
3075
|
+
const formInlineStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, cssVarStyle), getRadiusStyle(style)), rootBgStyle), previewTextColor ? { color: previewTextColor } : {});
|
|
3076
|
+
const darkScopeAttr = darkEnabled ? { [FORM_DARK_SCOPE_ATTR]: "" } : {};
|
|
3077
|
+
const darkStyleSheet = darkEnabled ? /* @__PURE__ */ jsx(
|
|
3078
|
+
"style",
|
|
3079
|
+
{
|
|
3080
|
+
"data-vt-forms-dark": "",
|
|
3081
|
+
dangerouslySetInnerHTML: { __html: buildDarkSchemeCss(darkModeSelector) }
|
|
3082
|
+
}
|
|
3083
|
+
) : null;
|
|
2474
3084
|
const formClasses = twMerge(
|
|
3085
|
+
"bg-inherit",
|
|
2475
3086
|
presetNonBgClasses[style.preset] || "",
|
|
2476
|
-
|
|
3087
|
+
getRadiusClass(style),
|
|
2477
3088
|
isCard ? "p-8" : spacingClasses[style.spacing] || "p-6",
|
|
2478
3089
|
isStacked ? "space-y-8" : "",
|
|
2479
3090
|
className
|
|
@@ -2486,24 +3097,29 @@ var DynamicForm = ({
|
|
|
2486
3097
|
responseData
|
|
2487
3098
|
);
|
|
2488
3099
|
if (successBehavior === "replace" && effectiveSubmitStatus === "success") {
|
|
2489
|
-
return /* @__PURE__ */ jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsx(
|
|
3100
|
+
return /* @__PURE__ */ jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsx(FormColorSchemeProvider, { value: colorSchemeState, children: /* @__PURE__ */ jsxs(
|
|
2490
3101
|
"div",
|
|
2491
|
-
{
|
|
3102
|
+
__spreadProps(__spreadValues({
|
|
3103
|
+
ref: bannerRef,
|
|
2492
3104
|
className: formClasses,
|
|
2493
3105
|
style: formInlineStyle,
|
|
2494
|
-
"data-form-version": definition.version
|
|
2495
|
-
|
|
2496
|
-
|
|
3106
|
+
"data-form-version": definition.version
|
|
3107
|
+
}, darkScopeAttr), {
|
|
3108
|
+
children: [
|
|
3109
|
+
darkStyleSheet,
|
|
3110
|
+
/* @__PURE__ */ jsx(SuccessBanner, { message: successMessage })
|
|
3111
|
+
]
|
|
3112
|
+
})
|
|
2497
3113
|
) }) });
|
|
2498
3114
|
}
|
|
2499
|
-
return /* @__PURE__ */ jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsx(
|
|
3115
|
+
return /* @__PURE__ */ jsx(FormStyleProvider, { value: style, children: /* @__PURE__ */ jsx(FormColorSchemeProvider, { value: colorSchemeState, children: /* @__PURE__ */ jsx(FormFileUploadProvider, { value: fileUploadValue, children: /* @__PURE__ */ jsx(
|
|
2500
3116
|
Formik,
|
|
2501
3117
|
{
|
|
2502
3118
|
innerRef: formikRef,
|
|
2503
3119
|
initialValues,
|
|
2504
3120
|
validationSchema,
|
|
2505
3121
|
onSubmit: (_0, _1) => __async(null, [_0, _1], function* (values, { setSubmitting, resetForm }) {
|
|
2506
|
-
var _a2, _b2,
|
|
3122
|
+
var _a2, _b2, _d2, _e, _f, _g;
|
|
2507
3123
|
if (previewState) {
|
|
2508
3124
|
setSubmitting(false);
|
|
2509
3125
|
return;
|
|
@@ -2518,6 +3134,7 @@ var DynamicForm = ({
|
|
|
2518
3134
|
console.debug(`[forms] Spam detected: ${reason}`);
|
|
2519
3135
|
}
|
|
2520
3136
|
setResponseData(null);
|
|
3137
|
+
markSubmitted(values);
|
|
2521
3138
|
setSubmitStatus("success");
|
|
2522
3139
|
if (successBehavior === "reset" || successBehavior === "replace") {
|
|
2523
3140
|
resetForm();
|
|
@@ -2529,7 +3146,9 @@ var DynamicForm = ({
|
|
|
2529
3146
|
setSubmitStatus("idle");
|
|
2530
3147
|
try {
|
|
2531
3148
|
const _c2 = values, { [_b2 = HONEYPOT_FIELD_NAME]: _hp } = _c2, cleanValues = __objRest(_c2, [__restKey(_b2)]);
|
|
2532
|
-
const
|
|
3149
|
+
const adReferral = readAdReferral();
|
|
3150
|
+
const analyticsSessionId = readAnalyticsSessionId();
|
|
3151
|
+
const payload = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, cleanValues), adReferral ? { adReferral } : {}), analyticsSessionId ? { analyticsSessionId } : {}), extraData), {
|
|
2533
3152
|
formId: definition.id
|
|
2534
3153
|
});
|
|
2535
3154
|
for (const hiddenId of getHiddenFieldIds(definition, cleanValues)) {
|
|
@@ -2559,29 +3178,49 @@ var DynamicForm = ({
|
|
|
2559
3178
|
);
|
|
2560
3179
|
}
|
|
2561
3180
|
}
|
|
2562
|
-
const res = yield fetch(apiRoute, {
|
|
2563
|
-
method: "POST",
|
|
2564
|
-
headers: { "Content-Type": "application/json" },
|
|
2565
|
-
body: JSON.stringify(payload)
|
|
2566
|
-
});
|
|
2567
|
-
if (!res.ok) {
|
|
2568
|
-
const errBody = yield res.json().catch(() => null);
|
|
2569
|
-
throw new Error(
|
|
2570
|
-
(errBody == null ? void 0 : errBody.error) || `Submission failed (${res.status})`
|
|
2571
|
-
);
|
|
2572
|
-
}
|
|
2573
3181
|
let body = null;
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
3182
|
+
if (submit) {
|
|
3183
|
+
const result = yield submit(payload);
|
|
3184
|
+
body = result && typeof result === "object" ? result : null;
|
|
3185
|
+
} else {
|
|
3186
|
+
const res = yield fetch(apiRoute, {
|
|
3187
|
+
method: "POST",
|
|
3188
|
+
headers: { "Content-Type": "application/json" },
|
|
3189
|
+
body: JSON.stringify(payload)
|
|
3190
|
+
});
|
|
3191
|
+
if (!res.ok) {
|
|
3192
|
+
const errBody = yield res.json().catch(() => null);
|
|
3193
|
+
throw new Error(
|
|
3194
|
+
(errBody == null ? void 0 : errBody.error) || `Submission failed (${res.status})`
|
|
3195
|
+
);
|
|
3196
|
+
}
|
|
3197
|
+
try {
|
|
3198
|
+
body = yield res.json();
|
|
3199
|
+
} catch (e) {
|
|
3200
|
+
body = null;
|
|
3201
|
+
}
|
|
2578
3202
|
}
|
|
2579
3203
|
setResponseData(body);
|
|
3204
|
+
const submissionType = (_d2 = extraData == null ? void 0 : extraData.submissionType) != null ? _d2 : "contact";
|
|
3205
|
+
const serverId = body == null ? void 0 : body.submissionId;
|
|
3206
|
+
trackFormConversion(
|
|
3207
|
+
{
|
|
3208
|
+
formId: definition.id,
|
|
3209
|
+
formName: definition.name,
|
|
3210
|
+
formType: submissionType
|
|
3211
|
+
},
|
|
3212
|
+
(_e = definition.submitConfig.conversion) == null ? void 0 : _e.sendTo,
|
|
3213
|
+
{
|
|
3214
|
+
transactionId: typeof serverId === "string" && serverId ? serverId : newTransactionId(),
|
|
3215
|
+
userData: getConversionUserData(definition, values)
|
|
3216
|
+
}
|
|
3217
|
+
);
|
|
3218
|
+
markSubmitted(values);
|
|
2580
3219
|
setSubmitStatus("success");
|
|
2581
|
-
(
|
|
3220
|
+
(_g = onFormSubmitCallback != null ? onFormSubmitCallback : (_f = globalTracker()) == null ? void 0 : _f.trackFormSubmit) == null ? void 0 : _g(
|
|
2582
3221
|
definition.id,
|
|
2583
3222
|
definition.name,
|
|
2584
|
-
|
|
3223
|
+
submissionType
|
|
2585
3224
|
);
|
|
2586
3225
|
if (successBehavior === "reset" || successBehavior === "replace") {
|
|
2587
3226
|
resetForm();
|
|
@@ -2595,23 +3234,29 @@ var DynamicForm = ({
|
|
|
2595
3234
|
}
|
|
2596
3235
|
} catch (err) {
|
|
2597
3236
|
setResponseData(null);
|
|
3237
|
+
clearSubmitted();
|
|
2598
3238
|
setSubmitStatus("error");
|
|
2599
3239
|
onError == null ? void 0 : onError(err instanceof Error ? err : new Error("Submission failed"));
|
|
2600
3240
|
} finally {
|
|
2601
3241
|
setSubmitting(false);
|
|
2602
3242
|
}
|
|
2603
3243
|
}),
|
|
2604
|
-
children: ({ isSubmitting, getFieldProps }) => {
|
|
3244
|
+
children: ({ isSubmitting, getFieldProps, values }) => {
|
|
2605
3245
|
const showSubmitting = isSubmitting || previewSubmitting;
|
|
2606
3246
|
const isDisabled = successBehavior === "disable" && effectiveSubmitStatus === "success";
|
|
2607
|
-
const
|
|
3247
|
+
const unchangedSinceSuccess = effectiveSubmitStatus === "success" && submittedSnapshot !== null && JSON.stringify(values) === submittedSnapshot;
|
|
3248
|
+
const submitLocked = showSubmitting || postSuccessCooldown || unchangedSinceSuccess || previewState === "success";
|
|
2608
3249
|
return /* @__PURE__ */ jsxs(
|
|
2609
3250
|
Form,
|
|
2610
|
-
{
|
|
3251
|
+
__spreadProps(__spreadValues({
|
|
3252
|
+
method: "post",
|
|
2611
3253
|
className: formClasses,
|
|
2612
3254
|
style: formInlineStyle,
|
|
2613
|
-
"data-form-version": definition.version
|
|
3255
|
+
"data-form-version": definition.version
|
|
3256
|
+
}, darkScopeAttr), {
|
|
2614
3257
|
children: [
|
|
3258
|
+
darkStyleSheet,
|
|
3259
|
+
onValuesChange && /* @__PURE__ */ jsx(ValuesObserver, { onChange: onValuesChange }),
|
|
2615
3260
|
honeypotEnabled && /* @__PURE__ */ jsxs(
|
|
2616
3261
|
"div",
|
|
2617
3262
|
{
|
|
@@ -2641,7 +3286,7 @@ var DynamicForm = ({
|
|
|
2641
3286
|
]
|
|
2642
3287
|
}
|
|
2643
3288
|
),
|
|
2644
|
-
effectiveSubmitStatus === "success" && /* @__PURE__ */ jsx("div", { className: bannerWrapperClass, children: /* @__PURE__ */ jsx(SuccessBanner, { message: successMessage }) }),
|
|
3289
|
+
effectiveSubmitStatus === "success" && /* @__PURE__ */ jsx("div", { ref: bannerRef, className: bannerWrapperClass, children: /* @__PURE__ */ jsx(SuccessBanner, { message: successMessage }) }),
|
|
2645
3290
|
effectiveSubmitStatus === "error" && /* @__PURE__ */ jsx("div", { className: bannerWrapperClass, children: /* @__PURE__ */ jsx(
|
|
2646
3291
|
ErrorBanner,
|
|
2647
3292
|
{
|
|
@@ -2655,7 +3300,7 @@ var DynamicForm = ({
|
|
|
2655
3300
|
disabled: isDisabled,
|
|
2656
3301
|
"aria-disabled": isDisabled,
|
|
2657
3302
|
className: twMerge(
|
|
2658
|
-
"min-w-0 border-0 p-0",
|
|
3303
|
+
"min-w-0 border-0 bg-inherit p-0",
|
|
2659
3304
|
isStacked ? "space-y-8" : "",
|
|
2660
3305
|
isDisabled ? "pointer-events-none opacity-60" : ""
|
|
2661
3306
|
),
|
|
@@ -2674,7 +3319,7 @@ var DynamicForm = ({
|
|
|
2674
3319
|
"aria-busy": showSubmitting,
|
|
2675
3320
|
children: [
|
|
2676
3321
|
showSubmitting && /* @__PURE__ */ jsx(Spinner, {}),
|
|
2677
|
-
showSubmitting ? submittingText : definition.submitConfig.buttonText
|
|
3322
|
+
showSubmitting ? submittingText : unchangedSinceSuccess ? submittedText : definition.submitConfig.buttonText
|
|
2678
3323
|
]
|
|
2679
3324
|
}
|
|
2680
3325
|
);
|
|
@@ -2687,6 +3332,7 @@ var DynamicForm = ({
|
|
|
2687
3332
|
section,
|
|
2688
3333
|
isLast,
|
|
2689
3334
|
formDefaultTextColor: definition.defaultTextColor,
|
|
3335
|
+
formDefaultTextColorDark: definition.defaultTextColorDark,
|
|
2690
3336
|
inlineSubmit: inlineButton && isLast ? submitButton : void 0
|
|
2691
3337
|
},
|
|
2692
3338
|
section.id
|
|
@@ -2698,12 +3344,31 @@ var DynamicForm = ({
|
|
|
2698
3344
|
}
|
|
2699
3345
|
)
|
|
2700
3346
|
]
|
|
2701
|
-
}
|
|
3347
|
+
})
|
|
2702
3348
|
);
|
|
2703
3349
|
}
|
|
2704
3350
|
}
|
|
2705
3351
|
) }) }) });
|
|
2706
3352
|
};
|
|
3353
|
+
function AdReferralTracker({
|
|
3354
|
+
fallback,
|
|
3355
|
+
cookieName = AD_REFERRAL_COOKIE,
|
|
3356
|
+
ttlDays = AD_REFERRAL_TTL_DAYS
|
|
3357
|
+
} = {}) {
|
|
3358
|
+
useEffect(() => {
|
|
3359
|
+
const referral = captureAdReferral(
|
|
3360
|
+
window.location.search,
|
|
3361
|
+
fallback,
|
|
3362
|
+
/* @__PURE__ */ new Date(),
|
|
3363
|
+
window.location.pathname
|
|
3364
|
+
);
|
|
3365
|
+
if (!referral) return;
|
|
3366
|
+
const existing = readAdReferral(cookieName);
|
|
3367
|
+
if (existing && isSameAdReferralTouch(existing, referral)) return;
|
|
3368
|
+
writeAdReferral(referral, cookieName, ttlDays);
|
|
3369
|
+
}, []);
|
|
3370
|
+
return null;
|
|
3371
|
+
}
|
|
2707
3372
|
function buildQueryString(opts) {
|
|
2708
3373
|
const params = new URLSearchParams({
|
|
2709
3374
|
projectId: opts.projectId,
|
|
@@ -2965,6 +3630,6 @@ function useDragReorder({
|
|
|
2965
3630
|
});
|
|
2966
3631
|
}
|
|
2967
3632
|
|
|
2968
|
-
export { APPLICATION_STATUS_KEYS, CORE_EMAIL_TEMPLATE_VARIABLES, DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES, DEFAULT_FILE_FIELD_CONFIG, DEFAULT_FORM_STYLE, DEFAULT_NOTIFICATION_EMAIL_HTML, DEFAULT_NOTIFICATION_EMAIL_SUBJECT, DEFAULT_NOTIFICATION_EMAIL_TEMPLATE, DEFAULT_SENSITIVE_FIELD_CONFIG, DEFAULT_SPAM_PROTECTION, DynamicForm, DynamicFormField, DynamicFormSection, FORM_CSS_VAR, FORM_DEFAULT_COLOR, FORM_VAR, FileField, FormFileUploadProvider, HONEYPOT_FIELD_NAME, NEWSLETTER_ALLOWED_FIELD_TYPES, SAME_AS_TOGGLE_PREFIX, SAMPLE_EMAIL_TEMPLATE_VARIABLES, applyTextTransform, applyTransform, base64ToBuffer, bufferToBase64, buildEmailTemplateVariables, buildFormCssVars, buildInitialValues, buildYupSchema, deriveLast4, encryptSensitiveValue, formatSsn, formatUsPhone, getFormDefinition, getSafeRedirectUrl, isVisibilityConditionMet, parseFormDefinition, renderEmailTemplate, renderNotificationEmail, resizeImageFile, sameAsToggleKey, useDragReorder, useFormDefinition, useFormFileUpload, useUndoRedo, useUndoRedoShortcuts };
|
|
3633
|
+
export { AD_REFERRAL_COOKIE, AD_REFERRAL_TTL_DAYS, APPLICATION_STATUS_KEYS, AdReferralTracker, CORE_EMAIL_TEMPLATE_VARIABLES, DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES, DEFAULT_FILE_FIELD_CONFIG, DEFAULT_FORM_STYLE, DEFAULT_NOTIFICATION_EMAIL_HTML, DEFAULT_NOTIFICATION_EMAIL_SUBJECT, DEFAULT_NOTIFICATION_EMAIL_TEMPLATE, DEFAULT_SENSITIVE_FIELD_CONFIG, DEFAULT_SPAM_PROTECTION, DynamicForm, DynamicFormField, DynamicFormSection, ENHANCED_CONVERSIONS_GLOBAL, FORM_CONVERSION_SEND_TO_GLOBAL, FORM_CSS_VAR, FORM_DARK_SCOPE_ATTR, FORM_DARK_TEXT_ATTR, FORM_DARK_TEXT_VAR, FORM_DEFAULT_COLOR, FORM_DEFAULT_DARK_SELECTOR, FORM_DEFAULT_RADIUS, FORM_GAP_VAR, FORM_RADIUS_VAR, FORM_ROOT_BG_VAR, FORM_STRUCT_VAR, FORM_STYLE_COLOR_KEYS, FORM_SUBMIT_SUCCESS_EVENT, FORM_VAR, FileField, FormFileUploadProvider, HONEYPOT_FIELD_NAME, NEWSLETTER_ALLOWED_FIELD_TYPES, SAME_AS_TOGGLE_PREFIX, SAMPLE_EMAIL_TEMPLATE_VARIABLES, applyTextTransform, applyTransform, base64ToBuffer, bufferToBase64, buildColorVars, buildDarkSchemeCss, buildEmailTemplateVariables, buildFormCssVars, buildFormDarkCssVars, buildInitialValues, buildUserData, buildYupSchema, captureAdReferral, darkVarName, definitionHasDarkColors, deriveLast4, encryptSensitiveValue, fireAdsConversion, fireGenerateLead, formatSsn, formatUsPhone, getFormDefinition, getSafeRedirectUrl, hasDarkColors, isSameAdReferralTouch, isVisibilityConditionMet, newTransactionId, parseFormDefinition, pushFormSubmitSuccess, readAdReferral, renderEmailTemplate, renderNotificationEmail, resizeImageFile, resolveConversionSendTo, resolveCustomGap, resolveCustomRadius, resolveSchemeColors, resolveSchemeStyle, resolveSectionTextColor, sameAsToggleKey, toE164, trackFormConversion, useDragReorder, useFormDefinition, useFormFileUpload, useUndoRedo, useUndoRedoShortcuts, writeAdReferral };
|
|
2969
3634
|
//# sourceMappingURL=index.mjs.map
|
|
2970
3635
|
//# sourceMappingURL=index.mjs.map
|