@transferwise/components 46.161.0 → 46.161.2

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 (715) hide show
  1. package/build/Accordion/Accordion.js.map +1 -1
  2. package/build/Accordion/Accordion.mjs.map +1 -1
  3. package/build/Accordion/AccordionItem/AccordionItem.js.map +1 -1
  4. package/build/Accordion/AccordionItem/AccordionItem.mjs.map +1 -1
  5. package/build/AvatarLayout/AvatarLayout.js.map +1 -1
  6. package/build/AvatarLayout/AvatarLayout.mjs.map +1 -1
  7. package/build/AvatarView/AvatarView.js.map +1 -1
  8. package/build/AvatarView/AvatarView.mjs.map +1 -1
  9. package/build/AvatarView/Dot/Dot.js.map +1 -1
  10. package/build/AvatarView/Dot/Dot.mjs.map +1 -1
  11. package/build/Body/Body.js.map +1 -1
  12. package/build/Body/Body.mjs.map +1 -1
  13. package/build/Button/Button.js.map +1 -1
  14. package/build/Button/Button.mjs.map +1 -1
  15. package/build/Button/Button.resolver.js.map +1 -1
  16. package/build/Button/Button.resolver.mjs.map +1 -1
  17. package/build/Button/LegacyButton/LegacyButton.js.map +1 -1
  18. package/build/Button/LegacyButton/LegacyButton.mjs.map +1 -1
  19. package/build/Button/LegacyButton/utils/legacyUtils.js.map +1 -1
  20. package/build/Button/LegacyButton/utils/legacyUtils.mjs.map +1 -1
  21. package/build/Button/classMap.js.map +1 -1
  22. package/build/Button/classMap.mjs.map +1 -1
  23. package/build/Calendar/Calendar.constants.js.map +1 -1
  24. package/build/Calendar/Calendar.constants.mjs.map +1 -1
  25. package/build/Calendar/Calendar.js.map +1 -1
  26. package/build/Calendar/Calendar.messages.js.map +1 -1
  27. package/build/Calendar/Calendar.messages.mjs.map +1 -1
  28. package/build/Calendar/Calendar.mjs.map +1 -1
  29. package/build/Calendar/DateHeader/DateHeader.js.map +1 -1
  30. package/build/Calendar/DateHeader/DateHeader.mjs.map +1 -1
  31. package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
  32. package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
  33. package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
  34. package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
  35. package/build/Calendar/GetFocusableTime/GetFocusableTime.js.map +1 -1
  36. package/build/Calendar/GetFocusableTime/GetFocusableTime.mjs.map +1 -1
  37. package/build/Calendar/GetStartOfDay/GetStartOfDay.js.map +1 -1
  38. package/build/Calendar/GetStartOfDay/GetStartOfDay.mjs.map +1 -1
  39. package/build/Calendar/MonthCalendar/MonthCalendar.js.map +1 -1
  40. package/build/Calendar/MonthCalendar/MonthCalendar.mjs.map +1 -1
  41. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
  42. package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
  43. package/build/Calendar/TableLink/TableLink.js.map +1 -1
  44. package/build/Calendar/TableLink/TableLink.mjs.map +1 -1
  45. package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
  46. package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
  47. package/build/Calendar/YearCalendar/YearCalendar.js.map +1 -1
  48. package/build/Calendar/YearCalendar/YearCalendar.mjs.map +1 -1
  49. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.js.map +1 -1
  50. package/build/Calendar/_helpers/clampToDayViewBoundary/clampToDayViewBoundary.mjs.map +1 -1
  51. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -1
  52. package/build/Calendar/_helpers/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -1
  53. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.js.map +1 -1
  54. package/build/Calendar/_helpers/isDateDisabled/isDateDisabled.mjs.map +1 -1
  55. package/build/Carousel/Carousel.js.map +1 -1
  56. package/build/Carousel/Carousel.mjs.map +1 -1
  57. package/build/Checkbox/Checkbox.js.map +1 -1
  58. package/build/Checkbox/Checkbox.mjs.map +1 -1
  59. package/build/CheckboxButton/CheckboxButton.js.map +1 -1
  60. package/build/CheckboxButton/CheckboxButton.mjs.map +1 -1
  61. package/build/Chevron/Chevron.js.map +1 -1
  62. package/build/Chevron/Chevron.mjs.map +1 -1
  63. package/build/Chips/Chip/Chip.js.map +1 -1
  64. package/build/Chips/Chip/Chip.mjs.map +1 -1
  65. package/build/Chips/Chips.js.map +1 -1
  66. package/build/Chips/Chips.messages.js.map +1 -1
  67. package/build/Chips/Chips.messages.mjs.map +1 -1
  68. package/build/Chips/Chips.mjs.map +1 -1
  69. package/build/CircularButton/CircularButton.js.map +1 -1
  70. package/build/CircularButton/CircularButton.mjs.map +1 -1
  71. package/build/Container/Container.js.map +1 -1
  72. package/build/Container/Container.mjs.map +1 -1
  73. package/build/DateInput/DateInput.js.map +1 -1
  74. package/build/DateInput/DateInput.messages.js.map +1 -1
  75. package/build/DateInput/DateInput.messages.mjs.map +1 -1
  76. package/build/DateInput/DateInput.mjs.map +1 -1
  77. package/build/DateInput/utils/convertToLocalMidnight/convertToLocalMidnight.js.map +1 -1
  78. package/build/DateInput/utils/convertToLocalMidnight/convertToLocalMidnight.mjs.map +1 -1
  79. package/build/DateLookup/DateLookup.js.map +1 -1
  80. package/build/DateLookup/DateLookup.mjs.map +1 -1
  81. package/build/DateLookup/DateTrigger/DateTrigger.js.map +1 -1
  82. package/build/DateLookup/DateTrigger/DateTrigger.messages.js.map +1 -1
  83. package/build/DateLookup/DateTrigger/DateTrigger.messages.mjs.map +1 -1
  84. package/build/DateLookup/DateTrigger/DateTrigger.mjs.map +1 -1
  85. package/build/Decision/Decision.js.map +1 -1
  86. package/build/Decision/Decision.mjs.map +1 -1
  87. package/build/DefinitionList/DefinitionList.js.map +1 -1
  88. package/build/DefinitionList/DefinitionList.mjs.map +1 -1
  89. package/build/Dimmer/Dimmer.js.map +1 -1
  90. package/build/Dimmer/Dimmer.mjs.map +1 -1
  91. package/build/Dimmer/dimmerManager/dimmerManager.js.map +1 -1
  92. package/build/Dimmer/dimmerManager/dimmerManager.mjs.map +1 -1
  93. package/build/Display/Display.js.map +1 -1
  94. package/build/Display/Display.mjs.map +1 -1
  95. package/build/Divider/Divider.js.map +1 -1
  96. package/build/Divider/Divider.mjs.map +1 -1
  97. package/build/Drawer/Drawer.js.map +1 -1
  98. package/build/Drawer/Drawer.mjs.map +1 -1
  99. package/build/DropFade/DropFade.js.map +1 -1
  100. package/build/DropFade/DropFade.mjs.map +1 -1
  101. package/build/Emphasis/Emphasis.js.map +1 -1
  102. package/build/Emphasis/Emphasis.mjs.map +1 -1
  103. package/build/Emphasis/EmphasisHtmlTransformer.js.map +1 -1
  104. package/build/Emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
  105. package/build/ExpressiveMoneyInput/AmountInput/AmountInput.js.map +1 -1
  106. package/build/ExpressiveMoneyInput/AmountInput/AmountInput.mjs.map +1 -1
  107. package/build/ExpressiveMoneyInput/AmountInput/utils.js.map +1 -1
  108. package/build/ExpressiveMoneyInput/AmountInput/utils.mjs.map +1 -1
  109. package/build/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.js.map +1 -1
  110. package/build/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.mjs.map +1 -1
  111. package/build/ExpressiveMoneyInput/Chevron/Chevron.js.map +1 -1
  112. package/build/ExpressiveMoneyInput/Chevron/Chevron.mjs.map +1 -1
  113. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.js.map +1 -1
  114. package/build/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.mjs.map +1 -1
  115. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.js.map +1 -1
  116. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.messages.js.map +1 -1
  117. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.messages.mjs.map +1 -1
  118. package/build/ExpressiveMoneyInput/ExpressiveMoneyInput.mjs.map +1 -1
  119. package/build/ExpressiveMoneyInput/hooks/useFocus.js.map +1 -1
  120. package/build/ExpressiveMoneyInput/hooks/useFocus.mjs.map +1 -1
  121. package/build/ExpressiveMoneyInput/hooks/useInputStyle.js.map +1 -1
  122. package/build/ExpressiveMoneyInput/hooks/useInputStyle.mjs.map +1 -1
  123. package/build/Field/Field.js.map +1 -1
  124. package/build/Field/Field.messages.js.map +1 -1
  125. package/build/Field/Field.messages.mjs.map +1 -1
  126. package/build/Field/Field.mjs.map +1 -1
  127. package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.js.map +1 -1
  128. package/build/FlowNavigation/AnimatedLabel/AnimatedLabel.mjs.map +1 -1
  129. package/build/FlowNavigation/FlowNavigation.js.map +1 -1
  130. package/build/FlowNavigation/FlowNavigation.messages.js.map +1 -1
  131. package/build/FlowNavigation/FlowNavigation.messages.mjs.map +1 -1
  132. package/build/FlowNavigation/FlowNavigation.mjs.map +1 -1
  133. package/build/Header/Header.js.map +1 -1
  134. package/build/Header/Header.mjs.map +1 -1
  135. package/build/IconButton/IconButton.js.map +1 -1
  136. package/build/IconButton/IconButton.mjs.map +1 -1
  137. package/build/Image/Image.js.map +1 -1
  138. package/build/Image/Image.mjs.map +1 -1
  139. package/build/Info/Info.js.map +1 -1
  140. package/build/Info/Info.messages.js.map +1 -1
  141. package/build/Info/Info.messages.mjs.map +1 -1
  142. package/build/Info/Info.mjs.map +1 -1
  143. package/build/Info/infoPresentations.js.map +1 -1
  144. package/build/Info/infoPresentations.mjs.map +1 -1
  145. package/build/InputWithDisplayFormat/InputWithDisplayFormat.js.map +1 -1
  146. package/build/InputWithDisplayFormat/InputWithDisplayFormat.mjs.map +1 -1
  147. package/build/Inputs/Input/Input.js.map +1 -1
  148. package/build/Inputs/Input/Input.mjs.map +1 -1
  149. package/build/Inputs/InputGroup/InputGroup.js.map +1 -1
  150. package/build/Inputs/InputGroup/InputGroup.mjs.map +1 -1
  151. package/build/Inputs/SearchInput/SearchInput.js.map +1 -1
  152. package/build/Inputs/SearchInput/SearchInput.mjs.map +1 -1
  153. package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.js.map +1 -1
  154. package/build/Inputs/SelectInput/BottomSheet/SelectInputBottomSheet.mjs.map +1 -1
  155. package/build/Inputs/SelectInput/ButtonInput/SelectInputButtonInput.js.map +1 -1
  156. package/build/Inputs/SelectInput/ButtonInput/SelectInputButtonInput.mjs.map +1 -1
  157. package/build/Inputs/SelectInput/ClearButton/SelectInputClearButton.js.map +1 -1
  158. package/build/Inputs/SelectInput/ClearButton/SelectInputClearButton.mjs.map +1 -1
  159. package/build/Inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.js.map +1 -1
  160. package/build/Inputs/SelectInput/DefaultRenderTrigger/SelectInputDefaultRenderTrigger.mjs.map +1 -1
  161. package/build/Inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.js.map +1 -1
  162. package/build/Inputs/SelectInput/ItemView/GroupItemView/SelectInputGroupItemView.mjs.map +1 -1
  163. package/build/Inputs/SelectInput/ItemView/SelectInputItemView.js.map +1 -1
  164. package/build/Inputs/SelectInput/ItemView/SelectInputItemView.mjs.map +1 -1
  165. package/build/Inputs/SelectInput/Option/SelectInputOption.js.map +1 -1
  166. package/build/Inputs/SelectInput/Option/SelectInputOption.mjs.map +1 -1
  167. package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.js.map +1 -1
  168. package/build/Inputs/SelectInput/OptionContent/SelectInputOptionContent.mjs.map +1 -1
  169. package/build/Inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.js.map +1 -1
  170. package/build/Inputs/SelectInput/Options/OptionsContainer/SelectInputOptionsContainer.mjs.map +1 -1
  171. package/build/Inputs/SelectInput/Options/SelectInputOptions.js.map +1 -1
  172. package/build/Inputs/SelectInput/Options/SelectInputOptions.mjs.map +1 -1
  173. package/build/Inputs/SelectInput/Popover/SelectInputPopover.js.map +1 -1
  174. package/build/Inputs/SelectInput/Popover/SelectInputPopover.mjs.map +1 -1
  175. package/build/Inputs/SelectInput/SelectInput.contexts.js.map +1 -1
  176. package/build/Inputs/SelectInput/SelectInput.contexts.mjs.map +1 -1
  177. package/build/Inputs/SelectInput/SelectInput.js.map +1 -1
  178. package/build/Inputs/SelectInput/SelectInput.messages.js.map +1 -1
  179. package/build/Inputs/SelectInput/SelectInput.messages.mjs.map +1 -1
  180. package/build/Inputs/SelectInput/SelectInput.mjs.map +1 -1
  181. package/build/Inputs/SelectInput/SelectInput.utils.js.map +1 -1
  182. package/build/Inputs/SelectInput/SelectInput.utils.mjs.map +1 -1
  183. package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.js.map +1 -1
  184. package/build/Inputs/SelectInput/TriggerButton/SelectInputTriggerButton.mjs.map +1 -1
  185. package/build/Inputs/SelectInput/constants.js.map +1 -1
  186. package/build/Inputs/SelectInput/constants.mjs.map +1 -1
  187. package/build/Inputs/SelectInput/hooks/useTypeahead.js.map +1 -1
  188. package/build/Inputs/SelectInput/hooks/useTypeahead.mjs.map +1 -1
  189. package/build/Inputs/TextArea/TextArea.js.map +1 -1
  190. package/build/Inputs/TextArea/TextArea.mjs.map +1 -1
  191. package/build/Inputs/_common.js.map +1 -1
  192. package/build/Inputs/_common.mjs.map +1 -1
  193. package/build/Inputs/contexts.js.map +1 -1
  194. package/build/Inputs/contexts.mjs.map +1 -1
  195. package/build/InstructionsList/InstructionsList.js.map +1 -1
  196. package/build/InstructionsList/InstructionsList.mjs.map +1 -1
  197. package/build/Label/Label.js.map +1 -1
  198. package/build/Label/Label.messages.js.map +1 -1
  199. package/build/Label/Label.messages.mjs.map +1 -1
  200. package/build/Label/Label.mjs.map +1 -1
  201. package/build/Link/Link.js.map +1 -1
  202. package/build/Link/Link.messages.js.map +1 -1
  203. package/build/Link/Link.messages.mjs.map +1 -1
  204. package/build/Link/Link.mjs.map +1 -1
  205. package/build/List/List.js.map +1 -1
  206. package/build/List/List.mjs.map +1 -1
  207. package/build/ListItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -1
  208. package/build/ListItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -1
  209. package/build/ListItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -1
  210. package/build/ListItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -1
  211. package/build/ListItem/AvatarView/ListItemAvatarView.js.map +1 -1
  212. package/build/ListItem/AvatarView/ListItemAvatarView.mjs.map +1 -1
  213. package/build/ListItem/Button/ListItemButton.js.map +1 -1
  214. package/build/ListItem/Button/ListItemButton.mjs.map +1 -1
  215. package/build/ListItem/Checkbox/ListItemCheckbox.js.map +1 -1
  216. package/build/ListItem/Checkbox/ListItemCheckbox.mjs.map +1 -1
  217. package/build/ListItem/IconButton/ListItemIconButton.js.map +1 -1
  218. package/build/ListItem/IconButton/ListItemIconButton.mjs.map +1 -1
  219. package/build/ListItem/Image/ListItemImage.js.map +1 -1
  220. package/build/ListItem/Image/ListItemImage.mjs.map +1 -1
  221. package/build/ListItem/ListItem.js.map +1 -1
  222. package/build/ListItem/ListItem.mjs.map +1 -1
  223. package/build/ListItem/ListItemContext.js.map +1 -1
  224. package/build/ListItem/ListItemContext.mjs.map +1 -1
  225. package/build/ListItem/Navigation/ListItemNavigation.js.map +1 -1
  226. package/build/ListItem/Navigation/ListItemNavigation.mjs.map +1 -1
  227. package/build/ListItem/Prompt/ListItemPrompt.js.map +1 -1
  228. package/build/ListItem/Prompt/ListItemPrompt.mjs.map +1 -1
  229. package/build/ListItem/Radio/ListItemRadio.js.map +1 -1
  230. package/build/ListItem/Radio/ListItemRadio.mjs.map +1 -1
  231. package/build/ListItem/Switch/ListItemSwitch.js.map +1 -1
  232. package/build/ListItem/Switch/ListItemSwitch.mjs.map +1 -1
  233. package/build/ListItem/useListItemControl.js.map +1 -1
  234. package/build/ListItem/useListItemControl.mjs.map +1 -1
  235. package/build/ListItem/useListItemMedia.js.map +1 -1
  236. package/build/ListItem/useListItemMedia.mjs.map +1 -1
  237. package/build/Loader/Loader.js.map +1 -1
  238. package/build/Loader/Loader.mjs.map +1 -1
  239. package/build/Logo/Logo.js.map +1 -1
  240. package/build/Logo/Logo.mjs.map +1 -1
  241. package/build/Logo/logo-assets.js.map +1 -1
  242. package/build/Logo/logo-assets.mjs.map +1 -1
  243. package/build/Markdown/Markdown.js.map +1 -1
  244. package/build/Markdown/Markdown.mjs.map +1 -1
  245. package/build/Markup/Markup.js.map +1 -1
  246. package/build/Markup/Markup.mjs.map +1 -1
  247. package/build/Markup/constants.js.map +1 -1
  248. package/build/Markup/constants.mjs.map +1 -1
  249. package/build/Markup/utils/parseMarkup.js.map +1 -1
  250. package/build/Markup/utils/parseMarkup.mjs.map +1 -1
  251. package/build/Markup/utils/sanitise.js.map +1 -1
  252. package/build/Markup/utils/sanitise.mjs.map +1 -1
  253. package/build/Modal/Modal.js.map +1 -1
  254. package/build/Modal/Modal.mjs.map +1 -1
  255. package/build/Money/Money.js.map +1 -1
  256. package/build/Money/Money.mjs.map +1 -1
  257. package/build/MoneyInput/MoneyInput.js.map +1 -1
  258. package/build/MoneyInput/MoneyInput.messages.js.map +1 -1
  259. package/build/MoneyInput/MoneyInput.messages.mjs.map +1 -1
  260. package/build/MoneyInput/MoneyInput.mjs.map +1 -1
  261. package/build/MoneyInput/currencyFormatting.js.map +1 -1
  262. package/build/MoneyInput/currencyFormatting.mjs.map +1 -1
  263. package/build/Nudge/Nudge.js.map +1 -1
  264. package/build/Nudge/Nudge.mjs.map +1 -1
  265. package/build/PhoneNumberInput/Data/countries.js.map +1 -1
  266. package/build/PhoneNumberInput/Data/countries.mjs.map +1 -1
  267. package/build/PhoneNumberInput/PhoneNumberInput.js.map +1 -1
  268. package/build/PhoneNumberInput/PhoneNumberInput.messages.js.map +1 -1
  269. package/build/PhoneNumberInput/PhoneNumberInput.messages.mjs.map +1 -1
  270. package/build/PhoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  271. package/build/PhoneNumberInput/utils/cleanNumber/cleanNumber.js.map +1 -1
  272. package/build/PhoneNumberInput/utils/cleanNumber/cleanNumber.mjs.map +1 -1
  273. package/build/PhoneNumberInput/utils/excludeCountries/excludeCountries.js.map +1 -1
  274. package/build/PhoneNumberInput/utils/excludeCountries/excludeCountries.mjs.map +1 -1
  275. package/build/PhoneNumberInput/utils/explodeNumberModel/index.js.map +1 -1
  276. package/build/PhoneNumberInput/utils/explodeNumberModel/index.mjs.map +1 -1
  277. package/build/PhoneNumberInput/utils/findCountryByCode/index.js.map +1 -1
  278. package/build/PhoneNumberInput/utils/findCountryByCode/index.mjs.map +1 -1
  279. package/build/PhoneNumberInput/utils/findCountryByPrefix/index.js.map +1 -1
  280. package/build/PhoneNumberInput/utils/findCountryByPrefix/index.mjs.map +1 -1
  281. package/build/PhoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js.map +1 -1
  282. package/build/PhoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.mjs.map +1 -1
  283. package/build/PhoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js.map +1 -1
  284. package/build/PhoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.mjs.map +1 -1
  285. package/build/PhoneNumberInput/utils/longestMatchingPrefix/index.js.map +1 -1
  286. package/build/PhoneNumberInput/utils/longestMatchingPrefix/index.mjs.map +1 -1
  287. package/build/PhoneNumberInput/utils/setDefaultPrefix/index.js.map +1 -1
  288. package/build/PhoneNumberInput/utils/setDefaultPrefix/index.mjs.map +1 -1
  289. package/build/PhoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js.map +1 -1
  290. package/build/PhoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.mjs.map +1 -1
  291. package/build/Popover/Popover.js.map +1 -1
  292. package/build/Popover/Popover.mjs.map +1 -1
  293. package/build/Primitives/PrimitiveAnchor/PrimitiveAnchor.js.map +1 -1
  294. package/build/Primitives/PrimitiveAnchor/PrimitiveAnchor.mjs.map +1 -1
  295. package/build/Primitives/PrimitiveButton/PrimitiveButton.js.map +1 -1
  296. package/build/Primitives/PrimitiveButton/PrimitiveButton.mjs.map +1 -1
  297. package/build/ProcessIndicator/ProcessIndicator.js.map +1 -1
  298. package/build/ProcessIndicator/ProcessIndicator.mjs.map +1 -1
  299. package/build/Progress/Progress.js.map +1 -1
  300. package/build/Progress/Progress.mjs.map +1 -1
  301. package/build/ProgressBar/ProgressBar.js.map +1 -1
  302. package/build/ProgressBar/ProgressBar.mjs.map +1 -1
  303. package/build/PromoCard/CardGroup/PromoCardGroup.js.map +1 -1
  304. package/build/PromoCard/CardGroup/PromoCardGroup.mjs.map +1 -1
  305. package/build/PromoCard/Indicator/PromoCardIndicator.js.map +1 -1
  306. package/build/PromoCard/Indicator/PromoCardIndicator.mjs.map +1 -1
  307. package/build/PromoCard/PromoCard.js.map +1 -1
  308. package/build/PromoCard/PromoCard.mjs.map +1 -1
  309. package/build/PromoCard/PromoCardContext.js.map +1 -1
  310. package/build/PromoCard/PromoCardContext.mjs.map +1 -1
  311. package/build/Prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  312. package/build/Prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  313. package/build/Prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  314. package/build/Prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  315. package/build/Prompt/CriticalBanner/helpers.js.map +1 -1
  316. package/build/Prompt/CriticalBanner/helpers.mjs.map +1 -1
  317. package/build/Prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  318. package/build/Prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  319. package/build/Prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  320. package/build/Prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  321. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  322. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  323. package/build/Prompt/common/Expander/Expander.js.map +1 -1
  324. package/build/Prompt/common/Expander/Expander.messages.js.map +1 -1
  325. package/build/Prompt/common/Expander/Expander.messages.mjs.map +1 -1
  326. package/build/Prompt/common/Expander/Expander.mjs.map +1 -1
  327. package/build/Prompt/helpers/promptMedia.js.map +1 -1
  328. package/build/Prompt/helpers/promptMedia.mjs.map +1 -1
  329. package/build/Provider/Direction/DirectionProvider.js.map +1 -1
  330. package/build/Provider/Direction/DirectionProvider.mjs.map +1 -1
  331. package/build/Provider/Language/LanguageProvider.js.map +1 -1
  332. package/build/Provider/Language/LanguageProvider.mjs.map +1 -1
  333. package/build/Provider/Provider.js.map +1 -1
  334. package/build/Provider/Provider.mjs.map +1 -1
  335. package/build/Provider/overlay/OverlayIdProvider.js.map +1 -1
  336. package/build/Provider/overlay/OverlayIdProvider.mjs.map +1 -1
  337. package/build/Radio/Radio.js.map +1 -1
  338. package/build/Radio/Radio.mjs.map +1 -1
  339. package/build/RadioGroup/RadioGroup.js.map +1 -1
  340. package/build/RadioGroup/RadioGroup.mjs.map +1 -1
  341. package/build/Section/Section.js.map +1 -1
  342. package/build/Section/Section.mjs.map +1 -1
  343. package/build/SegmentedControl/SegmentedControl.js.map +1 -1
  344. package/build/SegmentedControl/SegmentedControl.mjs.map +1 -1
  345. package/build/SentimentSurface/SentimentSurface.js.map +1 -1
  346. package/build/SentimentSurface/SentimentSurface.mjs.map +1 -1
  347. package/build/SlidingPanel/SlidingPanel.js.map +1 -1
  348. package/build/SlidingPanel/SlidingPanel.mjs.map +1 -1
  349. package/build/Snackbar/Snackbar.js.map +1 -1
  350. package/build/Snackbar/Snackbar.mjs.map +1 -1
  351. package/build/Snackbar/SnackbarContext.js.map +1 -1
  352. package/build/Snackbar/SnackbarContext.mjs.map +1 -1
  353. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  354. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  355. package/build/Snackbar/useSnackbar.js.map +1 -1
  356. package/build/Snackbar/useSnackbar.mjs.map +1 -1
  357. package/build/StatusIcon/StatusIcon.js.map +1 -1
  358. package/build/StatusIcon/StatusIcon.messages.js.map +1 -1
  359. package/build/StatusIcon/StatusIcon.messages.mjs.map +1 -1
  360. package/build/StatusIcon/StatusIcon.mjs.map +1 -1
  361. package/build/Stepper/Stepper.js.map +1 -1
  362. package/build/Stepper/Stepper.mjs.map +1 -1
  363. package/build/Stepper/deviceDetection.js.map +1 -1
  364. package/build/Stepper/deviceDetection.mjs.map +1 -1
  365. package/build/Sticky/Sticky.js.map +1 -1
  366. package/build/Sticky/Sticky.mjs.map +1 -1
  367. package/build/Switch/Switch.js.map +1 -1
  368. package/build/Switch/Switch.mjs.map +1 -1
  369. package/build/Table/Cell/TableCell.js.map +1 -1
  370. package/build/Table/Cell/TableCell.mjs.map +1 -1
  371. package/build/Table/Header/TableHeader.js.map +1 -1
  372. package/build/Table/Header/TableHeader.mjs.map +1 -1
  373. package/build/Table/Row/TableRow.js.map +1 -1
  374. package/build/Table/Row/TableRow.mjs.map +1 -1
  375. package/build/Table/StatusText/TableStatusText.js.map +1 -1
  376. package/build/Table/StatusText/TableStatusText.mjs.map +1 -1
  377. package/build/Table/Table.js.map +1 -1
  378. package/build/Table/Table.messages.js.map +1 -1
  379. package/build/Table/Table.messages.mjs.map +1 -1
  380. package/build/Table/Table.mjs.map +1 -1
  381. package/build/Tabs/Tab/Tab.js.map +1 -1
  382. package/build/Tabs/Tab/Tab.mjs.map +1 -1
  383. package/build/Tabs/TabList/TabList.js.map +1 -1
  384. package/build/Tabs/TabList/TabList.mjs.map +1 -1
  385. package/build/Tabs/TabPanel/TabPanel.js.map +1 -1
  386. package/build/Tabs/TabPanel/TabPanel.mjs.map +1 -1
  387. package/build/Tabs/Tabs.js.map +1 -1
  388. package/build/Tabs/Tabs.mjs.map +1 -1
  389. package/build/Tabs/utils.js.map +1 -1
  390. package/build/Tabs/utils.mjs.map +1 -1
  391. package/build/Tag/Tag.js.map +1 -1
  392. package/build/Tag/Tag.mjs.map +1 -1
  393. package/build/TextareaWithDisplayFormat/TextareaWithDisplayFormat.js.map +1 -1
  394. package/build/TextareaWithDisplayFormat/TextareaWithDisplayFormat.mjs.map +1 -1
  395. package/build/Tile/Tile.js.map +1 -1
  396. package/build/Tile/Tile.mjs.map +1 -1
  397. package/build/Title/Title.js.map +1 -1
  398. package/build/Title/Title.mjs.map +1 -1
  399. package/build/Tooltip/Tooltip.js.map +1 -1
  400. package/build/Tooltip/Tooltip.mjs.map +1 -1
  401. package/build/Typeahead/Typeahead.js.map +1 -1
  402. package/build/Typeahead/Typeahead.messages.js.map +1 -1
  403. package/build/Typeahead/Typeahead.messages.mjs.map +1 -1
  404. package/build/Typeahead/Typeahead.mjs.map +1 -1
  405. package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
  406. package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
  407. package/build/Typeahead/TypeaheadOption/TypeaheadOption.js.map +1 -1
  408. package/build/Typeahead/TypeaheadOption/TypeaheadOption.mjs.map +1 -1
  409. package/build/Typeahead/Util/highlight.js.map +1 -1
  410. package/build/Typeahead/Util/highlight.mjs.map +1 -1
  411. package/build/Upload/Steps/CompleteStep/CompleteStep.js.map +1 -1
  412. package/build/Upload/Steps/CompleteStep/CompleteStep.mjs.map +1 -1
  413. package/build/Upload/Steps/ProcessingStep/ProcessingStep.js.map +1 -1
  414. package/build/Upload/Steps/ProcessingStep/ProcessingStep.mjs.map +1 -1
  415. package/build/Upload/Steps/UploadImageStep/UploadImageStep.js.map +1 -1
  416. package/build/Upload/Steps/UploadImageStep/UploadImageStep.mjs.map +1 -1
  417. package/build/Upload/Upload.js.map +1 -1
  418. package/build/Upload/Upload.messages.js.map +1 -1
  419. package/build/Upload/Upload.messages.mjs.map +1 -1
  420. package/build/Upload/Upload.mjs.map +1 -1
  421. package/build/Upload/utils/asyncFileRead/asyncFileRead.js.map +1 -1
  422. package/build/Upload/utils/asyncFileRead/asyncFileRead.mjs.map +1 -1
  423. package/build/Upload/utils/getFileType/getFileType.js.map +1 -1
  424. package/build/Upload/utils/getFileType/getFileType.mjs.map +1 -1
  425. package/build/Upload/utils/isSizeValid/isSizeValid.js.map +1 -1
  426. package/build/Upload/utils/isSizeValid/isSizeValid.mjs.map +1 -1
  427. package/build/Upload/utils/isTypeValid/isTypeValid.js.map +1 -1
  428. package/build/Upload/utils/isTypeValid/isTypeValid.mjs.map +1 -1
  429. package/build/Upload/utils/postData/postData.js.map +1 -1
  430. package/build/Upload/utils/postData/postData.mjs.map +1 -1
  431. package/build/UploadInput/UploadButton/UploadButton.js.map +1 -1
  432. package/build/UploadInput/UploadButton/UploadButton.messages.js.map +1 -1
  433. package/build/UploadInput/UploadButton/UploadButton.messages.mjs.map +1 -1
  434. package/build/UploadInput/UploadButton/UploadButton.mjs.map +1 -1
  435. package/build/UploadInput/UploadButton/defaults.js.map +1 -1
  436. package/build/UploadInput/UploadButton/defaults.mjs.map +1 -1
  437. package/build/UploadInput/UploadButton/getAllowedFileTypes.js.map +1 -1
  438. package/build/UploadInput/UploadButton/getAllowedFileTypes.mjs.map +1 -1
  439. package/build/UploadInput/UploadInput.js.map +1 -1
  440. package/build/UploadInput/UploadInput.messages.js.map +1 -1
  441. package/build/UploadInput/UploadInput.messages.mjs.map +1 -1
  442. package/build/UploadInput/UploadInput.mjs.map +1 -1
  443. package/build/UploadInput/UploadItem/UploadItem.js.map +1 -1
  444. package/build/UploadInput/UploadItem/UploadItem.messages.js.map +1 -1
  445. package/build/UploadInput/UploadItem/UploadItem.messages.mjs.map +1 -1
  446. package/build/UploadInput/UploadItem/UploadItem.mjs.map +1 -1
  447. package/build/UploadInput/UploadItem/UploadItemLink.js.map +1 -1
  448. package/build/UploadInput/UploadItem/UploadItemLink.mjs.map +1 -1
  449. package/build/WithDisplayFormat/WithDisplayFormat.js.map +1 -1
  450. package/build/WithDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  451. package/build/WithId/WithId.js.map +1 -1
  452. package/build/WithId/WithId.mjs.map +1 -1
  453. package/build/WithNextPortal/WithNextPortal.js.map +1 -1
  454. package/build/WithNextPortal/WithNextPortal.mjs.map +1 -1
  455. package/build/_deprecated/ActionButton/ActionButton.js.map +1 -1
  456. package/build/_deprecated/ActionButton/ActionButton.mjs.map +1 -1
  457. package/build/_deprecated/ActionOption/ActionOption.js.map +1 -1
  458. package/build/_deprecated/ActionOption/ActionOption.mjs.map +1 -1
  459. package/build/_deprecated/Alert/Alert.js.map +1 -1
  460. package/build/_deprecated/Alert/Alert.mjs.map +1 -1
  461. package/build/_deprecated/Alert/InlineMarkdown/InlineMarkdown.js.map +1 -1
  462. package/build/_deprecated/Alert/InlineMarkdown/InlineMarkdown.mjs.map +1 -1
  463. package/build/_deprecated/Avatar/Avatar.js.map +1 -1
  464. package/build/_deprecated/Avatar/Avatar.mjs.map +1 -1
  465. package/build/_deprecated/Avatar/types.js.map +1 -1
  466. package/build/_deprecated/Avatar/types.mjs.map +1 -1
  467. package/build/_deprecated/AvatarWrapper/AvatarWrapper.js.map +1 -1
  468. package/build/_deprecated/AvatarWrapper/AvatarWrapper.mjs.map +1 -1
  469. package/build/_deprecated/Badge/Badge.js.map +1 -1
  470. package/build/_deprecated/Badge/Badge.mjs.map +1 -1
  471. package/build/_deprecated/Badge/BadgeAssets.js.map +1 -1
  472. package/build/_deprecated/Badge/BadgeAssets.mjs.map +1 -1
  473. package/build/_deprecated/Card/Card.js.map +1 -1
  474. package/build/_deprecated/Card/Card.mjs.map +1 -1
  475. package/build/_deprecated/CheckboxOption/CheckboxOption.js.map +1 -1
  476. package/build/_deprecated/CheckboxOption/CheckboxOption.mjs.map +1 -1
  477. package/build/_deprecated/CriticalBanner/CriticalCommsBanner.js.map +1 -1
  478. package/build/_deprecated/CriticalBanner/CriticalCommsBanner.mjs.map +1 -1
  479. package/build/_deprecated/InlineAlert/InlineAlert.js.map +1 -1
  480. package/build/_deprecated/InlineAlert/InlineAlert.mjs.map +1 -1
  481. package/build/_deprecated/LegacyListItem/LegacyListItem.js.map +1 -1
  482. package/build/_deprecated/LegacyListItem/LegacyListItem.mjs.map +1 -1
  483. package/build/_deprecated/NavigationOption/NavigationOption.js.map +1 -1
  484. package/build/_deprecated/NavigationOption/NavigationOption.mjs.map +1 -1
  485. package/build/_deprecated/NavigationOptionsList/NavigationOptionsList.js.map +1 -1
  486. package/build/_deprecated/NavigationOptionsList/NavigationOptionsList.mjs.map +1 -1
  487. package/build/_deprecated/OverlayHeader/OverlayHeader.js.map +1 -1
  488. package/build/_deprecated/OverlayHeader/OverlayHeader.mjs.map +1 -1
  489. package/build/_deprecated/RadioOption/RadioOption.js.map +1 -1
  490. package/build/_deprecated/RadioOption/RadioOption.mjs.map +1 -1
  491. package/build/_deprecated/Select/Option/Option.js.map +1 -1
  492. package/build/_deprecated/Select/Option/Option.mjs.map +1 -1
  493. package/build/_deprecated/Select/SearchBox/SearchBox.js.map +1 -1
  494. package/build/_deprecated/Select/SearchBox/SearchBox.mjs.map +1 -1
  495. package/build/_deprecated/Select/Select.js.map +1 -1
  496. package/build/_deprecated/Select/Select.messages.js.map +1 -1
  497. package/build/_deprecated/Select/Select.messages.mjs.map +1 -1
  498. package/build/_deprecated/Select/Select.mjs.map +1 -1
  499. package/build/_deprecated/Summary/Summary.js.map +1 -1
  500. package/build/_deprecated/Summary/Summary.messages.js.map +1 -1
  501. package/build/_deprecated/Summary/Summary.messages.mjs.map +1 -1
  502. package/build/_deprecated/Summary/Summary.mjs.map +1 -1
  503. package/build/_deprecated/SwitchOption/SwitchOption.js.map +1 -1
  504. package/build/_deprecated/SwitchOption/SwitchOption.mjs.map +1 -1
  505. package/build/common/BaseCard/BaseCard.js.map +1 -1
  506. package/build/common/BaseCard/BaseCard.mjs.map +1 -1
  507. package/build/common/BottomSheet/BottomSheet.js.map +1 -1
  508. package/build/common/BottomSheet/BottomSheet.mjs.map +1 -1
  509. package/build/common/Circle/Circle.js.map +1 -1
  510. package/build/common/Circle/Circle.mjs.map +1 -1
  511. package/build/common/CloseButton/CloseButton.js.map +1 -1
  512. package/build/common/CloseButton/CloseButton.messages.js.map +1 -1
  513. package/build/common/CloseButton/CloseButton.messages.mjs.map +1 -1
  514. package/build/common/CloseButton/CloseButton.mjs.map +1 -1
  515. package/build/common/DOMOperations/DOMOperations.js.map +1 -1
  516. package/build/common/DOMOperations/DOMOperations.mjs.map +1 -1
  517. package/build/common/DateUtils/getDateView/getDateView.js.map +1 -1
  518. package/build/common/DateUtils/getDateView/getDateView.mjs.map +1 -1
  519. package/build/common/DateUtils/getDayNames/getDayNames.js.map +1 -1
  520. package/build/common/DateUtils/getDayNames/getDayNames.mjs.map +1 -1
  521. package/build/common/DateUtils/getFormatForLocale/getFormatForLocale.js.map +1 -1
  522. package/build/common/DateUtils/getFormatForLocale/getFormatForLocale.mjs.map +1 -1
  523. package/build/common/DateUtils/getMonthNames/getMonthNames.js.map +1 -1
  524. package/build/common/DateUtils/getMonthNames/getMonthNames.mjs.map +1 -1
  525. package/build/common/DateUtils/isDateValid/isDateValid.js.map +1 -1
  526. package/build/common/DateUtils/isDateValid/isDateValid.mjs.map +1 -1
  527. package/build/common/DateUtils/isMonthAndYearFormat/isMonthAndYearFormat.js.map +1 -1
  528. package/build/common/DateUtils/isMonthAndYearFormat/isMonthAndYearFormat.mjs.map +1 -1
  529. package/build/common/DateUtils/isWithinRange/isWithinRange.js.map +1 -1
  530. package/build/common/DateUtils/isWithinRange/isWithinRange.mjs.map +1 -1
  531. package/build/common/DateUtils/moveToWithinRange/moveToWithinRange.js.map +1 -1
  532. package/build/common/DateUtils/moveToWithinRange/moveToWithinRange.mjs.map +1 -1
  533. package/build/common/DomHelpers/documentIosClick.js.map +1 -1
  534. package/build/common/DomHelpers/documentIosClick.mjs.map +1 -1
  535. package/build/common/FlowHeader/FlowHeader.js.map +1 -1
  536. package/build/common/FlowHeader/FlowHeader.mjs.map +1 -1
  537. package/build/common/FocusBoundary/FocusBoundary.js.map +1 -1
  538. package/build/common/FocusBoundary/FocusBoundary.mjs.map +1 -1
  539. package/build/common/LiveRegion/LiveRegion.js.map +1 -1
  540. package/build/common/LiveRegion/LiveRegion.mjs.map +1 -1
  541. package/build/common/Locale/index.js.map +1 -1
  542. package/build/common/Locale/index.mjs.map +1 -1
  543. package/build/common/Option/Option.js.map +1 -1
  544. package/build/common/Option/Option.mjs.map +1 -1
  545. package/build/common/Panel/Panel.js.map +1 -1
  546. package/build/common/Panel/Panel.mjs.map +1 -1
  547. package/build/common/Panel/Panel.positionUtils.js.map +1 -1
  548. package/build/common/Panel/Panel.positionUtils.mjs.map +1 -1
  549. package/build/common/PolymorphicWithOverrides/PolymorphicWithOverrides.js.map +1 -1
  550. package/build/common/PolymorphicWithOverrides/PolymorphicWithOverrides.mjs.map +1 -1
  551. package/build/common/PreventScroll/PreventScroll.js.map +1 -1
  552. package/build/common/PreventScroll/PreventScroll.mjs.map +1 -1
  553. package/build/common/PropsValues/control.js.map +1 -1
  554. package/build/common/PropsValues/control.mjs.map +1 -1
  555. package/build/common/PropsValues/dateMode.js.map +1 -1
  556. package/build/common/PropsValues/dateMode.mjs.map +1 -1
  557. package/build/common/PropsValues/layouts.js.map +1 -1
  558. package/build/common/PropsValues/layouts.mjs.map +1 -1
  559. package/build/common/PropsValues/markdownNodeType.js.map +1 -1
  560. package/build/common/PropsValues/markdownNodeType.mjs.map +1 -1
  561. package/build/common/PropsValues/monthFormat.js.map +1 -1
  562. package/build/common/PropsValues/monthFormat.mjs.map +1 -1
  563. package/build/common/PropsValues/position.js.map +1 -1
  564. package/build/common/PropsValues/position.mjs.map +1 -1
  565. package/build/common/PropsValues/profileType.js.map +1 -1
  566. package/build/common/PropsValues/profileType.mjs.map +1 -1
  567. package/build/common/PropsValues/scroll.js.map +1 -1
  568. package/build/common/PropsValues/scroll.mjs.map +1 -1
  569. package/build/common/PropsValues/sentiment.js.map +1 -1
  570. package/build/common/PropsValues/sentiment.mjs.map +1 -1
  571. package/build/common/PropsValues/size.js.map +1 -1
  572. package/build/common/PropsValues/size.mjs.map +1 -1
  573. package/build/common/PropsValues/status.js.map +1 -1
  574. package/build/common/PropsValues/status.mjs.map +1 -1
  575. package/build/common/PropsValues/type.js.map +1 -1
  576. package/build/common/PropsValues/type.mjs.map +1 -1
  577. package/build/common/PropsValues/typography.js.map +1 -1
  578. package/build/common/PropsValues/typography.mjs.map +1 -1
  579. package/build/common/PropsValues/variant.js.map +1 -1
  580. package/build/common/PropsValues/variant.mjs.map +1 -1
  581. package/build/common/PropsValues/width.js.map +1 -1
  582. package/build/common/PropsValues/width.mjs.map +1 -1
  583. package/build/common/RadioButton/RadioButton.js.map +1 -1
  584. package/build/common/RadioButton/RadioButton.mjs.map +1 -1
  585. package/build/common/ResponsivePanel/ResponsivePanel.js.map +1 -1
  586. package/build/common/ResponsivePanel/ResponsivePanel.mjs.map +1 -1
  587. package/build/common/TextFormat/formatWithPattern/formatWithPattern.js.map +1 -1
  588. package/build/common/TextFormat/formatWithPattern/formatWithPattern.mjs.map +1 -1
  589. package/build/common/TextFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.js.map +1 -1
  590. package/build/common/TextFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.mjs.map +1 -1
  591. package/build/common/TextFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js.map +1 -1
  592. package/build/common/TextFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.mjs.map +1 -1
  593. package/build/common/TextFormat/getDistanceToSymbol/getDistanceToSymbol.js.map +1 -1
  594. package/build/common/TextFormat/getDistanceToSymbol/getDistanceToSymbol.mjs.map +1 -1
  595. package/build/common/TextFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js.map +1 -1
  596. package/build/common/TextFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.mjs.map +1 -1
  597. package/build/common/TextFormat/unformatWithPattern/unformatWithPattern.js.map +1 -1
  598. package/build/common/TextFormat/unformatWithPattern/unformatWithPattern.mjs.map +1 -1
  599. package/build/common/colors.js.map +1 -1
  600. package/build/common/colors.mjs.map +1 -1
  601. package/build/common/constants.js.map +1 -1
  602. package/build/common/constants.mjs.map +1 -1
  603. package/build/common/deviceDetection/deviceDetection.js.map +1 -1
  604. package/build/common/deviceDetection/deviceDetection.mjs.map +1 -1
  605. package/build/common/direction.js.map +1 -1
  606. package/build/common/direction.mjs.map +1 -1
  607. package/build/common/fileType.js.map +1 -1
  608. package/build/common/fileType.mjs.map +1 -1
  609. package/build/common/historyNavigator/historyNavigator.js.map +1 -1
  610. package/build/common/historyNavigator/historyNavigator.mjs.map +1 -1
  611. package/build/common/hooks/useConditionalListener/useConditionalListener.js.map +1 -1
  612. package/build/common/hooks/useConditionalListener/useConditionalListener.mjs.map +1 -1
  613. package/build/common/hooks/useContainerSize.js.map +1 -1
  614. package/build/common/hooks/useContainerSize.mjs.map +1 -1
  615. package/build/common/hooks/useDirection/useDirection.js.map +1 -1
  616. package/build/common/hooks/useDirection/useDirection.mjs.map +1 -1
  617. package/build/common/hooks/useEffectEvent.js.map +1 -1
  618. package/build/common/hooks/useEffectEvent.mjs.map +1 -1
  619. package/build/common/hooks/useHasIntersected/useHasIntersected.js.map +1 -1
  620. package/build/common/hooks/useHasIntersected/useHasIntersected.mjs.map +1 -1
  621. package/build/common/hooks/useLayout/useLayout.js.map +1 -1
  622. package/build/common/hooks/useLayout/useLayout.mjs.map +1 -1
  623. package/build/common/hooks/useMedia.js.map +1 -1
  624. package/build/common/hooks/useMedia.mjs.map +1 -1
  625. package/build/common/hooks/useResizeObserver.js.map +1 -1
  626. package/build/common/hooks/useResizeObserver.mjs.map +1 -1
  627. package/build/common/hooks/useScreenSize.js.map +1 -1
  628. package/build/common/hooks/useScreenSize.mjs.map +1 -1
  629. package/build/common/hooks/useVirtualKeyboard.js.map +1 -1
  630. package/build/common/hooks/useVirtualKeyboard.mjs.map +1 -1
  631. package/build/common/initials.js.map +1 -1
  632. package/build/common/initials.mjs.map +1 -1
  633. package/build/common/injectIntl.js.map +1 -1
  634. package/build/common/injectIntl.mjs.map +1 -1
  635. package/build/common/theme.js.map +1 -1
  636. package/build/common/theme.mjs.map +1 -1
  637. package/build/i18n/commonMessages/Button.messages.js.map +1 -1
  638. package/build/i18n/commonMessages/Button.messages.mjs.map +1 -1
  639. package/build/i18n/cs.json.js.map +1 -1
  640. package/build/i18n/cs.json.mjs.map +1 -1
  641. package/build/i18n/de.json.js.map +1 -1
  642. package/build/i18n/de.json.mjs.map +1 -1
  643. package/build/i18n/en.json.js.map +1 -1
  644. package/build/i18n/en.json.mjs.map +1 -1
  645. package/build/i18n/es.json.js.map +1 -1
  646. package/build/i18n/es.json.mjs.map +1 -1
  647. package/build/i18n/fr.json.js.map +1 -1
  648. package/build/i18n/fr.json.mjs.map +1 -1
  649. package/build/i18n/hu.json.js.map +1 -1
  650. package/build/i18n/hu.json.mjs.map +1 -1
  651. package/build/i18n/id.json.js.map +1 -1
  652. package/build/i18n/id.json.mjs.map +1 -1
  653. package/build/i18n/index.js.map +1 -1
  654. package/build/i18n/index.mjs.map +1 -1
  655. package/build/i18n/it.json.js.map +1 -1
  656. package/build/i18n/it.json.mjs.map +1 -1
  657. package/build/i18n/ja.json.js.map +1 -1
  658. package/build/i18n/ja.json.mjs.map +1 -1
  659. package/build/i18n/nl.json.js.map +1 -1
  660. package/build/i18n/nl.json.mjs.map +1 -1
  661. package/build/i18n/pl.json.js.map +1 -1
  662. package/build/i18n/pl.json.mjs.map +1 -1
  663. package/build/i18n/pt.json.js.map +1 -1
  664. package/build/i18n/pt.json.mjs.map +1 -1
  665. package/build/i18n/ro.json.js.map +1 -1
  666. package/build/i18n/ro.json.mjs.map +1 -1
  667. package/build/i18n/ru.json.js.map +1 -1
  668. package/build/i18n/ru.json.mjs.map +1 -1
  669. package/build/i18n/th.json.js.map +1 -1
  670. package/build/i18n/th.json.mjs.map +1 -1
  671. package/build/i18n/tr.json.js.map +1 -1
  672. package/build/i18n/tr.json.mjs.map +1 -1
  673. package/build/i18n/uk.json.js.map +1 -1
  674. package/build/i18n/uk.json.mjs.map +1 -1
  675. package/build/i18n/zh-CN.json.js.map +1 -1
  676. package/build/i18n/zh-CN.json.mjs.map +1 -1
  677. package/build/i18n/zh-HK.json.js.map +1 -1
  678. package/build/i18n/zh-HK.json.mjs.map +1 -1
  679. package/build/main.css +6 -38
  680. package/build/mocks.js.map +1 -1
  681. package/build/mocks.mjs.map +1 -1
  682. package/build/styles/FlowNavigation/FlowNavigation.css +5 -6
  683. package/build/styles/css/neptune-core.css +1 -32
  684. package/build/styles/css/neptune.css +1 -32
  685. package/build/styles/main.css +6 -38
  686. package/build/styles/styles/less/neptune-core.css +1 -32
  687. package/build/styles/styles/less/neptune.css +1 -32
  688. package/build/utilities/cssValueWithUnit.js.map +1 -1
  689. package/build/utilities/cssValueWithUnit.mjs.map +1 -1
  690. package/build/utilities/logActionRequired.js.map +1 -1
  691. package/build/utilities/logActionRequired.mjs.map +1 -1
  692. package/package.json +14 -14
  693. package/src/FlowNavigation/FlowNavigation.css +5 -6
  694. package/src/FlowNavigation/FlowNavigation.less +7 -8
  695. package/src/main.css +6 -38
  696. package/src/styles/less/core/_fonts.less +9 -29
  697. package/src/styles/less/core/_scaffolding.less +1 -12
  698. package/src/styles/less/neptune-core.css +1 -32
  699. package/src/styles/less/neptune.css +1 -32
  700. package/build/styles/fonts/TW-Averta-Bold.woff +0 -0
  701. package/build/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  702. package/build/styles/fonts/TW-Averta-Regular.woff +0 -0
  703. package/build/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  704. package/build/styles/fonts/TW-Averta-Semibold.woff +0 -0
  705. package/build/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  706. package/build/styles/fonts/TransferWise-IconFont.svg +0 -81
  707. package/build/styles/fonts/TransferWise-IconFont.woff +0 -0
  708. package/src/styles/fonts/TW-Averta-Bold.woff +0 -0
  709. package/src/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  710. package/src/styles/fonts/TW-Averta-Regular.woff +0 -0
  711. package/src/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  712. package/src/styles/fonts/TW-Averta-Semibold.woff +0 -0
  713. package/src/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  714. package/src/styles/fonts/TransferWise-IconFont.svg +0 -81
  715. package/src/styles/fonts/TransferWise-IconFont.woff +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Emphasis.mjs","sources":["../../src/Emphasis/Emphasis.tsx"],"sourcesContent":["import EmphasisHtmlTransformer from './EmphasisHtmlTransformer';\n\nconst SUPPORTED_TAGS = ['important', 'positive', 'negative', 'warning'];\nconst emphasisHtmlTransformer = new EmphasisHtmlTransformer(SUPPORTED_TAGS);\n\nexport type EmphasisProps = {\n text?: string;\n};\n\nconst Emphasis = ({ text = undefined }: EmphasisProps) => {\n if (!text) {\n return null;\n }\n\n const transformedText = emphasisHtmlTransformer.transform(text);\n // eslint-disable-next-line react/no-danger\n return transformedText ? <span dangerouslySetInnerHTML={{ __html: transformedText }} /> : null;\n};\n\nexport default Emphasis;\n"],"names":["SUPPORTED_TAGS","emphasisHtmlTransformer","EmphasisHtmlTransformer","Emphasis","text","undefined","transformedText","transform","_jsx","dangerouslySetInnerHTML","__html"],"mappings":";;;AAEA,MAAMA,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC;AACvE,MAAMC,uBAAuB,GAAG,IAAIC,uBAAuB,CAACF,cAAc,CAAC;AAM3E,MAAMG,QAAQ,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAGC;AAAS,CAAiB,KAAI;EACvD,IAAI,CAACD,IAAI,EAAE;AACT,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,MAAME,eAAe,GAAGL,uBAAuB,CAACM,SAAS,CAACH,IAAI,CAAC;AAC/D;EACA,OAAOE,eAAe,gBAAGE,GAAA,CAAA,MAAA,EAAA;AAAMC,IAAAA,uBAAuB,EAAE;AAAEC,MAAAA,MAAM,EAAEJ;AAAe;IAAM,GAAG,IAAI;AAChG;;;;"}
1
+ {"version":3,"file":"Emphasis.mjs","sources":["../../src/Emphasis/Emphasis.tsx"],"sourcesContent":["import EmphasisHtmlTransformer from './EmphasisHtmlTransformer';\n\nconst SUPPORTED_TAGS = ['important', 'positive', 'negative', 'warning'];\nconst emphasisHtmlTransformer = new EmphasisHtmlTransformer(SUPPORTED_TAGS);\n\nexport type EmphasisProps = {\n text?: string;\n};\n\nconst Emphasis = ({ text = undefined }: EmphasisProps) => {\n if (!text) {\n return null;\n }\n\n const transformedText = emphasisHtmlTransformer.transform(text);\n // eslint-disable-next-line react/no-danger\n return transformedText ? <span dangerouslySetInnerHTML={{ __html: transformedText }} /> : null;\n};\n\nexport default Emphasis;\n"],"names":["SUPPORTED_TAGS","emphasisHtmlTransformer","EmphasisHtmlTransformer","Emphasis","text","undefined","transformedText","transform","_jsx","dangerouslySetInnerHTML","__html"],"mappings":";;;AAEA,MAAMA,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC;AACvE,MAAMC,uBAAuB,GAAG,IAAIC,uBAAuB,CAACF,cAAc,CAAC;AAM3E,MAAMG,QAAQ,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAGC;AAAS,CAAiB,KAAI;EACvD,IAAI,CAACD,IAAI,EAAE;AACT,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,MAAME,eAAe,GAAGL,uBAAuB,CAACM,SAAS,CAACH,IAAI,CAAC;AAC/D;EACA,OAAOE,eAAe,gBAAGE,GAAA,CAAA,MAAA,EAAA;AAAMC,IAAAA,uBAAuB,EAAE;AAAEC,MAAAA,MAAM,EAAEJ;AAAe;IAAM,GAAG,IAAI;AAChG;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EmphasisHtmlTransformer.js","sources":["../../src/Emphasis/EmphasisHtmlTransformer.ts"],"sourcesContent":["const ESCAPED_OPENING_CHEVRON = '&lt;';\nconst ESCAPED_CLOSING_CHEVRON = '&gt;';\n\ntype Tags = {\n transformed: {\n opening: string;\n closing: string;\n };\n escapedRegex: {\n opening: RegExp;\n closing: RegExp;\n };\n};\n\nclass EmphasisHtmlTransformer {\n tags: Tags[];\n\n constructor(whitelistedTags?: string[]) {\n this.tags = (whitelistedTags || []).map((tag) => {\n return {\n transformed: {\n opening: `<em class=\"emphasis emphasis--${tag}\">`,\n closing: '</em>',\n },\n escapedRegex: {\n opening: new RegExp(`${ESCAPED_OPENING_CHEVRON}${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n closing: new RegExp(`${ESCAPED_OPENING_CHEVRON}/${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n },\n };\n });\n }\n\n // Algorithm:\n // 1) Escape all dangerous characters (<,>,&)\n // 2) Replace all escaped, whitelisted tags with styled spans.\n // 3) Transform new line characters to `<br />`s\n //\n // Note: for simplicity this doesn't support tags with non-standard whitespaces, e.g. <positive></ positive>\n transform(unsafe: string): string | null {\n if (!unsafe) {\n return null;\n }\n\n const safe = unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n return this.tags\n .reduce((accumulator, tag) => {\n return accumulator\n .replace(tag.escapedRegex.opening, tag.transformed.opening)\n .replace(tag.escapedRegex.closing, tag.transformed.closing);\n }, safe)\n .replace(/\\\\n|\\n/g, '<br />');\n }\n}\n\nexport default EmphasisHtmlTransformer;\n"],"names":["ESCAPED_OPENING_CHEVRON","ESCAPED_CLOSING_CHEVRON","EmphasisHtmlTransformer","tags","constructor","whitelistedTags","map","tag","transformed","opening","closing","escapedRegex","RegExp","transform","unsafe","safe","replace","reduce","accumulator"],"mappings":";;;;AAAA,MAAMA,uBAAuB,GAAG,MAAM;AACtC,MAAMC,uBAAuB,GAAG,MAAM;AAatC,MAAMC,uBAAuB,CAAA;EAC3BC,IAAI;EAEJC,WAAAA,CAAYC,eAA0B,EAAA;IACpC,IAAI,CAACF,IAAI,GAAG,CAACE,eAAe,IAAI,EAAE,EAAEC,GAAG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mphasisHtmlTransformer.ts"],"sourcesContent":["const ESCAPED_OPENING_CHEVRON = '&lt;';\nconst ESCAPED_CLOSING_CHEVRON = '&gt;';\n\ntype Tags = {\n transformed: {\n opening: string;\n closing: string;\n };\n escapedRegex: {\n opening: RegExp;\n closing: RegExp;\n };\n};\n\nclass EmphasisHtmlTransformer {\n tags: Tags[];\n\n constructor(whitelistedTags?: string[]) {\n this.tags = (whitelistedTags || []).map((tag) => {\n return {\n transformed: {\n opening: `<em class=\"emphasis emphasis--${tag}\">`,\n closing: '</em>',\n },\n escapedRegex: {\n opening: new RegExp(`${ESCAPED_OPENING_CHEVRON}${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n closing: new RegExp(`${ESCAPED_OPENING_CHEVRON}/${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n },\n };\n });\n }\n\n // Algorithm:\n // 1) Escape all dangerous characters (<,>,&)\n // 2) Replace all escaped, whitelisted tags with styled spans.\n // 3) Transform new line characters to `<br />`s\n //\n // Note: for simplicity this doesn't support tags with non-standard whitespaces, e.g. <positive></ positive>\n transform(unsafe: string): string | null {\n if (!unsafe) {\n return null;\n }\n\n const safe = unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n return this.tags\n .reduce((accumulator, tag) => {\n return accumulator\n .replace(tag.escapedRegex.opening, tag.transformed.opening)\n .replace(tag.escapedRegex.closing, tag.transformed.closing);\n }, safe)\n .replace(/\\\\n|\\n/g, '<br />');\n }\n}\n\nexport default EmphasisHtmlTransformer;\n"],"names":["ESCAPED_OPENING_CHEVRON","ESCAPED_CLOSING_CHEVRON","EmphasisHtmlTransformer","tags","constructor","whitelistedTags","map","tag","transformed","opening","closing","escapedRegex","RegExp","transform","unsafe","safe","replace","reduce","accumulator"],"mappings":";;;;AAAA,MAAMA,uBAAuB,GAAG,MAAM;AACtC,MAAMC,uBAAuB,GAAG,MAAM;AAatC,MAAMC,uBAAuB,CAAA;EAC3BC,IAAI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AAS,EAAE,QAAQ,CAAC;AACjC,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EmphasisHtmlTransformer.mjs","sources":["../../src/Emphasis/EmphasisHtmlTransformer.ts"],"sourcesContent":["const ESCAPED_OPENING_CHEVRON = '&lt;';\nconst ESCAPED_CLOSING_CHEVRON = '&gt;';\n\ntype Tags = {\n transformed: {\n opening: string;\n closing: string;\n };\n escapedRegex: {\n opening: RegExp;\n closing: RegExp;\n };\n};\n\nclass EmphasisHtmlTransformer {\n tags: Tags[];\n\n constructor(whitelistedTags?: string[]) {\n this.tags = (whitelistedTags || []).map((tag) => {\n return {\n transformed: {\n opening: `<em class=\"emphasis emphasis--${tag}\">`,\n closing: '</em>',\n },\n escapedRegex: {\n opening: new RegExp(`${ESCAPED_OPENING_CHEVRON}${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n closing: new RegExp(`${ESCAPED_OPENING_CHEVRON}/${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n },\n };\n });\n }\n\n // Algorithm:\n // 1) Escape all dangerous characters (<,>,&)\n // 2) Replace all escaped, whitelisted tags with styled spans.\n // 3) Transform new line characters to `<br />`s\n //\n // Note: for simplicity this doesn't support tags with non-standard whitespaces, e.g. <positive></ positive>\n transform(unsafe: string): string | null {\n if (!unsafe) {\n return null;\n }\n\n const safe = unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n return this.tags\n .reduce((accumulator, tag) => {\n return accumulator\n .replace(tag.escapedRegex.opening, tag.transformed.opening)\n .replace(tag.escapedRegex.closing, tag.transformed.closing);\n }, safe)\n .replace(/\\\\n|\\n/g, '<br />');\n }\n}\n\nexport default EmphasisHtmlTransformer;\n"],"names":["ESCAPED_OPENING_CHEVRON","ESCAPED_CLOSING_CHEVRON","EmphasisHtmlTransformer","tags","constructor","whitelistedTags","map","tag","transformed","opening","closing","escapedRegex","RegExp","transform","unsafe","safe","replace","reduce","accumulator"],"mapp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AAY,CAACD,OAAO,EAAEH,GAAG,CAACC,WAAW,CAACE,OAAO,CAAC;IAC/D,CAAC,EAAEK,IAAI,CAAC,CACPC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;AACjC,EAAA;AACD;;;;"}
1
+ {"version":3,"file":"EmphasisHtmlTransformer.mjs","sources":["../../src/Emphasis/EmphasisHtmlTransformer.ts"],"sourcesContent":["const ESCAPED_OPENING_CHEVRON = '&lt;';\nconst ESCAPED_CLOSING_CHEVRON = '&gt;';\n\ntype Tags = {\n transformed: {\n opening: string;\n closing: string;\n };\n escapedRegex: {\n opening: RegExp;\n closing: RegExp;\n };\n};\n\nclass EmphasisHtmlTransformer {\n tags: Tags[];\n\n constructor(whitelistedTags?: string[]) {\n this.tags = (whitelistedTags || []).map((tag) => {\n return {\n transformed: {\n opening: `<em class=\"emphasis emphasis--${tag}\">`,\n closing: '</em>',\n },\n escapedRegex: {\n opening: new RegExp(`${ESCAPED_OPENING_CHEVRON}${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n closing: new RegExp(`${ESCAPED_OPENING_CHEVRON}/${tag}${ESCAPED_CLOSING_CHEVRON}`, 'g'),\n },\n };\n });\n }\n\n // Algorithm:\n // 1) Escape all dangerous characters (<,>,&)\n // 2) Replace all escaped, whitelisted tags with styled spans.\n // 3) Transform new line characters to `<br />`s\n //\n // Note: for simplicity this doesn't support tags with non-standard whitespaces, e.g. <positive></ positive>\n transform(unsafe: string): string | null {\n if (!unsafe) {\n return null;\n }\n\n const safe = unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n\n return this.tags\n .reduce((accumulator, tag) => {\n return accumulator\n .replace(tag.escapedRegex.opening, tag.transformed.opening)\n .replace(tag.escapedRegex.closing, tag.transformed.closing);\n }, safe)\n .replace(/\\\\n|\\n/g, '<br />');\n }\n}\n\nexport default EmphasisHtmlTransformer;\n"],"names":["ESCAPED_OPENING_CHEVRON","ESCAPED_CLOSING_CHEVRON","EmphasisHtmlTransformer","tags","constructor","whitelistedTags","map","tag","transformed","opening","closing","escapedRegex","RegExp","transform","unsafe","safe","replace","reduce","accumulator"],"mappings":"AAAA,MAAMA,uBAAuB,GAAG,MAAM;AACtC,MAAMC,uBAAuB,GAAG,MAAM;AAatC,MAAMC,uBAAuB,CAAA;EAC3BC,IAAI;EAEJC,WAAAA,CAAYC,eAA0B,EAAA;IACpC,IAAI,CAACF,IAAI,GAAG,CAACE,eAAe,IAAI,EAAE,EAAEC,GAAG,CAAEC,GAAG,IAAI;MAC9C,OAAO;AACLC,QAAAA,WAAW,EAAE;UACXC,OAAO,EAAE,CAAA,8BAAA,EAAiCF,GAAG,CAAA,EAAA,CAAI;AACjDG,UAAAA,OAAO,EAAE;SACV;AACDC,QAAAA,YAAY,EAAE;AACZF,UAAAA,OAAO,EAAE,IAAIG,MAAM,CAAC,CAAA,EAAGZ,uBAAuB,CAAA,EAAGO,GAAG,CAAA,EAAGN,uBAAuB,CAAA,CAAE,EAAE,GAAG,CAAC;AACtFS,UAAAA,OAAO,EAAE,IAAIE,MAAM,CAAC,CAAA,EAAGZ,uBAAuB,CAAA,CAAA,EAAIO,GAAG,CAAA,EAAGN,uBAAuB,CAAA,CAAE,EAAE,GAAG;AACvF;OACF;AACH,IAAA,CAAC,CAAC;AACJ,EAAA;AAEA;AACA;AACA;AACA;AACA;AACA;EACAY,SAASA,CAACC,MAAc,EAAA;IACtB,IAAI,CAACA,MAAM,EAAE;AACX,MAAA,OAAO,IAAI;AACb,IAAA;IAEA,MAAMC,IAAI,GAAGD,MAAM,CAACE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAACA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAACA,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtF,OAAO,IAAI,CAACb,IAAI,CACbc,MAAM,CAAC,CAACC,WAAW,EAAEX,GAAG,KAAI;AAC3B,MAAA,OAAOW,WAAW,CACfF,OAAO,CAACT,GAAG,CAACI,YAAY,CAACF,OAAO,EAAEF,GAAG,CAACC,WAAW,CAACC,OAAO,CAAC,CAC1DO,OAAO,CAACT,GAAG,CAACI,YAAY,CAACD,OAAO,EAAEH,GAAG,CAACC,WAAW,CAACE,OAAO,CAAC;IAC/D,CAAC,EAAEK,IAAI,CAAC,CACPC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;AACjC,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AmountInput.js","sources":["../../../src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport { clsx } from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport type { ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { AnimatedNumber } from '../AnimatedNumber/AnimatedNumber';\nimport { useFocus } from '../hooks/useFocus';\nimport { useInputStyle } from '../hooks/useInputStyle';\nimport {\n getDecimalCount,\n getDecimalSeparator,\n getEnteredDecimalsCount,\n getFormattedString,\n getGroupSeparator,\n getUnformattedNumber,\n isAllowedInputKey,\n isInputPossiblyOverflowing,\n} from './utils';\n\ntype AmountInputProps = {\n id: string;\n describedById?: string;\n amount?: number | null;\n currency: string;\n autoFocus?: boolean;\n onChange: (amount: number | null) => void;\n onFocusChange?: (focused: boolean) => void;\n} & Pick<ExpressiveMoneyInputProps, 'loading'>;\n\nexport const AmountInput = ({\n id,\n describedById,\n amount,\n currency,\n autoFocus,\n onChange,\n onFocusChange,\n loading,\n}: AmountInputProps) => {\n const intl = useIntl();\n const { focus, setFocus, visualFocus, setVisualFocus } = useFocus();\n\n const [value, setValue] = useState<string>(() =>\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n const prevAmountRef = useRef<string | number | null | undefined>(amount);\n const numericValue = useMemo(() => {\n return getUnformattedNumber({\n value,\n currency,\n locale: intl.locale,\n });\n }, [value, currency, intl.locale]);\n\n const valueWithFullDecimals = useMemo(() => {\n return getFormattedString({\n value: numericValue ?? 0,\n currency,\n locale: intl.locale,\n alwaysShowDecimals: true,\n });\n }, [numericValue, currency, intl.locale]);\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus) {\n ref.current?.focus();\n }\n }, []);\n\n const placeholder = getPlaceholder(currency, intl.locale);\n const groupSeparator = getGroupSeparator(currency, intl.locale);\n const decimalSeparator = getDecimalSeparator(currency, intl.locale);\n const maxDecimalCount = getDecimalCount(currency, intl.locale);\n\n const decimalPart = getDecimalPart(value, decimalSeparator);\n const decimalMode = decimalSeparator && value.includes(decimalSeparator);\n\n useEffect(() => {\n if (prevAmountRef.current !== amount) {\n prevAmountRef.current = amount;\n\n // Only update the displayed value if not focused (preserve user input when focused)\n if (!focus) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- Syncing external prop to internal state when unfocused\n setValue(\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n }\n }\n }, [amount, focus, currency, intl.locale]);\n\n useEffect(() => {\n onFocusChange?.(visualFocus);\n }, [onFocusChange, visualFocus]);\n\n const shouldReformatAfterUserInput = (newValue: string) => {\n // don't reformat if formatting would wipe out user's input\n if (reformatValue(newValue) === '') {\n return false;\n }\n\n const endsWithDecimalSeparator = decimalSeparator && newValue.endsWith(decimalSeparator);\n const endsWithGroupSeparator = groupSeparator && newValue.endsWith(groupSeparator);\n\n // if the user has entered a seperator to the end, formatting would delete it\n if (endsWithDecimalSeparator || endsWithGroupSeparator) {\n return false;\n }\n\n const containsDecimalSeparator = decimalSeparator && newValue.includes(decimalSeparator);\n\n if (containsDecimalSeparator) {\n const enteredDecimalsCount = getEnteredDecimalsCount(newValue, decimalSeparator);\n // don't reformat until user has entered all the allowed decimals\n // for example, we don't want 1.1 to be reformatted to 1.10 immediately\n if (enteredDecimalsCount < maxDecimalCount) {\n return false;\n }\n }\n\n return true;\n };\n\n const reformatValue = (newValue: string) => {\n const unformattedValue = getUnformattedNumber({\n value: newValue,\n currency,\n locale: intl.locale,\n });\n const formattedValue = unformattedValue\n ? getFormattedString({\n value: unformattedValue,\n currency,\n locale: intl.locale,\n })\n : '';\n return formattedValue;\n };\n\n const handleChange = (newValue: string) => {\n const oldCursorPosition = ref.current?.selectionStart ?? 0;\n\n const newFormattedString = shouldReformatAfterUserInput(newValue)\n ? reformatValue(newValue)\n : newValue;\n setValue(newFormattedString);\n\n const newNumber = getUnformattedNumber({\n value: newFormattedString,\n currency,\n locale: intl.locale,\n });\n\n if (newNumber !== numericValue) {\n if (numericValue || newNumber) {\n onChange(newNumber);\n }\n }\n\n const newCursorPosition = oldCursorPosition + (newFormattedString.length - newValue.length);\n requestAnimationFrame(() => {\n ref?.current?.setSelectionRange(newCursorPosition, newCursorPosition);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n\n const clipboardData = e.clipboardData?.getData('text/plain');\n if (!clipboardData) {\n return;\n }\n\n // need to sanitise the pasted value otherwise other validation logic will ignore the input entirely\n const sanitisedValue = reformatValue(clipboardData);\n\n handleChange(sanitisedValue);\n };\n\n const handleBlur = () => {\n setFocus(false);\n setValue(reformatValue(value));\n };\n\n const handleBackspace = (e: KeyboardEvent<HTMLInputElement>) => {\n const input = e.target as HTMLInputElement;\n // using the updated selection range after the backspace key has been processed, instead of the current selection range in state\n const { value: currentValue, selectionStart, selectionEnd } = input;\n\n if (selectionStart === selectionEnd && selectionStart && selectionStart > 0) {\n const charBeforeCursor = currentValue[selectionStart - 1];\n\n // if the user deletes a thousands separator, remove the digit before it as well\n if (charBeforeCursor === groupSeparator) {\n e.preventDefault();\n const beforeCursor = currentValue.slice(0, selectionStart - 2);\n const afterCursor = currentValue.slice(selectionStart);\n const newValue = `${beforeCursor}${afterCursor}`;\n input.setSelectionRange(beforeCursor.length, beforeCursor.length);\n handleChange(newValue);\n }\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n setFocus(true);\n if (!isAllowedInputKey(e)) {\n e.preventDefault();\n }\n\n if (e.key === 'Backspace') {\n handleBackspace(e);\n }\n };\n\n const isAllowedInput = (e: ChangeEvent<HTMLInputElement>) => {\n const hasMultipleDecimalSeparators =\n decimalSeparator && e.target.value.split(decimalSeparator).length > 2;\n if (hasMultipleDecimalSeparators) {\n return false;\n }\n\n const newNumericValue = getUnformattedNumber({\n value: e.target.value,\n currency,\n locale: intl.locale,\n });\n const maxLength = Number.MAX_SAFE_INTEGER.toString().length;\n if (String(newNumericValue).length > maxLength) {\n return false;\n }\n\n return true;\n };\n\n const addonContent = useMemo((): string | null | undefined => {\n // because we're using a separate \"addon\" element for the placeholder decimals, there is a possibility that the input itself will become scrollable\n // and the decimals will appear on top of the input. Safest thing to do is to just hide the addon if there is not enough room\n // eslint-disable-next-line react-hooks/refs -- Reading layout dimensions for overflow detection\n if (isInputPossiblyOverflowing({ ref, value })) {\n return null;\n }\n if (!decimalSeparator || !value) {\n return null;\n }\n\n // if the user has typed a decimal separator, show the full decimal part as a placeholder\n // this returns a string even if there is no content, typing should replace the placeholder immediately without animation\n // otherwise there is an ugly animation when going from 1.23 to 1.2 due to AnimatePresence\n if (focus && decimalMode) {\n // reuse getDecimalPart\n const fullDecimalPart = getDecimalPart(valueWithFullDecimals, decimalSeparator);\n // show only the characters that are not already displayed by the input\n return fullDecimalPart?.slice(decimalPart?.length);\n }\n\n // in unfocused state, always show the full decimal part unless the user has already entered decimals\n if (!focus && !decimalMode) {\n const [_, decimalPlaceholder] = placeholder.split(decimalSeparator);\n return decimalSeparator + decimalPlaceholder;\n }\n\n return null;\n }, [\n decimalMode,\n decimalPart?.length,\n decimalSeparator,\n focus,\n placeholder,\n value,\n valueWithFullDecimals,\n ]);\n\n const style = useInputStyle({\n // whenever decimals are shown, we need to account for the full decimal part for the font size calculation\n value: addonContent ? valueWithFullDecimals : value,\n focus: visualFocus,\n inputElement: ref,\n loading,\n });\n\n return (\n <div className=\"wds-amount-input-container\" dir=\"ltr\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large--forced')}\n style={style}\n >\n <input\n ref={ref}\n dir=\"auto\"\n className=\"wds-amount-input-input\"\n id={id}\n autoComplete=\"off\"\n inputMode=\"decimal\"\n value={value}\n type=\"text\"\n placeholder={placeholder}\n aria-describedby={describedById}\n /* without this, the input tries to keep an aspect ratio and doesn't respect CSS width rules */\n size={1}\n onChange={(e) => {\n if (isAllowedInput(e)) {\n handleChange(e.target.value);\n }\n }}\n onBlurCapture={() => handleBlur()}\n onPaste={(e) => handlePaste(e)}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => {\n setTimeout(() => setVisualFocus(false), 30);\n }}\n onKeyDown={(e) => handleKeyDown(e)}\n />\n <AnimatePresence initial={false}>\n {addonContent !== null && (\n <AnimatedNumber\n className={clsx(\n 'wds-amount-input-placeholder',\n visualFocus && 'wds-amount-input-placeholder-focus',\n )}\n onClick={() => ref.current?.focus()}\n >\n {addonContent}\n </AnimatedNumber>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n};\n\nconst getPlaceholder = (currency: string, locale: string) => {\n return formatAmount(0, currency, locale, { alwaysShowDecimals: true });\n};\n\nconst getDecimalPart = (value: string, decimalSeparator: string | null) => {\n if (!value || !decimalSeparator) {\n return undefined;\n }\n\n const [_, decimalPart] = value.split(decimalSeparator);\n return decimalPart ?? undefined;\n};\n"],"names":["AmountInput","id","describedById","amount","currency","autoFocus","onChange","onFocusChange","loading","intl","useIntl","focus","setFocus","visualFocus","setVisualFocus","useFocus","value","setValue","useState","getFormattedString","locale","prevAmountRef","useRef","numericValue","useMemo","getUnformattedNumber","valueWithFullDecimals","alwaysShowDecimals","ref","useEffect","current","placeholder","getPlaceholder","groupSeparator","getGroupSeparator","decimalSeparator","getDecimalSeparator","maxDecimalCount","getDecimalCount","decimalPart","getDecimalPart","decimalMode","includes","shouldReformatAfterUserInput","newValue","reformatValue","endsWithDecimalSeparator","endsWith","endsWithGroupSeparator","containsDecimalSeparator","enteredDecimalsCount","getEnteredDecimalsCount","unformattedValue","formattedValue","handleChange","oldCursorPosition","selectionStart","newFormattedString","newNumber","newCursorPosition","length","requestAnimationFrame","setSelectionRange","handlePaste","e","preventDefault","clipboardData","getData","sanitisedValue","handleBlur","handleBackspace","input","target","currentValue","selectionEnd","charBeforeCursor","beforeCursor","slice","afterCursor","handleKeyDown","isAllowedInputKey","key","isAllowedInput","hasMultipleDecimalSeparators","split","newNumericValue","maxLength","Number","MAX_SAFE_INTEGER","toString","String","addonContent","isInputPossiblyOverflowing","fullDecimalPart","_","decimalPlaceholder","style","useInputStyle","inputElement","_jsx","className","dir","children","_jsxs","clsx","autoComplete","inputMode","type","size","onBlurCapture","onPaste","onFocus","onBlur","setTimeout","onKeyDown","AnimatePresence","initial","AnimatedNumber","onClick","formatAmount","undefined"],"mappings":";;;;;;;;;;;;;AA+BO,MAAMA,WAAW,GAAGA,CAAC;EAC1BC,EAAE;EACFC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,aAAa;AACbC,EAAAA;AAAO,CACU,KAAI;AACrB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;EACtB,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,WAAW;AAAEC,IAAAA;GAAgB,GAAGC,iBAAQ,EAAE;AAEnE,EAAA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ,CAAS,MACzCf,MAAM,GACFgB,wBAAkB,CAAC;AACjBH,IAAAA,KAAK,EAAEb,MAAM;IACbC,QAAQ;IACRgB,MAAM,EAAEX,IAAI,CAACW;GACd,CAAC,GACF,EAAE,CACP;AACD,EAAA,MAAMC,aAAa,GAAGC,YAAM,CAAqCnB,MAAM,CAAC;AACxE,EAAA,MAAMoB,YAAY,GAAGC,aAAO,CAAC,MAAK;AA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K;AACP,GAAK,CAAC;AAEV;AAEA,MAAM3D,cAAc,GAAGA,CAAC5B,QAAgB,EAAEgB,MAAc,KAAI;AAC1D,EAAA,OAAOmG,uBAAY,CAAC,CAAC,EAAEnH,QAAQ,EAAEgB,MAAM,EAAE;AAAEO,IAAAA,kBAAkB,EAAE;AAAI,GAAE,CAAC;AACxE,CAAC;AAED,MAAMa,cAAc,GAAGA,CAACxB,KAAa,EAAEmB,gBAA+B,KAAI;AACxE,EAAA,IAAI,CAACnB,KAAK,IAAI,CAACmB,gBAAgB,EAAE;AAC/B,IAAA,OAAOqF,SAAS;AAClB,EAAA;EAEA,MAAM,CAAC1B,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIiF,SAAS;AACjC,CAAC;;;;"}
1
+ {"version":3,"file":"AmountInput.js","sources":["../../../src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport { clsx } from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport type { ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { AnimatedNumber } from '../AnimatedNumber/AnimatedNumber';\nimport { useFocus } from '../hooks/useFocus';\nimport { useInputStyle } from '../hooks/useInputStyle';\nimport {\n getDecimalCount,\n getDecimalSeparator,\n getEnteredDecimalsCount,\n getFormattedString,\n getGroupSeparator,\n getUnformattedNumber,\n isAllowedInputKey,\n isInputPossiblyOverflowing,\n} from './utils';\n\ntype AmountInputProps = {\n id: string;\n describedById?: string;\n amount?: number | null;\n currency: string;\n autoFocus?: boolean;\n onChange: (amount: number | null) => void;\n onFocusChange?: (focused: boolean) => void;\n} & Pick<ExpressiveMoneyInputProps, 'loading'>;\n\nexport const AmountInput = ({\n id,\n describedById,\n amount,\n currency,\n autoFocus,\n onChange,\n onFocusChange,\n loading,\n}: AmountInputProps) => {\n const intl = useIntl();\n const { focus, setFocus, visualFocus, setVisualFocus } = useFocus();\n\n const [value, setValue] = useState<string>(() =>\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n const prevAmountRef = useRef<string | number | null | undefined>(amount);\n const numericValue = useMemo(() => {\n return getUnformattedNumber({\n value,\n currency,\n locale: intl.locale,\n });\n }, [value, currency, intl.locale]);\n\n const valueWithFullDecimals = useMemo(() => {\n return getFormattedString({\n value: numericValue ?? 0,\n currency,\n locale: intl.locale,\n alwaysShowDecimals: true,\n });\n }, [numericValue, currency, intl.locale]);\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus) {\n ref.current?.focus();\n }\n }, []);\n\n const placeholder = getPlaceholder(currency, intl.locale);\n const groupSeparator = getGroupSeparator(currency, intl.locale);\n const decimalSeparator = getDecimalSeparator(currency, intl.locale);\n const maxDecimalCount = getDecimalCount(currency, intl.locale);\n\n const decimalPart = getDecimalPart(value, decimalSeparator);\n const decimalMode = decimalSeparator && value.includes(decimalSeparator);\n\n useEffect(() => {\n if (prevAmountRef.current !== amount) {\n prevAmountRef.current = amount;\n\n // Only update the displayed value if not focused (preserve user input when focused)\n if (!focus) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- Syncing external prop to internal state when unfocused\n setValue(\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n }\n }\n }, [amount, focus, currency, intl.locale]);\n\n useEffect(() => {\n onFocusChange?.(visualFocus);\n }, [onFocusChange, visualFocus]);\n\n const shouldReformatAfterUserInput = (newValue: string) => {\n // don't reformat if formatting would wipe out user's input\n if (reformatValue(newValue) === '') {\n return false;\n }\n\n const endsWithDecimalSeparator = decimalSeparator && newValue.endsWith(decimalSeparator);\n const endsWithGroupSeparator = groupSeparator && newValue.endsWith(groupSeparator);\n\n // if the user has entered a seperator to the end, formatting would delete it\n if (endsWithDecimalSeparator || endsWithGroupSeparator) {\n return false;\n }\n\n const containsDecimalSeparator = decimalSeparator && newValue.includes(decimalSeparator);\n\n if (containsDecimalSeparator) {\n const enteredDecimalsCount = getEnteredDecimalsCount(newValue, decimalSeparator);\n // don't reformat until user has entered all the allowed decimals\n // for example, we don't want 1.1 to be reformatted to 1.10 immediately\n if (enteredDecimalsCount < maxDecimalCount) {\n return false;\n }\n }\n\n return true;\n };\n\n const reformatValue = (newValue: string) => {\n const unformattedValue = getUnformattedNumber({\n value: newValue,\n currency,\n locale: intl.locale,\n });\n const formattedValue = unformattedValue\n ? getFormattedString({\n value: unformattedValue,\n currency,\n locale: intl.locale,\n })\n : '';\n return formattedValue;\n };\n\n const handleChange = (newValue: string) => {\n const oldCursorPosition = ref.current?.selectionStart ?? 0;\n\n const newFormattedString = shouldReformatAfterUserInput(newValue)\n ? reformatValue(newValue)\n : newValue;\n setValue(newFormattedString);\n\n const newNumber = getUnformattedNumber({\n value: newFormattedString,\n currency,\n locale: intl.locale,\n });\n\n if (newNumber !== numericValue) {\n if (numericValue || newNumber) {\n onChange(newNumber);\n }\n }\n\n const newCursorPosition = oldCursorPosition + (newFormattedString.length - newValue.length);\n requestAnimationFrame(() => {\n ref?.current?.setSelectionRange(newCursorPosition, newCursorPosition);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n\n const clipboardData = e.clipboardData?.getData('text/plain');\n if (!clipboardData) {\n return;\n }\n\n // need to sanitise the pasted value otherwise other validation logic will ignore the input entirely\n const sanitisedValue = reformatValue(clipboardData);\n\n handleChange(sanitisedValue);\n };\n\n const handleBlur = () => {\n setFocus(false);\n setValue(reformatValue(value));\n };\n\n const handleBackspace = (e: KeyboardEvent<HTMLInputElement>) => {\n const input = e.target as HTMLInputElement;\n // using the updated selection range after the backspace key has been processed, instead of the current selection range in state\n const { value: currentValue, selectionStart, selectionEnd } = input;\n\n if (selectionStart === selectionEnd && selectionStart && selectionStart > 0) {\n const charBeforeCursor = currentValue[selectionStart - 1];\n\n // if the user deletes a thousands separator, remove the digit before it as well\n if (charBeforeCursor === groupSeparator) {\n e.preventDefault();\n const beforeCursor = currentValue.slice(0, selectionStart - 2);\n const afterCursor = currentValue.slice(selectionStart);\n const newValue = `${beforeCursor}${afterCursor}`;\n input.setSelectionRange(beforeCursor.length, beforeCursor.length);\n handleChange(newValue);\n }\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n setFocus(true);\n if (!isAllowedInputKey(e)) {\n e.preventDefault();\n }\n\n if (e.key === 'Backspace') {\n handleBackspace(e);\n }\n };\n\n const isAllowedInput = (e: ChangeEvent<HTMLInputElement>) => {\n const hasMultipleDecimalSeparators =\n decimalSeparator && e.target.value.split(decimalSeparator).length > 2;\n if (hasMultipleDecimalSeparators) {\n return false;\n }\n\n const newNumericValue = getUnformattedNumber({\n value: e.target.value,\n currency,\n locale: intl.locale,\n });\n const maxLength = Number.MAX_SAFE_INTEGER.toString().length;\n if (String(newNumericValue).length > maxLength) {\n return false;\n }\n\n return true;\n };\n\n const addonContent = useMemo((): string | null | undefined => {\n // because we're using a separate \"addon\" element for the placeholder decimals, there is a possibility that the input itself will become scrollable\n // and the decimals will appear on top of the input. Safest thing to do is to just hide the addon if there is not enough room\n // eslint-disable-next-line react-hooks/refs -- Reading layout dimensions for overflow detection\n if (isInputPossiblyOverflowing({ ref, value })) {\n return null;\n }\n if (!decimalSeparator || !value) {\n return null;\n }\n\n // if the user has typed a decimal separator, show the full decimal part as a placeholder\n // this returns a string even if there is no content, typing should replace the placeholder immediately without animation\n // otherwise there is an ugly animation when going from 1.23 to 1.2 due to AnimatePresence\n if (focus && decimalMode) {\n // reuse getDecimalPart\n const fullDecimalPart = getDecimalPart(valueWithFullDecimals, decimalSeparator);\n // show only the characters that are not already displayed by the input\n return fullDecimalPart?.slice(decimalPart?.length);\n }\n\n // in unfocused state, always show the full decimal part unless the user has already entered decimals\n if (!focus && !decimalMode) {\n const [_, decimalPlaceholder] = placeholder.split(decimalSeparator);\n return decimalSeparator + decimalPlaceholder;\n }\n\n return null;\n }, [\n decimalMode,\n decimalPart?.length,\n decimalSeparator,\n focus,\n placeholder,\n value,\n valueWithFullDecimals,\n ]);\n\n const style = useInputStyle({\n // whenever decimals are shown, we need to account for the full decimal part for the font size calculation\n value: addonContent ? valueWithFullDecimals : value,\n focus: visualFocus,\n inputElement: ref,\n loading,\n });\n\n return (\n <div className=\"wds-amount-input-container\" dir=\"ltr\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large--forced')}\n style={style}\n >\n <input\n ref={ref}\n dir=\"auto\"\n className=\"wds-amount-input-input\"\n id={id}\n autoComplete=\"off\"\n inputMode=\"decimal\"\n value={value}\n type=\"text\"\n placeholder={placeholder}\n aria-describedby={describedById}\n /* without this, the input tries to keep an aspect ratio and doesn't respect CSS width rules */\n size={1}\n onChange={(e) => {\n if (isAllowedInput(e)) {\n handleChange(e.target.value);\n }\n }}\n onBlurCapture={() => handleBlur()}\n onPaste={(e) => handlePaste(e)}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => {\n setTimeout(() => setVisualFocus(false), 30);\n }}\n onKeyDown={(e) => handleKeyDown(e)}\n />\n <AnimatePresence initial={false}>\n {addonContent !== null && (\n <AnimatedNumber\n className={clsx(\n 'wds-amount-input-placeholder',\n visualFocus && 'wds-amount-input-placeholder-focus',\n )}\n onClick={() => ref.current?.focus()}\n >\n {addonContent}\n </AnimatedNumber>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n};\n\nconst getPlaceholder = (currency: string, locale: string) => {\n return formatAmount(0, currency, locale, { alwaysShowDecimals: true });\n};\n\nconst getDecimalPart = (value: string, decimalSeparator: string | null) => {\n if (!value || !decimalSeparator) {\n return undefined;\n }\n\n const [_, decimalPart] = value.split(decimalSeparator);\n return decimalPart ?? undefined;\n};\n"],"names":["AmountInput","id","describedById","amount","currency","autoFocus","onChange","onFocusChange","loading","intl","useIntl","focus","setFocus","visualFocus","setVisualFocus","useFocus","value","setValue","useState","getFormattedString","locale","prevAmountRef","useRef","numericValue","useMemo","getUnformattedNumber","valueWithFullDecimals","alwaysShowDecimals","ref","useEffect","current","placeholder","getPlaceholder","groupSeparator","getGroupSeparator","decimalSeparator","getDecimalSeparator","maxDecimalCount","getDecimalCount","decimalPart","getDecimalPart","decimalMode","includes","shouldReformatAfterUserInput","newValue","reformatValue","endsWithDecimalSeparator","endsWith","endsWithGroupSeparator","containsDecimalSeparator","enteredDecimalsCount","getEnteredDecimalsCount","unformattedValue","formattedValue","handleChange","oldCursorPosition","selectionStart","newFormattedString","newNumber","newCursorPosition","length","requestAnimationFrame","setSelectionRange","handlePaste","e","preventDefault","clipboardData","getData","sanitisedValue","handleBlur","handleBackspace","input","target","currentValue","selectionEnd","charBeforeCursor","beforeCursor","slice","afterCursor","handleKeyDown","isAllowedInputKey","key","isAllowedInput","hasMultipleDecimalSeparators","split","newNumericValue","maxLength","Number","MAX_SAFE_INTEGER","toString","String","addonContent","isInputPossiblyOverflowing","fullDecimalPart","_","decimalPlaceholder","style","useInputStyle","inputElement","_jsx","className","dir","children","_jsxs","clsx","autoComplete","inputMode","type","size","onBlurCapture","onPaste","onFocus","onBlur","setTimeout","onKeyDown","AnimatePresence","initial","AnimatedNumber","onClick","formatAmount","undefined"],"mappings":";;;;;;;;;;;;;AA+BO,MAAMA,WAAW,GAAGA,CAAC;EAC1BC,EAAE;EACFC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,aAAa;AACbC,EAAAA;AAAO,CACU,KAAI;AACrB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;EACtB,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,WAAW;AAAEC,IAAAA;GAAgB,GAAGC,iBAAQ,EAAE;AAEnE,EAAA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ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,EAC7BX,YAAY,KAAK,IAAI,iBACpBQ,cAAA,CAACkB,6BAAc,EAAA;UACbjB,SAAS,EAAEI,SAAI,CACb,8BAA8B,EAC9B3F,WAAW,IAAI,oCAAoC,CACnD;UACFyG,OAAO,EAAEA,MAAM1F,GAAG,CAACE,OAAO,EAAEnB,KAAK,EAAG;AAAA2F,UAAAA,QAAA,EAEnCX;SACa;AACjB,OACc,CACnB;KAAK;AACP,GAAK,CAAC;AAEV;AAEA,MAAM3D,cAAc,GAAGA,CAAC5B,QAAgB,EAAEgB,MAAc,KAAI;AAC1D,EAAA,OAAOmG,uBAAY,CAAC,CAAC,EAAEnH,QAAQ,EAAEgB,MAAM,EAAE;AAAEO,IAAAA,kBAAkB,EAAE;AAAI,GAAE,CAAC;AACxE,CAAC;AAED,MAAMa,cAAc,GAAGA,CAACxB,KAAa,EAAEmB,gBAA+B,KAAI;AACxE,EAAA,IAAI,CAACnB,KAAK,IAAI,CAACmB,gBAAgB,EAAE;AAC/B,IAAA,OAAOqF,SAAS;AAClB,EAAA;EAEA,MAAM,CAAC1B,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIiF,SAAS;AACjC,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AmountInput.mjs","sources":["../../../src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport { clsx } from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport type { ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { AnimatedNumber } from '../AnimatedNumber/AnimatedNumber';\nimport { useFocus } from '../hooks/useFocus';\nimport { useInputStyle } from '../hooks/useInputStyle';\nimport {\n getDecimalCount,\n getDecimalSeparator,\n getEnteredDecimalsCount,\n getFormattedString,\n getGroupSeparator,\n getUnformattedNumber,\n isAllowedInputKey,\n isInputPossiblyOverflowing,\n} from './utils';\n\ntype AmountInputProps = {\n id: string;\n describedById?: string;\n amount?: number | null;\n currency: string;\n autoFocus?: boolean;\n onChange: (amount: number | null) => void;\n onFocusChange?: (focused: boolean) => void;\n} & Pick<ExpressiveMoneyInputProps, 'loading'>;\n\nexport const AmountInput = ({\n id,\n describedById,\n amount,\n currency,\n autoFocus,\n onChange,\n onFocusChange,\n loading,\n}: AmountInputProps) => {\n const intl = useIntl();\n const { focus, setFocus, visualFocus, setVisualFocus } = useFocus();\n\n const [value, setValue] = useState<string>(() =>\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n const prevAmountRef = useRef<string | number | null | undefined>(amount);\n const numericValue = useMemo(() => {\n return getUnformattedNumber({\n value,\n currency,\n locale: intl.locale,\n });\n }, [value, currency, intl.locale]);\n\n const valueWithFullDecimals = useMemo(() => {\n return getFormattedString({\n value: numericValue ?? 0,\n currency,\n locale: intl.locale,\n alwaysShowDecimals: true,\n });\n }, [numericValue, currency, intl.locale]);\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus) {\n ref.current?.focus();\n }\n }, []);\n\n const placeholder = getPlaceholder(currency, intl.locale);\n const groupSeparator = getGroupSeparator(currency, intl.locale);\n const decimalSeparator = getDecimalSeparator(currency, intl.locale);\n const maxDecimalCount = getDecimalCount(currency, intl.locale);\n\n const decimalPart = getDecimalPart(value, decimalSeparator);\n const decimalMode = decimalSeparator && value.includes(decimalSeparator);\n\n useEffect(() => {\n if (prevAmountRef.current !== amount) {\n prevAmountRef.current = amount;\n\n // Only update the displayed value if not focused (preserve user input when focused)\n if (!focus) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- Syncing external prop to internal state when unfocused\n setValue(\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n }\n }\n }, [amount, focus, currency, intl.locale]);\n\n useEffect(() => {\n onFocusChange?.(visualFocus);\n }, [onFocusChange, visualFocus]);\n\n const shouldReformatAfterUserInput = (newValue: string) => {\n // don't reformat if formatting would wipe out user's input\n if (reformatValue(newValue) === '') {\n return false;\n }\n\n const endsWithDecimalSeparator = decimalSeparator && newValue.endsWith(decimalSeparator);\n const endsWithGroupSeparator = groupSeparator && newValue.endsWith(groupSeparator);\n\n // if the user has entered a seperator to the end, formatting would delete it\n if (endsWithDecimalSeparator || endsWithGroupSeparator) {\n return false;\n }\n\n const containsDecimalSeparator = decimalSeparator && newValue.includes(decimalSeparator);\n\n if (containsDecimalSeparator) {\n const enteredDecimalsCount = getEnteredDecimalsCount(newValue, decimalSeparator);\n // don't reformat until user has entered all the allowed decimals\n // for example, we don't want 1.1 to be reformatted to 1.10 immediately\n if (enteredDecimalsCount < maxDecimalCount) {\n return false;\n }\n }\n\n return true;\n };\n\n const reformatValue = (newValue: string) => {\n const unformattedValue = getUnformattedNumber({\n value: newValue,\n currency,\n locale: intl.locale,\n });\n const formattedValue = unformattedValue\n ? getFormattedString({\n value: unformattedValue,\n currency,\n locale: intl.locale,\n })\n : '';\n return formattedValue;\n };\n\n const handleChange = (newValue: string) => {\n const oldCursorPosition = ref.current?.selectionStart ?? 0;\n\n const newFormattedString = shouldReformatAfterUserInput(newValue)\n ? reformatValue(newValue)\n : newValue;\n setValue(newFormattedString);\n\n const newNumber = getUnformattedNumber({\n value: newFormattedString,\n currency,\n locale: intl.locale,\n });\n\n if (newNumber !== numericValue) {\n if (numericValue || newNumber) {\n onChange(newNumber);\n }\n }\n\n const newCursorPosition = oldCursorPosition + (newFormattedString.length - newValue.length);\n requestAnimationFrame(() => {\n ref?.current?.setSelectionRange(newCursorPosition, newCursorPosition);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n\n const clipboardData = e.clipboardData?.getData('text/plain');\n if (!clipboardData) {\n return;\n }\n\n // need to sanitise the pasted value otherwise other validation logic will ignore the input entirely\n const sanitisedValue = reformatValue(clipboardData);\n\n handleChange(sanitisedValue);\n };\n\n const handleBlur = () => {\n setFocus(false);\n setValue(reformatValue(value));\n };\n\n const handleBackspace = (e: KeyboardEvent<HTMLInputElement>) => {\n const input = e.target as HTMLInputElement;\n // using the updated selection range after the backspace key has been processed, instead of the current selection range in state\n const { value: currentValue, selectionStart, selectionEnd } = input;\n\n if (selectionStart === selectionEnd && selectionStart && selectionStart > 0) {\n const charBeforeCursor = currentValue[selectionStart - 1];\n\n // if the user deletes a thousands separator, remove the digit before it as well\n if (charBeforeCursor === groupSeparator) {\n e.preventDefault();\n const beforeCursor = currentValue.slice(0, selectionStart - 2);\n const afterCursor = currentValue.slice(selectionStart);\n const newValue = `${beforeCursor}${afterCursor}`;\n input.setSelectionRange(beforeCursor.length, beforeCursor.length);\n handleChange(newValue);\n }\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n setFocus(true);\n if (!isAllowedInputKey(e)) {\n e.preventDefault();\n }\n\n if (e.key === 'Backspace') {\n handleBackspace(e);\n }\n };\n\n const isAllowedInput = (e: ChangeEvent<HTMLInputElement>) => {\n const hasMultipleDecimalSeparators =\n decimalSeparator && e.target.value.split(decimalSeparator).length > 2;\n if (hasMultipleDecimalSeparators) {\n return false;\n }\n\n const newNumericValue = getUnformattedNumber({\n value: e.target.value,\n currency,\n locale: intl.locale,\n });\n const maxLength = Number.MAX_SAFE_INTEGER.toString().length;\n if (String(newNumericValue).length > maxLength) {\n return false;\n }\n\n return true;\n };\n\n const addonContent = useMemo((): string | null | undefined => {\n // because we're using a separate \"addon\" element for the placeholder decimals, there is a possibility that the input itself will become scrollable\n // and the decimals will appear on top of the input. Safest thing to do is to just hide the addon if there is not enough room\n // eslint-disable-next-line react-hooks/refs -- Reading layout dimensions for overflow detection\n if (isInputPossiblyOverflowing({ ref, value })) {\n return null;\n }\n if (!decimalSeparator || !value) {\n return null;\n }\n\n // if the user has typed a decimal separator, show the full decimal part as a placeholder\n // this returns a string even if there is no content, typing should replace the placeholder immediately without animation\n // otherwise there is an ugly animation when going from 1.23 to 1.2 due to AnimatePresence\n if (focus && decimalMode) {\n // reuse getDecimalPart\n const fullDecimalPart = getDecimalPart(valueWithFullDecimals, decimalSeparator);\n // show only the characters that are not already displayed by the input\n return fullDecimalPart?.slice(decimalPart?.length);\n }\n\n // in unfocused state, always show the full decimal part unless the user has already entered decimals\n if (!focus && !decimalMode) {\n const [_, decimalPlaceholder] = placeholder.split(decimalSeparator);\n return decimalSeparator + decimalPlaceholder;\n }\n\n return null;\n }, [\n decimalMode,\n decimalPart?.length,\n decimalSeparator,\n focus,\n placeholder,\n value,\n valueWithFullDecimals,\n ]);\n\n const style = useInputStyle({\n // whenever decimals are shown, we need to account for the full decimal part for the font size calculation\n value: addonContent ? valueWithFullDecimals : value,\n focus: visualFocus,\n inputElement: ref,\n loading,\n });\n\n return (\n <div className=\"wds-amount-input-container\" dir=\"ltr\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large--forced')}\n style={style}\n >\n <input\n ref={ref}\n dir=\"auto\"\n className=\"wds-amount-input-input\"\n id={id}\n autoComplete=\"off\"\n inputMode=\"decimal\"\n value={value}\n type=\"text\"\n placeholder={placeholder}\n aria-describedby={describedById}\n /* without this, the input tries to keep an aspect ratio and doesn't respect CSS width rules */\n size={1}\n onChange={(e) => {\n if (isAllowedInput(e)) {\n handleChange(e.target.value);\n }\n }}\n onBlurCapture={() => handleBlur()}\n onPaste={(e) => handlePaste(e)}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => {\n setTimeout(() => setVisualFocus(false), 30);\n }}\n onKeyDown={(e) => handleKeyDown(e)}\n />\n <AnimatePresence initial={false}>\n {addonContent !== null && (\n <AnimatedNumber\n className={clsx(\n 'wds-amount-input-placeholder',\n visualFocus && 'wds-amount-input-placeholder-focus',\n )}\n onClick={() => ref.current?.focus()}\n >\n {addonContent}\n </AnimatedNumber>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n};\n\nconst getPlaceholder = (currency: string, locale: string) => {\n return formatAmount(0, currency, locale, { alwaysShowDecimals: true });\n};\n\nconst getDecimalPart = (value: string, decimalSeparator: string | null) => {\n if (!value || !decimalSeparator) {\n return undefined;\n }\n\n const [_, decimalPart] = value.split(decimalSeparator);\n return decimalPart ?? undefined;\n};\n"],"names":["AmountInput","id","describedById","amount","currency","autoFocus","onChange","onFocusChange","loading","intl","useIntl","focus","setFocus","visualFocus","setVisualFocus","useFocus","value","setValue","useState","getFormattedString","locale","prevAmountRef","useRef","numericValue","useMemo","getUnformattedNumber","valueWithFullDecimals","alwaysShowDecimals","ref","useEffect","current","placeholder","getPlaceholder","groupSeparator","getGroupSeparator","decimalSeparator","getDecimalSeparator","maxDecimalCount","getDecimalCount","decimalPart","getDecimalPart","decimalMode","includes","shouldReformatAfterUserInput","newValue","reformatValue","endsWithDecimalSeparator","endsWith","endsWithGroupSeparator","containsDecimalSeparator","enteredDecimalsCount","getEnteredDecimalsCount","unformattedValue","formattedValue","handleChange","oldCursorPosition","selectionStart","newFormattedString","newNumber","newCursorPosition","length","requestAnimationFrame","setSelectionRange","handlePaste","e","preventDefault","clipboardData","getData","sanitisedValue","handleBlur","handleBackspace","input","target","currentValue","selectionEnd","charBeforeCursor","beforeCursor","slice","afterCursor","handleKeyDown","isAllowedInputKey","key","isAllowedInput","hasMultipleDecimalSeparators","split","newNumericValue","maxLength","Number","MAX_SAFE_INTEGER","toString","String","addonContent","isInputPossiblyOverflowing","fullDecimalPart","_","decimalPlaceholder","style","useInputStyle","inputElement","_jsx","className","dir","children","_jsxs","clsx","autoComplete","inputMode","type","size","onBlurCapture","onPaste","onFocus","onBlur","setTimeout","onKeyDown","AnimatePresence","initial","AnimatedNumber","onClick","formatAmount","undefined"],"mappings":";;;;;;;;;;;AA+BO,MAAMA,WAAW,GAAGA,CAAC;EAC1BC,EAAE;EACFC,aAAa;EACbC,MAAM;EACNC,QAAQ;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oG,MAAM,EAAEA,MAAK;UACXC,UAAU,CAAC,MAAMnG,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;QAC7C,CAAE;AACFoG,QAAAA,SAAS,EAAGlD,CAAC,IAAKe,aAAa,CAACf,CAAC;AAAE,OAAA,CAErC,eAAAmC,GAAA,CAACgB,eAAe,EAAA;AAACC,QAAAA,OAAO,EAAE,KAAM;AAAAd,QAAAA,QAAA,EAC7BX,YAAY,KAAK,IAAI,iBACpBQ,GAAA,CAACkB,cAAc,EAAA;UACbjB,SAAS,EAAEI,IAAI,CACb,8BAA8B,EAC9B3F,WAAW,IAAI,oCAAoC,CACnD;UACFyG,OAAO,EAAEA,MAAM1F,GAAG,CAACE,OAAO,EAAEnB,KAAK,EAAG;AAAA2F,UAAAA,QAAA,EAEnCX;SACa;AACjB,OACc,CACnB;KAAK;AACP,GAAK,CAAC;AAEV;AAEA,MAAM3D,cAAc,GAAGA,CAAC5B,QAAgB,EAAEgB,MAAc,KAAI;AAC1D,EAAA,OAAOmG,YAAY,CAAC,CAAC,EAAEnH,QAAQ,EAAEgB,MAAM,EAAE;AAAEO,IAAAA,kBAAkB,EAAE;AAAI,GAAE,CAAC;AACxE,CAAC;AAED,MAAMa,cAAc,GAAGA,CAACxB,KAAa,EAAEmB,gBAA+B,KAAI;AACxE,EAAA,IAAI,CAACnB,KAAK,IAAI,CAACmB,gBAAgB,EAAE;AAC/B,IAAA,OAAOqF,SAAS;AAClB,EAAA;EAEA,MAAM,CAAC1B,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIiF,SAAS;AACjC,CAAC;;;;"}
1
+ {"version":3,"file":"AmountInput.mjs","sources":["../../../src/ExpressiveMoneyInput/AmountInput/AmountInput.tsx"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport { clsx } from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport type { ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { AnimatedNumber } from '../AnimatedNumber/AnimatedNumber';\nimport { useFocus } from '../hooks/useFocus';\nimport { useInputStyle } from '../hooks/useInputStyle';\nimport {\n getDecimalCount,\n getDecimalSeparator,\n getEnteredDecimalsCount,\n getFormattedString,\n getGroupSeparator,\n getUnformattedNumber,\n isAllowedInputKey,\n isInputPossiblyOverflowing,\n} from './utils';\n\ntype AmountInputProps = {\n id: string;\n describedById?: string;\n amount?: number | null;\n currency: string;\n autoFocus?: boolean;\n onChange: (amount: number | null) => void;\n onFocusChange?: (focused: boolean) => void;\n} & Pick<ExpressiveMoneyInputProps, 'loading'>;\n\nexport const AmountInput = ({\n id,\n describedById,\n amount,\n currency,\n autoFocus,\n onChange,\n onFocusChange,\n loading,\n}: AmountInputProps) => {\n const intl = useIntl();\n const { focus, setFocus, visualFocus, setVisualFocus } = useFocus();\n\n const [value, setValue] = useState<string>(() =>\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n const prevAmountRef = useRef<string | number | null | undefined>(amount);\n const numericValue = useMemo(() => {\n return getUnformattedNumber({\n value,\n currency,\n locale: intl.locale,\n });\n }, [value, currency, intl.locale]);\n\n const valueWithFullDecimals = useMemo(() => {\n return getFormattedString({\n value: numericValue ?? 0,\n currency,\n locale: intl.locale,\n alwaysShowDecimals: true,\n });\n }, [numericValue, currency, intl.locale]);\n\n const ref = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (autoFocus) {\n ref.current?.focus();\n }\n }, []);\n\n const placeholder = getPlaceholder(currency, intl.locale);\n const groupSeparator = getGroupSeparator(currency, intl.locale);\n const decimalSeparator = getDecimalSeparator(currency, intl.locale);\n const maxDecimalCount = getDecimalCount(currency, intl.locale);\n\n const decimalPart = getDecimalPart(value, decimalSeparator);\n const decimalMode = decimalSeparator && value.includes(decimalSeparator);\n\n useEffect(() => {\n if (prevAmountRef.current !== amount) {\n prevAmountRef.current = amount;\n\n // Only update the displayed value if not focused (preserve user input when focused)\n if (!focus) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- Syncing external prop to internal state when unfocused\n setValue(\n amount\n ? getFormattedString({\n value: amount,\n currency,\n locale: intl.locale,\n })\n : '',\n );\n }\n }\n }, [amount, focus, currency, intl.locale]);\n\n useEffect(() => {\n onFocusChange?.(visualFocus);\n }, [onFocusChange, visualFocus]);\n\n const shouldReformatAfterUserInput = (newValue: string) => {\n // don't reformat if formatting would wipe out user's input\n if (reformatValue(newValue) === '') {\n return false;\n }\n\n const endsWithDecimalSeparator = decimalSeparator && newValue.endsWith(decimalSeparator);\n const endsWithGroupSeparator = groupSeparator && newValue.endsWith(groupSeparator);\n\n // if the user has entered a seperator to the end, formatting would delete it\n if (endsWithDecimalSeparator || endsWithGroupSeparator) {\n return false;\n }\n\n const containsDecimalSeparator = decimalSeparator && newValue.includes(decimalSeparator);\n\n if (containsDecimalSeparator) {\n const enteredDecimalsCount = getEnteredDecimalsCount(newValue, decimalSeparator);\n // don't reformat until user has entered all the allowed decimals\n // for example, we don't want 1.1 to be reformatted to 1.10 immediately\n if (enteredDecimalsCount < maxDecimalCount) {\n return false;\n }\n }\n\n return true;\n };\n\n const reformatValue = (newValue: string) => {\n const unformattedValue = getUnformattedNumber({\n value: newValue,\n currency,\n locale: intl.locale,\n });\n const formattedValue = unformattedValue\n ? getFormattedString({\n value: unformattedValue,\n currency,\n locale: intl.locale,\n })\n : '';\n return formattedValue;\n };\n\n const handleChange = (newValue: string) => {\n const oldCursorPosition = ref.current?.selectionStart ?? 0;\n\n const newFormattedString = shouldReformatAfterUserInput(newValue)\n ? reformatValue(newValue)\n : newValue;\n setValue(newFormattedString);\n\n const newNumber = getUnformattedNumber({\n value: newFormattedString,\n currency,\n locale: intl.locale,\n });\n\n if (newNumber !== numericValue) {\n if (numericValue || newNumber) {\n onChange(newNumber);\n }\n }\n\n const newCursorPosition = oldCursorPosition + (newFormattedString.length - newValue.length);\n requestAnimationFrame(() => {\n ref?.current?.setSelectionRange(newCursorPosition, newCursorPosition);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n\n const clipboardData = e.clipboardData?.getData('text/plain');\n if (!clipboardData) {\n return;\n }\n\n // need to sanitise the pasted value otherwise other validation logic will ignore the input entirely\n const sanitisedValue = reformatValue(clipboardData);\n\n handleChange(sanitisedValue);\n };\n\n const handleBlur = () => {\n setFocus(false);\n setValue(reformatValue(value));\n };\n\n const handleBackspace = (e: KeyboardEvent<HTMLInputElement>) => {\n const input = e.target as HTMLInputElement;\n // using the updated selection range after the backspace key has been processed, instead of the current selection range in state\n const { value: currentValue, selectionStart, selectionEnd } = input;\n\n if (selectionStart === selectionEnd && selectionStart && selectionStart > 0) {\n const charBeforeCursor = currentValue[selectionStart - 1];\n\n // if the user deletes a thousands separator, remove the digit before it as well\n if (charBeforeCursor === groupSeparator) {\n e.preventDefault();\n const beforeCursor = currentValue.slice(0, selectionStart - 2);\n const afterCursor = currentValue.slice(selectionStart);\n const newValue = `${beforeCursor}${afterCursor}`;\n input.setSelectionRange(beforeCursor.length, beforeCursor.length);\n handleChange(newValue);\n }\n }\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n setFocus(true);\n if (!isAllowedInputKey(e)) {\n e.preventDefault();\n }\n\n if (e.key === 'Backspace') {\n handleBackspace(e);\n }\n };\n\n const isAllowedInput = (e: ChangeEvent<HTMLInputElement>) => {\n const hasMultipleDecimalSeparators =\n decimalSeparator && e.target.value.split(decimalSeparator).length > 2;\n if (hasMultipleDecimalSeparators) {\n return false;\n }\n\n const newNumericValue = getUnformattedNumber({\n value: e.target.value,\n currency,\n locale: intl.locale,\n });\n const maxLength = Number.MAX_SAFE_INTEGER.toString().length;\n if (String(newNumericValue).length > maxLength) {\n return false;\n }\n\n return true;\n };\n\n const addonContent = useMemo((): string | null | undefined => {\n // because we're using a separate \"addon\" element for the placeholder decimals, there is a possibility that the input itself will become scrollable\n // and the decimals will appear on top of the input. Safest thing to do is to just hide the addon if there is not enough room\n // eslint-disable-next-line react-hooks/refs -- Reading layout dimensions for overflow detection\n if (isInputPossiblyOverflowing({ ref, value })) {\n return null;\n }\n if (!decimalSeparator || !value) {\n return null;\n }\n\n // if the user has typed a decimal separator, show the full decimal part as a placeholder\n // this returns a string even if there is no content, typing should replace the placeholder immediately without animation\n // otherwise there is an ugly animation when going from 1.23 to 1.2 due to AnimatePresence\n if (focus && decimalMode) {\n // reuse getDecimalPart\n const fullDecimalPart = getDecimalPart(valueWithFullDecimals, decimalSeparator);\n // show only the characters that are not already displayed by the input\n return fullDecimalPart?.slice(decimalPart?.length);\n }\n\n // in unfocused state, always show the full decimal part unless the user has already entered decimals\n if (!focus && !decimalMode) {\n const [_, decimalPlaceholder] = placeholder.split(decimalSeparator);\n return decimalSeparator + decimalPlaceholder;\n }\n\n return null;\n }, [\n decimalMode,\n decimalPart?.length,\n decimalSeparator,\n focus,\n placeholder,\n value,\n valueWithFullDecimals,\n ]);\n\n const style = useInputStyle({\n // whenever decimals are shown, we need to account for the full decimal part for the font size calculation\n value: addonContent ? valueWithFullDecimals : value,\n focus: visualFocus,\n inputElement: ref,\n loading,\n });\n\n return (\n <div className=\"wds-amount-input-container\" dir=\"ltr\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large--forced')}\n style={style}\n >\n <input\n ref={ref}\n dir=\"auto\"\n className=\"wds-amount-input-input\"\n id={id}\n autoComplete=\"off\"\n inputMode=\"decimal\"\n value={value}\n type=\"text\"\n placeholder={placeholder}\n aria-describedby={describedById}\n /* without this, the input tries to keep an aspect ratio and doesn't respect CSS width rules */\n size={1}\n onChange={(e) => {\n if (isAllowedInput(e)) {\n handleChange(e.target.value);\n }\n }}\n onBlurCapture={() => handleBlur()}\n onPaste={(e) => handlePaste(e)}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => {\n setTimeout(() => setVisualFocus(false), 30);\n }}\n onKeyDown={(e) => handleKeyDown(e)}\n />\n <AnimatePresence initial={false}>\n {addonContent !== null && (\n <AnimatedNumber\n className={clsx(\n 'wds-amount-input-placeholder',\n visualFocus && 'wds-amount-input-placeholder-focus',\n )}\n onClick={() => ref.current?.focus()}\n >\n {addonContent}\n </AnimatedNumber>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n};\n\nconst getPlaceholder = (currency: string, locale: string) => {\n return formatAmount(0, currency, locale, { alwaysShowDecimals: true });\n};\n\nconst getDecimalPart = (value: string, decimalSeparator: string | null) => {\n if (!value || !decimalSeparator) {\n return undefined;\n }\n\n const [_, decimalPart] = value.split(decimalSeparator);\n return decimalPart ?? undefined;\n};\n"],"names":["AmountInput","id","describedById","amount","currency","autoFocus","onChange","onFocusChange","loading","intl","useIntl","focus","setFocus","visualFocus","setVisualFocus","useFocus","value","setValue","useState","getFormattedString","locale","prevAmountRef","useRef","numericValue","useMemo","getUnformattedNumber","valueWithFullDecimals","alwaysShowDecimals","ref","useEffect","current","placeholder","getPlaceholder","groupSeparator","getGroupSeparator","decimalSeparator","getDecimalSeparator","maxDecimalCount","getDecimalCount","decimalPart","getDecimalPart","decimalMode","includes","shouldReformatAfterUserInput","newValue","reformatValue","endsWithDecimalSeparator","endsWith","endsWithGroupSeparator","containsDecimalSeparator","enteredDecimalsCount","getEnteredDecimalsCount","unformattedValue","formattedValue","handleChange","oldCursorPosition","selectionStart","newFormattedString","newNumber","newCursorPosition","length","requestAnimationFrame","setSelectionRange","handlePaste","e","preventDefault","clipboardData","getData","sanitisedValue","handleBlur","handleBackspace","input","target","currentValue","selectionEnd","charBeforeCursor","beforeCursor","slice","afterCursor","handleKeyDown","isAllowedInputKey","key","isAllowedInput","hasMultipleDecimalSeparators","split","newNumericValue","maxLength","Number","MAX_SAFE_INTEGER","toString","String","addonContent","isInputPossiblyOverflowing","fullDecimalPart","_","decimalPlaceholder","style","useInputStyle","inputElement","_jsx","className","dir","children","_jsxs","clsx","autoComplete","inputMode","type","size","onBlurCapture","onPaste","onFocus","onBlur","setTimeout","onKeyDown","AnimatePresence","initial","AnimatedNumber","onClick","formatAmount","undefined"],"mappings":";;;;;;;;;;;AA+BO,MAAMA,WAAW,GAAGA,CAAC;EAC1BC,EAAE;EACFC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,aAAa;AACbC,EAAAA;AAAO,CACU,KAAI;AACrB,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,WAAW;AAAEC,IAAAA;GAAgB,GAAGC,QAAQ,EAAE;AAEnE,EAAA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAS,MACzCf,MAAM,GACFgB,kBAAkB,CAAC;AACjBH,IAAAA,KAAK,EAAEb,MAAM;IACbC,QAAQ;IACRgB,MAAM,EAAEX,IAAI,CAACW;GACd,CAAC,GACF,EAAE,CACP;AACD,EAAA,MAAMC,aAAa,GAAGC,MAAM,CAAqCnB,MAAM,CAAC;AACxE,EAAA,MAAMoB,YAAY,GAAGC,OAAO,CAAC,MAAK;AAChC,IAAA,OAAOC,oBAAoB,CAAC;MAC1BT,KAAK;MACLZ,QAAQ;MACRgB,MAAM,EAAEX,IAAI,CAACW;AACd,KAAA,CAAC;EACJ,CAAC,EAAE,CAACJ,KAAK,EAAEZ,QAAQ,EAAEK,IAAI,CAACW,MAAM,CAAC,CAAC;AAElC,EAAA,MAAMM,qBAAqB,GAAGF,OAAO,CAAC,MAAK;AACzC,IAAA,OAAOL,kBAAkB,CAAC;MACxBH,KAAK,EAAEO,YAAY,IAAI,CAAC;MACxBnB,QAAQ;MACRgB,MAAM,EAAEX,IAAI,CAACW,MAAM;AACnBO,MAAAA,kBAAkB,EAAE;AACrB,KAAA,CAAC;EACJ,CAAC,EAAE,CAACJ,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E,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIiF,SAAS;AACjC,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/ExpressiveMoneyInput/AmountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","is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BAAyB,GAAGb,MAAM,CAACC,UAAU,CAAC,CAAA,EAAGO,WAAW,CAAA,CAAA,EAAIG,oBAAoB,CAAA,CAAE,CAAC;AAE7F,EAAA,OAAO5B,uBAAY,CAAC8B,yBAAyB,EAAEhC,QAAQ,EAAEC,MAAM,EAAE;AAC/DsB,IAAAA;AACD,GAAA,CAAC;AACJ;AAEO,MAAMU,0BAA0B,GAAGA,CAAC;EACzCC,GAAG;AACHvB,EAAAA;AAAK,CAIN,KAAI;AACH,EAAA,MAAMwB,UAAU,GAAGxB,KAAK,CAACF,MAAM;AAC/B,EAAA,MAAM2B,UAAU,GAAGF,GAAG,CAACG,OAAO,EAAEC,WAAW;AAC3C,EAAA,IAAI,CAACF,UAAU,IAAI,CAACD,UAAU,EAAE;AAC9B,IAAA;AACF,EAAA;EAEA,MAAMI,4BAA4B,GAAGC,IAAI,CAACC,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC;EAChE,OAAOD,UAAU,GAAGI,4BAA4B;AAClD;AAEA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;AAEK,MAAMC,iBAAiB,GAAIC,CAAkC,IAAI;EACtE,MAAM;IAAEC,OAAO;IAAEC,GAAG;AAAEC,IAAAA;AAAO,GAAE,GAAGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/ExpressiveMoneyInput/AmountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","isAllowedInputKey","e","metaKey","key","ctrlKey","isNumberKey","isNaN","parseInt","has"],"mappings":";;;;MAGaA,mBAAmB,GAAGA,CAACC,QAAgB,EAAEC,MAAc,KAAmB;AACrF,EAAA,OAAOC,uBAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CA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AAA;AACD,GAAA,CAAC;AACJ;AAEO,MAAMU,0BAA0B,GAAGA,CAAC;EACzCC,GAAG;AACHvB,EAAAA;AAAK,CAIN,KAAI;AACH,EAAA,MAAMwB,UAAU,GAAGxB,KAAK,CAACF,MAAM;AAC/B,EAAA,MAAM2B,UAAU,GAAGF,GAAG,CAACG,OAAO,EAAEC,WAAW;AAC3C,EAAA,IAAI,CAACF,UAAU,IAAI,CAACD,UAAU,EAAE;AAC9B,IAAA;AACF,EAAA;EAEA,MAAMI,4BAA4B,GAAGC,IAAI,CAACC,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC;EAChE,OAAOD,UAAU,GAAGI,4BAA4B;AAClD;AAEA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;AAEK,MAAMC,iBAAiB,GAAIC,CAAkC,IAAI;EACtE,MAAM;IAAEC,OAAO;IAAEC,GAAG;AAAEC,IAAAA;AAAO,GAAE,GAAGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../src/ExpressiveMoneyInput/AmountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","isAllowedInputKey","e","metaKey","key","ctrlKey","isNumberKey","isNaN","parseInt","has"],"mappings":";;MAGaA,mBAAmB,GAAGA,CAACC,QAAgB,EAAEC,MAAc,KAAmB;AACrF,EAAA,OAAOC,YAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;AACxE;MAEaC,iBAAiB,GAAGA,CAACJ,QAAgB,EAAEC,MAAc,KAAmB;AACnF,EAAA,OAAOC,YAAY,CAAC,QAAQ,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO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AGF,GAAG,CAACG,OAAO,EAAEC,WAAW;AAC3C,EAAA,IAAI,CAACF,UAAU,IAAI,CAACD,UAAU,EAAE;AAC9B,IAAA;AACF,EAAA;EAEA,MAAMI,4BAA4B,GAAGC,IAAI,CAACC,KAAK,CAACL,UAAU,GAAG,EAAE,CAAC;EAChE,OAAOD,UAAU,GAAGI,4BAA4B;AAClD;AAEA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;AAEK,MAAMC,iBAAiB,GAAIC,CAAkC,IAAI;EACtE,MAAM;IAAEC,OAAO;IAAEC,GAAG;AAAEC,IAAAA;AAAO,GAAE,GAAGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../src/ExpressiveMoneyInput/AmountInput/utils.ts"],"sourcesContent":["import { formatAmount } from '@transferwise/formatting';\nimport type { KeyboardEvent } from 'react';\n\nexport const getDecimalSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(1.1, currency, locale).replace(/\\p{Number}/gu, '');\n};\n\nexport const getGroupSeparator = (currency: string, locale: string): string | null => {\n return formatAmount(10000000, currency, locale).replace(/\\p{Number}/gu, '')[0];\n};\n\nexport const getDecimalCount = (currency: string, locale: string): number => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!decimalSeparator) {\n return 0;\n }\n const parts = formatAmount(1.1, currency, locale).split(decimalSeparator);\n return parts.length === 2 ? parts[1].length : 0;\n};\n\nexport const getEnteredDecimalsCount = (value: string, decimalSeparator: string) => {\n return value.split(decimalSeparator)[1]?.length ?? 0;\n};\n\nexport const getUnformattedNumber = ({\n value: formattedValue,\n currency,\n locale,\n}: {\n value: string;\n currency: string;\n locale: string;\n}): number | null => {\n const groupSeparator = getGroupSeparator(currency, locale);\n const decimalSeparator = getDecimalSeparator(currency, locale);\n if (!formattedValue) {\n return null;\n }\n\n // parseFloat can't handle thousands separators\n const withoutGroupSeparator = groupSeparator\n ? formattedValue.replace(/ /gu, '').replace(new RegExp(`\\\\${groupSeparator}`, 'g'), '')\n : formattedValue;\n\n // parseFloat can only handle . as decimal separator\n const withNormalisedDecimalSeparator = decimalSeparator\n ? withoutGroupSeparator.replace(decimalSeparator, '.')\n : withoutGroupSeparator;\n\n const parsedValue = Number.parseFloat(withNormalisedDecimalSeparator);\n return parsedValue;\n};\n\nexport const getFormattedString = ({\n value: unformattedValue,\n currency,\n locale,\n alwaysShowDecimals = false,\n}: {\n value: number;\n currency: string;\n locale: string;\n alwaysShowDecimals?: boolean;\n}): string => {\n const decimalSeparator = getDecimalSeparator(currency, locale);\n // formatAmount rounds extra decimals, so 1.999 will become 2. Instead we will manually strip extra decimals so that it becomes 1.99 after formatting\n const decimalCount = getDecimalCount(currency, locale);\n const unformattedString = unformattedValue.toString();\n\n const [integerPart, decimalPart] = decimalSeparator\n ? unformattedString.split(decimalSeparator)\n : [unformattedString, undefined];\n\n const formattedDecimalPart = decimalPart ? decimalPart.slice(0, decimalCount) : '';\n\n const sanitisedUnformattedValue = Number.parseFloat(`${integerPart}.${formattedDecimalPart}`);\n\n return formatAmount(sanitisedUnformattedValue, currency, locale, {\n alwaysShowDecimals,\n });\n};\n\nexport const isInputPossiblyOverflowing = ({\n ref,\n value,\n}: {\n ref: React.RefObject<HTMLInputElement>;\n value: string;\n}) => {\n const textLength = value.length;\n const inputWidth = ref.current?.clientWidth;\n if (!inputWidth || !textLength) {\n return;\n }\n\n const maxCharactersWithoutOverflow = Math.floor(inputWidth / 19);\n return textLength > maxCharactersWithoutOverflow;\n};\n\nconst allowedInputKeys = new Set([\n 'Backspace',\n 'Delete',\n ',',\n '.',\n 'ArrowLeft',\n 'ArrowRight',\n 'Enter',\n 'Tab',\n]);\n\nexport const isAllowedInputKey = (e: KeyboardEvent<HTMLInputElement>) => {\n const { metaKey, key, ctrlKey } = e;\n const isNumberKey = !Number.isNaN(Number.parseInt(key, 10));\n\n return isNumberKey || metaKey || ctrlKey || allowedInputKeys.has(key);\n};\n"],"names":["getDecimalSeparator","currency","locale","formatAmount","replace","getGroupSeparator","getDecimalCount","decimalSeparator","parts","split","length","getEnteredDecimalsCount","value","getUnformattedNumber","formattedValue","groupSeparator","withoutGroupSeparator","RegExp","withNormalisedDecimalSeparator","parsedValue","Number","parseFloat","getFormattedString","unformattedValue","alwaysShowDecimals","decimalCount","unformattedString","toString","integerPart","decimalPart","undefined","formattedDecimalPart","slice","sanitisedUnformattedValue","isInputPossiblyOverflowing","ref","textLength","inputWidth","current","clientWidth","maxCharactersWithoutOverflow","Math","floor","allowedInputKeys","Set","isAllowedInputKey","e","metaKey","key","ctrlKey","isNumberKey","isNaN","parseInt","has"],"mappings":";;MAGaA,mBAAmB,GAAGA,CAACC,QAAgB,EAAEC,MAAc,KAAmB;AACrF,EAAA,OAAOC,YAAY,CAAC,GAAG,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;AACxE;MAEaC,iBAAiB,GAAGA,CAACJ,QAAgB,EAAEC,MAAc,KAAmB;AACnF,EAAA,OAAOC,YAAY,CAAC,QAAQ,EAAEF,QAAQ,EAAEC,MAAM,CAAC,CAACE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF;MAEaE,eAAe,GAAGA,CAACL,QAAgB,EAAEC,MAAc,KAAY;AAC1E,EAAA,MAAMK,gBAAgB,GAAGP,mBAAmB,CAACC,QAAQ,EAAEC,MAAM,CAAC;EAC9D,IAAI,CAACK,gBAA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U,GAAGI,4BAA4B;AAClD;AAEA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,WAAW,EACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;AAEK,MAAMC,iBAAiB,GAAIC,CAAkC,IAAI;EACtE,MAAM;IAAEC,OAAO;IAAEC,GAAG;AAAEC,IAAAA;AAAO,GAAE,GAAGH,CAAC;AACnC,EAAA,MAAMI,WAAW,GAAG,CAAC9B,MAAM,CAAC+B,KAAK,CAAC/B,MAAM,CAACgC,QAAQ,CAACJ,GAAG,EAAE,EAAE,CAAC,CAAC;EAE3D,OAAOE,WAAW,IAAIH,OAAO,IAAIE,OAAO,IAAIN,gBAAgB,CAACU,GAAG,CAACL,GAAG,CAAC;AACvE;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedNumber.js","sources":["../../../src/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","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3,"file":"AnimatedNumber.js","sources":["../../../src/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","duration","type","ease","opacity","times"],"mappings":";;;;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA;AAAS,CAAS,KAAI;AACxE,EAAA,MAAMC,aAAa,GAAGC,sBAAgB,EAAE;AAExC,EAAA,oBACEC,cAAA,CAACC,YAAM,CAACC,IAAI,EAAA;AACVL,IAAAA,SAAS,EAAEA,SAAU;IACrB,aAAA,EAAA,IAAW;AACXM,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE;KAAO;AACxBC,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE;KAAI;AACrBE,IAAAA,IAAI,EAAE;AAAEF,MAAAA,IAAI,EAAE;KAAO;AACrBG,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCW,MAAAA,IAAI,EAAE,OAAO;MACbC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB;AACFd,IAAAA,OAAO,EAAEA,MAAMA,OAAO,IAAK;AAAAD,IAAAA,QAAA,eAE3BK,cAAA,CAACC,YAAM,CAACC,IAAI,EAAA;AACVC,MAAAA,OAAO,EAAE;AAAEQ,QAAAA,OAAO,EAAE;OAAI;AACxBN,MAAAA,OAAO,EAAE;AAAEM,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAChCL,MAAAA,IAAI,EAAE;AAAEK,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAC7BJ,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCc,QAAAA,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;OACjB;AAAAjB,MAAAA,QAAA,EAEDA;KACU;AACf,GAAa,CAAC;AAElB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedNumber.mjs","sources":["../../../src/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","duration","type","ease","opacity","times"],"mappings":";;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA;AAAS,CAAS,KAAI;AACxE,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;AAExC,EAAA,oBACEC,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVL,IAAAA,SAAS,EAAEA,SAAU;IACrB,aAAA,EAAA,IAAW;AACXM,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE;KAAO;AACxBC,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE;KAAI;AACrBE,IAAAA,IAAI,EAAE;AAAEF,MAAAA,IAAI,EAAE;KAAO;AACrBG,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCW,MAAAA,IAAI,EAAE,OAAO;MACbC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB;AACFd,IAAAA,OAAO,EAAEA,MAAMA,OAAO,IAAK;AAAAD,IAAAA,QAAA,eAE3BK,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVC,MAAAA,OAAO,EAAE;AAAEQ,QAAAA,OAAO,EAAE;OAAI;AACxBN,MAAAA,OAAO,EAAE;AAAEM,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAChCL,MAAAA,IAAI,EAAE;AAAEK,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAC7BJ,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCc,QAAAA,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;OACjB;AAAAjB,MAAAA,QAAA,EAEDA;KACU;AACf,GAAa,CAAC;AAElB;;;;"}
1
+ {"version":3,"file":"AnimatedNumber.mjs","sources":["../../../src/ExpressiveMoneyInput/AnimatedNumber/AnimatedNumber.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n children: ReactNode;\n onClick?: () => void;\n className?: string;\n}\n\nexport const AnimatedNumber = ({ children, onClick, className }: Props) => {\n const reducedMotion = useReducedMotion();\n\n return (\n <motion.span\n className={className}\n aria-hidden\n initial={{ zoom: 0.01 }}\n animate={{ zoom: 1 }}\n exit={{ zoom: 0.01 }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n type: 'tween',\n ease: [0.3, 0, 0.1, 1],\n }}\n onClick={() => onClick?.()}\n >\n <motion.span\n initial={{ opacity: 0 }}\n animate={{ opacity: [0, 0, 1] }}\n exit={{ opacity: [1, 0, 0] }}\n transition={{\n duration: reducedMotion ? 0 : 0.3,\n times: [0, 0.5, 1],\n }}\n >\n {children}\n </motion.span>\n </motion.span>\n );\n};\n"],"names":["AnimatedNumber","children","onClick","className","reducedMotion","useReducedMotion","_jsx","motion","span","initial","zoom","animate","exit","transition","duration","type","ease","opacity","times"],"mappings":";;;AASO,MAAMA,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;AAAEC,EAAAA;AAAS,CAAS,KAAI;AACxE,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;AAExC,EAAA,oBACEC,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVL,IAAAA,SAAS,EAAEA,SAAU;IACrB,aAAA,EAAA,IAAW;AACXM,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE;KAAO;AACxBC,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE;KAAI;AACrBE,IAAAA,IAAI,EAAE;AAAEF,MAAAA,IAAI,EAAE;KAAO;AACrBG,IAAAA,UAAU,EAAE;AACVC,MAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCW,MAAAA,IAAI,EAAE,OAAO;MACbC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB;AACFd,IAAAA,OAAO,EAAEA,MAAMA,OAAO,IAAK;AAAAD,IAAAA,QAAA,eAE3BK,GAAA,CAACC,MAAM,CAACC,IAAI,EAAA;AACVC,MAAAA,OAAO,EAAE;AAAEQ,QAAAA,OAAO,EAAE;OAAI;AACxBN,MAAAA,OAAO,EAAE;AAAEM,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAChCL,MAAAA,IAAI,EAAE;AAAEK,QAAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;OAAI;AAC7BJ,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAEV,aAAa,GAAG,CAAC,GAAG,GAAG;AACjCc,QAAAA,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;OACjB;AAAAjB,MAAAA,QAAA,EAEDA;KACU;AACf,GAAa,CAAC;AAElB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chevron.js","sources":["../../../src/ExpressiveMoneyInput/Chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'motion/react';\n\nimport { useDirection } from '../../common/hooks';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n const { isRTL } = useDirection();\n const Icon = isRTL ? ChevronRight : ChevronLeft;\n\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: isRTL ? [-12, 0, 0, 12] : [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <Icon />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","isRTL","useDirection","Icon","ChevronRight","ChevronLeft","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType"],"mappings":";;;;;;;;;;;AAUO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;EACtD,MAAM;AAAEC,IAAAA;GAAO,GAAGC,yBAAY,EAAE;AAChC,EAAA,MAAMC,IAAI,GAAGF,KAAK,GAAGG,kBAAY,GAAGC,iBAAW;AAE/C,EAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,SAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACR,UAAU,IAAI,oBAAoB,CACnC;AAAAS,IAAAA,QAAA,eAEFH,cAAA,CAACI,YAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAEZ,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAC5Ca,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,cAAA,CAACH,IAAI,EAAA,EAAA;KACK;AACd,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"Chevron.js","sources":["../../../src/ExpressiveMoneyInput/Chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'motion/react';\n\nimport { useDirection } from '../../common/hooks';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n const { isRTL } = useDirection();\n const Icon = isRTL ? ChevronRight : ChevronLeft;\n\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: isRTL ? [-12, 0, 0, 12] : [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <Icon />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","isRTL","useDirection","Icon","ChevronRight","ChevronLeft","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType"],"mappings":";;;;;;;;;;;AAUO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;EACtD,MAAM;AAAEC,IAAAA;GAAO,GAAGC,yBAAY,EAAE;AAChC,EAAA,MAAMC,IAAI,GAAGF,KAAK,GAAGG,kBAAY,GAAGC,iBAAW;AAE/C,EAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,SAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACR,UAAU,IAAI,oBAAoB,CACnC;AAAAS,IAAAA,QAAA,eAEFH,cAAA,CAACI,YAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAEZ,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAC5Ca,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,cAAA,CAACH,IAAI,EAAA,EAAA;KACK;AACd,GAAK,CAAC;AAEV;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chevron.mjs","sources":["../../../src/ExpressiveMoneyInput/Chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'motion/react';\n\nimport { useDirection } from '../../common/hooks';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n const { isRTL } = useDirection();\n const Icon = isRTL ? ChevronRight : ChevronLeft;\n\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: isRTL ? [-12, 0, 0, 12] : [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <Icon />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","isRTL","useDirection","Icon","ChevronRight","ChevronLeft","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType"],"mappings":";;;;;;;;;AAUO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;EACtD,MAAM;AAAEC,IAAAA;GAAO,GAAGC,YAAY,EAAE;AAChC,EAAA,MAAMC,IAAI,GAAGF,KAAK,GAAGG,YAAY,GAAGC,WAAW;AAE/C,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,IAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACR,UAAU,IAAI,oBAAoB,CACnC;AAAAS,IAAAA,QAAA,eAEFH,GAAA,CAACI,MAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAEZ,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAC5Ca,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,GAAA,CAACH,IAAI,EAAA,EAAA;KACK;AACd,GAAK,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"Chevron.mjs","sources":["../../../src/ExpressiveMoneyInput/Chevron/Chevron.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { motion } from 'motion/react';\n\nimport { useDirection } from '../../common/hooks';\n\ninterface Props {\n shouldShow: boolean;\n}\n\nexport const Chevron = ({ shouldShow = true }: Props) => {\n const { isRTL } = useDirection();\n const Icon = isRTL ? ChevronRight : ChevronLeft;\n\n return (\n <div\n className={clsx(\n 'd-flex align-items-center',\n 'wds-chevron-container',\n !shouldShow && 'wds-chevron-hidden',\n )}\n >\n <motion.div\n animate={{\n x: isRTL ? [-12, 0, 0, 12] : [12, 0, 0, -12],\n opacity: [0, 1, 1, 0],\n }}\n transition={{\n duration: 3,\n ease: [[0.3, 0, 0.1, 1], 'linear', [0.3, 0, 0.1, 1]],\n times: [0, 0.1, 0.9, 1],\n repeat: Infinity,\n repeatType: 'loop',\n }}\n >\n <Icon />\n </motion.div>\n </div>\n );\n};\n"],"names":["Chevron","shouldShow","isRTL","useDirection","Icon","ChevronRight","ChevronLeft","_jsx","className","clsx","children","motion","div","animate","x","opacity","transition","duration","ease","times","repeat","Infinity","repeatType"],"mappings":";;;;;;;;;AAUO,MAAMA,OAAO,GAAGA,CAAC;AAAEC,EAAAA,UAAU,GAAG;AAAI,CAAS,KAAI;EACtD,MAAM;AAAEC,IAAAA;GAAO,GAAGC,YAAY,EAAE;AAChC,EAAA,MAAMC,IAAI,GAAGF,KAAK,GAAGG,YAAY,GAAGC,WAAW;AAE/C,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;IACEC,SAAS,EAAEC,IAAI,CACb,2BAA2B,EAC3B,uBAAuB,EACvB,CAACR,UAAU,IAAI,oBAAoB,CACnC;AAAAS,IAAAA,QAAA,eAEFH,GAAA,CAACI,MAAM,CAACC,GAAG,EAAA;AACTC,MAAAA,OAAO,EAAE;QACPC,CAAC,EAAEZ,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QAC5Ca,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;OACpB;AACFC,MAAAA,UAAU,EAAE;AACVC,QAAAA,QAAQ,EAAE,CAAC;QACXC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpDC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACvBC,QAAAA,MAAM,EAAEC,QAAQ;AAChBC,QAAAA,UAAU,EAAE;OACZ;AAAAZ,MAAAA,QAAA,eAEFH,GAAA,CAACH,IAAI,EAAA,EAAA;KACK;AACd,GAAK,CAAC;AAEV;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencySelector.js","sources":["../../../src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx"],"sourcesContent":["import type { AvatarLayoutProps } from '../../AvatarLayout';\nimport Button from '../../Button';\nimport type { NewButtonProps } from '../../Button';\nimport {\n SelectInput,\n SelectInputOptionContent,\n SelectInputTriggerButton,\n} from '../../Inputs/SelectInput';\nimport type { CurrencyType, ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { ChevronDown } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport { forwardRef, type MouseEventHandler, useMemo, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../ExpressiveMoneyInput.messages';\nimport { getLocaleCurrencyName } from '../../common';\nimport { formatCurrencyCode } from '@transferwise/formatting';\n\nexport interface CurrencyOption {\n label?: string;\n code: string;\n keywords: string[] | undefined;\n}\n\nexport interface CurrencySection {\n title: string;\n currencies: CurrencyOption[];\n}\n\nexport type CurrencyOptions = CurrencySection[];\n\nexport type CurrencySelectorProps = {\n id: string;\n labelId: string;\n options?: CurrencyOptions;\n onChange?: (currency: CurrencyType) => void;\n onOpen?: () => void;\n addons?: AvatarLayoutProps['avatars'];\n onSearchChange?: (payload: { query: string; resultCount: number }) => void;\n} & Pick<ExpressiveMoneyInputProps, 'currency'>;\n\ntype ButtonInputProps = Omit<\n Extract<NewButtonProps, { as?: 'button' }>,\n 'v2' | 'size' | 'priority' | 'className' | 'href' | 'target'\n>;\n\nexport const CurrencySelector = ({\n id,\n currency,\n options = [],\n labelId,\n onChange,\n addons,\n onOpen,\n onSearchChange,\n}: CurrencySelectorProps) => {\n const intl = useIntl();\n\n const allCurrencyOptions = useMemo(() => getUniqueCurrencies(options), [options]);\n\n const activeCurrencyOption = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return allCurrencyOptions.find((option) => option.code === currency)!;\n }, [currency, allCurrencyOptions]);\n\n const disabled =\n !onChange ||\n options.length === 0 ||\n (options.length === 1 && options[0].currencies.length <= 1);\n\n const [searchQuery, setSearchQuery] = useState<string>('');\n\n const handleTriggerClick: MouseEventHandler = (event) => {\n const triggerEl = event.currentTarget;\n if (triggerEl?.getAttribute('aria-expanded') === 'false') {\n onOpen?.();\n }\n };\n\n const items = searchQuery\n ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption)\n : options.map(getCurrencyGroup);\n\n return (\n <SelectInput\n compareValues=\"code\"\n disabled={disabled}\n id={id}\n value={activeCurrencyOption}\n filterable\n filterPlaceholder={intl.formatMessage(messages.currencySelectorSearchPlaceholder)}\n UNSAFE_triggerButtonProps={{\n id: undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': labelId,\n 'aria-invalid': undefined,\n 'aria-label': intl.formatMessage(messages.currencySelectorSelectCurrency),\n }}\n items={items}\n renderValue={({ code, label }) => {\n return (\n <SelectInputOptionContent\n title={formatCurrencyCode(code)}\n note={label}\n icon={<Flag code={code} intrinsicSize={24} />}\n />\n );\n }}\n renderTrigger={() => (\n <SelectInputTriggerButton\n as={ButtonInput}\n addonStart={{\n type: 'avatar',\n value: [\n addons ? addons[0] : null,\n {\n ...(addons && addons.length > 1\n ? { ...addons[1] }\n : {\n asset: <Flag code={currency} />,\n }),\n },\n ]\n .filter((avatar): avatar is NonNullable<typeof avatar> => avatar != null)\n .filter((avatar) => !(avatar && Object.keys(avatar).length === 0)),\n }}\n addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}\n onClick={handleTriggerClick}\n >\n <>\n <span aria-hidden>{formatCurrencyCode(currency)}</span>\n <span className=\"sr-only\">{getLocaleCurrencyName(intl, currency)}</span>\n </>\n </SelectInputTriggerButton>\n )}\n onChange={(newValue) => {\n onChange?.(newValue.code);\n }}\n onFilterChange={({ queryNormalized }) => {\n setSearchQuery(queryNormalized ?? '');\n if (queryNormalized) {\n onSearchChange?.({\n query: queryNormalized,\n resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized)\n .length,\n });\n }\n }}\n />\n );\n};\n\nexport const ButtonInput = forwardRef<HTMLButtonElement, ButtonInputProps>(function ButtonInput(\n { children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n size=\"md\"\n v2\n className=\"wds-currency-selector\"\n priority=\"secondary-neutral\"\n {...rest}\n >\n {children}\n </Button>\n );\n});\n\nconst getCurrencySelectOption = (currency: CurrencyOption) => {\n return {\n type: 'option' as const,\n value: currency,\n filterMatchers: currency.keywords,\n };\n};\n\nconst getCurrencyGroup = (section: CurrencySection) => {\n return {\n type: 'group' as const,\n label: section.title,\n options: section.currencies.map(getCurrencySelectOption),\n };\n};\n\nconst getUniqueCurrencies = (options: CurrencyOptions) => {\n const allCurrencyOptions = options.flatMap((section) => section.currencies);\n const uniqueCurrencies = new Map<string, CurrencyOption>();\n\n allCurrencyOptions.forEach((currencyObj) => {\n uniqueCurrencies.set(currencyObj.code, currencyObj);\n });\n\n return Array.from(uniqueCurrencies.values());\n};\n\nconst filterAndSortCurrenciesForQuery = (\n currencies: CurrencyOption[],\n query: string,\n): CurrencyOption[] => {\n return (\n currencies\n .filter((currency) => {\n return (\n formatCurrencyCode(currency.code).toLowerCase().includes(query) ||\n (currency.label ?? '').toLowerCase().includes(query) ||\n currency.keywords?.some((keyword) => keyword.toLowerCase().includes(query))\n );\n })\n // prefer exact matches, then sort alphabetically by code\n .sort((a, b) => {\n const aCode = a.code.toLowerCase();\n const bCode = b.code.toLowerCase();\n if (aCode === query) {\n return -1;\n }\n if (bCode === query) {\n return 1;\n }\n return aCode.localeCompare(bCode);\n })\n );\n};\n"],"names":["CurrencySelector","id","currency","options","labelId","onChange","addons","onOpen","onSearchChange","intl","useIntl","allCurrencyOptions","useMemo","getUniqueCurrencies","activeCurrencyOption","find","option","code","disabled","length","currencies","searchQuery","setSearchQuery","useState","handleTriggerClick","event","triggerEl","currentTarget","getAttribute","items","filterAndSortCurrenciesForQuery","map","getCurrencySelectOption","getCurrencyGroup","_jsx","SelectInput","compareValues","value","filterable","filterPlaceholder","formatMessage","messages","currencySelectorSearchPlaceholder","UNSAFE_triggerButtonProps","undefined","currencySelectorSelectCurrency","renderValue","label","SelectInputOptionContent","title","formatCurrencyCode","note","icon","Flag","intrinsicSize","renderTrigger","SelectInputTriggerButton","as","ButtonInput","addonStart","type","asset","filter","avatar","Object","keys","addonEnd","ChevronDown","onClick","children","_jsxs","_Fragment","className","getLocaleCurrencyName","newValue","onFilterChange","queryNormalized","query","resultCount","forwardRef","rest","ref","Button","size","v2","priority","filterMatchers","keywords","section","flatMap","uniqueCurrencies","Map","forEach","currencyObj","set","Array","from","values","toLowerCase","includes","some","keyword","sort","a","b","aCode","bCode","localeCompare"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,MAAMA,gBAAgB,GAAGA,CAAC;EAC/BC,EAAE;EACFC,QAAQ;AACRC,EAAAA,OAAO,GAAG,EAAE;EACZC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,MAAM;AACNC,EAAAA;AAAc,CACQ,KAAI;AAC1B,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,MAAMC,kBAAkB,GAAGC,aAAO,CAAC,MAAMC,mBAAmB,CAACV,OAAO,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AAEjF,EAAA,MAAMW,oBAAoB,GAAGF,aAAO,CAAC,MAAK;AACxC;IACA,OAAOD,kBAAkB,CAACI,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKf,QAAQ,CAAE;AACvE,EAAA,CAAC,EAAE,CAACA,QAAQ,EAAES,kBAAkB,CAAC,CAAC;EAElC,MAAMO,QAAQ,GACZ,CAACb,QAAQ,IACTF,OAAO,CAACgB,MAAM,KAAK,CAAC,IACnBhB,OAAO,CAACgB,MAAM,KAAK,CAAC,IAAIhB,OAAO,CAAC,CAAC,CAAC,CAACiB,UAAU,CAACD,MAAM,IAAI,CAAE;EAE7D,MAAM,CAACE,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAQ,CAAS,EAAE,CAAC;EAE1D,MAAMC,kBAAkB,GAAuBC,KAAK,IAAI;AACtD,IAAA,MAAMC,SAAS,GAAGD,KAAK,CAACE,aAAa;IACrC,IAAID,SAAS,EAAEE,YAAY,CAAC,eAAe,CAAC,KAAK,OAAO,EAAE;AACxDrB,MAAAA,MAAM,IAAI;AACZ,IAAA;EACF,CAAC;EAED,MAAM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ressiveMoneyInput/CurrencySelector/CurrencySelector.tsx"],"sourcesContent":["import type { AvatarLayoutProps } from '../../AvatarLayout';\nimport Button from '../../Button';\nimport type { NewButtonProps } from '../../Button';\nimport {\n SelectInput,\n SelectInputOptionContent,\n SelectInputTriggerButton,\n} from '../../Inputs/SelectInput';\nimport type { CurrencyType, ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { ChevronDown } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport { forwardRef, type MouseEventHandler, useMemo, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../ExpressiveMoneyInput.messages';\nimport { getLocaleCurrencyName } from '../../common';\nimport { formatCurrencyCode } from '@transferwise/formatting';\n\nexport interface CurrencyOption {\n label?: string;\n code: string;\n keywords: string[] | undefined;\n}\n\nexport interface CurrencySection {\n title: string;\n currencies: CurrencyOption[];\n}\n\nexport type CurrencyOptions = CurrencySection[];\n\nexport type CurrencySelectorProps = {\n id: string;\n labelId: string;\n options?: CurrencyOptions;\n onChange?: (currency: CurrencyType) => void;\n onOpen?: () => void;\n addons?: AvatarLayoutProps['avatars'];\n onSearchChange?: (payload: { query: string; resultCount: number }) => void;\n} & Pick<ExpressiveMoneyInputProps, 'currency'>;\n\ntype ButtonInputProps = Omit<\n Extract<NewButtonProps, { as?: 'button' }>,\n 'v2' | 'size' | 'priority' | 'className' | 'href' | 'target'\n>;\n\nexport const CurrencySelector = ({\n id,\n currency,\n options = [],\n labelId,\n onChange,\n addons,\n onOpen,\n onSearchChange,\n}: CurrencySelectorProps) => {\n const intl = useIntl();\n\n const allCurrencyOptions = useMemo(() => getUniqueCurrencies(options), [options]);\n\n const activeCurrencyOption = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return allCurrencyOptions.find((option) => option.code === currency)!;\n }, [currency, allCurrencyOptions]);\n\n const disabled =\n !onChange ||\n options.length === 0 ||\n (options.length === 1 && options[0].currencies.length <= 1);\n\n const [searchQuery, setSearchQuery] = useState<string>('');\n\n const handleTriggerClick: MouseEventHandler = (event) => {\n const triggerEl = event.currentTarget;\n if (triggerEl?.getAttribute('aria-expanded') === 'false') {\n onOpen?.();\n }\n };\n\n const items = searchQuery\n ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption)\n : options.map(getCurrencyGroup);\n\n return (\n <SelectInput\n compareValues=\"code\"\n disabled={disabled}\n id={id}\n value={activeCurrencyOption}\n filterable\n filterPlaceholder={intl.formatMessage(messages.currencySelectorSearchPlaceholder)}\n UNSAFE_triggerButtonProps={{\n id: undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': labelId,\n 'aria-invalid': undefined,\n 'aria-label': intl.formatMessage(messages.currencySelectorSelectCurrency),\n }}\n items={items}\n renderValue={({ code, label }) => {\n return (\n <SelectInputOptionContent\n title={formatCurrencyCode(code)}\n note={label}\n icon={<Flag code={code} intrinsicSize={24} />}\n />\n );\n }}\n renderTrigger={() => (\n <SelectInputTriggerButton\n as={ButtonInput}\n addonStart={{\n type: 'avatar',\n value: [\n addons ? addons[0] : null,\n {\n ...(addons && addons.length > 1\n ? { ...addons[1] }\n : {\n asset: <Flag code={currency} />,\n }),\n },\n ]\n .filter((avatar): avatar is NonNullable<typeof avatar> => avatar != null)\n .filter((avatar) => !(avatar && Object.keys(avatar).length === 0)),\n }}\n addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}\n onClick={handleTriggerClick}\n >\n <>\n <span aria-hidden>{formatCurrencyCode(currency)}</span>\n <span className=\"sr-only\">{getLocaleCurrencyName(intl, currency)}</span>\n </>\n </SelectInputTriggerButton>\n )}\n onChange={(newValue) => {\n onChange?.(newValue.code);\n }}\n onFilterChange={({ queryNormalized }) => {\n setSearchQuery(queryNormalized ?? '');\n if (queryNormalized) {\n onSearchChange?.({\n query: queryNormalized,\n resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized)\n .length,\n });\n }\n }}\n />\n );\n};\n\nexport const ButtonInput = forwardRef<HTMLButtonElement, ButtonInputProps>(function ButtonInput(\n { children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n size=\"md\"\n v2\n className=\"wds-currency-selector\"\n priority=\"secondary-neutral\"\n {...rest}\n >\n {children}\n </Button>\n );\n});\n\nconst getCurrencySelectOption = (currency: CurrencyOption) => {\n return {\n type: 'option' as const,\n value: currency,\n filterMatchers: currency.keywords,\n };\n};\n\nconst getCurrencyGroup = (section: CurrencySection) => {\n return {\n type: 'group' as const,\n label: section.title,\n options: section.currencies.map(getCurrencySelectOption),\n };\n};\n\nconst getUniqueCurrencies = (options: CurrencyOptions) => {\n const allCurrencyOptions = options.flatMap((section) => section.currencies);\n const uniqueCurrencies = new Map<string, CurrencyOption>();\n\n allCurrencyOptions.forEach((currencyObj) => {\n uniqueCurrencies.set(currencyObj.code, currencyObj);\n });\n\n return Array.from(uniqueCurrencies.values());\n};\n\nconst filterAndSortCurrenciesForQuery = (\n currencies: CurrencyOption[],\n query: string,\n): CurrencyOption[] => {\n return (\n currencies\n .filter((currency) => {\n return (\n formatCurrencyCode(currency.code).toLowerCase().includes(query) ||\n (currency.label ?? '').toLowerCase().includes(query) ||\n currency.keywords?.some((keyword) => keyword.toLowerCase().includes(query))\n );\n })\n // prefer exact matches, then sort alphabetically by code\n .sort((a, b) => {\n const aCode = a.code.toLowerCase();\n const bCode = b.code.toLowerCase();\n if (aCode === query) {\n return -1;\n }\n if (bCode === query) {\n return 1;\n }\n return aCode.localeCompare(bCode);\n })\n );\n};\n"],"names":["CurrencySelector","id","currency","options","labelId","onChange","addons","onOpen","onSearchChange","intl","useIntl","allCurrencyOptions","useMemo","getUniqueCurrencies","activeCurrencyOption","find","option","code","disabled","length","currencies","searchQuery","setSearchQuery","useState","handleTriggerClick","event","triggerEl","currentTarget","getAttribute","items","filterAndSortCurrenciesForQuery","map","getCurrencySelectOption","getCurrencyGroup","_jsx","SelectInput","compareValues","value","filterable","filterPlaceholder","formatMessage","messages","currencySelectorSearchPlaceholder","UNSAFE_triggerButtonProps","undefined","currencySelectorSelectCurrency","renderValue","label","SelectInputOptionContent","title","formatCurrencyCode","note","icon","Flag","intrinsicSize","renderTrigger","SelectInputTriggerButton","as","ButtonInput","addonStart","type","asset","filter","avatar","Object","keys","addonEnd","ChevronDown","onClick","children","_jsxs","_Fragment","className","getLocaleCurrencyName","newValue","onFilterChange","queryNormalized","query","resultCount","forwardRef","rest","ref","Button","size","v2","priority","filterMatchers","keywords","section","flatMap","uniqueCurrencies","Map","forEach","currencyObj","set","Array","from","values","toLowerCase","includes","some","keyword","sort","a","b","aCode","bCode","localeCompare"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,MAAMA,gBAAgB,GAAGA,CAAC;EAC/BC,EAAE;EACFC,QAAQ;AACRC,EAAAA,OAAO,GAAG,EAAE;EACZC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,MAAM;AACNC,EAAAA;AAAc,CACQ,KAAI;AAC1B,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AAEtB,EAAA,MAAMC,kBAAkB,GAAGC,aAAO,CAAC,MAAMC,mBAAmB,CAACV,OAAO,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AAEjF,EAAA,MAAMW,oBAAoB,GAAGF,aAAO,CAAC,MAAK;AACxC;IACA,OAAOD,kBAAkB,CAACI,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKf,QAAQ,CAAE;AACvE,EAAA,CAAC,EAAE,CAACA,QAAQ,EAAES,kBAAkB,CAAC,CAAC;EAElC,MAAMO,QAAQ,GACZ,CAACb,QAAQ,IACTF,OAAO,CAACgB,MAAM,KAAK,CAAC,IACnBhB,OAAO,CAACgB,MAAM,KAAK,CAAC,IAAIhB,OAAO,CAAC,CAAC,CAAC,CAACiB,UAAU,CAACD,MAAM,IAAI,CAAE;EAE7D,MAAM,CAACE,WAAW,EAAEC,cAAc,CAAC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AE;AACnB,MAAA,OAAO,EAAE;AACX,IAAA;IACA,IAAI6B,KAAK,KAAK7B,KAAK,EAAE;AACnB,MAAA,OAAO,CAAC;AACV,IAAA;AACA,IAAA,OAAO4B,KAAK,CAACE,aAAa,CAACD,KAAK,CAAC;AACnC,EAAA,CAAC,CAAC;AAER,CAAC;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencySelector.mjs","sources":["../../../src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx"],"sourcesContent":["import type { AvatarLayoutProps } from '../../AvatarLayout';\nimport Button from '../../Button';\nimport type { NewButtonProps } from '../../Button';\nimport {\n SelectInput,\n SelectInputOptionContent,\n SelectInputTriggerButton,\n} from '../../Inputs/SelectInput';\nimport type { CurrencyType, ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { ChevronDown } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport { forwardRef, type MouseEventHandler, useMemo, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../ExpressiveMoneyInput.messages';\nimport { getLocaleCurrencyName } from '../../common';\nimport { formatCurrencyCode } from '@transferwise/formatting';\n\nexport interface CurrencyOption {\n label?: string;\n code: string;\n keywords: string[] | undefined;\n}\n\nexport interface CurrencySection {\n title: string;\n currencies: CurrencyOption[];\n}\n\nexport type CurrencyOptions = CurrencySection[];\n\nexport type CurrencySelectorProps = {\n id: string;\n labelId: string;\n options?: CurrencyOptions;\n onChange?: (currency: CurrencyType) => void;\n onOpen?: () => void;\n addons?: AvatarLayoutProps['avatars'];\n onSearchChange?: (payload: { query: string; resultCount: number }) => void;\n} & Pick<ExpressiveMoneyInputProps, 'currency'>;\n\ntype ButtonInputProps = Omit<\n Extract<NewButtonProps, { as?: 'button' }>,\n 'v2' | 'size' | 'priority' | 'className' | 'href' | 'target'\n>;\n\nexport const CurrencySelector = ({\n id,\n currency,\n options = [],\n labelId,\n onChange,\n addons,\n onOpen,\n onSearchChange,\n}: CurrencySelectorProps) => {\n const intl = useIntl();\n\n const allCurrencyOptions = useMemo(() => getUniqueCurrencies(options), [options]);\n\n const activeCurrencyOption = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return allCurrencyOptions.find((option) => option.code === currency)!;\n }, [currency, allCurrencyOptions]);\n\n const disabled =\n !onChange ||\n options.length === 0 ||\n (options.length === 1 && options[0].currencies.length <= 1);\n\n const [searchQuery, setSearchQuery] = useState<string>('');\n\n const handleTriggerClick: MouseEventHandler = (event) => {\n const triggerEl = event.currentTarget;\n if (triggerEl?.getAttribute('aria-expanded') === 'false') {\n onOpen?.();\n }\n };\n\n const items = searchQuery\n ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption)\n : options.map(getCurrencyGroup);\n\n return (\n <SelectInput\n compareValues=\"code\"\n disabled={disabled}\n id={id}\n value={activeCurrencyOption}\n filterable\n filterPlaceholder={intl.formatMessage(messages.currencySelectorSearchPlaceholder)}\n UNSAFE_triggerButtonProps={{\n id: undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': labelId,\n 'aria-invalid': undefined,\n 'aria-label': intl.formatMessage(messages.currencySelectorSelectCurrency),\n }}\n items={items}\n renderValue={({ code, label }) => {\n return (\n <SelectInputOptionContent\n title={formatCurrencyCode(code)}\n note={label}\n icon={<Flag code={code} intrinsicSize={24} />}\n />\n );\n }}\n renderTrigger={() => (\n <SelectInputTriggerButton\n as={ButtonInput}\n addonStart={{\n type: 'avatar',\n value: [\n addons ? addons[0] : null,\n {\n ...(addons && addons.length > 1\n ? { ...addons[1] }\n : {\n asset: <Flag code={currency} />,\n }),\n },\n ]\n .filter((avatar): avatar is NonNullable<typeof avatar> => avatar != null)\n .filter((avatar) => !(avatar && Object.keys(avatar).length === 0)),\n }}\n addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}\n onClick={handleTriggerClick}\n >\n <>\n <span aria-hidden>{formatCurrencyCode(currency)}</span>\n <span className=\"sr-only\">{getLocaleCurrencyName(intl, currency)}</span>\n </>\n </SelectInputTriggerButton>\n )}\n onChange={(newValue) => {\n onChange?.(newValue.code);\n }}\n onFilterChange={({ queryNormalized }) => {\n setSearchQuery(queryNormalized ?? '');\n if (queryNormalized) {\n onSearchChange?.({\n query: queryNormalized,\n resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized)\n .length,\n });\n }\n }}\n />\n );\n};\n\nexport const ButtonInput = forwardRef<HTMLButtonElement, ButtonInputProps>(function ButtonInput(\n { children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n size=\"md\"\n v2\n className=\"wds-currency-selector\"\n priority=\"secondary-neutral\"\n {...rest}\n >\n {children}\n </Button>\n );\n});\n\nconst getCurrencySelectOption = (currency: CurrencyOption) => {\n return {\n type: 'option' as const,\n value: currency,\n filterMatchers: currency.keywords,\n };\n};\n\nconst getCurrencyGroup = (section: CurrencySection) => {\n return {\n type: 'group' as const,\n label: section.title,\n options: section.currencies.map(getCurrencySelectOption),\n };\n};\n\nconst getUniqueCurrencies = (options: CurrencyOptions) => {\n const allCurrencyOptions = options.flatMap((section) => section.currencies);\n const uniqueCurrencies = new Map<string, CurrencyOption>();\n\n allCurrencyOptions.forEach((currencyObj) => {\n uniqueCurrencies.set(currencyObj.code, currencyObj);\n });\n\n return Array.from(uniqueCurrencies.values());\n};\n\nconst filterAndSortCurrenciesForQuery = (\n currencies: CurrencyOption[],\n query: string,\n): CurrencyOption[] => {\n return (\n currencies\n .filter((currency) => {\n return (\n formatCurrencyCode(currency.code).toLowerCase().includes(query) ||\n (currency.label ?? '').toLowerCase().includes(query) ||\n currency.keywords?.some((keyword) => keyword.toLowerCase().includes(query))\n );\n })\n // prefer exact matches, then sort alphabetically by code\n .sort((a, b) => {\n const aCode = a.code.toLowerCase();\n const bCode = b.code.toLowerCase();\n if (aCode === query) {\n return -1;\n }\n if (bCode === query) {\n return 1;\n }\n return aCode.localeCompare(bCode);\n })\n );\n};\n"],"names":["CurrencySelector","id","currency","options","labelId","onChange","addons","onOpen","onSearchChange","intl","useIntl","allCurrencyOptions","useMemo","getUniqueCurrencies","activeCurrencyOption","find","option","code","disabled","length","currencies","searchQuery","setSearchQuery","useState","handleTriggerClick","event","triggerEl","currentTarget","getAttribute","items","filterAndSortCurrenciesForQuery","map","getCurrencySelectOption","getCurrencyGroup","_jsx","SelectInput","compareValues","value","filterable","filterPlaceholder","formatMessage","messages","currencySelectorSearchPlaceholder","UNSAFE_triggerButtonProps","undefined","currencySelectorSelectCurrency","renderValue","label","SelectInputOptionContent","title","formatCurrencyCode","note","icon","Flag","intrinsicSize","renderTrigger","SelectInputTriggerButton","as","ButtonInput","addonStart","type","asset","filter","avatar","Object","keys","addonEnd","ChevronDown","onClick","children","_jsxs","_Fragment","className","getLocaleCurrencyName","newValue","onFilterChange","queryNormalized","query","resultCount","forwardRef","rest","ref","Button","size","v2","priority","filterMatchers","keywords","section","flatMap","uniqueCurrencies","Map","forEach","currencyObj","set","Array","from","values","toLowerCase","includes","some","keyword","sort","a","b","aCode","bCode","localeCompare"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,MAAMA,gBAAgB,GAAGA,CAAC;EAC/BC,EAAE;EACFC,QAAQ;AACRC,EAAAA,OAAO,GAAG,EAAE;EACZC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,MAAM;AACNC,EAAAA;AAAc,CACQ,KAAI;AAC1B,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AAEtB,EAAA,MAAMC,kBAAkB,GAAGC,OAAO,CAAC,MAAMC,mBAAmB,CAACV,OAAO,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AAEjF,EAAA,MAAMW,oBAAoB,GAAGF,OAAO,CAAC,MAAK;AACxC;IACA,OAAOD,kBAAkB,CAACI,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAKf,QAAQ,CAAE;AACvE,EAAA,CAAC,EAAE,CAACA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AK,CAAC,CAAC;EAE/E,CAAC;AACD;AAAA,GACCyB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAI;IACb,MAAMC,KAAK,GAAGF,CAAC,CAACtF,IAAI,CAACiF,WAAW,EAAE;IAClC,MAAMQ,KAAK,GAAGF,CAAC,CAACvF,IAAI,CAACiF,WAAW,EAAE;IAClC,IAAIO,KAAK,KAAK5B,KAAK,EAAE;AACnB,MAAA,OAAO,EAAE;AACX,IAAA;IACA,IAAI6B,KAAK,KAAK7B,KAAK,EAAE;AACnB,MAAA,OAAO,CAAC;AACV,IAAA;AACA,IAAA,OAAO4B,KAAK,CAACE,aAAa,CAACD,KAAK,CAAC;AACnC,EAAA,CAAC,CAAC;AAER,CAAC;;;;"}
1
+ {"version":3,"file":"CurrencySelector.mjs","sources":["../../../src/ExpressiveMoneyInput/CurrencySelector/CurrencySelector.tsx"],"sourcesContent":["import type { AvatarLayoutProps } from '../../AvatarLayout';\nimport Button from '../../Button';\nimport type { NewButtonProps } from '../../Button';\nimport {\n SelectInput,\n SelectInputOptionContent,\n SelectInputTriggerButton,\n} from '../../Inputs/SelectInput';\nimport type { CurrencyType, ExpressiveMoneyInputProps } from '../ExpressiveMoneyInput';\nimport { ChevronDown } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport { forwardRef, type MouseEventHandler, useMemo, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport messages from '../ExpressiveMoneyInput.messages';\nimport { getLocaleCurrencyName } from '../../common';\nimport { formatCurrencyCode } from '@transferwise/formatting';\n\nexport interface CurrencyOption {\n label?: string;\n code: string;\n keywords: string[] | undefined;\n}\n\nexport interface CurrencySection {\n title: string;\n currencies: CurrencyOption[];\n}\n\nexport type CurrencyOptions = CurrencySection[];\n\nexport type CurrencySelectorProps = {\n id: string;\n labelId: string;\n options?: CurrencyOptions;\n onChange?: (currency: CurrencyType) => void;\n onOpen?: () => void;\n addons?: AvatarLayoutProps['avatars'];\n onSearchChange?: (payload: { query: string; resultCount: number }) => void;\n} & Pick<ExpressiveMoneyInputProps, 'currency'>;\n\ntype ButtonInputProps = Omit<\n Extract<NewButtonProps, { as?: 'button' }>,\n 'v2' | 'size' | 'priority' | 'className' | 'href' | 'target'\n>;\n\nexport const CurrencySelector = ({\n id,\n currency,\n options = [],\n labelId,\n onChange,\n addons,\n onOpen,\n onSearchChange,\n}: CurrencySelectorProps) => {\n const intl = useIntl();\n\n const allCurrencyOptions = useMemo(() => getUniqueCurrencies(options), [options]);\n\n const activeCurrencyOption = useMemo(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return allCurrencyOptions.find((option) => option.code === currency)!;\n }, [currency, allCurrencyOptions]);\n\n const disabled =\n !onChange ||\n options.length === 0 ||\n (options.length === 1 && options[0].currencies.length <= 1);\n\n const [searchQuery, setSearchQuery] = useState<string>('');\n\n const handleTriggerClick: MouseEventHandler = (event) => {\n const triggerEl = event.currentTarget;\n if (triggerEl?.getAttribute('aria-expanded') === 'false') {\n onOpen?.();\n }\n };\n\n const items = searchQuery\n ? filterAndSortCurrenciesForQuery(allCurrencyOptions, searchQuery).map(getCurrencySelectOption)\n : options.map(getCurrencyGroup);\n\n return (\n <SelectInput\n compareValues=\"code\"\n disabled={disabled}\n id={id}\n value={activeCurrencyOption}\n filterable\n filterPlaceholder={intl.formatMessage(messages.currencySelectorSearchPlaceholder)}\n UNSAFE_triggerButtonProps={{\n id: undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': labelId,\n 'aria-invalid': undefined,\n 'aria-label': intl.formatMessage(messages.currencySelectorSelectCurrency),\n }}\n items={items}\n renderValue={({ code, label }) => {\n return (\n <SelectInputOptionContent\n title={formatCurrencyCode(code)}\n note={label}\n icon={<Flag code={code} intrinsicSize={24} />}\n />\n );\n }}\n renderTrigger={() => (\n <SelectInputTriggerButton\n as={ButtonInput}\n addonStart={{\n type: 'avatar',\n value: [\n addons ? addons[0] : null,\n {\n ...(addons && addons.length > 1\n ? { ...addons[1] }\n : {\n asset: <Flag code={currency} />,\n }),\n },\n ]\n .filter((avatar): avatar is NonNullable<typeof avatar> => avatar != null)\n .filter((avatar) => !(avatar && Object.keys(avatar).length === 0)),\n }}\n addonEnd={disabled ? undefined : { type: 'icon', value: <ChevronDown /> }}\n onClick={handleTriggerClick}\n >\n <>\n <span aria-hidden>{formatCurrencyCode(currency)}</span>\n <span className=\"sr-only\">{getLocaleCurrencyName(intl, currency)}</span>\n </>\n </SelectInputTriggerButton>\n )}\n onChange={(newValue) => {\n onChange?.(newValue.code);\n }}\n onFilterChange={({ queryNormalized }) => {\n setSearchQuery(queryNormalized ?? '');\n if (queryNormalized) {\n onSearchChange?.({\n query: queryNormalized,\n resultCount: filterAndSortCurrenciesForQuery(allCurrencyOptions, queryNormalized)\n .length,\n });\n }\n }}\n />\n );\n};\n\nexport const ButtonInput = forwardRef<HTMLButtonElement, ButtonInputProps>(function ButtonInput(\n { children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n size=\"md\"\n v2\n className=\"wds-currency-selector\"\n priority=\"secondary-neutral\"\n {...rest}\n >\n {children}\n </Button>\n );\n});\n\nconst getCurrencySelectOption = (currency: CurrencyOption) => {\n return {\n type: 'option' as const,\n value: currency,\n filterMatchers: currency.keywords,\n };\n};\n\nconst getCurrencyGroup = (section: CurrencySection) => {\n return {\n type: 'group' as const,\n label: section.title,\n options: section.currencies.map(getCurrencySelectOption),\n };\n};\n\nconst getUniqueCurrencies = (options: CurrencyOptions) => {\n const allCurrencyOptions = options.flatMap((section) => section.currencies);\n const uniqueCurrencies = new Map<string, CurrencyOption>();\n\n allCurrencyOptions.forEach((currencyObj) => {\n uniqueCurrencies.set(currencyObj.code, currencyObj);\n });\n\n return Array.from(uniqueCurrencies.values());\n};\n\nconst filterAndSortCurrenciesForQuery = (\n currencies: CurrencyOption[],\n query: string,\n): CurrencyOption[] => {\n return (\n currencies\n .filter((currency) => {\n return (\n formatCurrencyCode(currency.code).toLowerCase().includes(query) ||\n (currency.label ?? '').toLowerCase().includes(query) ||\n currency.keywords?.some((keyword) => keyword.toLowerCase().includes(query))\n );\n })\n // prefer exact matches, then sort alphabetically by code\n .sort((a, b) => {\n const aCode = a.code.toLowerCase();\n const bCode = b.code.toLowerCase();\n if (aCode === query) {\n return -1;\n }\n if (bCode === query) {\n return 1;\n }\n return aCode.localeCompare(bCode);\n })\n );\n};\n"],"names":["CurrencySelector","id","currency","options","labelId","onChange","addons","onOpen","onSearchChange","intl","useIntl","allCurrencyOptions","useMemo","getUniqueCurrencies","activeCurrencyOption","find","option","code","disabled","length","currencies","searchQuery","setSearchQuery","useState","handleTriggerClick","event","triggerEl","currentTarget","getAttribute","items","filterAndSortCurrenciesForQuery","map","getCurrencySelectOption","getCurrencyGroup","_jsx","SelectInput","compareValues","value","filterable","filterPlaceholder","formatMessage","messages","currencySelectorSearchPlaceholder","UNSAFE_triggerButtonProps","undefined","currencySelectorSelectCurrency","renderValue","label","SelectInputOptionContent","title","formatCurrencyCode","note","icon","Flag","intrinsicSize","renderTrigger","SelectInputTriggerButton","as","ButtonInput","addonStart","type","asset","filter","avatar","Object","keys","addonEnd","ChevronDown","onClick","children","_jsxs","_Fragment","className","getLocaleCurrencyName","newValue","onFilterChange","queryNormalized","query","resultCount","forwardRef","rest","ref","Button","size","v2","priority","filterMatchers","keywords","section","flatMap","uniqueCurrencies","Map","forEach","currencyObj","set","Array","from","values","toLowerCase","includes","some","keyword","sort","a","b","aCode","bCode","localeCompare"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,MAAMA,gBAAgB,GAAGA,CAAC;EAC/BC,EAAE;EACFC,QAAQ;AACRC,EAAAA,OAAO,GAAG,EAAE;EACZC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC,MAAM;AACNC,EAAAA;AAAc,CACQ,KAAI;AAC1B,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AAEtB,EAAA,MAAMC,kBAAkB,GAAGC,OAAO,CAAC,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