@transferwise/components 46.141.0 → 46.143.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/build/accordion/AccordionItem/AccordionItem.js +1 -1
  2. package/build/accordion/AccordionItem/AccordionItem.mjs +1 -1
  3. package/build/actionButton/ActionButton.js +1 -1
  4. package/build/actionButton/ActionButton.mjs +1 -1
  5. package/build/actionOption/ActionOption.js +1 -1
  6. package/build/actionOption/ActionOption.mjs +1 -1
  7. package/build/alert/Alert.js +1 -1
  8. package/build/alert/Alert.mjs +1 -1
  9. package/build/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  10. package/build/alert/inlineMarkdown/InlineMarkdown.mjs +1 -1
  11. package/build/avatar/Avatar.js +1 -1
  12. package/build/avatar/Avatar.mjs +1 -1
  13. package/build/avatarLayout/AvatarLayout.js +16 -2
  14. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  15. package/build/avatarLayout/AvatarLayout.mjs +16 -2
  16. package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
  17. package/build/avatarView/AvatarView.js +7 -3
  18. package/build/avatarView/AvatarView.js.map +1 -1
  19. package/build/avatarView/AvatarView.mjs +7 -3
  20. package/build/avatarView/AvatarView.mjs.map +1 -1
  21. package/build/avatarView/Dot.js +8 -0
  22. package/build/avatarView/Dot.js.map +1 -1
  23. package/build/avatarView/Dot.mjs +8 -0
  24. package/build/avatarView/Dot.mjs.map +1 -1
  25. package/build/avatarWrapper/AvatarWrapper.js +1 -1
  26. package/build/avatarWrapper/AvatarWrapper.mjs +1 -1
  27. package/build/badge/Badge.js +1 -1
  28. package/build/badge/Badge.mjs +1 -1
  29. package/build/button/Button.js +1 -1
  30. package/build/button/Button.mjs +1 -1
  31. package/build/button/LegacyButton.js +1 -1
  32. package/build/button/LegacyButton.mjs +1 -1
  33. package/build/button/classMap.js +1 -1
  34. package/build/button/classMap.mjs +1 -1
  35. package/build/button/legacyUtils/legacyUtils.js +1 -1
  36. package/build/button/legacyUtils/legacyUtils.mjs +1 -1
  37. package/build/card/Card.js +1 -1
  38. package/build/card/Card.mjs +1 -1
  39. package/build/checkbox/Checkbox.js +1 -1
  40. package/build/checkbox/Checkbox.mjs +1 -1
  41. package/build/chevron/Chevron.js +1 -1
  42. package/build/chevron/Chevron.mjs +1 -1
  43. package/build/chips/Chip.js +1 -1
  44. package/build/chips/Chip.mjs +1 -1
  45. package/build/circularButton/CircularButton.js +2 -2
  46. package/build/circularButton/CircularButton.js.map +1 -1
  47. package/build/circularButton/CircularButton.mjs +2 -2
  48. package/build/circularButton/CircularButton.mjs.map +1 -1
  49. package/build/common/bottomSheet/BottomSheet.js +2 -2
  50. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  51. package/build/common/bottomSheet/BottomSheet.mjs +2 -2
  52. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  53. package/build/common/circle/Circle.js +8 -4
  54. package/build/common/circle/Circle.js.map +1 -1
  55. package/build/common/circle/Circle.mjs +8 -4
  56. package/build/common/circle/Circle.mjs.map +1 -1
  57. package/build/common/hooks/useLayout/useLayout.js +6 -6
  58. package/build/common/hooks/useLayout/useLayout.js.map +1 -1
  59. package/build/common/hooks/useLayout/useLayout.mjs +1 -1
  60. package/build/common/hooks/useLayout/useLayout.mjs.map +1 -1
  61. package/build/common/hooks/useScreenSize.js.map +1 -1
  62. package/build/common/hooks/useScreenSize.mjs.map +1 -1
  63. package/build/common/panel/Panel.js +1 -1
  64. package/build/common/panel/Panel.mjs +1 -1
  65. package/build/common/responsivePanel/ResponsivePanel.js +1 -1
  66. package/build/common/responsivePanel/ResponsivePanel.mjs +1 -1
  67. package/build/criticalBanner/CriticalCommsBanner.js +1 -1
  68. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
  69. package/build/dateInput/DateInput.js +1 -1
  70. package/build/dateInput/DateInput.mjs +1 -1
  71. package/build/dateLookup/DateLookup.js +2 -2
  72. package/build/dateLookup/DateLookup.js.map +1 -1
  73. package/build/dateLookup/DateLookup.mjs +1 -1
  74. package/build/dateLookup/DateLookup.mjs.map +1 -1
  75. package/build/dateLookup/dateHeader/DateHeader.js +1 -1
  76. package/build/dateLookup/dateHeader/DateHeader.mjs +1 -1
  77. package/build/dateLookup/dateTrigger/DateTrigger.js +1 -1
  78. package/build/dateLookup/dateTrigger/DateTrigger.mjs +1 -1
  79. package/build/decision/Decision.js +3 -3
  80. package/build/decision/Decision.js.map +1 -1
  81. package/build/decision/Decision.mjs +1 -1
  82. package/build/decision/Decision.mjs.map +1 -1
  83. package/build/definitionList/DefinitionList.js +1 -1
  84. package/build/definitionList/DefinitionList.mjs +1 -1
  85. package/build/dimmer/Dimmer.js +1 -1
  86. package/build/dimmer/Dimmer.mjs +1 -1
  87. package/build/display/Display.js +1 -1
  88. package/build/display/Display.mjs +1 -1
  89. package/build/drawer/Drawer.js +1 -1
  90. package/build/drawer/Drawer.mjs +1 -1
  91. package/build/expressiveMoneyInput/amountInput/AmountInput.js +1 -1
  92. package/build/expressiveMoneyInput/amountInput/AmountInput.js.map +1 -1
  93. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs +1 -1
  94. package/build/expressiveMoneyInput/amountInput/AmountInput.mjs.map +1 -1
  95. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +1 -1
  96. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +1 -1
  97. package/build/field/Field.js +64 -33
  98. package/build/field/Field.js.map +1 -1
  99. package/build/field/Field.messages.js +14 -0
  100. package/build/field/Field.messages.js.map +1 -0
  101. package/build/field/Field.messages.mjs +10 -0
  102. package/build/field/Field.messages.mjs.map +1 -0
  103. package/build/field/Field.mjs +66 -35
  104. package/build/field/Field.mjs.map +1 -1
  105. package/build/flowNavigation/FlowNavigation.js +3 -3
  106. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  107. package/build/flowNavigation/FlowNavigation.mjs +1 -1
  108. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  109. package/build/header/Header.js +1 -1
  110. package/build/header/Header.mjs +1 -1
  111. package/build/i18n/en.json +1 -0
  112. package/build/i18n/en.json.js +1 -0
  113. package/build/i18n/en.json.js.map +1 -1
  114. package/build/i18n/en.json.mjs +1 -0
  115. package/build/i18n/en.json.mjs.map +1 -1
  116. package/build/image/Image.js +1 -1
  117. package/build/image/Image.mjs +1 -1
  118. package/build/index.js +2 -2
  119. package/build/index.mjs +1 -1
  120. package/build/info/Info.js +1 -1
  121. package/build/info/Info.mjs +1 -1
  122. package/build/inlineAlert/InlineAlert.js +1 -1
  123. package/build/inlineAlert/InlineAlert.mjs +1 -1
  124. package/build/inputs/SearchInput.js +1 -1
  125. package/build/inputs/SearchInput.mjs +1 -1
  126. package/build/inputs/SelectInput/SelectInput.js +2 -2
  127. package/build/inputs/SelectInput/SelectInput.js.map +1 -1
  128. package/build/inputs/SelectInput/SelectInput.mjs +1 -1
  129. package/build/inputs/SelectInput/SelectInput.mjs.map +1 -1
  130. package/build/inputs/TextArea.js +5 -0
  131. package/build/inputs/TextArea.js.map +1 -1
  132. package/build/inputs/TextArea.mjs +6 -1
  133. package/build/inputs/TextArea.mjs.map +1 -1
  134. package/build/inputs/contexts.js +16 -0
  135. package/build/inputs/contexts.js.map +1 -1
  136. package/build/inputs/contexts.mjs +16 -2
  137. package/build/inputs/contexts.mjs.map +1 -1
  138. package/build/instructionsList/InstructionsList.js +1 -1
  139. package/build/instructionsList/InstructionsList.mjs +1 -1
  140. package/build/link/Link.js +1 -1
  141. package/build/link/Link.mjs +1 -1
  142. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +1 -1
  143. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +1 -1
  144. package/build/listItem/ListItem.js +1 -1
  145. package/build/listItem/ListItem.mjs +1 -1
  146. package/build/listItem/Prompt/ListItemPrompt.js +1 -1
  147. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
  148. package/build/loader/Loader.js +1 -1
  149. package/build/loader/Loader.mjs +1 -1
  150. package/build/logo/Logo.js +3 -3
  151. package/build/logo/Logo.js.map +1 -1
  152. package/build/logo/Logo.mjs +2 -2
  153. package/build/logo/Logo.mjs.map +1 -1
  154. package/build/main.css +350 -402
  155. package/build/markdown/Markdown.js +1 -1
  156. package/build/markdown/Markdown.mjs +1 -1
  157. package/build/modal/Modal.js +3 -3
  158. package/build/modal/Modal.js.map +1 -1
  159. package/build/modal/Modal.mjs +3 -3
  160. package/build/modal/Modal.mjs.map +1 -1
  161. package/build/moneyInput/MoneyInput.js +1 -1
  162. package/build/moneyInput/MoneyInput.mjs +1 -1
  163. package/build/navigationOption/NavigationOption.js +1 -1
  164. package/build/navigationOption/NavigationOption.mjs +1 -1
  165. package/build/nudge/Nudge.js +1 -1
  166. package/build/nudge/Nudge.mjs +1 -1
  167. package/build/overlayHeader/OverlayHeader.js +1 -1
  168. package/build/overlayHeader/OverlayHeader.mjs +1 -1
  169. package/build/phoneNumberInput/PhoneNumberInput.js +1 -1
  170. package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -1
  171. package/build/popover/Popover.js +1 -1
  172. package/build/popover/Popover.mjs +1 -1
  173. package/build/processIndicator/ProcessIndicator.js +1 -1
  174. package/build/processIndicator/ProcessIndicator.mjs +1 -1
  175. package/build/progressBar/ProgressBar.js +1 -1
  176. package/build/progressBar/ProgressBar.mjs +1 -1
  177. package/build/promoCard/PromoCard.js +1 -1
  178. package/build/promoCard/PromoCard.mjs +1 -1
  179. package/build/promoCard/PromoCardIndicator.js +1 -1
  180. package/build/promoCard/PromoCardIndicator.mjs +1 -1
  181. package/build/prompt/ActionPrompt/ActionPrompt.js +2 -2
  182. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  183. package/build/prompt/ActionPrompt/ActionPrompt.mjs +2 -2
  184. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  185. package/build/prompt/CriticalBanner/CriticalBanner.js +2 -2
  186. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  187. package/build/prompt/CriticalBanner/CriticalBanner.mjs +1 -1
  188. package/build/prompt/InfoPrompt/InfoPrompt.js +1 -1
  189. package/build/prompt/InfoPrompt/InfoPrompt.mjs +1 -1
  190. package/build/prompt/InlinePrompt/InlinePrompt.js +1 -1
  191. package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -1
  192. package/build/provider/Provider.js +1 -1
  193. package/build/provider/Provider.mjs +1 -1
  194. package/build/radio/Radio.js +1 -1
  195. package/build/radio/Radio.mjs +1 -1
  196. package/build/segmentedControl/SegmentedControl.js +1 -1
  197. package/build/segmentedControl/SegmentedControl.mjs +1 -1
  198. package/build/select/Select.js +1 -1
  199. package/build/select/Select.mjs +1 -1
  200. package/build/select/option/Option.js +1 -1
  201. package/build/select/option/Option.mjs +1 -1
  202. package/build/statusIcon/StatusIcon.js +2 -2
  203. package/build/statusIcon/StatusIcon.js.map +1 -1
  204. package/build/statusIcon/StatusIcon.mjs +2 -2
  205. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  206. package/build/stepper/Stepper.js +1 -1
  207. package/build/stepper/Stepper.mjs +1 -1
  208. package/build/sticky/Sticky.js +1 -1
  209. package/build/sticky/Sticky.mjs +1 -1
  210. package/build/styles/accordion/Accordion.css +1 -1
  211. package/build/styles/avatarView/AvatarView.css +4 -4
  212. package/build/styles/avatarView/Dot.css +4 -4
  213. package/build/styles/card/Card.css +2 -2
  214. package/build/styles/carousel/Carousel.css +5 -5
  215. package/build/styles/common/Option/Option.css +2 -4
  216. package/build/styles/common/baseCard/BaseCard.css +1 -1
  217. package/build/styles/container/Container.css +3 -3
  218. package/build/styles/criticalBanner/CriticalCommsBanner.css +1 -1
  219. package/build/styles/css/accordion.css +4 -4
  220. package/build/styles/css/button-groups.css +6 -6
  221. package/build/styles/css/buttons.css +1 -1
  222. package/build/styles/css/circles.css +1 -1
  223. package/build/styles/css/column-layout.css +4 -4
  224. package/build/styles/css/decision.css +4 -4
  225. package/build/styles/css/dropdowns.css +10 -10
  226. package/build/styles/css/droppable.css +8 -8
  227. package/build/styles/css/flex.css +13 -15
  228. package/build/styles/css/footer.css +3 -3
  229. package/build/styles/css/grid.css +19 -19
  230. package/build/styles/css/input-groups.css +12 -12
  231. package/build/styles/css/list-group.css +8 -8
  232. package/build/styles/css/modals.css +6 -6
  233. package/build/styles/css/navbar.css +62 -62
  234. package/build/styles/css/navs.css +2 -2
  235. package/build/styles/css/neptune.css +274 -328
  236. package/build/styles/css/panels.css +9 -9
  237. package/build/styles/css/popovers.css +13 -13
  238. package/build/styles/css/select.css +1 -1
  239. package/build/styles/css/sequences.css +6 -6
  240. package/build/styles/css/table.css +6 -6
  241. package/build/styles/css/utilities.css +8 -20
  242. package/build/styles/css/wells.css +4 -18
  243. package/build/styles/dateInput/DateInput.css +1 -1
  244. package/build/styles/definitionList/DefinitionList.css +2 -2
  245. package/build/styles/drawer/Drawer.css +2 -2
  246. package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +2 -0
  247. package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +2 -0
  248. package/build/styles/field/Field.css +19 -3
  249. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  250. package/build/styles/inputs/Input.css +3 -3
  251. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  252. package/build/styles/inputs/SelectInput/SelectInput.css +2 -2
  253. package/build/styles/inputs/TextArea.css +3 -3
  254. package/build/styles/less/legacy-variables.less +34 -47
  255. package/build/styles/main.css +350 -402
  256. package/build/styles/modal/Modal.css +7 -20
  257. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  258. package/build/styles/popover/Popover.css +3 -3
  259. package/build/styles/promoCard/PromoCard.css +1 -1
  260. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +1 -1
  261. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +1 -1
  262. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  263. package/build/styles/props/custom-media.css +23 -11
  264. package/build/styles/snackbar/Snackbar.css +2 -2
  265. package/build/styles/stepper/Stepper.css +2 -2
  266. package/build/styles/styles/less/accordion.css +4 -4
  267. package/build/styles/styles/less/button-groups.css +6 -6
  268. package/build/styles/styles/less/buttons.css +1 -1
  269. package/build/styles/styles/less/circles.css +1 -1
  270. package/build/styles/styles/less/column-layout.css +4 -4
  271. package/build/styles/styles/less/decision.css +4 -4
  272. package/build/styles/styles/less/dropdowns.css +10 -10
  273. package/build/styles/styles/less/droppable.css +8 -8
  274. package/build/styles/styles/less/flex.css +13 -15
  275. package/build/styles/styles/less/footer.css +3 -3
  276. package/build/styles/styles/less/forms/bootstrap-forms.css +9 -9
  277. package/build/styles/styles/less/grid.css +19 -19
  278. package/build/styles/styles/less/input-groups.css +12 -12
  279. package/build/styles/styles/less/list-group.css +8 -8
  280. package/build/styles/styles/less/modals.css +6 -6
  281. package/build/styles/styles/less/navbar.css +62 -62
  282. package/build/styles/styles/less/navs.css +2 -2
  283. package/build/styles/styles/less/neptune.css +274 -328
  284. package/build/styles/styles/less/panels.css +9 -9
  285. package/build/styles/styles/less/popovers.css +13 -13
  286. package/build/styles/styles/less/select.css +1 -1
  287. package/build/styles/styles/less/sequences.css +6 -6
  288. package/build/styles/styles/less/table.css +6 -6
  289. package/build/styles/styles/less/utilities.css +8 -20
  290. package/build/styles/styles/less/wells.css +4 -18
  291. package/build/styles/styles/props/custom-media.css +1 -11
  292. package/build/styles/table/Table.css +1 -1
  293. package/build/styles/tabs/Tabs.css +2 -2
  294. package/build/styles/typeahead/Typeahead.css +1 -1
  295. package/build/summary/Summary.js +1 -1
  296. package/build/summary/Summary.mjs +1 -1
  297. package/build/table/Table.js +1 -1
  298. package/build/table/Table.mjs +1 -1
  299. package/build/table/TableRow.js +1 -1
  300. package/build/table/TableRow.mjs +1 -1
  301. package/build/table/TableStatusText.js +1 -1
  302. package/build/table/TableStatusText.mjs +1 -1
  303. package/build/tabs/Tabs.js +1 -1
  304. package/build/tabs/Tabs.mjs +1 -1
  305. package/build/tile/Tile.js +1 -1
  306. package/build/tile/Tile.mjs +1 -1
  307. package/build/title/Title.js +1 -1
  308. package/build/title/Title.mjs +1 -1
  309. package/build/tooltip/Tooltip.js +1 -1
  310. package/build/tooltip/Tooltip.mjs +1 -1
  311. package/build/typeahead/Typeahead.js +1 -1
  312. package/build/typeahead/Typeahead.mjs +1 -1
  313. package/build/types/avatarView/AvatarView.d.ts +1 -1
  314. package/build/types/avatarView/AvatarView.d.ts.map +1 -1
  315. package/build/types/avatarView/Dot.d.ts.map +1 -1
  316. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  317. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  318. package/build/types/common/circle/Circle.d.ts +1 -1
  319. package/build/types/common/circle/Circle.d.ts.map +1 -1
  320. package/build/types/common/hooks/useScreenSize.d.ts +1 -1
  321. package/build/types/common/hooks/useScreenSize.d.ts.map +1 -1
  322. package/build/types/common/index.d.ts +1 -1
  323. package/build/types/common/index.d.ts.map +1 -1
  324. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  325. package/build/types/decision/Decision.d.ts.map +1 -1
  326. package/build/types/field/Field.d.ts.map +1 -1
  327. package/build/types/field/Field.messages.d.ts +8 -0
  328. package/build/types/field/Field.messages.d.ts.map +1 -0
  329. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  330. package/build/types/index.d.ts +2 -1
  331. package/build/types/index.d.ts.map +1 -1
  332. package/build/types/inputs/TextArea.d.ts.map +1 -1
  333. package/build/types/inputs/contexts.d.ts +6 -0
  334. package/build/types/inputs/contexts.d.ts.map +1 -1
  335. package/build/types/logo/Logo.d.ts +1 -1
  336. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  337. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  338. package/build/types/test-utils/index.d.ts +2 -0
  339. package/build/types/test-utils/index.d.ts.map +1 -1
  340. package/build/upload/Upload.js +1 -1
  341. package/build/upload/Upload.mjs +1 -1
  342. package/build/upload/steps/completeStep/completeStep.js +1 -1
  343. package/build/upload/steps/completeStep/completeStep.mjs +1 -1
  344. package/build/upload/steps/processingStep/processingStep.js +1 -1
  345. package/build/upload/steps/processingStep/processingStep.mjs +1 -1
  346. package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  347. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -1
  348. package/build/uploadInput/UploadInput.js +1 -1
  349. package/build/uploadInput/UploadInput.mjs +1 -1
  350. package/build/uploadInput/uploadButton/UploadButton.js +1 -1
  351. package/build/uploadInput/uploadButton/UploadButton.mjs +1 -1
  352. package/build/uploadInput/uploadButton/defaults.js +1 -1
  353. package/build/uploadInput/uploadButton/defaults.mjs +1 -1
  354. package/build/uploadInput/uploadItem/UploadItem.js +1 -1
  355. package/build/uploadInput/uploadItem/UploadItem.mjs +1 -1
  356. package/build/withDisplayFormat/WithDisplayFormat.js +1 -1
  357. package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -1
  358. package/package.json +3 -3
  359. package/src/accordion/Accordion.css +1 -1
  360. package/src/avatarLayout/AvatarLayout.story.tsx +1 -1
  361. package/src/avatarLayout/AvatarLayout.tsx +4 -0
  362. package/src/avatarView/AvatarView.css +4 -4
  363. package/src/avatarView/AvatarView.story.tsx +17 -13
  364. package/src/avatarView/AvatarView.tsx +5 -1
  365. package/src/avatarView/Dot.css +4 -4
  366. package/src/avatarView/Dot.less +6 -6
  367. package/src/avatarView/Dot.tsx +2 -0
  368. package/src/card/Card.css +2 -2
  369. package/src/carousel/Carousel.css +5 -5
  370. package/src/carousel/Carousel.less +3 -3
  371. package/src/circularButton/CircularButton.tsx +3 -2
  372. package/src/common/Option/Option.css +2 -4
  373. package/src/common/Option/Option.less +2 -4
  374. package/src/common/baseCard/BaseCard.css +1 -1
  375. package/src/common/bottomSheet/BottomSheet.tsx +2 -2
  376. package/src/common/circle/Circle.tsx +7 -3
  377. package/src/common/hooks/useLayout/useLayout.ts +1 -1
  378. package/src/common/hooks/useScreenSize.ts +1 -1
  379. package/src/common/index.ts +1 -1
  380. package/src/common/responsivePanel/ResponsivePanel.test.js +3 -2
  381. package/src/container/Container.css +3 -3
  382. package/src/criticalBanner/CriticalCommsBanner.css +1 -1
  383. package/src/dateInput/DateInput.css +1 -1
  384. package/src/dateLookup/DateLookup.tsx +1 -1
  385. package/src/decision/Decision.test.tsx +2 -1
  386. package/src/decision/Decision.tsx +2 -1
  387. package/src/definitionList/DefinitionList.css +2 -2
  388. package/src/definitionList/DefinitionList.less +2 -2
  389. package/src/drawer/Drawer.css +2 -2
  390. package/src/drawer/Drawer.less +4 -3
  391. package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +2 -0
  392. package/src/expressiveMoneyInput/ExpressiveMoneyInput.test.story.tsx +43 -0
  393. package/src/expressiveMoneyInput/amountInput/AmountInput.css +2 -0
  394. package/src/expressiveMoneyInput/amountInput/AmountInput.less +2 -0
  395. package/src/expressiveMoneyInput/amountInput/AmountInput.tsx +1 -1
  396. package/src/field/Field.css +19 -3
  397. package/src/field/Field.less +17 -3
  398. package/src/field/Field.messages.ts +8 -0
  399. package/src/field/Field.story.tsx +5 -1
  400. package/src/field/Field.test.tsx +90 -0
  401. package/src/field/Field.tsx +84 -37
  402. package/src/flowNavigation/FlowNavigation.css +1 -1
  403. package/src/flowNavigation/FlowNavigation.less +2 -1
  404. package/src/flowNavigation/FlowNavigation.story.tsx +6 -3
  405. package/src/flowNavigation/FlowNavigation.test.js +1 -1
  406. package/src/flowNavigation/FlowNavigation.tsx +2 -1
  407. package/src/i18n/en.json +1 -0
  408. package/src/index.ts +1 -1
  409. package/src/inputs/Input.css +3 -3
  410. package/src/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  411. package/src/inputs/SelectInput/SelectInput.css +2 -2
  412. package/src/inputs/SelectInput/SelectInput.tsx +1 -1
  413. package/src/inputs/TextArea.css +3 -3
  414. package/src/inputs/TextArea.story.tsx +97 -0
  415. package/src/inputs/TextArea.test.story.tsx +142 -0
  416. package/src/inputs/TextArea.tsx +7 -2
  417. package/src/inputs/contexts.tsx +18 -1
  418. package/src/logo/Logo.tsx +1 -1
  419. package/src/main.css +350 -402
  420. package/src/modal/Modal.css +7 -20
  421. package/src/modal/Modal.less +7 -19
  422. package/src/modal/Modal.tsx +2 -2
  423. package/src/overlayHeader/OverlayHeader.css +1 -1
  424. package/src/overlayHeader/OverlayHeader.less +3 -2
  425. package/src/popover/Popover.css +3 -3
  426. package/src/popover/Popover.test.tsx +2 -1
  427. package/src/promoCard/PromoCard.css +1 -1
  428. package/src/prompt/ActionPrompt/ActionPrompt.css +1 -1
  429. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
  430. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +37 -6
  431. package/src/prompt/ActionPrompt/ActionPrompt.tsx +3 -2
  432. package/src/prompt/CriticalBanner/CriticalBanner.css +1 -1
  433. package/src/prompt/CriticalBanner/CriticalBanner.less +2 -2
  434. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  435. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  436. package/src/select/Select.test.tsx +1 -1
  437. package/src/snackbar/Snackbar.css +2 -2
  438. package/src/statusIcon/StatusIcon.tsx +3 -2
  439. package/src/stepper/Stepper.css +2 -2
  440. package/src/styles/less/accordion.css +4 -4
  441. package/src/styles/less/addons/_display-utilities.less +13 -27
  442. package/src/styles/less/button-groups.css +6 -6
  443. package/src/styles/less/buttons.css +1 -1
  444. package/src/styles/less/circles.css +1 -1
  445. package/src/styles/less/column-layout.css +4 -4
  446. package/src/styles/less/core/_typography-utilities.less +10 -22
  447. package/src/styles/less/core/_typography.less +28 -6
  448. package/src/styles/less/decision.css +4 -4
  449. package/src/styles/less/dropdowns.css +10 -10
  450. package/src/styles/less/droppable.css +8 -8
  451. package/src/styles/less/flex.css +13 -15
  452. package/src/styles/less/flex.less +1 -3
  453. package/src/styles/less/footer.css +3 -3
  454. package/src/styles/less/forms/bootstrap-forms.css +9 -9
  455. package/src/styles/less/forms/bootstrap-forms.less +1 -1
  456. package/src/styles/less/grid.css +19 -19
  457. package/src/styles/less/input-groups.css +12 -12
  458. package/src/styles/less/list-group.css +8 -8
  459. package/src/styles/less/modals.css +6 -6
  460. package/src/styles/less/modals.less +4 -4
  461. package/src/styles/less/navbar.css +62 -62
  462. package/src/styles/less/navbar.less +2 -2
  463. package/src/styles/less/navs.css +2 -2
  464. package/src/styles/less/neptune.bundle.less +1 -0
  465. package/src/styles/less/neptune.css +274 -328
  466. package/src/styles/less/panels.css +9 -9
  467. package/src/styles/less/popovers.css +13 -13
  468. package/src/styles/less/popovers.less +6 -6
  469. package/src/styles/less/select.css +1 -1
  470. package/src/styles/less/sequences.css +6 -6
  471. package/src/styles/less/table.css +6 -6
  472. package/src/styles/less/table.less +1 -1
  473. package/src/styles/less/utilities.css +8 -20
  474. package/src/styles/less/utilities.less +6 -14
  475. package/src/styles/less/wells.css +4 -18
  476. package/src/styles/less/wells.less +3 -5
  477. package/src/styles/props/custom-media.css +1 -11
  478. package/src/styles/variables/legacy-variables.less +4 -47
  479. package/src/table/Table.css +1 -1
  480. package/src/tabs/Tabs.css +2 -2
  481. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -0
  482. package/src/typeahead/Typeahead.css +1 -1
  483. package/src/uploadInput/uploadItem/UploadItem.less +2 -2
  484. package/build/common/propsValues/breakpoint.js +0 -12
  485. package/build/common/propsValues/breakpoint.js.map +0 -1
  486. package/build/common/propsValues/breakpoint.mjs +0 -12
  487. package/build/common/propsValues/breakpoint.mjs.map +0 -1
  488. package/build/types/common/propsValues/breakpoint.d.ts +0 -9
  489. package/build/types/common/propsValues/breakpoint.d.ts.map +0 -1
  490. package/src/common/propsValues/breakpoint.ts +0 -8
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var clsx = require('clsx');
6
6
  require('../common/theme.js');
7
7
  require('../common/direction.js');
8
+ require('@transferwise/neptune-tokens');
8
9
  require('../common/propsValues/control.js');
9
- require('../common/propsValues/breakpoint.js');
10
10
  require('../common/propsValues/size.js');
11
11
  var typography = require('../common/propsValues/typography.js');
12
12
  require('../common/propsValues/width.js');
@@ -1,8 +1,8 @@
1
1
  import { clsx } from 'clsx';
2
2
  import '../common/theme.mjs';
3
3
  import '../common/direction.mjs';
4
+ import '@transferwise/neptune-tokens';
4
5
  import '../common/propsValues/control.mjs';
5
- import '../common/propsValues/breakpoint.mjs';
6
6
  import '../common/propsValues/size.mjs';
7
7
  import { Typography } from '../common/propsValues/typography.mjs';
8
8
  import '../common/propsValues/width.mjs';
@@ -6,8 +6,8 @@ var clsx = require('clsx');
6
6
  var React = require('react');
7
7
  require('../common/theme.js');
8
8
  require('../common/direction.js');
9
+ require('@transferwise/neptune-tokens');
9
10
  require('../common/propsValues/control.js');
10
- require('../common/propsValues/breakpoint.js');
11
11
  require('../common/propsValues/size.js');
12
12
  var typography = require('../common/propsValues/typography.js');
13
13
  require('../common/propsValues/width.js');
@@ -2,8 +2,8 @@ import { clsx } from 'clsx';
2
2
  import { useId, useContext } from 'react';
3
3
  import '../common/theme.mjs';
4
4
  import '../common/direction.mjs';
5
+ import '@transferwise/neptune-tokens';
5
6
  import '../common/propsValues/control.mjs';
6
- import '../common/propsValues/breakpoint.mjs';
7
7
  import '../common/propsValues/size.mjs';
8
8
  import { Typography } from '../common/propsValues/typography.mjs';
9
9
  import '../common/propsValues/width.mjs';
@@ -231,7 +231,7 @@ const AmountInput = ({
231
231
  return /*#__PURE__*/jsxRuntime.jsx("div", {
232
232
  className: "wds-amount-input-container",
233
233
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
234
- className: clsx.clsx('wds-amount-input-input-container', 'np-text-display-large'),
234
+ className: clsx.clsx('wds-amount-input-input-container', 'np-text-display-large--forced'),
235
235
  style: style,
236
236
  children: [/*#__PURE__*/jsxRuntime.jsx("input", {
237
237
  ref: ref,
@@ -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 'framer-motion';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Props as 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 Props = {\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}: Props) => {\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\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large')}\n style={style}\n >\n <input\n ref={ref}\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","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,CACD,KAAI;AACV,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;AAChC,IAAA,OAAOC,0BAAoB,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,aAAO,CAAC,MAAK;AACzC,IAAA,OAAOL,wBAAkB,CAAC;MACxBH,KAAK,EAAEO,YAAY,IAAI,CA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EAAA;EAEA,MAAM,CAACzB,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIgF,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 'framer-motion';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Props as 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 Props = {\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}: Props) => {\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\">\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 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","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,CACD,KAAI;AACV,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;AAChC,IAAA,OAAOC,0BAAoB,CAAC;MAC1BT,KAAK;MACLZ,QAAQ;MACRgB,MAAM,EAAEX,IAAI,CAACW;AACd,KAAA,CAAC;EACJ,CAAC,EAAE,CAACJ,KAAK,EAAEZ,QAAQ,EAAEK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ED,MAAMa,cAAc,GAAGA,CAACxB,KAAa,EAAEmB,gBAA+B,KAAI;AACxE,EAAA,IAAI,CAACnB,KAAK,IAAI,CAACmB,gBAAgB,EAAE;AAC/B,IAAA,OAAOoF,SAAS;AAClB,EAAA;EAEA,MAAM,CAACzB,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIgF,SAAS;AACjC,CAAC;;;;"}
@@ -229,7 +229,7 @@ const AmountInput = ({
229
229
  return /*#__PURE__*/jsx("div", {
230
230
  className: "wds-amount-input-container",
231
231
  children: /*#__PURE__*/jsxs("div", {
232
- className: clsx('wds-amount-input-input-container', 'np-text-display-large'),
232
+ className: clsx('wds-amount-input-input-container', 'np-text-display-large--forced'),
233
233
  style: style,
234
234
  children: [/*#__PURE__*/jsx("input", {
235
235
  ref: ref,
@@ -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 'framer-motion';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Props as 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 Props = {\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}: Props) => {\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\">\n <div\n className={clsx('wds-amount-input-input-container', 'np-text-display-large')}\n style={style}\n >\n <input\n ref={ref}\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","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,CACD,KAAI;AACV,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,M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EAAEG,IAAI,CACb,8BAA8B,EAC9B1F,WAAW,IAAI,oCAAoC,CACnD;UACFwG,OAAO,EAAEA,MAAMzF,GAAG,CAACE,OAAO,EAAEnB,KAAK,EAAG;AAAA0F,UAAAA,QAAA,EAEnCV;SACa;AACjB,OACc,CACnB;KAAK;AACP,GAAK,CAAC;AAEV;AAEA,MAAM3D,cAAc,GAAGA,CAAC5B,QAAgB,EAAEgB,MAAc,KAAI;AAC1D,EAAA,OAAOkG,YAAY,CAAC,CAAC,EAAElH,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,OAAOoF,SAAS;AAClB,EAAA;EAEA,MAAM,CAACzB,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIgF,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 'framer-motion';\nimport { type ChangeEvent, type KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Props as 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 Props = {\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}: Props) => {\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\">\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 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","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,CACD,KAAI;AACV,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;EACtB,MAAM;IAAEC,KAAK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AACe,eAAe,EAAA;AAACC,QAAAA,OAAO,EAAE,KAAM;AAAAd,QAAAA,QAAA,EAC7BV,YAAY,KAAK,IAAI,iBACpBQ,GAAA,CAACiB,cAAc,EAAA;UACbhB,SAAS,EAAEG,IAAI,CACb,8BAA8B,EAC9B1F,WAAW,IAAI,oCAAoC,CACnD;UACFwG,OAAO,EAAEA,MAAMzF,GAAG,CAACE,OAAO,EAAEnB,KAAK,EAAG;AAAA0F,UAAAA,QAAA,EAEnCV;SACa;AACjB,OACc,CACnB;KAAK;AACP,GAAK,CAAC;AAEV;AAEA,MAAM3D,cAAc,GAAGA,CAAC5B,QAAgB,EAAEgB,MAAc,KAAI;AAC1D,EAAA,OAAOkG,YAAY,CAAC,CAAC,EAAElH,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,OAAOoF,SAAS;AAClB,EAAA;EAEA,MAAM,CAACzB,CAAC,EAAEvD,WAAW,CAAC,GAAGvB,KAAK,CAACoE,KAAK,CAACjD,gBAAgB,CAAC;EACtD,OAAOI,WAAW,IAAIgF,SAAS;AACjC,CAAC;;;;"}
@@ -16,8 +16,8 @@ require('../../header/Header.js');
16
16
  require('virtua');
17
17
  require('../../common/theme.js');
18
18
  require('../../common/direction.js');
19
+ require('@transferwise/neptune-tokens');
19
20
  require('../../common/propsValues/control.js');
20
- require('../../common/propsValues/breakpoint.js');
21
21
  require('../../common/propsValues/size.js');
22
22
  require('../../common/propsValues/typography.js');
23
23
  require('../../common/propsValues/width.js');
@@ -14,8 +14,8 @@ import '../../header/Header.mjs';
14
14
  import 'virtua';
15
15
  import '../../common/theme.mjs';
16
16
  import '../../common/direction.mjs';
17
+ import '@transferwise/neptune-tokens';
17
18
  import '../../common/propsValues/control.mjs';
18
- import '../../common/propsValues/breakpoint.mjs';
19
19
  import '../../common/propsValues/size.mjs';
20
20
  import '../../common/propsValues/typography.mjs';
21
21
  import '../../common/propsValues/width.mjs';
@@ -2,10 +2,12 @@
2
2
 
3
3
  var clsx = require('clsx');
4
4
  var React = require('react');
5
+ var reactIntl = require('react-intl');
6
+ var Body = require('../body/Body.js');
5
7
  require('../common/theme.js');
6
8
  require('../common/direction.js');
9
+ require('@transferwise/neptune-tokens');
7
10
  require('../common/propsValues/control.js');
8
- require('../common/propsValues/breakpoint.js');
9
11
  require('../common/propsValues/size.js');
10
12
  require('../common/propsValues/typography.js');
11
13
  require('../common/propsValues/width.js');
@@ -23,11 +25,10 @@ require('../common/propsValues/markdownNodeType.js');
23
25
  require('../common/fileType.js');
24
26
  require('@transferwise/formatting');
25
27
  require('@transferwise/icons');
26
- require('react-intl');
27
28
  require('../common/closeButton/CloseButton.messages.js');
28
29
  var jsxRuntime = require('react/jsx-runtime');
30
+ var Field_messages = require('./Field.messages.js');
29
31
  var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
30
- require('../body/Body.js');
31
32
  require('../button/Button.resolver.js');
32
33
  require('../prompt/PrimitivePrompt/PrimitivePrompt.js');
33
34
  require('../badge/Badge.js');
@@ -56,6 +57,9 @@ const Field = ({
56
57
  children,
57
58
  ...props
58
59
  }) => {
60
+ const {
61
+ formatMessage
62
+ } = reactIntl.useIntl();
59
63
  const labelRef = React.useRef(null);
60
64
  const sentiment$1 = props.error ? sentiment.Sentiment.NEGATIVE : propType;
61
65
  const message = propMessage || props.error;
@@ -65,6 +69,10 @@ const Field = ({
65
69
  const inputId = id !== null ? id ?? fallbackInputId : undefined;
66
70
  const messageId = React.useId();
67
71
  const descriptionId = React.useId();
72
+ const textareaCharCounterId = React.useId();
73
+ const [textareaCharacterCount, setTextareaCharacterCount] = React.useState(null);
74
+ const handleTextareaCharacterCount = React.useCallback(state => setTextareaCharacterCount(state), []);
75
+ const isNearCharLimit = textareaCharacterCount != null && textareaCharacterCount.current >= textareaCharacterCount.max * 0.8;
68
76
  /**
69
77
  * form control can have multiple messages to describe it,
70
78
  * e.g the description underneath the label and inline alert
@@ -77,6 +85,9 @@ const Field = ({
77
85
  if (message) {
78
86
  messageIds.push(messageId);
79
87
  }
88
+ if (textareaCharacterCount) {
89
+ messageIds.push(textareaCharCounterId);
90
+ }
80
91
  return messageIds.length > 0 ? messageIds.join(' ') : undefined;
81
92
  }
82
93
  return /*#__PURE__*/jsxRuntime.jsx(contexts.FieldLabelContextProvider, {
@@ -90,37 +101,57 @@ const Field = ({
90
101
  value: ariaDescribedbyByIds(),
91
102
  children: /*#__PURE__*/jsxRuntime.jsx(contexts.InputInvalidProvider, {
92
103
  value: hasError,
93
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
94
- className: clsx.clsx('np-field form-group d-block', {
95
- 'has-success': sentiment$1 === sentiment.Sentiment.POSITIVE,
96
- 'has-warning': sentiment$1 === sentiment.Sentiment.WARNING,
97
- 'has-error': hasError,
98
- 'has-info': sentiment$1 === sentiment.Sentiment.NEUTRAL
99
- }, className),
100
- children: [label != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
101
- children: [/*#__PURE__*/jsxRuntime.jsx(Label.Label, {
102
- ref: labelRef,
103
- id: labelId,
104
- htmlFor: inputId,
105
- children: required ? label : /*#__PURE__*/jsxRuntime.jsx(Label.Label.Optional, {
106
- children: label
107
- })
108
- }), /*#__PURE__*/jsxRuntime.jsx(Label.Label.Description, {
109
- id: descriptionId,
110
- children: description
111
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
112
- className: "np-field-control",
113
- children: children
104
+ children: /*#__PURE__*/jsxRuntime.jsx(contexts.TextareaCharacterCountProvider, {
105
+ value: handleTextareaCharacterCount,
106
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
107
+ className: clsx.clsx('np-field form-group d-block', {
108
+ 'has-success': sentiment$1 === sentiment.Sentiment.POSITIVE,
109
+ 'has-warning': sentiment$1 === sentiment.Sentiment.WARNING,
110
+ 'has-error': hasError,
111
+ 'has-info': sentiment$1 === sentiment.Sentiment.NEUTRAL
112
+ }, className),
113
+ children: [label != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
114
+ children: [/*#__PURE__*/jsxRuntime.jsx(Label.Label, {
115
+ ref: labelRef,
116
+ id: labelId,
117
+ htmlFor: inputId,
118
+ children: required ? label : /*#__PURE__*/jsxRuntime.jsx(Label.Label.Optional, {
119
+ children: label
120
+ })
121
+ }), /*#__PURE__*/jsxRuntime.jsx(Label.Label.Description, {
122
+ id: descriptionId,
123
+ children: description
124
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
125
+ className: "np-field-control",
126
+ children: children
127
+ })]
128
+ }) : children, (message || textareaCharacterCount) && /*#__PURE__*/jsxRuntime.jsxs("div", {
129
+ className: "np-field-validation",
130
+ children: [message && /*#__PURE__*/jsxRuntime.jsx(InlinePrompt.InlinePrompt, {
131
+ sentiment: sentiment$1,
132
+ id: messageId,
133
+ mediaLabel: messageIconLabel,
134
+ className: "np-field__prompt",
135
+ loading: messageLoading,
136
+ width: "full",
137
+ children: message
138
+ }), textareaCharacterCount && /*#__PURE__*/jsxRuntime.jsxs(Body.default, {
139
+ as: "span",
140
+ id: textareaCharCounterId,
141
+ ...(isNearCharLimit ? {
142
+ role: 'status',
143
+ 'aria-live': 'polite',
144
+ 'aria-atomic': 'true'
145
+ } : {}),
146
+ "aria-label": formatMessage(Field_messages.default.characterCount, {
147
+ current: textareaCharacterCount.current,
148
+ max: textareaCharacterCount.max
149
+ }),
150
+ className: "np-field-textarea-char-counter",
151
+ children: [textareaCharacterCount.current, "/", textareaCharacterCount.max]
152
+ })]
114
153
  })]
115
- }) : children, message && /*#__PURE__*/jsxRuntime.jsx(InlinePrompt.InlinePrompt, {
116
- sentiment: sentiment$1,
117
- id: messageId,
118
- mediaLabel: messageIconLabel,
119
- className: "np-field__prompt",
120
- loading: messageLoading,
121
- width: "full",
122
- children: message
123
- })]
154
+ })
124
155
  })
125
156
  })
126
157
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n /** @default true */\n required?: boolean;\n /** @deprecated Use `description` prop instead. */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n * @default false\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated Use `message` and `type={Sentiment.NEGATIVE}` prop instead. */\n error?: React.ReactNode;\n /** @default Sentiment.NEUTRAL */\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAA,QAAA,EAAEN;eAA+B,CACtE,eAAAyB,cAAA,CAAA,KAAA,EAAA;AAAKpB,gBAAAA,SAAS,EAAC,kBAAkB;AAAAC,gBAAAA,QAAA,EAAEA;AAAQ,eAAM,CACnD;aAAA,CAAG,GAEHA,QACD,EAEAX,OAAO,iBACN8B,cAAA,CAACgB,yBAAY,EAAA;AACXxC,cAAAA,SAAS,EAAEA,WAAU;AACrBT,cAAAA,EAAE,EAAE0B,SAAU;AACdwB,cAAAA,UAAU,EAAE7C,gBAAiB;AAC7BQ,cAAAA,SAAS,EAAC,kBAAkB;AAC5BsC,cAAAA,OAAO,EAAE7C,cAAe;AACxB8C,cAAAA,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useCallback, useId, useRef, useState } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport Body from '../body';\nimport { Sentiment } from '../common';\nimport messages from './Field.messages';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n TextareaCharacterCountProvider,\n type TextareaCharacterCountState,\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n /** @default true */\n required?: boolean;\n /** @deprecated Use `description` prop instead. */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n * @default false\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated Use `message` and `type={Sentiment.NEGATIVE}` prop instead. */\n error?: React.ReactNode;\n /** @default Sentiment.NEUTRAL */\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const { formatMessage } = useIntl();\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n const textareaCharCounterId = useId();\n\n const [textareaCharacterCount, setTextareaCharacterCount] =\n useState<TextareaCharacterCountState>(null);\n const handleTextareaCharacterCount = useCallback(\n (state: TextareaCharacterCountState) => setTextareaCharacterCount(state),\n [],\n );\n\n const isNearCharLimit =\n textareaCharacterCount != null &&\n textareaCharacterCount.current >= textareaCharacterCount.max * 0.8;\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n if (textareaCharacterCount) {\n messageIds.push(textareaCharCounterId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <TextareaCharacterCountProvider value={handleTextareaCharacterCount}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {(message || textareaCharacterCount) && (\n <div className=\"np-field-validation\">\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n {textareaCharacterCount && (\n <Body\n as=\"span\"\n id={textareaCharCounterId}\n {...(isNearCharLimit\n ? {\n role: 'status' as const,\n 'aria-live': 'polite' as const,\n 'aria-atomic': 'true' as const,\n }\n : {})}\n aria-label={formatMessage(messages.characterCount, {\n current: textareaCharacterCount.current,\n max: textareaCharacterCount.max,\n })}\n className=\"np-field-textarea-char-counter\"\n >\n {textareaCharacterCount.current}/{textareaCharacterCount.max}\n </Body>\n )}\n </div>\n )}\n </div>\n </TextareaCharacterCountProvider>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","formatMessage","useIntl","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","textareaCharCounterId","textareaCharacterCount","setTextareaCharacterCount","useState","handleTextareaCharacterCount","useCallback","state","isNearCharLimit","current","max","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","TextareaCharacterCountProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width","Body","as","role","messages","characterCount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,mBAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;EACf,MAAM;AAAEC,IAAAA;GAAe,GAAGC,iBAAO,EAAE;AACnC,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMV,WAAS,GAAGM,KAAK,CAACK,KAAK,GAAGT,mBAAS,CAACU,QAAQ,GAAGX,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACK,KAAK;AAC1C,EAAA,MAAME,QAAQ,GAAGb,WAAS,KAAKE,mBAAS,CAACU,QAAQ;AAEjD,EAAA,MAAME,OAAO,GAAGC,WAAK,EAAE;AAEvB,EAAA,MAAMC,eAAe,GAAGD,WAAK,EAAE;EAC/B,MAAME,OAAO,GAAG1B,EAAE,KAAK,IAAI,GAAIA,EAAE,IAAIyB,eAAe,GAAIE,SAAS;AAEjE,EAAA,MAAMC,SAAS,GAAGJ,WAAK,EAAE;AACzB,EAAA,MAAMK,aAAa,GAAGL,WAAK,EAAE;AAC7B,EAAA,MAAMM,qBAAqB,GAAGN,WAAK,EAAE;EAErC,MAAM,CAACO,sBAAsB,EAAEC,yBAAyB,CAAC,GACvDC,cAAQ,CAA8B,IAAI,CAAC;AAC7C,EAAA,MAAMC,4BAA4B,GAAGC,iBAAW,CA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C,kBAAkB;AAC5BmD,kBAAAA,OAAO,EAAE1D,cAAe;AACxB2D,kBAAAA,KAAK,EAAC,MAAM;AAAAnD,kBAAAA,QAAA,EAEXX;AAAO,iBACI,CACf,EACA4B,sBAAsB,iBACrBsB,eAAA,CAACa,YAAI,EAAA;AACHC,kBAAAA,EAAE,EAAC,MAAM;AACTnE,kBAAAA,EAAE,EAAE8B,qBAAsB;AAAA,kBAAA,IACrBO,eAAe,GAChB;AACE+B,oBAAAA,IAAI,EAAE,QAAiB;AACvB,oBAAA,WAAW,EAAE,QAAiB;AAC9B,oBAAA,aAAa,EAAE;mBAChB,GACD,EAAE,CAAA;AACN,kBAAA,YAAA,EAAYpD,aAAa,CAACqD,sBAAQ,CAACC,cAAc,EAAE;oBACjDhC,OAAO,EAAEP,sBAAsB,CAACO,OAAO;oBACvCC,GAAG,EAAER,sBAAsB,CAACQ;AAC7B,mBAAA,CAAE;AACH1B,kBAAAA,SAAS,EAAC,gCAAgC;kBAAAC,QAAA,EAAA,CAEzCiB,sBAAsB,CAACO,OAAO,EAAC,GAAC,EAACP,sBAAsB,CAACQ,GAAG;AAAA,iBACxD,CACP;AAAA,eACE,CACN;aACE;WACyB;SACZ;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var reactIntl = require('react-intl');
6
+
7
+ var messages = reactIntl.defineMessages({
8
+ characterCount: {
9
+ id: "neptune.Field.characterCount"
10
+ }
11
+ });
12
+
13
+ exports.default = messages;
14
+ //# sourceMappingURL=Field.messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.messages.js","sources":["../../src/field/Field.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n characterCount: {\n id: 'neptune.Field.characterCount',\n defaultMessage: '{current} of {max} characters used',\n },\n});\n"],"names":["defineMessages","characterCount","id"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,cAAc,EAAE;IACdC,EAAE,EAAA;AAEH;AACF,CAAA,CAAC;;;;"}
@@ -0,0 +1,10 @@
1
+ import { defineMessages } from 'react-intl';
2
+
3
+ var messages = defineMessages({
4
+ characterCount: {
5
+ id: "neptune.Field.characterCount"
6
+ }
7
+ });
8
+
9
+ export { messages as default };
10
+ //# sourceMappingURL=Field.messages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.messages.mjs","sources":["../../src/field/Field.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n characterCount: {\n id: 'neptune.Field.characterCount',\n defaultMessage: '{current} of {max} characters used',\n },\n});\n"],"names":["defineMessages","characterCount","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,cAAc,EAAE;IACdC,EAAE,EAAA;AAEH;AACF,CAAA,CAAC;;;;"}