@transferwise/components 46.50.1 → 46.52.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 (493) hide show
  1. package/build/accordion/AccordionItem/AccordionItem.js +3 -7
  2. package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
  3. package/build/accordion/AccordionItem/AccordionItem.mjs +3 -3
  4. package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
  5. package/build/actionButton/ActionButton.js +2 -6
  6. package/build/actionButton/ActionButton.js.map +1 -1
  7. package/build/actionButton/ActionButton.mjs +2 -2
  8. package/build/actionButton/ActionButton.mjs.map +1 -1
  9. package/build/actionOption/ActionOption.js +2 -6
  10. package/build/actionOption/ActionOption.js.map +1 -1
  11. package/build/actionOption/ActionOption.mjs +2 -2
  12. package/build/actionOption/ActionOption.mjs.map +1 -1
  13. package/build/alert/Alert.js +3 -7
  14. package/build/alert/Alert.js.map +1 -1
  15. package/build/alert/Alert.mjs +3 -3
  16. package/build/alert/Alert.mjs.map +1 -1
  17. package/build/avatar/Avatar.js +2 -6
  18. package/build/avatar/Avatar.js.map +1 -1
  19. package/build/avatar/Avatar.mjs +2 -2
  20. package/build/avatar/Avatar.mjs.map +1 -1
  21. package/build/badge/Badge.js +2 -6
  22. package/build/badge/Badge.js.map +1 -1
  23. package/build/badge/Badge.mjs +2 -2
  24. package/build/badge/Badge.mjs.map +1 -1
  25. package/build/body/Body.js +2 -6
  26. package/build/body/Body.js.map +1 -1
  27. package/build/body/Body.mjs +2 -2
  28. package/build/body/Body.mjs.map +1 -1
  29. package/build/button/Button.js +2 -6
  30. package/build/button/Button.js.map +1 -1
  31. package/build/button/Button.mjs +2 -2
  32. package/build/button/Button.mjs.map +1 -1
  33. package/build/card/Card.js +4 -8
  34. package/build/card/Card.js.map +1 -1
  35. package/build/card/Card.mjs +4 -4
  36. package/build/card/Card.mjs.map +1 -1
  37. package/build/carousel/Carousel.js +5 -9
  38. package/build/carousel/Carousel.js.map +1 -1
  39. package/build/carousel/Carousel.mjs +5 -5
  40. package/build/carousel/Carousel.mjs.map +1 -1
  41. package/build/checkbox/Checkbox.js +3 -7
  42. package/build/checkbox/Checkbox.js.map +1 -1
  43. package/build/checkbox/Checkbox.mjs +3 -3
  44. package/build/checkbox/Checkbox.mjs.map +1 -1
  45. package/build/checkboxButton/CheckboxButton.js +2 -6
  46. package/build/checkboxButton/CheckboxButton.js.map +1 -1
  47. package/build/checkboxButton/CheckboxButton.mjs +2 -2
  48. package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
  49. package/build/chevron/Chevron.js +3 -7
  50. package/build/chevron/Chevron.js.map +1 -1
  51. package/build/chevron/Chevron.mjs +3 -3
  52. package/build/chevron/Chevron.mjs.map +1 -1
  53. package/build/chips/Chip.js +2 -6
  54. package/build/chips/Chip.js.map +1 -1
  55. package/build/chips/Chip.mjs +2 -2
  56. package/build/chips/Chip.mjs.map +1 -1
  57. package/build/chips/Chips.js +3 -7
  58. package/build/chips/Chips.js.map +1 -1
  59. package/build/chips/Chips.mjs +3 -3
  60. package/build/chips/Chips.mjs.map +1 -1
  61. package/build/circularButton/CircularButton.js +3 -7
  62. package/build/circularButton/CircularButton.js.map +1 -1
  63. package/build/circularButton/CircularButton.mjs +3 -3
  64. package/build/circularButton/CircularButton.mjs.map +1 -1
  65. package/build/common/Option/Option.js +3 -7
  66. package/build/common/Option/Option.js.map +1 -1
  67. package/build/common/Option/Option.mjs +3 -3
  68. package/build/common/Option/Option.mjs.map +1 -1
  69. package/build/common/RadioButton/RadioButton.js +2 -6
  70. package/build/common/RadioButton/RadioButton.js.map +1 -1
  71. package/build/common/RadioButton/RadioButton.mjs +2 -2
  72. package/build/common/RadioButton/RadioButton.mjs.map +1 -1
  73. package/build/common/action/Action.js +2 -6
  74. package/build/common/action/Action.js.map +1 -1
  75. package/build/common/action/Action.mjs +2 -2
  76. package/build/common/action/Action.mjs.map +1 -1
  77. package/build/common/bottomSheet/BottomSheet.js +2 -6
  78. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  79. package/build/common/bottomSheet/BottomSheet.mjs +2 -2
  80. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  81. package/build/common/card/Card.js +2 -6
  82. package/build/common/card/Card.js.map +1 -1
  83. package/build/common/card/Card.mjs +2 -2
  84. package/build/common/card/Card.mjs.map +1 -1
  85. package/build/common/closeButton/CloseButton.js +2 -6
  86. package/build/common/closeButton/CloseButton.js.map +1 -1
  87. package/build/common/closeButton/CloseButton.mjs +2 -2
  88. package/build/common/closeButton/CloseButton.mjs.map +1 -1
  89. package/build/common/flowHeader/FlowHeader.js +3 -6
  90. package/build/common/flowHeader/FlowHeader.js.map +1 -1
  91. package/build/common/flowHeader/FlowHeader.mjs +3 -3
  92. package/build/common/flowHeader/FlowHeader.mjs.map +1 -1
  93. package/build/common/panel/Panel.js +4 -8
  94. package/build/common/panel/Panel.js.map +1 -1
  95. package/build/common/panel/Panel.mjs +4 -4
  96. package/build/common/panel/Panel.mjs.map +1 -1
  97. package/build/criticalBanner/CriticalCommsBanner.js +4 -8
  98. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  99. package/build/criticalBanner/CriticalCommsBanner.mjs +4 -4
  100. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  101. package/build/dateInput/DateInput.js +2 -6
  102. package/build/dateInput/DateInput.js.map +1 -1
  103. package/build/dateInput/DateInput.mjs +2 -2
  104. package/build/dateInput/DateInput.mjs.map +1 -1
  105. package/build/dateLookup/DateLookup.js +2 -6
  106. package/build/dateLookup/DateLookup.js.map +1 -1
  107. package/build/dateLookup/DateLookup.mjs +2 -2
  108. package/build/dateLookup/DateLookup.mjs.map +1 -1
  109. package/build/dateLookup/dateHeader/DateHeader.js +2 -6
  110. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  111. package/build/dateLookup/dateHeader/DateHeader.mjs +2 -2
  112. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  113. package/build/dateLookup/tableLink/TableLink.js +15 -21
  114. package/build/dateLookup/tableLink/TableLink.js.map +1 -1
  115. package/build/dateLookup/tableLink/TableLink.mjs +16 -18
  116. package/build/dateLookup/tableLink/TableLink.mjs.map +1 -1
  117. package/build/decision/Decision.js +3 -7
  118. package/build/decision/Decision.js.map +1 -1
  119. package/build/decision/Decision.mjs +3 -3
  120. package/build/decision/Decision.mjs.map +1 -1
  121. package/build/definitionList/DefinitionList.js +4 -8
  122. package/build/definitionList/DefinitionList.js.map +1 -1
  123. package/build/definitionList/DefinitionList.mjs +4 -4
  124. package/build/definitionList/DefinitionList.mjs.map +1 -1
  125. package/build/dimmer/Dimmer.js +6 -10
  126. package/build/dimmer/Dimmer.js.map +1 -1
  127. package/build/dimmer/Dimmer.mjs +6 -6
  128. package/build/dimmer/Dimmer.mjs.map +1 -1
  129. package/build/display/Display.js +2 -6
  130. package/build/display/Display.js.map +1 -1
  131. package/build/display/Display.mjs +2 -2
  132. package/build/display/Display.mjs.map +1 -1
  133. package/build/drawer/Drawer.js +5 -9
  134. package/build/drawer/Drawer.js.map +1 -1
  135. package/build/drawer/Drawer.mjs +5 -5
  136. package/build/drawer/Drawer.mjs.map +1 -1
  137. package/build/field/Field.js +2 -6
  138. package/build/field/Field.js.map +1 -1
  139. package/build/field/Field.mjs +2 -2
  140. package/build/field/Field.mjs.map +1 -1
  141. package/build/flowNavigation/FlowNavigation.js +4 -8
  142. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  143. package/build/flowNavigation/FlowNavigation.mjs +4 -4
  144. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  145. package/build/flowNavigation/animatedLabel/AnimatedLabel.js +3 -7
  146. package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
  147. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +3 -3
  148. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
  149. package/build/flowNavigation/backButton/BackButton.js +2 -6
  150. package/build/flowNavigation/backButton/BackButton.js.map +1 -1
  151. package/build/flowNavigation/backButton/BackButton.mjs +2 -2
  152. package/build/flowNavigation/backButton/BackButton.mjs.map +1 -1
  153. package/build/header/Header.js +3 -7
  154. package/build/header/Header.js.map +1 -1
  155. package/build/header/Header.mjs +3 -3
  156. package/build/header/Header.mjs.map +1 -1
  157. package/build/i18n/zh-HK.json +2 -0
  158. package/build/i18n/zh-HK.json.js +2 -0
  159. package/build/i18n/zh-HK.json.js.map +1 -1
  160. package/build/i18n/zh-HK.json.mjs +2 -0
  161. package/build/i18n/zh-HK.json.mjs.map +1 -1
  162. package/build/image/Image.js +2 -6
  163. package/build/image/Image.js.map +1 -1
  164. package/build/image/Image.mjs +2 -2
  165. package/build/image/Image.mjs.map +1 -1
  166. package/build/info/Info.js +2 -6
  167. package/build/info/Info.js.map +1 -1
  168. package/build/info/Info.mjs +2 -2
  169. package/build/info/Info.mjs.map +1 -1
  170. package/build/inlineAlert/InlineAlert.js +2 -6
  171. package/build/inlineAlert/InlineAlert.js.map +1 -1
  172. package/build/inlineAlert/InlineAlert.mjs +2 -2
  173. package/build/inlineAlert/InlineAlert.mjs.map +1 -1
  174. package/build/inputs/Input.js +2 -6
  175. package/build/inputs/Input.js.map +1 -1
  176. package/build/inputs/Input.mjs +2 -2
  177. package/build/inputs/Input.mjs.map +1 -1
  178. package/build/inputs/InputGroup.js +3 -7
  179. package/build/inputs/InputGroup.js.map +1 -1
  180. package/build/inputs/InputGroup.mjs +3 -3
  181. package/build/inputs/InputGroup.mjs.map +1 -1
  182. package/build/inputs/SelectInput.js +118 -48
  183. package/build/inputs/SelectInput.js.map +1 -1
  184. package/build/inputs/SelectInput.mjs +120 -49
  185. package/build/inputs/SelectInput.mjs.map +1 -1
  186. package/build/inputs/TextArea.js +2 -6
  187. package/build/inputs/TextArea.js.map +1 -1
  188. package/build/inputs/TextArea.mjs +2 -2
  189. package/build/inputs/TextArea.mjs.map +1 -1
  190. package/build/inputs/_BottomSheet.js +2 -6
  191. package/build/inputs/_BottomSheet.js.map +1 -1
  192. package/build/inputs/_BottomSheet.mjs +2 -2
  193. package/build/inputs/_BottomSheet.mjs.map +1 -1
  194. package/build/inputs/_ButtonInput.js +2 -6
  195. package/build/inputs/_ButtonInput.js.map +1 -1
  196. package/build/inputs/_ButtonInput.mjs +2 -2
  197. package/build/inputs/_ButtonInput.mjs.map +1 -1
  198. package/build/inputs/_Popover.js +3 -7
  199. package/build/inputs/_Popover.js.map +1 -1
  200. package/build/inputs/_Popover.mjs +3 -3
  201. package/build/inputs/_Popover.mjs.map +1 -1
  202. package/build/inputs/_common.js +2 -6
  203. package/build/inputs/_common.js.map +1 -1
  204. package/build/inputs/_common.mjs +2 -2
  205. package/build/inputs/_common.mjs.map +1 -1
  206. package/build/instructionsList/InstructionsList.js +2 -6
  207. package/build/instructionsList/InstructionsList.js.map +1 -1
  208. package/build/instructionsList/InstructionsList.mjs +2 -2
  209. package/build/instructionsList/InstructionsList.mjs.map +1 -1
  210. package/build/label/Label.js +2 -6
  211. package/build/label/Label.js.map +1 -1
  212. package/build/label/Label.mjs +2 -2
  213. package/build/label/Label.mjs.map +1 -1
  214. package/build/link/Link.js +2 -6
  215. package/build/link/Link.js.map +1 -1
  216. package/build/link/Link.mjs +2 -2
  217. package/build/link/Link.mjs.map +1 -1
  218. package/build/listItem/ListItem.js +3 -7
  219. package/build/listItem/ListItem.js.map +1 -1
  220. package/build/listItem/ListItem.mjs +3 -3
  221. package/build/listItem/ListItem.mjs.map +1 -1
  222. package/build/loader/Loader.js +2 -6
  223. package/build/loader/Loader.js.map +1 -1
  224. package/build/loader/Loader.mjs +4 -4
  225. package/build/loader/Loader.mjs.map +1 -1
  226. package/build/logo/Logo.js +2 -6
  227. package/build/logo/Logo.js.map +1 -1
  228. package/build/logo/Logo.mjs +2 -2
  229. package/build/logo/Logo.mjs.map +1 -1
  230. package/build/main.css +10 -0
  231. package/build/modal/Modal.js +7 -11
  232. package/build/modal/Modal.js.map +1 -1
  233. package/build/modal/Modal.mjs +7 -7
  234. package/build/modal/Modal.mjs.map +1 -1
  235. package/build/moneyInput/MoneyInput.js +17 -39
  236. package/build/moneyInput/MoneyInput.js.map +1 -1
  237. package/build/moneyInput/MoneyInput.mjs +17 -35
  238. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  239. package/build/navigationOption/NavigationOption.js +2 -6
  240. package/build/navigationOption/NavigationOption.js.map +1 -1
  241. package/build/navigationOption/NavigationOption.mjs +2 -2
  242. package/build/navigationOption/NavigationOption.mjs.map +1 -1
  243. package/build/nudge/Nudge.js +4 -8
  244. package/build/nudge/Nudge.js.map +1 -1
  245. package/build/nudge/Nudge.mjs +4 -4
  246. package/build/nudge/Nudge.mjs.map +1 -1
  247. package/build/overlayHeader/OverlayHeader.js +3 -7
  248. package/build/overlayHeader/OverlayHeader.js.map +1 -1
  249. package/build/overlayHeader/OverlayHeader.mjs +3 -3
  250. package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
  251. package/build/popover/Popover.js +2 -6
  252. package/build/popover/Popover.js.map +1 -1
  253. package/build/popover/Popover.mjs +2 -2
  254. package/build/popover/Popover.mjs.map +1 -1
  255. package/build/processIndicator/ProcessIndicator.js +2 -6
  256. package/build/processIndicator/ProcessIndicator.js.map +1 -1
  257. package/build/processIndicator/ProcessIndicator.mjs +2 -2
  258. package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
  259. package/build/progress/Progress.js +2 -6
  260. package/build/progress/Progress.js.map +1 -1
  261. package/build/progress/Progress.mjs +2 -2
  262. package/build/progress/Progress.mjs.map +1 -1
  263. package/build/progressBar/ProgressBar.js +2 -6
  264. package/build/progressBar/ProgressBar.js.map +1 -1
  265. package/build/progressBar/ProgressBar.mjs +2 -2
  266. package/build/progressBar/ProgressBar.mjs.map +1 -1
  267. package/build/promoCard/PromoCard.js +3 -4
  268. package/build/promoCard/PromoCard.js.map +1 -1
  269. package/build/promoCard/PromoCard.mjs +3 -3
  270. package/build/promoCard/PromoCard.mjs.map +1 -1
  271. package/build/promoCard/PromoCardGroup.js +2 -3
  272. package/build/promoCard/PromoCardGroup.js.map +1 -1
  273. package/build/promoCard/PromoCardGroup.mjs +2 -2
  274. package/build/promoCard/PromoCardGroup.mjs.map +1 -1
  275. package/build/promoCard/PromoCardIndicator.js +2 -6
  276. package/build/promoCard/PromoCardIndicator.js.map +1 -1
  277. package/build/promoCard/PromoCardIndicator.mjs +2 -2
  278. package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
  279. package/build/radio/Radio.js +5 -9
  280. package/build/radio/Radio.js.map +1 -1
  281. package/build/radio/Radio.mjs +5 -5
  282. package/build/radio/Radio.mjs.map +1 -1
  283. package/build/section/Section.js +2 -6
  284. package/build/section/Section.js.map +1 -1
  285. package/build/section/Section.mjs +2 -2
  286. package/build/section/Section.mjs.map +1 -1
  287. package/build/segmentedControl/SegmentedControl.js +5 -9
  288. package/build/segmentedControl/SegmentedControl.js.map +1 -1
  289. package/build/segmentedControl/SegmentedControl.mjs +5 -5
  290. package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
  291. package/build/select/Select.js +9 -10
  292. package/build/select/Select.js.map +1 -1
  293. package/build/select/Select.mjs +9 -9
  294. package/build/select/Select.mjs.map +1 -1
  295. package/build/select/option/Option.js +2 -6
  296. package/build/select/option/Option.js.map +1 -1
  297. package/build/select/option/Option.mjs +2 -2
  298. package/build/select/option/Option.mjs.map +1 -1
  299. package/build/select/searchBox/SearchBox.js +4 -8
  300. package/build/select/searchBox/SearchBox.js.map +1 -1
  301. package/build/select/searchBox/SearchBox.mjs +6 -6
  302. package/build/select/searchBox/SearchBox.mjs.map +1 -1
  303. package/build/selectOption/SelectOption.js +4 -8
  304. package/build/selectOption/SelectOption.js.map +1 -1
  305. package/build/selectOption/SelectOption.mjs +4 -4
  306. package/build/selectOption/SelectOption.mjs.map +1 -1
  307. package/build/slidingPanel/SlidingPanel.js +2 -6
  308. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  309. package/build/slidingPanel/SlidingPanel.mjs +2 -2
  310. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  311. package/build/statusIcon/StatusIcon.js +3 -7
  312. package/build/statusIcon/StatusIcon.js.map +1 -1
  313. package/build/statusIcon/StatusIcon.mjs +3 -3
  314. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  315. package/build/stepper/Stepper.js +3 -7
  316. package/build/stepper/Stepper.js.map +1 -1
  317. package/build/stepper/Stepper.mjs +3 -3
  318. package/build/stepper/Stepper.mjs.map +1 -1
  319. package/build/styles/inputs/SelectInput.css +10 -0
  320. package/build/styles/main.css +10 -0
  321. package/build/summary/Summary.js +2 -6
  322. package/build/summary/Summary.js.map +1 -1
  323. package/build/summary/Summary.mjs +2 -2
  324. package/build/summary/Summary.mjs.map +1 -1
  325. package/build/switch/Switch.js +2 -6
  326. package/build/switch/Switch.js.map +1 -1
  327. package/build/switch/Switch.mjs +2 -2
  328. package/build/switch/Switch.mjs.map +1 -1
  329. package/build/tabs/Tab.js +6 -7
  330. package/build/tabs/Tab.js.map +1 -1
  331. package/build/tabs/Tab.mjs +6 -6
  332. package/build/tabs/Tab.mjs.map +1 -1
  333. package/build/tabs/Tabs.js +2 -3
  334. package/build/tabs/Tabs.js.map +1 -1
  335. package/build/tabs/Tabs.mjs +2 -2
  336. package/build/tabs/Tabs.mjs.map +1 -1
  337. package/build/tile/Tile.js +3 -7
  338. package/build/tile/Tile.js.map +1 -1
  339. package/build/tile/Tile.mjs +3 -3
  340. package/build/tile/Tile.mjs.map +1 -1
  341. package/build/title/Title.js +3 -7
  342. package/build/title/Title.js.map +1 -1
  343. package/build/title/Title.mjs +3 -3
  344. package/build/title/Title.mjs.map +1 -1
  345. package/build/tooltip/Tooltip.js +3 -7
  346. package/build/tooltip/Tooltip.js.map +1 -1
  347. package/build/tooltip/Tooltip.mjs +3 -3
  348. package/build/tooltip/Tooltip.mjs.map +1 -1
  349. package/build/typeahead/Typeahead.js +6 -7
  350. package/build/typeahead/Typeahead.js.map +1 -1
  351. package/build/typeahead/Typeahead.mjs +6 -6
  352. package/build/typeahead/Typeahead.mjs.map +1 -1
  353. package/build/typeahead/typeaheadInput/TypeaheadInput.js +2 -6
  354. package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
  355. package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +2 -2
  356. package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
  357. package/build/typeahead/typeaheadOption/TypeaheadOption.js +2 -6
  358. package/build/typeahead/typeaheadOption/TypeaheadOption.js.map +1 -1
  359. package/build/typeahead/typeaheadOption/TypeaheadOption.mjs +2 -2
  360. package/build/typeahead/typeaheadOption/TypeaheadOption.mjs.map +1 -1
  361. package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
  362. package/build/types/chevron/Chevron.d.ts.map +1 -1
  363. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  364. package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
  365. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  366. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  367. package/build/types/link/Link.d.ts.map +1 -1
  368. package/build/types/modal/Modal.d.ts.map +1 -1
  369. package/build/types/moneyInput/MoneyInput.d.ts +0 -1
  370. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  371. package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
  372. package/build/types/tabs/Tab.d.ts.map +1 -1
  373. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  374. package/build/upload/Upload.js +2 -6
  375. package/build/upload/Upload.js.map +1 -1
  376. package/build/upload/Upload.mjs +2 -2
  377. package/build/upload/Upload.mjs.map +1 -1
  378. package/build/uploadInput/UploadInput.js +2 -6
  379. package/build/uploadInput/UploadInput.js.map +1 -1
  380. package/build/uploadInput/UploadInput.mjs +2 -2
  381. package/build/uploadInput/UploadInput.mjs.map +1 -1
  382. package/build/uploadInput/uploadButton/UploadButton.js +5 -9
  383. package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
  384. package/build/uploadInput/uploadButton/UploadButton.mjs +5 -5
  385. package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
  386. package/build/uploadInput/uploadItem/UploadItem.js +3 -7
  387. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  388. package/build/uploadInput/uploadItem/UploadItem.mjs +3 -3
  389. package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
  390. package/build/uploadInput/uploadItem/UploadItemLink.js +2 -6
  391. package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
  392. package/build/uploadInput/uploadItem/UploadItemLink.mjs +2 -2
  393. package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
  394. package/package.json +6 -5
  395. package/src/accordion/AccordionItem/AccordionItem.tsx +5 -9
  396. package/src/actionButton/ActionButton.tsx +2 -2
  397. package/src/actionOption/ActionOption.tsx +2 -2
  398. package/src/alert/Alert.tsx +3 -3
  399. package/src/avatar/Avatar.tsx +2 -2
  400. package/src/badge/Badge.tsx +2 -2
  401. package/src/body/Body.tsx +2 -2
  402. package/src/button/Button.tsx +2 -2
  403. package/src/card/Card.tsx +4 -4
  404. package/src/carousel/Carousel.tsx +5 -5
  405. package/src/checkbox/Checkbox.tsx +3 -3
  406. package/src/checkboxButton/CheckboxButton.tsx +2 -2
  407. package/src/chevron/Chevron.tsx +3 -12
  408. package/src/chips/Chip.tsx +2 -2
  409. package/src/chips/Chips.tsx +3 -3
  410. package/src/circularButton/CircularButton.tsx +4 -7
  411. package/src/common/Option/Option.tsx +3 -3
  412. package/src/common/RadioButton/RadioButton.tsx +2 -2
  413. package/src/common/action/Action.tsx +2 -2
  414. package/src/common/bottomSheet/BottomSheet.tsx +2 -2
  415. package/src/common/card/Card.tsx +2 -2
  416. package/src/common/closeButton/CloseButton.tsx +2 -2
  417. package/src/common/flowHeader/FlowHeader.tsx +3 -3
  418. package/src/common/panel/Panel.tsx +4 -4
  419. package/src/criticalBanner/CriticalCommsBanner.tsx +4 -4
  420. package/src/dateInput/DateInput.tsx +2 -2
  421. package/src/dateLookup/DateLookup.tsx +2 -2
  422. package/src/dateLookup/dateHeader/DateHeader.tsx +2 -2
  423. package/src/dateLookup/tableLink/TableLink.tsx +3 -5
  424. package/src/decision/Decision.tsx +3 -3
  425. package/src/definitionList/DefinitionList.tsx +4 -4
  426. package/src/dimmer/Dimmer.tsx +6 -6
  427. package/src/display/Display.tsx +2 -2
  428. package/src/drawer/Drawer.tsx +5 -5
  429. package/src/field/Field.tsx +3 -3
  430. package/src/flowNavigation/FlowNavigation.tsx +6 -7
  431. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +3 -3
  432. package/src/flowNavigation/backButton/BackButton.tsx +2 -2
  433. package/src/header/Header.tsx +3 -3
  434. package/src/i18n/zh-HK.json +2 -0
  435. package/src/image/Image.tsx +2 -2
  436. package/src/info/Info.tsx +2 -2
  437. package/src/inlineAlert/InlineAlert.tsx +2 -2
  438. package/src/inputs/Input.tsx +2 -2
  439. package/src/inputs/InputGroup.tsx +3 -3
  440. package/src/inputs/SelectInput.css +10 -0
  441. package/src/inputs/SelectInput.less +12 -0
  442. package/src/inputs/SelectInput.story.tsx +22 -2
  443. package/src/inputs/SelectInput.tsx +156 -58
  444. package/src/inputs/TextArea.tsx +2 -2
  445. package/src/inputs/_BottomSheet.tsx +2 -2
  446. package/src/inputs/_ButtonInput.tsx +2 -2
  447. package/src/inputs/_Popover.tsx +3 -3
  448. package/src/inputs/_common.ts +2 -2
  449. package/src/instructionsList/InstructionsList.tsx +3 -3
  450. package/src/label/Label.tsx +2 -2
  451. package/src/link/Link.tsx +2 -7
  452. package/src/listItem/ListItem.tsx +3 -3
  453. package/src/loader/Loader.tsx +2 -2
  454. package/src/logo/Logo.tsx +2 -2
  455. package/src/main.css +10 -0
  456. package/src/modal/Modal.tsx +9 -15
  457. package/src/moneyInput/MoneyInput.story.tsx +0 -34
  458. package/src/moneyInput/MoneyInput.tsx +6 -29
  459. package/src/navigationOption/NavigationOption.tsx +2 -2
  460. package/src/nudge/Nudge.tsx +4 -4
  461. package/src/overlayHeader/OverlayHeader.tsx +3 -3
  462. package/src/popover/Popover.tsx +2 -2
  463. package/src/processIndicator/ProcessIndicator.tsx +2 -2
  464. package/src/progress/Progress.tsx +2 -2
  465. package/src/progressBar/ProgressBar.tsx +2 -2
  466. package/src/promoCard/PromoCard.tsx +4 -4
  467. package/src/promoCard/PromoCardGroup.tsx +2 -2
  468. package/src/promoCard/PromoCardIndicator.tsx +2 -2
  469. package/src/radio/Radio.tsx +5 -5
  470. package/src/section/Section.tsx +2 -2
  471. package/src/segmentedControl/SegmentedControl.tsx +5 -5
  472. package/src/select/Select.js +9 -9
  473. package/src/select/option/Option.tsx +2 -2
  474. package/src/select/searchBox/SearchBox.tsx +4 -7
  475. package/src/selectOption/SelectOption.tsx +5 -5
  476. package/src/slidingPanel/SlidingPanel.tsx +2 -2
  477. package/src/statusIcon/StatusIcon.tsx +3 -3
  478. package/src/stepper/Stepper.tsx +3 -3
  479. package/src/summary/Summary.tsx +2 -2
  480. package/src/switch/Switch.tsx +2 -2
  481. package/src/tabs/Tab.js +8 -12
  482. package/src/tabs/Tabs.js +2 -2
  483. package/src/tile/Tile.tsx +3 -3
  484. package/src/title/Title.tsx +3 -3
  485. package/src/tooltip/Tooltip.tsx +3 -3
  486. package/src/typeahead/Typeahead.tsx +6 -6
  487. package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +2 -2
  488. package/src/typeahead/typeaheadOption/TypeaheadOption.tsx +2 -2
  489. package/src/upload/Upload.tsx +2 -2
  490. package/src/uploadInput/UploadInput.tsx +2 -2
  491. package/src/uploadInput/uploadButton/UploadButton.tsx +5 -9
  492. package/src/uploadInput/uploadItem/UploadItem.tsx +3 -3
  493. package/src/uploadInput/uploadItem/UploadItemLink.tsx +2 -2
@@ -1,11 +1,12 @@
1
1
  import { Listbox as ListboxBase } from '@headlessui/react';
2
2
  import { Check, ChevronDown, Cross, CrossCircle } from '@transferwise/icons';
3
- import classNames from 'classnames';
3
+ import { clsx } from 'clsx';
4
4
  import mergeProps from 'merge-props';
5
5
  import {
6
6
  createContext,
7
7
  forwardRef,
8
8
  useContext,
9
+ useDeferredValue,
9
10
  useEffect,
10
11
  useId,
11
12
  useMemo,
@@ -13,6 +14,7 @@ import {
13
14
  useState,
14
15
  } from 'react';
15
16
  import { useIntl } from 'react-intl';
17
+ import { Virtualizer } from 'virtua';
16
18
 
17
19
  import { useEffectEvent } from '../common/hooks/useEffectEvent';
18
20
  import { useScreenSize } from '../common/hooks/useScreenSize';
@@ -29,6 +31,8 @@ import { InputGroup } from './InputGroup';
29
31
  import { SearchInput } from './SearchInput';
30
32
  import messages from './SelectInput.messages';
31
33
 
34
+ const MAX_ITEMS_WITHOUT_VIRTUALIZATION = 50;
35
+
32
36
  function searchableString(value: string) {
33
37
  return value.trim().replace(/\s+/gu, ' ').normalize('NFKC').toLowerCase();
34
38
  }
@@ -40,22 +44,13 @@ function inferSearchableStrings(value: unknown) {
40
44
 
41
45
  if (typeof value === 'object' && value != null) {
42
46
  return Object.values(value)
43
- .filter((innerValue): innerValue is string => typeof innerValue === 'string')
47
+ .filter((innerValue) => typeof innerValue === 'string')
44
48
  .map((innerValue) => searchableString(innerValue));
45
49
  }
46
50
 
47
51
  return [];
48
52
  }
49
53
 
50
- const SelectInputTriggerButtonPropsContext = createContext<{
51
- ref?: React.ForwardedRef<HTMLButtonElement | null>;
52
- id?: string;
53
- onClick?: (event: React.MouseEvent) => void;
54
- onKeyDown?: (event: React.KeyboardEvent) => void;
55
- [key: string]: unknown;
56
- }>({});
57
- const SelectInputOptionContentWithinTriggerContext = createContext(false);
58
-
59
54
  export interface SelectInputOptionItem<T = string> {
60
55
  type: 'option';
61
56
  value: T;
@@ -89,6 +84,11 @@ function dedupeSelectInputOptionItem<T>(
89
84
  return { ...item, value: undefined };
90
85
  }
91
86
 
87
+ /**
88
+ * Sets the `value` of duplicate option items to `undefined`, hiding them when
89
+ * rendered. Indexes are kept intact within groups to preserve the active item
90
+ * between filter changes when possible.
91
+ */
92
92
  function dedupeSelectInputItems<T>(
93
93
  items: readonly SelectInputItem<T>[],
94
94
  ): SelectInputItem<T | undefined>[] {
@@ -112,20 +112,23 @@ function dedupeSelectInputItems<T>(
112
112
  });
113
113
  }
114
114
 
115
- function filterSelectInputOptionItem<T>(item: SelectInputOptionItem<T>, needle: string) {
115
+ function selectInputOptionItemIncludesNeedle<T>(item: SelectInputOptionItem<T>, needle: string) {
116
116
  return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
117
117
  haystack.includes(needle),
118
118
  );
119
119
  }
120
120
 
121
- function filterSelectInputItems<T>(items: readonly SelectInputItem<T>[], needle: string) {
121
+ function filterSelectInputItems<T>(
122
+ items: readonly SelectInputItem<T>[],
123
+ predicate: (item: SelectInputOptionItem<T>) => boolean,
124
+ ) {
122
125
  return items.filter((item) => {
123
126
  switch (item.type) {
124
127
  case 'option': {
125
- return filterSelectInputOptionItem(item, needle);
128
+ return predicate(item);
126
129
  }
127
130
  case 'group': {
128
- return item.options.some((option) => filterSelectInputOptionItem(option, needle));
131
+ return item.options.some((option) => predicate(option));
129
132
  }
130
133
  default:
131
134
  }
@@ -173,7 +176,7 @@ const defaultRenderTrigger = (({ content, placeholderShown, clear, disabled, siz
173
176
  <InputGroup
174
177
  addonEnd={{
175
178
  content: (
176
- <span className={classNames('np-select-input-addon-container', disabled && 'disabled')}>
179
+ <span className={clsx('np-select-input-addon-container', disabled && 'disabled')}>
177
180
  {clear != null && !placeholderShown ? (
178
181
  <>
179
182
  <SelectInputClearButton
@@ -199,7 +202,7 @@ const defaultRenderTrigger = (({ content, placeholderShown, clear, disabled, siz
199
202
  >
200
203
  <SelectInputTriggerButton as={ButtonInput} size={size}>
201
204
  <span
202
- className={classNames(
205
+ className={clsx(
203
206
  'np-select-input-content',
204
207
  placeholderShown && 'np-select-input-placeholder',
205
208
  )}
@@ -220,7 +223,7 @@ function SelectInputClearButton({ className, onClick }: SelectInputClearButtonPr
220
223
  <button
221
224
  type="button"
222
225
  aria-label={intl.formatMessage(dateTriggerMessages.ariaLabel)}
223
- className={classNames(className, 'np-select-input-addon np-select-input-addon--interactive')}
226
+ className={clsx(className, 'np-select-input-addon np-select-input-addon--interactive')}
224
227
  onClick={onClick}
225
228
  >
226
229
  <Cross size={16} />
@@ -271,12 +274,15 @@ export function SelectInput<T = string, M extends boolean = false>({
271
274
  }, [handleClose, open]);
272
275
 
273
276
  const [filterQuery, _setFilterQuery] = useState('');
277
+ const deferredFilterQuery = useDeferredValue(filterQuery);
274
278
  const setFilterQuery = useEffectEvent((query: string) => {
275
279
  _setFilterQuery(query);
276
- onFilterChange({
277
- query,
278
- queryNormalized: query ? searchableString(query) : null,
279
- });
280
+ if (query !== filterQuery) {
281
+ onFilterChange({
282
+ query,
283
+ queryNormalized: query ? searchableString(query) : null,
284
+ });
285
+ }
280
286
  });
281
287
 
282
288
  const triggerRef = useRef<HTMLButtonElement | null>(null);
@@ -294,9 +300,7 @@ export function SelectInput<T = string, M extends boolean = false>({
294
300
  multiple={multiple}
295
301
  defaultValue={defaultValue}
296
302
  value={controlledValue}
297
- // TODO: Remove assertion when upgrading TypeScript to v5
298
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
299
- by={compareValues as any}
303
+ by={compareValues}
300
304
  disabled={disabled}
301
305
  onChange={
302
306
  ((value) => {
@@ -349,8 +353,8 @@ export function SelectInput<T = string, M extends boolean = false>({
349
353
  content: !placeholderShown ? (
350
354
  <SelectInputOptionContentWithinTriggerContext.Provider value>
351
355
  {multiple && Array.isArray(value)
352
- ? value
353
- .map((option: NonNullable<T>) => renderValue(option, true))
356
+ ? (value as readonly NonNullable<T>[])
357
+ .map((option) => renderValue(option, true))
354
358
  .filter((node) => node != null)
355
359
  .join(', ')
356
360
  : renderValue(value as NonNullable<T>, true)}
@@ -379,9 +383,7 @@ export function SelectInput<T = string, M extends boolean = false>({
379
383
  setOpen(false);
380
384
  }}
381
385
  onCloseEnd={() => {
382
- if (filterQuery !== '') {
383
- setFilterQuery('');
384
- }
386
+ setFilterQuery('');
385
387
  }}
386
388
  >
387
389
  <SelectInputOptions
@@ -392,7 +394,7 @@ export function SelectInput<T = string, M extends boolean = false>({
392
394
  filterPlaceholder={filterPlaceholder}
393
395
  searchInputRef={searchInputRef}
394
396
  listboxRef={listboxRef}
395
- filterQuery={filterQuery}
397
+ filterQuery={deferredFilterQuery}
396
398
  onFilterChange={setFilterQuery}
397
399
  />
398
400
  </OptionsOverlay>
@@ -402,6 +404,14 @@ export function SelectInput<T = string, M extends boolean = false>({
402
404
  );
403
405
  }
404
406
 
407
+ const SelectInputTriggerButtonPropsContext = createContext<{
408
+ ref?: React.ForwardedRef<HTMLButtonElement | null>;
409
+ id?: string;
410
+ onClick?: (event: React.MouseEvent) => void;
411
+ onKeyDown?: (event: React.KeyboardEvent) => void;
412
+ [key: string]: unknown;
413
+ }>({});
414
+
405
415
  type SelectInputTriggerButtonElementType = 'button' | React.ComponentType;
406
416
 
407
417
  export type SelectInputTriggerButtonProps<
@@ -506,7 +516,51 @@ function SelectInputOptions<T = string>({
506
516
  }
507
517
  return undefined;
508
518
  }, [filterQuery, filterable]);
509
- const resultsEmpty = needle != null && filterSelectInputItems(items, needle).length === 0;
519
+ useEffect(() => {
520
+ if (needle) {
521
+ // Ensure having an active option while filtering.
522
+ // Without `requestAnimationFrame` upon which React depends for scheduling
523
+ // updates, the active status would only show for a split second and then
524
+ // disappear inadvertently.
525
+ requestAnimationFrame(() => {
526
+ if (
527
+ controllerRef.current != null &&
528
+ !controllerRef.current.hasAttribute('aria-activedescendant')
529
+ ) {
530
+ // Activate first option via synthetic key press
531
+ controllerRef.current.dispatchEvent(
532
+ new KeyboardEvent('keydown', { key: 'Home', bubbles: true }),
533
+ );
534
+ }
535
+ });
536
+ }
537
+ }, [controllerRef, needle]);
538
+
539
+ const filteredItems: readonly SelectInputItem<NonNullable<T> | undefined>[] =
540
+ needle != null
541
+ ? filterSelectInputItems(dedupeSelectInputItems(items), (item) =>
542
+ selectInputOptionItemIncludesNeedle(item, needle),
543
+ )
544
+ : items;
545
+ const resultsEmpty = needle != null && filteredItems.length === 0;
546
+
547
+ const virtualized = filteredItems.length > MAX_ITEMS_WITHOUT_VIRTUALIZATION;
548
+
549
+ // Items shown once shall be kept mounted until the needle changes, otherwise
550
+ // the scroll position may jump around inadvertently. Pattern adopted from:
551
+ // https://inokawa.github.io/virtua/?path=/story/advanced-keep-offscreen-items--append-only
552
+ const [mountedIndexes, setMountedIndexes] = useState<number[]>([]);
553
+ useEffect(() => {
554
+ // Ensure the 'End' key works as intended by keeping the last item mounted
555
+ setMountedIndexes((prevMountedIndexes) => {
556
+ const indexes = new Set(prevMountedIndexes);
557
+ indexes.add(filteredItems.length - 1);
558
+ return [...indexes]; // Sorting is redundant by nature here
559
+ });
560
+ }, [
561
+ needle, // Needed as `filteredItems.length` may be equal between two updates
562
+ filteredItems.length,
563
+ ]);
510
564
 
511
565
  const listboxContainerRef = useRef<HTMLDivElement>(null);
512
566
  useEffect(() => {
@@ -522,6 +576,19 @@ function SelectInputOptions<T = string>({
522
576
  const statusId = useId();
523
577
  const listboxId = useId();
524
578
 
579
+ const getItemNode = (index: number) => {
580
+ const item = filteredItems[index];
581
+ return (
582
+ <SelectInputItemView
583
+ // eslint-disable-next-line react/no-array-index-key
584
+ key={index}
585
+ item={item}
586
+ renderValue={renderValue}
587
+ needle={needle}
588
+ />
589
+ );
590
+ };
591
+
525
592
  return (
526
593
  <ListboxBase.Options
527
594
  as={SelectInputOptionsContainer}
@@ -533,12 +600,6 @@ function SelectInputOptions<T = string>({
533
600
  controllerRef.current.setAttribute('aria-activedescendant', value);
534
601
  } else {
535
602
  controllerRef.current.removeAttribute('aria-activedescendant');
536
- if (filterQuery) {
537
- // Ensure having an active option while filtering
538
- controllerRef.current.dispatchEvent(
539
- new KeyboardEvent('keydown', { key: 'Home', bubbles: true }),
540
- );
541
- }
542
603
  }
543
604
  }
544
605
  }}
@@ -549,7 +610,7 @@ function SelectInputOptions<T = string>({
549
610
  ref={searchInputRef}
550
611
  shape="rectangle"
551
612
  placeholder={filterPlaceholder}
552
- value={filterQuery}
613
+ defaultValue={filterQuery}
553
614
  aria-controls={listboxId}
554
615
  aria-describedby={showStatus ? statusId : undefined}
555
616
  onKeyDown={(event) => {
@@ -560,6 +621,9 @@ function SelectInputOptions<T = string>({
560
621
  }
561
622
  }}
562
623
  onChange={(event) => {
624
+ // Free up resources and ensure not to go out of bounds when the
625
+ // resulting item count is less than before
626
+ setMountedIndexes([]);
563
627
  onFilterChange(event.currentTarget.value);
564
628
  }}
565
629
  />
@@ -569,9 +633,11 @@ function SelectInputOptions<T = string>({
569
633
  <section
570
634
  ref={listboxContainerRef}
571
635
  tabIndex={-1}
572
- className={classNames(
636
+ className={clsx(
573
637
  'np-select-input-listbox-container',
574
- items.some((item) => item.type === 'group') &&
638
+ virtualized && 'np-select-input-listbox-container--virtualized',
639
+ needle == null && // Groups aren't shown when filtering
640
+ items.some((item) => item.type === 'group') &&
575
641
  'np-select-input-listbox-container--has-group',
576
642
  )}
577
643
  >
@@ -590,15 +656,35 @@ function SelectInputOptions<T = string>({
590
656
  tabIndex={0}
591
657
  className="np-select-input-listbox"
592
658
  >
593
- {(needle != null ? dedupeSelectInputItems(items) : items).map((item, index) => (
594
- <SelectInputItemView
595
- // eslint-disable-next-line react/no-array-index-key
596
- key={index}
597
- item={item}
598
- renderValue={renderValue}
599
- needle={needle}
600
- />
601
- ))}
659
+ {!virtualized ? (
660
+ filteredItems.map((_, index) => getItemNode(index))
661
+ ) : (
662
+ <Virtualizer
663
+ key={needle}
664
+ count={filteredItems.length}
665
+ keepMounted={mountedIndexes}
666
+ scrollRef={listboxRef} // `VList` doesn't expose this
667
+ onRangeChange={(startIndex, endIndex) => {
668
+ setMountedIndexes((prevMountedIndexes) => {
669
+ const indexes = new Set(prevMountedIndexes);
670
+ for (let index = startIndex; index <= endIndex; index += 1) {
671
+ indexes.add(index);
672
+ }
673
+ return [...indexes].sort((a, b) => a - b);
674
+ });
675
+ }}
676
+ >
677
+ {(index) => (
678
+ // The position of each item can't be inferred by browsers when
679
+ // virtualizing, as some of the items may not be in the DOM
680
+ <SelectInputItemsCountContext.Provider value={filteredItems.length}>
681
+ <SelectInputItemPositionContext.Provider value={index + 1}>
682
+ {getItemNode(index)}
683
+ </SelectInputItemPositionContext.Provider>
684
+ </SelectInputItemsCountContext.Provider>
685
+ )}
686
+ </Virtualizer>
687
+ )}
602
688
  </div>
603
689
 
604
690
  {renderFooter != null ? (
@@ -639,7 +725,10 @@ function SelectInputItemView<T = string>({
639
725
  }: SelectInputItemViewProps<T>) {
640
726
  switch (item.type) {
641
727
  case 'option': {
642
- if (item.value != null && (needle == null || filterSelectInputOptionItem(item, needle))) {
728
+ if (
729
+ item.value != null &&
730
+ (needle == null || selectInputOptionItemIncludesNeedle(item, needle))
731
+ ) {
643
732
  return (
644
733
  <SelectInputOption value={item.value} disabled={item.disabled}>
645
734
  {renderValue(item.value, false)}
@@ -677,7 +766,7 @@ function SelectInputGroupItemView<T = string>({
677
766
  <section
678
767
  role="group"
679
768
  aria-labelledby={headerId}
680
- className={classNames(needle === null && 'np-select-input-group-item--without-needle')}
769
+ className={clsx(needle === null && 'np-select-input-group-item--without-needle')}
681
770
  >
682
771
  {needle == null ? (
683
772
  <header
@@ -701,6 +790,9 @@ function SelectInputGroupItemView<T = string>({
701
790
  );
702
791
  }
703
792
 
793
+ const SelectInputItemsCountContext = createContext<number | undefined>(undefined);
794
+ const SelectInputItemPositionContext = createContext<number | undefined>(undefined);
795
+
704
796
  interface SelectInputOptionProps<T = string> {
705
797
  value: T;
706
798
  disabled?: boolean;
@@ -708,13 +800,17 @@ interface SelectInputOptionProps<T = string> {
708
800
  }
709
801
 
710
802
  function SelectInputOption<T = string>({ value, disabled, children }: SelectInputOptionProps<T>) {
803
+ const itemsCount = useContext(SelectInputItemsCountContext);
804
+ const itemPosition = useContext(SelectInputItemPositionContext);
711
805
  return (
712
806
  <ListboxBase.Option
713
807
  as="div"
714
808
  value={value}
809
+ aria-setsize={itemsCount}
810
+ aria-posinset={itemPosition}
715
811
  disabled={disabled}
716
812
  className={({ active, disabled: uiDisabled }) =>
717
- classNames(
813
+ clsx(
718
814
  'np-select-input-option-container np-text-body-large',
719
815
  active && 'np-select-input-option-container--active',
720
816
  uiDisabled && 'np-select-input-option-container--disabled',
@@ -726,7 +822,7 @@ function SelectInputOption<T = string>({ value, disabled, children }: SelectInpu
726
822
  <div className="np-select-input-option">{children}</div>
727
823
  <Check
728
824
  size={16}
729
- className={classNames(
825
+ className={clsx(
730
826
  'np-select-input-option-check',
731
827
  !selected && 'np-select-input-option-check--not-selected',
732
828
  )}
@@ -737,6 +833,8 @@ function SelectInputOption<T = string>({ value, disabled, children }: SelectInpu
737
833
  );
738
834
  }
739
835
 
836
+ const SelectInputOptionContentWithinTriggerContext = createContext(false);
837
+
740
838
  export interface SelectInputOptionContentProps {
741
839
  title: string;
742
840
  note?: string;
@@ -754,14 +852,14 @@ export function SelectInputOptionContent({
754
852
 
755
853
  return (
756
854
  <div
757
- className={classNames(
855
+ className={clsx(
758
856
  'np-select-input-option-content-container',
759
857
  (note || description) && 'np-text-body-large',
760
858
  )}
761
859
  >
762
860
  {icon ? (
763
861
  <div
764
- className={classNames(
862
+ className={clsx(
765
863
  'np-select-input-option-content-icon',
766
864
  !withinTrigger && 'np-select-input-option-content-icon--not-within-trigger',
767
865
  )}
@@ -772,7 +870,7 @@ export function SelectInputOptionContent({
772
870
 
773
871
  <div className="np-select-input-option-content-text">
774
872
  <div
775
- className={classNames(
873
+ className={clsx(
776
874
  'np-select-input-option-content-text-line-1',
777
875
  withinTrigger && 'np-select-input-option-content-text-within-trigger',
778
876
  )}
@@ -787,7 +885,7 @@ export function SelectInputOptionContent({
787
885
 
788
886
  {description ? (
789
887
  <div
790
- className={classNames(
888
+ className={clsx(
791
889
  'np-select-input-option-content-text-secondary np-text-body-default',
792
890
  withinTrigger && 'np-select-input-option-content-text-within-trigger',
793
891
  )}
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
  import { forwardRef } from 'react';
3
3
 
4
4
  import { Merge } from '../utils';
@@ -22,7 +22,7 @@ export const TextArea = forwardRef(function TextArea(
22
22
  return (
23
23
  <textarea
24
24
  ref={reference}
25
- className={classNames(className, inputClassNameBase(), 'np-text-area')}
25
+ className={clsx(className, inputClassNameBase(), 'np-text-area')}
26
26
  {...inputAttributes}
27
27
  {...restProps}
28
28
  />
@@ -9,7 +9,7 @@ import {
9
9
  import { Transition } from '@headlessui/react';
10
10
  import { FocusScope } from '@react-aria/focus';
11
11
  import { ThemeProvider, useTheme } from '@wise/components-theming';
12
- import classNames from 'classnames';
12
+ import { clsx } from 'clsx';
13
13
  import { Fragment, useState } from 'react';
14
14
 
15
15
  import { CloseButton } from '../common/closeButton';
@@ -112,7 +112,7 @@ export function BottomSheet({
112
112
  />
113
113
  </div>
114
114
  <div
115
- className={classNames(
115
+ className={clsx(
116
116
  'np-bottom-sheet-v2-content-inner',
117
117
  title && 'np-bottom-sheet-v2-content-inner--has-title',
118
118
  padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
  import { forwardRef } from 'react';
3
3
 
4
4
  import { useInputPaddings } from './InputGroup';
@@ -18,7 +18,7 @@ export const ButtonInput = forwardRef(function ButtonInput(
18
18
  <button
19
19
  ref={ref}
20
20
  type="button"
21
- className={classNames(className, inputClassNameBase({ size }), 'np-button-input')}
21
+ className={clsx(className, inputClassNameBase({ size }), 'np-button-input')}
22
22
  // eslint-disable-next-line react/forbid-dom-props
23
23
  style={{ ...inputPaddings, ...style }}
24
24
  {...restProps}
@@ -15,7 +15,7 @@ import {
15
15
  import { Transition } from '@headlessui/react';
16
16
  import { FocusScope } from '@react-aria/focus';
17
17
  import { ThemeProvider, useTheme } from '@wise/components-theming';
18
- import classNames from 'classnames';
18
+ import { clsx } from 'clsx';
19
19
  import { useState } from 'react';
20
20
 
21
21
  import { PreventScroll } from '../common/preventScroll/PreventScroll';
@@ -109,7 +109,7 @@ export function Popover({
109
109
  <div
110
110
  key={floatingKey} // Force inner state invalidation on open
111
111
  ref={refs.setFloating}
112
- className={classNames('np-popover-v2-container', {
112
+ className={clsx('np-popover-v2-container', {
113
113
  'np-popover-v2-container--size-md': size === 'md',
114
114
  'np-popover-v2-container--size-lg': size === 'lg',
115
115
  })}
@@ -118,7 +118,7 @@ export function Popover({
118
118
  {...getFloatingProps()}
119
119
  >
120
120
  <div
121
- className={classNames('np-popover-v2', title && 'np-popover-v2--has-title', {
121
+ className={clsx('np-popover-v2', title && 'np-popover-v2--has-title', {
122
122
  'np-popover-v2--padding-md': padding === 'md',
123
123
  })}
124
124
  >
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
 
3
3
  import { SizeLarge, SizeMedium, SizeSmall } from '../common';
4
4
 
@@ -7,7 +7,7 @@ export type InputPropsBase = {
7
7
  };
8
8
 
9
9
  export function inputClassNameBase({ size = 'auto' }: InputPropsBase = {}) {
10
- return classNames(
10
+ return clsx(
11
11
  'form-control', // TODO: Deprecate
12
12
  'np-form-control',
13
13
  {
@@ -1,5 +1,5 @@
1
1
  import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';
2
- import classNames from 'classnames';
2
+ import { clsx } from 'clsx';
3
3
  import { ReactNode } from 'react';
4
4
 
5
5
  import Body from '../body/Body';
@@ -50,7 +50,7 @@ const InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: Instruct
50
50
  </>
51
51
  );
52
52
 
53
- return <ul className={classNames('tw-instructions', className)}>{orderedInstructions}</ul>;
53
+ return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;
54
54
  };
55
55
 
56
56
  function Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {
@@ -59,7 +59,7 @@ function Instruction({ item, type }: { item: ReactNode | InstructionNode; type:
59
59
  return (
60
60
  <li
61
61
  className="instruction"
62
- aria-label={isInstructionNode ? (item['aria-label'] as string) : undefined}
62
+ aria-label={isInstructionNode ? (item['aria-label']) : undefined}
63
63
  >
64
64
  {type === 'do' ? (
65
65
  <DoIcon size={24} className={type} />
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
 
3
3
  export type LabelProps = {
4
4
  id?: string;
@@ -12,7 +12,7 @@ export const Label = ({ id, htmlFor, className, children }: LabelProps) => {
12
12
  <label
13
13
  id={id}
14
14
  htmlFor={htmlFor}
15
- className={classNames('control-label d-flex flex-column gap-y-1 m-b-0', className)}
15
+ className={clsx('control-label d-flex flex-column gap-y-1 m-b-0', className)}
16
16
  >
17
17
  {children}
18
18
  </label>
package/src/link/Link.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
2
- import classNames from 'classnames';
2
+ import { clsx } from 'clsx';
3
3
  import { AnchorHTMLAttributes } from 'react';
4
4
  import { useIntl } from 'react-intl';
5
5
 
@@ -32,12 +32,7 @@ const Link = ({
32
32
  <a
33
33
  href={href}
34
34
  target={target}
35
- className={classNames(
36
- 'np-link',
37
- type ? `np-text-${type}` : undefined,
38
- 'd-inline-flex',
39
- className,
40
- )}
35
+ className={clsx('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className)}
41
36
  aria-label={ariaLabel}
42
37
  rel={isBlank ? 'noreferrer' : undefined}
43
38
  onClick={onClick}
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
  import { ElementType, FC, ReactNode } from 'react';
3
3
 
4
4
  import Body from '../body/Body';
@@ -27,14 +27,14 @@ const ListItem: FC<ListItemProps> = ({
27
27
 
28
28
  return (
29
29
  <Element
30
- className={classNames('np-list-item d-flex align-items-center p-y-2', className, {
30
+ className={clsx('np-list-item d-flex align-items-center p-y-2', className, {
31
31
  'p-x-2': !isContainerAligned,
32
32
  })}
33
33
  {...rest}
34
34
  >
35
35
  {media}
36
36
 
37
- <div className={classNames('d-flex flex-column', { 'p-l-2': !!media, 'p-r-2': !!action })}>
37
+ <div className={clsx('d-flex flex-column', { 'p-l-2': !!media, 'p-r-2': !!action })}>
38
38
  <Body type="body-default" className="text-secondary m-b-0">
39
39
  {title}
40
40
  </Body>
@@ -1,5 +1,5 @@
1
1
  import { useTheme } from '@wise/components-theming';
2
- import classnames from 'classnames';
2
+ import { clsx } from 'clsx';
3
3
  import { useEffect, useState } from 'react';
4
4
 
5
5
  import { Size, SizeExtraSmall, SizeSmall, SizeMedium, SizeLarge, SizeExtraLarge } from '../common';
@@ -74,7 +74,7 @@ const Loader = ({
74
74
 
75
75
  return (
76
76
  <div
77
- className={classnames(style('tw-loader'), style(`tw-loader--${supportedSize}`), {
77
+ className={clsx(style('tw-loader'), style(`tw-loader--${supportedSize}`), {
78
78
  'tw-loader--visible': hasDebounced,
79
79
  })}
80
80
  data-testid={restProps['data-testid']}
package/src/logo/Logo.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import classNames from 'classnames';
1
+ import { clsx } from 'clsx';
2
2
 
3
3
  import { ReactComponent as LogoFlagInverse } from './svg/flag-inverse.svg';
4
4
  import { ReactComponent as LogoFlagPlatformInverse } from './svg/flag-platform-white.svg';
@@ -49,7 +49,7 @@ export default function Logo({ className, inverse, type = 'WISE' }: LogoProps) {
49
49
  const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
50
50
 
51
51
  return (
52
- <span aria-label={labelByType[type]} role="img" className={classNames(className, 'np-logo')}>
52
+ <span aria-label={labelByType[type]} role="img" className={clsx(className, 'np-logo')}>
53
53
  <LogoSm className="np-logo-svg np-logo-svg--size-sm" />
54
54
  <LogoMd className="np-logo-svg np-logo-svg--size-md" />
55
55
  </span>