@transferwise/components 0.0.0-experimental-4c97d70 → 0.0.0-experimental-a322f91

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 (647) hide show
  1. package/build/accordion/AccordionItem/AccordionItem.js +2 -1
  2. package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
  3. package/build/accordion/AccordionItem/AccordionItem.mjs +2 -1
  4. package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
  5. package/build/actionButton/ActionButton.js +2 -1
  6. package/build/actionButton/ActionButton.js.map +1 -1
  7. package/build/actionButton/ActionButton.mjs +2 -1
  8. package/build/actionButton/ActionButton.mjs.map +1 -1
  9. package/build/actionOption/ActionOption.js +2 -1
  10. package/build/actionOption/ActionOption.js.map +1 -1
  11. package/build/actionOption/ActionOption.mjs +2 -1
  12. package/build/actionOption/ActionOption.mjs.map +1 -1
  13. package/build/alert/Alert.js +2 -1
  14. package/build/alert/Alert.js.map +1 -1
  15. package/build/alert/Alert.mjs +2 -1
  16. package/build/alert/Alert.mjs.map +1 -1
  17. package/build/alert/inlineMarkdown/InlineMarkdown.js +2 -1
  18. package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
  19. package/build/alert/inlineMarkdown/InlineMarkdown.mjs +2 -1
  20. package/build/alert/inlineMarkdown/InlineMarkdown.mjs.map +1 -1
  21. package/build/avatar/Avatar.js +2 -1
  22. package/build/avatar/Avatar.js.map +1 -1
  23. package/build/avatar/Avatar.mjs +2 -1
  24. package/build/avatar/Avatar.mjs.map +1 -1
  25. package/build/avatarLayout/AvatarLayout.js +1 -1
  26. package/build/avatarLayout/AvatarLayout.mjs +1 -1
  27. package/build/avatarView/AvatarView.js +2 -1
  28. package/build/avatarView/AvatarView.js.map +1 -1
  29. package/build/avatarView/AvatarView.mjs +2 -1
  30. package/build/avatarView/AvatarView.mjs.map +1 -1
  31. package/build/avatarWrapper/AvatarWrapper.js +2 -1
  32. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  33. package/build/avatarWrapper/AvatarWrapper.mjs +2 -1
  34. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  35. package/build/badge/Badge.js +2 -1
  36. package/build/badge/Badge.js.map +1 -1
  37. package/build/badge/Badge.mjs +2 -1
  38. package/build/badge/Badge.mjs.map +1 -1
  39. package/build/badge/BadgeAssets.js +2 -1
  40. package/build/badge/BadgeAssets.js.map +1 -1
  41. package/build/badge/BadgeAssets.mjs +2 -1
  42. package/build/badge/BadgeAssets.mjs.map +1 -1
  43. package/build/button/Button.js +2 -1
  44. package/build/button/Button.js.map +1 -1
  45. package/build/button/Button.mjs +2 -1
  46. package/build/button/Button.mjs.map +1 -1
  47. package/build/button/LegacyButton.js +2 -1
  48. package/build/button/LegacyButton.js.map +1 -1
  49. package/build/button/LegacyButton.mjs +2 -1
  50. package/build/button/LegacyButton.mjs.map +1 -1
  51. package/build/button/classMap.js +2 -1
  52. package/build/button/classMap.js.map +1 -1
  53. package/build/button/classMap.mjs +2 -1
  54. package/build/button/classMap.mjs.map +1 -1
  55. package/build/button/legacyUtils/legacyUtils.js +2 -1
  56. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  57. package/build/button/legacyUtils/legacyUtils.mjs +2 -1
  58. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  59. package/build/card/Card.js +2 -1
  60. package/build/card/Card.js.map +1 -1
  61. package/build/card/Card.mjs +2 -1
  62. package/build/card/Card.mjs.map +1 -1
  63. package/build/checkbox/Checkbox.js +2 -1
  64. package/build/checkbox/Checkbox.js.map +1 -1
  65. package/build/checkbox/Checkbox.mjs +2 -1
  66. package/build/checkbox/Checkbox.mjs.map +1 -1
  67. package/build/chevron/Chevron.js +2 -1
  68. package/build/chevron/Chevron.js.map +1 -1
  69. package/build/chevron/Chevron.mjs +2 -1
  70. package/build/chevron/Chevron.mjs.map +1 -1
  71. package/build/chips/Chip.js +2 -1
  72. package/build/chips/Chip.js.map +1 -1
  73. package/build/chips/Chip.mjs +2 -1
  74. package/build/chips/Chip.mjs.map +1 -1
  75. package/build/circularButton/CircularButton.js +3 -2
  76. package/build/circularButton/CircularButton.js.map +1 -1
  77. package/build/circularButton/CircularButton.mjs +3 -2
  78. package/build/circularButton/CircularButton.mjs.map +1 -1
  79. package/build/common/bottomSheet/BottomSheet.js +2 -2
  80. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  81. package/build/common/bottomSheet/BottomSheet.mjs +2 -2
  82. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  83. package/build/common/circle/Circle.js +2 -2
  84. package/build/common/circle/Circle.js.map +1 -1
  85. package/build/common/circle/Circle.mjs +2 -2
  86. package/build/common/circle/Circle.mjs.map +1 -1
  87. package/build/common/hooks/useLayout/useLayout.js +6 -6
  88. package/build/common/hooks/useLayout/useLayout.js.map +1 -1
  89. package/build/common/hooks/useLayout/useLayout.mjs +1 -1
  90. package/build/common/hooks/useLayout/useLayout.mjs.map +1 -1
  91. package/build/common/hooks/useScreenSize.js.map +1 -1
  92. package/build/common/hooks/useScreenSize.mjs.map +1 -1
  93. package/build/common/locale/index.js +9 -4
  94. package/build/common/locale/index.js.map +1 -1
  95. package/build/common/locale/index.mjs +9 -4
  96. package/build/common/locale/index.mjs.map +1 -1
  97. package/build/common/panel/Panel.js +51 -55
  98. package/build/common/panel/Panel.js.map +1 -1
  99. package/build/common/panel/Panel.mjs +56 -60
  100. package/build/common/panel/Panel.mjs.map +1 -1
  101. package/build/common/responsivePanel/ResponsivePanel.js +2 -1
  102. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  103. package/build/common/responsivePanel/ResponsivePanel.mjs +2 -1
  104. package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
  105. package/build/criticalBanner/CriticalCommsBanner.js +2 -1
  106. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  107. package/build/criticalBanner/CriticalCommsBanner.mjs +2 -1
  108. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  109. package/build/dateInput/DateInput.js +2 -2
  110. package/build/dateInput/DateInput.mjs +2 -2
  111. package/build/dateLookup/DateLookup.js +3 -3
  112. package/build/dateLookup/DateLookup.js.map +1 -1
  113. package/build/dateLookup/DateLookup.mjs +2 -2
  114. package/build/dateLookup/DateLookup.mjs.map +1 -1
  115. package/build/dateLookup/dateHeader/DateHeader.js +2 -1
  116. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  117. package/build/dateLookup/dateHeader/DateHeader.mjs +2 -1
  118. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  119. package/build/dateLookup/dateTrigger/DateTrigger.js +1 -1
  120. package/build/dateLookup/dateTrigger/DateTrigger.mjs +1 -1
  121. package/build/decision/Decision.js +4 -3
  122. package/build/decision/Decision.js.map +1 -1
  123. package/build/decision/Decision.mjs +2 -1
  124. package/build/decision/Decision.mjs.map +1 -1
  125. package/build/definitionList/DefinitionList.js +2 -1
  126. package/build/definitionList/DefinitionList.js.map +1 -1
  127. package/build/definitionList/DefinitionList.mjs +2 -1
  128. package/build/definitionList/DefinitionList.mjs.map +1 -1
  129. package/build/dimmer/Dimmer.js +2 -1
  130. package/build/dimmer/Dimmer.js.map +1 -1
  131. package/build/dimmer/Dimmer.mjs +2 -1
  132. package/build/dimmer/Dimmer.mjs.map +1 -1
  133. package/build/display/Display.js +2 -1
  134. package/build/display/Display.js.map +1 -1
  135. package/build/display/Display.mjs +2 -1
  136. package/build/display/Display.mjs.map +1 -1
  137. package/build/drawer/Drawer.js +2 -1
  138. package/build/drawer/Drawer.js.map +1 -1
  139. package/build/drawer/Drawer.mjs +2 -1
  140. package/build/drawer/Drawer.mjs.map +1 -1
  141. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +5 -4
  142. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
  143. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +5 -4
  144. package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
  145. package/build/field/Field.js +6 -6
  146. package/build/field/Field.mjs +6 -6
  147. package/build/flowNavigation/FlowNavigation.js +4 -3
  148. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  149. package/build/flowNavigation/FlowNavigation.mjs +2 -1
  150. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  151. package/build/header/Header.js +2 -1
  152. package/build/header/Header.js.map +1 -1
  153. package/build/header/Header.mjs +2 -1
  154. package/build/header/Header.mjs.map +1 -1
  155. package/build/i18n/en.json +0 -2
  156. package/build/i18n/en.json.js +0 -2
  157. package/build/i18n/en.json.js.map +1 -1
  158. package/build/i18n/en.json.mjs +0 -2
  159. package/build/i18n/en.json.mjs.map +1 -1
  160. package/build/image/Image.js +1 -1
  161. package/build/image/Image.mjs +1 -1
  162. package/build/index.js +2 -4
  163. package/build/index.js.map +1 -1
  164. package/build/index.mjs +1 -2
  165. package/build/index.mjs.map +1 -1
  166. package/build/info/Info.js +2 -1
  167. package/build/info/Info.js.map +1 -1
  168. package/build/info/Info.mjs +2 -1
  169. package/build/info/Info.mjs.map +1 -1
  170. package/build/inlineAlert/InlineAlert.js +2 -1
  171. package/build/inlineAlert/InlineAlert.js.map +1 -1
  172. package/build/inlineAlert/InlineAlert.mjs +2 -1
  173. package/build/inlineAlert/InlineAlert.mjs.map +1 -1
  174. package/build/inputs/SearchInput.js +2 -1
  175. package/build/inputs/SearchInput.js.map +1 -1
  176. package/build/inputs/SearchInput.mjs +2 -1
  177. package/build/inputs/SearchInput.mjs.map +1 -1
  178. package/build/inputs/SelectInput/SelectInput.js +2 -2
  179. package/build/inputs/SelectInput/SelectInput.js.map +1 -1
  180. package/build/inputs/SelectInput/SelectInput.mjs +1 -1
  181. package/build/inputs/SelectInput/SelectInput.mjs.map +1 -1
  182. package/build/instructionsList/InstructionsList.js +2 -1
  183. package/build/instructionsList/InstructionsList.js.map +1 -1
  184. package/build/instructionsList/InstructionsList.mjs +2 -1
  185. package/build/instructionsList/InstructionsList.mjs.map +1 -1
  186. package/build/link/Link.js +2 -1
  187. package/build/link/Link.js.map +1 -1
  188. package/build/link/Link.mjs +2 -1
  189. package/build/link/Link.mjs.map +1 -1
  190. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +2 -1
  191. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -1
  192. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +2 -1
  193. package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -1
  194. package/build/listItem/ListItem.js +2 -1
  195. package/build/listItem/ListItem.js.map +1 -1
  196. package/build/listItem/ListItem.mjs +2 -1
  197. package/build/listItem/ListItem.mjs.map +1 -1
  198. package/build/listItem/Prompt/ListItemPrompt.js +6 -6
  199. package/build/listItem/Prompt/ListItemPrompt.mjs +6 -6
  200. package/build/loader/Loader.js +2 -1
  201. package/build/loader/Loader.js.map +1 -1
  202. package/build/loader/Loader.mjs +2 -1
  203. package/build/loader/Loader.mjs.map +1 -1
  204. package/build/logo/Logo.js +1 -1
  205. package/build/logo/Logo.js.map +1 -1
  206. package/build/logo/Logo.mjs +1 -1
  207. package/build/logo/Logo.mjs.map +1 -1
  208. package/build/main.css +351 -418
  209. package/build/markdown/Markdown.js +2 -1
  210. package/build/markdown/Markdown.js.map +1 -1
  211. package/build/markdown/Markdown.mjs +2 -1
  212. package/build/markdown/Markdown.mjs.map +1 -1
  213. package/build/modal/Modal.js +2 -1
  214. package/build/modal/Modal.js.map +1 -1
  215. package/build/modal/Modal.mjs +2 -1
  216. package/build/modal/Modal.mjs.map +1 -1
  217. package/build/moneyInput/MoneyInput.js +29 -13
  218. package/build/moneyInput/MoneyInput.js.map +1 -1
  219. package/build/moneyInput/MoneyInput.mjs +31 -15
  220. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  221. package/build/moneyInput/currencyFormatting.js +8 -2
  222. package/build/moneyInput/currencyFormatting.js.map +1 -1
  223. package/build/moneyInput/currencyFormatting.mjs +5 -4
  224. package/build/moneyInput/currencyFormatting.mjs.map +1 -1
  225. package/build/navigationOption/NavigationOption.js +2 -1
  226. package/build/navigationOption/NavigationOption.js.map +1 -1
  227. package/build/navigationOption/NavigationOption.mjs +2 -1
  228. package/build/navigationOption/NavigationOption.mjs.map +1 -1
  229. package/build/nudge/Nudge.js +2 -1
  230. package/build/nudge/Nudge.js.map +1 -1
  231. package/build/nudge/Nudge.mjs +2 -1
  232. package/build/nudge/Nudge.mjs.map +1 -1
  233. package/build/overlayHeader/OverlayHeader.js +2 -1
  234. package/build/overlayHeader/OverlayHeader.js.map +1 -1
  235. package/build/overlayHeader/OverlayHeader.mjs +2 -1
  236. package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
  237. package/build/phoneNumberInput/PhoneNumberInput.js +2 -1
  238. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  239. package/build/phoneNumberInput/PhoneNumberInput.mjs +2 -1
  240. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  241. package/build/popover/Popover.js +2 -1
  242. package/build/popover/Popover.js.map +1 -1
  243. package/build/popover/Popover.mjs +2 -1
  244. package/build/popover/Popover.mjs.map +1 -1
  245. package/build/processIndicator/ProcessIndicator.js +2 -1
  246. package/build/processIndicator/ProcessIndicator.js.map +1 -1
  247. package/build/processIndicator/ProcessIndicator.mjs +2 -1
  248. package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
  249. package/build/progressBar/ProgressBar.js +2 -1
  250. package/build/progressBar/ProgressBar.js.map +1 -1
  251. package/build/progressBar/ProgressBar.mjs +2 -1
  252. package/build/progressBar/ProgressBar.mjs.map +1 -1
  253. package/build/promoCard/PromoCard.js +2 -1
  254. package/build/promoCard/PromoCard.js.map +1 -1
  255. package/build/promoCard/PromoCard.mjs +2 -1
  256. package/build/promoCard/PromoCard.mjs.map +1 -1
  257. package/build/promoCard/PromoCardIndicator.js +2 -1
  258. package/build/promoCard/PromoCardIndicator.js.map +1 -1
  259. package/build/promoCard/PromoCardIndicator.mjs +2 -1
  260. package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
  261. package/build/prompt/ActionPrompt/ActionPrompt.js +43 -10
  262. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
  263. package/build/prompt/ActionPrompt/ActionPrompt.mjs +42 -9
  264. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
  265. package/build/prompt/InfoPrompt/InfoPrompt.js +2 -1
  266. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  267. package/build/prompt/InfoPrompt/InfoPrompt.mjs +2 -1
  268. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  269. package/build/prompt/InlinePrompt/InlinePrompt.js +2 -1
  270. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  271. package/build/prompt/InlinePrompt/InlinePrompt.mjs +2 -1
  272. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  273. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +0 -2
  274. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  275. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +0 -2
  276. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  277. package/build/provider/Provider.js +1 -1
  278. package/build/provider/Provider.mjs +1 -1
  279. package/build/radio/Radio.js +2 -1
  280. package/build/radio/Radio.js.map +1 -1
  281. package/build/radio/Radio.mjs +2 -1
  282. package/build/radio/Radio.mjs.map +1 -1
  283. package/build/segmentedControl/SegmentedControl.js +2 -1
  284. package/build/segmentedControl/SegmentedControl.js.map +1 -1
  285. package/build/segmentedControl/SegmentedControl.mjs +2 -1
  286. package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
  287. package/build/select/Select.js +3 -2
  288. package/build/select/Select.js.map +1 -1
  289. package/build/select/Select.mjs +3 -2
  290. package/build/select/Select.mjs.map +1 -1
  291. package/build/select/option/Option.js +2 -1
  292. package/build/select/option/Option.js.map +1 -1
  293. package/build/select/option/Option.mjs +2 -1
  294. package/build/select/option/Option.mjs.map +1 -1
  295. package/build/statusIcon/StatusIcon.js +3 -2
  296. package/build/statusIcon/StatusIcon.js.map +1 -1
  297. package/build/statusIcon/StatusIcon.mjs +3 -2
  298. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  299. package/build/stepper/Stepper.js +2 -1
  300. package/build/stepper/Stepper.js.map +1 -1
  301. package/build/stepper/Stepper.mjs +2 -1
  302. package/build/stepper/Stepper.mjs.map +1 -1
  303. package/build/sticky/Sticky.js +2 -1
  304. package/build/sticky/Sticky.js.map +1 -1
  305. package/build/sticky/Sticky.mjs +2 -1
  306. package/build/sticky/Sticky.mjs.map +1 -1
  307. package/build/styles/accordion/Accordion.css +1 -1
  308. package/build/styles/card/Card.css +2 -2
  309. package/build/styles/carousel/Carousel.css +5 -5
  310. package/build/styles/common/Option/Option.css +1 -1
  311. package/build/styles/common/baseCard/BaseCard.css +1 -1
  312. package/build/styles/criticalBanner/CriticalCommsBanner.css +1 -1
  313. package/build/styles/css/accordion.css +4 -4
  314. package/build/styles/css/button-groups.css +6 -6
  315. package/build/styles/css/buttons.css +1 -1
  316. package/build/styles/css/circles.css +1 -1
  317. package/build/styles/css/column-layout.css +4 -4
  318. package/build/styles/css/decision.css +4 -4
  319. package/build/styles/css/dropdowns.css +10 -10
  320. package/build/styles/css/droppable.css +8 -8
  321. package/build/styles/css/flex.css +14 -14
  322. package/build/styles/css/footer.css +3 -3
  323. package/build/styles/css/grid.css +19 -19
  324. package/build/styles/css/input-groups.css +12 -12
  325. package/build/styles/css/list-group.css +8 -8
  326. package/build/styles/css/modals.css +3 -3
  327. package/build/styles/css/navbar.css +62 -62
  328. package/build/styles/css/navs.css +2 -2
  329. package/build/styles/css/neptune.css +280 -269
  330. package/build/styles/css/panels.css +9 -9
  331. package/build/styles/css/popovers.css +13 -13
  332. package/build/styles/css/select.css +1 -1
  333. package/build/styles/css/sequences.css +6 -6
  334. package/build/styles/css/table.css +6 -6
  335. package/build/styles/css/utilities.css +4 -4
  336. package/build/styles/css/wells.css +4 -4
  337. package/build/styles/dateInput/DateInput.css +1 -1
  338. package/build/styles/definitionList/DefinitionList.css +2 -2
  339. package/build/styles/drawer/Drawer.css +1 -1
  340. package/build/styles/inputs/Input.css +3 -3
  341. package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  342. package/build/styles/inputs/SelectInput/SelectInput.css +2 -2
  343. package/build/styles/inputs/TextArea.css +3 -3
  344. package/build/styles/less/legacy-variables.less +34 -47
  345. package/build/styles/less/neptune-tokens.less +5 -4
  346. package/build/styles/logo/Logo.css +2 -2
  347. package/build/styles/main.css +351 -418
  348. package/build/styles/modal/Modal.css +5 -5
  349. package/build/styles/popover/Popover.css +3 -3
  350. package/build/styles/promoCard/PromoCard.css +1 -1
  351. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +1 -1
  352. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  353. package/build/styles/props/custom-media.css +23 -11
  354. package/build/styles/props/neptune-tokens.css +3 -2
  355. package/build/styles/select/Select.css +2 -1
  356. package/build/styles/snackbar/Snackbar.css +2 -2
  357. package/build/styles/stepper/Stepper.css +2 -2
  358. package/build/styles/styles/less/accordion.css +4 -4
  359. package/build/styles/styles/less/button-groups.css +6 -6
  360. package/build/styles/styles/less/buttons.css +1 -1
  361. package/build/styles/styles/less/circles.css +1 -1
  362. package/build/styles/styles/less/column-layout.css +4 -4
  363. package/build/styles/styles/less/decision.css +4 -4
  364. package/build/styles/styles/less/dropdowns.css +10 -10
  365. package/build/styles/styles/less/droppable.css +8 -8
  366. package/build/styles/styles/less/flex.css +14 -14
  367. package/build/styles/styles/less/footer.css +3 -3
  368. package/build/styles/styles/less/forms/bootstrap-forms.css +9 -9
  369. package/build/styles/styles/less/grid.css +19 -19
  370. package/build/styles/styles/less/input-groups.css +12 -12
  371. package/build/styles/styles/less/list-group.css +8 -8
  372. package/build/styles/styles/less/modals.css +3 -3
  373. package/build/styles/styles/less/navbar.css +62 -62
  374. package/build/styles/styles/less/navs.css +2 -2
  375. package/build/styles/styles/less/neptune.css +280 -269
  376. package/build/styles/styles/less/panels.css +9 -9
  377. package/build/styles/styles/less/popovers.css +13 -13
  378. package/build/styles/styles/less/select.css +1 -1
  379. package/build/styles/styles/less/sequences.css +6 -6
  380. package/build/styles/styles/less/table.css +6 -6
  381. package/build/styles/styles/less/utilities.css +4 -4
  382. package/build/styles/styles/less/wells.css +4 -4
  383. package/build/styles/styles/props/custom-media.css +1 -11
  384. package/build/styles/table/Table.css +1 -1
  385. package/build/styles/tabs/Tabs.css +2 -2
  386. package/build/styles/typeahead/Typeahead.css +1 -1
  387. package/build/summary/Summary.js +2 -1
  388. package/build/summary/Summary.js.map +1 -1
  389. package/build/summary/Summary.mjs +2 -1
  390. package/build/summary/Summary.mjs.map +1 -1
  391. package/build/table/Table.js +2 -1
  392. package/build/table/Table.js.map +1 -1
  393. package/build/table/Table.mjs +2 -1
  394. package/build/table/Table.mjs.map +1 -1
  395. package/build/table/TableRow.js +2 -1
  396. package/build/table/TableRow.js.map +1 -1
  397. package/build/table/TableRow.mjs +2 -1
  398. package/build/table/TableRow.mjs.map +1 -1
  399. package/build/table/TableStatusText.js +2 -1
  400. package/build/table/TableStatusText.js.map +1 -1
  401. package/build/table/TableStatusText.mjs +2 -1
  402. package/build/table/TableStatusText.mjs.map +1 -1
  403. package/build/tabs/Tabs.js +2 -1
  404. package/build/tabs/Tabs.js.map +1 -1
  405. package/build/tabs/Tabs.mjs +2 -1
  406. package/build/tabs/Tabs.mjs.map +1 -1
  407. package/build/tile/Tile.js +2 -1
  408. package/build/tile/Tile.js.map +1 -1
  409. package/build/tile/Tile.mjs +2 -1
  410. package/build/tile/Tile.mjs.map +1 -1
  411. package/build/title/Title.js +2 -1
  412. package/build/title/Title.js.map +1 -1
  413. package/build/title/Title.mjs +2 -1
  414. package/build/title/Title.mjs.map +1 -1
  415. package/build/tooltip/Tooltip.js +31 -51
  416. package/build/tooltip/Tooltip.js.map +1 -1
  417. package/build/tooltip/Tooltip.mjs +32 -52
  418. package/build/tooltip/Tooltip.mjs.map +1 -1
  419. package/build/typeahead/Typeahead.js +6 -6
  420. package/build/typeahead/Typeahead.mjs +6 -6
  421. package/build/types/badge/BadgeAssets.d.ts.map +1 -1
  422. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  423. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  424. package/build/types/common/hooks/useScreenSize.d.ts +1 -1
  425. package/build/types/common/hooks/useScreenSize.d.ts.map +1 -1
  426. package/build/types/common/index.d.ts +1 -1
  427. package/build/types/common/index.d.ts.map +1 -1
  428. package/build/types/common/locale/index.d.ts +1 -1
  429. package/build/types/common/locale/index.d.ts.map +1 -1
  430. package/build/types/common/panel/Panel.d.ts.map +1 -1
  431. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  432. package/build/types/decision/Decision.d.ts.map +1 -1
  433. package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -1
  434. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  435. package/build/types/index.d.ts +4 -3
  436. package/build/types/index.d.ts.map +1 -1
  437. package/build/types/logo/Logo.d.ts +1 -1
  438. package/build/types/moneyInput/MoneyInput.d.ts +6 -0
  439. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  440. package/build/types/moneyInput/currencyFormatting.d.ts +4 -3
  441. package/build/types/moneyInput/currencyFormatting.d.ts.map +1 -1
  442. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +11 -2
  443. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
  444. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +3 -8
  445. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  446. package/build/types/prompt/index.d.ts +0 -2
  447. package/build/types/prompt/index.d.ts.map +1 -1
  448. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  449. package/build/types/test-utils/index.d.ts +0 -4
  450. package/build/types/test-utils/index.d.ts.map +1 -1
  451. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  452. package/build/upload/Upload.js +2 -1
  453. package/build/upload/Upload.js.map +1 -1
  454. package/build/upload/Upload.mjs +2 -1
  455. package/build/upload/Upload.mjs.map +1 -1
  456. package/build/upload/steps/completeStep/completeStep.js +2 -1
  457. package/build/upload/steps/completeStep/completeStep.js.map +1 -1
  458. package/build/upload/steps/completeStep/completeStep.mjs +2 -1
  459. package/build/upload/steps/completeStep/completeStep.mjs.map +1 -1
  460. package/build/upload/steps/processingStep/processingStep.js +2 -1
  461. package/build/upload/steps/processingStep/processingStep.js.map +1 -1
  462. package/build/upload/steps/processingStep/processingStep.mjs +2 -1
  463. package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
  464. package/build/upload/steps/uploadImageStep/uploadImageStep.js +2 -1
  465. package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
  466. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +2 -1
  467. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
  468. package/build/uploadInput/UploadInput.js +2 -1
  469. package/build/uploadInput/UploadInput.js.map +1 -1
  470. package/build/uploadInput/UploadInput.mjs +2 -1
  471. package/build/uploadInput/UploadInput.mjs.map +1 -1
  472. package/build/uploadInput/uploadButton/UploadButton.js +2 -1
  473. package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
  474. package/build/uploadInput/uploadButton/UploadButton.mjs +2 -1
  475. package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
  476. package/build/uploadInput/uploadButton/defaults.js +2 -1
  477. package/build/uploadInput/uploadButton/defaults.js.map +1 -1
  478. package/build/uploadInput/uploadButton/defaults.mjs +2 -1
  479. package/build/uploadInput/uploadButton/defaults.mjs.map +1 -1
  480. package/build/uploadInput/uploadItem/UploadItem.js +2 -1
  481. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  482. package/build/uploadInput/uploadItem/UploadItem.mjs +2 -1
  483. package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
  484. package/build/withDisplayFormat/WithDisplayFormat.js +2 -1
  485. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  486. package/build/withDisplayFormat/WithDisplayFormat.mjs +2 -1
  487. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  488. package/package.json +20 -22
  489. package/src/accordion/Accordion.css +1 -1
  490. package/src/avatarView/AvatarView.story.tsx +1 -1
  491. package/src/avatarView/AvatarView.test.story.tsx +108 -1
  492. package/src/badge/BadgeAssets.tsx +2 -0
  493. package/src/card/Card.css +2 -2
  494. package/src/carousel/Carousel.css +5 -5
  495. package/src/circularButton/CircularButton.tsx +3 -2
  496. package/src/common/Option/Option.css +1 -1
  497. package/src/common/baseCard/BaseCard.css +1 -1
  498. package/src/common/bottomSheet/BottomSheet.tsx +2 -2
  499. package/src/common/circle/Circle.tsx +2 -2
  500. package/src/common/hooks/useLayout/useLayout.ts +1 -1
  501. package/src/common/hooks/useScreenSize.ts +1 -1
  502. package/src/common/index.ts +1 -1
  503. package/src/common/locale/index.test.ts +13 -4
  504. package/src/common/locale/index.ts +9 -3
  505. package/src/common/panel/Panel.tsx +56 -49
  506. package/src/common/responsivePanel/ResponsivePanel.test.js +3 -2
  507. package/src/criticalBanner/CriticalCommsBanner.css +1 -1
  508. package/src/dateInput/DateInput.css +1 -1
  509. package/src/dateLookup/DateLookup.tsx +1 -1
  510. package/src/decision/Decision.test.tsx +2 -1
  511. package/src/decision/Decision.tsx +2 -1
  512. package/src/definitionList/DefinitionList.css +2 -2
  513. package/src/definitionList/DefinitionList.less +2 -2
  514. package/src/drawer/Drawer.css +1 -1
  515. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +18 -0
  516. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.test.tsx +119 -1
  517. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +4 -3
  518. package/src/flowNavigation/FlowNavigation.test.js +1 -1
  519. package/src/flowNavigation/FlowNavigation.tsx +2 -1
  520. package/src/i18n/en.json +0 -2
  521. package/src/index.ts +3 -3
  522. package/src/inputs/Input.css +3 -3
  523. package/src/inputs/SelectInput/Options/SelectInputOptions.css +2 -2
  524. package/src/inputs/SelectInput/SelectInput.css +2 -2
  525. package/src/inputs/SelectInput/SelectInput.tsx +1 -1
  526. package/src/inputs/TextArea.css +3 -3
  527. package/src/logo/Logo.css +2 -2
  528. package/src/logo/Logo.story.tsx +3 -3
  529. package/src/logo/Logo.tsx +1 -1
  530. package/src/main.css +351 -418
  531. package/src/main.less +1 -3
  532. package/src/modal/Modal.css +5 -5
  533. package/src/moneyInput/MoneyInput.story.tsx +10 -1
  534. package/src/moneyInput/MoneyInput.test.story.tsx +141 -1
  535. package/src/moneyInput/MoneyInput.test.tsx +45 -0
  536. package/src/moneyInput/MoneyInput.tsx +27 -3
  537. package/src/moneyInput/currencyFormatting.ts +11 -5
  538. package/src/popover/Popover.css +3 -3
  539. package/src/popover/Popover.test.tsx +2 -1
  540. package/src/promoCard/PromoCard.css +1 -1
  541. package/src/prompt/ActionPrompt/ActionPrompt.css +1 -1
  542. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +3 -3
  543. package/src/prompt/ActionPrompt/ActionPrompt.tsx +64 -10
  544. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -1
  545. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +2 -9
  546. package/src/prompt/index.ts +0 -4
  547. package/src/section/Section.story.tsx +2 -8
  548. package/src/select/Select.css +2 -1
  549. package/src/select/Select.less +6 -5
  550. package/src/select/Select.test.story.tsx +59 -0
  551. package/src/select/Select.test.tsx +1 -1
  552. package/src/select/Select.tsx +1 -1
  553. package/src/sentimentSurface/SentimentSurface.story.tsx +17 -43
  554. package/src/snackbar/Snackbar.css +2 -2
  555. package/src/statusIcon/StatusIcon.test.tsx +0 -2
  556. package/src/statusIcon/StatusIcon.tsx +3 -2
  557. package/src/stepper/Stepper.css +2 -2
  558. package/src/styles/less/accordion.css +4 -4
  559. package/src/styles/less/button-groups.css +6 -6
  560. package/src/styles/less/buttons.css +1 -1
  561. package/src/styles/less/circles.css +1 -1
  562. package/src/styles/less/column-layout.css +4 -4
  563. package/src/styles/less/decision.css +4 -4
  564. package/src/styles/less/dropdowns.css +10 -10
  565. package/src/styles/less/droppable.css +8 -8
  566. package/src/styles/less/flex.css +14 -14
  567. package/src/styles/less/footer.css +3 -3
  568. package/src/styles/less/forms/bootstrap-forms.css +9 -9
  569. package/src/styles/less/forms/bootstrap-forms.less +1 -1
  570. package/src/styles/less/grid.css +19 -19
  571. package/src/styles/less/input-groups.css +12 -12
  572. package/src/styles/less/list-group.css +8 -8
  573. package/src/styles/less/modals.css +3 -3
  574. package/src/styles/less/navbar.css +62 -62
  575. package/src/styles/less/navbar.less +2 -2
  576. package/src/styles/less/navs.css +2 -2
  577. package/src/styles/less/neptune.bundle.less +1 -0
  578. package/src/styles/less/neptune.css +280 -269
  579. package/src/styles/less/panels.css +9 -9
  580. package/src/styles/less/popovers.css +13 -13
  581. package/src/styles/less/select.css +1 -1
  582. package/src/styles/less/sequences.css +6 -6
  583. package/src/styles/less/table.css +6 -6
  584. package/src/styles/less/table.less +1 -1
  585. package/src/styles/less/utilities.css +4 -4
  586. package/src/styles/less/wells.css +4 -4
  587. package/src/styles/props/custom-media.css +1 -11
  588. package/src/styles/variables/legacy-variables.less +4 -47
  589. package/src/table/Table.css +1 -1
  590. package/src/tabs/Tabs.css +2 -2
  591. package/src/tooltip/Tooltip.tsx +26 -45
  592. package/src/typeahead/Typeahead.css +1 -1
  593. package/build/common/propsValues/breakpoint.js +0 -12
  594. package/build/common/propsValues/breakpoint.js.map +0 -1
  595. package/build/common/propsValues/breakpoint.mjs +0 -12
  596. package/build/common/propsValues/breakpoint.mjs.map +0 -1
  597. package/build/prompt/CriticalBanner/CriticalBanner.js +0 -143
  598. package/build/prompt/CriticalBanner/CriticalBanner.js.map +0 -1
  599. package/build/prompt/CriticalBanner/CriticalBanner.mjs +0 -141
  600. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +0 -1
  601. package/build/prompt/CriticalBanner/helpers.js +0 -29
  602. package/build/prompt/CriticalBanner/helpers.js.map +0 -1
  603. package/build/prompt/CriticalBanner/helpers.mjs +0 -26
  604. package/build/prompt/CriticalBanner/helpers.mjs.map +0 -1
  605. package/build/prompt/common/Expander/Expander.js +0 -47
  606. package/build/prompt/common/Expander/Expander.js.map +0 -1
  607. package/build/prompt/common/Expander/Expander.messages.js +0 -17
  608. package/build/prompt/common/Expander/Expander.messages.js.map +0 -1
  609. package/build/prompt/common/Expander/Expander.messages.mjs +0 -13
  610. package/build/prompt/common/Expander/Expander.messages.mjs.map +0 -1
  611. package/build/prompt/common/Expander/Expander.mjs +0 -44
  612. package/build/prompt/common/Expander/Expander.mjs.map +0 -1
  613. package/build/prompt/helpers/promptMedia.js +0 -52
  614. package/build/prompt/helpers/promptMedia.js.map +0 -1
  615. package/build/prompt/helpers/promptMedia.mjs +0 -50
  616. package/build/prompt/helpers/promptMedia.mjs.map +0 -1
  617. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +0 -59
  618. package/build/styles/prompt/common/Expander/Expander.css +0 -8
  619. package/build/types/common/propsValues/breakpoint.d.ts +0 -9
  620. package/build/types/common/propsValues/breakpoint.d.ts.map +0 -1
  621. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +0 -33
  622. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +0 -1
  623. package/build/types/prompt/CriticalBanner/helpers.d.ts +0 -18
  624. package/build/types/prompt/CriticalBanner/helpers.d.ts.map +0 -1
  625. package/build/types/prompt/CriticalBanner/index.d.ts +0 -3
  626. package/build/types/prompt/CriticalBanner/index.d.ts.map +0 -1
  627. package/build/types/prompt/common/Expander/Expander.d.ts +0 -20
  628. package/build/types/prompt/common/Expander/Expander.d.ts.map +0 -1
  629. package/build/types/prompt/common/Expander/Expander.messages.d.ts +0 -14
  630. package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +0 -1
  631. package/build/types/prompt/helpers/promptMedia.d.ts +0 -22
  632. package/build/types/prompt/helpers/promptMedia.d.ts.map +0 -1
  633. package/src/common/propsValues/breakpoint.ts +0 -8
  634. package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +0 -113
  635. package/src/prompt/CriticalBanner/CriticalBanner.css +0 -59
  636. package/src/prompt/CriticalBanner/CriticalBanner.less +0 -64
  637. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +0 -632
  638. package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +0 -285
  639. package/src/prompt/CriticalBanner/CriticalBanner.tsx +0 -182
  640. package/src/prompt/CriticalBanner/helpers.ts +0 -39
  641. package/src/prompt/CriticalBanner/index.ts +0 -2
  642. package/src/prompt/common/Expander/Expander.css +0 -8
  643. package/src/prompt/common/Expander/Expander.less +0 -9
  644. package/src/prompt/common/Expander/Expander.messages.ts +0 -14
  645. package/src/prompt/common/Expander/Expander.test.tsx +0 -167
  646. package/src/prompt/common/Expander/Expander.tsx +0 -83
  647. package/src/prompt/helpers/promptMedia.tsx +0 -79
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/common/locale/index.ts"],"sourcesContent":["import { IntlShape } from 'react-intl/src/types';\nimport { Direction } from '../direction';\n\nexport const DEFAULT_LANG = 'en';\nexport const DEFAULT_LOCALE = 'en-GB';\n\n/**\n * Languages written right-to-left.\n */\nexport const RTL_LANGUAGES = ['ar', 'he'];\n\n/**\n * @deprecated The source of truth for supported languages lives in Crab.\n */\nexport const SUPPORTED_LANGUAGES = [\n DEFAULT_LANG,\n 'cs',\n 'de',\n 'es',\n 'fr',\n 'hu',\n 'id',\n 'it',\n 'ja',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'ru',\n 'th',\n 'tr',\n 'uk',\n 'zh',\n];\n\n/**\n * Verifies and adjusts locale, replacing `_` with `-`.\n *\n * @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns `null` if locale is unrecognized by `Intl.Locale`.\n */\nexport function adjustLocale(locale: string) {\n const localeTrimmed = locale?.trim();\n if (localeTrimmed) {\n try {\n return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding lang (iso2) for provided locale.\n *\n * @deprecated The use of this function almost always breaks language variants\n * e.g. Simplified and Traditional Chinese.\n * There should be no use case for this function.\n * To select the correct translations from a translations object, pass the\n * locale directly into Crab's getLocalisedMessages.\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.\n */\nexport function getLangFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n if (adjustedLocale != null) {\n const { language } = new Intl.Locale(adjustedLocale);\n if (SUPPORTED_LANGUAGES.includes(language)) {\n return language;\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding country code (iso2) for locales code with explicit region value.\n *\n * @param locale `es-ES`, `en-GB`, `ja-JP`, etc.\n * @returns `null` if the locale is invalid or the region can‘t be identified.\n */\nexport function getCountryFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null ? (new Intl.Locale(adjustedLocale).region ?? null) : null;\n}\n\n/**\n * Provides the layout direction for a given locale.\n *\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.\n */\nexport function getDirectionFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)\n ? Direction.RTL\n : Direction.LTR;\n}\n\n/**\n * Provides the localized currency name for a given currency code.\n * @param intl The `intl` object from `react-intl` used for localization.\n * @param currencyCode The ISO 4217 currency code (e.g., `USD`, `EUR`, `JPY`).\n * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.\n */\nexport function getLocaleCurrencyName(intl: IntlShape, currencyCode: string) {\n return typeof Intl.DisplayNames === 'function'\n ? intl.formatDisplayName(currencyCode, { type: 'currency', fallback: 'code' })\n : currencyCode;\n}\n"],"names":["DEFAULT_LANG","DEFAULT_LOCALE","RTL_LANGUAGES","SUPPORTED_LANGUAGES","adjustLocale","locale","localeTrimmed","trim","Intl","Locale","replace","baseName","error","console","getLangFromLocale","adjustedLocale","language","includes","getCountryFromLocale","region","getDirectionFromLocale","Direction","RTL","LTR","getLocaleCurrencyName","intl","currencyCode","DisplayNames","formatDisplayName","type","fallback"],"mappings":";;;;AAGO,MAAMA,YAAY,GAAG;AACrB,MAAMC,cAAc,GAAG;AAE9B;;AAEG;MACUC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI;AAExC;;AAEG;MACUC,mBAAmB,GAAG,CACjCH,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI;AAGN;;;;;AAKG;AACG,SAAUI,YAAYA,CAACC,MAAc,EAAA;AACzC,EAAA,MAAMC,aAAa,GAAGD,MAAM,EAAEE,IAAI,EAAE;AACpC,EAAA,IAAID,aAAa,EAAE;IACjB,IAAI;AACF,MAAA,OAAO,IAAIE,IAAI,CAACC,MAAM,CAACH,aAAa,CAACI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAACC,QAAQ;IAClE,CAAC,CAAC,OAAOC,KAAK,EAAE;AACd;AACAC,MAAA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U;AAAEC,IAAAA,QAAQ,EAAE;GAAQ,CAAC,GAC5EJ,YAAY;AAClB;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/common/locale/index.ts"],"sourcesContent":["import { IntlShape } from 'react-intl/src/types';\nimport { formatCurrencyCode } from '@transferwise/formatting';\nimport { Direction } from '../direction';\n\nexport const DEFAULT_LANG = 'en';\nexport const DEFAULT_LOCALE = 'en-GB';\n\n/**\n * Languages written right-to-left.\n */\nexport const RTL_LANGUAGES = ['ar', 'he'];\n\n/**\n * @deprecated The source of truth for supported languages lives in Crab.\n */\nexport const SUPPORTED_LANGUAGES = [\n DEFAULT_LANG,\n 'cs',\n 'de',\n 'es',\n 'fr',\n 'hu',\n 'id',\n 'it',\n 'ja',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'ru',\n 'th',\n 'tr',\n 'uk',\n 'zh',\n];\n\n/**\n * Verifies and adjusts locale, replacing `_` with `-`.\n *\n * @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns `null` if locale is unrecognized by `Intl.Locale`.\n */\nexport function adjustLocale(locale: string) {\n const localeTrimmed = locale?.trim();\n if (localeTrimmed) {\n try {\n return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding lang (iso2) for provided locale.\n *\n * @deprecated The use of this function almost always breaks language variants\n * e.g. Simplified and Traditional Chinese.\n * There should be no use case for this function.\n * To select the correct translations from a translations object, pass the\n * locale directly into Crab's getLocalisedMessages.\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.\n */\nexport function getLangFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n if (adjustedLocale != null) {\n const { language } = new Intl.Locale(adjustedLocale);\n if (SUPPORTED_LANGUAGES.includes(language)) {\n return language;\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding country code (iso2) for locales code with explicit region value.\n *\n * @param locale `es-ES`, `en-GB`, `ja-JP`, etc.\n * @returns `null` if the locale is invalid or the region can‘t be identified.\n */\nexport function getCountryFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null ? (new Intl.Locale(adjustedLocale).region ?? null) : null;\n}\n\n/**\n * Provides the layout direction for a given locale.\n *\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.\n */\nexport function getDirectionFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)\n ? Direction.RTL\n : Direction.LTR;\n}\n\n/**\n * Provides the localized currency name for a given currency code.\n * @param intl The `intl` object from `react-intl` used for localization.\n * @param currencyCode The ISO 4217 currency code (e.g., `USD`, `EUR`, `JPY`).\n * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.\n */\nexport function getLocaleCurrencyName(intl: IntlShape, currencyCode: string) {\n if (typeof Intl.DisplayNames === 'function') {\n const localisedName = intl.formatDisplayName(currencyCode, {\n type: 'currency',\n fallback: 'none',\n });\n return localisedName != null ? localisedName : formatCurrencyCode(currencyCode);\n }\n return formatCurrencyCode(currencyCode);\n}\n"],"names":["DEFAULT_LANG","DEFAULT_LOCALE","RTL_LANGUAGES","SUPPORTED_LANGUAGES","adjustLocale","locale","localeTrimmed","trim","Intl","Locale","replace","baseName","error","console","getLangFromLocale","adjustedLocale","language","includes","getCountryFromLocale","region","getDirectionFromLocale","Direction","RTL","LTR","getLocaleCurrencyName","intl","currencyCode","DisplayNames","localisedName","formatDisplayName","type","fallback","formatCurrencyCode"],"mappings":";;;;;AAIO,MAAMA,YAAY,GAAG;AACrB,MAAMC,cAAc,GAAG;AAE9B;;AAEG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U,cAAc,IAAI,IAAI,GAAI,IAAIP,IAAI,CAACC,MAAM,CAACM,cAAc,CAAC,CAACI,MAAM,IAAI,IAAI,GAAI,IAAI;AACzF;AAEA;;;;;AAKG;AACG,SAAUC,sBAAsBA,CAACf,MAAc,EAAA;AACnD,EAAA,MAAMU,cAAc,GAAGX,YAAY,CAACC,MAAM,CAAC;EAC3C,OAAOU,cAAc,IAAI,IAAI,IAAIb,aAAa,CAACe,QAAQ,CAAC,IAAIT,IAAI,CAACC,MAAM,CAACM,cAAc,CAAC,CAACC,QAAQ,CAAC,GAC7FK,mBAAS,CAACC,GAAG,GACbD,mBAAS,CAACE,GAAG;AACnB;AAEA;;;;;AAKG;AACG,SAAUC,qBAAqBA,CAACC,IAAe,EAAEC,YAAoB,EAAA;AACzE,EAAA,IAAI,OAAOlB,IAAI,CAACmB,YAAY,KAAK,UAAU,EAAE;AAC3C,IAAA,MAAMC,aAAa,GAAGH,IAAI,CAACI,iBAAiB,CAACH,YAAY,EAAE;AACzDI,MAAAA,IAAI,EAAE,UAAU;AAChBC,MAAAA,QAAQ,EAAE;AACX,KAAA,CAAC;IACF,OAAOH,aAAa,IAAI,IAAI,GAAGA,aAAa,GAAGI,6BAAkB,CAACN,YAAY,CAAC;AACjF,EAAA;EACA,OAAOM,6BAAkB,CAACN,YAAY,CAAC;AACzC;;;;;;;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import { formatCurrencyCode } from '@transferwise/formatting';
1
2
  import { Direction } from '../direction.mjs';
2
3
 
3
4
  const DEFAULT_LANG = 'en';
@@ -78,10 +79,14 @@ function getDirectionFromLocale(locale) {
78
79
  * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.
79
80
  */
80
81
  function getLocaleCurrencyName(intl, currencyCode) {
81
- return typeof Intl.DisplayNames === 'function' ? intl.formatDisplayName(currencyCode, {
82
- type: 'currency',
83
- fallback: 'code'
84
- }) : currencyCode;
82
+ if (typeof Intl.DisplayNames === 'function') {
83
+ const localisedName = intl.formatDisplayName(currencyCode, {
84
+ type: 'currency',
85
+ fallback: 'none'
86
+ });
87
+ return localisedName != null ? localisedName : formatCurrencyCode(currencyCode);
88
+ }
89
+ return formatCurrencyCode(currencyCode);
85
90
  }
86
91
 
87
92
  export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, getLocaleCurrencyName };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/common/locale/index.ts"],"sourcesContent":["import { IntlShape } from 'react-intl/src/types';\nimport { Direction } from '../direction';\n\nexport const DEFAULT_LANG = 'en';\nexport const DEFAULT_LOCALE = 'en-GB';\n\n/**\n * Languages written right-to-left.\n */\nexport const RTL_LANGUAGES = ['ar', 'he'];\n\n/**\n * @deprecated The source of truth for supported languages lives in Crab.\n */\nexport const SUPPORTED_LANGUAGES = [\n DEFAULT_LANG,\n 'cs',\n 'de',\n 'es',\n 'fr',\n 'hu',\n 'id',\n 'it',\n 'ja',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'ru',\n 'th',\n 'tr',\n 'uk',\n 'zh',\n];\n\n/**\n * Verifies and adjusts locale, replacing `_` with `-`.\n *\n * @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns `null` if locale is unrecognized by `Intl.Locale`.\n */\nexport function adjustLocale(locale: string) {\n const localeTrimmed = locale?.trim();\n if (localeTrimmed) {\n try {\n return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding lang (iso2) for provided locale.\n *\n * @deprecated The use of this function almost always breaks language variants\n * e.g. Simplified and Traditional Chinese.\n * There should be no use case for this function.\n * To select the correct translations from a translations object, pass the\n * locale directly into Crab's getLocalisedMessages.\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.\n */\nexport function getLangFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n if (adjustedLocale != null) {\n const { language } = new Intl.Locale(adjustedLocale);\n if (SUPPORTED_LANGUAGES.includes(language)) {\n return language;\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding country code (iso2) for locales code with explicit region value.\n *\n * @param locale `es-ES`, `en-GB`, `ja-JP`, etc.\n * @returns `null` if the locale is invalid or the region can‘t be identified.\n */\nexport function getCountryFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null ? (new Intl.Locale(adjustedLocale).region ?? null) : null;\n}\n\n/**\n * Provides the layout direction for a given locale.\n *\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.\n */\nexport function getDirectionFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)\n ? Direction.RTL\n : Direction.LTR;\n}\n\n/**\n * Provides the localized currency name for a given currency code.\n * @param intl The `intl` object from `react-intl` used for localization.\n * @param currencyCode The ISO 4217 currency code (e.g., `USD`, `EUR`, `JPY`).\n * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.\n */\nexport function getLocaleCurrencyName(intl: IntlShape, currencyCode: string) {\n return typeof Intl.DisplayNames === 'function'\n ? intl.formatDisplayName(currencyCode, { type: 'currency', fallback: 'code' })\n : currencyCode;\n}\n"],"names":["DEFAULT_LANG","DEFAULT_LOCALE","RTL_LANGUAGES","SUPPORTED_LANGUAGES","adjustLocale","locale","localeTrimmed","trim","Intl","Locale","replace","baseName","error","console","getLangFromLocale","adjustedLocale","language","includes","getCountryFromLocale","region","getDirectionFromLocale","Direction","RTL","LTR","getLocaleCurrencyName","intl","currencyCode","D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oBA,CAACb,MAAc,EAAA;AACjD,EAAA,MAAMU,cAAc,GAAGX,YAAY,CAACC,MAAM,CAAC;AAC3C,EAAA,OAAOU,cAAc,IAAI,IAAI,GAAI,IAAIP,IAAI,CAACC,MAAM,CAACM,cAAc,CAAC,CAACI,MAAM,IAAI,IAAI,GAAI,IAAI;AACzF;AAEA;;;;;AAKG;AACG,SAAUC,sBAAsBA,CAACf,MAAc,EAAA;AACnD,EAAA,MAAMU,cAAc,GAAGX,YAAY,CAACC,MAAM,CAAC;EAC3C,OAAOU,cAAc,IAAI,IAAI,IAAIb,aAAa,CAACe,QAAQ,CAAC,IAAIT,IAAI,CAACC,MAAM,CAACM,cAAc,CAAC,CAACC,QAAQ,CAAC,GAC7FK,SAAS,CAACC,GAAG,GACbD,SAAS,CAACE,GAAG;AACnB;AAEA;;;;;AAKG;AACG,SAAUC,qBAAqBA,CAACC,IAAe,EAAEC,YAAoB,EAAA;AACzE,EAAA,OAAO,OAAOlB,IAAI,CAACmB,YAAY,KAAK,UAAU,GAC1CF,IAAI,CAACG,iBAAiB,CAACF,YAAY,EAAE;AAAEG,IAAAA,IAAI,EAAE,UAAU;AAAEC,IAAAA,QAAQ,EAAE;GAAQ,CAAC,GAC5EJ,YAAY;AAClB;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/common/locale/index.ts"],"sourcesContent":["import { IntlShape } from 'react-intl/src/types';\nimport { formatCurrencyCode } from '@transferwise/formatting';\nimport { Direction } from '../direction';\n\nexport const DEFAULT_LANG = 'en';\nexport const DEFAULT_LOCALE = 'en-GB';\n\n/**\n * Languages written right-to-left.\n */\nexport const RTL_LANGUAGES = ['ar', 'he'];\n\n/**\n * @deprecated The source of truth for supported languages lives in Crab.\n */\nexport const SUPPORTED_LANGUAGES = [\n DEFAULT_LANG,\n 'cs',\n 'de',\n 'es',\n 'fr',\n 'hu',\n 'id',\n 'it',\n 'ja',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'ru',\n 'th',\n 'tr',\n 'uk',\n 'zh',\n];\n\n/**\n * Verifies and adjusts locale, replacing `_` with `-`.\n *\n * @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns `null` if locale is unrecognized by `Intl.Locale`.\n */\nexport function adjustLocale(locale: string) {\n const localeTrimmed = locale?.trim();\n if (localeTrimmed) {\n try {\n return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding lang (iso2) for provided locale.\n *\n * @deprecated The use of this function almost always breaks language variants\n * e.g. Simplified and Traditional Chinese.\n * There should be no use case for this function.\n * To select the correct translations from a translations object, pass the\n * locale directly into Crab's getLocalisedMessages.\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.\n */\nexport function getLangFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n if (adjustedLocale != null) {\n const { language } = new Intl.Locale(adjustedLocale);\n if (SUPPORTED_LANGUAGES.includes(language)) {\n return language;\n }\n }\n return null;\n}\n\n/**\n * Provides corresponding country code (iso2) for locales code with explicit region value.\n *\n * @param locale `es-ES`, `en-GB`, `ja-JP`, etc.\n * @returns `null` if the locale is invalid or the region can‘t be identified.\n */\nexport function getCountryFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null ? (new Intl.Locale(adjustedLocale).region ?? null) : null;\n}\n\n/**\n * Provides the layout direction for a given locale.\n *\n * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.\n * @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.\n */\nexport function getDirectionFromLocale(locale: string) {\n const adjustedLocale = adjustLocale(locale);\n return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)\n ? Direction.RTL\n : Direction.LTR;\n}\n\n/**\n * Provides the localized currency name for a given currency code.\n * @param intl The `intl` object from `react-intl` used for localization.\n * @param currencyCode The ISO 4217 currency code (e.g., `USD`, `EUR`, `JPY`).\n * @returns The localized currency name if Intl.DisplayNames is supported supported, otherwise returns the original currency code.\n */\nexport function getLocaleCurrencyName(intl: IntlShape, currencyCode: string) {\n if (typeof Intl.DisplayNames === 'function') {\n const localisedName = intl.formatDisplayName(currencyCode, {\n type: 'currency',\n fallback: 'none',\n });\n return localisedName != null ? localisedName : formatCurrencyCode(currencyCode);\n }\n return formatCurrencyCode(currencyCode);\n}\n"],"names":["DEFAULT_LANG","DEFAULT_LOCALE","RTL_LANGUAGES","SUPPORTED_LANGUAGES","adjustLocale","locale","localeTrimmed","trim","Intl","Locale","replace","baseName","error","console","getLangFromLocale","adjustedLocale","language","includes","getCountryFromLocale","region","getDirectionFromLocale","Direction","RTL","LTR","getLocaleCurrencyName","intl","currencyCode","DisplayNames","localisedName","formatDisplayName","type","fallback","formatCurrencyCode"],"mappings":";;;AAIO,MAAMA,YAAY,GAAG;AACrB,MAAMC,cAAc,GAAG;AAE9B;;AAEG;MACUC,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI;AAExC;;AAEG;MACUC,mBAAmB,GAAG,CACjCH,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI;AAGN;;;;;AAKG;AACG,SAAUI,YAAYA,CAACC,MAAc,EAAA;AACzC,EAAA,MAAMC,aAAa,GAAGD,MAAM,EAAEE,IAAI,EAAE;AACpC,EAAA,IAAID,aAAa,EAAE;IACjB,IAAI;AACF,MAAA,OAAO,IAAIE,IAAI,CAACC,MAAM,CAACH,aAAa,CAACI,OAAO,CAAC,GAAG,EA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K,UAAU,EAAE;AAC3C,IAAA,MAAMC,aAAa,GAAGH,IAAI,CAACI,iBAAiB,CAACH,YAAY,EAAE;AACzDI,MAAAA,IAAI,EAAE,UAAU;AAChBC,MAAAA,QAAQ,EAAE;AACX,KAAA,CAAC;IACF,OAAOH,aAAa,IAAI,IAAI,GAAGA,aAAa,GAAGI,kBAAkB,CAACN,YAAY,CAAC;AACjF,EAAA;EACA,OAAOM,kBAAkB,CAACN,YAAY,CAAC;AACzC;;;;"}
@@ -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');
10
11
  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');
@@ -24,6 +24,7 @@ require('../propsValues/variant.js');
24
24
  require('../propsValues/scroll.js');
25
25
  require('../propsValues/markdownNodeType.js');
26
26
  require('../fileType.js');
27
+ require('@transferwise/formatting');
27
28
  require('@transferwise/icons');
28
29
  require('react-intl');
29
30
  require('../closeButton/CloseButton.messages.js');
@@ -31,7 +32,7 @@ var jsxRuntime = require('react/jsx-runtime');
31
32
  var Dimmer = require('../../dimmer/Dimmer.js');
32
33
  var OverlayIdProvider = require('../../provider/overlay/OverlayIdProvider.js');
33
34
 
34
- const POPOVER_OFFSET = [0, 16];
35
+ const POPOVER_OFFSET = 16;
35
36
  // By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
36
37
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
37
38
  // This mapping forces popover to try the four available positions before going back to the initial chosen one.
@@ -54,60 +55,57 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
54
55
  considerHeight = false,
55
56
  ...rest
56
57
  }, reference) {
57
- const [arrowElement, setArrowElement] = React.useState(null);
58
- const [popperElement, setPopperElement] = React.useState(null);
59
- const modifiers = [];
58
+ const arrowRef = React.useRef(null);
59
+ const middleware = [];
60
+ if (arrow) {
61
+ middleware.push(react.offset(POPOVER_OFFSET));
62
+ }
63
+ if (flip && fallbackPlacements[position$1]) {
64
+ middleware.push(react.flip({
65
+ fallbackPlacements: fallbackPlacements[position$1]
66
+ }));
67
+ }
60
68
  if (altAxis) {
61
- modifiers.push({
62
- // https://popper.js.org/docs/v2/modifiers/prevent-overflow
63
- name: 'preventOverflow',
64
- options: {
65
- altAxis: true,
66
- tether: false
67
- }
68
- });
69
+ middleware.push(react.shift());
69
70
  }
70
71
  if (arrow) {
71
- modifiers.push({
72
- name: 'arrow',
73
- options: {
74
- element: arrowElement,
75
- options: {
76
- padding: 8 // 8px from the edges of the popper
77
- }
78
- }
79
- });
80
- // This lets you displace a popper element from its reference element.
81
- modifiers.push({
82
- name: 'offset',
83
- options: {
84
- offset: POPOVER_OFFSET
85
- }
86
- });
72
+ middleware.push(react.arrow({
73
+ element: arrowRef,
74
+ padding: 8
75
+ }));
87
76
  }
88
- if (flip && fallbackPlacements[position$1]) {
89
- modifiers.push({
90
- name: 'flip',
91
- options: {
92
- fallbackPlacements: fallbackPlacements[position$1]
77
+ if (considerHeight) {
78
+ middleware.push(react.size({
79
+ padding: POPOVER_OFFSET,
80
+ apply: ({
81
+ elements,
82
+ availableHeight
83
+ }) => {
84
+ elements.floating.style.setProperty('--np-panel-available-height', `${availableHeight}px`);
93
85
  }
94
- });
86
+ }));
95
87
  }
96
88
  const {
97
- styles,
98
- attributes,
99
- forceUpdate
100
- } = reactPopper.usePopper(anchorRef.current, popperElement, {
89
+ refs,
90
+ floatingStyles,
91
+ placement,
92
+ middlewareData
93
+ } = react.useFloating({
101
94
  placement: position$1,
102
- modifiers
95
+ middleware,
96
+ elements: {
97
+ reference: anchorRef.current
98
+ },
99
+ whileElementsMounted: open ? react.autoUpdate : undefined
103
100
  });
104
- // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
105
- // it is most simple just to always position before opening
106
- React.useEffect(() => {
107
- if (open && forceUpdate) {
108
- forceUpdate();
109
- }
110
- }, [open]);
101
+ const arrowStyle = {
102
+ ...(middlewareData.arrow?.x != null ? {
103
+ left: middlewareData.arrow.x
104
+ } : {}),
105
+ ...(middlewareData.arrow?.y != null ? {
106
+ top: middlewareData.arrow.y
107
+ } : {})
108
+ };
111
109
  const contentStyle = {
112
110
  ...(anchorWidth ? {
113
111
  width: anchorRef.current?.clientWidth
@@ -123,12 +121,10 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
123
121
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
124
122
  id: overlayId,
125
123
  ...rest,
126
- ref: setPopperElement,
124
+ ref: refs.setFloating,
127
125
  role: "dialog",
128
- style: {
129
- ...styles.popper
130
- },
131
- ...attributes.popper,
126
+ style: floatingStyles,
127
+ "data-popper-placement": placement,
132
128
  className: clsx.clsx('np-panel', {
133
129
  'np-panel--open': open
134
130
  }, rest.className),
@@ -137,9 +133,9 @@ const Panel = /*#__PURE__*/React.forwardRef(function Panel({
137
133
  style: contentStyle,
138
134
  className: clsx.clsx('np-panel__content'),
139
135
  children: [children, arrow && /*#__PURE__*/jsxRuntime.jsx("div", {
140
- ref: setArrowElement,
136
+ ref: arrowRef,
141
137
  className: clsx.clsx('np-panel__arrow'),
142
- style: styles.arrow
138
+ style: arrowStyle
143
139
  })]
144
140
  })
145
141
  })
@@ -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,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AAA,MAAMC,SAAS,GAAGC,gBAAU,CAACC,kCAAgB,CAAC;EAE9C,oBACEC,cAAA,CAACC,cAAM,EAAA;AAACpC,IAAAA,IAAI,EAAEA,IAAK;IAACqC,WAAW,EAAA,IAAA;IAACC,kBAAkB,EAAA,IAAA;IAACC,iBAAiB,EAAA,IAAA;AAACtC,IAAAA,OAAO,EAAEA,OAAQ;AAAAF,IAAAA,QAAA,eACpFoC,cAAA,CAAA,KAAA,EAAA;AACEK,MAAAA,EAAE,EAAER,SAAU;AAAA,MAAA,GACV1B,IAAI;AACRmC,MAAAA,GAAG,EAAE7B,gBAAiB;AACtB8B,MAAAA,IAAI,EAAC,QAAQ;AACbC,MAAAA,KAAK,EAAE;AAAE,QAAA,GAAGtB,MAAM,CAACuB;OAAS;MAAA,GACxBtB,UAAU,CAACsB,MAAM;AACrBC,MAAAA,SAAS,EAAEC,SAAI,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAE9C;AAAI,OAAE,EAAEM,IAAI,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 size as sizeMiddleware,\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 }\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 if (arrow) {\n middleware.push(arrowMiddleware({ element: arrowRef, padding: 8 }));\n }\n\n if (considerHeight) {\n middleware.push(\n sizeMiddleware({\n padding: POPOVER_OFFSET,\n apply: ({ elements, availableHeight }) => {\n elements.floating.style.setProperty(\n '--np-panel-available-height',\n `${availableHeight}px`,\n );\n },\n }),\n );\n }\n\n const { refs, floatingStyles, placement, middlewareData } = useFloating({\n placement: position,\n middleware,\n elements: {\n reference: anchorRef.current,\n },\n whileElementsMounted: open ? autoUpdate : undefined,\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","flipMiddleware","shift","arrowMiddleware","element","padding","sizeMiddleware","apply","elements","availableHeight","floating","style","setProperty","refs","floatingStyles","placement","middlewareData","useFloating","current","whileElementsMounted","autoUpdate","undefined","arrowStyle","x","left","y","top","contentStyle","width","clientWidth","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","setFloating","role","className","clsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,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;AACEE,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ;AACRC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;YACPC,UAAQ,GAAGb,iBAAQ,CAACE,MAAM;EAC1BY,SAAS;AACTC,EAAAA,WAAW,GAAG,KAAK;AACnBC,EAAAA,cAAc,GAAG,KAAK;EACtB,GAAGC;AAAI,CACI,EACbC,SAAS,EAAA;AAET,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAwB,IAAI,CAAC;EAEpD,MAAMC,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AAA,KAAK,EAAEgB,YAAa;AAACe,QAAAA,SAAS,EAAEC,SAAI,CAAC,mBAAmB,CAAE;AAAAxD,QAAAA,QAAA,EAAA,CAC5EA,QAAQ,EAERH,KAAK,iBAAIiD,cAAA,CAAA,KAAA,EAAA;AAAKM,UAAAA,GAAG,EAAE3C,QAAS;AAAC8C,UAAAA,SAAS,EAAEC,SAAI,CAAC,iBAAiB,CAAE;AAAChC,UAAAA,KAAK,EAAEW;AAAW,SAAA,CAAG;OACpF;KACF;AACP,GAAQ,CAAC;AAEb,CAAC;;;;"}
@@ -1,10 +1,10 @@
1
+ import { offset, flip, shift, arrow, size, 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';
6
7
  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';
@@ -20,6 +20,7 @@ import '../propsValues/variant.mjs';
20
20
  import '../propsValues/scroll.mjs';
21
21
  import '../propsValues/markdownNodeType.mjs';
22
22
  import '../fileType.mjs';
23
+ import '@transferwise/formatting';
23
24
  import '@transferwise/icons';
24
25
  import 'react-intl';
25
26
  import '../closeButton/CloseButton.messages.mjs';
@@ -27,7 +28,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
27
28
  import Dimmer from '../../dimmer/Dimmer.mjs';
28
29
  import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider.mjs';
29
30
 
30
- const POPOVER_OFFSET = [0, 16];
31
+ const POPOVER_OFFSET = 16;
31
32
  // By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
32
33
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
33
34
  // This mapping forces popover to try the four available positions before going back to the initial chosen one.
@@ -38,8 +39,8 @@ const fallbackPlacements = {
38
39
  [Position.RIGHT]: [Position.LEFT, Position.TOP, Position.BOTTOM]
39
40
  };
40
41
  const Panel = /*#__PURE__*/forwardRef(function Panel({
41
- arrow = false,
42
- flip = true,
42
+ arrow: arrow$1 = false,
43
+ flip: flip$1 = true,
43
44
  altAxis = false,
44
45
  children,
45
46
  open = false,
@@ -50,60 +51,57 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
50
51
  considerHeight = false,
51
52
  ...rest
52
53
  }, reference) {
53
- const [arrowElement, setArrowElement] = useState(null);
54
- const [popperElement, setPopperElement] = useState(null);
55
- const modifiers = [];
54
+ const arrowRef = useRef(null);
55
+ const middleware = [];
56
+ if (arrow$1) {
57
+ middleware.push(offset(POPOVER_OFFSET));
58
+ }
59
+ if (flip$1 && fallbackPlacements[position]) {
60
+ middleware.push(flip({
61
+ fallbackPlacements: fallbackPlacements[position]
62
+ }));
63
+ }
56
64
  if (altAxis) {
57
- modifiers.push({
58
- // https://popper.js.org/docs/v2/modifiers/prevent-overflow
59
- name: 'preventOverflow',
60
- options: {
61
- altAxis: true,
62
- tether: false
63
- }
64
- });
65
+ middleware.push(shift());
65
66
  }
66
- if (arrow) {
67
- modifiers.push({
68
- name: 'arrow',
69
- options: {
70
- element: arrowElement,
71
- options: {
72
- padding: 8 // 8px from the edges of the popper
73
- }
74
- }
75
- });
76
- // This lets you displace a popper element from its reference element.
77
- modifiers.push({
78
- name: 'offset',
79
- options: {
80
- offset: POPOVER_OFFSET
81
- }
82
- });
67
+ if (arrow$1) {
68
+ middleware.push(arrow({
69
+ element: arrowRef,
70
+ padding: 8
71
+ }));
83
72
  }
84
- if (flip && fallbackPlacements[position]) {
85
- modifiers.push({
86
- name: 'flip',
87
- options: {
88
- fallbackPlacements: fallbackPlacements[position]
73
+ if (considerHeight) {
74
+ middleware.push(size({
75
+ padding: POPOVER_OFFSET,
76
+ apply: ({
77
+ elements,
78
+ availableHeight
79
+ }) => {
80
+ elements.floating.style.setProperty('--np-panel-available-height', `${availableHeight}px`);
89
81
  }
90
- });
82
+ }));
91
83
  }
92
84
  const {
93
- styles,
94
- attributes,
95
- forceUpdate
96
- } = usePopper(anchorRef.current, popperElement, {
85
+ refs,
86
+ floatingStyles,
87
+ placement,
88
+ middlewareData
89
+ } = useFloating({
97
90
  placement: position,
98
- modifiers
91
+ middleware,
92
+ elements: {
93
+ reference: anchorRef.current
94
+ },
95
+ whileElementsMounted: open ? autoUpdate : undefined
99
96
  });
100
- // If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
101
- // it is most simple just to always position before opening
102
- useEffect(() => {
103
- if (open && forceUpdate) {
104
- forceUpdate();
105
- }
106
- }, [open]);
97
+ const arrowStyle = {
98
+ ...(middlewareData.arrow?.x != null ? {
99
+ left: middlewareData.arrow.x
100
+ } : {}),
101
+ ...(middlewareData.arrow?.y != null ? {
102
+ top: middlewareData.arrow.y
103
+ } : {})
104
+ };
107
105
  const contentStyle = {
108
106
  ...(anchorWidth ? {
109
107
  width: anchorRef.current?.clientWidth
@@ -119,12 +117,10 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
119
117
  children: /*#__PURE__*/jsx("div", {
120
118
  id: overlayId,
121
119
  ...rest,
122
- ref: setPopperElement,
120
+ ref: refs.setFloating,
123
121
  role: "dialog",
124
- style: {
125
- ...styles.popper
126
- },
127
- ...attributes.popper,
122
+ style: floatingStyles,
123
+ "data-popper-placement": placement,
128
124
  className: clsx('np-panel', {
129
125
  'np-panel--open': open
130
126
  }, rest.className),
@@ -132,10 +128,10 @@ const Panel = /*#__PURE__*/forwardRef(function Panel({
132
128
  ref: reference,
133
129
  style: contentStyle,
134
130
  className: clsx('np-panel__content'),
135
- children: [children, arrow && /*#__PURE__*/jsx("div", {
136
- ref: setArrowElement,
131
+ children: [children, arrow$1 && /*#__PURE__*/jsx("div", {
132
+ ref: arrowRef,
137
133
  className: clsx('np-panel__arrow'),
138
- style: styles.arrow
134
+ style: arrowStyle
139
135
  })]
140
136
  })
141
137
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.mjs","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,QAAQ,CAACC,GAAG,GAAG,CAACD,QAAQ,CAACE,MAAM,EAAEF,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACE,MAAM,GAAG,CAACF,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACI,IAAI,GAAG,CAACJ,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,QAAQ,CAACG,KAAK,GAAG,CAACH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM;CAChE;AAeD,MAAMG,KAAK,gBAAGC,UAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ;AACRC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ,GAAGb,QAAQ,CAACE,MAAM;EAC1BY,SAAS;AACTC,EAAAA,WAAW,GAAG,KAAK;AACnBC,EAAAA,cAAc,GAAG,KAAK;EACtB,GAAGC;AAAI,CACI,EACbC,SAAS,EAA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AA,GAAG,EAAEhC,eAAgB;AAACoC,UAAAA,SAAS,EAAEC,IAAI,CAAC,iBAAiB,CAAE;UAACH,KAAK,EAAEtB,MAAM,CAACzB;AAAM,SAAA,CACpF;OACE;KACF;AACP,GAAQ,CAAC;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"Panel.mjs","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 size as sizeMiddleware,\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 }\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 if (arrow) {\n middleware.push(arrowMiddleware({ element: arrowRef, padding: 8 }));\n }\n\n if (considerHeight) {\n middleware.push(\n sizeMiddleware({\n padding: POPOVER_OFFSET,\n apply: ({ elements, availableHeight }) => {\n elements.floating.style.setProperty(\n '--np-panel-available-height',\n `${availableHeight}px`,\n );\n },\n }),\n );\n }\n\n const { refs, floatingStyles, placement, middlewareData } = useFloating({\n placement: position,\n middleware,\n elements: {\n reference: anchorRef.current,\n },\n whileElementsMounted: open ? autoUpdate : undefined,\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","flipMiddleware","shift","arrowMiddleware","element","padding","sizeMiddleware","apply","elements","availableHeight","floating","style","setProperty","refs","floatingStyles","placement","middlewareData","useFloating","current","whileElementsMounted","autoUpdate","undefined","arrowStyle","x","left","y","top","contentStyle","width","clientWidth","overlayId","useContext","OverlayIdContext","_jsx","Dimmer","transparent","fadeContentOnEnter","fadeContentOnExit","id","ref","setFloating","role","className","clsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,cAAc,GAAG,EAAE;AAEzB;AACA;AACA;AACA,MAAMC,kBAAkB,GAAgC;AACtD,EAAA,CAACC,QAAQ,CAACC,GAAG,GAAG,CAACD,QAAQ,CAACE,MAAM,EAAEF,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACE,MAAM,GAAG,CAACF,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACI,IAAI,CAAC;AAChE,EAAA,CAACJ,QAAQ,CAACI,IAAI,GAAG,CAACJ,QAAQ,CAACG,KAAK,EAAEH,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM,CAAC;AAChE,EAAA,CAACF,QAAQ,CAACG,KAAK,GAAG,CAACH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACC,GAAG,EAAED,QAAQ,CAACE,MAAM;CAChE;AAeD,MAAMG,KAAK,gBAAGC,UAAU,CAA6B,SAASD,KAAKA,CACjE;AACEE,SAAAA,OAAK,GAAG,KAAK;AACbC,QAAAA,MAAI,GAAG,IAAI;AACXC,EAAAA,OAAO,GAAG,KAAK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,MAAAA,KAAK,EAAEG,cAAe;AACtB,MAAA,uBAAA,EAAuBC,SAAU;AACjC2B,MAAAA,SAAS,EAAEC,IAAI,CAAC,UAAU,EAAE;AAAE,QAAA,gBAAgB,EAAEvD;AAAI,OAAE,EAAEM,IAAI,CAACgD,SAAS,CAAE;AAAAvD,MAAAA,QAAA,eAExEyD,IAAA,CAAA,KAAA,EAAA;AAAKL,QAAAA,GAAG,EAAE5C,SAAU;AAACgB,QAAAA,KAAK,EAAEgB,YAAa;AAACe,QAAAA,SAAS,EAAEC,IAAI,CAAC,mBAAmB,CAAE;AAAAxD,QAAAA,QAAA,EAAA,CAC5EA,QAAQ,EAERH,OAAK,iBAAIiD,GAAA,CAAA,KAAA,EAAA;AAAKM,UAAAA,GAAG,EAAE3C,QAAS;AAAC8C,UAAAA,SAAS,EAAEC,IAAI,CAAC,iBAAiB,CAAE;AAAChC,UAAAA,KAAK,EAAEW;AAAW,SAAA,CAAG;OACpF;KACF;AACP,GAAQ,CAAC;AAEb,CAAC;;;;"}
@@ -6,8 +6,8 @@ var React = require('react');
6
6
  var documentIosClick = require('../domHelpers/documentIosClick.js');
7
7
  require('../theme.js');
8
8
  require('../direction.js');
9
+ require('@transferwise/neptune-tokens');
9
10
  require('../propsValues/control.js');
10
- require('../propsValues/breakpoint.js');
11
11
  require('../propsValues/size.js');
12
12
  require('../propsValues/typography.js');
13
13
  require('../propsValues/width.js');
@@ -23,6 +23,7 @@ require('../propsValues/variant.js');
23
23
  require('../propsValues/scroll.js');
24
24
  require('../propsValues/markdownNodeType.js');
25
25
  require('../fileType.js');
26
+ require('@transferwise/formatting');
26
27
  require('@transferwise/icons');
27
28
  require('clsx');
28
29
  require('react-intl');
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsivePanel.js","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel, { type PanelProps } from '../panel';\nimport { isServerSide } from '../domHelpers';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n 'aria-label': ariaLabel,\n considerHeight = false,\n 'aria-labelledby': ariaLabelledBy,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n const SHORT_SCREEN = 500;\n const isShortViewport = considerHeight && !isServerSide() && window.innerHeight < SHORT_SCREEN;\n\n if (isMobile || isShortViewport) {\n return (\n <BottomSheet\n key=\"bottomSheet\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n open={open}\n className={className}\n onClose={onClose}\n >\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n aria-label={ariaLabel}\n considerHeight={considerHeight}\n aria-labelledby={ariaLabelledBy}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","ariaLabel","considerHeight","ariaLabelledBy","reference","isMobile","useLayout","SHORT_SCREEN","isShortViewport","isServerSide","window","innerHeight","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,gBAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;YACZC,UAAQ,GAAGC,iBAAQ,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/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel, { type PanelProps } from '../panel';\nimport { isServerSide } from '../domHelpers';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n 'aria-label': ariaLabel,\n considerHeight = false,\n 'aria-labelledby': ariaLabelledBy,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n const SHORT_SCREEN = 500;\n const isShortViewport = considerHeight && !isServerSide() && window.innerHeight < SHORT_SCREEN;\n\n if (isMobile || isShortViewport) {\n return (\n <BottomSheet\n key=\"bottomSheet\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n open={open}\n className={className}\n onClose={onClose}\n >\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n aria-label={ariaLabel}\n considerHeight={considerHeight}\n aria-labelledby={ariaLabelledBy}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","ariaLabel","considerHeight","ariaLabelledBy","reference","isMobile","useLayout","SHORT_SCREEN","isShortViewport","isServerSide","window","innerHeight","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,gBAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG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AAQ;AAAAH,IAAAA,QAAA,EAEhBA;AAAQ,GAAA,EAdL,OAeC,CAAC;AAEZ,CAAC;;;;"}
@@ -2,8 +2,8 @@ import { forwardRef } from 'react';
2
2
  import { isServerSide } from '../domHelpers/documentIosClick.mjs';
3
3
  import '../theme.mjs';
4
4
  import '../direction.mjs';
5
+ import '@transferwise/neptune-tokens';
5
6
  import '../propsValues/control.mjs';
6
- import '../propsValues/breakpoint.mjs';
7
7
  import '../propsValues/size.mjs';
8
8
  import '../propsValues/typography.mjs';
9
9
  import '../propsValues/width.mjs';
@@ -19,6 +19,7 @@ import '../propsValues/variant.mjs';
19
19
  import '../propsValues/scroll.mjs';
20
20
  import '../propsValues/markdownNodeType.mjs';
21
21
  import '../fileType.mjs';
22
+ import '@transferwise/formatting';
22
23
  import '@transferwise/icons';
23
24
  import 'clsx';
24
25
  import 'react-intl';
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsivePanel.mjs","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel, { type PanelProps } from '../panel';\nimport { isServerSide } from '../domHelpers';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n 'aria-label': ariaLabel,\n considerHeight = false,\n 'aria-labelledby': ariaLabelledBy,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n const SHORT_SCREEN = 500;\n const isShortViewport = considerHeight && !isServerSide() && window.innerHeight < SHORT_SCREEN;\n\n if (isMobile || isShortViewport) {\n return (\n <BottomSheet\n key=\"bottomSheet\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n open={open}\n className={className}\n onClose={onClose}\n >\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n aria-label={ariaLabel}\n considerHeight={considerHeight}\n aria-labelledby={ariaLabelledBy}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","ariaLabel","considerHeight","ariaLabelledBy","reference","isMobile","useLayout","SHORT_SCREEN","isShortViewport","isServerSide","window","innerHeight","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,UAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;EACZC,QAAQ,GAAGC,QAAQ,CAACC,MAAM;AAC1BC,EAAAA,WAAW,GAAG,KAAK;AACnB,EAAA,YAAY,EAAEC,SAAS;AACvBC,EAAAA,cAAc,GAAG,KAAK;AACtB,EAAA,iBAAiB,EAAEC;AAAc,CACtB,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA;GAAU,GAAGC,SAAS,EAAE;EAChC,MAAMC,YAAY,GAAG,GAAG;AACxB,EAAA,MAAMC,eAAe,GAAGN,cAAc,IAAI,CAACO,YAAY,EAAE,IAAIC,MAAM,CAACC,WAAW,GAAGJ,YAAY;EAE9F,IAAIF,QAAQ,IAAIG,eAAe,EAAE;IAC/B,oBACEI,GAAA,CAACC,WAAW,EAAA;AAEV,MAAA,YAAA,EAAYZ,SAAU;AACtB,MAAA,iBAAA,EAAiBE,cAAe;AAChCP,MAAAA,IAAI,EAAEA,IAAK;AACXH,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,OAAO,EAAEA,OAAQ;AAAAH,MAAAA,QAAA,EAEhBA;AAAQ,KAAA,EAPL,aAQO,CAAC;AAElB,EAAA;EACA,oBACEoB,GAAA,CAACE,KAAK,EAAA;AAEJC,IAAAA,GAAG,EAAEX,SAAU;AACfb,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,KAAK,EAAEA,KAAM;AACbM,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;AACnBG,IAAAA,WAAW,EAAEA,WAAY;AACzBX,IAAAA,SAAS,EAAEA,SAAU;AACrB,IAAA,YAAA,EAAYY,SAAU;AACtBC,IAAAA,cAAc,EAAEA,cAAe;AAC/B,IAAA,iBAAA,EAAiBC,cAAe;AAChCV,IAAAA,SAAS,EAAEA,SAAU;AACrBE,IAAAA,OAAO,EAAEA,OAAQ;AAAAH,IAAAA,QAAA,EAEhBA;AAAQ,GAAA,EAdL,OAeC,CAAC;AAEZ,CAAC;;;;"}
1
+ {"version":3,"file":"ResponsivePanel.mjs","sources":["../../../src/common/responsivePanel/ResponsivePanel.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { Position } from '..';\nimport BottomSheet from '../bottomSheet';\nimport { useLayout } from '../hooks';\nimport Panel, { type PanelProps } from '../panel';\nimport { isServerSide } from '../domHelpers';\n\nconst ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(\n {\n anchorRef,\n arrow = false,\n flip = true,\n children,\n className = undefined,\n onClose,\n open = false,\n position = Position.BOTTOM,\n anchorWidth = false,\n 'aria-label': ariaLabel,\n considerHeight = false,\n 'aria-labelledby': ariaLabelledBy,\n }: PanelProps,\n reference,\n) {\n const { isMobile } = useLayout();\n const SHORT_SCREEN = 500;\n const isShortViewport = considerHeight && !isServerSide() && window.innerHeight < SHORT_SCREEN;\n\n if (isMobile || isShortViewport) {\n return (\n <BottomSheet\n key=\"bottomSheet\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n open={open}\n className={className}\n onClose={onClose}\n >\n {children}\n </BottomSheet>\n );\n }\n return (\n <Panel\n key=\"panel\"\n ref={reference}\n flip={flip}\n arrow={arrow}\n open={open}\n position={position}\n anchorWidth={anchorWidth}\n anchorRef={anchorRef}\n aria-label={ariaLabel}\n considerHeight={considerHeight}\n aria-labelledby={ariaLabelledBy}\n className={className}\n onClose={onClose}\n >\n {children}\n </Panel>\n );\n});\n\nexport default ResponsivePanel;\n"],"names":["ResponsivePanel","forwardRef","anchorRef","arrow","flip","children","className","undefined","onClose","open","position","Position","BOTTOM","anchorWidth","ariaLabel","considerHeight","ariaLabelledBy","reference","isMobile","useLayout","SHORT_SCREEN","isShortViewport","isServerSide","window","innerHeight","_jsx","BottomSheet","Panel","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,eAAe,gBAAGC,UAAU,CAA6B,SAASD,eAAeA,CACrF;EACEE,SAAS;AACTC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,QAAQ;AACRC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;AACPC,EAAAA,IAAI,GAAG,KAAK;EACZC,QAAQ,GAAGC,QAAQ,CAACC,MAAM;AAC1BC,EAAAA,WAAW,GAAG,KAAK;AACnB,EAAA,YAAY,EAAEC,SAAS;AACvBC,EAAAA,cAAc,GAAG,KAAK;AACtB,EAAA,iBAAiB,EAAEC;AAAc,CACtB,EACbC,SAAS,EAAA;EAET,MAAM;AAAEC,IAAAA;GAAU,GAAGC,SAAS,EAAE;EAChC,MAAMC,YAAY,GAAG,GAAG;AACxB,EAAA,MAAMC,eAAe,GAAGN,cAAc,IAAI,CAACO,YAAY,EAAE,IAAIC,MAAM,CAACC,WAAW,GAAGJ,YAAY;EAE9F,IAAIF,QAAQ,IAAIG,eAAe,EAAE;IAC/B,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