@transferwise/components 0.0.0-experimental-033dd15 → 0.0.0-experimental-64ea603

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 (663) hide show
  1. package/build/accordion/Accordion.js +4 -2
  2. package/build/accordion/Accordion.js.map +1 -1
  3. package/build/accordion/AccordionItem/AccordionItem.js +6 -4
  4. package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
  5. package/build/actionButton/ActionButton.js +3 -1
  6. package/build/actionButton/ActionButton.js.map +1 -1
  7. package/build/actionOption/ActionOption.js +5 -3
  8. package/build/actionOption/ActionOption.js.map +1 -1
  9. package/build/alert/Alert.js +4 -4
  10. package/build/alert/Alert.js.map +1 -1
  11. package/build/alert/inlineMarkdown/InlineMarkdown.js +4 -2
  12. package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
  13. package/build/avatar/Avatar.js +3 -1
  14. package/build/avatar/Avatar.js.map +1 -1
  15. package/build/avatarLayout/AvatarLayout.js +5 -3
  16. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  17. package/build/avatarView/AvatarView.js +9 -7
  18. package/build/avatarView/AvatarView.js.map +1 -1
  19. package/build/avatarView/NotificationDot.js +3 -1
  20. package/build/avatarView/NotificationDot.js.map +1 -1
  21. package/build/avatarWrapper/AvatarWrapper.js +8 -6
  22. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  23. package/build/avatarWrapper/AvatarWrapper.mjs +1 -1
  24. package/build/avatarWrapper/index.js +3 -1
  25. package/build/avatarWrapper/index.js.map +1 -1
  26. package/build/badge/Badge.js +3 -1
  27. package/build/badge/Badge.js.map +1 -1
  28. package/build/badge/Badge.mjs.map +1 -1
  29. package/build/badge/BadgeAssets.js +9 -7
  30. package/build/badge/BadgeAssets.js.map +1 -1
  31. package/build/badge/BadgeAssets.mjs +2 -2
  32. package/build/badge/BadgeAssets.mjs.map +1 -1
  33. package/build/body/Body.js +3 -1
  34. package/build/body/Body.js.map +1 -1
  35. package/build/button/Button.js +8 -6
  36. package/build/button/Button.js.map +1 -1
  37. package/build/button/Button.resolver.js +5 -3
  38. package/build/button/Button.resolver.js.map +1 -1
  39. package/build/button/LegacyButton.js +5 -5
  40. package/build/button/LegacyButton.js.map +1 -1
  41. package/build/button/LegacyButton.mjs +0 -2
  42. package/build/button/LegacyButton.mjs.map +1 -1
  43. package/build/card/Card.js +6 -4
  44. package/build/card/Card.js.map +1 -1
  45. package/build/carousel/Carousel.js +8 -8
  46. package/build/carousel/Carousel.js.map +1 -1
  47. package/build/carousel/Carousel.mjs +1 -3
  48. package/build/carousel/Carousel.mjs.map +1 -1
  49. package/build/checkbox/Checkbox.js +6 -4
  50. package/build/checkbox/Checkbox.js.map +1 -1
  51. package/build/checkbox/Checkbox.mjs.map +1 -1
  52. package/build/checkboxButton/CheckboxButton.js +4 -2
  53. package/build/checkboxButton/CheckboxButton.js.map +1 -1
  54. package/build/checkboxButton/CheckboxButton.mjs +1 -1
  55. package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
  56. package/build/checkboxOption/CheckboxOption.js +5 -3
  57. package/build/checkboxOption/CheckboxOption.js.map +1 -1
  58. package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
  59. package/build/chevron/Chevron.js +3 -1
  60. package/build/chevron/Chevron.js.map +1 -1
  61. package/build/chips/Chip.js +4 -2
  62. package/build/chips/Chip.js.map +1 -1
  63. package/build/chips/Chips.js +5 -3
  64. package/build/chips/Chips.js.map +1 -1
  65. package/build/chips/Chips.messages.js +3 -1
  66. package/build/chips/Chips.messages.js.map +1 -1
  67. package/build/circularButton/CircularButton.js +5 -3
  68. package/build/circularButton/CircularButton.js.map +1 -1
  69. package/build/common/Option/Option.js +7 -5
  70. package/build/common/Option/Option.js.map +1 -1
  71. package/build/common/Option/Option.mjs +2 -2
  72. package/build/common/Option/Option.mjs.map +1 -1
  73. package/build/common/RadioButton/RadioButton.js +3 -1
  74. package/build/common/RadioButton/RadioButton.js.map +1 -1
  75. package/build/common/action/Action.js +2 -2
  76. package/build/common/action/Action.js.map +1 -1
  77. package/build/common/bottomSheet/BottomSheet.js +4 -2
  78. package/build/common/bottomSheet/BottomSheet.js.map +1 -1
  79. package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
  80. package/build/common/card/Card.js +3 -1
  81. package/build/common/card/Card.js.map +1 -1
  82. package/build/common/circle/Circle.js +3 -1
  83. package/build/common/circle/Circle.js.map +1 -1
  84. package/build/common/closeButton/CloseButton.js +1 -1
  85. package/build/common/closeButton/CloseButton.js.map +1 -1
  86. package/build/common/closeButton/CloseButton.messages.js +3 -1
  87. package/build/common/closeButton/CloseButton.messages.js.map +1 -1
  88. package/build/common/dateUtils/isDateValid/isDateValid.js +3 -3
  89. package/build/common/dateUtils/isDateValid/isDateValid.js.map +1 -1
  90. package/build/common/dateUtils/isDateValid/isDateValid.mjs +3 -3
  91. package/build/common/dateUtils/isDateValid/isDateValid.mjs.map +1 -1
  92. package/build/common/flowHeader/FlowHeader.js +3 -1
  93. package/build/common/flowHeader/FlowHeader.js.map +1 -1
  94. package/build/common/focusBoundary/FocusBoundary.js +3 -1
  95. package/build/common/focusBoundary/FocusBoundary.js.map +1 -1
  96. package/build/common/historyNavigator/historyNavigator.js +3 -1
  97. package/build/common/historyNavigator/historyNavigator.js.map +1 -1
  98. package/build/common/locale/index.js +0 -24
  99. package/build/common/locale/index.js.map +1 -1
  100. package/build/common/locale/index.mjs +0 -24
  101. package/build/common/locale/index.mjs.map +1 -1
  102. package/build/common/panel/Panel.js +6 -9
  103. package/build/common/panel/Panel.js.map +1 -1
  104. package/build/common/panel/Panel.mjs +3 -8
  105. package/build/common/panel/Panel.mjs.map +1 -1
  106. package/build/common/responsivePanel/ResponsivePanel.js +5 -3
  107. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  108. package/build/common/textFormat/formatWithPattern/formatWithPattern.js +4 -2
  109. package/build/common/textFormat/formatWithPattern/formatWithPattern.js.map +1 -1
  110. package/build/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.js +4 -2
  111. package/build/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.js.map +1 -1
  112. package/build/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +4 -2
  113. package/build/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js.map +1 -1
  114. package/build/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.js +2 -2
  115. package/build/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.js.map +1 -1
  116. package/build/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js +3 -1
  117. package/build/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js.map +1 -1
  118. package/build/common/textFormat/unformatWithPattern/unformatWithPattern.js +3 -1
  119. package/build/common/textFormat/unformatWithPattern/unformatWithPattern.js.map +1 -1
  120. package/build/criticalBanner/CriticalCommsBanner.js +3 -1
  121. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  122. package/build/dateInput/DateInput.js +15 -13
  123. package/build/dateInput/DateInput.js.map +1 -1
  124. package/build/dateInput/DateInput.messages.js +3 -1
  125. package/build/dateInput/DateInput.messages.js.map +1 -1
  126. package/build/dateInput/DateInput.mjs +3 -3
  127. package/build/dateInput/DateInput.mjs.map +1 -1
  128. package/build/dateLookup/DateLookup.js +8 -6
  129. package/build/dateLookup/DateLookup.js.map +1 -1
  130. package/build/dateLookup/DateLookup.messages.js +3 -1
  131. package/build/dateLookup/DateLookup.messages.js.map +1 -1
  132. package/build/dateLookup/dateHeader/DateHeader.js +33 -26
  133. package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
  134. package/build/dateLookup/dateHeader/DateHeader.mjs +27 -22
  135. package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
  136. package/build/dateLookup/dateTrigger/DateTrigger.js +8 -6
  137. package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
  138. package/build/dateLookup/dateTrigger/DateTrigger.messages.js +4 -2
  139. package/build/dateLookup/dateTrigger/DateTrigger.messages.js.map +1 -1
  140. package/build/dateLookup/dateTrigger/DateTrigger.messages.mjs +2 -2
  141. package/build/dateLookup/dateTrigger/DateTrigger.messages.mjs.map +1 -1
  142. package/build/dateLookup/dateTrigger/DateTrigger.mjs +2 -2
  143. package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
  144. package/build/dateLookup/dayCalendar/DayCalendar.js +6 -4
  145. package/build/dateLookup/dayCalendar/DayCalendar.js.map +1 -1
  146. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +4 -2
  147. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
  148. package/build/dateLookup/monthCalendar/MonthCalendar.js +6 -4
  149. package/build/dateLookup/monthCalendar/MonthCalendar.js.map +1 -1
  150. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js +4 -2
  151. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +1 -1
  152. package/build/dateLookup/tableLink/TableLink.js +4 -2
  153. package/build/dateLookup/tableLink/TableLink.js.map +1 -1
  154. package/build/dateLookup/yearCalendar/YearCalendar.js +6 -4
  155. package/build/dateLookup/yearCalendar/YearCalendar.js.map +1 -1
  156. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js +4 -2
  157. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +1 -1
  158. package/build/decision/Decision.js +2 -2
  159. package/build/decision/Decision.js.map +1 -1
  160. package/build/definitionList/DefinitionList.js +4 -2
  161. package/build/definitionList/DefinitionList.js.map +1 -1
  162. package/build/dimmer/Dimmer.js +3 -3
  163. package/build/dimmer/Dimmer.js.map +1 -1
  164. package/build/dimmer/dimmerManager/DimmerManager.js +3 -1
  165. package/build/dimmer/dimmerManager/DimmerManager.js.map +1 -1
  166. package/build/dimmer/dimmerManager/DimmerManager.mjs.map +1 -1
  167. package/build/display/Display.js +3 -1
  168. package/build/display/Display.js.map +1 -1
  169. package/build/divider/Divider.js +35 -0
  170. package/build/divider/Divider.js.map +1 -0
  171. package/build/divider/Divider.mjs +31 -0
  172. package/build/divider/Divider.mjs.map +1 -0
  173. package/build/drawer/Drawer.js +4 -2
  174. package/build/drawer/Drawer.js.map +1 -1
  175. package/build/dropFade/DropFade.js +3 -1
  176. package/build/dropFade/DropFade.js.map +1 -1
  177. package/build/dropFade/DropFade.mjs.map +1 -1
  178. package/build/emphasis/Emphasis.js +4 -2
  179. package/build/emphasis/Emphasis.js.map +1 -1
  180. package/build/emphasis/EmphasisHtmlTransformer.js +3 -1
  181. package/build/emphasis/EmphasisHtmlTransformer.js.map +1 -1
  182. package/build/emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
  183. package/build/field/Field.js +1 -1
  184. package/build/field/Field.js.map +1 -1
  185. package/build/flowNavigation/FlowNavigation.js +8 -6
  186. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  187. package/build/flowNavigation/FlowNavigation.messages.js +3 -1
  188. package/build/flowNavigation/FlowNavigation.messages.js.map +1 -1
  189. package/build/flowNavigation/animatedLabel/AnimatedLabel.js +5 -3
  190. package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
  191. package/build/header/Header.js +83 -42
  192. package/build/header/Header.js.map +1 -1
  193. package/build/header/Header.mjs +76 -38
  194. package/build/header/Header.mjs.map +1 -1
  195. package/build/i18n/commonMessages/Button.messages.js +3 -1
  196. package/build/i18n/commonMessages/Button.messages.js.map +1 -1
  197. package/build/i18n/cs.json +22 -5
  198. package/build/i18n/cs.json.js +25 -6
  199. package/build/i18n/cs.json.js.map +1 -1
  200. package/build/i18n/cs.json.mjs +22 -5
  201. package/build/i18n/cs.json.mjs.map +1 -1
  202. package/build/i18n/de.json.js +3 -1
  203. package/build/i18n/de.json.js.map +1 -1
  204. package/build/i18n/en.json.js +3 -1
  205. package/build/i18n/en.json.js.map +1 -1
  206. package/build/i18n/es.json.js +3 -1
  207. package/build/i18n/es.json.js.map +1 -1
  208. package/build/i18n/fr.json.js +3 -1
  209. package/build/i18n/fr.json.js.map +1 -1
  210. package/build/i18n/hu.json.js +3 -1
  211. package/build/i18n/hu.json.js.map +1 -1
  212. package/build/i18n/id.json.js +3 -1
  213. package/build/i18n/id.json.js.map +1 -1
  214. package/build/i18n/index.js +22 -20
  215. package/build/i18n/index.js.map +1 -1
  216. package/build/i18n/it.json.js +3 -1
  217. package/build/i18n/it.json.js.map +1 -1
  218. package/build/i18n/ja.json.js +3 -1
  219. package/build/i18n/ja.json.js.map +1 -1
  220. package/build/i18n/nl.json +73 -0
  221. package/build/i18n/pl.json.js +3 -1
  222. package/build/i18n/pl.json.js.map +1 -1
  223. package/build/i18n/pt.json.js +3 -1
  224. package/build/i18n/pt.json.js.map +1 -1
  225. package/build/i18n/ro.json.js +3 -1
  226. package/build/i18n/ro.json.js.map +1 -1
  227. package/build/i18n/ru.json.js +3 -1
  228. package/build/i18n/ru.json.js.map +1 -1
  229. package/build/i18n/th.json.js +3 -1
  230. package/build/i18n/th.json.js.map +1 -1
  231. package/build/i18n/tr.json.js +3 -1
  232. package/build/i18n/tr.json.js.map +1 -1
  233. package/build/i18n/uk.json.js +3 -1
  234. package/build/i18n/uk.json.js.map +1 -1
  235. package/build/i18n/zh-CN.json.js +3 -1
  236. package/build/i18n/zh-CN.json.js.map +1 -1
  237. package/build/i18n/zh-HK.json.js +3 -1
  238. package/build/i18n/zh-HK.json.js.map +1 -1
  239. package/build/iconButton/IconButton.js +5 -3
  240. package/build/iconButton/IconButton.js.map +1 -1
  241. package/build/index.js +85 -84
  242. package/build/index.js.map +1 -1
  243. package/build/index.mjs +5 -4
  244. package/build/index.mjs.map +1 -1
  245. package/build/info/Info.js +13 -17
  246. package/build/info/Info.js.map +1 -1
  247. package/build/info/Info.messages.js +3 -1
  248. package/build/info/Info.messages.js.map +1 -1
  249. package/build/info/Info.mjs +7 -13
  250. package/build/info/Info.mjs.map +1 -1
  251. package/build/inlineAlert/InlineAlert.js +5 -3
  252. package/build/inlineAlert/InlineAlert.js.map +1 -1
  253. package/build/inputWithDisplayFormat/InputWithDisplayFormat.js +4 -2
  254. package/build/inputWithDisplayFormat/InputWithDisplayFormat.js.map +1 -1
  255. package/build/inputs/Input.js +1 -3
  256. package/build/inputs/Input.js.map +1 -1
  257. package/build/inputs/Input.mjs +1 -3
  258. package/build/inputs/Input.mjs.map +1 -1
  259. package/build/inputs/SelectInput.js +5 -7
  260. package/build/inputs/SelectInput.js.map +1 -1
  261. package/build/inputs/SelectInput.messages.js +3 -1
  262. package/build/inputs/SelectInput.messages.js.map +1 -1
  263. package/build/inputs/SelectInput.mjs +4 -6
  264. package/build/inputs/SelectInput.mjs.map +1 -1
  265. package/build/inputs/_ButtonInput.js +1 -3
  266. package/build/inputs/_ButtonInput.js.map +1 -1
  267. package/build/inputs/_ButtonInput.mjs +1 -3
  268. package/build/inputs/_ButtonInput.mjs.map +1 -1
  269. package/build/inputs/_Popover.js +1 -3
  270. package/build/inputs/_Popover.js.map +1 -1
  271. package/build/inputs/_Popover.mjs +1 -3
  272. package/build/inputs/_Popover.mjs.map +1 -1
  273. package/build/instructionsList/InstructionsList.js +4 -2
  274. package/build/instructionsList/InstructionsList.js.map +1 -1
  275. package/build/label/Label.js +3 -3
  276. package/build/label/Label.js.map +1 -1
  277. package/build/label/Label.messages.js +3 -1
  278. package/build/label/Label.messages.js.map +1 -1
  279. package/build/link/Link.js +5 -3
  280. package/build/link/Link.js.map +1 -1
  281. package/build/link/Link.messages.js +3 -1
  282. package/build/link/Link.messages.js.map +1 -1
  283. package/build/listItem/ListItem.js +6 -4
  284. package/build/listItem/ListItem.js.map +1 -1
  285. package/build/listItem/ListItem.mjs +1 -1
  286. package/build/listItem/ListItem.mjs.map +1 -1
  287. package/build/loader/Loader.js +3 -1
  288. package/build/loader/Loader.js.map +1 -1
  289. package/build/main.css +55 -102
  290. package/build/markdown/Markdown.js +3 -1
  291. package/build/markdown/Markdown.js.map +1 -1
  292. package/build/modal/Modal.js +5 -3
  293. package/build/modal/Modal.js.map +1 -1
  294. package/build/money/Money.js +3 -1
  295. package/build/money/Money.js.map +1 -1
  296. package/build/moneyInput/MoneyInput.js +7 -5
  297. package/build/moneyInput/MoneyInput.js.map +1 -1
  298. package/build/moneyInput/MoneyInput.messages.js +3 -1
  299. package/build/moneyInput/MoneyInput.messages.js.map +1 -1
  300. package/build/moneyInput/currencyFormatting.js +2 -2
  301. package/build/moneyInput/currencyFormatting.js.map +1 -1
  302. package/build/moneyInput/currencyFormatting.mjs +2 -2
  303. package/build/moneyInput/currencyFormatting.mjs.map +1 -1
  304. package/build/navigationOption/NavigationOption.js +5 -3
  305. package/build/navigationOption/NavigationOption.js.map +1 -1
  306. package/build/navigationOptionsList/NavigationOptionsList.js +3 -1
  307. package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
  308. package/build/nudge/Nudge.js +2 -4
  309. package/build/nudge/Nudge.js.map +1 -1
  310. package/build/nudge/Nudge.mjs +0 -2
  311. package/build/nudge/Nudge.mjs.map +1 -1
  312. package/build/overlayHeader/OverlayHeader.js +4 -2
  313. package/build/overlayHeader/OverlayHeader.js.map +1 -1
  314. package/build/phoneNumberInput/PhoneNumberInput.js +5 -3
  315. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  316. package/build/phoneNumberInput/PhoneNumberInput.messages.js +3 -1
  317. package/build/phoneNumberInput/PhoneNumberInput.messages.js.map +1 -1
  318. package/build/phoneNumberInput/data/countries.js +3 -1
  319. package/build/phoneNumberInput/data/countries.js.map +1 -1
  320. package/build/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
  321. package/build/phoneNumberInput/utils/findCountryByCode/index.js.map +1 -1
  322. package/build/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
  323. package/build/phoneNumberInput/utils/findCountryByPrefix/index.js.map +1 -1
  324. package/build/popover/Popover.js +5 -3
  325. package/build/popover/Popover.js.map +1 -1
  326. package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.js +3 -1
  327. package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.js.map +1 -1
  328. package/build/primitives/PrimitiveButton/PrimitiveButton.js +4 -2
  329. package/build/primitives/PrimitiveButton/PrimitiveButton.js.map +1 -1
  330. package/build/processIndicator/ProcessIndicator.js +3 -1
  331. package/build/processIndicator/ProcessIndicator.js.map +1 -1
  332. package/build/progress/Progress.js +3 -1
  333. package/build/progress/Progress.js.map +1 -1
  334. package/build/progressBar/ProgressBar.js +7 -5
  335. package/build/progressBar/ProgressBar.js.map +1 -1
  336. package/build/promoCard/PromoCard.js +8 -6
  337. package/build/promoCard/PromoCard.js.map +1 -1
  338. package/build/promoCard/PromoCardContext.js +0 -1
  339. package/build/promoCard/PromoCardContext.js.map +1 -1
  340. package/build/promoCard/PromoCardContext.mjs +0 -1
  341. package/build/promoCard/PromoCardContext.mjs.map +1 -1
  342. package/build/promoCard/PromoCardGroup.js +3 -2
  343. package/build/promoCard/PromoCardGroup.js.map +1 -1
  344. package/build/promoCard/PromoCardGroup.mjs +0 -1
  345. package/build/promoCard/PromoCardGroup.mjs.map +1 -1
  346. package/build/promoCard/PromoCardIndicator.js +5 -3
  347. package/build/promoCard/PromoCardIndicator.js.map +1 -1
  348. package/build/provider/Provider.js +4 -2
  349. package/build/provider/Provider.js.map +1 -1
  350. package/build/radio/Radio.js +6 -4
  351. package/build/radio/Radio.js.map +1 -1
  352. package/build/radioGroup/RadioGroup.js +4 -2
  353. package/build/radioGroup/RadioGroup.js.map +1 -1
  354. package/build/radioOption/RadioOption.js +5 -3
  355. package/build/radioOption/RadioOption.js.map +1 -1
  356. package/build/section/Section.js +3 -1
  357. package/build/section/Section.js.map +1 -1
  358. package/build/segmentedControl/SegmentedControl.js +5 -3
  359. package/build/segmentedControl/SegmentedControl.js.map +1 -1
  360. package/build/select/Select.js +31 -35
  361. package/build/select/Select.js.map +1 -1
  362. package/build/select/Select.messages.js +3 -1
  363. package/build/select/Select.messages.js.map +1 -1
  364. package/build/select/Select.mjs +19 -25
  365. package/build/select/Select.mjs.map +1 -1
  366. package/build/select/option/Option.js +9 -5
  367. package/build/select/option/Option.js.map +1 -1
  368. package/build/select/option/Option.mjs +3 -1
  369. package/build/select/option/Option.mjs.map +1 -1
  370. package/build/select/option/index.js +3 -1
  371. package/build/select/option/index.js.map +1 -1
  372. package/build/select/searchBox/SearchBox.js +3 -1
  373. package/build/select/searchBox/SearchBox.js.map +1 -1
  374. package/build/selectOption/SelectOption.js +11 -9
  375. package/build/selectOption/SelectOption.js.map +1 -1
  376. package/build/selectOption/SelectOption.messages.js +3 -1
  377. package/build/selectOption/SelectOption.messages.js.map +1 -1
  378. package/build/selectOption/SelectOption.mjs +1 -1
  379. package/build/snackbar/Snackbar.js +3 -3
  380. package/build/snackbar/Snackbar.js.map +1 -1
  381. package/build/snackbar/SnackbarProvider.js +3 -1
  382. package/build/snackbar/SnackbarProvider.js.map +1 -1
  383. package/build/snackbar/useSnackbar.js +3 -1
  384. package/build/snackbar/useSnackbar.js.map +1 -1
  385. package/build/statusIcon/StatusIcon.js +12 -10
  386. package/build/statusIcon/StatusIcon.js.map +1 -1
  387. package/build/statusIcon/StatusIcon.messages.js +3 -1
  388. package/build/statusIcon/StatusIcon.messages.js.map +1 -1
  389. package/build/stepper/Stepper.js +4 -2
  390. package/build/stepper/Stepper.js.map +1 -1
  391. package/build/sticky/Sticky.js +3 -1
  392. package/build/sticky/Sticky.js.map +1 -1
  393. package/build/styles/button/Button.css +2 -2
  394. package/build/styles/common/Option/Option.css +1 -1
  395. package/build/styles/dateLookup/DateLookup.css +0 -5
  396. package/build/styles/divider/Divider.css +24 -0
  397. package/build/styles/header/Header.css +28 -11
  398. package/build/styles/info/Info.css +0 -23
  399. package/build/styles/main.css +55 -102
  400. package/build/summary/Summary.js +11 -9
  401. package/build/summary/Summary.js.map +1 -1
  402. package/build/summary/Summary.messages.js +3 -1
  403. package/build/summary/Summary.messages.js.map +1 -1
  404. package/build/summary/Summary.mjs +2 -2
  405. package/build/summary/Summary.mjs.map +1 -1
  406. package/build/switch/Switch.js +3 -1
  407. package/build/switch/Switch.js.map +1 -1
  408. package/build/switchOption/SwitchOption.js +5 -3
  409. package/build/switchOption/SwitchOption.js.map +1 -1
  410. package/build/table/Table.js +17 -17
  411. package/build/table/Table.js.map +1 -1
  412. package/build/table/Table.messages.js +3 -1
  413. package/build/table/Table.messages.js.map +1 -1
  414. package/build/table/Table.mjs +1 -3
  415. package/build/table/Table.mjs.map +1 -1
  416. package/build/table/TableCell.js +9 -7
  417. package/build/table/TableCell.js.map +1 -1
  418. package/build/table/TableHeader.js +6 -4
  419. package/build/table/TableHeader.js.map +1 -1
  420. package/build/table/TableRow.js +6 -4
  421. package/build/table/TableRow.js.map +1 -1
  422. package/build/table/TableStatusText.js +4 -2
  423. package/build/table/TableStatusText.js.map +1 -1
  424. package/build/tabs/Tab.js +3 -1
  425. package/build/tabs/Tab.js.map +1 -1
  426. package/build/tabs/TabList.js +3 -1
  427. package/build/tabs/TabList.js.map +1 -1
  428. package/build/tabs/TabPanel.js +3 -1
  429. package/build/tabs/TabPanel.js.map +1 -1
  430. package/build/tabs/Tabs.js +6 -4
  431. package/build/tabs/Tabs.js.map +1 -1
  432. package/build/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +4 -2
  433. package/build/textareaWithDisplayFormat/TextareaWithDisplayFormat.js.map +1 -1
  434. package/build/tile/Tile.js +5 -3
  435. package/build/tile/Tile.js.map +1 -1
  436. package/build/title/Title.js +9 -5
  437. package/build/title/Title.js.map +1 -1
  438. package/build/title/Title.mjs +6 -4
  439. package/build/title/Title.mjs.map +1 -1
  440. package/build/tooltip/Tooltip.js +5 -7
  441. package/build/tooltip/Tooltip.js.map +1 -1
  442. package/build/tooltip/Tooltip.mjs +2 -6
  443. package/build/tooltip/Tooltip.mjs.map +1 -1
  444. package/build/typeahead/Typeahead.js +8 -6
  445. package/build/typeahead/Typeahead.js.map +1 -1
  446. package/build/typeahead/Typeahead.messages.js +3 -1
  447. package/build/typeahead/Typeahead.messages.js.map +1 -1
  448. package/build/typeahead/typeaheadInput/TypeaheadInput.js +3 -1
  449. package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
  450. package/build/typeahead/typeaheadOption/TypeaheadOption.js +5 -3
  451. package/build/typeahead/typeaheadOption/TypeaheadOption.js.map +1 -1
  452. package/build/typeahead/util/highlight.js +3 -1
  453. package/build/typeahead/util/highlight.js.map +1 -1
  454. package/build/types/badge/Badge.d.ts +1 -1
  455. package/build/types/badge/Badge.d.ts.map +1 -1
  456. package/build/types/badge/BadgeAssets.d.ts.map +1 -1
  457. package/build/types/button/LegacyButton.d.ts.map +1 -1
  458. package/build/types/carousel/Carousel.d.ts.map +1 -1
  459. package/build/types/checkbox/Checkbox.d.ts.map +1 -1
  460. package/build/types/checkboxOption/CheckboxOption.d.ts +1 -2
  461. package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
  462. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  463. package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
  464. package/build/types/common/locale/index.d.ts +1 -1
  465. package/build/types/common/locale/index.d.ts.map +1 -1
  466. package/build/types/common/panel/Panel.d.ts.map +1 -1
  467. package/build/types/dateInput/DateInput.d.ts +1 -1
  468. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  469. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  470. package/build/types/dimmer/dimmerManager/DimmerManager.d.ts +1 -1
  471. package/build/types/dimmer/dimmerManager/DimmerManager.d.ts.map +1 -1
  472. package/build/types/divider/Divider.d.ts +29 -0
  473. package/build/types/divider/Divider.d.ts.map +1 -0
  474. package/build/types/divider/index.d.ts +3 -0
  475. package/build/types/divider/index.d.ts.map +1 -0
  476. package/build/types/dropFade/DropFade.d.ts.map +1 -1
  477. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts +2 -2
  478. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts.map +1 -1
  479. package/build/types/header/Header.d.ts +28 -11
  480. package/build/types/header/Header.d.ts.map +1 -1
  481. package/build/types/header/index.d.ts +1 -0
  482. package/build/types/header/index.d.ts.map +1 -1
  483. package/build/types/index.d.ts +3 -2
  484. package/build/types/index.d.ts.map +1 -1
  485. package/build/types/info/Info.d.ts.map +1 -1
  486. package/build/types/inputs/Input.d.ts.map +1 -1
  487. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  488. package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
  489. package/build/types/inputs/_Popover.d.ts.map +1 -1
  490. package/build/types/nudge/Nudge.d.ts.map +1 -1
  491. package/build/types/promoCard/PromoCardContext.d.ts.map +1 -1
  492. package/build/types/promoCard/PromoCardGroup.d.ts.map +1 -1
  493. package/build/types/select/Select.d.ts.map +1 -1
  494. package/build/types/select/option/Option.d.ts +2 -1
  495. package/build/types/select/option/Option.d.ts.map +1 -1
  496. package/build/types/table/Table.d.ts.map +1 -1
  497. package/build/types/title/Title.d.ts +3 -4
  498. package/build/types/title/Title.d.ts.map +1 -1
  499. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  500. package/build/types/upload/Upload.d.ts.map +1 -1
  501. package/build/upload/Upload.js +20 -18
  502. package/build/upload/Upload.js.map +1 -1
  503. package/build/upload/Upload.messages.js +3 -1
  504. package/build/upload/Upload.messages.js.map +1 -1
  505. package/build/upload/Upload.mjs +3 -1
  506. package/build/upload/Upload.mjs.map +1 -1
  507. package/build/upload/steps/completeStep/completeStep.js +30 -6
  508. package/build/upload/steps/completeStep/completeStep.js.map +1 -1
  509. package/build/upload/steps/completeStep/completeStep.mjs +24 -2
  510. package/build/upload/steps/completeStep/completeStep.mjs.map +1 -1
  511. package/build/upload/steps/processingStep/processingStep.js +6 -4
  512. package/build/upload/steps/processingStep/processingStep.js.map +1 -1
  513. package/build/upload/steps/uploadImageStep/uploadImageStep.js +5 -3
  514. package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
  515. package/build/uploadInput/UploadInput.js +13 -11
  516. package/build/uploadInput/UploadInput.js.map +1 -1
  517. package/build/uploadInput/UploadInput.messages.js +3 -1
  518. package/build/uploadInput/UploadInput.messages.js.map +1 -1
  519. package/build/uploadInput/uploadButton/UploadButton.js +8 -8
  520. package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
  521. package/build/uploadInput/uploadButton/UploadButton.messages.js +3 -1
  522. package/build/uploadInput/uploadButton/UploadButton.messages.js.map +1 -1
  523. package/build/uploadInput/uploadButton/getAllowedFileTypes.js +3 -1
  524. package/build/uploadInput/uploadButton/getAllowedFileTypes.js.map +1 -1
  525. package/build/uploadInput/uploadItem/UploadItem.js +12 -12
  526. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  527. package/build/uploadInput/uploadItem/UploadItem.messages.js +3 -1
  528. package/build/uploadInput/uploadItem/UploadItem.messages.js.map +1 -1
  529. package/build/withDisplayFormat/WithDisplayFormat.js +19 -17
  530. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  531. package/build/withId/withId.js +3 -1
  532. package/build/withId/withId.js.map +1 -1
  533. package/build/withNextPortal/withNextPortal.js +3 -1
  534. package/build/withNextPortal/withNextPortal.js.map +1 -1
  535. package/package.json +12 -10
  536. package/src/accordion/Accordion.story.tsx +2 -2
  537. package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -2
  538. package/src/alert/Alert.story.tsx +2 -2
  539. package/src/alert/Alert.tests.story.tsx +1 -1
  540. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +12 -4
  541. package/src/badge/Badge.tsx +1 -1
  542. package/src/badge/BadgeAssets.tsx +2 -2
  543. package/src/button/Button.css +2 -2
  544. package/src/button/Button.less +2 -2
  545. package/src/button/LegacyButton.tsx +0 -2
  546. package/src/carousel/Carousel.spec.tsx +0 -4
  547. package/src/carousel/Carousel.tsx +0 -1
  548. package/src/checkbox/Checkbox.tsx +0 -1
  549. package/src/checkboxButton/CheckboxButton.story.tsx +0 -2
  550. package/src/checkboxButton/CheckboxButton.tsx +1 -1
  551. package/src/checkboxOption/CheckboxOption.tsx +1 -2
  552. package/src/chips/__snapshots__/Chips.spec.tsx.snap +1 -1
  553. package/src/common/Option/Option.css +1 -1
  554. package/src/common/Option/Option.less +2 -2
  555. package/src/common/Option/Option.tsx +1 -1
  556. package/src/common/bottomSheet/BottomSheet.spec.tsx +0 -1
  557. package/src/common/bottomSheet/BottomSheet.story.tsx +1 -1
  558. package/src/common/bottomSheet/BottomSheet.tsx +0 -1
  559. package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +1 -1
  560. package/src/common/closeButton/__snapshots__/CloseButton.spec.tsx.snap +1 -1
  561. package/src/common/dateUtils/isDateValid/isDateValid.ts +5 -3
  562. package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +0 -2
  563. package/src/common/locale/index.ts +1 -1
  564. package/src/common/panel/Panel.tsx +2 -13
  565. package/src/dateInput/DateInput.tsx +7 -1
  566. package/src/dateLookup/DateLookup.css +0 -5
  567. package/src/dateLookup/DateLookup.less +0 -4
  568. package/src/dateLookup/dateHeader/DateHeader.tsx +24 -26
  569. package/src/dimmer/Dimmer.story.tsx +0 -1
  570. package/src/dimmer/dimmerManager/DimmerManager.ts +1 -1
  571. package/src/display/Display.story.tsx +0 -2
  572. package/src/divider/Divider.accessibility.docs.mdx +61 -0
  573. package/src/divider/Divider.css +24 -0
  574. package/src/divider/Divider.less +31 -0
  575. package/src/divider/Divider.spec.tsx +60 -0
  576. package/src/divider/Divider.story.tsx +130 -0
  577. package/src/divider/Divider.tsx +54 -0
  578. package/src/divider/index.ts +2 -0
  579. package/src/dropFade/DropFade.story.tsx +0 -1
  580. package/src/dropFade/DropFade.tsx +0 -1
  581. package/src/emphasis/EmphasisHtmlTransformer.spec.tsx +4 -4
  582. package/src/emphasis/EmphasisHtmlTransformer.ts +2 -2
  583. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +5 -3
  584. package/src/header/Header.accessibility.docs.mdx +85 -0
  585. package/src/header/Header.css +28 -11
  586. package/src/header/Header.less +29 -7
  587. package/src/header/Header.spec.tsx +68 -50
  588. package/src/header/Header.story.tsx +184 -39
  589. package/src/header/Header.tsx +123 -69
  590. package/src/header/index.ts +1 -0
  591. package/src/i18n/cs.json +22 -5
  592. package/src/i18n/nl.json +73 -0
  593. package/src/index.ts +3 -2
  594. package/src/info/Info.css +0 -23
  595. package/src/info/Info.less +0 -28
  596. package/src/info/Info.tsx +8 -14
  597. package/src/inputs/Input.tsx +0 -1
  598. package/src/inputs/SelectInput.tsx +1 -7
  599. package/src/inputs/_ButtonInput.tsx +0 -1
  600. package/src/inputs/_Popover.tsx +0 -1
  601. package/src/link/Link.story.tsx +0 -1
  602. package/src/listItem/ListItem.story.tsx +4 -11
  603. package/src/listItem/ListItem.tests.story.tsx +52 -0
  604. package/src/listItem/ListItem.tsx +1 -1
  605. package/src/main.css +55 -102
  606. package/src/main.less +1 -1
  607. package/src/markdown/Markdown.spec.tsx +0 -1
  608. package/src/modal/Modal.story.tsx +1 -1
  609. package/src/moneyInput/currencyFormatting.ts +3 -3
  610. package/src/nudge/Nudge.tsx +0 -2
  611. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +1 -1
  612. package/src/promoCard/PromoCardContext.tsx +0 -1
  613. package/src/promoCard/PromoCardGroup.story.tsx +3 -15
  614. package/src/promoCard/PromoCardGroup.tsx +0 -1
  615. package/src/provider/theme/ThemeProvider.story.tsx +3 -5
  616. package/src/select/Select.spec.tsx +0 -1
  617. package/src/select/Select.tsx +0 -3
  618. package/src/select/option/Option.spec.tsx +51 -0
  619. package/src/select/option/Option.tsx +3 -1
  620. package/src/selectOption/SelectOption.story.tsx +1 -2
  621. package/src/summary/Summary.tests.story.tsx +55 -0
  622. package/src/summary/Summary.tsx +2 -2
  623. package/src/table/Table.tsx +0 -1
  624. package/src/test-utils/jest.setup.ts +0 -1
  625. package/src/title/Title.tsx +25 -11
  626. package/src/tooltip/Tooltip.tsx +0 -2
  627. package/src/upload/Upload.spec.tsx +295 -0
  628. package/src/upload/Upload.tsx +5 -1
  629. package/src/upload/steps/completeStep/completeStep.spec.tsx +51 -0
  630. package/src/upload/steps/completeStep/completeStep.tsx +1 -1
  631. package/src/upload/steps/processingStep/processingStep.spec.tsx +59 -0
  632. package/src/upload/steps/uploadImageStep/uploadImageStep.spec.tsx +79 -0
  633. package/build/styles/item/Item.css +0 -60
  634. package/build/types/item/Item.d.ts +0 -39
  635. package/build/types/item/Item.d.ts.map +0 -1
  636. package/build/types/item/ItemAdditionalInfo.d.ts +0 -7
  637. package/build/types/item/ItemAdditionalInfo.d.ts.map +0 -1
  638. package/build/types/item/ItemCheckbox.d.ts +0 -4
  639. package/build/types/item/ItemCheckbox.d.ts.map +0 -1
  640. package/build/types/item/ItemIconButton.d.ts +0 -4
  641. package/build/types/item/ItemIconButton.d.ts.map +0 -1
  642. package/build/types/item/ItemImage.d.ts +0 -4
  643. package/build/types/item/ItemImage.d.ts.map +0 -1
  644. package/build/types/item/ItemNavigation.d.ts +0 -4
  645. package/build/types/item/ItemNavigation.d.ts.map +0 -1
  646. package/build/types/item/index.d.ts +0 -5
  647. package/build/types/item/index.d.ts.map +0 -1
  648. package/src/item/Item.css +0 -60
  649. package/src/item/Item.less +0 -60
  650. package/src/item/Item.story.tsx +0 -39
  651. package/src/item/Item.tsx +0 -153
  652. package/src/item/ItemAdditionalInfo.tsx +0 -14
  653. package/src/item/ItemCheckbox.tsx +0 -16
  654. package/src/item/ItemIconButton.tsx +0 -15
  655. package/src/item/ItemImage.tsx +0 -11
  656. package/src/item/ItemNavigation.tsx +0 -16
  657. package/src/item/index.ts +0 -4
  658. package/src/select/option/Option.spec.js +0 -43
  659. package/src/upload/Upload.events.spec.js +0 -49
  660. package/src/upload/Upload.spec.js +0 -305
  661. package/src/upload/steps/completeStep/completeStep.spec.js +0 -51
  662. package/src/upload/steps/processingStep/processingStep.spec.js +0 -55
  663. package/src/upload/steps/uploadImageStep/uploadImageStep.spec.js +0 -91
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId } from 'react';\n\nimport { Sentiment } from '../common';\nimport InlineAlert from '../inlineAlert/InlineAlert';\nimport {\n FieldLabelIdContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlineAlert icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: `${Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.POSITIVE | Sentiment.WARNING}`;\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelIdContextProvider value={labelId}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlineAlert type={sentiment} id={messageId} iconLabel={messageIconLabel}>\n {message}\n </InlineAlert>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelIdContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelIdContextProvider","value","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlineAlert","type","iconLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,mBAAS,CAACC,OAAO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C,gBAAiB;AAAAQ,cAAAA,QAAA,EACtEV,OAAAA;AAAO,aACG,CACd,CAAA;WACE,CAAA;SACe,CAAA;OACE,CAAA;KACJ,CAAA;AAC1B,GAA6B,CAAC,CAAA;AAElC;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId } from 'react';\n\nimport { Sentiment } from '../common';\nimport InlineAlert from '../inlineAlert/InlineAlert';\nimport {\n FieldLabelIdContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlineAlert icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: `${Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.POSITIVE | Sentiment.WARNING}`;\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelIdContextProvider value={labelId}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlineAlert type={sentiment} id={messageId} iconLabel={messageIconLabel}>\n {message}\n </InlineAlert>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelIdContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelIdContextProvider","value","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlineAlert","type","iconLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EACh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AW,EAAA;AAACC,cAAAA,IAAI,EAAEtC,WAAU;AAACR,cAAAA,EAAE,EAAEuB,SAAU;AAACwB,cAAAA,SAAS,EAAE1C,gBAAiB;AAAAQ,cAAAA,QAAA,EACtEV,OAAAA;AAAO,aACG,CACd,CAAA;WACE,CAAA;SACe,CAAA;OACE,CAAA;KACJ,CAAA;AAC1B,GAA6B,CAAC,CAAA;AAElC;;;;"}
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var clsx = require('clsx');
4
6
  var reactIntl = require('react-intl');
5
7
  require('../common/theme.js');
@@ -54,7 +56,7 @@ const FlowNavigation = ({
54
56
  className: clsx.clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
55
57
  'np-flow-navigation--border-bottom': !done
56
58
  }),
57
- children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
59
+ children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader.default, {
58
60
  className: clsx.clsx('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
59
61
  'np-flow-navigation--xs-max': !screenSm,
60
62
  // Size switches on parent container which may or may not have the same size as the window.
@@ -62,17 +64,17 @@ const FlowNavigation = ({
62
64
  'np-flow-navigation--lg': screenLg
63
65
  }),
64
66
  leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
65
- children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(IconButton, {
67
+ children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
66
68
  size: 40,
67
69
  priority: "tertiary",
68
70
  type: "default",
69
- "aria-label": intl.formatMessage(FlowNavigation_messages.back),
71
+ "aria-label": intl.formatMessage(FlowNavigation_messages.default.back),
70
72
  onClick: onGoBack,
71
73
  children: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowLeft, {})
72
74
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
73
75
  className: "np-flow-header__left",
74
76
  children: logo
75
- }), !screenSm && !done && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
77
+ }), !screenSm && !done && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel.default, {
76
78
  className: "m-x-1",
77
79
  steps: steps,
78
80
  activeLabel: activeStep
@@ -84,7 +86,7 @@ const FlowNavigation = ({
84
86
  className: "m-x-1"
85
87
  }), closeButton]
86
88
  }),
87
- bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
89
+ bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper.default, {
88
90
  activeStep: activeStep,
89
91
  steps: steps,
90
92
  className: clsx.clsx('np-flow-navigation__stepper')
@@ -94,5 +96,5 @@ const FlowNavigation = ({
94
96
  });
95
97
  };
96
98
 
97
- module.exports = FlowNavigation;
99
+ exports.default = FlowNavigation;
98
100
  //# sourceMappingURL=FlowNavigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowNavigation.js","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n activeStep?: number;\n avatar?: React.ReactNode;\n logo?: React.ReactNode;\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: () => void;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */\n steps: readonly Step[];\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = <Logo />,\n done = false,\n onClose,\n onGoBack,\n steps,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const newAvatar = done ? null : avatar;\n\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n return (\n <div\n className={clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {\n 'np-flow-navigation--border-bottom': !done,\n })}\n >\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content p-x-3',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n )\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n </div>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["FlowNavigation","activeStep","avatar","logo","_jsx","Logo","done","onClose","onGoBack","steps","intl","useIntl","closeButton","CloseButton","size","onClick","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","newAvatar","displayGoBack","className","clsx","children","FlowHeader","leftContent","_jsxs","_Fragment","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedLabel","activeLabel","rightContent","bottomContent","Stepper","layout","Layout","VERTICAL","HORIZONTAL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BMA,MAAAA,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAAM;AACNC,EAAAA,IAAI,gBAAGC,cAAA,CAACC,YAAI,IAAG,CAAA;AACfC,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ;AACRC,EAAAA,KAAAA;AAAK,CACe,KAAI;AACxB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;EAEtB,MAAMC,WAAW,GAAGL,OAAO,IAAI,IAAI,iBAAIH,cAAA,CAACS,uBAAW,EAAA;AAACC,IAAAA,IAAI,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAER,OAAAA;AAAQ,IAAG,CAAA;AAElF,EAAA,MAAMS,QAAQ,GAAGC,2BAAa,CAACC,qBAAU,CAACC,KAAK,CAAC,CAAA;AAChD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,qBAAU,CAACG,KAAK,CAAC,CAAA;AAEhD,EAAA,MAAMC,SAAS,GAAGhB,IAAI,GAAG,IAAI,GAAGJ,MAAM,CAAA;EAEtC,MAAMqB,aAAa,GAAGf,QAAQ,IAAI,IAAI,IAAIP,UAAU,GAAG,CAAC,CAAA;AAExD,EAAA,oBACEG,cAAA,CAAA,KAAA,EAAA;AACEoB,IAAAA,SAAS,EAAEC,SAAI,CAAC,2EAA2E,EAAE;AAC3F,MAAA,mCAAmC,EAAE,CAACnB,IAAAA;AACvC,KAAA,CAAE;IAAAoB,QAAA,eAEHtB,cAAA,CAACuB,UAAU,EAAA;MACTH,SAAS,EAAEC,SAAI,CACb,mCAAmC,EACnCT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AAA,CAACsC,OAAO,EAAA;AACNzC,QAAAA,UAAU,EAAEA,UAAW;AACvBQ,QAAAA,KAAK,EAAEA,KAAM;QACbe,SAAS,EAAEC,SAAI,CAAC,6BAA6B,CAAA;AAAE,OAAA,CAGpD;MACDkB,MAAM,EAAE,CAACvB,QAAQ,GAAGwB,cAAM,CAACC,QAAQ,GAAGD,cAAM,CAACE,UAAAA;KAEjD,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"FlowNavigation.js","sources":["../../src/flowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { Breakpoint, Layout } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport FlowHeader from '../common/flowHeader/FlowHeader';\nimport Logo from '../logo';\nimport Stepper, { type Step } from '../stepper/Stepper';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './animatedLabel';\nimport IconButton from '../iconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nexport interface FlowNavigationProps {\n activeStep?: number;\n avatar?: React.ReactNode;\n logo?: React.ReactNode;\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: () => void;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */\n steps: readonly Step[];\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = <Logo />,\n done = false,\n onClose,\n onGoBack,\n steps,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const newAvatar = done ? null : avatar;\n\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n return (\n <div\n className={clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {\n 'np-flow-navigation--border-bottom': !done,\n })}\n >\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content p-x-3',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n )\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n </div>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["FlowNavigation","activeStep","avatar","logo","_jsx","Logo","done","onClose","onGoBack","steps","intl","useIntl","closeButton","CloseButton","size","onClick","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","newAvatar","displayGoBack","className","clsx","children","FlowHeader","leftContent","_jsxs","_Fragment","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedLabel","activeLabel","rightContent","bottomContent","Stepper","layout","Layout","VERTICAL","HORIZONTAL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BMA,MAAAA,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAA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1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var reactIntl = require('react-intl');
4
6
 
5
7
  var messages = reactIntl.defineMessages({
@@ -8,5 +10,5 @@ var messages = reactIntl.defineMessages({
8
10
  }
9
11
  });
10
12
 
11
- module.exports = messages;
13
+ exports.default = messages;
12
14
  //# sourceMappingURL=FlowNavigation.messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowNavigation.messages.js","sources":["../../src/flowNavigation/FlowNavigation.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n back: {\n id: 'neptune.FlowNavigation.back',\n defaultMessage: 'back to previous step',\n },\n});\n"],"names":["defineMessages","back","id"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA,6BAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"FlowNavigation.messages.js","sources":["../../src/flowNavigation/FlowNavigation.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n back: {\n id: 'neptune.FlowNavigation.back',\n defaultMessage: 'back to previous step',\n },\n});\n"],"names":["defineMessages","back","id"],"mappings":";;;;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,IAAI,EAAE;IACJC,EAAE,EAAA,6BAAA;AAEH,GAAA;AACF,CAAA,CAAC;;;;"}
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var clsx = require('clsx');
4
6
  var React = require('react');
5
7
  var BottomSheet = require('../../common/bottomSheet/BottomSheet.js');
@@ -49,7 +51,7 @@ const AnimatedLabel = ({
49
51
  children: [label, " ", /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {})]
50
52
  }, previousIndex);
51
53
  })
52
- }), /*#__PURE__*/jsxRuntime.jsx(BottomSheet, {
54
+ }), /*#__PURE__*/jsxRuntime.jsx(BottomSheet.default, {
53
55
  role: "menu",
54
56
  "aria-labelledby": labelId,
55
57
  open: showSteps,
@@ -60,7 +62,7 @@ const AnimatedLabel = ({
60
62
  const isCurrentStep = activeLabel === index;
61
63
  const isDisabled = activeLabel < index;
62
64
  const itemId = `step-${index}`;
63
- return /*#__PURE__*/jsxRuntime.jsx(Option, {
65
+ return /*#__PURE__*/jsxRuntime.jsx(Option.default, {
64
66
  id: itemId,
65
67
  as: "li",
66
68
  role: "menuitem",
@@ -97,5 +99,5 @@ const AnimatedLabel = ({
97
99
  });
98
100
  };
99
101
 
100
- module.exports = AnimatedLabel;
102
+ exports.default = AnimatedLabel;
101
103
  //# sourceMappingURL=AnimatedLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedLabel.js","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const previousIndex = index - 1;\n return (\n <div\n key={previousIndex}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', 'align-items-center', {\n 'np-animated-label--active text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"m-b-0 p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","previousIndex","ChevronDown","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","size","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;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EP,IAAI,CAACT,KAAM;kBAClBiB,OAAO,EAAER,IAAI,CAACS,UAAW;AACzBC,kBAAAA,MAAM,EAAEjB,aAAa,gBAAGf,cAAA,CAACiC,WAAK,EAAA;AAACC,oBAAAA,IAAI,EAAE,EAAA;oBAAM,GAAG,IAAK;AACnD,kBAAA,cAAA,EAAcnB,aAAa,GAAG,MAAM,GAAG,KAAM;AAC7C,kBAAA,eAAA,EAAeQ,UAAW;AAC1BY,kBAAAA,QAAQ,EAAEZ,UAAW;kBACrBa,kBAAkB,EAAA,IAAA;kBAAA,IACb,CAACb,UAAU,IAAI;AAClBc,oBAAAA,QAAQ,EAAE,CAAC;AACXtC,oBAAAA,OAAO,EAAED,gBAAgB,CAACwB,IAAI,CAACvB,OAAO,CAAC;oBACvCuC,SAAS,EAAGC,KAAK,IAAI;sBACnBA,KAAK,CAACC,cAAc,EAAE,CAAA;sBACtB,IAAID,KAAK,CAACE,IAAI,KAAK,OAAO,IAAIF,KAAK,CAACE,IAAI,KAAK,OAAO,EAAE;AACpD3C,wBAAAA,gBAAgB,CAACwB,IAAI,CAACvB,OAAO,CAAC,EAAE,CAAA;AAClC,uBAAA;AACF,qBAAA;mBACD,CAAA;AAAA,iBAAA,EAxBIyB,MAyBL,CAAA,CAAA;eAEL,CAAA;aACG,CAAA;AACR,WAAa,CACf,CAAA;AAAA,SAAA,CAAG,CAAA;AAEP,OAAA;KACyB,CAAA;AAC7B,GAAmB,CAAC,CAAA;AAExB;;;;"}
1
+ {"version":3,"file":"AnimatedLabel.js","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const previousIndex = index - 1;\n return (\n <div\n key={previousIndex}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', 'align-items-center', {\n 'np-animated-label--active text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"m-b-0 p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","previousIndex","ChevronDown","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","size","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;;;;;;;;;AAgBMA,MAAAA,aAAa,GAAGA,CAAC;EAAEC,WAAW;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAA2B,CAAA,KAAI;AAC9E,EAAA,MAAMC,OAAO,GAAGC,WAAK,EAAE,CAAA;EACvB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC,CAAA;EAEjD,SAASC,gBAAgBA,CAACC,OAAwB,EAAA;AAChD,IAAA,OAAO,MAAK;MACVH,YAAY,CAAC,KAAK,CAAC,CAAA;AACnBG,MAAAA,OAAO,IAAI,CAAA;KACZ,CAAA;AACH,GAAA;EAEA,oBACEC,cAAA,CAACC,mCAAiB,EAAA;AAACC,IAAAA,IAAI,EAAEP,SAAU;AAAAQ,IAAAA,QAAA,eACjCH,cAAA,CAACI,kCAAgB,CAACC,QAAQ,EAAA;MAAAF,QAAA,EACtBG,SAAS,IAAI;QACb,oBACEC,eAAA,CAAAC,mBAAA,EAAA;AAAAL,UAAAA,QAAA,gBACEH,cAAA,CAAA,QAAA,EAAA;AACES,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,EAAE,EAAEjB,OAAQ;AACZ,YAAA,eAAA,EAAc,MAAM;AACpB,YAAA,eAAA,EAAea,SAAU;AACzB,YAAA,eA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AAA;AACR,WAAa,CACf,CAAA;AAAA,SAAA,CAAG,CAAA;AAEP,OAAA;KACyB,CAAA;AAC7B,GAAmB,CAAC,CAAA;AAExB;;;;"}
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var clsx = require('clsx');
6
- var Button_resolver = require('../button/Button.resolver.js');
7
6
  require('../common/theme.js');
8
7
  require('../common/direction.js');
9
8
  require('../common/propsValues/control.js');
@@ -24,78 +23,120 @@ require('../common/propsValues/scroll.js');
24
23
  require('../common/propsValues/markdownNodeType.js');
25
24
  require('../common/fileType.js');
26
25
  require('@transferwise/icons');
27
- require('react');
26
+ var React = require('react');
28
27
  require('react-intl');
29
28
  require('../common/closeButton/CloseButton.messages.js');
30
29
  var jsxRuntime = require('react/jsx-runtime');
31
30
  var Link = require('../link/Link.js');
31
+ var Button_resolver = require('../button/Button.resolver.js');
32
32
  var Title = require('../title/Title.js');
33
33
 
34
- const HeaderAction = ({
34
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
35
+
36
+ var React__default = /*#__PURE__*/_interopDefault(React);
37
+
38
+ const HeaderAction = /*#__PURE__*/React__default.default.forwardRef(({
35
39
  action
36
- }) => {
37
- const props = {
38
- 'aria-label': action['aria-label']
39
- };
40
+ }, ref) => {
41
+ const {
42
+ 'aria-label': ariaLabel,
43
+ text,
44
+ onClick
45
+ } = action;
40
46
  if ('href' in action) {
41
- return /*#__PURE__*/jsxRuntime.jsx(Link, {
42
- href: action.href,
43
- target: action.target,
44
- onClick: action.onClick,
45
- ...props,
46
- children: action.text
47
+ const {
48
+ href,
49
+ target,
50
+ onClick: linkOnClick
51
+ } = action;
52
+ return /*#__PURE__*/jsxRuntime.jsx(Link.default, {
53
+ ref: ref,
54
+ className: "np-header__link",
55
+ href: href,
56
+ target: target,
57
+ "aria-label": ariaLabel,
58
+ onClick: linkOnClick,
59
+ children: text
47
60
  });
48
61
  }
49
- return /*#__PURE__*/jsxRuntime.jsx(Button_resolver, {
62
+ return /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
63
+ ref: ref,
50
64
  className: "np-header__button",
51
65
  priority: "tertiary",
52
66
  size: "sm",
53
- onClick: action.onClick,
54
- ...props,
55
- children: action.text
67
+ "aria-label": ariaLabel,
68
+ onClick: onClick,
69
+ children: text
56
70
  });
57
- };
71
+ });
72
+ HeaderAction.displayName = 'HeaderAction';
58
73
  /**
74
+ * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.
75
+ * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.
76
+ * @param {string} title - Required prop to set the title of the section header.
77
+ * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.
78
+ * @param {string} [className]
79
+ * @param {string} [testId]
59
80
  *
60
- * Neptune Web: https://transferwise.github.io/neptune-web/components/content/Header
61
- *
81
+ * @see {@link Header } for further information.
82
+ * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}
62
83
  */
63
- const Header = ({
64
- id,
65
- action,
84
+ const Header = /*#__PURE__*/React__default.default.forwardRef(({
66
85
  as = 'h5',
67
- title,
86
+ action,
68
87
  className,
69
- role = undefined
70
- }) => {
71
- if (!action) {
72
- return /*#__PURE__*/jsxRuntime.jsx(Title, {
88
+ testId,
89
+ title,
90
+ level = 'group',
91
+ ...props
92
+ }, ref) => {
93
+ const internalRef = React.useRef(null);
94
+ const levelTypography = level === 'section' ? typography.Typography.TITLE_SUBSECTION : typography.Typography.TITLE_GROUP;
95
+ const headerClasses = clsx.clsx('np-header', className, {
96
+ 'np-header--section': level === 'section',
97
+ 'np-header__title': !action || as === 'legend'
98
+ });
99
+ const commonProps = {
100
+ className: headerClasses,
101
+ 'data-testid': testId
102
+ };
103
+ React.useEffect(() => {
104
+ if (as === 'legend' && internalRef.current) {
105
+ const {
106
+ parentElement
107
+ } = internalRef.current;
108
+ if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {
109
+ console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
110
+ }
111
+ }
112
+ }, [as]);
113
+ if (!action || as === 'legend') {
114
+ return /*#__PURE__*/jsxRuntime.jsx(Title.default, {
115
+ ref: internalRef,
73
116
  as: as,
74
- id: id,
75
- role: role,
76
- type: typography.Typography.TITLE_GROUP,
77
- className: clsx.clsx('np-header', 'np-header__title', className),
117
+ type: levelTypography,
118
+ ...commonProps,
119
+ ...props,
78
120
  children: title
79
121
  });
80
122
  }
81
- if (as === 'legend') {
82
- // eslint-disable-next-line no-console
83
- console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
84
- }
123
+ const actionRef = /*#__PURE__*/React__default.default.createRef();
85
124
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
86
- className: clsx.clsx('np-header', className),
87
- children: [/*#__PURE__*/jsxRuntime.jsx(Title, {
125
+ ...commonProps,
126
+ ...props,
127
+ ref: ref,
128
+ children: [/*#__PURE__*/jsxRuntime.jsx(Title.default, {
88
129
  as: as,
89
- type: typography.Typography.TITLE_GROUP,
90
- id: id,
130
+ type: levelTypography,
91
131
  className: "np-header__title",
92
132
  children: title
93
133
  }), /*#__PURE__*/jsxRuntime.jsx(HeaderAction, {
134
+ ref: actionRef,
94
135
  action: action
95
136
  })]
96
137
  });
97
- };
138
+ });
139
+ Header.displayName = 'Header';
98
140
 
99
- exports.Header = Header;
100
141
  exports.default = Header;
101
142
  //# sourceMappingURL=Header.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { ActionButtonProps } from '../actionButton/ActionButton';\nimport Button from '../button';\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Title from '../title';\nimport { HTMLAttributes } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n};\n\ntype ButtonActionProps = ActionProps & ActionButtonProps;\n\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport type HeaderProps = CommonProps & {\n /**\n * When the `href` property is provided to the `action`, we will render a `Link` instead of a `ActionButton`.\n */\n action?: ButtonActionProps | LinkActionProps;\n /**\n * Override the heading element rendered for the title, useful to specify the semantics of your header.\n *\n * @default \"h5\"\n */\n as?: Heading | 'legend' | 'header';\n title: string;\n} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'id'>;\n\nconst HeaderAction = ({ action }: { action: ButtonActionProps | LinkActionProps }) => {\n const props = {\n 'aria-label': action['aria-label'],\n };\n\n if ('href' in action) {\n return (\n <Link href={action.href} target={action.target} onClick={action.onClick} {...props}>\n {action.text}\n </Link>\n );\n }\n\n return (\n <Button\n className=\"np-header__button\"\n priority=\"tertiary\"\n size=\"sm\"\n onClick={action.onClick}\n {...props}\n >\n {action.text}\n </Button>\n );\n};\n\n/**\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/content/Header\n *\n */\nexport const Header = ({\n id,\n action,\n as = 'h5',\n title,\n className,\n role = undefined,\n}: HeaderProps) => {\n if (!action) {\n return (\n <Title\n as={as}\n id={id}\n role={role}\n type={Typography.TITLE_GROUP}\n className={clsx('np-header', 'np-header__title', className)}\n >\n {title}\n </Title>\n );\n }\n\n if (as === 'legend') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n\n return (\n <div className={clsx('np-header', className)}>\n <Title as={as} type={Typography.TITLE_GROUP} id={id} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction action={action} />\n </div>\n );\n};\n\nexport default Header;\n"],"names":["HeaderAction","action","props","_jsx","Link","href","target","onClick","children","text","Button","className","priority","size","Header","id","as","title","role","undefined","Title","type","Typography","TITLE_GROUP","clsx","console","warn","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,YAAY,GAAGA,CAAC;AAAEC,EAAAA,MAAAA;AAAM,CAAmD,KAAI;AACnF,EAAA,MAA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O,CAACC,IAAI,CACV,oGAAoG,CACrG,CAAA;AACH,GAAA;AAEA,EAAA,oBACEC,eAAA,CAAA,KAAA,EAAA;AAAKhB,IAAAA,SAAS,EAAEa,SAAI,CAAC,WAAW,EAAEb,SAAS,CAAE;IAAAH,QAAA,EAAA,cAC3CL,cAAA,CAACiB,KAAK,EAAA;AAACJ,MAAAA,EAAE,EAAEA,EAAG;MAACK,IAAI,EAAEC,qBAAU,CAACC,WAAY;AAACR,MAAAA,EAAE,EAAEA,EAAG;AAACJ,MAAAA,SAAS,EAAC,kBAAkB;AAAAH,MAAAA,QAAA,EAC9ES,KAAAA;AAAK,KACD,CACP,eAAAd,cAAA,CAACH,YAAY,EAAA;AAACC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAC/B,CAAA,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../src/header/Header.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { AriaLabelProperty, CommonProps, Heading, LinkProps, Typography } from '../common';\nimport Link from '../link';\nimport Button from '../button';\nimport Title from '../title';\nimport React, { useEffect, useRef, FunctionComponent } from 'react';\n\ntype ActionProps = AriaLabelProperty & {\n text: string;\n onClick?: () => void;\n};\n\ntype ButtonActionProps = ActionProps;\ntype LinkActionProps = ActionProps & LinkProps;\n\nexport interface HeaderProps extends CommonProps {\n /**\n * Optional prop to define the action for the header. If the `href` property\n * is provided, a `Link` will be rendered instead of a `Button`.\n */\n action?: ButtonActionProps | LinkActionProps;\n\n /**\n * Option prop to specify DOM render element of the title\n *\n * - When `as=\"legend\"`, the `Header` will render as a `<legend>` element.\n * **Note:** `<legend>` elements must be the first child of a `<fieldset>` to comply with HTML semantics.\n * If this condition is not met, a warning will be logged to the console.\n * Additionally, the `action` prop is not supported when `as=\"legend\"`.\n *\n * - Other valid values include standard heading tags (`h1` to `h6`) or `header`.\n */\n as?: Heading | 'legend' | 'header';\n\n /** Required prop to set the title of the Header. */\n title: string;\n\n /** Optional prop to specify the level of the Header */\n level?: 'section' | 'group';\n\n className?: string;\n testId?: string;\n}\n\n/**\n * Renders a header action which can be either a button or a link.\n *\n * @param {Object} props - The properties object.\n * @param {ButtonActionProps | LinkActionProps} props.action - The action object which can be either a button or a link.\n * @returns {JSX.Element} The rendered header action component.\n */\nconst HeaderAction = React.forwardRef(\n (\n { action }: { action: ButtonActionProps | LinkActionProps },\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n ) => {\n const { 'aria-label': ariaLabel, text, onClick } = action;\n\n if ('href' in action) {\n const { href, target, onClick: linkOnClick } = action;\n return (\n <Link\n ref={ref as React.Ref<HTMLAnchorElement>}\n className=\"np-header__link\"\n href={href}\n target={target}\n aria-label={ariaLabel}\n onClick={linkOnClick}\n >\n {text}\n </Link>\n );\n }\n\n return (\n <Button\n ref={ref as React.Ref<HTMLButtonElement>}\n className=\"np-header__button\"\n priority=\"tertiary\"\n size=\"sm\"\n aria-label={ariaLabel}\n onClick={onClick}\n >\n {text}\n </Button>\n );\n },\n);\n\nHeaderAction.displayName = 'HeaderAction';\n\n/**\n * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.\n * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.\n * @param {string} title - Required prop to set the title of the section header.\n * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.\n * @param {string} [className]\n * @param {string} [testId]\n *\n * @see {@link Header } for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}\n */\nconst Header: FunctionComponent<HeaderProps> = React.forwardRef(\n (\n { as = 'h5', action, className, testId, title, level = 'group', ...props },\n ref: React.Ref<HTMLDivElement | HTMLHeadingElement | HTMLLegendElement>,\n ) => {\n const internalRef = useRef<HTMLLegendElement>(null);\n const levelTypography =\n level === 'section' ? Typography.TITLE_SUBSECTION : Typography.TITLE_GROUP;\n const headerClasses = clsx('np-header', className, {\n 'np-header--section': level === 'section',\n 'np-header__title': !action || as === 'legend',\n });\n\n const commonProps = {\n className: headerClasses,\n 'data-testid': testId,\n };\n\n useEffect(() => {\n if (as === 'legend' && internalRef.current) {\n const { parentElement } = internalRef.current;\n if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {\n console.warn(\n 'Legends should be the first child in a fieldset, and this is not possible when including an action',\n );\n }\n }\n }, [as]);\n\n if (!action || as === 'legend') {\n return (\n <Title ref={internalRef} as={as} type={levelTypography} {...commonProps} {...props}>\n {title}\n </Title>\n );\n }\n\n const actionRef = React.createRef<HTMLButtonElement | HTMLAnchorElement>();\n\n return (\n <div {...commonProps} {...props} ref={ref as React.Ref<HTMLDivElement>}>\n <Title as={as} type={levelTypography} className=\"np-header__title\">\n {title}\n </Title>\n <HeaderAction ref={actionRef} action={action} />\n </div>\n );\n },\n);\n\nHeader.displayName = 'Header';\n\nexport default Header;\n"],"names":["HeaderAction","React","forwardRef","action","ref","ariaLabel","text","onClick","href","target","linkOnClick","_jsx","Link","className","children","Button","priority","size","displayName","Header","as","testId","title","level","props","internalRef","useRef","levelTypography","Typography","TITLE_SUBSECTION","TITLE_GROUP","headerClasses","clsx","commonProps","useEffect","current","parentElement","tagName","toLowerCase","console","warn","Title","type","actionRef","createRef","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAMA,YAAY,gBAAGC,sBAAK,CAACC,UAAU,CACnC,CACE;AAAEC,EAAAA,MAAAA;AAAM,CAAmD,EAC3DC,GAAqD,KACnD;EACF,MAAM;AAAE,IAAA,YAAY,EAAEC,SAAS;IAAEC,IAAI;AAAEC,IAAAA,OAAAA;AAAO,GAAE,GAAGJ,MAAM,CAAA;EAEzD,IAAI,MAAM,IAAIA,MAAM,EAAE;IACpB,MAAM;MAAEK,IAAI;MAAEC,MAAM;AAAEF,MAAAA,OAAO,EAAEG,WAAAA;AAAW,KAAE,GAAGP,MAAM,CAAA;IACrD,oBACEQ,cAAA,CA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SAAS,EAAC,kBAAkB;AAAAC,MAAAA,QAAA,EAC/DQ,KAAAA;AAAK,KACD,CACP,eAAAX,cAAA,CAACX,YAAY,EAAA;AAACI,MAAAA,GAAG,EAAEuC,SAAU;AAACxC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAC/C,CAAA,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV,CAAC,EACF;AAEDgB,MAAM,CAACD,WAAW,GAAG,QAAQ;;;;"}
@@ -1,5 +1,4 @@
1
1
  import { clsx } from 'clsx';
2
- import Button from '../button/Button.resolver.mjs';
3
2
  import '../common/theme.mjs';
4
3
  import '../common/direction.mjs';
5
4
  import '../common/propsValues/control.mjs';
@@ -20,77 +19,116 @@ import '../common/propsValues/scroll.mjs';
20
19
  import '../common/propsValues/markdownNodeType.mjs';
21
20
  import '../common/fileType.mjs';
22
21
  import '@transferwise/icons';
23
- import 'react';
22
+ import React__default, { useRef, useEffect } from 'react';
24
23
  import 'react-intl';
25
24
  import '../common/closeButton/CloseButton.messages.mjs';
26
25
  import { jsx, jsxs } from 'react/jsx-runtime';
27
26
  import Link from '../link/Link.mjs';
27
+ import Button from '../button/Button.resolver.mjs';
28
28
  import Title from '../title/Title.mjs';
29
29
 
30
- const HeaderAction = ({
30
+ const HeaderAction = /*#__PURE__*/React__default.forwardRef(({
31
31
  action
32
- }) => {
33
- const props = {
34
- 'aria-label': action['aria-label']
35
- };
32
+ }, ref) => {
33
+ const {
34
+ 'aria-label': ariaLabel,
35
+ text,
36
+ onClick
37
+ } = action;
36
38
  if ('href' in action) {
39
+ const {
40
+ href,
41
+ target,
42
+ onClick: linkOnClick
43
+ } = action;
37
44
  return /*#__PURE__*/jsx(Link, {
38
- href: action.href,
39
- target: action.target,
40
- onClick: action.onClick,
41
- ...props,
42
- children: action.text
45
+ ref: ref,
46
+ className: "np-header__link",
47
+ href: href,
48
+ target: target,
49
+ "aria-label": ariaLabel,
50
+ onClick: linkOnClick,
51
+ children: text
43
52
  });
44
53
  }
45
54
  return /*#__PURE__*/jsx(Button, {
55
+ ref: ref,
46
56
  className: "np-header__button",
47
57
  priority: "tertiary",
48
58
  size: "sm",
49
- onClick: action.onClick,
50
- ...props,
51
- children: action.text
59
+ "aria-label": ariaLabel,
60
+ onClick: onClick,
61
+ children: text
52
62
  });
53
- };
63
+ });
64
+ HeaderAction.displayName = 'HeaderAction';
54
65
  /**
66
+ * @param {ButtonActionProps | LinkActionProps} [action] - Optional prop to specify the action button or link.
67
+ * @param {Heading | 'legend'} [as='h5'] - Optional prop to override the heading element rendered for the title.
68
+ * @param {string} title - Required prop to set the title of the section header.
69
+ * @param {'group' | 'section'} [level='group'] - Optional prop to specify the level of the section header.
70
+ * @param {string} [className]
71
+ * @param {string} [testId]
55
72
  *
56
- * Neptune Web: https://transferwise.github.io/neptune-web/components/content/Header
57
- *
73
+ * @see {@link Header } for further information.
74
+ * @see {@link https://storybook.wise.design/?path=/docs/typography-header--docs|Storybook Wise Design}
58
75
  */
59
- const Header = ({
60
- id,
61
- action,
76
+ const Header = /*#__PURE__*/React__default.forwardRef(({
62
77
  as = 'h5',
63
- title,
78
+ action,
64
79
  className,
65
- role = undefined
66
- }) => {
67
- if (!action) {
80
+ testId,
81
+ title,
82
+ level = 'group',
83
+ ...props
84
+ }, ref) => {
85
+ const internalRef = useRef(null);
86
+ const levelTypography = level === 'section' ? Typography.TITLE_SUBSECTION : Typography.TITLE_GROUP;
87
+ const headerClasses = clsx('np-header', className, {
88
+ 'np-header--section': level === 'section',
89
+ 'np-header__title': !action || as === 'legend'
90
+ });
91
+ const commonProps = {
92
+ className: headerClasses,
93
+ 'data-testid': testId
94
+ };
95
+ useEffect(() => {
96
+ if (as === 'legend' && internalRef.current) {
97
+ const {
98
+ parentElement
99
+ } = internalRef.current;
100
+ if (!parentElement || parentElement.tagName.toLowerCase() !== 'fieldset') {
101
+ console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
102
+ }
103
+ }
104
+ }, [as]);
105
+ if (!action || as === 'legend') {
68
106
  return /*#__PURE__*/jsx(Title, {
107
+ ref: internalRef,
69
108
  as: as,
70
- id: id,
71
- role: role,
72
- type: Typography.TITLE_GROUP,
73
- className: clsx('np-header', 'np-header__title', className),
109
+ type: levelTypography,
110
+ ...commonProps,
111
+ ...props,
74
112
  children: title
75
113
  });
76
114
  }
77
- if (as === 'legend') {
78
- // eslint-disable-next-line no-console
79
- console.warn('Legends should be the first child in a fieldset, and this is not possible when including an action');
80
- }
115
+ const actionRef = /*#__PURE__*/React__default.createRef();
81
116
  return /*#__PURE__*/jsxs("div", {
82
- className: clsx('np-header', className),
117
+ ...commonProps,
118
+ ...props,
119
+ ref: ref,
83
120
  children: [/*#__PURE__*/jsx(Title, {
84
121
  as: as,
85
- type: Typography.TITLE_GROUP,
86
- id: id,
122
+ type: levelTypography,
87
123
  className: "np-header__title",
88
124
  children: title
89
125
  }), /*#__PURE__*/jsx(HeaderAction, {
126
+ ref: actionRef,
90
127
  action: action
91
128
  })]
92
129
  });
93
- };
130
+ });
131
+ Header.displayName = 'Header';
94
132
 
95
- export { Header, Header as default };
133
+ export { Header as default };
96
134
  //# sourceMappingURL=Header.mjs.map