@transferwise/components 46.124.1 → 46.126.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 (401) hide show
  1. package/build/avatarView/AvatarView.js.map +1 -1
  2. package/build/avatarView/AvatarView.mjs.map +1 -1
  3. package/build/common/locale/index.js +13 -0
  4. package/build/common/locale/index.js.map +1 -1
  5. package/build/common/locale/index.mjs +13 -1
  6. package/build/common/locale/index.mjs.map +1 -1
  7. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +31 -1
  8. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  9. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +32 -2
  10. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  11. package/build/field/Field.js +11 -0
  12. package/build/field/Field.js.map +1 -1
  13. package/build/field/Field.mjs +11 -0
  14. package/build/field/Field.mjs.map +1 -1
  15. package/build/index.js +5 -0
  16. package/build/index.js.map +1 -1
  17. package/build/index.mjs +3 -1
  18. package/build/index.mjs.map +1 -1
  19. package/build/inputs/Input.js.map +1 -1
  20. package/build/inputs/Input.mjs.map +1 -1
  21. package/build/inputs/SearchInput.js.map +1 -1
  22. package/build/inputs/SearchInput.mjs.map +1 -1
  23. package/build/inputs/SelectInput.js.map +1 -1
  24. package/build/inputs/SelectInput.mjs.map +1 -1
  25. package/build/inputs/TextArea.js.map +1 -1
  26. package/build/inputs/TextArea.mjs.map +1 -1
  27. package/build/listItem/ListItem.js +2 -2
  28. package/build/listItem/ListItem.js.map +1 -1
  29. package/build/listItem/ListItem.mjs +2 -2
  30. package/build/listItem/ListItem.mjs.map +1 -1
  31. package/build/listItem/Prompt/ListItemPrompt.js +11 -0
  32. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  33. package/build/listItem/Prompt/ListItemPrompt.mjs +11 -0
  34. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  35. package/build/main.css +63 -2
  36. package/build/moneyInput/MoneyInput.js +6 -1
  37. package/build/moneyInput/MoneyInput.js.map +1 -1
  38. package/build/moneyInput/MoneyInput.mjs +6 -1
  39. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  40. package/build/prompt/ActionPrompt/ActionPrompt.js +146 -0
  41. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -0
  42. package/build/prompt/ActionPrompt/ActionPrompt.mjs +141 -0
  43. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -0
  44. package/build/prompt/InfoPrompt/InfoPrompt.js +113 -0
  45. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -0
  46. package/build/prompt/InfoPrompt/InfoPrompt.mjs +111 -0
  47. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -0
  48. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +13 -11
  49. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  50. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +14 -12
  51. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  52. package/build/radioOption/RadioOption.js.map +1 -1
  53. package/build/radioOption/RadioOption.mjs.map +1 -1
  54. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  55. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  56. package/build/statusIcon/StatusIcon.js +2 -0
  57. package/build/statusIcon/StatusIcon.js.map +1 -1
  58. package/build/statusIcon/StatusIcon.mjs +2 -0
  59. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  60. package/build/styles/main.css +63 -2
  61. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +21 -0
  62. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +31 -0
  63. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +11 -2
  64. package/build/table/TableCell.js.map +1 -1
  65. package/build/table/TableCell.mjs.map +1 -1
  66. package/build/tabs/Tabs.js +14 -171
  67. package/build/tabs/Tabs.js.map +1 -1
  68. package/build/tabs/Tabs.mjs +16 -173
  69. package/build/tabs/Tabs.mjs.map +1 -1
  70. package/build/tabs/utils.js +0 -18
  71. package/build/tabs/utils.js.map +1 -1
  72. package/build/tabs/utils.mjs +1 -17
  73. package/build/tabs/utils.mjs.map +1 -1
  74. package/build/typeahead/Typeahead.js +11 -0
  75. package/build/typeahead/Typeahead.js.map +1 -1
  76. package/build/typeahead/Typeahead.mjs +11 -0
  77. package/build/typeahead/Typeahead.mjs.map +1 -1
  78. package/build/types/avatarView/AvatarView.d.ts +1 -1
  79. package/build/types/avatarView/AvatarView.d.ts.map +1 -1
  80. package/build/types/common/locale/index.d.ts +8 -0
  81. package/build/types/common/locale/index.d.ts.map +1 -1
  82. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -1
  83. package/build/types/index.d.ts +4 -3
  84. package/build/types/index.d.ts.map +1 -1
  85. package/build/types/inputs/Input.d.ts.map +1 -1
  86. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  87. package/build/types/inputs/SelectInput.d.ts +1 -1
  88. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  89. package/build/types/inputs/TextArea.d.ts.map +1 -1
  90. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  91. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -1
  92. package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -1
  93. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +28 -0
  94. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -0
  95. package/build/types/prompt/ActionPrompt/index.d.ts +3 -0
  96. package/build/types/prompt/ActionPrompt/index.d.ts.map +1 -0
  97. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +56 -0
  98. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -0
  99. package/build/types/prompt/InfoPrompt/index.d.ts +3 -0
  100. package/build/types/prompt/InfoPrompt/index.d.ts.map +1 -0
  101. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +5 -5
  102. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  103. package/build/types/prompt/index.d.ts +4 -0
  104. package/build/types/prompt/index.d.ts.map +1 -1
  105. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  106. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  107. package/build/types/statusIcon/StatusIcon.d.ts +2 -1
  108. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  109. package/build/types/table/TableCell.d.ts.map +1 -1
  110. package/build/types/tabs/Tabs.d.ts +2 -24
  111. package/build/types/tabs/Tabs.d.ts.map +1 -1
  112. package/build/types/tabs/utils.d.ts +0 -2
  113. package/build/types/tabs/utils.d.ts.map +1 -1
  114. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  115. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  116. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  117. package/package.json +2 -3
  118. package/src/actionButton/ActionButton.story.tsx +2 -9
  119. package/src/avatar/Avatar.story.tsx +2 -8
  120. package/src/avatarLayout/AvatarLayout.story.tsx +3 -3
  121. package/src/avatarView/AvatarView.story.tsx +29 -24
  122. package/src/avatarView/AvatarView.tsx +1 -1
  123. package/src/button/_stories/{Button.tests.story.tsx → Button.test.story.tsx} +5 -10
  124. package/src/checkbox/Checkbox.story.tsx +3 -16
  125. package/src/circularButton/CircularButton.story.tsx +2 -7
  126. package/src/common/bottomSheet/BottomSheet.story.tsx +6 -32
  127. package/src/common/bottomSheet/BottomSheet.test.story.tsx +98 -0
  128. package/src/common/circle/Circle.story.tsx +3 -14
  129. package/src/common/locale/{index.spec.ts → index.test.ts} +36 -1
  130. package/src/common/locale/index.ts +13 -0
  131. package/src/criticalBanner/CriticalCommsBanner.story.tsx +3 -16
  132. package/src/dateInput/{DateInput.tests.story.tsx → DateInput.test.story.tsx} +3 -13
  133. package/src/dateLookup/DateLookup.story.tsx +9 -7
  134. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +5 -1
  135. package/src/header/{Header.tests.story.tsx → Header.test.story.tsx} +5 -10
  136. package/src/index.ts +4 -2
  137. package/src/info/Info.story.tsx +4 -20
  138. package/src/inputs/Input.tsx +8 -9
  139. package/src/inputs/SearchInput.tsx +8 -9
  140. package/src/inputs/SelectInput.test.story.tsx +86 -0
  141. package/src/inputs/SelectInput.tsx +1 -1
  142. package/src/inputs/TextArea.tsx +6 -7
  143. package/src/listItem/ListItem.tsx +2 -2
  144. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +2 -7
  145. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +2 -7
  146. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +2 -7
  147. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +2 -7
  148. package/src/main.css +63 -2
  149. package/src/main.less +3 -1
  150. package/src/modal/Modal.story.tsx +6 -31
  151. package/src/moneyInput/MoneyInput.test.story.tsx +104 -0
  152. package/src/moneyInput/MoneyInput.tsx +20 -2
  153. package/src/primitives/PrimitiveAnchor/PrimitiveAnchor.types.ts +1 -3
  154. package/src/primitives/PrimitiveButton/PrimitiveButton.types.ts +1 -3
  155. package/src/prompt/ActionPrompt/ActionPrompt.accessibility.docs.mdx +65 -0
  156. package/src/prompt/ActionPrompt/ActionPrompt.css +21 -0
  157. package/src/prompt/ActionPrompt/ActionPrompt.less +23 -0
  158. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +187 -0
  159. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +147 -0
  160. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +251 -0
  161. package/src/prompt/ActionPrompt/ActionPrompt.tsx +170 -0
  162. package/src/prompt/ActionPrompt/index.ts +2 -0
  163. package/src/prompt/InfoPrompt/InfoPrompt.css +31 -0
  164. package/src/prompt/InfoPrompt/InfoPrompt.less +37 -0
  165. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +312 -0
  166. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +246 -0
  167. package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +224 -0
  168. package/src/prompt/InfoPrompt/InfoPrompt.tsx +148 -0
  169. package/src/prompt/InfoPrompt/index.ts +2 -0
  170. package/src/prompt/InlinePrompt/{InlinePrompt.spec.tsx → InlinePrompt.test.tsx} +3 -38
  171. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +11 -2
  172. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +13 -3
  173. package/src/prompt/PrimitivePrompt/PrimitivePrompt.test.tsx +161 -0
  174. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +20 -16
  175. package/src/prompt/index.ts +8 -0
  176. package/src/radioOption/RadioOption.tsx +2 -1
  177. package/src/slidingPanel/SlidingPanel.tsx +4 -2
  178. package/src/snackbar/{Snackbar.tests.story.tsx → Snackbar.test.story.tsx} +6 -32
  179. package/src/{ssr.spec.tsx → ssr.test.tsx} +3 -0
  180. package/src/statusIcon/StatusIcon.story.tsx +5 -9
  181. package/src/statusIcon/StatusIcon.tsx +8 -1
  182. package/src/table/TableCell.tsx +1 -3
  183. package/src/tabs/Tabs.story.tsx +1 -45
  184. package/src/tabs/{Tabs.spec.tsx → Tabs.test.tsx} +0 -22
  185. package/src/tabs/Tabs.tsx +23 -240
  186. package/src/tabs/utils.test.ts +68 -0
  187. package/src/tabs/utils.ts +0 -20
  188. package/src/tooltip/Tooltip.story.tsx +2 -7
  189. package/src/withDisplayFormat/WithDisplayFormat.tsx +13 -14
  190. package/src/tabs/utils.spec.ts +0 -126
  191. /package/src/accordion/{Accordion.spec.js → Accordion.test.js} +0 -0
  192. /package/src/accordion/AccordionItem/{AccordionItem.spec.js → AccordionItem.test.js} +0 -0
  193. /package/src/accordion/AccordionItem/__snapshots__/{AccordionItem.spec.js.snap → AccordionItem.test.js.snap} +0 -0
  194. /package/src/accordion/__snapshots__/{Accordion.spec.js.snap → Accordion.test.js.snap} +0 -0
  195. /package/src/actionButton/{ActionButton.spec.tsx → ActionButton.test.tsx} +0 -0
  196. /package/src/actionButton/__snapshots__/{ActionButton.spec.tsx.snap → ActionButton.test.tsx.snap} +0 -0
  197. /package/src/actionOption/{ActionOption.spec.tsx → ActionOption.test.tsx} +0 -0
  198. /package/src/alert/{Alert.tests.story.tsx → Alert.test.story.tsx} +0 -0
  199. /package/src/alert/{Alert.spec.tsx → Alert.test.tsx} +0 -0
  200. /package/src/avatar/{Avatar.spec.tsx → Avatar.test.tsx} +0 -0
  201. /package/src/avatarWrapper/{AvatarWrapper.spec.tsx → AvatarWrapper.test.tsx} +0 -0
  202. /package/src/avatarWrapper/__snapshots__/{AvatarWrapper.spec.tsx.snap → AvatarWrapper.test.tsx.snap} +0 -0
  203. /package/src/badge/{Badge.spec.tsx → Badge.test.tsx} +0 -0
  204. /package/src/body/{Body.spec.tsx → Body.test.tsx} +0 -0
  205. /package/src/button/{Button.spec.tsx → Button.test.tsx} +0 -0
  206. /package/src/button/{LegacyButton.spec.tsx → LegacyButton.test.tsx} +0 -0
  207. /package/src/button/_stories/{Button.brightGreen.tests.story.tsx → Button.brightGreen.test.story.tsx} +0 -0
  208. /package/src/button/_stories/{Button.dark.tests.story.tsx → Button.dark.test.story.tsx} +0 -0
  209. /package/src/button/_stories/{Button.default.tests.story.tsx → Button.default.test.story.tsx} +0 -0
  210. /package/src/button/_stories/{Button.forestGreen.tests.story.tsx → Button.forestGreen.test.story.tsx} +0 -0
  211. /package/src/button/legacyUtils/{legacyUtils.spec.tsx → legacyUtils.test.tsx} +0 -0
  212. /package/src/card/{Card.spec.tsx → Card.test.tsx} +0 -0
  213. /package/src/carousel/{Carousel.spec.tsx → Carousel.test.tsx} +0 -0
  214. /package/src/checkbox/{Checkbox.spec.tsx → Checkbox.test.tsx} +0 -0
  215. /package/src/checkbox/__snapshots__/{Checkbox.spec.tsx.snap → Checkbox.test.tsx.snap} +0 -0
  216. /package/src/checkboxButton/{CheckboxButton.spec.tsx → CheckboxButton.test.tsx} +0 -0
  217. /package/src/checkboxOption/{CheckboxOption.spec.tsx → CheckboxOption.test.tsx} +0 -0
  218. /package/src/chevron/{Chevron.spec.tsx → Chevron.test.tsx} +0 -0
  219. /package/src/chevron/__snapshots__/{Chevron.spec.tsx.snap → Chevron.test.tsx.snap} +0 -0
  220. /package/src/chips/{Chips.spec.tsx → Chips.test.tsx} +0 -0
  221. /package/src/chips/__snapshots__/{Chips.spec.tsx.snap → Chips.test.tsx.snap} +0 -0
  222. /package/src/circularButton/{CircularButton.tests.story.tsx → CircularButton.test.story.tsx} +0 -0
  223. /package/src/circularButton/{CircularButton.spec.tsx → CircularButton.test.tsx} +0 -0
  224. /package/src/common/DOMOperations/{DOMOperations.spec.tsx → DOMOperations.test.tsx} +0 -0
  225. /package/src/common/Option/{Option.spec.tsx → Option.test.tsx} +0 -0
  226. /package/src/common/RadioButton/{RadioButton.spec.tsx → RadioButton.test.tsx} +0 -0
  227. /package/src/common/RadioButton/__snapshots__/{RadioButton.spec.tsx.snap → RadioButton.test.tsx.snap} +0 -0
  228. /package/src/common/bottomSheet/{BottomSheet.spec.tsx → BottomSheet.test.tsx} +0 -0
  229. /package/src/common/bottomSheet/__snapshots__/{BottomSheet.spec.tsx.snap → BottomSheet.test.tsx.snap} +0 -0
  230. /package/src/common/card/{Card.spec.tsx → Card.test.tsx} +0 -0
  231. /package/src/common/card/__snapshots__/{Card.spec.tsx.snap → Card.test.tsx.snap} +0 -0
  232. /package/src/common/closeButton/{CloseButton.spec.tsx → CloseButton.test.tsx} +0 -0
  233. /package/src/common/closeButton/__snapshots__/{CloseButton.spec.tsx.snap → CloseButton.test.tsx.snap} +0 -0
  234. /package/src/common/dateUtils/getDayNames/{getDayNames.spec.js → getDayNames.test.js} +0 -0
  235. /package/src/common/dateUtils/getMonthNames/{getMonthNames.spec.js → getMonthNames.test.js} +0 -0
  236. /package/src/common/dateUtils/isDateValid/{isDateValid.spec.ts → isDateValid.test.ts} +0 -0
  237. /package/src/common/dateUtils/isMonthAndYearFormat/{isMonthAndYearFormat.spec.js → isMonthAndYearFormat.test.js} +0 -0
  238. /package/src/common/dateUtils/isWithinRange/{isWithinRange.spec.ts → isWithinRange.test.ts} +0 -0
  239. /package/src/common/dateUtils/moveToWithinRange/{moveToWithinRange.spec.js → moveToWithinRange.test.js} +0 -0
  240. /package/src/common/deviceDetection/{deviceDetection.spec.ts → deviceDetection.test.ts} +0 -0
  241. /package/src/common/domHelpers/{documentIosClick.spec.ts → documentIosClick.test.ts} +0 -0
  242. /package/src/common/flowHeader/{FlowHeader.spec.tsx → FlowHeader.test.tsx} +0 -0
  243. /package/src/common/flowHeader/__snapshots__/{FlowHeader.spec.tsx.snap → FlowHeader.test.tsx.snap} +0 -0
  244. /package/src/common/historyNavigator/{historyNavigator.spec.ts → historyNavigator.test.ts} +0 -0
  245. /package/src/common/hooks/useConditionalListener/{useConditionalListener.spec.js → useConditionalListener.test.js} +0 -0
  246. /package/src/common/hooks/useDirection/{useDirection.spec.js → useDirection.test.js} +0 -0
  247. /package/src/common/hooks/useHasIntersected/{useHasIntersected.spec.js → useHasIntersected.test.js} +0 -0
  248. /package/src/common/hooks/{useMedia.spec.ts → useMedia.test.ts} +0 -0
  249. /package/src/common/{initials.spec.tsx → initials.test.tsx} +0 -0
  250. /package/src/common/panel/{Panel.spec.tsx → Panel.test.tsx} +0 -0
  251. /package/src/common/panel/__snapshots__/{Panel.spec.tsx.snap → Panel.test.tsx.snap} +0 -0
  252. /package/src/common/responsivePanel/{ResponsivePanel.spec.js → ResponsivePanel.test.js} +0 -0
  253. /package/src/common/textFormat/formatWithPattern/{formatWithPattern.spec.ts → formatWithPattern.test.ts} +0 -0
  254. /package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.spec.ts → getCountOfSymbolsInSelection.test.ts} +0 -0
  255. /package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.spec.ts → getCursorPositionAfterKeystroke.test.ts} +0 -0
  256. /package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.spec.ts → getDistanceToSymbol.test.ts} +0 -0
  257. /package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.spec.ts → getSymbolsInPatternWithPosition.test.ts} +0 -0
  258. /package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.spec.ts → unformatWithPattern.test.ts} +0 -0
  259. /package/src/dateInput/{DateInput.spec.tsx → DateInput.test.tsx} +0 -0
  260. /package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.spec.ts → convertToLocalMidnight.test.ts} +0 -0
  261. /package/src/dateLookup/{DateLookup.tests.story.tsx → DateLookup.test.story.tsx} +0 -0
  262. /package/src/dateLookup/{DateLookup.spec.tsx → DateLookup.test.tsx} +0 -0
  263. /package/src/dateLookup/getFocusableTime/{getFocusable.spec.ts → getFocusable.test.ts} +0 -0
  264. /package/src/dateLookup/getStartOfDay/{getStartOfDay.spec.js → getStartOfDay.test.js} +0 -0
  265. /package/src/decision/{Decision.spec.tsx → Decision.test.tsx} +0 -0
  266. /package/src/dimmer/{Dimmer.spec.tsx → Dimmer.test.tsx} +0 -0
  267. /package/src/divider/{Divider.spec.tsx → Divider.test.tsx} +0 -0
  268. /package/src/drawer/{Drawer.spec.tsx → Drawer.test.tsx} +0 -0
  269. /package/src/emphasis/{Emphasis.spec.tsx → Emphasis.test.tsx} +0 -0
  270. /package/src/emphasis/{EmphasisHtmlTransformer.spec.tsx → EmphasisHtmlTransformer.test.tsx} +0 -0
  271. /package/src/expressiveMoneyInput/{ExpressiveMoneyInput.spec.tsx → ExpressiveMoneyInput.test.tsx} +0 -0
  272. /package/src/expressiveMoneyInput/amountInput/{AmountInput.spec.tsx → AmountInput.test.tsx} +0 -0
  273. /package/src/expressiveMoneyInput/amountInput/{utils.spec.ts → utils.test.ts} +0 -0
  274. /package/src/expressiveMoneyInput/currencySelector/{CurrencySelector.spec.tsx → CurrencySelector.test.tsx} +0 -0
  275. /package/src/field/{Field.spec.tsx → Field.test.tsx} +0 -0
  276. /package/src/flowNavigation/{FlowNavigation.spec.js → FlowNavigation.test.js} +0 -0
  277. /package/src/flowNavigation/__snapshots__/{FlowNavigation.spec.js.snap → FlowNavigation.test.js.snap} +0 -0
  278. /package/src/flowNavigation/animatedLabel/{AnimatedLabel.spec.js → AnimatedLabel.test.js} +0 -0
  279. /package/src/header/{Header.spec.tsx → Header.test.tsx} +0 -0
  280. /package/src/iconButton/{iconButton.spec.tsx → iconButton.test.tsx} +0 -0
  281. /package/src/image/{Image.spec.tsx → Image.test.tsx} +0 -0
  282. /package/src/info/{Info.spec.jsx → Info.test.jsx} +0 -0
  283. /package/src/inlineAlert/{InlineAlert.spec.tsx → InlineAlert.test.tsx} +0 -0
  284. /package/src/inputWithDisplayFormat/{InputWithDisplayFormat.spec.js → InputWithDisplayFormat.test.js} +0 -0
  285. /package/src/inputs/{InputGroup.spec.tsx → InputGroup.test.tsx} +0 -0
  286. /package/src/inputs/{SearchInput.spec.tsx → SearchInput.test.tsx} +0 -0
  287. /package/src/inputs/{SelectInput.spec.tsx → SelectInput.test.tsx} +0 -0
  288. /package/src/instructionsList/{InstructionsList.spec.tsx → InstructionsList.test.tsx} +0 -0
  289. /package/src/label/{Label.spec.tsx → Label.test.tsx} +0 -0
  290. /package/src/legacylistItem/{LegacyListItem.tests.story.tsx → LegacyListItem.test.story.tsx} +0 -0
  291. /package/src/legacylistItem/{LegacyListItem.spec.tsx → LegacyListItem.test.tsx} +0 -0
  292. /package/src/link/{Link.spec.tsx → Link.test.tsx} +0 -0
  293. /package/src/list/{List.spec.tsx → List.test.tsx} +0 -0
  294. /package/src/listItem/AdditionalInfo/{ListItemAdditionalInfo.spec.tsx → ListItemAdditionalInfo.test.tsx} +0 -0
  295. /package/src/listItem/AvatarLayout/{ListItemAvatarLayout.spec.tsx → ListItemAvatarLayout.test.tsx} +0 -0
  296. /package/src/listItem/AvatarView/{ListItemAvatarView.spec.tsx → ListItemAvatarView.test.tsx} +0 -0
  297. /package/src/listItem/Button/{ListItemButton.spec.tsx → ListItemButton.test.tsx} +0 -0
  298. /package/src/listItem/Checkbox/{ListItemCheckbox.spec.tsx → ListItemCheckbox.test.tsx} +0 -0
  299. /package/src/listItem/IconButton/{ListItemIconButton.spec.tsx → ListItemIconButton.test.tsx} +0 -0
  300. /package/src/listItem/Image/{ListItemImage.spec.tsx → ListItemImage.test.tsx} +0 -0
  301. /package/src/listItem/{ListItem.spec.tsx → ListItem.test.tsx} +0 -0
  302. /package/src/listItem/Navigation/{ListItemNavigation.spec.tsx → ListItemNavigation.test.tsx} +0 -0
  303. /package/src/listItem/Prompt/{ListItemPrompt.spec.tsx → ListItemPrompt.test.tsx} +0 -0
  304. /package/src/listItem/Radio/{ListItemRadio.spec.tsx → ListItemRadio.test.tsx} +0 -0
  305. /package/src/listItem/Switch/{ListItemSwitch.spec.tsx → ListItemSwitch.test.tsx} +0 -0
  306. /package/src/loader/{Loader.spec.tsx → Loader.test.tsx} +0 -0
  307. /package/src/logo/{Logo.spec.tsx → Logo.test.tsx} +0 -0
  308. /package/src/logo/__snapshots__/{Logo.spec.tsx.snap → Logo.test.tsx.snap} +0 -0
  309. /package/src/markdown/{Markdown.spec.tsx → Markdown.test.tsx} +0 -0
  310. /package/src/modal/{Modal.spec.tsx → Modal.test.tsx} +0 -0
  311. /package/src/money/{Money.spec.tsx → Money.test.tsx} +0 -0
  312. /package/src/moneyInput/{MoneyInput.spec.tsx → MoneyInput.test.tsx} +0 -0
  313. /package/src/moneyInput/{currencyFormatting.spec.ts → currencyFormatting.test.ts} +0 -0
  314. /package/src/navigationOption/{NavigationOption.spec.tsx → NavigationOption.test.tsx} +0 -0
  315. /package/src/navigationOptionsList/{NavigationOptionsList.spec.tsx → NavigationOptionsList.test.tsx} +0 -0
  316. /package/src/nudge/{Nudge.spec.tsx → Nudge.test.tsx} +0 -0
  317. /package/src/overlayHeader/{OverlayHeader.spec.tsx → OverlayHeader.test.tsx} +0 -0
  318. /package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.tsx.snap → OverlayHeader.test.tsx.snap} +0 -0
  319. /package/src/phoneNumberInput/{PhoneNumberInput.spec.tsx → PhoneNumberInput.test.tsx} +0 -0
  320. /package/src/phoneNumberInput/utils/cleanNumber/{cleanNumber.spec.ts → cleanNumber.test.ts} +0 -0
  321. /package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.spec.ts → excludeCountries.test.ts} +0 -0
  322. /package/src/phoneNumberInput/utils/explodeNumberModel/{explodeNumberModel.spec.ts → explodeNumberModel.test.ts} +0 -0
  323. /package/src/phoneNumberInput/utils/findCountryByCode/{findCountryByCode.spec.ts → findCountryByCode.test.ts} +0 -0
  324. /package/src/phoneNumberInput/utils/findCountryByPrefix/{findCountryByPrefix.spec.ts → findCountryByPrefix.test.ts} +0 -0
  325. /package/src/phoneNumberInput/utils/groupCountriesByPrefix/{groupCountriesByPrefix.spec.ts → groupCountriesByPrefix.test.ts} +0 -0
  326. /package/src/phoneNumberInput/utils/isStringNumeric/{isStringNumeric.spec.ts → isStringNumeric.test.ts} +0 -0
  327. /package/src/phoneNumberInput/utils/isValidPhoneNumber/{isValidPhoneNumber.spec.ts → isValidPhoneNumber.test.ts} +0 -0
  328. /package/src/phoneNumberInput/utils/longestMatchingPrefix/{longestMatchingPrefix.spec.ts → longestMatchingPrefix.test.ts} +0 -0
  329. /package/src/phoneNumberInput/utils/setDefaultPrefix/{setDefaultPrefix.spec.ts → setDefaultPrefix.test.ts} +0 -0
  330. /package/src/phoneNumberInput/utils/sortArrayByProperty/{sortArrayByProperty.spec.ts → sortArrayByProperty.test.ts} +0 -0
  331. /package/src/popover/{Popover.spec.tsx → Popover.test.tsx} +0 -0
  332. /package/src/popover/__snapshots__/{Popover.spec.tsx.snap → Popover.test.tsx.snap} +0 -0
  333. /package/src/primitives/PrimitiveAnchor/stories/{PrimitiveAnchor.tests.story.tsx → PrimitiveAnchor.test.story.tsx} +0 -0
  334. /package/src/primitives/PrimitiveAnchor/test/{PrimitiveAnchor.spec.tsx → PrimitiveAnchor.test.tsx} +0 -0
  335. /package/src/primitives/PrimitiveButton/stories/{PrimitiveButton.tests.story.tsx → PrimitiveButton.test.story.tsx} +0 -0
  336. /package/src/primitives/PrimitiveButton/test/{PrimitiveButton.spec.tsx → PrimitiveButton.test.tsx} +0 -0
  337. /package/src/processIndicator/{ProcessIndicator.rtl.spec.tsx → ProcessIndicator.rtl.test.tsx} +0 -0
  338. /package/src/progress/{Progress.spec.tsx → Progress.test.tsx} +0 -0
  339. /package/src/progressBar/{ProgressBar.spec.tsx → ProgressBar.test.tsx} +0 -0
  340. /package/src/promoCard/{PromoCard.spec.tsx → PromoCard.test.tsx} +0 -0
  341. /package/src/promoCard/{PromoCardContext.spec.tsx → PromoCardContext.test.tsx} +0 -0
  342. /package/src/promoCard/{PromoCardGroup.spec.tsx → PromoCardGroup.test.tsx} +0 -0
  343. /package/src/promoCard/__snapshots__/{PromoCard.spec.tsx.snap → PromoCard.test.tsx.snap} +0 -0
  344. /package/src/promoCard/__snapshots__/{PromoCardGroup.spec.tsx.snap → PromoCardGroup.test.tsx.snap} +0 -0
  345. /package/src/provider/{Provider.spec.tsx → Provider.test.tsx} +0 -0
  346. /package/src/provider/direction/{DirectionProvider.spec.tsx → DirectionProvider.test.tsx} +0 -0
  347. /package/src/provider/language/{LanguageProvider.spec.tsx → LanguageProvider.test.tsx} +0 -0
  348. /package/src/radio/{Radio.spec.tsx → Radio.test.tsx} +0 -0
  349. /package/src/radioGroup/{RadioGroup.spec.tsx → RadioGroup.test.tsx} +0 -0
  350. /package/src/radioOption/{RadioOption.spec.tsx → RadioOption.test.tsx} +0 -0
  351. /package/src/section/{Section.spec.tsx → Section.test.tsx} +0 -0
  352. /package/src/segmentedControl/{SegmentedControl.spec.tsx → SegmentedControl.test.tsx} +0 -0
  353. /package/src/select/{Select.rtl.spec.tsx → Select.rtl.test.tsx} +0 -0
  354. /package/src/select/{Select.spec.tsx → Select.test.tsx} +0 -0
  355. /package/src/select/option/{Option.spec.tsx → Option.test.tsx} +0 -0
  356. /package/src/select/searchBox/{SearchBox.spec.tsx → SearchBox.test.tsx} +0 -0
  357. /package/src/sentimentSurface/{SentimentSurface.tests.story.tsx → SentimentSurface.test.story.tsx} +0 -0
  358. /package/src/sentimentSurface/{SentimentSurface.spec.tsx → SentimentSurface.test.tsx} +0 -0
  359. /package/src/slidingPanel/{SlidingPanel.spec.tsx → SlidingPanel.test.tsx} +0 -0
  360. /package/src/statusIcon/{StatusIcon.spec.tsx → StatusIcon.test.tsx} +0 -0
  361. /package/src/stepper/{Stepper.tests.story.tsx → Stepper.test.story.tsx} +0 -0
  362. /package/src/stepper/{Stepper.spec.tsx → Stepper.test.tsx} +0 -0
  363. /package/src/stepper/{deviceDetection.spec.ts → deviceDetection.test.ts} +0 -0
  364. /package/src/sticky/{Sticky.spec.tsx → Sticky.test.tsx} +0 -0
  365. /package/src/summary/{Summary.tests.story.tsx → Summary.test.story.tsx} +0 -0
  366. /package/src/summary/{Summary.spec.tsx → Summary.test.tsx} +0 -0
  367. /package/src/switch/{Switch.spec.tsx → Switch.test.tsx} +0 -0
  368. /package/src/switchOption/{SwitchOption.spec.tsx → SwitchOption.test.tsx} +0 -0
  369. /package/src/table/{Table.spec.tsx → Table.test.tsx} +0 -0
  370. /package/src/table/{TableCell.spec.tsx → TableCell.test.tsx} +0 -0
  371. /package/src/table/{TableHeader.spec.tsx → TableHeader.test.tsx} +0 -0
  372. /package/src/table/{TableRow.spec.tsx → TableRow.test.tsx} +0 -0
  373. /package/src/table/{TableStatusText.spec.tsx → TableStatusText.test.tsx} +0 -0
  374. /package/src/textareaWithDisplayFormat/{TextareaWithDisplayFormat.spec.js → TextareaWithDisplayFormat.test.js} +0 -0
  375. /package/src/tile/{Tile.spec.tsx → Tile.test.tsx} +0 -0
  376. /package/src/tile/__snapshots__/{Tile.spec.tsx.snap → Tile.test.tsx.snap} +0 -0
  377. /package/src/title/{Title.spec.tsx → Title.test.tsx} +0 -0
  378. /package/src/tooltip/{Tooltip.spec.tsx → Tooltip.test.tsx} +0 -0
  379. /package/src/tooltip/__snapshots__/{Tooltip.spec.tsx.snap → Tooltip.test.tsx.snap} +0 -0
  380. /package/src/typeahead/{Typeahead.spec.tsx → Typeahead.test.tsx} +0 -0
  381. /package/src/typeahead/typeaheadInput/{TypeaheadInput.spec.tsx → TypeaheadInput.test.tsx} +0 -0
  382. /package/src/typeahead/util/{highlight.spec.tsx → highlight.test.tsx} +0 -0
  383. /package/src/upload/{Upload.tests.story.tsx → Upload.test.story.tsx} +0 -0
  384. /package/src/upload/{Upload.spec.tsx → Upload.test.tsx} +0 -0
  385. /package/src/upload/steps/completeStep/{completeStep.spec.tsx → completeStep.test.tsx} +0 -0
  386. /package/src/upload/steps/processingStep/{processingStep.spec.tsx → processingStep.test.tsx} +0 -0
  387. /package/src/upload/steps/uploadImageStep/{uploadImageStep.spec.tsx → uploadImageStep.test.tsx} +0 -0
  388. /package/src/upload/utils/asyncFileRead/{asyncFileRead.spec.ts → asyncFileRead.test.ts} +0 -0
  389. /package/src/upload/utils/getFileType/{getFileType.spec.ts → getFileType.test.ts} +0 -0
  390. /package/src/upload/utils/isSizeValid/{isSizeValid.spec.ts → isSizeValid.test.ts} +0 -0
  391. /package/src/upload/utils/isTypeValid/{isTypeValid.spec.ts → isTypeValid.test.ts} +0 -0
  392. /package/src/upload/utils/postData/{postData.spec.ts → postData.test.ts} +0 -0
  393. /package/src/uploadInput/{UploadInput.tests.story.tsx → UploadInput.test.story.tsx} +0 -0
  394. /package/src/uploadInput/{UploadInput.spec.tsx → UploadInput.test.tsx} +0 -0
  395. /package/src/uploadInput/uploadButton/{UploadButton.spec.tsx → UploadButton.test.tsx} +0 -0
  396. /package/src/uploadInput/uploadButton/{getAllowedFileTypes.spec.ts → getAllowedFileTypes.test.ts} +0 -0
  397. /package/src/uploadInput/uploadItem/{UploadItem.spec.tsx → UploadItem.test.tsx} +0 -0
  398. /package/src/utilities/deprecatedProperty/{deprecatedProperty.spec.ts → deprecatedProperty.test.ts} +0 -0
  399. /package/src/withDisplayFormat/{WithDisplayFormat.spec.js → WithDisplayFormat.test.js} +0 -0
  400. /package/src/withId/{withId.spec.tsx → withId.test.tsx} +0 -0
  401. /package/src/withNextPortal/{withNextPortal.spec.tsx → withNextPortal.test.tsx} +0 -0
@@ -0,0 +1,312 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
3
+ import { action } from 'storybook/actions';
4
+ import { Confetti, GiftBox, Star, Travel } from '@transferwise/icons';
5
+ import { InfoPrompt, InfoPromptProps } from './InfoPrompt';
6
+
7
+ const withComponentGrid =
8
+ ({ maxWidth = 'auto', gap = '1rem' } = {}) =>
9
+ (Story: () => ReactElement) => (
10
+ <div
11
+ style={{
12
+ width: '100%',
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ justifyContent: 'flex-start',
16
+ alignItems: 'flex-start',
17
+ alignContent: 'flex-start',
18
+ gap,
19
+ maxWidth,
20
+ }}
21
+ >
22
+ <Story />
23
+ </div>
24
+ );
25
+
26
+ export default {
27
+ title: 'Prompts/InfoPrompt',
28
+ component: InfoPrompt,
29
+ tags: ['new'],
30
+ decorators: [withComponentGrid()],
31
+ args: {
32
+ description: 'Your payment is being processed.',
33
+ },
34
+ argTypes: {
35
+ sentiment: {
36
+ control: 'select',
37
+ options: ['success', 'negative', 'neutral', 'warning', 'proposition'],
38
+ },
39
+ title: {
40
+ control: 'text',
41
+ table: {
42
+ type: { summary: 'ReactNode' },
43
+ },
44
+ },
45
+ description: {
46
+ control: 'text',
47
+ table: {
48
+ type: { summary: 'ReactNode' },
49
+ },
50
+ },
51
+ },
52
+ parameters: {
53
+ docs: {
54
+ toc: true,
55
+ },
56
+ },
57
+ } satisfies Meta<InfoPromptProps>;
58
+
59
+ /**
60
+ * Convenience controls for previewing rich markup,
61
+ * not otherwise possible via Storybook
62
+ */
63
+ type PreviewStoryArgs = InfoPromptProps & {
64
+ previewMedia: boolean;
65
+ previewOnDismiss: boolean;
66
+ previewAction: boolean;
67
+ };
68
+
69
+ const previewArgGroup = {
70
+ category: 'Storybook Preview options',
71
+ type: {
72
+ summary: undefined,
73
+ },
74
+ };
75
+
76
+ const previewArgTypes = {
77
+ previewMedia: {
78
+ name: 'Preview with `media`',
79
+ control: 'boolean',
80
+ table: previewArgGroup,
81
+ },
82
+ previewOnDismiss: {
83
+ name: 'Preview with `onDismiss`',
84
+ control: 'boolean',
85
+ table: previewArgGroup,
86
+ },
87
+ previewAction: {
88
+ name: 'Preview with `action`',
89
+ control: 'boolean',
90
+ table: previewArgGroup,
91
+ },
92
+ } as const;
93
+
94
+ const getPropsForPreview = (
95
+ args: PreviewStoryArgs,
96
+ ): [InfoPromptProps, Partial<InfoPromptProps>] => {
97
+ const { previewMedia, previewOnDismiss, previewAction, ...props } = args;
98
+
99
+ return [
100
+ props,
101
+ {
102
+ media: previewMedia ? { asset: <Star title="Starred" /> } : undefined,
103
+ onDismiss: previewOnDismiss ? action('onDismiss') : undefined,
104
+ action: previewAction
105
+ ? { label: 'Learn more', onClick: action('action.onClick') }
106
+ : undefined,
107
+ },
108
+ ];
109
+ };
110
+
111
+ export const Playground: StoryObj<PreviewStoryArgs> = {
112
+ tags: ['!autodocs'],
113
+ argTypes: previewArgTypes,
114
+ args: {
115
+ previewMedia: false,
116
+ previewOnDismiss: false,
117
+ previewAction: false,
118
+ },
119
+ render: (args: PreviewStoryArgs) => {
120
+ const [props, previewProps] = getPropsForPreview(args);
121
+ return <InfoPrompt {...props} {...previewProps} />;
122
+ },
123
+ };
124
+
125
+ /**
126
+ * InfoPrompt supports multiple sentiments to communicate different types of messages:
127
+ * - `neutral` (default): General information
128
+ * - `success`: Success messages
129
+ * - `negative`: Error messages
130
+ * - `warning`: Warning messages
131
+ * - `proposition`: Promotional content (uses GiftBox icon by default)
132
+ */
133
+ export const Sentiments: StoryObj<InfoPromptProps> = {
134
+ render: (args: InfoPromptProps) => (
135
+ <>
136
+ <InfoPrompt {...args} sentiment="neutral" description="This is a neutral message." />
137
+ <InfoPrompt {...args} sentiment="success" description="Your payment was successful!" />
138
+ <InfoPrompt {...args} sentiment="negative" description="Something went wrong." />
139
+ <InfoPrompt {...args} sentiment="warning" description="Please review your details." />
140
+ <InfoPrompt {...args} sentiment="proposition" description="Check out our new features!" />
141
+ </>
142
+ ),
143
+ decorators: [withComponentGrid()],
144
+ };
145
+
146
+ /**
147
+ * InfoPrompt can include both a title and description for more detailed messaging.
148
+ */
149
+ export const WithTitle: StoryObj<InfoPromptProps> = {
150
+ render: (args: InfoPromptProps) => (
151
+ <>
152
+ <InfoPrompt
153
+ {...args}
154
+ sentiment="success"
155
+ title="Payment Successful"
156
+ description="Your money is on its way to the recipient."
157
+ />
158
+ <InfoPrompt
159
+ {...args}
160
+ sentiment="warning"
161
+ title="Payment Delayed"
162
+ description="Payments sent today might not arrive in time for the holidays."
163
+ />
164
+ <InfoPrompt
165
+ {...args}
166
+ sentiment="negative"
167
+ title="Payment Failed"
168
+ description="We couldn't process your payment. Please try again."
169
+ />
170
+ </>
171
+ ),
172
+ decorators: [withComponentGrid()],
173
+ };
174
+
175
+ /**
176
+ * When `onDismiss` is provided, a close button appears allowing users to dismiss the prompt.
177
+ * Note: The component itself is not automatically removed - you must handle state management.
178
+ */
179
+ export const Dismissible: StoryObj<InfoPromptProps> = {
180
+ render: (args: InfoPromptProps) => (
181
+ <>
182
+ <InfoPrompt
183
+ {...args}
184
+ sentiment="success"
185
+ title="Success"
186
+ description="Your payment was successful."
187
+ onDismiss={action('onDismiss')}
188
+ />
189
+ <InfoPrompt
190
+ {...args}
191
+ sentiment="neutral"
192
+ description="This message can be dismissed."
193
+ onDismiss={action('onDismiss')}
194
+ />
195
+ </>
196
+ ),
197
+ decorators: [withComponentGrid()],
198
+ };
199
+
200
+ /**
201
+ * Use the `action` prop to add a clickable link below the message.
202
+ * Actions can have an `href` for navigation or an `onClick` for custom behavior.
203
+ */
204
+ export const WithAction: StoryObj<InfoPromptProps> = {
205
+ render: (args: InfoPromptProps) => (
206
+ <>
207
+ <InfoPrompt
208
+ {...args}
209
+ sentiment="neutral"
210
+ description="New feature available"
211
+ action={{ label: 'Learn more', href: '/features', target: '_blank' }}
212
+ />
213
+ <InfoPrompt
214
+ {...args}
215
+ sentiment="warning"
216
+ title="Action Required"
217
+ description="Please verify your identity to continue."
218
+ action={{ label: 'Verify now', onClick: action('verify') }}
219
+ />
220
+ <InfoPrompt
221
+ {...args}
222
+ sentiment="proposition"
223
+ title="Special Offer"
224
+ description="Get 50% off your next transfer!"
225
+ action={{ label: 'Claim offer', onClick: action('claim') }}
226
+ />
227
+ </>
228
+ ),
229
+ decorators: [withComponentGrid()],
230
+ };
231
+
232
+ /**
233
+ * Use the `media` prop to override the default status icon with a custom icon.
234
+ * This is useful for matching the prompt's visual language to its content.
235
+ *
236
+ * Success and proposition sentiments support both standard checkmark and confetti variations.
237
+ */
238
+ export const CustomMedia: StoryObj<InfoPromptProps> = {
239
+ render: (args: InfoPromptProps) => (
240
+ <>
241
+ <InfoPrompt
242
+ {...args}
243
+ sentiment="success"
244
+ description="Saved to favorites!"
245
+ media={{ asset: <Star title="Starred" /> }}
246
+ />
247
+ <InfoPrompt
248
+ {...args}
249
+ sentiment="success"
250
+ title="Congratulations!"
251
+ description="You've completed all the steps."
252
+ media={{ asset: <Confetti size={24} title="Celebration" /> }}
253
+ />
254
+ <InfoPrompt
255
+ {...args}
256
+ sentiment="proposition"
257
+ title="Check out more!"
258
+ description="New ways to send money with Wise!"
259
+ media={{ asset: <GiftBox title="Gift" /> }}
260
+ />
261
+ <InfoPrompt
262
+ {...args}
263
+ sentiment="success"
264
+ description="Your travel account is ready!"
265
+ media={{ asset: <Travel title="Travel" /> }}
266
+ />
267
+ </>
268
+ ),
269
+ decorators: [withComponentGrid()],
270
+ };
271
+
272
+ /**
273
+ * InfoPrompt fully supports accessibility attributes through spread props.
274
+ * Use `role="status"` for non-critical updates or `role="alert"` for important messages.
275
+ */
276
+ export const Accessibility: StoryObj<InfoPromptProps> = {
277
+ render: (args: InfoPromptProps) => (
278
+ <>
279
+ <InfoPrompt
280
+ {...args}
281
+ sentiment="success"
282
+ description="Your profile has been saved"
283
+ role="status"
284
+ />
285
+ <InfoPrompt
286
+ {...args}
287
+ sentiment="negative"
288
+ title="Error"
289
+ description="Your session has expired. Please log in again."
290
+ role="alert"
291
+ />
292
+ </>
293
+ ),
294
+ decorators: [withComponentGrid()],
295
+ };
296
+
297
+ /**
298
+ * Complete example showing all features combined:
299
+ * sentiment, title, description, action, onDismiss, and custom media.
300
+ */
301
+ export const CompleteExample: StoryObj<InfoPromptProps> = {
302
+ render: () => (
303
+ <InfoPrompt
304
+ sentiment="proposition"
305
+ title="Invite Friends & Earn"
306
+ description="Share Wise with friends and get £50 for each friend who makes their first transfer."
307
+ media={{ asset: <GiftBox title="Gift" /> }}
308
+ action={{ label: 'Invite friends', onClick: action('invite') }}
309
+ onDismiss={action('onDismiss')}
310
+ />
311
+ ),
312
+ };
@@ -0,0 +1,246 @@
1
+ import { useState, MouseEvent } from 'react';
2
+ import { userEvent, within, expect, waitFor } from 'storybook/test';
3
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
4
+ import { InfoPrompt, type InfoPromptProps } from './InfoPrompt';
5
+
6
+ const meta = {
7
+ title: 'Prompts/InfoPrompt/Tests',
8
+ component: InfoPrompt,
9
+ tags: ['!autodocs', '!manifest', 'new'],
10
+ args: {
11
+ sentiment: 'neutral',
12
+ description: 'This is an informational message.',
13
+ },
14
+ } satisfies Meta<typeof InfoPrompt>;
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ const wait = async (duration = 500) =>
21
+ new Promise<void>((resolve) => {
22
+ setTimeout(resolve, duration);
23
+ });
24
+
25
+ /**
26
+ * Test that clicking the dismiss button removes the prompt.
27
+ */
28
+ export const DismissInteraction: Story = {
29
+ play: async ({ canvasElement, step }) => {
30
+ const canvas = within(canvasElement);
31
+ const dismissButton = canvas.getByRole('button', { name: /close/i });
32
+
33
+ await step('Verify prompt is visible', async () => {
34
+ await waitFor(async () =>
35
+ expect(canvas.getByText('This message can be dismissed.')).toBeInTheDocument(),
36
+ );
37
+ });
38
+
39
+ await step('Click the dismiss button', async () => {
40
+ await userEvent.click(dismissButton);
41
+ });
42
+
43
+ await step('Verify prompt is removed', async () => {
44
+ await waitFor(async () =>
45
+ expect(canvas.queryByText('This message can be dismissed.')).not.toBeInTheDocument(),
46
+ );
47
+ });
48
+ },
49
+ render: function Render(args: InfoPromptProps) {
50
+ const [isVisible, setIsVisible] = useState(true);
51
+
52
+ if (!isVisible) {
53
+ return <div data-testid="dismissed">Prompt dismissed</div>;
54
+ }
55
+
56
+ return (
57
+ <InfoPrompt
58
+ {...args}
59
+ description="This message can be dismissed."
60
+ onDismiss={() => setIsVisible(false)}
61
+ />
62
+ );
63
+ },
64
+ };
65
+
66
+ /**
67
+ * Test keyboard accessibility - dismiss prompt via Enter key.
68
+ */
69
+ export const DismissViaKeyboard: Story = {
70
+ play: async ({ canvasElement, step }) => {
71
+ const canvas = within(canvasElement);
72
+
73
+ await step('Tab to the dismiss button', async () => {
74
+ await wait();
75
+ await userEvent.tab();
76
+ });
77
+
78
+ await step('Press Enter to dismiss', async () => {
79
+ await userEvent.keyboard('{Enter}');
80
+ });
81
+
82
+ await step('Verify prompt is removed', async () => {
83
+ await waitFor(async () =>
84
+ expect(canvas.queryByText('Press Enter to dismiss.')).not.toBeInTheDocument(),
85
+ );
86
+ });
87
+ },
88
+ render: function Render(args: InfoPromptProps) {
89
+ const [isVisible, setIsVisible] = useState(true);
90
+
91
+ if (!isVisible) {
92
+ return <div data-testid="dismissed">Prompt dismissed</div>;
93
+ }
94
+
95
+ return (
96
+ <InfoPrompt
97
+ {...args}
98
+ description="Press Enter to dismiss."
99
+ onDismiss={() => setIsVisible(false)}
100
+ />
101
+ );
102
+ },
103
+ };
104
+
105
+ /**
106
+ * Test action link click interaction.
107
+ */
108
+ export const ActionClickInteraction: Story = {
109
+ play: async ({ canvasElement, step }) => {
110
+ const canvas = within(canvasElement);
111
+ const actionLink = canvas.getByRole('link', { name: 'Learn more' });
112
+
113
+ await step('Verify prompt with action is visible', async () => {
114
+ await waitFor(async () =>
115
+ expect(canvas.getByText('Click the action link.')).toBeInTheDocument(),
116
+ );
117
+ });
118
+
119
+ await step('Click the action link', async () => {
120
+ await userEvent.click(actionLink);
121
+ });
122
+
123
+ await step('Verify action was triggered', async () => {
124
+ await waitFor(async () => expect(canvas.getByText('Action clicked!')).toBeInTheDocument());
125
+ });
126
+ },
127
+ render: function Render(args: InfoPromptProps) {
128
+ const [actionClicked, setActionClicked] = useState(false);
129
+
130
+ return (
131
+ <>
132
+ <InfoPrompt
133
+ {...args}
134
+ description="Click the action link."
135
+ action={{
136
+ label: 'Learn more',
137
+ href: '#',
138
+ onClick: (e: MouseEvent) => {
139
+ e.preventDefault();
140
+ setActionClicked(true);
141
+ },
142
+ }}
143
+ />
144
+ {actionClicked && <div>Action clicked!</div>}
145
+ </>
146
+ );
147
+ },
148
+ };
149
+
150
+ /**
151
+ * Test multiple prompts with different sentiments can be dismissed independently.
152
+ */
153
+ export const MultipleDismissInteraction: Story = {
154
+ play: async ({ canvasElement, step }) => {
155
+ const canvas = within(canvasElement);
156
+ const dismissButtons = canvas.getAllByRole('button', { name: /close/i });
157
+
158
+ await step('Verify all prompts are visible', async () => {
159
+ await waitFor(async () => {
160
+ await expect(canvas.getByText('Success message')).toBeInTheDocument();
161
+ await expect(canvas.getByText('Warning message')).toBeInTheDocument();
162
+ await expect(canvas.getByText('Negative message')).toBeInTheDocument();
163
+ });
164
+ });
165
+
166
+ await step('Dismiss the warning prompt', async () => {
167
+ // Click the second dismiss button (warning)
168
+ await userEvent.click(dismissButtons[1]);
169
+ });
170
+
171
+ await step('Verify only warning prompt is removed', async () => {
172
+ await waitFor(async () => {
173
+ await expect(canvas.getByText('Success message')).toBeInTheDocument();
174
+ await expect(canvas.queryByText('Warning message')).not.toBeInTheDocument();
175
+ await expect(canvas.getByText('Negative message')).toBeInTheDocument();
176
+ });
177
+ });
178
+ },
179
+ render: function Render() {
180
+ const [prompts, setPrompts] = useState([
181
+ { id: 1, sentiment: 'success' as const, description: 'Success message' },
182
+ { id: 2, sentiment: 'warning' as const, description: 'Warning message' },
183
+ { id: 3, sentiment: 'negative' as const, description: 'Negative message' },
184
+ ]);
185
+
186
+ const handleDismiss = (id: number) => {
187
+ setPrompts((prev) => prev.filter((p) => p.id !== id));
188
+ };
189
+
190
+ return (
191
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
192
+ {prompts.map((prompt) => (
193
+ <InfoPrompt
194
+ key={prompt.id}
195
+ sentiment={prompt.sentiment}
196
+ description={prompt.description}
197
+ onDismiss={() => handleDismiss(prompt.id)}
198
+ />
199
+ ))}
200
+ </div>
201
+ );
202
+ },
203
+ };
204
+
205
+ /**
206
+ * Test that touch interactions work for navigation (mobile).
207
+ */
208
+ export const TouchInteraction: Story = {
209
+ play: async ({ canvasElement, step }) => {
210
+ const canvas = within(canvasElement);
211
+ const actionLink = canvas.getByRole('link', { name: 'Navigate' });
212
+
213
+ await step('Verify prompt with action is visible', async () => {
214
+ await waitFor(async () => expect(canvas.getByText('Tap the prompt.')).toBeInTheDocument());
215
+ });
216
+
217
+ await step('Click the action (simulating touch)', async () => {
218
+ await userEvent.click(actionLink);
219
+ });
220
+
221
+ await step('Verify navigation was triggered', async () => {
222
+ await waitFor(async () => expect(canvas.getByText('Navigated!')).toBeInTheDocument());
223
+ });
224
+ },
225
+ render: function Render(args: InfoPromptProps) {
226
+ const [navigated, setNavigated] = useState(false);
227
+
228
+ return (
229
+ <>
230
+ <InfoPrompt
231
+ {...args}
232
+ description="Tap the prompt."
233
+ action={{
234
+ label: 'Navigate',
235
+ href: '#',
236
+ onClick: (e: MouseEvent) => {
237
+ e.preventDefault();
238
+ setNavigated(true);
239
+ },
240
+ }}
241
+ />
242
+ {navigated && <div>Navigated!</div>}
243
+ </>
244
+ );
245
+ },
246
+ };