@axos-web-dev/shared-components 2.0.0-queryparams.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +111 -111
  2. package/dist/ATMLocator/ATMLocator.d.ts +1 -1
  3. package/dist/ATMLocator/ATMLocator.js +2 -3
  4. package/dist/Accordion/Accordion.d.ts +3 -3
  5. package/dist/Article/Article.d.ts +1 -1
  6. package/dist/Auth/ErrorAlert.d.ts +1 -1
  7. package/dist/Auth/ErrorAlert.js +2 -3
  8. package/dist/Auth/Logout.d.ts +1 -1
  9. package/dist/Auth/SignInPassword.d.ts +1 -1
  10. package/dist/Avatar/Avatar.module.js +7 -7
  11. package/dist/Blockquote/Blockquote.module.js +3 -3
  12. package/dist/BulletItem/BulletItem.d.ts +1 -1
  13. package/dist/Button/Button.d.ts +1 -1
  14. package/dist/Button/Button.js +3 -22
  15. package/dist/Button/GoBackButton.d.ts +1 -1
  16. package/dist/Calculators/AnnualFeeCalculator/index.js +1 -1
  17. package/dist/Calculators/ApyCalculator/ApyCalculator.css.d.ts +46 -5
  18. package/dist/Calculators/ApyCalculator/ApyCalculator.css.js +72 -19
  19. package/dist/Calculators/ApyCalculator/index.js +583 -293
  20. package/dist/Calculators/Calculator.d.ts +1 -1
  21. package/dist/Calculators/Calculator.js +4 -5
  22. package/dist/Calculators/MarginTradingCalculator/index.js +2 -3
  23. package/dist/Calculators/MarineLoanMonthlyPaymentCalculator/index.js +1 -1
  24. package/dist/Calculators/MaxLoanCalculator/index.js +1 -1
  25. package/dist/Calculators/MonthlyPaymentCalculator/index.js +1 -1
  26. package/dist/Calculators/calculator.css.d.ts +21 -1
  27. package/dist/Calculators/calculator.css.js +3 -3
  28. package/dist/Carousel/index.d.ts +3 -3
  29. package/dist/Carousel/index.js +3 -4
  30. package/dist/Chatbot/Bubble.d.ts +2 -1
  31. package/dist/Chatbot/Chat.d.ts +1 -1
  32. package/dist/Chatbot/ChatWindow.js +31 -19
  33. package/dist/Chatbot/Chatbot.d.ts +11 -3
  34. package/dist/Chatbot/Chatbot.js +98 -66
  35. package/dist/Chatbot/ChatbotMessage.d.ts +1 -0
  36. package/dist/Chatbot/ChatbotMessage.js +5 -1
  37. package/dist/Chatbot/EllipsisAnimation.d.ts +1 -1
  38. package/dist/Chatbot/EllipsisIcon.d.ts +1 -1
  39. package/dist/Chevron/index.js +2 -15
  40. package/dist/Comparison/Comparison.d.ts +1 -1
  41. package/dist/Comparison/Comparison.js +2 -3
  42. package/dist/Comparison/ComparisonSet.d.ts +1 -1
  43. package/dist/ExecutiveBio/ExecutiveBio.d.ts +1 -1
  44. package/dist/ExecutiveBio/ExecutiveBio.js +2 -3
  45. package/dist/ExecutiveBio/ExecutiveBioSet.d.ts +1 -1
  46. package/dist/ExecutiveBio/Overlay.d.ts +1 -1
  47. package/dist/FaqAccordion/index.d.ts +5 -5
  48. package/dist/FaqAccordion/index.js +2 -3
  49. package/dist/FdicCallout/FdicCallout.module.js +2 -2
  50. package/dist/FdicCallout/index.d.ts +1 -1
  51. package/dist/FooterDisclosure/FooterDisclosure.d.ts +4 -4
  52. package/dist/FooterDisclosure/LVF/LaVictorieFooter.d.ts +1 -1
  53. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.d.ts +1 -1
  54. package/dist/FooterSiteMap/AxosBank/FooterSiteMap.js +20 -3
  55. package/dist/Forms/ApplicationStart.d.ts +1 -1
  56. package/dist/Forms/ApplyNow.d.ts +1 -1
  57. package/dist/Forms/ApplyNow.js +3 -4
  58. package/dist/Forms/BoatMooringLocation.d.ts +7 -2
  59. package/dist/Forms/BoatMooringLocation.js +145 -8
  60. package/dist/Forms/ClearingForm.d.ts +1 -1
  61. package/dist/Forms/CommercialDeposits.d.ts +1 -1
  62. package/dist/Forms/CommercialDepositsNoLendingOption.d.ts +1 -1
  63. package/dist/Forms/CommercialLending.d.ts +1 -1
  64. package/dist/Forms/CommercialPremiumFinance.d.ts +1 -1
  65. package/dist/Forms/ConstructionLendingDynamic.d.ts +1 -1
  66. package/dist/Forms/ContactCompany.d.ts +1 -1
  67. package/dist/Forms/ContactCompanyTitle.d.ts +1 -1
  68. package/dist/Forms/ContactUs.d.ts +1 -1
  69. package/dist/Forms/ContactUsAAS.d.ts +1 -1
  70. package/dist/Forms/ContactUsBusiness.d.ts +1 -1
  71. package/dist/Forms/ContactUsBusiness.js +2 -3
  72. package/dist/Forms/ContactUsBusinessNameEmail.d.ts +1 -1
  73. package/dist/Forms/ContactUsBusinessNameEmail.js +2 -3
  74. package/dist/Forms/ContactUsLVF.d.ts +1 -1
  75. package/dist/Forms/ContactUsNMLSId.d.ts +1 -1
  76. package/dist/Forms/ContactUsNMLSId.js +2 -3
  77. package/dist/Forms/CpraRequest.d.ts +1 -1
  78. package/dist/Forms/CpraRequest.js +2 -3
  79. package/dist/Forms/CraPublicFile.d.ts +1 -1
  80. package/dist/Forms/CraPublicFile.js +2 -3
  81. package/dist/Forms/DealerServices.d.ts +1 -1
  82. package/dist/Forms/EmailOnly.d.ts +1 -1
  83. package/dist/Forms/EmailOnly.js +2 -3
  84. package/dist/Forms/EmailUs.d.ts +1 -1
  85. package/dist/Forms/EmailUs.js +40 -34
  86. package/dist/Forms/FormEnums.js +2 -2
  87. package/dist/Forms/Forms.css.d.ts +3 -0
  88. package/dist/Forms/Forms.css.js +39 -39
  89. package/dist/Forms/HoneyPot/index.d.ts +1 -1
  90. package/dist/Forms/MortgageRate/MortgageRateForm.d.ts +1 -1
  91. package/dist/Forms/MortgageRate/MortgageRateForm.js +3 -4
  92. package/dist/Forms/MortgageRate/MortgageRateQuoteFilters.d.ts +1 -1
  93. package/dist/Forms/MortgageRate/MortgageRateWatch.d.ts +1 -1
  94. package/dist/Forms/MortgageRate/MortgageRateWatch.js +3 -4
  95. package/dist/Forms/MortgageWarehouseLending.d.ts +1 -1
  96. package/dist/Forms/MortgageWarehouseLending.js +2 -3
  97. package/dist/Forms/QuickPricer/QuickPricerForm.d.ts +1 -1
  98. package/dist/Forms/QuickPricer/UserInformation.d.ts +1 -1
  99. package/dist/Forms/ScheduleCall.d.ts +1 -1
  100. package/dist/Forms/ScheduleCallPremier.d.ts +1 -1
  101. package/dist/Forms/SuccesForm.d.ts +1 -1
  102. package/dist/Forms/SuccesForm.js +4 -5
  103. package/dist/Forms/VendorQuestionnaire.d.ts +1 -1
  104. package/dist/Forms/WcplSurvey.d.ts +1 -1
  105. package/dist/HeroBanner/HeroBanner.css.d.ts +1 -0
  106. package/dist/HeroBanner/HeroBanner.css.js +19 -16
  107. package/dist/HeroBanner/HeroBanner.d.ts +1 -1
  108. package/dist/HeroBanner/HeroBanner.interface.d.ts +4 -1
  109. package/dist/HeroBanner/HeroBanner.js +26 -160
  110. package/dist/HeroBanner/HeroVideoPoster.d.ts +5 -0
  111. package/dist/HeroBanner/HeroVideoPoster.js +24 -0
  112. package/dist/HeroBanner/LargeBanner.css.d.ts +110 -0
  113. package/dist/HeroBanner/LargeBanner.css.js +22 -8
  114. package/dist/HeroBanner/LargeHeroBanner.d.ts +5 -0
  115. package/dist/HeroBanner/LargeHeroBanner.js +228 -0
  116. package/dist/HeroBanner/index.js +3 -2
  117. package/dist/Hyperlink/index.js +2 -15
  118. package/dist/IconBillboard/IconBillboard.d.ts +1 -1
  119. package/dist/IconBillboard/IconBillboardSet.d.ts +1 -1
  120. package/dist/IconBillboard/sections/CallToActionSection.d.ts +1 -1
  121. package/dist/IconBillboard/sections/CallToActionSection.js +3 -1
  122. package/dist/IconBillboard/sections/HeaderSection.d.ts +2 -2
  123. package/dist/IconBillboard/sections/IconSection.d.ts +1 -1
  124. package/dist/IconBillboard/sections/ItemsSection.d.ts +1 -1
  125. package/dist/IconBillboard/sections/LayoutSection.d.ts +1 -1
  126. package/dist/ImageBillboard/ExitIntentModal/ModalWrapper.d.ts +1 -1
  127. package/dist/ImageBillboard/ImageBillboard.d.ts +1 -1
  128. package/dist/ImageBillboard/ImageBillboardSet.d.ts +1 -1
  129. package/dist/ImageLink/ImageLink.d.ts +1 -1
  130. package/dist/ImageLink/ImageLink.js +2 -3
  131. package/dist/ImageLink/ImageLinkSet.d.ts +1 -1
  132. package/dist/ImageLink/ImageLinkSet.js +1 -2
  133. package/dist/ImageLink/index.js +2 -3
  134. package/dist/ImageWrapper/ImageWrapper.d.ts +1 -1
  135. package/dist/Insight/Featured/CategorySelector.d.ts +2 -2
  136. package/dist/Insight/Featured/CategorySelector.js +3 -4
  137. package/dist/Insight/Featured/Featured.d.ts +2 -2
  138. package/dist/Insight/Featured/Featured.js +3 -4
  139. package/dist/Insight/Featured/Header.d.ts +1 -1
  140. package/dist/Insight/Featured/Header.js +3 -4
  141. package/dist/Interstitial/Interstitial.module.js +10 -10
  142. package/dist/LandingPageHeader/LandingPageHeader.d.ts +1 -1
  143. package/dist/LoadingIndicator/index.d.ts +1 -1
  144. package/dist/MainHTML/index.d.ts +1 -1
  145. package/dist/Modal/Modal.js +2 -3
  146. package/dist/Modal/contextApi/store.d.ts +1 -1
  147. package/dist/NavigationMenu/AxosALTS/NavBar.module.js +23 -23
  148. package/dist/NavigationMenu/AxosALTS/index.d.ts +1 -1
  149. package/dist/NavigationMenu/AxosALTS/index.js +2 -3
  150. package/dist/NavigationMenu/AxosAdvisor/NavBar.module.js +52 -52
  151. package/dist/NavigationMenu/AxosAdvisor/SubNavBar.d.ts +1 -1
  152. package/dist/NavigationMenu/AxosAdvisor/index.d.ts +1 -1
  153. package/dist/NavigationMenu/AxosAdvisorServices/NavBar.module.js +53 -53
  154. package/dist/NavigationMenu/AxosAdvisorServices/SubNavBar.d.ts +1 -1
  155. package/dist/NavigationMenu/AxosAdvisorServices/index.d.ts +1 -1
  156. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.d.ts +1 -1
  157. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.js +2 -3
  158. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileMenu.module.js +27 -27
  159. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.d.ts +13 -8
  160. package/dist/NavigationMenu/AxosBank/MobileMenu/MobileNavData.js +29 -26
  161. package/dist/NavigationMenu/AxosBank/NavBar.module.js +39 -39
  162. package/dist/NavigationMenu/AxosBank/SubNavBar.d.ts +1 -1
  163. package/dist/NavigationMenu/AxosBank/SubNavBar.js +72 -38
  164. package/dist/NavigationMenu/AxosBank/index.d.ts +1 -1
  165. package/dist/NavigationMenu/AxosBank/index.js +31 -30
  166. package/dist/NavigationMenu/AxosClearing/NavBar.module.js +37 -37
  167. package/dist/NavigationMenu/AxosClearing/SubNavBar.d.ts +1 -1
  168. package/dist/NavigationMenu/AxosClearing/index.d.ts +1 -1
  169. package/dist/NavigationMenu/AxosFiduciary/NavBar.module.js +41 -41
  170. package/dist/NavigationMenu/AxosFiduciary/index.d.ts +1 -1
  171. package/dist/NavigationMenu/LaVictoire/NavBar.module.js +37 -37
  172. package/dist/NavigationMenu/LaVictoire/SubNavBar.d.ts +1 -1
  173. package/dist/NavigationMenu/LaVictoire/index.d.ts +1 -1
  174. package/dist/NavigationMenu/LaVictoire/index.js +2 -3
  175. package/dist/NavigationMenu/NavItem/index.d.ts +1 -1
  176. package/dist/NavigationMenu/Navbar.d.ts +1 -1
  177. package/dist/NavigationMenu/Navbar.js +2 -3
  178. package/dist/NavigationMenu/SignInNavButton.d.ts +3 -1
  179. package/dist/NavigationMenu/SignInNavButton.js +2 -3
  180. package/dist/Pagination/Pagination.d.ts +1 -1
  181. package/dist/SecondaryFooter/index.d.ts +1 -1
  182. package/dist/SetContainer/SetContainer.css.d.ts +1 -0
  183. package/dist/SetContainer/SetContainer.css.js +5 -3
  184. package/dist/SetContainer/SetContainer.d.ts +1 -1
  185. package/dist/SetContainer/SetContainer.js +10 -5
  186. package/dist/SetContainer/index.js +2 -1
  187. package/dist/SocialMediaBar/iconsRepository.d.ts +14 -14
  188. package/dist/SocialMediaBar/iconsRepository.js +2 -3
  189. package/dist/SocialMediaBar/index.d.ts +1 -1
  190. package/dist/Tab/Tab.d.ts +1 -1
  191. package/dist/Tab/TabContainer.d.ts +1 -1
  192. package/dist/Table/Table.css.d.ts +21 -1
  193. package/dist/Table/Table.css.js +18 -18
  194. package/dist/Table/Table.d.ts +5 -5
  195. package/dist/Table/Table.js +5 -3
  196. package/dist/TextBlock/TextBlock.d.ts +1 -1
  197. package/dist/Topic/Topic.d.ts +4 -4
  198. package/dist/VideoTile/VideoInit.d.ts +1 -1
  199. package/dist/VideoTile/VideoTile.js +2 -3
  200. package/dist/VideoWrapper/index.js +2 -3
  201. package/dist/WalnutIframe/index.d.ts +1 -1
  202. package/dist/WalnutIframe/wrapper.module.js +3 -3
  203. package/dist/assets/Avatar/Avatar.css +59 -59
  204. package/dist/assets/Blockquote/Blockquote.css +72 -72
  205. package/dist/assets/Calculators/ApyCalculator/ApyCalculator.css +350 -64
  206. package/dist/assets/Calculators/AxosOneCalculator/BalanceAPYCalculator.css +2 -2
  207. package/dist/assets/Calculators/calculator.css +25 -15
  208. package/dist/assets/Chatbot/AnimatedGradientBorder.css +1 -1
  209. package/dist/assets/Chatbot/ChatWindow.css +19 -19
  210. package/dist/assets/Comparison/Comparison.css +2 -2
  211. package/dist/assets/DownloadTile/DownloadTile.css +7 -0
  212. package/dist/assets/ExecutiveBio/ExecutiveBio.css +0 -2
  213. package/dist/assets/FdicCallout/FdicCallout.css +48 -48
  214. package/dist/assets/Forms/Forms.css +94 -91
  215. package/dist/assets/HeroBanner/HeroBanner.css +82 -65
  216. package/dist/assets/HeroBanner/LargeBanner.css +126 -59
  217. package/dist/assets/ImageBillboard/ImageBillboard.css +1 -1
  218. package/dist/assets/Interstitial/Interstitial.css +142 -142
  219. package/dist/assets/NavigationMenu/AxosALTS/NavBar.css +264 -264
  220. package/dist/assets/NavigationMenu/AxosAdvisor/NavBar.css +609 -609
  221. package/dist/assets/NavigationMenu/AxosAdvisorServices/NavBar.css +630 -630
  222. package/dist/assets/NavigationMenu/AxosBank/MobileMenu/MobileMenu.css +353 -353
  223. package/dist/assets/NavigationMenu/AxosBank/NavBar.css +445 -445
  224. package/dist/assets/NavigationMenu/AxosClearing/NavBar.css +484 -484
  225. package/dist/assets/NavigationMenu/AxosFiduciary/NavBar.css +427 -427
  226. package/dist/assets/NavigationMenu/LaVictoire/NavBar.css +429 -429
  227. package/dist/assets/SetContainer/SetContainer.css +25 -15
  228. package/dist/assets/Table/Table.css +90 -75
  229. package/dist/assets/TextBlock/TextBlock.css +7 -0
  230. package/dist/assets/VideoTile/VideoTile.css +6 -0
  231. package/dist/assets/WalnutIframe/wrapper.css +48 -48
  232. package/dist/assets/globals.css +9 -9
  233. package/dist/assets/themes/axos.css +8 -7
  234. package/dist/assets/themes/premier.css +9 -8
  235. package/dist/assets/themes/ufb.css +9 -8
  236. package/dist/assets/themes/victorie.css +9 -8
  237. package/dist/assets/utils/optimizeImage/optimizeImage.css +47 -47
  238. package/dist/icons/AxosX/Blue.d.ts +1 -1
  239. package/dist/icons/AxosX/index.d.ts +1 -1
  240. package/dist/icons/CheckCircle.d.ts +1 -1
  241. package/dist/icons/CheckCircleLight.d.ts +1 -1
  242. package/dist/icons/CheckIcon/index.d.ts +1 -1
  243. package/dist/icons/ChevronDown.d.ts +1 -1
  244. package/dist/icons/ChevronUp.d.ts +1 -1
  245. package/dist/icons/Clock/index.d.ts +1 -1
  246. package/dist/icons/EqualHousingLender.d.ts +1 -1
  247. package/dist/icons/Logos/AAS.d.ts +1 -1
  248. package/dist/icons/Logos/AFS.d.ts +1 -1
  249. package/dist/icons/Logos/AXA.d.ts +1 -1
  250. package/dist/icons/Logos/AXB.d.ts +1 -1
  251. package/dist/icons/Logos/AXC.d.ts +1 -1
  252. package/dist/icons/Logos/AXI.d.ts +1 -1
  253. package/dist/icons/Logos/AXOS.d.ts +1 -1
  254. package/dist/icons/Logos/GBLVF.d.ts +1 -1
  255. package/dist/icons/Logos/LVF.d.ts +1 -1
  256. package/dist/icons/Logos/LVFText.d.ts +1 -1
  257. package/dist/icons/Logos/SPB.d.ts +1 -1
  258. package/dist/icons/MemberFdicLogo.d.ts +1 -1
  259. package/dist/icons/QuoteIconGrey.d.ts +1 -1
  260. package/dist/icons/QuoteIconWhite.d.ts +1 -1
  261. package/dist/icons/QuoteIconYellow.d.ts +1 -1
  262. package/dist/main.js +5 -8
  263. package/dist/themes/axos.css.d.ts +1 -0
  264. package/dist/themes/axos.css.js +1 -1
  265. package/dist/utils/appendQueryParams.js +53 -16
  266. package/dist/utils/getPosition.d.ts +1 -0
  267. package/dist/utils/getPosition.js +17 -0
  268. package/dist/utils/index.d.ts +0 -1
  269. package/dist/utils/index.js +0 -5
  270. package/dist/utils/optimizeImage/optimizeImage.module.js +3 -3
  271. package/dist/utils/variant.types.d.ts +1 -0
  272. package/package.json +148 -149
  273. package/dist/utils/samePageNavigation.d.ts +0 -3
  274. package/dist/utils/samePageNavigation.js +0 -23
  275. package/dist/utils/samePageQueryParamsNavigation.d.ts +0 -4
  276. package/dist/utils/samePageQueryParamsNavigation.js +0 -63
@@ -1,327 +1,617 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Button } from "../../Button/Button.js";
4
- import { button } from "../../Button/Button.css.js";
5
- import { useState, useCallback, useEffect } from "react";
6
- import "react-use";
7
- import { Chevron } from "../../Chevron/index.js";
8
- import { section_container, content, headerIconBillboard, buttons } from "../../IconBillboard/IconBillboard.css.js";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
9
3
  import { useGlobalContext } from "../../Modal/contextApi/store.js";
10
4
  import { getVariant } from "../../utils/getVariant.js";
11
- import { apy_calculator, calculator_section, section_header, header_theme, mt_8, apy_calculator_form, pis_0, errorTag, fieldset, field_row, relative, label_symbol, cash, prefix_pad, percent, submit_section, span_12, form_disclosure, marketing, marketingTile, bodyContent, container } from "./ApyCalculator.css.js";
5
+ import Image from "next/image.js";
6
+ import { button } from "../../Button/Button.css.js";
7
+ import { Field, Label, Input, Description, Listbox, ListboxButton, ListboxOptions, ListboxOption, Button, Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/react";
8
+ import { AnimatePresence, motion } from "framer-motion";
9
+ import { useState, useCallback, useEffect, useRef } from "react";
10
+ import { apy_calculator, section_header, header_theme, mt_8, calculator_section, apy_calculator_form, fieldset, field_row, relative, field_label, field_row_input, field_row_input_error, field_error, label_symbol, percent, listbox_button, chevron_icon, listbox_options, listbox_option, optional_badge, form_disclosure, calc_btn, results_wrapper, result_card, result_section, result_image, result_value, scrambling, result_value_label, result_item, result_item_label, result_item_value, definitions_accordion, definitions_button, definitions_h2, definitions_columns, definitions_panel, definitions_column, definitions_item, definitions_term, definitions_text, container } from "./ApyCalculator.css.js";
11
+ const COMPOUNDING_OPTIONS = [
12
+ { value: 360, label: "Daily" },
13
+ { value: 12, label: "Monthly" },
14
+ { value: 4, label: "Quarterly" },
15
+ { value: 2, label: "Semi-Annual" },
16
+ { value: 1, label: "Yearly" }
17
+ ];
18
+ const CALCULATOR_DEFINITIONS = [
19
+ {
20
+ term: "Initial deposit",
21
+ description: "The amount of money you're starting with."
22
+ },
23
+ {
24
+ term: "APY (Annual Percentage Yield)",
25
+ description: "The rate your money earns in a year, with compounding included."
26
+ },
27
+ {
28
+ term: "Months",
29
+ description: "How long you plan to keep your money in the account."
30
+ },
31
+ {
32
+ term: "Compounding",
33
+ description: "How often interest is calculated and added to your balance. APY on bank accounts usually compounds monthly."
34
+ },
35
+ {
36
+ term: "Monthly deposits",
37
+ description: "Any additional amount you plan to contribute each month."
38
+ },
39
+ {
40
+ term: "Interest earned",
41
+ description: "The amount gained from interest over the selected time period."
42
+ },
43
+ {
44
+ term: "Ending balance",
45
+ description: "Your projected balance at the end of the selected time period, based on the inputs above."
46
+ },
47
+ {
48
+ term: "Total deposits",
49
+ description: "The total money you contribute, including your initial and monthly deposits."
50
+ }
51
+ ];
52
+ const SCRAMBLE_CHARS = "0123456789";
53
+ const STACKED_LAYOUT_MEDIA = "(max-width: 930px)";
54
+ const INTEREST_EARNED_ID = "interestEarned";
55
+ function useStackedLayout() {
56
+ const [isStacked, setIsStacked] = useState(false);
57
+ useEffect(() => {
58
+ const media = window.matchMedia(STACKED_LAYOUT_MEDIA);
59
+ const onChange = () => setIsStacked(media.matches);
60
+ onChange();
61
+ media.addEventListener("change", onChange);
62
+ return () => media.removeEventListener("change", onChange);
63
+ }, []);
64
+ return isStacked;
65
+ }
66
+ function scrambleCurrency(target, progress) {
67
+ const formatted = target.toLocaleString("en-US", {
68
+ style: "currency",
69
+ currency: "USD"
70
+ });
71
+ return formatted.split("").map((char) => {
72
+ if (char === "$" || char === "," || char === "." || char === "-") {
73
+ return char;
74
+ }
75
+ if (/\d/.test(char)) {
76
+ return Math.random() > progress ? SCRAMBLE_CHARS[Math.floor(Math.random() * SCRAMBLE_CHARS.length)] : char;
77
+ }
78
+ return char;
79
+ }).join("");
80
+ }
81
+ function useScramble(targetValue, duration = 700) {
82
+ const [display, setDisplay] = useState(
83
+ () => targetValue.toLocaleString("en-US", { style: "currency", currency: "USD" })
84
+ );
85
+ const [isScrambling, setIsScrambling] = useState(false);
86
+ const rafRef = useRef(null);
87
+ const startRef = useRef(0);
88
+ const prevTarget = useRef(targetValue);
89
+ useEffect(() => {
90
+ if (prevTarget.current === targetValue) return;
91
+ prevTarget.current = targetValue;
92
+ setIsScrambling(true);
93
+ startRef.current = Date.now();
94
+ const tick = () => {
95
+ const elapsed = Date.now() - startRef.current;
96
+ const progress = Math.min(elapsed / duration, 1);
97
+ if (progress < 1) {
98
+ setDisplay(scrambleCurrency(targetValue, progress));
99
+ rafRef.current = setTimeout(tick, 40);
100
+ } else {
101
+ setDisplay(
102
+ targetValue.toLocaleString("en-US", {
103
+ style: "currency",
104
+ currency: "USD"
105
+ })
106
+ );
107
+ setIsScrambling(false);
108
+ }
109
+ };
110
+ if (rafRef.current) clearTimeout(rafRef.current);
111
+ rafRef.current = setTimeout(tick, 40);
112
+ return () => {
113
+ if (rafRef.current) clearTimeout(rafRef.current);
114
+ };
115
+ }, [targetValue, duration]);
116
+ return { display, isScrambling };
117
+ }
118
+ function formatWithCommas(value) {
119
+ return value.toLocaleString("en-US");
120
+ }
121
+ function parseCurrencyInput(raw) {
122
+ const digits = raw.replace(/[^0-9]/g, "");
123
+ return digits === "" ? 0 : parseInt(digits, 10);
124
+ }
12
125
  const ApyCalculator = ({
13
126
  header,
14
127
  body,
15
- marketingTiles,
16
128
  disclosure,
17
129
  variant
18
130
  }) => {
19
131
  const { domains } = useGlobalContext();
132
+ const isStackedLayout = useStackedLayout();
20
133
  const calculator_variant = getVariant(variant);
21
- const [compounding, setCompounding] = useState(360);
22
- const getAPR = (apy) => {
23
- return Number.parseFloat(
24
- (((1 + apy / 100) ** (1 / compounding) - 1) * compounding * 100).toFixed(
25
- 2
26
- )
27
- );
28
- };
29
- const AXOS_ONE_APY = Number(domains.AXOS_ONE_APY);
30
- const AXOS_ONE_APR = getAPR(AXOS_ONE_APY);
31
- const [initialDeposit, setInititalDeposit] = useState(1e3);
32
- const [APR, setAPR] = useState(AXOS_ONE_APR);
134
+ const [compoundingOption, setCompoundingOption] = useState(
135
+ COMPOUNDING_OPTIONS[1]
136
+ );
137
+ const compounding = compoundingOption.value;
138
+ const getAPR = useCallback(
139
+ (apy) => {
140
+ return Number.parseFloat(
141
+ (((1 + apy / 100) ** (1 / compounding) - 1) * compounding * 100).toFixed(2)
142
+ );
143
+ },
144
+ [compounding]
145
+ );
146
+ const AXOS_ONE_APY = Number(domains.AXOS_ONE_APY) || 4.21;
147
+ const [initialDeposit, setInitialDeposit] = useState(1e4);
148
+ const [initialDepositDisplay, setInitialDepositDisplay] = useState(
149
+ formatWithCommas(1e4)
150
+ );
33
151
  const [APY, setAPY] = useState(AXOS_ONE_APY);
152
+ const [APYDisplay, setAPYDisplay] = useState(APY.toString());
34
153
  const [months, setMonths] = useState(12);
154
+ const [monthsDisplay, setMonthsDisplay] = useState(months.toString());
35
155
  const [monthlyDeposits, setMonthlyDeposits] = useState(100);
36
- const [endingBalance, setEndingBalance] = useState("");
37
- const [errors, setErrors] = useState([]);
38
- const [interestRate, setInterestRate] = useState(0);
39
- const isValidNumber = (input) => {
40
- if (typeof input !== "number") {
41
- return false;
42
- } else if (input < 0 || Number.isNaN(input)) {
43
- return false;
44
- } else return true;
156
+ const [monthlyDepositsDisplay, setMonthlyDepositsDisplay] = useState(
157
+ formatWithCommas(100)
158
+ );
159
+ const [fieldErrors, setFieldErrors] = useState({});
160
+ const handleInitialDepositChange = (e) => {
161
+ const raw = e.target.value;
162
+ const num = parseCurrencyInput(raw);
163
+ setInitialDeposit(num);
164
+ setInitialDepositDisplay(num > 0 ? formatWithCommas(num) : "");
45
165
  };
46
- const isValidAPY = (input) => {
47
- if (typeof input !== "number") {
48
- return false;
49
- } else if (input <= 0 || Number.isNaN(input)) {
50
- return false;
51
- } else return true;
52
- };
53
- const convertInterest = useCallback(() => {
54
- const newInterestRate = 0.01 * APR;
55
- setInterestRate(newInterestRate);
56
- }, [APR]);
57
- useEffect(() => {
58
- convertInterest();
59
- }, [convertInterest, interestRate, setInterestRate]);
60
- const handleCalculate = () => {
61
- convertInterest();
62
- let newErrors = [];
63
- if (!isValidNumber(initialDeposit)) {
64
- newErrors.push("Initial Deposit must be a positive number.");
166
+ const handleMonthlyDepositsChange = (e) => {
167
+ const raw = e.target.value;
168
+ if (raw === "") {
169
+ setMonthlyDeposits(0);
170
+ setMonthlyDepositsDisplay("");
171
+ return;
65
172
  }
66
- if (!isValidNumber(months)) {
67
- newErrors.push("Months must be a positive number.");
173
+ const num = parseCurrencyInput(raw);
174
+ setMonthlyDeposits(num);
175
+ setMonthlyDepositsDisplay(formatWithCommas(num));
176
+ };
177
+ const handleMonthsChange = (e) => {
178
+ const raw = e.target.value;
179
+ const num = parseInt(raw.replace(/[^0-9]/g, ""), 10);
180
+ setMonths(num);
181
+ setMonthsDisplay(num > 0 ? num.toString() : "");
182
+ };
183
+ const handleAPYChange = (e) => {
184
+ const raw = e.target.value;
185
+ const num = parseFloat(raw.replace(/[^0-9.]/g, ""));
186
+ setAPY(num);
187
+ setAPYDisplay(raw.replace(/[^0-9.]/g, ""));
188
+ };
189
+ const [endingBalanceRaw, setEndingBalanceRaw] = useState(0);
190
+ const [totalDepositsRaw, setTotalDepositsRaw] = useState(0);
191
+ const [interestEarnedRaw, setInterestEarnedRaw] = useState(0);
192
+ const { display: endingBalanceDisplay, isScrambling: balanceScrambling } = useScramble(endingBalanceRaw);
193
+ const { display: totalDepositsDisplay, isScrambling: depositsScrambling } = useScramble(totalDepositsRaw);
194
+ const { display: interestEarnedDisplay, isScrambling: interestScrambling } = useScramble(interestEarnedRaw);
195
+ const midPoint = Math.ceil(CALCULATOR_DEFINITIONS.length / 2);
196
+ const leftDefinitions = CALCULATOR_DEFINITIONS.slice(0, midPoint);
197
+ const rightDefinitions = CALCULATOR_DEFINITIONS.slice(midPoint);
198
+ const scrollToInterestEarned = useCallback(() => {
199
+ document.getElementById(INTEREST_EARNED_ID)?.scrollIntoView({
200
+ behavior: "smooth",
201
+ block: "start"
202
+ });
203
+ }, []);
204
+ const calculate = useCallback(() => {
205
+ const newErrors = {};
206
+ if (!initialDeposit || initialDeposit <= 0 || Number.isNaN(initialDeposit)) {
207
+ newErrors.initialDeposit = "Please enter an amount greater than 0.";
68
208
  }
69
- if (!isValidNumber(monthlyDeposits)) {
70
- newErrors.push("Monthly Deposits must be a positive number.");
209
+ if (!months || months < 1 || Number.isNaN(months)) {
210
+ newErrors.months = "Please enter a term of at least 1 month.";
71
211
  }
72
- if (!isValidAPY(APY)) {
73
- newErrors.push("APY must be a positive number.");
212
+ if (monthlyDeposits < 0 || Number.isNaN(monthlyDeposits)) {
213
+ newErrors.monthlyDeposits = "Monthly deposit amount cannot be negative.";
74
214
  }
75
- if (!isValidAPY(APR)) {
76
- newErrors.push("APR must be a positive number.");
215
+ if (!APY || APY <= 0 || Number.isNaN(APY)) {
216
+ newErrors.APY = "Please enter a valid APY greater than 0.";
77
217
  }
78
- if (newErrors.length > 0) {
79
- setErrors(newErrors);
218
+ setFieldErrors(newErrors);
219
+ if (Object.keys(newErrors).length > 0) return false;
220
+ const APR = getAPR(APY);
221
+ const interestRate = 0.01 * APR;
222
+ let total;
223
+ if (compounding === 360) {
224
+ total = initialDeposit * Math.pow(1 + interestRate / compounding, 30 * months) + (monthlyDeposits > 0 ? monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, 30 * months) - 1) : 0);
225
+ } else if (compounding === 12) {
226
+ total = initialDeposit * Math.pow(1 + interestRate / compounding, months) + (monthlyDeposits > 0 ? monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months) - 1) : 0);
227
+ } else if (compounding === 4) {
228
+ total = initialDeposit * Math.pow(1 + interestRate / compounding, months / 3) + (monthlyDeposits > 0 ? monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 3) - 1) : 0);
229
+ } else if (compounding === 2) {
230
+ total = initialDeposit * Math.pow(1 + interestRate / compounding, months / 6) + (monthlyDeposits > 0 ? monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 6) - 1) : 0);
231
+ } else if (compounding === 1) {
232
+ total = initialDeposit * Math.pow(1 + interestRate, months / 12) + (monthlyDeposits > 0 ? monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 12) - 1) : 0);
80
233
  } else {
81
- newErrors = [];
82
- setErrors([]);
83
- let total;
84
- if (compounding === 360) {
85
- total = initialDeposit * Math.pow(1 + interestRate / compounding, 30 * months) + monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, 30 * months) - 1);
86
- } else if (compounding === 12) {
87
- total = initialDeposit * Math.pow(1 + interestRate / compounding, months) + monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months) - 1);
88
- } else if (compounding === 4) {
89
- total = initialDeposit * Math.pow(1 + interestRate / compounding, months / 3) + monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 3) - 1);
90
- } else if (compounding === 2) {
91
- total = initialDeposit * Math.pow(1 + interestRate / compounding, months / 6) + monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 6) - 1);
92
- } else if (compounding === 1) {
93
- total = initialDeposit * Math.pow(1 + interestRate, months / 12) + monthlyDeposits / (interestRate / 12) * (Math.pow(1 + interestRate / compounding, months / 12) - 1);
94
- } else {
95
- total = initialDeposit;
96
- for (let i = 0; i < months; i++) {
97
- total += monthlyDeposits;
98
- total *= Math.pow(1 + interestRate / compounding, compounding / 12);
99
- }
234
+ total = initialDeposit;
235
+ for (let i = 0; i < months; i++) {
236
+ total += monthlyDeposits;
237
+ total *= Math.pow(1 + interestRate / compounding, compounding / 12);
100
238
  }
101
- setEndingBalance(
102
- total.toLocaleString("en-US", { style: "currency", currency: "USD" })
103
- );
104
239
  }
105
- };
106
- const updateAPR = (value) => {
107
- setAPR(value);
108
- const new_apy = Number.parseFloat(
109
- (100 * ((1 + value / 100 / compounding) ** compounding - 1)).toFixed(2)
110
- );
111
- setAPY(new_apy);
112
- convertInterest();
113
- };
114
- const updateAPY = (value) => {
115
- setAPY(value);
116
- const new_apr = getAPR(value);
117
- setAPR(new_apr);
118
- convertInterest();
119
- };
120
- return /* @__PURE__ */ jsx("section", { className: `${container({ variant: getVariant(variant) })}`, children: /* @__PURE__ */ jsxs("div", { className: `${apy_calculator} containment flex between`, children: [
121
- /* @__PURE__ */ jsxs("div", { className: `${calculator_section}`, children: [
122
- (header || body) && /* @__PURE__ */ jsxs("div", { className: `${section_header}`, children: [
123
- header && /* @__PURE__ */ jsx(
124
- "h2",
125
- {
126
- className: `header_2 ${header_theme({ variant: calculator_variant })}`,
127
- children: header
128
- }
129
- ),
130
- body && /* @__PURE__ */ jsx("div", { className: mt_8, children: body })
131
- ] }),
132
- /* @__PURE__ */ jsxs("form", { id: "calculator_form", className: `${apy_calculator_form}`, children: [
133
- /* @__PURE__ */ jsx("div", { id: "errmsgbox", className: " flex middle", children: errors.length > 0 && /* @__PURE__ */ jsx("ul", { className: pis_0, children: errors.map((error, index) => /* @__PURE__ */ jsx("li", { className: `${errorTag}`, children: error }, index)) }) }),
134
- /* @__PURE__ */ jsxs("div", { className: `${fieldset}`, children: [
135
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
136
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "initDeposit", children: "Initial Deposit" }),
137
- /* @__PURE__ */ jsx("label", { className: `${label_symbol} ${cash}`, children: "$" }),
138
- /* @__PURE__ */ jsx(
139
- "input",
140
- {
141
- className: `${prefix_pad} bordered`,
142
- id: "initDeposit",
143
- type: "number",
144
- step: 100,
145
- name: "initDeposit",
146
- value: initialDeposit,
147
- onChange: (e) => setInititalDeposit(parseInt(e.target.value))
148
- }
149
- )
150
- ] }),
151
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
152
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "apr", children: "APR (Annual Percentage Rate)" }),
153
- /* @__PURE__ */ jsx("label", { className: `${label_symbol} ${percent}`, children: "%" }),
154
- /* @__PURE__ */ jsx(
155
- "input",
156
- {
157
- className: `${prefix_pad} bordered`,
158
- id: "apr",
159
- type: "number",
160
- step: 0.01,
161
- name: "apr",
162
- value: APR,
163
- onChange: (e) => updateAPR(parseFloat(e.target.value))
164
- }
165
- )
166
- ] }),
167
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
168
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "apy", children: "APY (Annual Percentage Yield)" }),
169
- /* @__PURE__ */ jsx("label", { className: `${label_symbol} ${percent}`, children: "%" }),
170
- /* @__PURE__ */ jsx(
171
- "input",
172
- {
173
- className: `${prefix_pad} bordered`,
174
- id: "apy",
175
- type: "number",
176
- step: 0.01,
177
- name: "apy",
178
- value: APY,
179
- onChange: (e) => updateAPY(parseFloat(e.target.value))
180
- }
181
- )
182
- ] }),
183
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
184
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "months", children: "Months" }),
185
- /* @__PURE__ */ jsx(
186
- "input",
187
- {
188
- className: `${prefix_pad} bordered`,
189
- id: "months",
190
- min: 1,
191
- maxLength: 4,
192
- type: "number",
193
- name: "months",
194
- value: months,
195
- onChange: (e) => setMonths(parseInt(e.target.value))
196
- }
197
- )
198
- ] }),
199
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
200
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "compounding", children: "Compounding" }),
201
- /* @__PURE__ */ jsxs(
202
- "select",
203
- {
204
- className: `${prefix_pad} bordered`,
205
- id: "compounding",
206
- name: "compounding",
207
- value: compounding,
208
- onChange: (e) => setCompounding(Number(e.target.value)),
209
- children: [
210
- /* @__PURE__ */ jsx("option", { value: 360, children: "Daily" }),
211
- /* @__PURE__ */ jsx("option", { value: 12, children: "Monthly" }),
212
- /* @__PURE__ */ jsx("option", { value: 4, children: "Quarterly" }),
213
- /* @__PURE__ */ jsx("option", { value: 2, children: "Semi-Annual" }),
214
- /* @__PURE__ */ jsx("option", { value: 1, children: "Yearly" })
215
- ]
216
- }
217
- )
218
- ] }),
219
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
220
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "monthlyDeposits", children: "Monthly Deposits" }),
221
- /* @__PURE__ */ jsx("label", { className: `${label_symbol} ${cash}`, children: "$" }),
222
- /* @__PURE__ */ jsx(
223
- "input",
224
- {
225
- className: `${prefix_pad} bordered`,
226
- id: "monthlyDeposits",
227
- maxLength: 25,
228
- type: "number",
229
- value: monthlyDeposits,
230
- name: "monthlyDeposits",
231
- onChange: (e) => setMonthlyDeposits(parseInt(e.target.value))
232
- }
233
- )
234
- ] }),
235
- /* @__PURE__ */ jsxs("div", { className: `${field_row} ${relative} flex flex_col`, children: [
236
- /* @__PURE__ */ jsx("label", { className: "input_label", htmlFor: "endBal", children: "Ending Balance" }),
237
- /* @__PURE__ */ jsx(
238
- "input",
239
- {
240
- className: `${prefix_pad} bordered`,
241
- id: "endBal",
242
- maxLength: 30,
243
- type: "string",
244
- readOnly: true,
245
- name: "endBal",
246
- value: endingBalance
247
- }
248
- )
249
- ] }),
250
- /* @__PURE__ */ jsx(
251
- "div",
240
+ const deposits = initialDeposit + monthlyDeposits * months;
241
+ const interest = total - deposits;
242
+ setEndingBalanceRaw(total);
243
+ setTotalDepositsRaw(deposits);
244
+ setInterestEarnedRaw(interest > 0 ? interest : 0);
245
+ return true;
246
+ }, [initialDeposit, APY, months, monthlyDeposits, compounding, getAPR]);
247
+ const handleCalculateClick = useCallback(() => {
248
+ const didCalculate = calculate();
249
+ if (!didCalculate || !isStackedLayout) return;
250
+ requestAnimationFrame(() => {
251
+ scrollToInterestEarned();
252
+ });
253
+ }, [calculate, isStackedLayout, scrollToInterestEarned]);
254
+ useEffect(() => {
255
+ calculate();
256
+ }, []);
257
+ return /* @__PURE__ */ jsxs(
258
+ "section",
259
+ {
260
+ className: `${container({ variant: getVariant(variant) })} ${apy_calculator}`,
261
+ children: [
262
+ (header || body) && /* @__PURE__ */ jsxs("div", { className: `${section_header} containment`, children: [
263
+ header && /* @__PURE__ */ jsx(
264
+ "h1",
252
265
  {
253
- className: `${submit_section} ${span_12} flex center middle push_up_32`,
254
- children: /* @__PURE__ */ jsx(
255
- "input",
256
- {
257
- className: `${button({ color: "primary", size: "medium", rounded: "medium" })} center`,
258
- type: "button",
259
- value: "Calculate",
260
- onClick: handleCalculate
261
- }
262
- )
266
+ className: `header_1 ${header_theme({ variant: calculator_variant })}`,
267
+ children: header
263
268
  }
264
269
  ),
265
- disclosure && /* @__PURE__ */ jsx("div", { className: `${form_disclosure} push_up_24`, children: disclosure })
266
- ] })
267
- ] })
268
- ] }),
269
- /* @__PURE__ */ jsx("div", { className: `${marketing} ${section_container}`, children: marketingTiles && marketingTiles?.map(
270
- ({ id, headline, bodyCopy, callToActionRow }) => /* @__PURE__ */ jsxs(
271
- "div",
272
- {
273
- className: `${container({ variant: getVariant(variant) })} ${marketingTile} rounded bordered`,
274
- children: [
275
- /* @__PURE__ */ jsx("div", { className: `${content} ${bodyContent}`, children: /* @__PURE__ */ jsxs(
276
- "div",
277
- {
278
- className: headerIconBillboard,
279
- style: { textAlign: "left" },
280
- children: [
270
+ body && /* @__PURE__ */ jsx("div", { className: mt_8, children: body })
271
+ ] }),
272
+ /* @__PURE__ */ jsxs(
273
+ "div",
274
+ {
275
+ className: `${apy_calculator} flex between`,
276
+ style: { paddingBlock: "0px" },
277
+ children: [
278
+ /* @__PURE__ */ jsx("div", { className: calculator_section, children: /* @__PURE__ */ jsx("form", { id: "calculator_form", className: apy_calculator_form, children: /* @__PURE__ */ jsxs("div", { className: fieldset, children: [
279
+ /* @__PURE__ */ jsxs(
280
+ Field,
281
+ {
282
+ className: `${field_row} ${relative} flex flex_col`,
283
+ style: { marginTop: 0 },
284
+ children: [
285
+ /* @__PURE__ */ jsx(Label, { className: field_label, children: "Initial Deposit" }),
286
+ /* @__PURE__ */ jsx(
287
+ Input,
288
+ {
289
+ className: `${field_row_input} ${fieldErrors.initialDeposit ? ` ${field_row_input_error}` : ""}`,
290
+ id: "initDeposit",
291
+ type: "text",
292
+ inputMode: "numeric",
293
+ name: "initDeposit",
294
+ value: initialDepositDisplay ? `$${initialDepositDisplay}` : "",
295
+ onChange: handleInitialDepositChange,
296
+ "aria-invalid": !!fieldErrors.initialDeposit,
297
+ "aria-describedby": fieldErrors.initialDeposit ? "initDeposit-error" : void 0
298
+ }
299
+ ),
300
+ fieldErrors.initialDeposit && /* @__PURE__ */ jsx(
301
+ Description,
302
+ {
303
+ as: "span",
304
+ id: "initDeposit-error",
305
+ className: field_error,
306
+ role: "alert",
307
+ children: fieldErrors.initialDeposit
308
+ }
309
+ )
310
+ ]
311
+ }
312
+ ),
313
+ /* @__PURE__ */ jsxs(Field, { className: `${field_row} ${relative} flex flex_col`, children: [
314
+ /* @__PURE__ */ jsx(Label, { className: field_label, children: "APY (Annual Percentage Yield)" }),
281
315
  /* @__PURE__ */ jsx(
282
- "div",
316
+ "span",
283
317
  {
284
- className: `header_3 ${header_theme({ variant: calculator_variant })}`,
285
- children: headline
318
+ className: `${label_symbol} ${percent}`,
319
+ "aria-hidden": "true",
320
+ children: "%"
286
321
  }
287
322
  ),
288
- /* @__PURE__ */ jsx("div", { children: bodyCopy })
289
- ]
290
- }
291
- ) }),
292
- callToActionRow && /* @__PURE__ */ jsx("div", { className: `${buttons} middle`, children: callToActionRow.map(
293
- ({
294
- id: id2,
295
- variant: variant2,
296
- displayText,
297
- targetUrl,
298
- type
299
- }) => type === "Button" ? /* @__PURE__ */ jsx(
300
- Button,
301
- {
302
- targetUrl,
303
- color: getVariant(variant2),
304
- size: "medium",
305
- rounded: "medium",
306
- children: displayText
307
- },
308
- id2
309
- ) : /* @__PURE__ */ jsx(
310
- Chevron,
323
+ /* @__PURE__ */ jsx(
324
+ Input,
325
+ {
326
+ className: `${field_row_input} ${fieldErrors.APY ? ` ${field_row_input_error}` : ""}`,
327
+ id: "apy",
328
+ type: "text",
329
+ inputMode: "numeric",
330
+ name: "apy",
331
+ value: APYDisplay,
332
+ onChange: handleAPYChange,
333
+ onWheel: (e) => e.currentTarget.blur(),
334
+ "aria-invalid": !!fieldErrors.APY,
335
+ "aria-describedby": fieldErrors.APY ? "apy-error" : void 0
336
+ }
337
+ ),
338
+ fieldErrors.APY && /* @__PURE__ */ jsx(
339
+ Description,
340
+ {
341
+ as: "span",
342
+ id: "apy-error",
343
+ className: field_error,
344
+ role: "alert",
345
+ children: fieldErrors.APY
346
+ }
347
+ )
348
+ ] }),
349
+ /* @__PURE__ */ jsxs(Field, { className: `${field_row} ${relative} flex flex_col`, children: [
350
+ /* @__PURE__ */ jsx(Label, { className: field_label, children: "Months" }),
351
+ /* @__PURE__ */ jsx(
352
+ Input,
353
+ {
354
+ className: `${field_row_input}${fieldErrors.months ? ` ${field_row_input_error}` : ""}`,
355
+ id: "months",
356
+ min: 1,
357
+ type: "text",
358
+ inputMode: "numeric",
359
+ name: "months",
360
+ value: monthsDisplay,
361
+ onChange: handleMonthsChange,
362
+ "aria-invalid": !!fieldErrors.months,
363
+ "aria-describedby": fieldErrors.months ? "months-error" : void 0
364
+ }
365
+ ),
366
+ fieldErrors.months && /* @__PURE__ */ jsx(
367
+ Description,
368
+ {
369
+ as: "span",
370
+ id: "months-error",
371
+ className: field_error,
372
+ role: "alert",
373
+ children: fieldErrors.months
374
+ }
375
+ )
376
+ ] }),
377
+ /* @__PURE__ */ jsxs(Field, { className: `${field_row} ${relative} flex flex_col`, children: [
378
+ /* @__PURE__ */ jsx(Label, { className: field_label, htmlFor: "compounding", children: "Compounding" }),
379
+ /* @__PURE__ */ jsxs(
380
+ Listbox,
381
+ {
382
+ value: compoundingOption,
383
+ onChange: setCompoundingOption,
384
+ children: [
385
+ /* @__PURE__ */ jsxs(
386
+ ListboxButton,
387
+ {
388
+ id: "compounding",
389
+ className: `${listbox_button} ${field_row_input}`,
390
+ children: [
391
+ /* @__PURE__ */ jsx("span", { children: compoundingOption.label }),
392
+ /* @__PURE__ */ jsx(
393
+ "svg",
394
+ {
395
+ className: chevron_icon,
396
+ xmlns: "http://www.w3.org/2000/svg",
397
+ viewBox: "0 0 20 20",
398
+ fill: "currentColor",
399
+ "aria-hidden": "true",
400
+ children: /* @__PURE__ */ jsx(
401
+ "path",
402
+ {
403
+ fillRule: "evenodd",
404
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
405
+ clipRule: "evenodd"
406
+ }
407
+ )
408
+ }
409
+ )
410
+ ]
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsx(
414
+ ListboxOptions,
415
+ {
416
+ anchor: "bottom start",
417
+ className: listbox_options,
418
+ children: COMPOUNDING_OPTIONS.map((opt) => /* @__PURE__ */ jsx(
419
+ ListboxOption,
420
+ {
421
+ value: opt,
422
+ className: listbox_option,
423
+ children: opt.label
424
+ },
425
+ opt.value
426
+ ))
427
+ }
428
+ )
429
+ ]
430
+ }
431
+ )
432
+ ] }),
433
+ /* @__PURE__ */ jsxs(Field, { className: `${field_row} ${relative} flex flex_col`, children: [
434
+ /* @__PURE__ */ jsxs(Label, { className: field_label, children: [
435
+ "Monthly Deposits",
436
+ " ",
437
+ /* @__PURE__ */ jsx("span", { className: optional_badge, children: "(optional)" })
438
+ ] }),
439
+ /* @__PURE__ */ jsx(
440
+ Input,
441
+ {
442
+ className: `${field_row_input} ${fieldErrors.monthlyDeposits ? ` ${field_row_input_error}` : ""}`,
443
+ id: "monthlyDeposits",
444
+ type: "text",
445
+ inputMode: "numeric",
446
+ name: "monthlyDeposits",
447
+ value: monthlyDepositsDisplay ? `$${monthlyDepositsDisplay}` : "",
448
+ placeholder: "0",
449
+ onChange: handleMonthlyDepositsChange,
450
+ "aria-invalid": !!fieldErrors.monthlyDeposits,
451
+ "aria-describedby": fieldErrors.monthlyDeposits ? "monthlyDeposits-error" : void 0
452
+ }
453
+ ),
454
+ fieldErrors.monthlyDeposits && /* @__PURE__ */ jsx(
455
+ Description,
456
+ {
457
+ as: "span",
458
+ id: "monthlyDeposits-error",
459
+ className: field_error,
460
+ role: "alert",
461
+ children: fieldErrors.monthlyDeposits
462
+ }
463
+ )
464
+ ] }),
465
+ disclosure && /* @__PURE__ */ jsx("div", { className: `${form_disclosure} push_up_24`, children: disclosure }),
466
+ /* @__PURE__ */ jsx("div", { className: "flex center push_up", children: /* @__PURE__ */ jsx(
467
+ Button,
468
+ {
469
+ type: "button",
470
+ onClick: handleCalculateClick,
471
+ className: `${button({ color: "primary", size: "large", rounded: "medium" })} ${calc_btn}`,
472
+ children: "Calculate"
473
+ }
474
+ ) })
475
+ ] }) }) }),
476
+ /* @__PURE__ */ jsx("div", { className: results_wrapper, children: /* @__PURE__ */ jsxs("div", { className: result_card, children: [
477
+ /* @__PURE__ */ jsxs(
478
+ "div",
479
+ {
480
+ id: INTEREST_EARNED_ID,
481
+ className: result_section,
482
+ "aria-live": "polite",
483
+ "aria-atomic": "true",
484
+ "aria-label": `Interest earned: ${interestEarnedDisplay}`,
485
+ children: [
486
+ /* @__PURE__ */ jsx(
487
+ Image,
488
+ {
489
+ src: "https://www.axos.com/images/5IyqVlv7El9K7hAX0vIGWG/axb-25th-growth-lg.png",
490
+ alt: "",
491
+ height: 173,
492
+ width: 202,
493
+ className: `img_fluid ${result_image}`,
494
+ priority: true
495
+ }
496
+ ),
497
+ /* @__PURE__ */ jsx(
498
+ "div",
499
+ {
500
+ className: `${result_value} ${interestScrambling ? scrambling : ""}`,
501
+ children: interestEarnedDisplay
502
+ }
503
+ ),
504
+ /* @__PURE__ */ jsx("div", { className: result_value_label, children: "Interest Earned" })
505
+ ]
506
+ }
507
+ ),
508
+ /* @__PURE__ */ jsxs("div", { "aria-live": "polite", "aria-atomic": "true", children: [
509
+ /* @__PURE__ */ jsxs("div", { className: result_item, children: [
510
+ /* @__PURE__ */ jsx("span", { className: result_item_label, children: "Ending Balance:" }),
511
+ /* @__PURE__ */ jsx(
512
+ "span",
513
+ {
514
+ className: `${result_item_value} ${balanceScrambling ? scrambling : ""}`,
515
+ children: endingBalanceDisplay
516
+ }
517
+ )
518
+ ] }),
519
+ /* @__PURE__ */ jsxs("div", { className: result_item, children: [
520
+ /* @__PURE__ */ jsx("span", { className: result_item_label, children: "Total Deposits:" }),
521
+ /* @__PURE__ */ jsx(
522
+ "span",
523
+ {
524
+ className: `${result_item_value} ${depositsScrambling ? scrambling : ""}`,
525
+ children: totalDepositsDisplay
526
+ }
527
+ )
528
+ ] })
529
+ ] })
530
+ ] }) })
531
+ ]
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsx("div", { id: "definitions", className: "push_up_24", children: /* @__PURE__ */ jsx(
535
+ "div",
536
+ {
537
+ className: `${definitions_accordion} ${apy_calculator}`,
538
+ "aria-label": "Calculator definitions",
539
+ style: { paddingBlock: "0px" },
540
+ children: /* @__PURE__ */ jsx(Disclosure, { children: ({ open }) => /* @__PURE__ */ jsxs(Fragment, { children: [
541
+ /* @__PURE__ */ jsxs(DisclosureButton, { className: definitions_button, children: [
542
+ /* @__PURE__ */ jsx(
543
+ "h2",
544
+ {
545
+ className: definitions_h2({ variant: getVariant(variant) }),
546
+ children: "Calculator definitions"
547
+ }
548
+ ),
549
+ /* @__PURE__ */ jsx(
550
+ "svg",
551
+ {
552
+ xmlns: "http://www.w3.org/2000/svg",
553
+ width: "20",
554
+ height: "20",
555
+ viewBox: "0 0 20 20",
556
+ fill: "none",
557
+ "aria-hidden": "true",
558
+ children: /* @__PURE__ */ jsx(
559
+ "path",
560
+ {
561
+ d: "M10 1.25C14.8325 1.25 18.75 5.16751 18.75 10C18.75 14.8325 14.8325 18.75 10 18.75C5.16751 18.75 1.25 14.8325 1.25 10C1.25 5.16751 5.16751 1.25 10 1.25ZM10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM10.625 8.75V14.375H9.375V8.75H10.625ZM10 5.625C10.5178 5.625 10.9375 6.04473 10.9375 6.5625C10.9375 7.08027 10.5178 7.5 10 7.5C9.48223 7.5 9.0625 7.08027 9.0625 6.5625C9.0625 6.04473 9.48223 5.625 10 5.625Z",
562
+ fill: "#435164"
563
+ }
564
+ )
565
+ }
566
+ )
567
+ ] }),
568
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsx(
569
+ DisclosurePanel,
311
570
  {
312
- targetUrl,
313
- variant: getVariant(variant2),
314
- children: displayText
315
- },
316
- id2
317
- )
318
- ) })
319
- ]
320
- },
321
- id
322
- )
323
- ) })
324
- ] }) });
571
+ static: true,
572
+ as: motion.div,
573
+ initial: { opacity: 0, height: 0, y: -6 },
574
+ animate: { opacity: 1, height: "auto", y: 0 },
575
+ exit: { opacity: 0, height: 0, y: -4 },
576
+ style: { overflow: "hidden" },
577
+ children: /* @__PURE__ */ jsxs(
578
+ "div",
579
+ {
580
+ className: `${definitions_columns} ${definitions_panel}`,
581
+ children: [
582
+ /* @__PURE__ */ jsx("div", { className: definitions_column, children: leftDefinitions.map((definition) => /* @__PURE__ */ jsxs(
583
+ "div",
584
+ {
585
+ className: definitions_item,
586
+ children: [
587
+ /* @__PURE__ */ jsx("h3", { className: definitions_term, children: definition.term }),
588
+ /* @__PURE__ */ jsx("p", { className: definitions_text, children: definition.description })
589
+ ]
590
+ },
591
+ definition.term
592
+ )) }),
593
+ /* @__PURE__ */ jsx("div", { className: definitions_column, children: rightDefinitions.map((definition) => /* @__PURE__ */ jsxs(
594
+ "div",
595
+ {
596
+ className: definitions_item,
597
+ children: [
598
+ /* @__PURE__ */ jsx("h3", { className: definitions_term, children: definition.term }),
599
+ /* @__PURE__ */ jsx("p", { className: definitions_text, children: definition.description })
600
+ ]
601
+ },
602
+ definition.term
603
+ )) })
604
+ ]
605
+ }
606
+ )
607
+ }
608
+ ) })
609
+ ] }) })
610
+ }
611
+ ) })
612
+ ]
613
+ }
614
+ );
325
615
  };
326
616
  export {
327
617
  ApyCalculator