@transferwise/components 46.37.0 → 46.39.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 (369) hide show
  1. package/README.md +1 -1
  2. package/build/index.js +179 -357
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +173 -350
  5. package/build/index.mjs.map +1 -1
  6. package/build/main.css +127 -108
  7. package/build/styles/main.css +127 -108
  8. package/build/styles/uploadInput/UploadInput.css +25 -27
  9. package/build/styles/uploadInput/uploadButton/UploadButton.css +24 -38
  10. package/build/styles/uploadInput/uploadItem/UploadItem.css +81 -46
  11. package/build/types/actionButton/ActionButton.d.ts +2 -2
  12. package/build/types/actionButton/ActionButton.d.ts.map +1 -1
  13. package/build/types/actionOption/ActionOption.d.ts +0 -1
  14. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  15. package/build/types/alert/Alert.d.ts +0 -1
  16. package/build/types/alert/Alert.d.ts.map +1 -1
  17. package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts +4 -11
  18. package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts.map +1 -1
  19. package/build/types/alert/inlineMarkdown/index.d.ts +2 -1
  20. package/build/types/alert/inlineMarkdown/index.d.ts.map +1 -1
  21. package/build/types/avatar/Avatar.d.ts +0 -1
  22. package/build/types/avatar/Avatar.d.ts.map +1 -1
  23. package/build/types/avatar/colors/colors.d.ts.map +1 -1
  24. package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -1
  25. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  26. package/build/types/body/Body.d.ts +2 -2
  27. package/build/types/body/Body.d.ts.map +1 -1
  28. package/build/types/button/Button.d.ts +0 -1
  29. package/build/types/button/Button.d.ts.map +1 -1
  30. package/build/types/button/Button.messages.d.ts +3 -3
  31. package/build/types/button/classMap.d.ts +6 -6
  32. package/build/types/card/Card.d.ts +16 -20
  33. package/build/types/card/Card.d.ts.map +1 -1
  34. package/build/types/card/index.d.ts +2 -1
  35. package/build/types/card/index.d.ts.map +1 -1
  36. package/build/types/checkbox/Checkbox.d.ts +15 -20
  37. package/build/types/checkbox/Checkbox.d.ts.map +1 -1
  38. package/build/types/checkbox/index.d.ts +2 -2
  39. package/build/types/checkbox/index.d.ts.map +1 -1
  40. package/build/types/checkboxOption/CheckboxOption.d.ts +2 -3
  41. package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
  42. package/build/types/chevron/Chevron.d.ts +0 -1
  43. package/build/types/chevron/Chevron.d.ts.map +1 -1
  44. package/build/types/chips/Chip.d.ts +0 -1
  45. package/build/types/chips/Chip.d.ts.map +1 -1
  46. package/build/types/chips/Chips.d.ts +0 -1
  47. package/build/types/chips/Chips.d.ts.map +1 -1
  48. package/build/types/circularButton/CircularButton.d.ts +0 -1
  49. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  50. package/build/types/common/RadioButton/RadioButton.d.ts +0 -1
  51. package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
  52. package/build/types/common/action/Action.d.ts +0 -1
  53. package/build/types/common/action/Action.d.ts.map +1 -1
  54. package/build/types/common/closeButton/CloseButton.d.ts +4 -5
  55. package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
  56. package/build/types/common/commonProps.d.ts +0 -1
  57. package/build/types/common/commonProps.d.ts.map +1 -1
  58. package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts +1 -1
  59. package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
  60. package/build/types/common/focusBoundary/FocusBoundary.d.ts +0 -1
  61. package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
  62. package/build/types/common/hooks/useDirection/useDirection.d.ts.map +1 -1
  63. package/build/types/common/hooks/useResizeObserver.d.ts +0 -1
  64. package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
  65. package/build/types/common/panel/Panel.d.ts +8 -8
  66. package/build/types/common/panel/Panel.d.ts.map +1 -1
  67. package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +0 -1
  68. package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
  69. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +8 -9
  70. package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
  71. package/build/types/criticalBanner/CriticalCommsBanner.d.ts +0 -1
  72. package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
  73. package/build/types/dateInput/DateInput.d.ts +0 -1
  74. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  75. package/build/types/dateLookup/DateLookup.d.ts +1 -1
  76. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  77. package/build/types/dateLookup/dateHeader/DateHeader.d.ts +0 -1
  78. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  79. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +0 -1
  80. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
  81. package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts +0 -1
  82. package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -1
  83. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +0 -1
  84. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
  85. package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts +0 -1
  86. package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -1
  87. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +0 -1
  88. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  89. package/build/types/dateLookup/tableLink/TableLink.d.ts +0 -1
  90. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  91. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +0 -1
  92. package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
  93. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts +0 -1
  94. package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
  95. package/build/types/decision/Decision.d.ts +1 -2
  96. package/build/types/decision/Decision.d.ts.map +1 -1
  97. package/build/types/definitionList/DefinitionList.d.ts +19 -24
  98. package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
  99. package/build/types/definitionList/index.d.ts +2 -1
  100. package/build/types/definitionList/index.d.ts.map +1 -1
  101. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  102. package/build/types/drawer/Drawer.d.ts +18 -36
  103. package/build/types/drawer/Drawer.d.ts.map +1 -1
  104. package/build/types/drawer/index.d.ts +2 -1
  105. package/build/types/drawer/index.d.ts.map +1 -1
  106. package/build/types/dropFade/DropFade.d.ts.map +1 -1
  107. package/build/types/emphasis/Emphasis.d.ts +0 -1
  108. package/build/types/emphasis/Emphasis.d.ts.map +1 -1
  109. package/build/types/field/Field.d.ts +0 -1
  110. package/build/types/field/Field.d.ts.map +1 -1
  111. package/build/types/flowNavigation/FlowNavigation.d.ts +0 -1
  112. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  113. package/build/types/flowNavigation/backButton/BackButton.d.ts +5 -17
  114. package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
  115. package/build/types/flowNavigation/backButton/index.d.ts +2 -2
  116. package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
  117. package/build/types/header/Header.d.ts +0 -1
  118. package/build/types/header/Header.d.ts.map +1 -1
  119. package/build/types/image/Image.d.ts +0 -1
  120. package/build/types/image/Image.d.ts.map +1 -1
  121. package/build/types/index.d.ts +5 -0
  122. package/build/types/index.d.ts.map +1 -1
  123. package/build/types/info/Info.d.ts +2 -3
  124. package/build/types/info/Info.d.ts.map +1 -1
  125. package/build/types/info/index.d.ts +1 -1
  126. package/build/types/info/index.d.ts.map +1 -1
  127. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +0 -1
  128. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
  129. package/build/types/inputs/Input.d.ts +0 -1
  130. package/build/types/inputs/Input.d.ts.map +1 -1
  131. package/build/types/inputs/InputGroup.d.ts +0 -1
  132. package/build/types/inputs/InputGroup.d.ts.map +1 -1
  133. package/build/types/inputs/SearchInput.d.ts +0 -1
  134. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  135. package/build/types/inputs/SelectInput.d.ts +0 -1
  136. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  137. package/build/types/inputs/TextArea.d.ts +0 -1
  138. package/build/types/inputs/TextArea.d.ts.map +1 -1
  139. package/build/types/inputs/_BottomSheet.d.ts +0 -1
  140. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  141. package/build/types/inputs/_ButtonInput.d.ts +0 -1
  142. package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
  143. package/build/types/inputs/_Popover.d.ts +0 -1
  144. package/build/types/inputs/_Popover.d.ts.map +1 -1
  145. package/build/types/inputs/contexts.d.ts +0 -1
  146. package/build/types/inputs/contexts.d.ts.map +1 -1
  147. package/build/types/label/Label.d.ts +0 -1
  148. package/build/types/label/Label.d.ts.map +1 -1
  149. package/build/types/loader/Loader.d.ts +0 -1
  150. package/build/types/loader/Loader.d.ts.map +1 -1
  151. package/build/types/logo/Logo.d.ts +15 -23
  152. package/build/types/logo/Logo.d.ts.map +1 -1
  153. package/build/types/logo/index.d.ts +1 -2
  154. package/build/types/logo/index.d.ts.map +1 -1
  155. package/build/types/markdown/Markdown.d.ts +0 -1
  156. package/build/types/markdown/Markdown.d.ts.map +1 -1
  157. package/build/types/money/Money.d.ts +0 -1
  158. package/build/types/money/Money.d.ts.map +1 -1
  159. package/build/types/moneyInput/MoneyInput.d.ts +0 -1
  160. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  161. package/build/types/navigationOption/NavigationOption.d.ts +0 -1
  162. package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
  163. package/build/types/overlayHeader/OverlayHeader.d.ts +9 -18
  164. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  165. package/build/types/overlayHeader/index.d.ts +2 -1
  166. package/build/types/overlayHeader/index.d.ts.map +1 -1
  167. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +0 -1
  168. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  169. package/build/types/popover/Popover.d.ts +0 -1
  170. package/build/types/popover/Popover.d.ts.map +1 -1
  171. package/build/types/progress/Progress.d.ts +0 -1
  172. package/build/types/progress/Progress.d.ts.map +1 -1
  173. package/build/types/progressBar/ProgressBar.d.ts +0 -1
  174. package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
  175. package/build/types/provider/Provider.d.ts +0 -1
  176. package/build/types/provider/Provider.d.ts.map +1 -1
  177. package/build/types/radio/Radio.d.ts +0 -1
  178. package/build/types/radio/Radio.d.ts.map +1 -1
  179. package/build/types/radioGroup/RadioGroup.d.ts +0 -1
  180. package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
  181. package/build/types/radioOption/RadioOption.d.ts +0 -1
  182. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  183. package/build/types/segmentedControl/SegmentedControl.d.ts +0 -1
  184. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  185. package/build/types/select/index.d.ts +1 -1
  186. package/build/types/select/index.d.ts.map +1 -1
  187. package/build/types/select/option/index.d.ts +1 -1
  188. package/build/types/select/option/index.d.ts.map +1 -1
  189. package/build/types/select/searchBox/SearchBox.d.ts +3 -3
  190. package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
  191. package/build/types/slidingPanel/SlidingPanel.d.ts +1 -1
  192. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  193. package/build/types/snackbar/Snackbar.d.ts +2 -1
  194. package/build/types/snackbar/Snackbar.d.ts.map +1 -1
  195. package/build/types/snackbar/SnackbarContext.d.ts +0 -1
  196. package/build/types/snackbar/SnackbarContext.d.ts.map +1 -1
  197. package/build/types/snackbar/SnackbarProvider.d.ts +0 -1
  198. package/build/types/snackbar/SnackbarProvider.d.ts.map +1 -1
  199. package/build/types/statusIcon/StatusIcon.d.ts +0 -1
  200. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  201. package/build/types/sticky/Sticky.d.ts +32 -4
  202. package/build/types/sticky/Sticky.d.ts.map +1 -1
  203. package/build/types/switchOption/SwitchOption.d.ts +0 -1
  204. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  205. package/build/types/tabs/TabList.d.ts +1 -1
  206. package/build/types/tabs/TabPanel.d.ts +4 -4
  207. package/build/types/tabs/Tabs.d.ts.map +1 -1
  208. package/build/types/test-utils/story-config.d.ts +8 -0
  209. package/build/types/test-utils/story-config.d.ts.map +1 -1
  210. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +0 -1
  211. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
  212. package/build/types/tile/Tile.d.ts +16 -37
  213. package/build/types/tile/Tile.d.ts.map +1 -1
  214. package/build/types/tile/index.d.ts +1 -1
  215. package/build/types/tile/index.d.ts.map +1 -1
  216. package/build/types/typeahead/Typeahead.d.ts.map +1 -1
  217. package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts +0 -1
  218. package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts.map +1 -1
  219. package/build/types/typeahead/util/highlight.d.ts +0 -1
  220. package/build/types/typeahead/util/highlight.d.ts.map +1 -1
  221. package/build/types/upload/Upload.d.ts.map +1 -1
  222. package/build/types/upload/Upload.messages.d.ts +20 -20
  223. package/build/types/upload/steps/completeStep/completeStep.d.ts +10 -10
  224. package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts +8 -8
  225. package/build/types/upload/steps/processingStep/processingStep.d.ts +8 -8
  226. package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts +9 -9
  227. package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
  228. package/build/types/uploadInput/UploadInput.d.ts +0 -1
  229. package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
  230. package/build/types/uploadInput/types.d.ts +9 -1
  231. package/build/types/uploadInput/types.d.ts.map +1 -1
  232. package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -6
  233. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  234. package/build/types/uploadInput/uploadItem/UploadItem.d.ts +0 -1
  235. package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
  236. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  237. package/build/types/withNextPortal/withNextPortal.d.ts +0 -1
  238. package/build/types/withNextPortal/withNextPortal.d.ts.map +1 -1
  239. package/package.json +24 -27
  240. package/src/accordion/Accordion.spec.js +5 -5
  241. package/src/accordion/AccordionItem/AccordionItem.spec.js +2 -2
  242. package/src/actionButton/ActionButton.spec.tsx +4 -5
  243. package/src/alert/Alert.spec.tsx +4 -4
  244. package/src/alert/Alert.story.tsx +6 -5
  245. package/src/alert/inlineMarkdown/InlineMarkdown.tsx +13 -0
  246. package/src/alert/inlineMarkdown/index.ts +2 -0
  247. package/src/button/Button.spec.js +4 -5
  248. package/src/card/{Card.spec.js → Card.spec.tsx} +4 -4
  249. package/src/card/{Card.story.js → Card.story.tsx} +6 -15
  250. package/src/card/{Card.js → Card.tsx} +23 -34
  251. package/src/card/index.ts +2 -0
  252. package/src/carousel/Carousel.spec.tsx +17 -17
  253. package/src/checkbox/{Checkbox.spec.js → Checkbox.spec.tsx} +5 -7
  254. package/src/checkbox/{Checkbox.js → Checkbox.tsx} +19 -41
  255. package/src/checkbox/index.ts +2 -0
  256. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -2
  257. package/src/checkboxOption/CheckboxOption.spec.tsx +0 -2
  258. package/src/chevron/Chevron.spec.tsx +0 -1
  259. package/src/chips/Chips.spec.tsx +0 -1
  260. package/src/chips/Chips.story.tsx +5 -3
  261. package/src/circularButton/CircularButton.spec.tsx +4 -5
  262. package/src/common/RadioButton/RadioButton.spec.tsx +2 -2
  263. package/src/common/card/Card.story.tsx +1 -0
  264. package/src/common/closeButton/CloseButton.spec.tsx +0 -1
  265. package/src/common/flowHeader/FlowHeader.spec.tsx +0 -1
  266. package/src/dateInput/DateInput.story.tsx +21 -16
  267. package/src/dateLookup/DateLookup.rtl.spec.tsx +18 -16
  268. package/src/dateLookup/DateLookup.testingLibrary.spec.js +47 -44
  269. package/src/dateLookup/DateLookup.tests.story.tsx +4 -2
  270. package/src/decision/Decision.spec.js +0 -2
  271. package/src/decision/Decision.tsx +1 -1
  272. package/src/definitionList/{DefinitionList.story.js → DefinitionList.story.tsx} +22 -2
  273. package/src/definitionList/DefinitionList.tsx +95 -0
  274. package/src/definitionList/index.ts +2 -0
  275. package/src/dimmer/Dimmer.rtl.spec.js +10 -10
  276. package/src/drawer/{Drawer.rtl.spec.js → Drawer.rtl.spec.tsx} +6 -4
  277. package/src/drawer/{Drawer.story.js → Drawer.story.tsx} +20 -28
  278. package/src/drawer/{Drawer.js → Drawer.tsx} +26 -31
  279. package/src/drawer/index.ts +2 -0
  280. package/src/emphasis/Emphasis.spec.tsx +0 -1
  281. package/src/field/Field.spec.tsx +2 -2
  282. package/src/flowNavigation/FlowNavigation.spec.js +0 -2
  283. package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +0 -1
  284. package/src/flowNavigation/backButton/BackButton.tsx +29 -0
  285. package/src/flowNavigation/backButton/index.ts +2 -0
  286. package/src/header/Header.spec.tsx +6 -6
  287. package/src/image/Image.spec.tsx +0 -1
  288. package/src/index.ts +5 -0
  289. package/src/info/Info.story.tsx +15 -9
  290. package/src/info/Info.tsx +2 -2
  291. package/src/info/index.ts +1 -1
  292. package/src/inlineAlert/InlineAlert.spec.tsx +0 -1
  293. package/src/inputs/SelectInput.spec.tsx +26 -47
  294. package/src/link/Link.spec.tsx +0 -1
  295. package/src/listItem/ListItem.spec.tsx +0 -1
  296. package/src/logo/Logo.story.tsx +3 -6
  297. package/src/logo/{Logo.js → Logo.tsx} +25 -35
  298. package/src/logo/index.ts +1 -0
  299. package/src/main.css +127 -108
  300. package/src/moneyInput/MoneyInput.rtl.spec.tsx +2 -2
  301. package/src/moneyInput/MoneyInput.story.tsx +1 -4
  302. package/src/overlayHeader/{OverlayHeader.spec.js → OverlayHeader.spec.tsx} +1 -1
  303. package/src/overlayHeader/{OverlayHeader.story.js → OverlayHeader.story.tsx} +10 -2
  304. package/src/overlayHeader/{OverlayHeader.js → OverlayHeader.tsx} +12 -19
  305. package/src/overlayHeader/index.ts +2 -0
  306. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -0
  307. package/src/popover/Popover.spec.tsx +10 -10
  308. package/src/progress/Progress.spec.tsx +0 -1
  309. package/src/progressBar/ProgressBar.spec.tsx +0 -1
  310. package/src/section/Section.story.tsx +0 -2
  311. package/src/segmentedControl/SegmentedControl.spec.tsx +10 -11
  312. package/src/select/Select.spec.js +71 -71
  313. package/src/slidingPanel/SlidingPanel.spec.js +2 -1
  314. package/src/slidingPanel/SlidingPanel.tsx +3 -0
  315. package/src/snackbar/Snackbar.story.tsx +20 -100
  316. package/src/snackbar/Snackbar.tests.story.tsx +281 -0
  317. package/src/snackbar/Snackbar.tsx +8 -12
  318. package/src/sticky/Sticky.spec.tsx +71 -0
  319. package/src/sticky/Sticky.story.tsx +72 -15
  320. package/src/sticky/Sticky.tsx +49 -5
  321. package/src/test-utils/Parameters.d.ts +8 -0
  322. package/src/test-utils/index.js +1 -1
  323. package/src/test-utils/jest.setup.js +2 -0
  324. package/src/test-utils/story-config.ts +5 -0
  325. package/src/tile/{Tile.spec.js → Tile.spec.tsx} +1 -1
  326. package/src/tile/{Tile.js → Tile.tsx} +24 -35
  327. package/src/tooltip/Tooltip.spec.tsx +15 -16
  328. package/src/uploadInput/UploadInput.css +25 -27
  329. package/src/uploadInput/UploadInput.less +24 -23
  330. package/src/uploadInput/UploadInput.spec.tsx +9 -10
  331. package/src/uploadInput/UploadInput.story.tsx +8 -130
  332. package/src/uploadInput/UploadInput.tests.story.tsx +212 -0
  333. package/src/uploadInput/UploadInput.tsx +1 -4
  334. package/src/uploadInput/types.ts +11 -1
  335. package/src/uploadInput/uploadButton/UploadButton.css +24 -38
  336. package/src/uploadInput/uploadButton/UploadButton.less +27 -40
  337. package/src/uploadInput/uploadButton/UploadButton.spec.tsx +4 -5
  338. package/src/uploadInput/uploadButton/UploadButton.tsx +12 -37
  339. package/src/uploadInput/uploadItem/UploadItem.css +81 -46
  340. package/src/uploadInput/uploadItem/UploadItem.less +75 -40
  341. package/src/uploadInput/uploadItem/UploadItem.spec.tsx +4 -4
  342. package/src/uploadInput/uploadItem/UploadItem.tsx +30 -25
  343. package/src/uploadInput/uploadItem/UploadItemBody.tsx +1 -1
  344. package/build/types/logo/logoTypes.d.ts +0 -6
  345. package/build/types/logo/logoTypes.d.ts.map +0 -1
  346. package/src/alert/inlineMarkdown/InlineMarkdown.js +0 -21
  347. package/src/alert/inlineMarkdown/index.js +0 -1
  348. package/src/card/index.js +0 -1
  349. package/src/checkbox/index.js +0 -3
  350. package/src/definitionList/DefinitionList.js +0 -100
  351. package/src/definitionList/index.js +0 -1
  352. package/src/drawer/index.js +0 -1
  353. package/src/flowNavigation/backButton/BackButton.js +0 -32
  354. package/src/flowNavigation/backButton/BackButton.spec.js +0 -16
  355. package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +0 -37
  356. package/src/flowNavigation/backButton/index.js +0 -3
  357. package/src/logo/index.js +0 -2
  358. package/src/logo/logoTypes.ts +0 -6
  359. package/src/overlayHeader/index.js +0 -1
  360. package/src/snackbar/Snackbar.spec.js +0 -112
  361. package/src/sticky/Sticky.spec.js +0 -34
  362. /package/src/checkbox/__snapshots__/{Checkbox.spec.js.snap → Checkbox.spec.tsx.snap} +0 -0
  363. /package/src/drawer/__snapshots__/{Drawer.rtl.spec.js.snap → Drawer.rtl.spec.tsx.snap} +0 -0
  364. /package/src/logo/{Logo.spec.js → Logo.spec.tsx} +0 -0
  365. /package/src/logo/__snapshots__/{Logo.spec.js.snap → Logo.spec.tsx.snap} +0 -0
  366. /package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap} +0 -0
  367. /package/src/tile/{Tile.story.js → Tile.story.tsx} +0 -0
  368. /package/src/tile/__snapshots__/{Tile.spec.js.snap → Tile.spec.tsx.snap} +0 -0
  369. /package/src/tile/{index.js → index.ts} +0 -0
@@ -8,15 +8,15 @@ declare class UploadImageStep extends PureComponent<any, any, any> {
8
8
  }
9
9
  declare namespace UploadImageStep {
10
10
  namespace propTypes {
11
- const fileDropped: any;
12
- const isComplete: any;
13
- const usAccept: any;
14
- const usButtonText: any;
15
- const usDisabled: any;
16
- const usHelpImage: any;
17
- const usLabel: any;
18
- const usPlaceholder: any;
11
+ let fileDropped: any;
12
+ let isComplete: any;
13
+ let usAccept: any;
14
+ let usButtonText: any;
15
+ let usDisabled: any;
16
+ let usHelpImage: any;
17
+ let usLabel: any;
18
+ let usPlaceholder: any;
19
19
  }
20
20
  }
21
- import { PureComponent } from "react";
21
+ import { PureComponent } from 'react';
22
22
  //# sourceMappingURL=uploadImageStep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploadImageStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/uploadImageStep/uploadImageStep.js"],"names":[],"mappings":";AAIA;IACE,cAGC;IADC,+CAAiC;IAGnC,2BAME;IAEF,oBAgBE;IAEF,sCA8BC;CACF"}
1
+ {"version":3,"file":"uploadImageStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/uploadImageStep/uploadImageStep.js"],"names":[],"mappings":";AAIA;IACE,cAGC;IADC,+CAAiC;IAGnC,2BAME;IAEF,oBAgBE;IAEF,sCA8BC;CACF;;;;;;;;;;;;;8BAjEwC,OAAO"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CommonProps } from '../common';
3
2
  import { UploadedFile, UploadResponse } from './types';
4
3
  import { UploadButtonProps } from './uploadButton/UploadButton';
@@ -1 +1 @@
1
- {"version":3,"file":"UploadInput.d.ts","sourceRoot":"","sources":["../../../src/uploadInput/UploadInput.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAiC,MAAM,WAAW,CAAC;AAMvE,OAAO,EAAE,YAAY,EAAe,cAAc,EAAE,MAAM,SAAS,CAAC;AACpE,OAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAmB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAErD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAEjD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAEvB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EA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AAa,CAAC,EAAE;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAEvB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,GAAG,IAAI,CACN,iBAAiB,EACjB,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,IAAI,GAAG,mBAAmB,CACjG,GACC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,GACnC,WAAW,CAAC;AAQd,QAAA,MAAM,WAAW,uQAoBd,gBAAgB,gCAwPlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -13,9 +13,13 @@ export type UploadResponse = {
13
13
  */
14
14
  url?: string;
15
15
  /**
16
- * Optionally set a translated error message when file was rejected
16
+ * Optionally sets translated error message when a file gets rejected
17
17
  */
18
18
  error?: UploadError;
19
+ /**
20
+ * Optionally sets translated error messages when a file gets rejected
21
+ */
22
+ errors?: UploadError[];
19
23
  [key: string]: any;
20
24
  };
21
25
  export type UploadedFile = {
@@ -35,6 +39,10 @@ export type UploadedFile = {
35
39
  * Any API errors. The message should be localized.
36
40
  */
37
41
  error?: UploadError;
42
+ /**
43
+ * Any API errors array. The messages should be localized.
44
+ */
45
+ errors?: UploadError[];
38
46
  /**
39
47
  * Optional. An external URL where the file can be opened from.
40
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/uploadInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC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G,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IAEvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { FileType } from '../../common';
3
2
  type AllowedFileTypes = string | readonly string[] | readonly FileType[];
4
3
  export type UploadButtonProps = {
@@ -40,15 +39,11 @@ export type UploadButtonProps = {
40
39
  * Title for the upload button
41
40
  */
42
41
  uploadButtonTitle?: string;
43
- /**
44
- * Are there any uploaded items on a multiple-file upload? Used for calculating border radiuses
45
- */
46
- multipleFileInputWithFilesAdded: boolean;
47
42
  };
48
43
  export declare enum TEST_IDS {
49
44
  uploadInput = "uploadInput",
50
45
  mediaBody = "mediaBody"
51
46
  }
52
- declare const UploadButton: ({ disabled, multiple, description, fileTypes, sizeLimit, maxFiles, onChange, id, uploadButtonTitle, multipleFileInputWithFilesAdded, }: UploadButtonProps) => import("react").JSX.Element;
47
+ declare const UploadButton: ({ disabled, multiple, description, fileTypes, sizeLimit, maxFiles, onChange, id, uploadButtonTitle, }: UploadButtonProps) => import("react").JSX.Element;
53
48
  export default UploadButton;
54
49
  //# sourceMappingURL=UploadButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploadButton.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadButton/UploadButton.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAA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,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAEpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,oBAAY,QAAQ;IAClB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;CACxB;AAOD,QAAA,MAAM,YAAY,0GAUf,iBAAiB,gCA6JnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { UploadedFile } from '../types';
3
2
  export type UploadItemProps = JSX.IntrinsicAttributes & {
4
3
  file: UploadedFile;
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCAmHjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCAyHjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,KAAK,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAC9D,KAAK,gBAAgB,GAAG,UAAU,GAAG,aAAa,CAAC;AAEnD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,GACN,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,MA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C,CAAC,CAAC,GACtC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,MAAM,OAAO,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,YAAY;;;;MAIjB;gBAEU,KAAK,EAAE,sBAAsB;IAezC,MAAM,CAAC,wBAAwB,CAC7B,EAAE,cAAc,EAAE,EAAE,sBAAsB,EAC1C,EAAE,kBAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,sBAAsB;;;;;;;IAiB1F,aAAa,qBAAsB,MAAM,KAAG,SAAS,GAAG,MAAM,CA8B5D;IAEF,UAAU,aAMR;IAEF,cAAc,UAAW,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,4BAM3D;IAEF,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAuB1D;IAEF,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAQzD;IAEF,WAAW,EAAE,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAEvD;IAEF,YAAY,WAAY,SAAS,GAAG,MAAM,aAKxC;IAEF,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC,CA0BvD;IAEF,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAEpD;IAEF,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAMrD;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAuBzD;IAEF,uBAAuB,WAAY,MAAM,UAiBvC;IAEF,MAAM;CAqCP;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  export default function withNextPortalWrapper<T extends Record<string, any>>(Component: React.ComponentType<T>): (props: T) => import("react").ReactPortal | null;
3
2
  //# sourceMappingURL=withNextPortal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withNextPortal.d.ts","sourceRoot":"","sources":["../../../src/withNextPortal/withNextPortal.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,WAET,CAAC,wCAQ1B"}
1
+ {"version":3,"file":"withNextPortal.d.ts","sourceRoot":"","sources":["../../../src/withNextPortal/withNextPortal.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,WAET,CAAC,wCAQ1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.37.0",
3
+ "version": "46.39.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -50,26 +50,25 @@
50
50
  "@rollup/plugin-node-resolve": "^15.2.3",
51
51
  "@rollup/plugin-typescript": "^11.1.6",
52
52
  "@rollup/plugin-url": "^8.0.2",
53
- "@storybook/addon-a11y": "^7.6.19",
54
- "@storybook/addon-actions": "^7.6.19",
55
- "@storybook/addon-essentials": "^7.6.19",
56
- "@storybook/addon-interactions": "^7.6.19",
57
- "@storybook/addon-knobs": "^7.0.2",
58
- "@storybook/addon-viewport": "^7.6.19",
59
- "@storybook/addons": "^7.6.17",
60
- "@storybook/api": "^7.6.17",
61
- "@storybook/components": "^7.6.19",
62
- "@storybook/core-events": "^7.6.19",
63
- "@storybook/manager-api": "^7.6.19",
64
- "@storybook/react": "^7.6.19",
65
- "@storybook/react-webpack5": "^7.6.19",
66
- "@storybook/test": "^7.6.19",
67
- "@storybook/theming": "^7.6.19",
68
- "@storybook/types": "^7.6.19",
69
- "@testing-library/dom": "^8.20.1",
70
- "@testing-library/jest-dom": "^5.17.0",
71
- "@testing-library/react": "^13.4.0",
72
- "@testing-library/user-event": "^13.5.0",
53
+ "@storybook/addon-a11y": "^8.1.10",
54
+ "@storybook/addon-actions": "^8.1.10",
55
+ "@storybook/addon-essentials": "^8.1.10",
56
+ "@storybook/addon-interactions": "^8.1.10",
57
+ "@storybook/addon-knobs": "^8.0.1",
58
+ "@storybook/addon-viewport": "^8.1.10",
59
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
60
+ "@storybook/components": "^8.1.10",
61
+ "@storybook/core-events": "^8.1.10",
62
+ "@storybook/manager-api": "^8.1.10",
63
+ "@storybook/react": "^8.1.10",
64
+ "@storybook/react-webpack5": "^8.1.10",
65
+ "@storybook/test": "^8.1.10",
66
+ "@storybook/theming": "^8.1.10",
67
+ "@storybook/types": "^8.1.10",
68
+ "@testing-library/dom": "^10.1.0",
69
+ "@testing-library/jest-dom": "^6.4.6",
70
+ "@testing-library/react": "^16.0.0",
71
+ "@testing-library/user-event": "^14.5.2",
73
72
  "@transferwise/icons": "^3.7.0",
74
73
  "@transferwise/neptune-tokens": "^8.9.2",
75
74
  "@tsconfig/recommended": "^1.0.6",
@@ -82,7 +81,6 @@
82
81
  "@types/react": "^18.3.3",
83
82
  "@types/react-dom": "^18.3.0",
84
83
  "@types/react-transition-group": "4.4.10",
85
- "@types/testing-library__jest-dom": "^5.14.9",
86
84
  "@wise/art": "^2.7.0",
87
85
  "babel-plugin-formatjs": "^10.5.14",
88
86
  "babel-plugin-inline-react-svg": "^2.0.2",
@@ -93,10 +91,10 @@
93
91
  "lodash.times": "^4.3.2",
94
92
  "react-intl": "^6.6.6",
95
93
  "rollup": "^4.17.2",
96
- "storybook": "^7.6.19",
94
+ "storybook": "^8.1.10",
95
+ "@transferwise/neptune-css": "14.10.0",
97
96
  "@transferwise/less-config": "3.1.0",
98
- "@wise/components-theming": "1.3.0",
99
- "@transferwise/neptune-css": "14.10.0"
97
+ "@wise/components-theming": "1.3.0"
100
98
  },
101
99
  "peerDependencies": {
102
100
  "@transferwise/icons": "^3.7.0",
@@ -127,7 +125,6 @@
127
125
  "merge-props": "^6.0.0",
128
126
  "prop-types": "^15.8.1",
129
127
  "react-popper": "^2.3.0",
130
- "react-required-if": "^1.0.3",
131
128
  "react-transition-group": "^4.4.5"
132
129
  },
133
130
  "publishConfig": {
@@ -138,7 +135,7 @@
138
135
  "dev:less:watch": "gulp watchLess --dest=src",
139
136
  "dev:translations": "pnpm build:crowdin-source-file",
140
137
  "storybook:dev": "storybook dev -p 3001",
141
- "storybook:build": "storybook build --webpack-stats-json",
138
+ "storybook:build": "storybook build --stats-json",
142
139
  "build:css": "gulp compileLess --dest=src",
143
140
  "build": "npm-run-all build:*",
144
141
  "build:clean": "rm -rf lib build",
@@ -49,25 +49,25 @@ describe('Accordion', () => {
49
49
  });
50
50
 
51
51
  describe('open and close', () => {
52
- it('can open and close an item when clicked', () => {
52
+ it('can open and close an item when clicked', async () => {
53
53
  const item = items[0];
54
54
  render(<Accordion items={items} />);
55
55
 
56
- userEvent.click(screen.getByRole('button', { name: item.title }));
56
+ await userEvent.click(screen.getByRole('button', { name: item.title }));
57
57
  expect(screen.getByText(item.content)).toBeInTheDocument();
58
58
 
59
- userEvent.click(screen.getByRole('button', { name: item.title }));
59
+ await userEvent.click(screen.getByRole('button', { name: item.title }));
60
60
  expect(screen.queryByText(item.content)).not.toBeInTheDocument();
61
61
  });
62
62
  });
63
63
 
64
64
  describe('onClick', () => {
65
- it('calls onClick when an item is clicked', () => {
65
+ it('calls onClick when an item is clicked', async () => {
66
66
  const onClick = jest.fn();
67
67
 
68
68
  render(<Accordion items={items} onClick={onClick} />);
69
69
 
70
- userEvent.click(screen.getAllByRole('button')[0]);
70
+ await userEvent.click(screen.getAllByRole('button')[0]);
71
71
 
72
72
  expect(onClick).toHaveBeenCalledTimes(1);
73
73
  expect(onClick).toHaveBeenCalledWith(0);
@@ -39,12 +39,12 @@ describe('AccordionItem', () => {
39
39
  });
40
40
 
41
41
  describe('onClick', () => {
42
- it('calls onClick when item is clicked', () => {
42
+ it('calls onClick when item is clicked', async () => {
43
43
  const onClick = jest.fn();
44
44
 
45
45
  render(<AccordionItem {...props} onClick={onClick} />);
46
46
 
47
- userEvent.click(screen.getByRole('button'));
47
+ await userEvent.click(screen.getByRole('button'));
48
48
 
49
49
  expect(onClick).toHaveBeenCalledTimes(1);
50
50
  });
@@ -1,4 +1,3 @@
1
- import '@testing-library/jest-dom';
2
1
  import { render, screen, userEvent } from '../test-utils';
3
2
 
4
3
  import ActionButton from '.';
@@ -40,17 +39,17 @@ describe('ActionButton', () => {
40
39
  });
41
40
 
42
41
  describe('onClick', () => {
43
- it('calls onClick when clicked', () => {
42
+ it('calls onClick when clicked', async () => {
44
43
  const onClick = jest.fn();
45
44
  render(<ActionButton {...props} onClick={onClick} />);
46
- userEvent.click(screen.getByRole('button'));
45
+ await userEvent.click(screen.getByRole('button'));
47
46
  expect(onClick).toHaveBeenCalledTimes(1);
48
47
  });
49
48
 
50
- it('does not call onClick when clicked if disabled', () => {
49
+ it('does not call onClick when clicked if disabled', async () => {
51
50
  const onClick = jest.fn();
52
51
  render(<ActionButton {...props} disabled onClick={onClick} />);
53
- userEvent.click(screen.getByRole('button'));
52
+ await userEvent.click(screen.getByRole('button'));
54
53
  expect(onClick).toHaveBeenCalledTimes(0);
55
54
  });
56
55
  });
@@ -175,14 +175,14 @@ describe('Alert', () => {
175
175
  expect(element).not.toHaveAttribute('target');
176
176
  });
177
177
 
178
- it('sets text and onClick', () => {
178
+ it('sets text and onClick', async () => {
179
179
  action = {
180
180
  onClick: jest.fn(),
181
181
  text: 'Learn more',
182
182
  };
183
183
  render(<Alert action={action} message={message} />);
184
184
 
185
- userEvent.click(screen.getByText('Learn more'));
185
+ await userEvent.click(screen.getByText('Learn more'));
186
186
 
187
187
  expect(action.onClick).toHaveBeenCalled();
188
188
  });
@@ -246,12 +246,12 @@ describe('Alert', () => {
246
246
  expect(screen.getByRole('button')).toBeInTheDocument();
247
247
  });
248
248
 
249
- it('calls onDismiss when the close button is clicked', () => {
249
+ it('calls onDismiss when the close button is clicked', async () => {
250
250
  const onDismiss = jest.fn();
251
251
 
252
252
  render(<Alert message={message} onDismiss={onDismiss} />);
253
253
 
254
- userEvent.click(screen.getByRole('button'));
254
+ await userEvent.click(screen.getByRole('button'));
255
255
 
256
256
  expect(onDismiss).toHaveBeenCalledTimes(1);
257
257
  });
@@ -41,11 +41,7 @@ export default {
41
41
 
42
42
  type Story = StoryObj<typeof Alert>;
43
43
 
44
- export const Basic: Story = {
45
- args: {
46
- onDismiss: undefined,
47
- },
48
- };
44
+ export const Basic: Story = {};
49
45
 
50
46
  export const WithLinkAction: Story = {
51
47
  args: {
@@ -53,6 +49,7 @@ export const WithLinkAction: Story = {
53
49
  href: '/',
54
50
  text: 'Read more',
55
51
  },
52
+ onDismiss: () => {},
56
53
  },
57
54
  };
58
55
 
@@ -62,12 +59,14 @@ export const WithButtonAction: Story = {
62
59
  onClick: action('alert action clicked'),
63
60
  text: 'Open',
64
61
  },
62
+ onDismiss: () => {},
65
63
  },
66
64
  };
67
65
 
68
66
  export const WithArrow: Story = {
69
67
  args: {
70
68
  arrow: AlertArrowPosition.TOP_LEFT,
69
+ onDismiss: () => {},
71
70
  },
72
71
  };
73
72
 
@@ -93,6 +92,7 @@ const CustomIcon = () => {
93
92
  export const WithCustomIcon: Story = {
94
93
  args: {
95
94
  icon: <CustomIcon />,
95
+ onDismiss: () => {},
96
96
  },
97
97
  };
98
98
 
@@ -100,5 +100,6 @@ export const WithTitle: Story = {
100
100
  args: {
101
101
  type: Sentiment.NEUTRAL,
102
102
  title: 'We’re reviewing your information.',
103
+ onDismiss: () => {},
103
104
  },
104
105
  };
@@ -0,0 +1,13 @@
1
+ import { MarkdownNodeType } from '../../common';
2
+ import Markdown from '../../markdown';
3
+
4
+ const allowList = [MarkdownNodeType.STRONG];
5
+
6
+ export interface InlineMarkdownProps {
7
+ children?: string;
8
+ className?: string;
9
+ }
10
+
11
+ export default function InlineMarkdown(props: InlineMarkdownProps) {
12
+ return <Markdown {...props} as="span" allowList={allowList} blockList={undefined} />;
13
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from './InlineMarkdown';
2
+ export type { InlineMarkdownProps } from './InlineMarkdown';
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
  import { createRef } from 'react';
3
3
 
4
- import '@testing-library/jest-dom';
5
4
  import { ControlType, Type, Priority, Size } from '../common';
6
5
  import { render, cleanup, screen, userEvent } from '../test-utils';
7
6
 
@@ -94,17 +93,17 @@ describe('Button', () => {
94
93
  });
95
94
 
96
95
  describe('onClick', () => {
97
- it('calls onClick when clicked', () => {
96
+ it('calls onClick when clicked', async () => {
98
97
  const onClick = jest.fn();
99
98
  render(<Button {...props} onClick={onClick} />);
100
- userEvent.click(screen.getByRole('button'));
99
+ await userEvent.click(screen.getByRole('button'));
101
100
  expect(onClick).toHaveBeenCalledTimes(1);
102
101
  });
103
102
 
104
- it('does not call onClick when clicked if disabled', () => {
103
+ it('does not call onClick when clicked if disabled', async () => {
105
104
  const onClick = jest.fn();
106
105
  render(<Button {...props} disabled onClick={onClick} />);
107
- userEvent.click(screen.getByRole('button'));
106
+ await userEvent.click(screen.getByRole('button'));
108
107
  expect(onClick).toHaveBeenCalledTimes(0);
109
108
  });
110
109
  });
@@ -68,10 +68,10 @@ describe('Card', () => {
68
68
  expect(screen.getByTestId(dataTestId)).toHaveClass('np-card--inactive');
69
69
  });
70
70
 
71
- it("doesn't call onClick when clicked", () => {
71
+ it("doesn't call onClick when clicked", async () => {
72
72
  renderCard();
73
73
 
74
- userEvent.click(screen.getByText(defaultProps.title));
74
+ await userEvent.click(screen.getByText(defaultProps.title));
75
75
 
76
76
  expect(defaultProps.onClick).not.toHaveBeenCalled();
77
77
  });
@@ -84,7 +84,7 @@ describe('Card', () => {
84
84
  });
85
85
 
86
86
  describe('when there is children prop', () => {
87
- it('calls on onClick with inverse of current isExpanded value when clicked', () => {
87
+ it('calls on onClick with inverse of current isExpanded value when clicked', async () => {
88
88
  const onClick = jest.fn();
89
89
  renderCard({
90
90
  'aria-label': 'test',
@@ -94,7 +94,7 @@ describe('Card', () => {
94
94
  onClick,
95
95
  });
96
96
 
97
- userEvent.click(screen.getByRole('button', { name: 'test' }));
97
+ await userEvent.click(screen.getByRole('button', { name: 'test' }));
98
98
  expect(onClick).toHaveBeenCalledWith(true);
99
99
  });
100
100
 
@@ -3,27 +3,21 @@ import { FastFlag as FastFlagIcon } from '@transferwise/icons';
3
3
  import { useState } from 'react';
4
4
 
5
5
  import Card from '.';
6
+ import { CardProps } from './Card';
6
7
 
7
8
  export default {
8
9
  component: Card,
9
10
  title: 'Layouts/Card',
10
11
  };
11
12
 
12
- const Template = (props) => {
13
+ const Template = (props: Pick<CardProps, 'isExpanded' | 'icon' | 'onClick'>) => {
13
14
  const elementType = select('elementType', ['div', 'li'], 'div');
14
15
  const title = text('title', 'A card');
15
16
  const details = text('details', 'Some details about this card');
16
17
  const content = text('content', 'Lorem ipsum dolor sit amet.');
17
18
 
18
19
  return (
19
- <Card
20
- as={elementType}
21
- title={title}
22
- details={details}
23
- isExpanded={props.isExpanded}
24
- icon={props.icon}
25
- onClick={props.onClick}
26
- >
20
+ <Card as={elementType} title={title} details={details} {...props}>
27
21
  {content}
28
22
  </Card>
29
23
  );
@@ -36,13 +30,10 @@ export const Basic = () => {
36
30
  };
37
31
 
38
32
  export const Multiple = () => {
39
- const [expandedCardIndex, setExpandedCardIndex] = useState(0);
33
+ const [expandedCardIndex, setExpandedCardIndex] = useState<number | null>(0);
40
34
 
41
- const handleOnCardClick = (index) => {
42
- if (expandedCardIndex === index) {
43
- return setExpandedCardIndex(null);
44
- }
45
- setExpandedCardIndex(index);
35
+ const handleOnCardClick = (index: number) => {
36
+ setExpandedCardIndex(index !== expandedCardIndex ? index : null);
46
37
  };
47
38
 
48
39
  return (
@@ -1,17 +1,29 @@
1
1
  import classNames from 'classnames';
2
- import PropTypes from 'prop-types';
3
2
  import { forwardRef } from 'react';
4
- import requiredIf from 'react-required-if';
5
3
 
6
4
  import Body from '../body';
7
5
  import Chevron from '../chevron';
8
6
  import { Position, Typography } from '../common';
9
7
  import Option from '../common/Option';
10
8
 
11
- const Card = forwardRef((props, reference) => {
12
- const {
9
+ export interface CardProps {
10
+ 'aria-label'?: string;
11
+ as?: React.ElementType;
12
+ isExpanded?: boolean;
13
+ title: React.ReactNode;
14
+ details: React.ReactNode;
15
+ icon?: React.ReactNode;
16
+ children?: React.ReactNode;
17
+ id?: string;
18
+ className?: string;
19
+ 'data-testid'?: string;
20
+ onClick?: (nextIsExpanded: boolean) => void;
21
+ }
22
+
23
+ const Card = forwardRef(function Card(
24
+ {
13
25
  'aria-label': ariaLabel,
14
- as: Element,
26
+ as: Element = 'div',
15
27
  isExpanded,
16
28
  title,
17
29
  details,
@@ -20,8 +32,10 @@ const Card = forwardRef((props, reference) => {
20
32
  icon,
21
33
  id,
22
34
  className,
23
- ...rest
24
- } = props;
35
+ 'data-testid': dataTestId,
36
+ }: CardProps,
37
+ reference,
38
+ ) {
25
39
  const isOpen = !!(isExpanded && children);
26
40
 
27
41
  return (
@@ -33,7 +47,7 @@ const Card = forwardRef((props, reference) => {
33
47
  'np-card--has-icon': !!icon,
34
48
  })}
35
49
  id={id}
36
- data-testid={rest['data-testid']}
50
+ data-testid={dataTestId}
37
51
  >
38
52
  <Option
39
53
  aria-label={ariaLabel}
@@ -44,7 +58,7 @@ const Card = forwardRef((props, reference) => {
44
58
  content={details}
45
59
  showMediaAtAllSizes
46
60
  button={children && <Chevron orientation={isOpen ? Position.TOP : Position.BOTTOM} />}
47
- onClick={() => children && onClick(!isExpanded)}
61
+ onClick={children ? () => onClick?.(!isExpanded) : undefined}
48
62
  />
49
63
  <div
50
64
  className={classNames('np-card__divider', {
@@ -60,29 +74,4 @@ const Card = forwardRef((props, reference) => {
60
74
  );
61
75
  });
62
76
 
63
- const hasChildren = ({ children }) => children;
64
-
65
- Card.propTypes = {
66
- 'aria-label': PropTypes.string,
67
- as: PropTypes.string,
68
- isExpanded: requiredIf(PropTypes.bool, hasChildren),
69
- title: PropTypes.node.isRequired,
70
- details: PropTypes.node.isRequired,
71
- onClick: requiredIf(PropTypes.func, hasChildren),
72
- icon: PropTypes.node,
73
- children: PropTypes.node,
74
- id: PropTypes.string,
75
- className: PropTypes.string,
76
- 'data-testid': PropTypes.string,
77
- };
78
-
79
- Card.defaultProps = {
80
- 'aria-label': undefined,
81
- as: 'div',
82
- children: null,
83
- id: null,
84
- className: null,
85
- 'data-testid': null,
86
- };
87
-
88
77
  export default Card;
@@ -0,0 +1,2 @@
1
+ export { default } from './Card';
2
+ export type { CardProps } from './Card';