@axos-web-dev/shared-components 2.0.0-dev.13-stepForm.2 → 2.0.0-dev.14

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.
Files changed (60) hide show
  1. package/dist/ATMLocator/ATMLocator.js +2 -3
  2. package/dist/Auth/ErrorAlert.js +1 -2
  3. package/dist/Button/Button.js +2 -3
  4. package/dist/Calculators/Calculator.js +1 -2
  5. package/dist/Calculators/MarginTradingCalculator/index.js +2 -3
  6. package/dist/Carousel/index.js +2 -3
  7. package/dist/Chevron/index.js +2 -3
  8. package/dist/Comparison/Comparison.js +3 -4
  9. package/dist/ExecutiveBio/ExecutiveBio.js +1 -2
  10. package/dist/FaqAccordion/index.js +2 -3
  11. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +2 -3
  12. package/dist/Forms/ApplyNow.js +2 -3
  13. package/dist/Forms/ContactUsBusiness.js +2 -3
  14. package/dist/Forms/ContactUsBusinessNameEmail.js +2 -3
  15. package/dist/Forms/ContactUsNMLSId.js +2 -3
  16. package/dist/Forms/CpraRequest.js +2 -3
  17. package/dist/Forms/CraPublicFile.js +2 -3
  18. package/dist/Forms/EmailOnly.js +2 -3
  19. package/dist/Forms/MortgageRate/MortgageRateForm.js +2 -3
  20. package/dist/Forms/MortgageRate/MortgageRateWatch.js +2 -3
  21. package/dist/Forms/MortgageWarehouseLending.js +2 -3
  22. package/dist/Forms/SuccesForm.js +1 -2
  23. package/dist/Forms/index.d.ts +0 -1
  24. package/dist/Forms/index.js +0 -2
  25. package/dist/Hyperlink/index.js +2 -3
  26. package/dist/ImageLink/ImageLink.js +2 -3
  27. package/dist/ImageLink/ImageLinkSet.js +2 -3
  28. package/dist/ImageLink/index.js +2 -3
  29. package/dist/Insight/Featured/CategorySelector.js +2 -3
  30. package/dist/Insight/Featured/Featured.js +2 -3
  31. package/dist/Insight/Featured/Header.js +2 -3
  32. package/dist/Modal/Modal.js +2 -3
  33. package/dist/NavigationMenu/AxosALTS/index.js +2 -3
  34. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.js +2 -3
  35. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +27 -27
  36. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +4 -2
  37. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +6 -4
  38. package/dist/NavigationMenu/AxosBank/SubNavBar.js +2 -3
  39. package/dist/NavigationMenu/AxosBank/index.js +24 -23
  40. package/dist/NavigationMenu/LaVictoire/index.js +2 -3
  41. package/dist/NavigationMenu/Navbar.js +2 -3
  42. package/dist/NavigationMenu/SignInNavButton.js +2 -3
  43. package/dist/SetContainer/SetContainer.js +2 -3
  44. package/dist/SocialMediaBar/iconsRepository.js +2 -3
  45. package/dist/VideoTile/VideoTile.js +2 -3
  46. package/dist/VideoWrapper/index.js +2 -3
  47. package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css +353 -353
  48. package/dist/main.js +0 -2
  49. package/package.json +1 -1
  50. package/dist/Forms/MortgageRate/MortgageRateStep.css.d.ts +0 -47
  51. package/dist/Forms/MortgageRate/MortgageRateStep.css.js +0 -98
  52. package/dist/Forms/MortgageRate/MortgageRateStep.d.ts +0 -1
  53. package/dist/Forms/MortgageRate/MortgageRateStep.js +0 -877
  54. package/dist/Forms/MortgageRate/mortgageLeadForm.config.d.ts +0 -101
  55. package/dist/Forms/MortgageRate/mortgageLeadForm.config.js +0 -57
  56. package/dist/Forms/MortgageRate/mortgageLeadForm.types.d.ts +0 -29
  57. package/dist/Forms/MortgageRate/mortgageLeadForm.types.js +0 -1
  58. package/dist/Forms/MortgageRate/mortgageLeadForm.utils.d.ts +0 -11
  59. package/dist/Forms/MortgageRate/mortgageLeadForm.utils.js +0 -74
  60. package/dist/assets/Forms/MortgageRate/MortgageRateStep.css +0 -341
@@ -1,877 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState, useRef, useMemo, useEffect } from "react";
4
- import { AnimatePresence, motion } from "framer-motion";
5
- import { Button, Field, Label, Input, RadioGroup, Radio } from "@headlessui/react";
6
- import { section, formShell, successWrap, successTitle, successText, disclosure, disclosureTitle, disclosureText, mainTitle, mainDescription, progressWrap, progressRow, progressLabel, progressTrack, progressFill, stepPanel, title, description, actions, secondaryButton, primaryButton, overlayOpacity, inputGrid, inputRowTwo, fieldBlock, fieldLabel, input, errorText, optionalText, radioOption, radioOptionChecked, radioText, autoAdvanceHint, sliderWrap, sliderHeader, sliderValue, slider, helperText, amountPreview, amountPreviewLabel, amountPreviewValue, radioGrid, autoAdvanceStatus, autoAdvanceText, autoAdvanceTrack, autoAdvanceBar } from "./MortgageRateStep.css.js";
7
- import { fixedLoanTermOptions, armLoanTermOptions, fixedLoanTypeOptions, amortizationTypeOptions, creditScoreOptions, propertyUseOptions, propertyTypeOptions, mortgageTypeOptions } from "./mortgageLeadForm.config.js";
8
- import { parseCurrencyInput, formatCurrency, formatPhoneInput, formatPercentInput, formatCurrencyInput, calculatePercentAmount, validateZipCode, validateEmail, validatePhone } from "./mortgageLeadForm.utils.js";
9
- import { Overlay } from "../../ExecutiveBio/Overlay.js";
10
- import { overlay } from "../../ExecutiveBio/ExecutiveBio.css.js";
11
- const AUTO_ADVANCE_DELAY = 1200;
12
- const initialValues = {
13
- mortgageType: "",
14
- propertyType: "",
15
- propertyUse: "",
16
- creditScore: "",
17
- purchasePrice: "",
18
- downPaymentPercent: 10,
19
- downPaymentAmount: "",
20
- estimatedHomeValue: "",
21
- currentLoanBalance: "",
22
- cashOutAmount: "",
23
- zipCode: "",
24
- amortizationType: "",
25
- fixedLoanType: "",
26
- loanTerm: "",
27
- desiredRate: "",
28
- discountPoints: "",
29
- firstName: "",
30
- lastName: "",
31
- email: "",
32
- phoneNumber: ""
33
- };
34
- function MortgageRateStep() {
35
- const [currentStepIndex, setCurrentStepIndex] = useState(0);
36
- const [values, setValues] = useState(initialValues);
37
- const [errors, setErrors] = useState({});
38
- const [submitted, setSubmitted] = useState(false);
39
- const [isAutoAdvancing, setIsAutoAdvancing] = useState(false);
40
- const [lastInteractedRadioStep, setLastInteractedRadioStep] = useState(null);
41
- const [radioSelectionVersion, setRadioSelectionVersion] = useState(0);
42
- const autoAdvanceTimeout = useRef(null);
43
- const isPurchase = values.mortgageType === "purchase-rates";
44
- const isRefinance = values.mortgageType === "refinance-rates";
45
- const showFixedLoanTypeStep = values.amortizationType === "fixed";
46
- const steps = useMemo(() => {
47
- const base = [
48
- "mortgageType",
49
- "propertyType",
50
- "propertyUse",
51
- "creditScore",
52
- "propertyDetails",
53
- "amortizationType"
54
- ];
55
- if (showFixedLoanTypeStep) {
56
- base.push("fixedLoanType");
57
- }
58
- base.push("loanTerm", "finalDetails", "contact");
59
- return base;
60
- }, [showFixedLoanTypeStep]);
61
- const totalSteps = steps.length;
62
- const stepKey = steps[currentStepIndex];
63
- const progress = (currentStepIndex + 1) / totalSteps * 100;
64
- const purchaseDownPaymentPreview = useMemo(() => {
65
- const raw = parseCurrencyInput(values.downPaymentAmount);
66
- return formatCurrency(raw);
67
- }, [values.downPaymentAmount]);
68
- const clearAutoAdvance = () => {
69
- if (autoAdvanceTimeout.current) {
70
- clearTimeout(autoAdvanceTimeout.current);
71
- autoAdvanceTimeout.current = null;
72
- }
73
- setIsAutoAdvancing(false);
74
- };
75
- useEffect(() => {
76
- return () => clearAutoAdvance();
77
- }, []);
78
- const updateValue = (key, value) => {
79
- setValues((prev) => {
80
- const next = { ...prev, [key]: value };
81
- if (key === "purchasePrice") {
82
- next.downPaymentAmount = calculatePercentAmount(
83
- String(value),
84
- next.downPaymentPercent
85
- );
86
- }
87
- if (key === "downPaymentPercent") {
88
- next.downPaymentAmount = calculatePercentAmount(
89
- next.purchasePrice,
90
- Number(value)
91
- );
92
- }
93
- if (key === "amortizationType") {
94
- next.fixedLoanType = "";
95
- next.loanTerm = "";
96
- }
97
- return next;
98
- });
99
- setErrors((prev) => {
100
- const next = { ...prev };
101
- delete next[String(key)];
102
- return next;
103
- });
104
- };
105
- const validateStep = (step) => {
106
- const nextErrors = {};
107
- if (step === "mortgageType" && !values.mortgageType) {
108
- nextErrors.mortgageType = "Please select a mortgage type.";
109
- }
110
- if (step === "propertyType" && !values.propertyType) {
111
- nextErrors.propertyType = "Please select a property type.";
112
- }
113
- if (step === "propertyUse" && !values.propertyUse) {
114
- nextErrors.propertyUse = "Please select how the property will be used.";
115
- }
116
- if (step === "creditScore" && !values.creditScore) {
117
- nextErrors.creditScore = "Please select your estimated credit score.";
118
- }
119
- if (step === "propertyDetails") {
120
- if (isPurchase) {
121
- if (!values.purchasePrice.trim()) {
122
- nextErrors.purchasePrice = "Please enter a purchase price.";
123
- }
124
- if (!values.zipCode.trim()) {
125
- nextErrors.zipCode = "Please enter a ZIP Code.";
126
- } else if (!validateZipCode(values.zipCode)) {
127
- nextErrors.zipCode = "Please enter a valid 5-digit ZIP Code.";
128
- }
129
- }
130
- if (isRefinance) {
131
- if (!values.estimatedHomeValue.trim()) {
132
- nextErrors.estimatedHomeValue = "Please enter an estimated home value.";
133
- }
134
- if (!values.currentLoanBalance.trim()) {
135
- nextErrors.currentLoanBalance = "Please enter your current loan balance.";
136
- }
137
- if (!values.zipCode.trim()) {
138
- nextErrors.zipCode = "Please enter a ZIP Code.";
139
- } else if (!validateZipCode(values.zipCode)) {
140
- nextErrors.zipCode = "Please enter a valid 5-digit ZIP Code.";
141
- }
142
- }
143
- }
144
- if (step === "amortizationType" && !values.amortizationType) {
145
- nextErrors.amortizationType = "Please select an amortization type.";
146
- }
147
- if (step === "fixedLoanType" && !values.fixedLoanType) {
148
- nextErrors.fixedLoanType = "Please select a loan type.";
149
- }
150
- if (step === "loanTerm" && !values.loanTerm) {
151
- nextErrors.loanTerm = "Please select a desired loan term.";
152
- }
153
- if (step === "finalDetails") {
154
- if (!values.desiredRate.trim()) {
155
- nextErrors.desiredRate = "Please enter your desired rate.";
156
- }
157
- }
158
- if (step === "contact") {
159
- if (!values.firstName.trim()) {
160
- nextErrors.firstName = "Please enter your first name.";
161
- }
162
- if (!values.lastName.trim()) {
163
- nextErrors.lastName = "Please enter your last name.";
164
- }
165
- if (!values.email.trim()) {
166
- nextErrors.email = "Please enter your email address.";
167
- } else if (!validateEmail(values.email)) {
168
- nextErrors.email = "Please enter a valid email address.";
169
- }
170
- if (!values.phoneNumber.trim()) {
171
- nextErrors.phoneNumber = "Please enter your phone number.";
172
- } else if (!validatePhone(values.phoneNumber)) {
173
- nextErrors.phoneNumber = "Please enter a valid 10-digit phone number.";
174
- }
175
- }
176
- setErrors(nextErrors);
177
- return Object.keys(nextErrors).length === 0;
178
- };
179
- const goNext = () => {
180
- clearAutoAdvance();
181
- if (!validateStep(stepKey)) return;
182
- if (currentStepIndex === totalSteps - 1) {
183
- console.log("Mortgage lead form submitted:", values);
184
- setSubmitted(true);
185
- return;
186
- }
187
- setLastInteractedRadioStep(null);
188
- setCurrentStepIndex((prev) => prev + 1);
189
- };
190
- const goBack = () => {
191
- clearAutoAdvance();
192
- setErrors({});
193
- setIsAutoAdvancing(false);
194
- setLastInteractedRadioStep(null);
195
- setCurrentStepIndex((prev) => Math.max(0, prev - 1));
196
- };
197
- const getAutoAdvanceValue = () => {
198
- switch (stepKey) {
199
- case "mortgageType":
200
- return values.mortgageType;
201
- case "propertyType":
202
- return values.propertyType;
203
- case "propertyUse":
204
- return values.propertyUse;
205
- case "creditScore":
206
- return values.creditScore;
207
- case "amortizationType":
208
- return values.amortizationType;
209
- case "fixedLoanType":
210
- return values.fixedLoanType;
211
- case "loanTerm":
212
- return values.loanTerm;
213
- default:
214
- return "";
215
- }
216
- };
217
- const isAutoAdvanceStep = (key) => {
218
- return [
219
- "mortgageType",
220
- "propertyType",
221
- "propertyUse",
222
- "creditScore",
223
- "amortizationType",
224
- "fixedLoanType",
225
- "loanTerm"
226
- ].includes(key);
227
- };
228
- const registerRadioInteraction = (step) => {
229
- setLastInteractedRadioStep(step);
230
- setRadioSelectionVersion((prev) => prev + 1);
231
- };
232
- useEffect(() => {
233
- clearAutoAdvance();
234
- if (!isAutoAdvanceStep(stepKey)) return;
235
- const selectedValue = getAutoAdvanceValue();
236
- if (!selectedValue) return;
237
- if (lastInteractedRadioStep !== stepKey) return;
238
- setIsAutoAdvancing(true);
239
- autoAdvanceTimeout.current = setTimeout(() => {
240
- if (currentStepIndex === totalSteps - 1) return;
241
- setCurrentStepIndex((prev) => prev + 1);
242
- setIsAutoAdvancing(false);
243
- }, AUTO_ADVANCE_DELAY);
244
- return () => clearAutoAdvance();
245
- }, [
246
- currentStepIndex,
247
- totalSteps,
248
- stepKey,
249
- lastInteractedRadioStep,
250
- radioSelectionVersion,
251
- values.mortgageType,
252
- values.propertyType,
253
- values.propertyUse,
254
- values.creditScore,
255
- values.amortizationType,
256
- values.fixedLoanType,
257
- values.loanTerm
258
- ]);
259
- const getStepTitle = () => {
260
- switch (stepKey) {
261
- case "mortgageType":
262
- return "What type of mortgage are you interested in?";
263
- case "propertyType":
264
- return "What kind of property type are you looking to finance?";
265
- case "propertyUse":
266
- return "How will you use this property?";
267
- case "creditScore":
268
- return "What's your estimated credit score?";
269
- case "propertyDetails":
270
- return "Let us know more about the property";
271
- case "amortizationType":
272
- return "What is your preferred amortization type on the loan?";
273
- case "fixedLoanType":
274
- return "Which loan type are interested in?";
275
- case "loanTerm":
276
- return "What is your desired loan term?";
277
- case "finalDetails":
278
- return "Some final details...";
279
- case "contact":
280
- return "Let us know how we can reach you";
281
- default:
282
- return "";
283
- }
284
- };
285
- const getStepDescription = () => {
286
- switch (stepKey) {
287
- case "mortgageType":
288
- return "Select the option that best matches your needs.";
289
- case "propertyUse":
290
- return "Describe how you plan to use the property to help us find the best mortgage options for you.";
291
- case "propertyDetails":
292
- return "Please provide these additional details to better understand your mortgage needs.";
293
- case "amortizationType":
294
- return "Selecting an amortization type helps us tailor loan options that fit your financial goals and preferences.";
295
- case "fixedLoanType":
296
- return "Choose the loan type that best describes the mortgage you are seeking.";
297
- case "loanTerm":
298
- return "Select the length of time (in years) for your loan term.";
299
- case "finalDetails":
300
- return "Almost there! Please provide these final details to help us find the best rates for you.";
301
- default:
302
- return "";
303
- }
304
- };
305
- const renderAutoAdvanceStatus = () => {
306
- if (!isAutoAdvancing || !isAutoAdvanceStep(stepKey)) return null;
307
- return /* @__PURE__ */ jsxs("div", { className: autoAdvanceStatus, "aria-live": "polite", children: [
308
- /* @__PURE__ */ jsx("span", { className: autoAdvanceText, children: "Continuing…" }),
309
- /* @__PURE__ */ jsx("div", { className: autoAdvanceTrack, children: /* @__PURE__ */ jsx("div", { className: autoAdvanceBar }) })
310
- ] });
311
- };
312
- const renderStep = () => {
313
- switch (stepKey) {
314
- case "mortgageType":
315
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
316
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
317
- /* @__PURE__ */ jsx(
318
- RadioGroup,
319
- {
320
- value: values.mortgageType,
321
- onChange: (value) => {
322
- updateValue("mortgageType", value);
323
- registerRadioInteraction("mortgageType");
324
- },
325
- className: radioGrid,
326
- children: mortgageTypeOptions.map((option) => {
327
- const checked = values.mortgageType === option.value;
328
- return /* @__PURE__ */ jsx(
329
- Radio,
330
- {
331
- value: option.value,
332
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
333
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
334
- },
335
- option.value
336
- );
337
- })
338
- }
339
- ),
340
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
341
- renderAutoAdvanceStatus(),
342
- errors.mortgageType ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.mortgageType }) : null
343
- ] });
344
- case "propertyType":
345
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, style: { marginTop: "24px" }, children: [
346
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
347
- /* @__PURE__ */ jsx(
348
- RadioGroup,
349
- {
350
- value: values.propertyType,
351
- onChange: (value) => {
352
- updateValue("propertyType", value);
353
- registerRadioInteraction("propertyType");
354
- },
355
- className: radioGrid,
356
- style: {
357
- gridTemplateColumns: "repeat(auto-fit,minmax(258px,1fr))"
358
- },
359
- children: propertyTypeOptions.map((option) => {
360
- const checked = values.propertyType === option.value;
361
- return /* @__PURE__ */ jsx(
362
- Radio,
363
- {
364
- value: option.value,
365
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
366
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
367
- },
368
- option.value
369
- );
370
- })
371
- }
372
- ),
373
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
374
- renderAutoAdvanceStatus(),
375
- errors.propertyType ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.propertyType }) : null
376
- ] });
377
- case "propertyUse":
378
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
379
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
380
- /* @__PURE__ */ jsx(
381
- RadioGroup,
382
- {
383
- value: values.propertyUse,
384
- onChange: (value) => {
385
- updateValue("propertyUse", value);
386
- registerRadioInteraction("propertyUse");
387
- },
388
- className: radioGrid,
389
- style: {
390
- gridTemplateColumns: "repeat(auto-fit,minmax(258px,1fr))"
391
- },
392
- children: propertyUseOptions.map((option) => {
393
- const checked = values.propertyUse === option.value;
394
- return /* @__PURE__ */ jsx(
395
- Radio,
396
- {
397
- value: option.value,
398
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
399
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
400
- },
401
- option.value
402
- );
403
- })
404
- }
405
- ),
406
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
407
- renderAutoAdvanceStatus(),
408
- errors.propertyUse ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.propertyUse }) : null
409
- ] });
410
- case "creditScore":
411
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, style: { marginTop: "24px" }, children: [
412
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
413
- /* @__PURE__ */ jsx(
414
- RadioGroup,
415
- {
416
- value: values.creditScore,
417
- onChange: (value) => {
418
- updateValue("creditScore", value);
419
- registerRadioInteraction("creditScore");
420
- },
421
- className: radioGrid,
422
- children: creditScoreOptions.map((option) => {
423
- const checked = values.creditScore === option.value;
424
- return /* @__PURE__ */ jsx(
425
- Radio,
426
- {
427
- value: option.value,
428
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
429
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
430
- },
431
- option.value
432
- );
433
- })
434
- }
435
- ),
436
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
437
- renderAutoAdvanceStatus(),
438
- errors.creditScore ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.creditScore }) : null
439
- ] });
440
- case "propertyDetails":
441
- if (isPurchase) {
442
- return /* @__PURE__ */ jsxs("div", { className: inputGrid, children: [
443
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
444
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Purchase Price" }),
445
- /* @__PURE__ */ jsx(
446
- Input,
447
- {
448
- className: input,
449
- inputMode: "numeric",
450
- placeholder: "Enter your purchase price",
451
- value: values.purchasePrice ? `$${values.purchasePrice}` : "",
452
- onChange: (e) => updateValue(
453
- "purchasePrice",
454
- formatCurrencyInput(e.target.value)
455
- )
456
- }
457
- ),
458
- errors.purchasePrice ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.purchasePrice }) : null
459
- ] }),
460
- /* @__PURE__ */ jsxs(Field, { className: sliderWrap, children: [
461
- /* @__PURE__ */ jsxs("div", { className: sliderHeader, children: [
462
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Down Payment" }),
463
- /* @__PURE__ */ jsxs("span", { className: sliderValue, children: [
464
- values.downPaymentPercent,
465
- "%"
466
- ] })
467
- ] }),
468
- /* @__PURE__ */ jsx(
469
- "input",
470
- {
471
- className: slider,
472
- type: "range",
473
- min: 0,
474
- max: 100,
475
- step: 1,
476
- value: values.downPaymentPercent,
477
- onChange: (e) => updateValue("downPaymentPercent", Number(e.target.value)),
478
- "aria-label": "Down payment percentage"
479
- }
480
- ),
481
- /* @__PURE__ */ jsx("p", { className: helperText, children: "Move the slider to estimate your down payment amount instantly." }),
482
- /* @__PURE__ */ jsxs("div", { className: amountPreview, children: [
483
- /* @__PURE__ */ jsx("span", { className: amountPreviewLabel, children: "Estimated down payment amount" }),
484
- /* @__PURE__ */ jsx("div", { className: amountPreviewValue, children: purchaseDownPaymentPreview })
485
- ] })
486
- ] }),
487
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
488
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "ZIP Code" }),
489
- /* @__PURE__ */ jsx(
490
- Input,
491
- {
492
- className: input,
493
- inputMode: "numeric",
494
- placeholder: "Enter ZIP Code",
495
- value: values.zipCode,
496
- onChange: (e) => updateValue(
497
- "zipCode",
498
- e.target.value.replace(/[^\d]/g, "").slice(0, 5)
499
- )
500
- }
501
- ),
502
- errors.zipCode ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.zipCode }) : null
503
- ] })
504
- ] });
505
- }
506
- return /* @__PURE__ */ jsxs(
507
- "div",
508
- {
509
- className: inputGrid,
510
- style: {
511
- gridTemplateColumns: "repeat(auto-fit,minmax(258px,1fr))"
512
- },
513
- children: [
514
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
515
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Estimated Home Value" }),
516
- /* @__PURE__ */ jsx(
517
- Input,
518
- {
519
- className: input,
520
- inputMode: "numeric",
521
- placeholder: "Enter your home value",
522
- value: values.estimatedHomeValue ? `$${values.estimatedHomeValue}` : "",
523
- onChange: (e) => updateValue(
524
- "estimatedHomeValue",
525
- formatCurrencyInput(e.target.value)
526
- )
527
- }
528
- ),
529
- errors.estimatedHomeValue ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.estimatedHomeValue }) : null
530
- ] }),
531
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
532
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Current Loan Balance" }),
533
- /* @__PURE__ */ jsx(
534
- Input,
535
- {
536
- className: input,
537
- inputMode: "numeric",
538
- placeholder: "Enter your loan balance",
539
- value: values.currentLoanBalance ? `$${values.currentLoanBalance}` : "",
540
- onChange: (e) => updateValue(
541
- "currentLoanBalance",
542
- formatCurrencyInput(e.target.value)
543
- )
544
- }
545
- ),
546
- errors.currentLoanBalance ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.currentLoanBalance }) : null
547
- ] }),
548
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
549
- /* @__PURE__ */ jsxs(Label, { className: fieldLabel, children: [
550
- "Cash Out Amount",
551
- " ",
552
- /* @__PURE__ */ jsx("span", { className: optionalText, children: "(Optional)" })
553
- ] }),
554
- /* @__PURE__ */ jsx(
555
- Input,
556
- {
557
- className: input,
558
- inputMode: "numeric",
559
- placeholder: "Enter cash out amount",
560
- value: values.cashOutAmount ? `$${values.cashOutAmount}` : "",
561
- onChange: (e) => updateValue(
562
- "cashOutAmount",
563
- formatCurrencyInput(e.target.value)
564
- )
565
- }
566
- )
567
- ] }),
568
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
569
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "ZIP Code" }),
570
- /* @__PURE__ */ jsx(
571
- Input,
572
- {
573
- className: input,
574
- inputMode: "numeric",
575
- placeholder: "Enter ZIP Code",
576
- value: values.zipCode,
577
- onChange: (e) => updateValue(
578
- "zipCode",
579
- e.target.value.replace(/[^\d]/g, "").slice(0, 5)
580
- )
581
- }
582
- ),
583
- errors.zipCode ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.zipCode }) : null
584
- ] })
585
- ]
586
- }
587
- );
588
- case "amortizationType":
589
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
590
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
591
- /* @__PURE__ */ jsx(
592
- RadioGroup,
593
- {
594
- value: values.amortizationType,
595
- onChange: (value) => {
596
- updateValue("amortizationType", value);
597
- registerRadioInteraction("amortizationType");
598
- },
599
- className: inputRowTwo,
600
- children: amortizationTypeOptions.map((option) => {
601
- const checked = values.amortizationType === option.value;
602
- return /* @__PURE__ */ jsx(
603
- Radio,
604
- {
605
- value: option.value,
606
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
607
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
608
- },
609
- option.value
610
- );
611
- })
612
- }
613
- ),
614
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
615
- renderAutoAdvanceStatus(),
616
- errors.amortizationType ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.amortizationType }) : null
617
- ] });
618
- case "fixedLoanType":
619
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
620
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
621
- /* @__PURE__ */ jsx(
622
- RadioGroup,
623
- {
624
- value: values.fixedLoanType,
625
- onChange: (value) => {
626
- updateValue("fixedLoanType", value);
627
- registerRadioInteraction("fixedLoanType");
628
- },
629
- className: inputRowTwo,
630
- children: fixedLoanTypeOptions.map((option) => {
631
- const checked = values.fixedLoanType === option.value;
632
- return /* @__PURE__ */ jsx(
633
- Radio,
634
- {
635
- value: option.value,
636
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
637
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
638
- },
639
- option.value
640
- );
641
- })
642
- }
643
- ),
644
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
645
- renderAutoAdvanceStatus(),
646
- errors.fixedLoanType ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.fixedLoanType }) : null
647
- ] });
648
- case "loanTerm":
649
- const loanTermOptions = values.amortizationType === "fixed" ? fixedLoanTermOptions : armLoanTermOptions;
650
- return /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
651
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Choose one" }),
652
- /* @__PURE__ */ jsx(
653
- RadioGroup,
654
- {
655
- value: values.loanTerm,
656
- onChange: (value) => {
657
- updateValue("loanTerm", value);
658
- registerRadioInteraction("loanTerm");
659
- },
660
- className: inputRowTwo,
661
- children: loanTermOptions.map((option) => {
662
- const checked = values.loanTerm === option.value;
663
- return /* @__PURE__ */ jsx(
664
- Radio,
665
- {
666
- value: option.value,
667
- className: `${radioOption} ${checked ? radioOptionChecked : ""}`,
668
- children: /* @__PURE__ */ jsx("span", { className: radioText, children: option.label })
669
- },
670
- option.value
671
- );
672
- })
673
- }
674
- ),
675
- /* @__PURE__ */ jsx("p", { className: autoAdvanceHint, children: "Your selection will continue automatically." }),
676
- renderAutoAdvanceStatus(),
677
- errors.loanTerm ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.loanTerm }) : null
678
- ] });
679
- case "finalDetails":
680
- return /* @__PURE__ */ jsxs("div", { className: inputGrid, children: [
681
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
682
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Desired Rate" }),
683
- /* @__PURE__ */ jsx(
684
- Input,
685
- {
686
- className: input,
687
- type: "text",
688
- inputMode: "decimal",
689
- placeholder: "6.25%",
690
- value: values.desiredRate ? `${values.desiredRate}%` : "",
691
- onChange: (e) => updateValue("desiredRate", formatPercentInput(e.target.value))
692
- }
693
- ),
694
- errors.desiredRate ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.desiredRate }) : null
695
- ] }),
696
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
697
- /* @__PURE__ */ jsxs(Label, { className: fieldLabel, children: [
698
- "Discount Points",
699
- " ",
700
- /* @__PURE__ */ jsx("span", { className: optionalText, children: "(Optional)" })
701
- ] }),
702
- /* @__PURE__ */ jsx(
703
- Input,
704
- {
705
- className: input,
706
- type: "text",
707
- inputMode: "decimal",
708
- placeholder: "1.0",
709
- value: values.discountPoints,
710
- onChange: (e) => updateValue("discountPoints", e.target.value)
711
- }
712
- )
713
- ] })
714
- ] });
715
- case "contact":
716
- return /* @__PURE__ */ jsxs("div", { className: inputGrid, style: { marginTop: "24px" }, children: [
717
- /* @__PURE__ */ jsxs("div", { className: inputRowTwo, children: [
718
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
719
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "First Name" }),
720
- /* @__PURE__ */ jsx(
721
- Input,
722
- {
723
- className: input,
724
- type: "text",
725
- placeholder: "Enter your first name",
726
- value: values.firstName,
727
- onChange: (e) => updateValue("firstName", e.target.value)
728
- }
729
- ),
730
- errors.firstName ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.firstName }) : null
731
- ] }),
732
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
733
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Last Name" }),
734
- /* @__PURE__ */ jsx(
735
- Input,
736
- {
737
- className: input,
738
- type: "text",
739
- placeholder: "Enter your last name",
740
- value: values.lastName,
741
- onChange: (e) => updateValue("lastName", e.target.value)
742
- }
743
- ),
744
- errors.lastName ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.lastName }) : null
745
- ] })
746
- ] }),
747
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
748
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Email" }),
749
- /* @__PURE__ */ jsx(
750
- Input,
751
- {
752
- className: input,
753
- type: "email",
754
- placeholder: "Enter your email",
755
- value: values.email,
756
- onChange: (e) => updateValue("email", e.target.value)
757
- }
758
- ),
759
- errors.email ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.email }) : null
760
- ] }),
761
- /* @__PURE__ */ jsxs(Field, { className: fieldBlock, children: [
762
- /* @__PURE__ */ jsx(Label, { className: fieldLabel, children: "Phone Number" }),
763
- /* @__PURE__ */ jsx(
764
- Input,
765
- {
766
- className: input,
767
- type: "tel",
768
- inputMode: "tel",
769
- placeholder: "(XXX) XXX-XXXX",
770
- value: values.phoneNumber,
771
- onChange: (e) => updateValue("phoneNumber", formatPhoneInput(e.target.value))
772
- }
773
- ),
774
- errors.phoneNumber ? /* @__PURE__ */ jsx("p", { className: errorText, children: errors.phoneNumber }) : null
775
- ] })
776
- ] });
777
- default:
778
- return null;
779
- }
780
- };
781
- if (submitted) {
782
- return /* @__PURE__ */ jsx("section", { className: section, children: /* @__PURE__ */ jsxs("div", { className: formShell, children: [
783
- /* @__PURE__ */ jsxs("div", { className: successWrap, children: [
784
- /* @__PURE__ */ jsx("h2", { className: successTitle, children: "Thanks for your submission" }),
785
- /* @__PURE__ */ jsx("p", { className: successText, children: "Your information has been received. An Axos team member may follow up with next steps based on your inquiry." })
786
- ] }),
787
- /* @__PURE__ */ jsxs("div", { className: disclosure, children: [
788
- /* @__PURE__ */ jsx("p", { className: disclosureTitle, children: "Important information" }),
789
- /* @__PURE__ */ jsx("p", { className: disclosureText, children: "Mortgage products are offered by Axos Bank. All loan applications are subject to credit and property approval. Terms, conditions, and program availability are subject to change without notice. This is not a commitment to lend. Additional disclosures may apply. NMLS #524995." })
790
- ] })
791
- ] }) });
792
- }
793
- const isCurrentStepAutoAdvanceStep = isAutoAdvanceStep(stepKey);
794
- const continueButtonLabel = isCurrentStepAutoAdvanceStep && isAutoAdvancing ? "Continuing…" : currentStepIndex === totalSteps - 1 ? "Submit" : "Continue";
795
- const continueButtonDisabled = isCurrentStepAutoAdvanceStep && isAutoAdvancing;
796
- return /* @__PURE__ */ jsxs("section", { className: section, children: [
797
- stepKey === "mortgageType" && /* @__PURE__ */ jsxs("div", { className: "text_center", children: [
798
- /* @__PURE__ */ jsx("h1", { className: mainTitle, children: "Rate Watch" }),
799
- /* @__PURE__ */ jsx("p", { className: mainDescription, children: "Get a personalized rate based on your needs. It only takes a few minutes." })
800
- ] }),
801
- /* @__PURE__ */ jsxs("div", { className: formShell, children: [
802
- /* @__PURE__ */ jsxs("div", { className: progressWrap, children: [
803
- /* @__PURE__ */ jsxs("div", { className: progressRow, children: [
804
- /* @__PURE__ */ jsxs("span", { className: progressLabel, children: [
805
- "Step ",
806
- currentStepIndex + 1,
807
- " of ",
808
- totalSteps
809
- ] }),
810
- /* @__PURE__ */ jsxs("span", { className: progressLabel, children: [
811
- Math.round(progress),
812
- "%"
813
- ] })
814
- ] }),
815
- /* @__PURE__ */ jsx("div", { className: progressTrack, children: /* @__PURE__ */ jsx(
816
- "div",
817
- {
818
- className: progressFill,
819
- style: { width: `${progress}%` }
820
- }
821
- ) })
822
- ] }),
823
- /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxs(
824
- motion.div,
825
- {
826
- className: stepPanel,
827
- initial: { opacity: 0, x: 28 },
828
- animate: { opacity: 1, x: 0 },
829
- exit: { opacity: 0, x: -28 },
830
- transition: { duration: 0.24, ease: "easeOut" },
831
- children: [
832
- /* @__PURE__ */ jsx("h2", { className: title, children: getStepTitle() }),
833
- getStepDescription() ? /* @__PURE__ */ jsx("p", { className: description, children: getStepDescription() }) : null,
834
- renderStep(),
835
- /* @__PURE__ */ jsxs("div", { className: actions, children: [
836
- /* @__PURE__ */ jsx(
837
- Button,
838
- {
839
- type: "button",
840
- className: secondaryButton,
841
- onClick: goBack,
842
- disabled: currentStepIndex === 0,
843
- children: "Back"
844
- }
845
- ),
846
- /* @__PURE__ */ jsx(
847
- Button,
848
- {
849
- type: "button",
850
- className: primaryButton,
851
- onClick: goNext,
852
- disabled: continueButtonDisabled,
853
- children: continueButtonLabel
854
- }
855
- )
856
- ] }),
857
- stepKey === "mortgageType" && /* @__PURE__ */ jsxs("div", { className: disclosure, children: [
858
- /* @__PURE__ */ jsx("p", { className: disclosureTitle, children: "Important information" }),
859
- /* @__PURE__ */ jsx("p", { className: disclosureText, children: "By continuing, you agree to provide information so Axos can better understand your mortgage needs. Mortgage products are subject to underwriting and approval. Rates, terms, and product availability may vary based on credit profile, property type, occupancy, loan amount, and other factors. This form is for informational purposes only and is not a commitment to lend. NMLS #524995." })
860
- ] })
861
- ]
862
- },
863
- stepKey
864
- ) })
865
- ] }),
866
- /* @__PURE__ */ jsx(
867
- Overlay,
868
- {
869
- className: `${overlay} ${overlayOpacity}`,
870
- variant: "secondary"
871
- }
872
- )
873
- ] });
874
- }
875
- export {
876
- MortgageRateStep
877
- };