@transferwise/components 0.0.0-experimental-c990279 → 0.0.0-experimental-826e553

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 (398) hide show
  1. package/build/accordion/AccordionItem/AccordionItem.js +1 -1
  2. package/build/accordion/AccordionItem/AccordionItem.mjs +1 -1
  3. package/build/actionButton/ActionButton.js +1 -1
  4. package/build/actionButton/ActionButton.mjs +1 -1
  5. package/build/actionOption/ActionOption.js +1 -1
  6. package/build/actionOption/ActionOption.mjs +1 -1
  7. package/build/alert/Alert.js +1 -1
  8. package/build/alert/Alert.mjs +1 -1
  9. package/build/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  10. package/build/alert/inlineMarkdown/InlineMarkdown.mjs +1 -1
  11. package/build/avatar/Avatar.js +1 -1
  12. package/build/avatar/Avatar.mjs +1 -1
  13. package/build/avatarLayout/AvatarLayout.js +1 -1
  14. package/build/avatarLayout/AvatarLayout.mjs +1 -1
  15. package/build/avatarView/AvatarView.js +1 -1
  16. package/build/avatarView/AvatarView.mjs +1 -1
  17. package/build/avatarWrapper/AvatarWrapper.js +1 -1
  18. package/build/avatarWrapper/AvatarWrapper.mjs +1 -1
  19. package/build/badge/Badge.js +1 -1
  20. package/build/badge/Badge.mjs +1 -1
  21. package/build/button/Button.js +1 -1
  22. package/build/button/Button.mjs +1 -1
  23. package/build/button/LegacyButton.js +1 -1
  24. package/build/button/LegacyButton.mjs +1 -1
  25. package/build/button/classMap.js +1 -1
  26. package/build/button/classMap.mjs +1 -1
  27. package/build/button/legacyUtils/legacyUtils.js +1 -1
  28. package/build/button/legacyUtils/legacyUtils.mjs +1 -1
  29. package/build/card/Card.js +1 -1
  30. package/build/card/Card.mjs +1 -1
  31. package/build/checkbox/Checkbox.js +1 -1
  32. package/build/checkbox/Checkbox.mjs +1 -1
  33. package/build/chevron/Chevron.js +1 -1
  34. package/build/chevron/Chevron.mjs +1 -1
  35. package/build/chips/Chip.js +1 -1
  36. package/build/chips/Chip.mjs +1 -1
  37. package/build/circularButton/CircularButton.js +2 -2
  38. package/build/circularButton/CircularButton.js.map +1 -1
  39. package/build/circularButton/CircularButton.mjs +1 -1
  40. package/build/circularButton/CircularButton.mjs.map +1 -1
  41. package/build/common/bottomSheet/BottomSheet.js +2 -2
  42. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  43. package/build/common/bottomSheet/BottomSheet.mjs +1 -1
  44. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  45. package/build/common/circle/Circle.js +2 -2
  46. package/build/common/circle/Circle.js.map +1 -1
  47. package/build/common/circle/Circle.mjs +1 -1
  48. package/build/common/circle/Circle.mjs.map +1 -1
  49. package/build/common/hooks/useLayout/useLayout.js +6 -6
  50. package/build/common/hooks/useLayout/useLayout.js.map +1 -1
  51. package/build/common/hooks/useLayout/useLayout.mjs +1 -1
  52. package/build/common/hooks/useLayout/useLayout.mjs.map +1 -1
  53. package/build/common/hooks/useScreenSize.js.map +1 -1
  54. package/build/common/hooks/useScreenSize.mjs.map +1 -1
  55. package/build/common/panel/Panel.js +39 -57
  56. package/build/common/panel/Panel.js.map +1 -1
  57. package/build/common/panel/Panel.mjs +44 -62
  58. package/build/common/panel/Panel.mjs.map +1 -1
  59. package/build/common/propsValues/breakpoint.js +12 -0
  60. package/build/common/propsValues/breakpoint.js.map +1 -0
  61. package/build/common/propsValues/breakpoint.mjs +12 -0
  62. package/build/common/propsValues/breakpoint.mjs.map +1 -0
  63. package/build/common/responsivePanel/ResponsivePanel.js +1 -1
  64. package/build/common/responsivePanel/ResponsivePanel.mjs +1 -1
  65. package/build/criticalBanner/CriticalCommsBanner.js +1 -1
  66. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
  67. package/build/dateInput/DateInput.js +1 -1
  68. package/build/dateInput/DateInput.mjs +1 -1
  69. package/build/dateLookup/DateLookup.js +2 -2
  70. package/build/dateLookup/DateLookup.js.map +1 -1
  71. package/build/dateLookup/DateLookup.mjs +1 -1
  72. package/build/dateLookup/DateLookup.mjs.map +1 -1
  73. package/build/dateLookup/dateHeader/DateHeader.js +1 -1
  74. package/build/dateLookup/dateHeader/DateHeader.mjs +1 -1
  75. package/build/dateLookup/dateTrigger/DateTrigger.js +1 -1
  76. package/build/dateLookup/dateTrigger/DateTrigger.mjs +1 -1
  77. package/build/decision/Decision.js +3 -3
  78. package/build/decision/Decision.js.map +1 -1
  79. package/build/decision/Decision.mjs +1 -1
  80. package/build/decision/Decision.mjs.map +1 -1
  81. package/build/definitionList/DefinitionList.js +1 -1
  82. package/build/definitionList/DefinitionList.mjs +1 -1
  83. package/build/dimmer/Dimmer.js +1 -1
  84. package/build/dimmer/Dimmer.mjs +1 -1
  85. package/build/display/Display.js +1 -1
  86. package/build/display/Display.mjs +1 -1
  87. package/build/drawer/Drawer.js +1 -1
  88. package/build/drawer/Drawer.mjs +1 -1
  89. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +1 -1
  90. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +1 -1
  91. package/build/field/Field.js +1 -1
  92. package/build/field/Field.mjs +1 -1
  93. package/build/flowNavigation/FlowNavigation.js +3 -3
  94. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  95. package/build/flowNavigation/FlowNavigation.mjs +1 -1
  96. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  97. package/build/header/Header.js +1 -1
  98. package/build/header/Header.mjs +1 -1
  99. package/build/image/Image.js +1 -1
  100. package/build/image/Image.mjs +1 -1
  101. package/build/index.js +2 -2
  102. package/build/index.mjs +1 -1
  103. package/build/info/Info.js +1 -1
  104. package/build/info/Info.mjs +1 -1
  105. package/build/inlineAlert/InlineAlert.js +1 -1
  106. package/build/inlineAlert/InlineAlert.mjs +1 -1
  107. package/build/inputs/SearchInput.js +1 -1
  108. package/build/inputs/SearchInput.mjs +1 -1
  109. package/build/inputs/SelectInput/SelectInput.js +2 -2
  110. package/build/inputs/SelectInput/SelectInput.js.map +1 -1
  111. package/build/inputs/SelectInput/SelectInput.mjs +1 -1
  112. package/build/inputs/SelectInput/SelectInput.mjs.map +1 -1
  113. package/build/instructionsList/InstructionsList.js +1 -1
  114. package/build/instructionsList/InstructionsList.mjs +1 -1
  115. package/build/link/Link.js +1 -1
  116. package/build/link/Link.mjs +1 -1
  117. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +1 -1
  118. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +1 -1
  119. package/build/listItem/ListItem.js +1 -1
  120. package/build/listItem/ListItem.mjs +1 -1
  121. package/build/listItem/Prompt/ListItemPrompt.js +1 -1
  122. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
  123. package/build/loader/Loader.js +1 -1
  124. package/build/loader/Loader.mjs +1 -1
  125. package/build/logo/Logo.js +1 -1
  126. package/build/logo/Logo.js.map +1 -1
  127. package/build/logo/Logo.mjs +1 -1
  128. package/build/logo/Logo.mjs.map +1 -1
  129. package/build/main.css +299 -299
  130. package/build/markdown/Markdown.js +1 -1
  131. package/build/markdown/Markdown.mjs +1 -1
  132. package/build/modal/Modal.js +1 -1
  133. package/build/modal/Modal.mjs +1 -1
  134. package/build/moneyInput/MoneyInput.js +1 -1
  135. package/build/moneyInput/MoneyInput.mjs +1 -1
  136. package/build/navigationOption/NavigationOption.js +1 -1
  137. package/build/navigationOption/NavigationOption.mjs +1 -1
  138. package/build/nudge/Nudge.js +1 -1
  139. package/build/nudge/Nudge.mjs +1 -1
  140. package/build/overlayHeader/OverlayHeader.js +1 -1
  141. package/build/overlayHeader/OverlayHeader.mjs +1 -1
  142. package/build/phoneNumberInput/PhoneNumberInput.js +1 -1
  143. package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -1
  144. package/build/popover/Popover.js +1 -1
  145. package/build/popover/Popover.mjs +1 -1
  146. package/build/processIndicator/ProcessIndicator.js +1 -1
  147. package/build/processIndicator/ProcessIndicator.mjs +1 -1
  148. package/build/progressBar/ProgressBar.js +1 -1
  149. package/build/progressBar/ProgressBar.mjs +1 -1
  150. package/build/promoCard/PromoCard.js +1 -1
  151. package/build/promoCard/PromoCard.mjs +1 -1
  152. package/build/promoCard/PromoCardIndicator.js +1 -1
  153. package/build/promoCard/PromoCardIndicator.mjs +1 -1
  154. package/build/prompt/ActionPrompt/ActionPrompt.js +2 -2
  155. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  156. package/build/prompt/ActionPrompt/ActionPrompt.mjs +1 -1
  157. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  158. package/build/prompt/InfoPrompt/InfoPrompt.js +1 -1
  159. package/build/prompt/InfoPrompt/InfoPrompt.mjs +1 -1
  160. package/build/prompt/InlinePrompt/InlinePrompt.js +1 -1
  161. package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -1
  162. package/build/provider/Provider.js +1 -1
  163. package/build/provider/Provider.mjs +1 -1
  164. package/build/radio/Radio.js +1 -1
  165. package/build/radio/Radio.mjs +1 -1
  166. package/build/segmentedControl/SegmentedControl.js +1 -1
  167. package/build/segmentedControl/SegmentedControl.mjs +1 -1
  168. package/build/select/Select.js +1 -1
  169. package/build/select/Select.mjs +1 -1
  170. package/build/select/option/Option.js +1 -1
  171. package/build/select/option/Option.mjs +1 -1
  172. package/build/statusIcon/StatusIcon.js +2 -2
  173. package/build/statusIcon/StatusIcon.js.map +1 -1
  174. package/build/statusIcon/StatusIcon.mjs +1 -1
  175. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  176. package/build/stepper/Stepper.js +1 -1
  177. package/build/stepper/Stepper.mjs +1 -1
  178. package/build/sticky/Sticky.js +1 -1
  179. package/build/sticky/Sticky.mjs +1 -1
  180. package/build/styles/accordion/Accordion.css +1 -1
  181. package/build/styles/card/Card.css +2 -2
  182. package/build/styles/carousel/Carousel.css +5 -5
  183. package/build/styles/common/Option/Option.css +1 -1
  184. package/build/styles/common/baseCard/BaseCard.css +1 -1
  185. package/build/styles/criticalBanner/CriticalCommsBanner.css +1 -1
  186. package/build/styles/css/accordion.css +4 -4
  187. package/build/styles/css/button-groups.css +6 -6
  188. package/build/styles/css/buttons.css +1 -1
  189. package/build/styles/css/circles.css +1 -1
  190. package/build/styles/css/column-layout.css +4 -4
  191. package/build/styles/css/decision.css +4 -4
  192. package/build/styles/css/dropdowns.css +10 -10
  193. package/build/styles/css/droppable.css +8 -8
  194. package/build/styles/css/flex.css +14 -14
  195. package/build/styles/css/footer.css +3 -3
  196. package/build/styles/css/grid.css +19 -19
  197. package/build/styles/css/input-groups.css +12 -12
  198. package/build/styles/css/list-group.css +8 -8
  199. package/build/styles/css/modals.css +3 -3
  200. package/build/styles/css/navbar.css +62 -62
  201. package/build/styles/css/navs.css +2 -2
  202. package/build/styles/css/neptune.css +258 -258
  203. package/build/styles/css/panels.css +9 -9
  204. package/build/styles/css/popovers.css +13 -13
  205. package/build/styles/css/select.css +1 -1
  206. package/build/styles/css/sequences.css +6 -6
  207. package/build/styles/css/table.css +6 -6
  208. package/build/styles/css/utilities.css +4 -4
  209. package/build/styles/css/wells.css +4 -4
  210. package/build/styles/dateInput/DateInput.css +1 -1
  211. package/build/styles/definitionList/DefinitionList.css +2 -2
  212. package/build/styles/drawer/Drawer.css +1 -1
  213. package/build/styles/inputs/Input.css +3 -3
  214. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  215. package/build/styles/inputs/SelectInput/SelectInput.css +2 -2
  216. package/build/styles/inputs/TextArea.css +3 -3
  217. package/build/styles/less/legacy-variables.less +47 -34
  218. package/build/styles/less/neptune-tokens.less +2 -2
  219. package/build/styles/logo/Logo.css +2 -2
  220. package/build/styles/main.css +299 -299
  221. package/build/styles/modal/Modal.css +5 -5
  222. package/build/styles/popover/Popover.css +3 -3
  223. package/build/styles/promoCard/PromoCard.css +1 -1
  224. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +1 -1
  225. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  226. package/build/styles/props/custom-media.css +11 -23
  227. package/build/styles/props/neptune-tokens.css +1 -1
  228. package/build/styles/snackbar/Snackbar.css +2 -2
  229. package/build/styles/stepper/Stepper.css +2 -2
  230. package/build/styles/styles/less/accordion.css +4 -4
  231. package/build/styles/styles/less/button-groups.css +6 -6
  232. package/build/styles/styles/less/buttons.css +1 -1
  233. package/build/styles/styles/less/circles.css +1 -1
  234. package/build/styles/styles/less/column-layout.css +4 -4
  235. package/build/styles/styles/less/decision.css +4 -4
  236. package/build/styles/styles/less/dropdowns.css +10 -10
  237. package/build/styles/styles/less/droppable.css +8 -8
  238. package/build/styles/styles/less/flex.css +14 -14
  239. package/build/styles/styles/less/footer.css +3 -3
  240. package/build/styles/styles/less/forms/bootstrap-forms.css +9 -9
  241. package/build/styles/styles/less/grid.css +19 -19
  242. package/build/styles/styles/less/input-groups.css +12 -12
  243. package/build/styles/styles/less/list-group.css +8 -8
  244. package/build/styles/styles/less/modals.css +3 -3
  245. package/build/styles/styles/less/navbar.css +62 -62
  246. package/build/styles/styles/less/navs.css +2 -2
  247. package/build/styles/styles/less/neptune.css +258 -258
  248. package/build/styles/styles/less/panels.css +9 -9
  249. package/build/styles/styles/less/popovers.css +13 -13
  250. package/build/styles/styles/less/select.css +1 -1
  251. package/build/styles/styles/less/sequences.css +6 -6
  252. package/build/styles/styles/less/table.css +6 -6
  253. package/build/styles/styles/less/utilities.css +4 -4
  254. package/build/styles/styles/less/wells.css +4 -4
  255. package/build/styles/styles/props/custom-media.css +11 -1
  256. package/build/styles/table/Table.css +1 -1
  257. package/build/styles/tabs/Tabs.css +2 -2
  258. package/build/styles/typeahead/Typeahead.css +1 -1
  259. package/build/summary/Summary.js +1 -1
  260. package/build/summary/Summary.mjs +1 -1
  261. package/build/table/Table.js +1 -1
  262. package/build/table/Table.mjs +1 -1
  263. package/build/table/TableRow.js +1 -1
  264. package/build/table/TableRow.mjs +1 -1
  265. package/build/table/TableStatusText.js +1 -1
  266. package/build/table/TableStatusText.mjs +1 -1
  267. package/build/tabs/Tabs.js +1 -1
  268. package/build/tabs/Tabs.mjs +1 -1
  269. package/build/tile/Tile.js +1 -1
  270. package/build/tile/Tile.mjs +1 -1
  271. package/build/title/Title.js +1 -1
  272. package/build/title/Title.mjs +1 -1
  273. package/build/tooltip/Tooltip.js +30 -51
  274. package/build/tooltip/Tooltip.js.map +1 -1
  275. package/build/tooltip/Tooltip.mjs +31 -52
  276. package/build/tooltip/Tooltip.mjs.map +1 -1
  277. package/build/typeahead/Typeahead.js +1 -1
  278. package/build/typeahead/Typeahead.mjs +1 -1
  279. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  280. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  281. package/build/types/common/hooks/useScreenSize.d.ts +1 -1
  282. package/build/types/common/hooks/useScreenSize.d.ts.map +1 -1
  283. package/build/types/common/index.d.ts +1 -1
  284. package/build/types/common/index.d.ts.map +1 -1
  285. package/build/types/common/panel/Panel.d.ts.map +1 -1
  286. package/build/types/common/propsValues/breakpoint.d.ts +9 -0
  287. package/build/types/common/propsValues/breakpoint.d.ts.map +1 -0
  288. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  289. package/build/types/decision/Decision.d.ts.map +1 -1
  290. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  291. package/build/types/index.d.ts +1 -2
  292. package/build/types/index.d.ts.map +1 -1
  293. package/build/types/logo/Logo.d.ts +1 -1
  294. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  295. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  296. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  297. package/build/upload/Upload.js +1 -1
  298. package/build/upload/Upload.mjs +1 -1
  299. package/build/upload/steps/completeStep/completeStep.js +1 -1
  300. package/build/upload/steps/completeStep/completeStep.mjs +1 -1
  301. package/build/upload/steps/processingStep/processingStep.js +1 -1
  302. package/build/upload/steps/processingStep/processingStep.mjs +1 -1
  303. package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  304. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -1
  305. package/build/uploadInput/UploadInput.js +1 -1
  306. package/build/uploadInput/UploadInput.mjs +1 -1
  307. package/build/uploadInput/uploadButton/UploadButton.js +1 -1
  308. package/build/uploadInput/uploadButton/UploadButton.mjs +1 -1
  309. package/build/uploadInput/uploadButton/defaults.js +1 -1
  310. package/build/uploadInput/uploadButton/defaults.mjs +1 -1
  311. package/build/uploadInput/uploadItem/UploadItem.js +1 -1
  312. package/build/uploadInput/uploadItem/UploadItem.mjs +1 -1
  313. package/build/withDisplayFormat/WithDisplayFormat.js +1 -1
  314. package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -1
  315. package/package.json +4 -6
  316. package/src/accordion/Accordion.css +1 -1
  317. package/src/card/Card.css +2 -2
  318. package/src/carousel/Carousel.css +5 -5
  319. package/src/circularButton/CircularButton.tsx +1 -2
  320. package/src/common/Option/Option.css +1 -1
  321. package/src/common/baseCard/BaseCard.css +1 -1
  322. package/src/common/bottomSheet/BottomSheet.tsx +1 -1
  323. package/src/common/circle/Circle.tsx +1 -1
  324. package/src/common/hooks/useLayout/useLayout.ts +1 -1
  325. package/src/common/hooks/useScreenSize.ts +1 -1
  326. package/src/common/index.ts +1 -1
  327. package/src/common/panel/Panel.tsx +39 -50
  328. package/src/common/propsValues/breakpoint.ts +8 -0
  329. package/src/common/responsivePanel/ResponsivePanel.test.js +2 -3
  330. package/src/criticalBanner/CriticalCommsBanner.css +1 -1
  331. package/src/dateInput/DateInput.css +1 -1
  332. package/src/dateLookup/DateLookup.tsx +1 -1
  333. package/src/decision/Decision.test.tsx +1 -2
  334. package/src/decision/Decision.tsx +1 -2
  335. package/src/definitionList/DefinitionList.css +2 -2
  336. package/src/definitionList/DefinitionList.less +2 -2
  337. package/src/drawer/Drawer.css +1 -1
  338. package/src/flowNavigation/FlowNavigation.test.js +1 -1
  339. package/src/flowNavigation/FlowNavigation.tsx +1 -2
  340. package/src/index.ts +1 -1
  341. package/src/inputs/Input.css +3 -3
  342. package/src/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  343. package/src/inputs/SelectInput/SelectInput.css +2 -2
  344. package/src/inputs/SelectInput/SelectInput.tsx +1 -1
  345. package/src/inputs/TextArea.css +3 -3
  346. package/src/logo/Logo.css +2 -2
  347. package/src/logo/Logo.story.tsx +3 -3
  348. package/src/logo/Logo.tsx +1 -1
  349. package/src/main.css +299 -299
  350. package/src/modal/Modal.css +5 -5
  351. package/src/popover/Popover.css +3 -3
  352. package/src/popover/Popover.test.tsx +1 -2
  353. package/src/promoCard/PromoCard.css +1 -1
  354. package/src/prompt/ActionPrompt/ActionPrompt.css +1 -1
  355. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +1 -2
  356. package/src/prompt/ActionPrompt/ActionPrompt.tsx +1 -2
  357. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  358. package/src/section/Section.story.tsx +8 -2
  359. package/src/select/Select.test.tsx +1 -1
  360. package/src/snackbar/Snackbar.css +2 -2
  361. package/src/statusIcon/StatusIcon.test.tsx +2 -0
  362. package/src/statusIcon/StatusIcon.tsx +1 -2
  363. package/src/stepper/Stepper.css +2 -2
  364. package/src/styles/less/accordion.css +4 -4
  365. package/src/styles/less/button-groups.css +6 -6
  366. package/src/styles/less/buttons.css +1 -1
  367. package/src/styles/less/circles.css +1 -1
  368. package/src/styles/less/column-layout.css +4 -4
  369. package/src/styles/less/decision.css +4 -4
  370. package/src/styles/less/dropdowns.css +10 -10
  371. package/src/styles/less/droppable.css +8 -8
  372. package/src/styles/less/flex.css +14 -14
  373. package/src/styles/less/footer.css +3 -3
  374. package/src/styles/less/forms/bootstrap-forms.css +9 -9
  375. package/src/styles/less/forms/bootstrap-forms.less +1 -1
  376. package/src/styles/less/grid.css +19 -19
  377. package/src/styles/less/input-groups.css +12 -12
  378. package/src/styles/less/list-group.css +8 -8
  379. package/src/styles/less/modals.css +3 -3
  380. package/src/styles/less/navbar.css +62 -62
  381. package/src/styles/less/navbar.less +2 -2
  382. package/src/styles/less/navs.css +2 -2
  383. package/src/styles/less/neptune.bundle.less +0 -1
  384. package/src/styles/less/neptune.css +258 -258
  385. package/src/styles/less/panels.css +9 -9
  386. package/src/styles/less/popovers.css +13 -13
  387. package/src/styles/less/select.css +1 -1
  388. package/src/styles/less/sequences.css +6 -6
  389. package/src/styles/less/table.css +6 -6
  390. package/src/styles/less/table.less +1 -1
  391. package/src/styles/less/utilities.css +4 -4
  392. package/src/styles/less/wells.css +4 -4
  393. package/src/styles/props/custom-media.css +11 -1
  394. package/src/styles/variables/legacy-variables.less +47 -4
  395. package/src/table/Table.css +1 -1
  396. package/src/tabs/Tabs.css +2 -2
  397. package/src/tooltip/Tooltip.tsx +26 -45
  398. package/src/typeahead/Typeahead.css +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps &\n Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby' | 'aria-label'>\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer\n aria-labelledby={props['aria-labelledby']}\n aria-label={props['aria-label']}\n role={role}\n open={props.open}\n className={props.className}\n onClose={close}\n >\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n <div\n id={overlayId}\n aria-labelledby={props['aria-labelledby'] || undefined}\n aria-label={props['aria-label'] || undefined}\n role={role}\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","role","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAkB,GAAG,CAAC;AAE5B,MAAMC,wBAAwB,GAAG,CAAC;AAElC,MAAMC,qBAAqB,GAAG,EAAE;AAUhC;;;;;AAKG;AACH,MAAMC,WAAW,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAG,QAAQ;EAAE,GAAGC;AAAK,CAAoB,KAAI;AACtE,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC;EAErD,MAAM,CAACG,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAAU,KAAK,CAAC;AAEtD;;;;AAIG;AACH,EAAA,MAAMC,WAAW,GAAGN,MAAM,CAAS,CAAC,CAAC;AAErC;;;;;AAKG;AACH,EAAA,MAAMO,UAAU,GAAGP,MAAM,CAAS,CAAC,CAAC;AACpC,EAAA,MAAMQ,kBAAkB,GAAGR,MAAM,CAAS,CAAC,CAAC;AAE5C;AACAS,EAAAA,sBAAsB,CAAC;IACrBC,cAAc,EAAEZ,KAAK,CAACa,IAAI,IAAI,CAACC,YAAY,EAAE;IAC7CC,QAAQ,EAAEA,MAAK;AACb,MAAA,IAAIZ,eAAe,CAACa,OAAO,KAAK,IAAI,EAAE;QACpC,MAAM;AAAEC,UAAAA;SAAW,GAAGd,eAAe,CAACa,OAAO;AAC7C,QAAA,IAAI,CAACE,4BAA4B,EAAE,EAAE;AACnCD,UAAAA,SAAS,CAACE,GAAG,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U,IAAA,CAAA,KAAA,EAAA;AACEC,QAAAA,EAAE,EAAEjB,SAAU;AACd,QAAA,iBAAA,EAAiBxD,KAAK,CAAC,iBAAiB,CAAC,IAAIuB,SAAU;AACvD,QAAA,YAAA,EAAYvB,KAAK,CAAC,YAAY,CAAC,IAAIuB,SAAU;AAC7CxB,QAAAA,IAAI,EAAEA,IAAK;QACX,YAAA,EAAA,IAAU;AACV2E,QAAAA,YAAY,EAAEzC,YAAa;AAC3B0C,QAAAA,WAAW,EAAEvC,WAAY;AACzBwC,QAAAA,UAAU,EAAEpC,UAAW;AACvBqC,QAAAA,WAAW,EAAE5C,YAAa;AAC1B6C,QAAAA,WAAW,EAAE1C,WAAY;AACzB2C,QAAAA,SAAS,EAAEvC,UAAW;AAAAsB,QAAAA,QAAA,gBAEtBU,IAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAEhE,eAAgB;AAAC0D,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC;AAA0B,WAAA,CACzC,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAErD;AAAM,WAAA,CACvF;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D;AAAQ,SACZ,CACP;OAAK;KACO;AAChB,GAAQ,CACT;AACH;;;;"}
1
+ {"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps &\n Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby' | 'aria-label'>\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer\n aria-labelledby={props['aria-labelledby']}\n aria-label={props['aria-label']}\n role={role}\n open={props.open}\n className={props.className}\n onClose={close}\n >\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n <div\n id={overlayId}\n aria-labelledby={props['aria-labelledby'] || undefined}\n aria-label={props['aria-label'] || undefined}\n role={role}\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","role","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAMA,kBAAkB,GAAG,CAAC;AAE5B,MAAMC,wBAAwB,GAAG,CAAC;AAElC,MAAMC,qBAAqB,GAAG,EAAE;AAUhC;;;;;AAKG;AACH,MAAMC,WAAW,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAG,QAAQ;EAAE,GAAGC;AAAK,CAAoB,KAAI;AACtE,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC;EAErD,MAAM,CAACG,OAAO,EAAEC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AA,SAAS,EAAC;AAA0B,WAAA,CACzC,eAAAF,GAAA,CAACqB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACpB,YAAAA,SAAS,EAAC,oCAAoC;AAACqB,YAAAA,OAAO,EAAErD;AAAM,WAAA,CACvF;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D;AAAQ,SACZ,CACP;OAAK;KACO;AAChB,GAAQ,CACT;AACH;;;;"}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var clsx = require('clsx');
7
- var neptuneTokens = require('@transferwise/neptune-tokens');
8
7
  var useMedia = require('../hooks/useMedia.js');
8
+ var breakpoint = require('../propsValues/breakpoint.js');
9
9
  var jsxRuntime = require('react/jsx-runtime');
10
10
 
11
11
  const MAP_ICON_SIZE = {
@@ -41,7 +41,7 @@ const Circle = /*#__PURE__*/React.forwardRef(function Circle({
41
41
  style,
42
42
  ...props
43
43
  }, ref) {
44
- const isTinyViewport = useMedia.useMedia(`(max-width: ${neptuneTokens.Breakpoint.ZOOM_400}px)`);
44
+ const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
45
45
  return /*#__PURE__*/jsxRuntime.jsx(Element, {
46
46
  ...props,
47
47
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useMedia } from '../hooks/useMedia';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AAC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;MAChD,GAAGI;KACH;AACFD,IAAAA,SAAS,EAAES,SAAI,CACb,WAAW,EACX;AAAE,MAAA,kBAAkB,EAAEV;KAAc,EACpC,kDAAkD,EAClDC,SAAS,CACT;AAAAJ,IAAAA,QAAA,EAEDA;AAAQ,GACF,CAAC;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED;;;;AAIG;AACH,MAAMC,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED,MAAMC,MAAM,gBAAGC,gBAAU,CAAC,SAASD,MAAMA,CACvC;EACEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,YAAY,GAAG,KAAK;EACpBC,SAAS;EACTC,KAAK;EACL,GAAGC;AAAK,CACF,EACRC,GAAG,EAAA;EAEH,MAAMC,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC;EACxE,oBACEC,cAAA,CAACb,OAAO,EAAA;AAAA,IAAA,GACFO,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;MACL,eAAe,EAAEH,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAA,EAAA,CAAI,GAAG,CAAA,WAAA,EAAcA,IAAI,CAAA,CAAA,CAAG;MAChE,oBAAoB,EAClBO,cAAc,IAAI,CAACN,SAAS,GACxB,CAAA,EAAGR,aAAa,CAACO,IAAI,CAAC,GAAG,CAAC,IAAI,GAC9B,CAAA,EAAGP,aAAa,CAACO,IAAI,CAAC,CAAA,EAAA,CAAI;AAChC,MAAA,oBAAoB,EAAE,CAAA,EAAGN,aAAa,CAACM,IAAI,CAAC,CAAA,EAAA,CAAI;MAChD,GAAGI;KACH;AACFD,IAAAA,SAAS,EAAES,SAAI,CACb,WAAW,EACX;AAAE,MAAA,kBAAkB,EAAEV;KAAc,EACpC,kDAAkD,EAClDC,SAAS,CACT;AAAAJ,IAAAA,QAAA,EAEDA;AAAQ,GACF,CAAC;AAEd,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { forwardRef } from 'react';
2
2
  import { clsx } from 'clsx';
3
- import { Breakpoint } from '@transferwise/neptune-tokens';
4
3
  import { useMedia } from '../hooks/useMedia.mjs';
4
+ import { Breakpoint } from '../propsValues/breakpoint.mjs';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  const MAP_ICON_SIZE = {
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useMedia } from '../hooks/useMedia';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;A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DC,SAAS,CACT;AAAAJ,IAAAA,QAAA,EAEDA;AAAQ,GACF,CAAC;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n enableBorder?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\n/**\n * circle like components have custom typography styles for for default (Inter) font\n *\n * circle size : font size (px)\n */\nconst MAP_FONT_SIZE = {\n 16: 8,\n 24: 12,\n 32: 14,\n 40: 18,\n 48: 22,\n 56: 26,\n 72: 30,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n enableBorder = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,\n ...style,\n }}\n className={clsx(\n 'np-circle',\n { 'np-circle-border': enableBorder },\n 'd-flex align-items-center justify-content-center',\n className,\n )}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","MAP_FONT_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","enableBorder","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;AA2BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED;;;;AAIG;AACH,MAAMC,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE;CACL;AAED,MAAMC,MAAM,gBAAGC,UAAU,CAAC,SAASD,MAAMA,CACvC;EACEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,YAAY,GAAG,KAAK;EACpBC,SAAS;EACTC,KAAK;EACL,GAAGC;AAAK,CACF,EACRC,GAAG,EAAA;EAEH,MAAMC,cAAc,GAAGC,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC;EACxE,oBACEC,GAAA,CAACb,OAAO,EAAA;AAAA,IAAA,GACFO,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;MACL,eAAe,EAAEH,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAA,EAAA,CAAI,GAAG,CAAA,WAAA,EAAcA,IAAI,CAAA,CAAA,CAAG;MAChE,oBAAoB,EAClBO,cAAc,IAAI,CAACN,SAAS,GACxB,CAAA,EAAGR,aAAa,CAACO,IAAI,CAAC,GAAG,CAAC,IAAI,GAC9B,CAAA,EAAGP,aAAa,CAACO,IAAI,CAAC,CAAA,EAAA,CAAI;AAChC,MAAA,oBAAoB,EAAE,CAAA,EAAGN,aAAa,CAACM,IAAI,CAAC,CAAA,EAAA,CAAI;MAChD,GAAGI;KACH;AACFD,IAAAA,SAAS,EAAES,IAAI,CACb,WAAW,EACX;AAAE,MAAA,kBAAkB,EAAEV;KAAc,EACpC,kDAAkD,EAClDC,SAAS,CACT;AAAAJ,IAAAA,QAAA,EAEDA;AAAQ,GACF,CAAC;AAEd,CAAC;;;;"}
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var neptuneTokens = require('@transferwise/neptune-tokens');
3
+ var breakpoint = require('../../propsValues/breakpoint.js');
4
4
  var useScreenSize = require('../useScreenSize.js');
5
5
 
6
6
  /**
7
7
  * @deprecated Prefer `useScreenSize` instead.
8
8
  */
9
9
  const useLayout = () => {
10
- const screenXs = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.EXTRA_SMALL);
11
- const screenSm = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.SMALL);
12
- const screenMd = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.MEDIUM);
13
- const screenLg = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.LARGE);
14
- const screenXl = useScreenSize.useScreenSize(neptuneTokens.Breakpoint.EXTRA_LARGE);
10
+ const screenXs = useScreenSize.useScreenSize(breakpoint.Breakpoint.EXTRA_SMALL);
11
+ const screenSm = useScreenSize.useScreenSize(breakpoint.Breakpoint.SMALL);
12
+ const screenMd = useScreenSize.useScreenSize(breakpoint.Breakpoint.MEDIUM);
13
+ const screenLg = useScreenSize.useScreenSize(breakpoint.Breakpoint.LARGE);
14
+ const screenXl = useScreenSize.useScreenSize(breakpoint.Breakpoint.EXTRA_LARGE);
15
15
  return {
16
16
  isMobile: screenSm != null ? !screenSm : undefined,
17
17
  isExtraSmall: screenXs,
@@ -1 +1 @@
1
- {"version":3,"file":"useLayout.js","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,2BAAa,CAACC,wBAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,wBAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,2BAAa,CAACC,wBAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,2BAAa,CAACC,wBAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,2BAAa,CAACC,wBAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
1
+ {"version":3,"file":"useLayout.js","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '../../propsValues/breakpoint';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,2BAAa,CAACC,qBAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,qBAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,2BAAa,CAACC,qBAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,2BAAa,CAACC,qBAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,2BAAa,CAACC,qBAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- import { Breakpoint } from '@transferwise/neptune-tokens';
1
+ import { Breakpoint } from '../../propsValues/breakpoint.mjs';
2
2
  import { useScreenSize } from '../useScreenSize.mjs';
3
3
 
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useLayout.mjs","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,aAAa,CAACC,UAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,aAAa,CAACC,UAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,aAAa,CAACC,UAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,aAAa,CAACC,UAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
1
+ {"version":3,"file":"useLayout.mjs","sources":["../../../../src/common/hooks/useLayout/useLayout.ts"],"sourcesContent":["import { Breakpoint } from '../../propsValues/breakpoint';\nimport { useScreenSize } from '../useScreenSize';\n\n/**\n * @deprecated Prefer `useScreenSize` instead.\n */\nexport const useLayout = (): {\n isMobile: boolean | undefined;\n isExtraSmall: boolean | undefined;\n isSmall: boolean | undefined;\n isMedium: boolean | undefined;\n isLarge: boolean | undefined;\n isExtraLarge: boolean | undefined;\n} => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenMd = useScreenSize(Breakpoint.MEDIUM);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n const screenXl = useScreenSize(Breakpoint.EXTRA_LARGE);\n\n return {\n isMobile: screenSm != null ? !screenSm : undefined,\n isExtraSmall: screenXs,\n isSmall: screenSm,\n isMedium: screenMd,\n isLarge: screenLg,\n isExtraLarge: screenXl,\n };\n};\n"],"names":["useLayout","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","screenMd","MEDIUM","screenLg","LARGE","screenXl","EXTRA_LARGE","isMobile","undefined","isExtraSmall","isSmall","isMedium","isLarge","isExtraLarge"],"mappings":";;;AAGA;;AAEG;AACI,MAAMA,SAAS,GAAGA,MAOrB;AACF,EAAA,MAAMC,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,WAAW,CAAC;AACtD,EAAA,MAAMC,QAAQ,GAAGH,aAAa,CAACC,UAAU,CAACG,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGL,aAAa,CAACC,UAAU,CAACK,MAAM,CAAC;AACjD,EAAA,MAAMC,QAAQ,GAAGP,aAAa,CAACC,UAAU,CAACO,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGT,aAAa,CAACC,UAAU,CAACS,WAAW,CAAC;EAEtD,OAAO;IACLC,QAAQ,EAAER,QAAQ,IAAI,IAAI,GAAG,CAACA,QAAQ,GAAGS,SAAS;AAClDC,IAAAA,YAAY,EAAEd,QAAQ;AACtBe,IAAAA,OAAO,EAAEX,QAAQ;AACjBY,IAAAA,QAAQ,EAAEV,QAAQ;AAClBW,IAAAA,OAAO,EAAET,QAAQ;AACjBU,IAAAA,YAAY,EAAER;GACf;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScreenSize.js","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;;;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,iBAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
1
+ {"version":3,"file":"useScreenSize.js","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '../propsValues/breakpoint';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;;;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,iBAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useScreenSize.mjs","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,QAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
1
+ {"version":3,"file":"useScreenSize.mjs","sources":["../../../src/common/hooks/useScreenSize.ts"],"sourcesContent":["import { Breakpoint } from '../propsValues/breakpoint';\n\nimport { useMedia } from './useMedia';\n\nexport function useScreenSize(size: Breakpoint) {\n return useMedia(`(min-width: ${size}px)`);\n}\n"],"names":["useScreenSize","size","useMedia"],"mappings":";;AAIM,SAAUA,aAAaA,CAACC,IAAgB,EAAA;AAC5C,EAAA,OAAOC,QAAQ,CAAC,CAAA,YAAA,EAAeD,IAAI,KAAK,CAAC;AAC3C;;;;"}
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var react = require('@floating-ui/react');
5
6
  var clsx = require('clsx');
6
7
  var React = require('react');
7
- var reactPopper = require('react-popper');
8
8
  require('../theme.js');
9
9
  require('../direction.js');
10
- require('@transferwise/neptune-tokens');
11
10
  require('../propsValues/control.js');
11
+ require('../propsValues/breakpoint.js');
12
12
  require('../propsValues/size.js');
13
13
  require('../propsValues/typography.js');
14
14
  require('../propsValues/width.js');
@@ -32,7 +32,7 @@ var jsxRuntime = require('react/jsx-runtime');
32
32
  var Dimmer = require('../../dimmer/Dimmer.js');
33
33
  var OverlayIdProvider = require('../../provider/overlay/OverlayIdProvider.js');
34
34
 
35
- const POPOVER_OFFSET = [0, 16];
35
+ const POPOVER_OFFSET = 16;
36
36
  // By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
37
37
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
38
38
  // This mapping forces popover to try the four available positions before going back to the initial chosen one.
@@ -55,60 +55,44 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
55
55
  considerHeight = false,
56
56
  ...rest
57
57
  }, reference) {
58
- const [arrowElement, setArrowElement] = React.useState(null);
59
- const [popperElement, setPopperElement] = React.useState(null);
60
- const modifiers = [];
61
- if (altAxis) {
62
- modifiers.push({
63
- // https://popper.js.org/docs/v2/modifiers/prevent-overflow
64
- name: 'preventOverflow',
65
- options: {
66
- altAxis: true,
67
- tether: false
68
- }
69
- });
70
- }
58
+ const arrowRef = React.useRef(null);
59
+ const middleware = [];
71
60
  if (arrow) {
72
- modifiers.push({
73
- name: 'arrow',
74
- options: {
75
- element: arrowElement,
76
- options: {
77
- padding: 8 // 8px from the edges of the popper
78
- }
79
- }
80
- });
81
- // This lets you displace a popper element from its reference element.
82
- modifiers.push({
83
- name: 'offset',
84
- options: {
85
- offset: POPOVER_OFFSET
86
- }
87
- });
61
+ middleware.push(react.offset(POPOVER_OFFSET));
62
+ middleware.push(react.arrow({
63
+ element: arrowRef,
64
+ padding: 8
65
+ }));
88
66
  }
89
67
  if (flip && fallbackPlacements[position$1]) {
90
- modifiers.push({
91
- name: 'flip',
92
- options: {
93
- fallbackPlacements: fallbackPlacements[position$1]
94
- }
95
- });
68
+ middleware.push(react.flip({
69
+ fallbackPlacements: fallbackPlacements[position$1]
70
+ }));
71
+ }
72
+ if (altAxis) {
73
+ middleware.push(react.shift());
96
74
  }
97
75
  const {
98
- styles,
99
- attributes,
100
- forceUpdate
101
- } = reactPopper.usePopper(anchorRef.current, popperElement, {
76
+ refs,
77
+ floatingStyles,
78
+ placement,
79
+ middlewareData
80
+ } = react.useFloating({
102
81
  placement: position$1,
103
- modifiers
82
+ middleware,
83
+ elements: {
84
+ reference: anchorRef.current
85
+ },
86
+ whileElementsMounted: react.autoUpdate
104
87
  });
105
- // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
106
- // it is most simple just to always position before opening
107
- React.useEffect(() => {
108
- if (open && forceUpdate) {
109
- forceUpdate();
110
- }
111
- }, [open]);
88
+ const arrowStyle = {
89
+ ...(middlewareData.arrow?.x != null ? {
90
+ left: middlewareData.arrow.x
91
+ } : {}),
92
+ ...(middlewareData.arrow?.y != null ? {
93
+ top: middlewareData.arrow.y
94
+ } : {})
95
+ };
112
96
  const contentStyle = {
113
97
  ...(anchorWidth ? {
114
98
  width: anchorRef.current?.clientWidth
@@ -124,12 +108,10 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
124
108
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
125
109
  id: overlayId,
126
110
  ...rest,
127
- ref: setPopperElement,
111
+ ref: refs.setFloating,
128
112
  role: "dialog",
129
- style: {
130
- ...styles.popper
131
- },
132
- ...attributes.popper,
113
+ style: floatingStyles,
114
+ "data-popper-placement": placement,
133
115
  className: clsx.clsx('np-panel', {
134
116
  'np-panel--open': open
135
117
  }, rest.className),
@@ -138,9 +120,9 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
138
120
  style: contentStyle,
139
121
  className: clsx.clsx('np-panel__content'),
140
122
  children: [children, arrow && /*#__PURE__*/jsxRuntime.jsx("div", {
141
- ref: setArrowElement,
123
+ ref: arrowRef,
142
124
  className: clsx.clsx('np-panel__arrow'),
143
- style: styles.arrow
125
+ style: arrowStyle
144
126
  })]
145
127
  })
146
128
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { usePopper } from 'react-popper';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = [0, 16];\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n considerHeight?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n considerHeight = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const modifiers = [];\n\n if (altAxis) {\n modifiers.push({\n // https://popper.js.org/docs/v2/modifiers/prevent-overflow\n name: 'preventOverflow',\n options: {\n altAxis: true,\n tether: false,\n },\n });\n }\n\n if (arrow) {\n modifiers.push({\n name: 'arrow',\n options: {\n element: arrowElement,\n options: {\n padding: 8, // 8px from the edges of the popper\n },\n },\n });\n // This lets you displace a popper element from its reference element.\n modifiers.push({ name: 'offset', options: { offset: POPOVER_OFFSET } });\n }\n if (flip && fallbackPlacements[position]) {\n modifiers.push({\n name: 'flip',\n options: {\n fallbackPlacements: fallbackPlacements[position],\n },\n });\n }\n\n const { styles, attributes, forceUpdate } = usePopper(anchorRef.current, popperElement, {\n placement: position,\n modifiers,\n });\n\n // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),\n // it is most simple just to always position before opening\n useEffect(() => {\n if (open && forceUpdate) {\n forceUpdate();\n }\n }, [open]);\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={setPopperElement}\n role=\"dialog\"\n style={{ ...styles.popper }}\n {...attributes.popper}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div ref={reference} style={contentStyle} className={clsx('np-panel__content')}>\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && (\n <div ref={setArrowElement} className={clsx('np-panel__arrow')} style={styles.arrow} />\n )}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","considerHeight","rest","reference","arrowElement","setArrowElement","useState","popperElement","setPopperElement","modifiers","push","name","options","tether","element","padding","offset","styles","attributes","forceUpdate","usePopper","current","placement","useEffect","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","role","style","popper","className","clsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;AAE9B;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG;AACzB,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IAAI,GAAG,CAACJ,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,iBAAQ,CAACG,KAAK,GAAG,CAACH,iBAAQ,CAACI,IAAI,EAAEJ,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM;CAChE;AAeD,MAAMG,KAAK,gBAAGC,gBAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,EAAAA,KAAK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CAACuC,SAAS,CAAE;AAAA9C,MAAAA,QAAA,eAExEgD,eAAA,CAAA,KAAA,EAAA;AAAKN,QAAAA,GAAG,EAAElC,SAAU;AAACoC,QAAAA,KAAK,EAAEf,YAAa;AAACiB,QAAAA,SAAS,EAAEC,SAAI,CAAC,mBAAmB,CAAE;AAAA/C,QAAAA,QAAA,EAAA,CAC5EA,QAAQ,EAERH,KAAK,iBACJuC,cAAA,CAAA,KAAA,EAAA;AAAKM,UAAAA,GAAG,EAAEhC,eAAgB;AAACoC,UAAAA,SAAS,EAAEC,SAAI,CAAC,iBAAiB,CAAE;UAACH,KAAK,EAAEtB,MAAM,CAACzB;AAAM,SAAA,CACpF;OACE;KACF;AACP,GAAQ,CAAC;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"Panel.js","sources":["../../../src/common/panel/Panel.tsx"],"sourcesContent":["import {\n arrow as arrowMiddleware,\n autoUpdate,\n flip as flipMiddleware,\n offset,\n type Placement,\n shift,\n useFloating,\n} from '@floating-ui/react';\nimport { clsx } from 'clsx';\nimport {\n CSSProperties,\n HTMLAttributes,\n MutableRefObject,\n PropsWithChildren,\n SyntheticEvent,\n forwardRef,\n useContext,\n useRef,\n} from 'react';\n\nimport { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';\nimport Dimmer from '../../dimmer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\n\nconst POPOVER_OFFSET = 16;\n\n// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space\n// the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.\n// This mapping forces popover to try the four available positions before going back to the initial chosen one.\nconst fallbackPlacements: Record<string, Placement[]> = {\n [Position.TOP]: [Position.BOTTOM, Position.RIGHT, Position.LEFT],\n [Position.BOTTOM]: [Position.TOP, Position.RIGHT, Position.LEFT],\n [Position.LEFT]: [Position.RIGHT, Position.TOP, Position.BOTTOM],\n [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM],\n};\n\nexport type PanelProps = PropsWithChildren<{\n arrow?: boolean;\n flip?: boolean;\n altAxis?: boolean;\n open?: boolean;\n onClose?: (event: Event | SyntheticEvent) => void;\n position?: PositionBottom | PositionLeft | PositionRight | PositionTop;\n anchorRef: MutableRefObject<Element | null>;\n anchorWidth?: boolean;\n considerHeight?: boolean;\n}> &\n HTMLAttributes<HTMLDivElement>;\n\nconst Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n {\n arrow = false,\n flip = true,\n altAxis = false,\n children,\n open = false,\n onClose,\n position = Position.BOTTOM,\n anchorRef,\n anchorWidth = false,\n considerHeight = false,\n ...rest\n }: PanelProps,\n reference,\n) {\n const arrowRef = useRef<HTMLDivElement | null>(null);\n\n const middleware = [];\n\n if (arrow) {\n middleware.push(offset(POPOVER_OFFSET));\n middleware.push(arrowMiddleware({ element: arrowRef, padding: 8 }));\n }\n\n if (flip && fallbackPlacements[position]) {\n middleware.push(\n flipMiddleware({\n fallbackPlacements: fallbackPlacements[position],\n }),\n );\n }\n\n if (altAxis) {\n middleware.push(shift());\n }\n\n const { refs, floatingStyles, placement, middlewareData } = useFloating({\n placement: position,\n middleware,\n elements: {\n reference: anchorRef.current,\n },\n whileElementsMounted: autoUpdate,\n });\n\n const arrowStyle: CSSProperties = {\n ...(middlewareData.arrow?.x != null ? { left: middlewareData.arrow.x } : {}),\n ...(middlewareData.arrow?.y != null ? { top: middlewareData.arrow.y } : {}),\n };\n\n const contentStyle: CSSProperties = {\n ...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),\n };\n\n const overlayId = useContext(OverlayIdContext);\n\n return (\n <Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>\n <div\n id={overlayId}\n {...rest}\n ref={refs.setFloating}\n role=\"dialog\"\n style={floatingStyles}\n data-popper-placement={placement}\n className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}\n >\n <div ref={reference} style={contentStyle} className={clsx('np-panel__content')}>\n {children}\n {/* Arrow has to stay inside content to get the same animations as the \"dialog\" and to get hidden when panel is closed. */}\n {arrow && <div ref={arrowRef} className={clsx('np-panel__arrow')} style={arrowStyle} />}\n </div>\n </div>\n </Dimmer>\n );\n});\n\nexport default Panel;\n"],"names":["POPOVER_OFFSET","fallbackPlacements","Position","TOP","BOTTOM","RIGHT","LEFT","Panel","forwardRef","arrow","flip","altAxis","children","open","onClose","position","anchorRef","anchorWidth","considerHeight","rest","reference","arrowRef","useRef","middleware","push","offset","arrowMiddleware","element","padding","flipMiddleware","shift","refs","floatingStyles","placement","middlewareData","useFloating","elements","current","whileElementsMounted","autoUpdate","arrowStyle","x","left","y","top","contentStyle","width","clientWidth","undefined","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","setFloating","role","style","className","clsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,cAAc,GAAG,EAAE;AAEzB;AACA;AACA;AACA,MAAMC,kBAAkB,GAAgC;AACtD,EAAA,CAACC,iBAAQ,CAACC,GAAG,GAAG,CAACD,iBAAQ,CAACE,MAAM,EAAEF,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACE,MAAM,GAAG,CAACF,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,iBAAQ,CAACI,IAAI,GAAG,CAACJ,iBAAQ,CAACG,KAAK,EAAEH,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,iBAAQ,CAACG,KAAK,GAAG,CAACH,iBAAQ,CAACI,IAAI,EAAEJ,iBAAQ,CAACC,GAAG,EAAED,iBAAQ,CAACE,MAAM;CAChE;AAeD,MAAMG,KAAK,gBAAGC,gBAAU,CAA6B,SAASD,KAAKA,CACjE;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SAAI,CAAC,mBAAmB,CAAE;AAAAnD,QAAAA,QAAA,EAAA,CAC5EA,QAAQ,EAERH,KAAK,iBAAI2C,cAAA,CAAA,KAAA,EAAA;AAAKM,UAAAA,GAAG,EAAErC,QAAS;AAACyC,UAAAA,SAAS,EAAEC,SAAI,CAAC,iBAAiB,CAAE;AAACF,UAAAA,KAAK,EAAErB;AAAW,SAAA,CAAG;OACpF;KACF;AACP,GAAQ,CAAC;AAEb,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
+ import { offset, arrow, flip, shift, useFloating, autoUpdate } from '@floating-ui/react';
1
2
  import { clsx } from 'clsx';
2
- import { forwardRef, useState, useEffect, useContext } from 'react';
3
- import { usePopper } from 'react-popper';
3
+ import { forwardRef, useRef, useContext } from 'react';
4
4
  import '../theme.mjs';
5
5
  import '../direction.mjs';
6
- import '@transferwise/neptune-tokens';
7
6
  import '../propsValues/control.mjs';
7
+ import '../propsValues/breakpoint.mjs';
8
8
  import '../propsValues/size.mjs';
9
9
  import '../propsValues/typography.mjs';
10
10
  import '../propsValues/width.mjs';
@@ -28,7 +28,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
28
28
  import Dimmer from '../../dimmer/Dimmer.mjs';
29
29
  import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider.mjs';
30
30
 
31
- const POPOVER_OFFSET = [0, 16];
31
+ const POPOVER_OFFSET = 16;
32
32
  // By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
33
33
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
34
34
  // This mapping forces popover to try the four available positions before going back to the initial chosen one.
@@ -39,8 +39,8 @@ const fallbackPlacements = {
39
39
  [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM]
40
40
  };
41
41
  const Panel = /*#__PURE__*/forwardRef(function Panel({
42
- arrow = false,
43
- flip = true,
42
+ arrow: arrow$1 = false,
43
+ flip: flip$1 = true,
44
44
  altAxis = false,
45
45
  children,
46
46
  open = false,
@@ -51,60 +51,44 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
51
51
  considerHeight = false,
52
52
  ...rest
53
53
  }, reference) {
54
- const [arrowElement, setArrowElement] = useState(null);
55
- const [popperElement, setPopperElement] = useState(null);
56
- const modifiers = [];
57
- if (altAxis) {
58
- modifiers.push({
59
- // https://popper.js.org/docs/v2/modifiers/prevent-overflow
60
- name: 'preventOverflow',
61
- options: {
62
- altAxis: true,
63
- tether: false
64
- }
65
- });
54
+ const arrowRef = useRef(null);
55
+ const middleware = [];
56
+ if (arrow$1) {
57
+ middleware.push(offset(POPOVER_OFFSET));
58
+ middleware.push(arrow({
59
+ element: arrowRef,
60
+ padding: 8
61
+ }));
66
62
  }
67
- if (arrow) {
68
- modifiers.push({
69
- name: 'arrow',
70
- options: {
71
- element: arrowElement,
72
- options: {
73
- padding: 8 // 8px from the edges of the popper
74
- }
75
- }
76
- });
77
- // This lets you displace a popper element from its reference element.
78
- modifiers.push({
79
- name: 'offset',
80
- options: {
81
- offset: POPOVER_OFFSET
82
- }
83
- });
63
+ if (flip$1 && fallbackPlacements[position]) {
64
+ middleware.push(flip({
65
+ fallbackPlacements: fallbackPlacements[position]
66
+ }));
84
67
  }
85
- if (flip && fallbackPlacements[position]) {
86
- modifiers.push({
87
- name: 'flip',
88
- options: {
89
- fallbackPlacements: fallbackPlacements[position]
90
- }
91
- });
68
+ if (altAxis) {
69
+ middleware.push(shift());
92
70
  }
93
71
  const {
94
- styles,
95
- attributes,
96
- forceUpdate
97
- } = usePopper(anchorRef.current, popperElement, {
72
+ refs,
73
+ floatingStyles,
74
+ placement,
75
+ middlewareData
76
+ } = useFloating({
98
77
  placement: position,
99
- modifiers
78
+ middleware,
79
+ elements: {
80
+ reference: anchorRef.current
81
+ },
82
+ whileElementsMounted: autoUpdate
100
83
  });
101
- // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
102
- // it is most simple just to always position before opening
103
- useEffect(() => {
104
- if (open && forceUpdate) {
105
- forceUpdate();
106
- }
107
- }, [open]);
84
+ const arrowStyle = {
85
+ ...(middlewareData.arrow?.x != null ? {
86
+ left: middlewareData.arrow.x
87
+ } : {}),
88
+ ...(middlewareData.arrow?.y != null ? {
89
+ top: middlewareData.arrow.y
90
+ } : {})
91
+ };
108
92
  const contentStyle = {
109
93
  ...(anchorWidth ? {
110
94
  width: anchorRef.current?.clientWidth
@@ -120,12 +104,10 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
120
104
  children: /*#__PURE__*/jsx("div", {
121
105
  id: overlayId,
122
106
  ...rest,
123
- ref: setPopperElement,
107
+ ref: refs.setFloating,
124
108
  role: "dialog",
125
- style: {
126
- ...styles.popper
127
- },
128
- ...attributes.popper,
109
+ style: floatingStyles,
110
+ "data-popper-placement": placement,
129
111
  className: clsx('np-panel', {
130
112
  'np-panel--open': open
131
113
  }, rest.className),
@@ -133,10 +115,10 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
133
115
  ref: reference,
134
116
  style: contentStyle,
135
117
  className: clsx('np-panel__content'),
136
- children: [children, arrow && /*#__PURE__*/jsx("div", {
137
- ref: setArrowElement,
118
+ children: [children, arrow$1 && /*#__PURE__*/jsx("div", {
119
+ ref: arrowRef,
138
120
  className: clsx('np-panel__arrow'),
139
- style: styles.arrow
121
+ style: arrowStyle
140
122
  })]
141
123
  })
142
124
  })