@transferwise/components 37.0.0 → 37.0.1-beta.23

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 (371) hide show
  1. package/CHANGELOG.md +264 -0
  2. package/build/es/no-polyfill/accordion/Accordion.js +1 -1
  3. package/build/es/no-polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
  4. package/build/es/no-polyfill/actionOption/ActionOption.js +1 -1
  5. package/build/es/no-polyfill/actionOption/ActionOption.story.js +1 -1
  6. package/build/es/no-polyfill/alert/Alert.js +1 -1
  7. package/build/es/no-polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  8. package/build/es/no-polyfill/alert/withArrow/withArrow.js +1 -1
  9. package/build/es/no-polyfill/avatar/Avatar.js +1 -1
  10. package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.js +1 -1
  11. package/build/es/no-polyfill/badge/Badge.js +1 -1
  12. package/build/es/no-polyfill/button/Button.js +1 -2
  13. package/build/es/no-polyfill/card/Card.js +2 -5
  14. package/build/es/no-polyfill/checkbox/Checkbox.js +1 -1
  15. package/build/es/no-polyfill/checkboxButton/CheckboxButton.js +1 -1
  16. package/build/es/no-polyfill/checkboxOption/CheckboxOption.js +1 -1
  17. package/build/es/no-polyfill/chevron/Chevron.js +1 -1
  18. package/build/es/no-polyfill/chip/Chip.js +8 -2
  19. package/build/es/no-polyfill/circularButton/CircularButton.js +1 -1
  20. package/build/es/no-polyfill/common/Option/Option.js +1 -1
  21. package/build/es/no-polyfill/common/Option/OptionDocumentation.js +1 -0
  22. package/build/es/no-polyfill/common/RadioButton/RadioButton.js +1 -1
  23. package/build/es/no-polyfill/common/bottomSheet/BottomSheet.js +4 -6
  24. package/build/es/no-polyfill/common/closeButton/CloseButton.js +1 -1
  25. package/build/es/no-polyfill/common/focusBoundary/FocusBoundary.js +1 -1
  26. package/build/es/no-polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
  27. package/build/es/no-polyfill/common/focusBoundary/utils/resetFocus.js +2 -2
  28. package/build/es/no-polyfill/common/historyNavigator/historyNavigator.js +1 -1
  29. package/build/es/no-polyfill/common/hooks/useClientWidth/useClientWidth.js +2 -1
  30. package/build/es/no-polyfill/common/hooks/useConditionalListener/useConditionalListener.js +3 -5
  31. package/build/es/no-polyfill/common/hooks/useHasIntersected/useHasIntersected.js +3 -2
  32. package/build/es/no-polyfill/common/keyCodes.js +1 -0
  33. package/build/es/no-polyfill/common/panel/Panel.js +2 -3
  34. package/build/es/no-polyfill/common/requirements.js +2 -2
  35. package/build/es/no-polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
  36. package/build/es/no-polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
  37. package/build/es/no-polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
  38. package/build/es/no-polyfill/dateInput/DateInput.js +3 -4
  39. package/build/es/no-polyfill/dateInput/DateInput.messages.js +1 -0
  40. package/build/es/no-polyfill/dateLookup/DateLookup.js +1 -1
  41. package/build/es/no-polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  42. package/build/es/no-polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
  43. package/build/es/no-polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
  44. package/build/es/no-polyfill/dateLookup/header/Header.js +1 -1
  45. package/build/es/no-polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
  46. package/build/es/no-polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  47. package/build/es/no-polyfill/dateLookup/tableLink/TableLink.js +1 -1
  48. package/build/es/no-polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
  49. package/build/es/no-polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  50. package/build/es/no-polyfill/decision/Decision.js +5 -5
  51. package/build/es/no-polyfill/definitionList/DefinitionList.js +1 -1
  52. package/build/es/no-polyfill/dimmer/Dimmer.js +3 -3
  53. package/build/es/no-polyfill/drawer/Drawer.js +1 -1
  54. package/build/es/no-polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
  55. package/build/es/no-polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +2 -4
  56. package/build/es/no-polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
  57. package/build/es/no-polyfill/emphasis/Emphasis.js +1 -1
  58. package/build/es/no-polyfill/flowNavigation/FlowNavigation.js +1 -1
  59. package/build/es/no-polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  60. package/build/es/no-polyfill/flowNavigation/backButton/BackButton.js +1 -1
  61. package/build/es/no-polyfill/header/Header.js +1 -1
  62. package/build/es/no-polyfill/i18n/en.json +3 -2
  63. package/build/es/no-polyfill/i18n/index.js +1 -1
  64. package/build/es/no-polyfill/image/Image.js +4 -5
  65. package/build/es/no-polyfill/info/Info.js +1 -1
  66. package/build/es/no-polyfill/inlineAlert/InlineAlert.js +1 -1
  67. package/build/es/no-polyfill/instructionsList/InstructionsList.js +1 -1
  68. package/build/es/no-polyfill/lab/mobileNav/MobileNav.js +2 -2
  69. package/build/es/no-polyfill/lab/pagination/Pagination.js +1 -1
  70. package/build/es/no-polyfill/lab/pagination/paginationLink/PaginationLink.js +1 -1
  71. package/build/es/no-polyfill/link/Link.js +4 -3
  72. package/build/es/no-polyfill/link/Link.spec.js +1 -0
  73. package/build/es/no-polyfill/link/Link.story.js +1 -0
  74. package/build/es/no-polyfill/loader/Loader.js +7 -3
  75. package/build/es/no-polyfill/logo/Logo.js +1 -1
  76. package/build/es/no-polyfill/markdown/Markdown.js +1 -1
  77. package/build/es/no-polyfill/modal/Modal.js +1 -1
  78. package/build/es/no-polyfill/money/Money.js +1 -1
  79. package/build/es/no-polyfill/moneyInput/MoneyInput.js +1 -2
  80. package/build/es/no-polyfill/navigationOption/NavigationOption.js +1 -1
  81. package/build/es/no-polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
  82. package/build/es/no-polyfill/nudge/Nudge.js +1 -1
  83. package/build/es/no-polyfill/overlayHeader/OverlayHeader.js +1 -1
  84. package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  85. package/build/es/no-polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +2 -1
  86. package/build/es/no-polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +1 -0
  87. package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
  88. package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
  89. package/build/es/no-polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +1 -0
  90. package/build/es/no-polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +2 -0
  91. package/build/es/no-polyfill/popover/Popover.js +1 -1
  92. package/build/es/no-polyfill/processIndicator/ProcessIndicator.js +4 -1
  93. package/build/es/no-polyfill/provider/Provider.js +1 -1
  94. package/build/es/no-polyfill/provider/direction/DirectionProvider.js +1 -1
  95. package/build/es/no-polyfill/radio/Radio.js +1 -1
  96. package/build/es/no-polyfill/radioGroup/RadioGroup.js +2 -2
  97. package/build/es/no-polyfill/radioOption/RadioOption.js +1 -1
  98. package/build/es/no-polyfill/select/Select.js +3 -5
  99. package/build/es/no-polyfill/select/option/Option.js +1 -1
  100. package/build/es/no-polyfill/select/searchBox/SearchBox.js +1 -1
  101. package/build/es/no-polyfill/sizeSwapper/SizeSwapper.js +4 -2
  102. package/build/es/no-polyfill/slidingPanel/SlidingPanel.js +2 -2
  103. package/build/es/no-polyfill/snackbar/Snackbar.js +1 -1
  104. package/build/es/no-polyfill/snackbar/SnackbarProvider.js +1 -1
  105. package/build/es/no-polyfill/stepper/Stepper.js +1 -1
  106. package/build/es/no-polyfill/stepper/deviceDetection.js +2 -1
  107. package/build/es/no-polyfill/summary/Summary.js +1 -4
  108. package/build/es/no-polyfill/switch/Switch.js +1 -1
  109. package/build/es/no-polyfill/switch/Switch.story.js +1 -1
  110. package/build/es/no-polyfill/switchOption/SwitchOption.js +1 -1
  111. package/build/es/no-polyfill/switchOption/SwitchOption.story.js +1 -1
  112. package/build/es/no-polyfill/tabs/Tab.js +1 -1
  113. package/build/es/no-polyfill/tabs/Tabs.js +1 -1
  114. package/build/es/no-polyfill/tile/Tile.js +1 -1
  115. package/build/es/no-polyfill/tooltip/Tooltip.js +1 -1
  116. package/build/es/no-polyfill/typeahead/Typeahead.js +1 -2
  117. package/build/es/no-polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
  118. package/build/es/no-polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
  119. package/build/es/no-polyfill/typeahead/util/highlight.js +1 -1
  120. package/build/es/no-polyfill/upload/Upload.js +3 -5
  121. package/build/es/no-polyfill/upload/steps/completeStep/completeStep.js +1 -1
  122. package/build/es/no-polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
  123. package/build/es/no-polyfill/upload/steps/processingStep/processingStep.js +1 -1
  124. package/build/es/no-polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  125. package/build/es/no-polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
  126. package/build/es/no-polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +1 -1
  127. package/build/es/no-polyfill/upload/utils/index.js +1 -1
  128. package/build/es/no-polyfill/uploadInput/UploadInput.js +4 -6
  129. package/build/es/no-polyfill/uploadInput/UploadInput.spec.js +1 -1
  130. package/build/es/no-polyfill/uploadInput/UploadInput.story.js +1 -1
  131. package/build/es/no-polyfill/uploadInput/types.js +1 -0
  132. package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
  133. package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -1
  134. package/build/es/no-polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
  135. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
  136. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
  137. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
  138. package/build/es/no-polyfill/utilities/{deprecatedProp/deprecatedProp.js → deprecatedProperty/deprecatedProperty.js} +0 -0
  139. package/build/es/no-polyfill/utilities/deprecatedProperty/index.js +1 -0
  140. package/build/es/no-polyfill/utilities/index.js +1 -1
  141. package/build/es/no-polyfill/utilities/logActionRequired.js +1 -1
  142. package/build/es/no-polyfill/withDisplayFormat/WithDisplayFormat.js +2 -2
  143. package/build/es/no-polyfill/withNextPortal/withNextPortal.js +1 -1
  144. package/build/es/no-polyfill/withNormaliser/WithNormalizer.js +3 -0
  145. package/build/es/polyfill/accordion/Accordion.js +1 -1
  146. package/build/es/polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
  147. package/build/es/polyfill/actionOption/ActionOption.js +1 -1
  148. package/build/es/polyfill/actionOption/ActionOption.story.js +1 -1
  149. package/build/es/polyfill/alert/Alert.js +1 -1
  150. package/build/es/polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  151. package/build/es/polyfill/alert/withArrow/withArrow.js +1 -1
  152. package/build/es/polyfill/avatar/Avatar.js +1 -1
  153. package/build/es/polyfill/avatarWrapper/AvatarWrapper.js +1 -1
  154. package/build/es/polyfill/badge/Badge.js +1 -1
  155. package/build/es/polyfill/button/Button.js +1 -2
  156. package/build/es/polyfill/card/Card.js +2 -5
  157. package/build/es/polyfill/checkbox/Checkbox.js +1 -1
  158. package/build/es/polyfill/checkboxButton/CheckboxButton.js +1 -1
  159. package/build/es/polyfill/checkboxOption/CheckboxOption.js +1 -1
  160. package/build/es/polyfill/chevron/Chevron.js +1 -1
  161. package/build/es/polyfill/chip/Chip.js +8 -2
  162. package/build/es/polyfill/circularButton/CircularButton.js +1 -1
  163. package/build/es/polyfill/common/Option/Option.js +1 -1
  164. package/build/es/polyfill/common/Option/OptionDocumentation.js +1 -0
  165. package/build/es/polyfill/common/RadioButton/RadioButton.js +1 -1
  166. package/build/es/polyfill/common/bottomSheet/BottomSheet.js +4 -6
  167. package/build/es/polyfill/common/closeButton/CloseButton.js +1 -1
  168. package/build/es/polyfill/common/focusBoundary/FocusBoundary.js +1 -1
  169. package/build/es/polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
  170. package/build/es/polyfill/common/focusBoundary/utils/resetFocus.js +2 -2
  171. package/build/es/polyfill/common/historyNavigator/historyNavigator.js +1 -1
  172. package/build/es/polyfill/common/hooks/useClientWidth/useClientWidth.js +2 -1
  173. package/build/es/polyfill/common/hooks/useConditionalListener/useConditionalListener.js +3 -5
  174. package/build/es/polyfill/common/hooks/useHasIntersected/useHasIntersected.js +3 -2
  175. package/build/es/polyfill/common/keyCodes.js +1 -0
  176. package/build/es/polyfill/common/panel/Panel.js +2 -3
  177. package/build/es/polyfill/common/requirements.js +2 -2
  178. package/build/es/polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
  179. package/build/es/polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
  180. package/build/es/polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
  181. package/build/es/polyfill/dateInput/DateInput.js +3 -4
  182. package/build/es/polyfill/dateInput/DateInput.messages.js +1 -0
  183. package/build/es/polyfill/dateLookup/DateLookup.js +1 -1
  184. package/build/es/polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  185. package/build/es/polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
  186. package/build/es/polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
  187. package/build/es/polyfill/dateLookup/header/Header.js +1 -1
  188. package/build/es/polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
  189. package/build/es/polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  190. package/build/es/polyfill/dateLookup/tableLink/TableLink.js +1 -1
  191. package/build/es/polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
  192. package/build/es/polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  193. package/build/es/polyfill/decision/Decision.js +5 -5
  194. package/build/es/polyfill/definitionList/DefinitionList.js +1 -1
  195. package/build/es/polyfill/dimmer/Dimmer.js +3 -3
  196. package/build/es/polyfill/drawer/Drawer.js +1 -1
  197. package/build/es/polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
  198. package/build/es/polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +2 -4
  199. package/build/es/polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
  200. package/build/es/polyfill/emphasis/Emphasis.js +1 -1
  201. package/build/es/polyfill/flowNavigation/FlowNavigation.js +1 -1
  202. package/build/es/polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  203. package/build/es/polyfill/flowNavigation/backButton/BackButton.js +1 -1
  204. package/build/es/polyfill/header/Header.js +1 -1
  205. package/build/es/polyfill/i18n/en.json +3 -2
  206. package/build/es/polyfill/i18n/index.js +1 -1
  207. package/build/es/polyfill/image/Image.js +4 -5
  208. package/build/es/polyfill/info/Info.js +1 -1
  209. package/build/es/polyfill/inlineAlert/InlineAlert.js +1 -1
  210. package/build/es/polyfill/instructionsList/InstructionsList.js +1 -1
  211. package/build/es/polyfill/lab/mobileNav/MobileNav.js +2 -2
  212. package/build/es/polyfill/lab/pagination/Pagination.js +1 -1
  213. package/build/es/polyfill/lab/pagination/paginationLink/PaginationLink.js +1 -1
  214. package/build/es/polyfill/link/Link.js +4 -3
  215. package/build/es/polyfill/link/Link.spec.js +1 -0
  216. package/build/es/polyfill/link/Link.story.js +1 -0
  217. package/build/es/polyfill/loader/Loader.js +7 -3
  218. package/build/es/polyfill/logo/Logo.js +1 -1
  219. package/build/es/polyfill/markdown/Markdown.js +1 -1
  220. package/build/es/polyfill/modal/Modal.js +1 -1
  221. package/build/es/polyfill/money/Money.js +1 -1
  222. package/build/es/polyfill/moneyInput/MoneyInput.js +1 -2
  223. package/build/es/polyfill/navigationOption/NavigationOption.js +1 -1
  224. package/build/es/polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
  225. package/build/es/polyfill/nudge/Nudge.js +1 -1
  226. package/build/es/polyfill/overlayHeader/OverlayHeader.js +1 -1
  227. package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  228. package/build/es/polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +3 -2
  229. package/build/es/polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +1 -0
  230. package/build/es/polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
  231. package/build/es/polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
  232. package/build/es/polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +1 -0
  233. package/build/es/polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +2 -0
  234. package/build/es/polyfill/popover/Popover.js +1 -1
  235. package/build/es/polyfill/processIndicator/ProcessIndicator.js +4 -1
  236. package/build/es/polyfill/provider/Provider.js +1 -1
  237. package/build/es/polyfill/provider/direction/DirectionProvider.js +1 -1
  238. package/build/es/polyfill/radio/Radio.js +1 -1
  239. package/build/es/polyfill/radioGroup/RadioGroup.js +2 -2
  240. package/build/es/polyfill/radioOption/RadioOption.js +1 -1
  241. package/build/es/polyfill/select/Select.js +3 -5
  242. package/build/es/polyfill/select/option/Option.js +1 -1
  243. package/build/es/polyfill/select/searchBox/SearchBox.js +1 -1
  244. package/build/es/polyfill/sizeSwapper/SizeSwapper.js +4 -2
  245. package/build/es/polyfill/slidingPanel/SlidingPanel.js +2 -2
  246. package/build/es/polyfill/snackbar/Snackbar.js +1 -1
  247. package/build/es/polyfill/snackbar/SnackbarProvider.js +1 -1
  248. package/build/es/polyfill/stepper/Stepper.js +1 -1
  249. package/build/es/polyfill/stepper/deviceDetection.js +2 -1
  250. package/build/es/polyfill/summary/Summary.js +1 -4
  251. package/build/es/polyfill/switch/Switch.js +1 -1
  252. package/build/es/polyfill/switch/Switch.story.js +1 -1
  253. package/build/es/polyfill/switchOption/SwitchOption.js +1 -1
  254. package/build/es/polyfill/switchOption/SwitchOption.story.js +1 -1
  255. package/build/es/polyfill/tabs/Tab.js +1 -1
  256. package/build/es/polyfill/tabs/Tabs.js +1 -1
  257. package/build/es/polyfill/tile/Tile.js +1 -1
  258. package/build/es/polyfill/tooltip/Tooltip.js +1 -1
  259. package/build/es/polyfill/typeahead/Typeahead.js +1 -2
  260. package/build/es/polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
  261. package/build/es/polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
  262. package/build/es/polyfill/typeahead/util/highlight.js +1 -1
  263. package/build/es/polyfill/upload/Upload.js +3 -5
  264. package/build/es/polyfill/upload/steps/completeStep/completeStep.js +1 -1
  265. package/build/es/polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
  266. package/build/es/polyfill/upload/steps/processingStep/processingStep.js +1 -1
  267. package/build/es/polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  268. package/build/es/polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
  269. package/build/es/polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +2 -2
  270. package/build/es/polyfill/upload/utils/index.js +1 -1
  271. package/build/es/polyfill/uploadInput/UploadInput.js +4 -6
  272. package/build/es/polyfill/uploadInput/UploadInput.spec.js +1 -1
  273. package/build/es/polyfill/uploadInput/UploadInput.story.js +1 -1
  274. package/build/es/polyfill/uploadInput/types.js +1 -0
  275. package/build/es/polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
  276. package/build/es/polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -1
  277. package/build/es/polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
  278. package/build/es/polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
  279. package/build/es/polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
  280. package/build/es/polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
  281. package/build/es/polyfill/utilities/{deprecatedProp/deprecatedProp.js → deprecatedProperty/deprecatedProperty.js} +0 -0
  282. package/build/es/polyfill/utilities/deprecatedProperty/index.js +1 -0
  283. package/build/es/polyfill/utilities/index.js +1 -1
  284. package/build/es/polyfill/utilities/logActionRequired.js +1 -1
  285. package/build/es/polyfill/withDisplayFormat/WithDisplayFormat.js +2 -2
  286. package/build/es/polyfill/withNextPortal/withNextPortal.js +1 -1
  287. package/build/es/polyfill/withNormaliser/WithNormalizer.js +3 -0
  288. package/build/i18n/en.json +3 -2
  289. package/build/main.css +1 -1
  290. package/build/styles/accordion/Accordion.css +1 -1
  291. package/build/styles/avatar/Avatar.css +1 -1
  292. package/build/styles/card/Card.css +1 -1
  293. package/build/styles/chip/Chip.css +1 -1
  294. package/build/styles/circularButton/CircularButton.css +1 -1
  295. package/build/styles/common/RadioButton/RadioButton.css +1 -1
  296. package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
  297. package/build/styles/common/closeButton/CloseButton.css +1 -1
  298. package/build/styles/dateLookup/DateLookup.css +1 -1
  299. package/build/styles/dateLookup/dateTrigger/DateTrigger.css +1 -1
  300. package/build/styles/drawer/Drawer.css +1 -1
  301. package/build/styles/emphasis/Emphasis.css +1 -1
  302. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  303. package/build/styles/flowNavigation/backButton/BackButton.css +1 -1
  304. package/build/styles/info/Info.css +1 -1
  305. package/build/styles/instructionsList/InstructionsList.css +1 -1
  306. package/build/styles/lab/mobileNav/MobileNav.css +1 -1
  307. package/build/styles/lab/pagination/Pagination.css +1 -1
  308. package/build/styles/loader/Loader.css +1 -1
  309. package/build/styles/main.css +1 -1
  310. package/build/styles/moneyInput/MoneyInput.css +1 -1
  311. package/build/styles/navigationOption/NavigationOption.css +1 -1
  312. package/build/styles/nudge/Nudge.css +1 -1
  313. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  314. package/build/styles/popover/Popover.css +1 -1
  315. package/build/styles/snackbar/Snackbar.css +1 -1
  316. package/build/styles/stepper/Stepper.css +1 -1
  317. package/build/styles/summary/Summary.css +1 -1
  318. package/build/styles/switch/Switch.css +1 -1
  319. package/build/styles/tabs/Tabs.css +1 -1
  320. package/build/styles/tile/Tile.css +1 -1
  321. package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +1 -1
  322. package/build/styles/uploadInput/UploadInput.css +1 -1
  323. package/build/styles/uploadInput/uploadButton/UploadButton.css +1 -1
  324. package/build/styles/uploadInput/uploadItem/UploadItem.css +1 -1
  325. package/build/types/actionOption/ActionOption.story.d.ts +1 -1
  326. package/build/types/alert/Alert.d.ts +1 -1
  327. package/build/types/badge/Badge.d.ts +1 -1
  328. package/build/types/chip/Chip.d.ts +8 -2
  329. package/build/types/common/bottomSheet/BottomSheet.d.ts +3 -1
  330. package/build/types/common/commonProps.d.ts +1 -1
  331. package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +1 -1
  332. package/build/types/common/focusBoundary/utils/resetFocus.d.ts +1 -1
  333. package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts +4 -1
  334. package/build/types/{link/Link.messages.d.ts → dateInput/DateInput.messages.d.ts} +8 -5
  335. package/build/types/link/Link.d.ts +5 -4
  336. package/build/types/link/Link.spec.d.ts +1 -0
  337. package/build/types/link/Link.story.d.ts +9 -0
  338. package/build/types/loader/Loader.d.ts +6 -1
  339. package/build/types/modal/Modal.d.ts +0 -1
  340. package/build/types/nudge/Nudge.d.ts +1 -0
  341. package/build/types/switch/Switch.story.d.ts +2 -1
  342. package/build/types/switchOption/SwitchOption.story.d.ts +1 -1
  343. package/build/types/test-utils/index.d.ts +17 -5
  344. package/build/types/upload/Upload.d.ts +1 -1
  345. package/build/types/upload/utils/index.d.ts +0 -1
  346. package/build/types/uploadInput/UploadInput.d.ts +8 -4
  347. package/build/types/uploadInput/UploadInput.story.d.ts +11 -10
  348. package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -0
  349. package/build/types/uploadInput/uploadItem/UploadItem.d.ts +8 -1
  350. package/build/types/uploadInput/uploadItem/UploadItemBody.d.ts +3 -2
  351. package/build/types/utilities/{deprecatedProp/deprecatedProp.d.ts → deprecatedProperty/deprecatedProperty.d.ts} +2 -2
  352. package/build/types/utilities/deprecatedProperty/index.d.ts +1 -0
  353. package/build/types/utilities/index.d.ts +1 -1
  354. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +1 -1
  355. package/build/types/withNextPortal/withNextPortal.d.ts +1 -2
  356. package/build/umd/no-polyfill/main.js +1 -1
  357. package/build/umd/polyfill/main.js +1 -1
  358. package/package.json +18 -18
  359. package/build/es/no-polyfill/common/Option/OptionDocs.js +0 -1
  360. package/build/es/no-polyfill/link/Link.messages.js +0 -1
  361. package/build/es/no-polyfill/upload/utils/generateErrorMessage/generateErrorMessage.js +0 -1
  362. package/build/es/no-polyfill/upload/utils/generateErrorMessage/index.js +0 -1
  363. package/build/es/no-polyfill/utilities/deprecatedProp/index.js +0 -1
  364. package/build/es/polyfill/common/Option/OptionDocs.js +0 -1
  365. package/build/es/polyfill/link/Link.messages.js +0 -1
  366. package/build/es/polyfill/upload/utils/generateErrorMessage/generateErrorMessage.js +0 -1
  367. package/build/es/polyfill/upload/utils/generateErrorMessage/index.js +0 -1
  368. package/build/es/polyfill/utilities/deprecatedProp/index.js +0 -1
  369. package/build/types/upload/utils/generateErrorMessage/generateErrorMessage.d.ts +0 -1
  370. package/build/types/upload/utils/generateErrorMessage/index.d.ts +0 -1
  371. package/build/types/utilities/deprecatedProp/index.d.ts +0 -1
@@ -1 +1 @@
1
- import{useEffect,useRef}from"react";import Types from"prop-types";import{isKey,isUndefined}from"@transferwise/neptune-validation";import{useConditionalListener}from"../hooks";import{getFocusableElements,resetFocus}from"./utils";import{Key}from"../key";import{jsx as _jsx}from"react/jsx-runtime";var TAB=Key.TAB,FocusBoundary=function(a){var b=a.children,c=useRef(),d=isUndefined(document)?void 0:document,e={};return useEffect(function(){c.current.focus(),e=getFocusableElements(c.current)},[]),useConditionalListener({eventType:"keydown",callback:function callback(a){return isKey({keyType:TAB,event:a})&&resetFocus({event:a,focusableEls:e})},attachListener:!0,parent:d}),/*#__PURE__*/_jsx("span",{ref:c,tabIndex:-1,className:"np-focus-boundary outline-none",children:b})};FocusBoundary.propTypes={children:Types.node.isRequired};export default FocusBoundary;
1
+ import{isKey,isUndefined}from"@transferwise/neptune-validation";import Types from"prop-types";import{useEffect,useRef}from"react";import{useConditionalListener}from"../hooks";import{Key}from"../key";import{getFocusableElements,resetFocus}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";var TAB=Key.TAB,FocusBoundary=function(a){var b=a.children,c=useRef(),d=isUndefined(document)?void 0:document,e={};return useEffect(function(){c.current.focus(),e=getFocusableElements(c.current)},[]),useConditionalListener({eventType:"keydown",callback:function callback(a){return isKey({keyType:TAB,event:a})&&resetFocus({event:a,focusableEls:e})},attachListener:!0,parent:d}),/*#__PURE__*/_jsx("span",{ref:c,tabIndex:-1,className:"np-focus-boundary outline-none",children:b})};FocusBoundary.propTypes={children:Types.node.isRequired};export default FocusBoundary;
@@ -2,5 +2,5 @@ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _toConsu
2
2
  * This function returns the first and the last focusable elements within a node.
3
3
  *
4
4
  * @param {Node} focusBoundaryContainer - the area that contains focused elements.
5
- * @returns {Object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
6
- */export var getFocusableElements=function(a){var b={first:a,last:a};if(null!==a&&void 0!==a&&a.querySelectorAll){var d=_toConsumableArray(a.querySelectorAll("a, button, input, textarea, select, details,[tabindex]:not([tabindex=\"-1\"])")).filter(function(a){return!a.hasAttribute("disabled")});if(d.length){var c=_slicedToArray(d,1);b.first=c[0],b.last=d[d.length-1]}}return b};
5
+ * @returns {object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
6
+ */export var getFocusableElements=function(a){var b={first:a,last:a};if(null!==a&&void 0!==a&&a.querySelectorAll){var d=_toConsumableArray(a.querySelectorAll("a, button, input, textarea, select, details,[tabindex]:not([tabindex=\"-1\"])")).filter(function(a){return!a.hasAttribute("disabled")});if(0<d.length){var c=_slicedToArray(d,1);b.first=c[0],b.last=d[d.length-1]}}return b};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * This function resets the focus to either last of first focusable elements within a node.
3
3
  *
4
- * @param {Object} focusableEls - contains the first last of first focusable elements within a node.
5
- * @param {Object} event - the triggered event
4
+ * @param {object} focusableEls - contains the first last of first focusable elements within a node.
5
+ * @param {object} event - the triggered event
6
6
  */export var resetFocus=function(a){var b=a.focusableEls,c=b.first,d=b.last,e=a.event,f=document,g=f.activeElement;e.shiftKey&&g===c&&(d&&d.focus(),e.preventDefault()),e.shiftKey||g!==d||(c&&c.focus(),e.preventDefault())};
@@ -1 +1 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _defineProperty from"@babel/runtime/helpers/defineProperty";var HistoryNavigator=function a(){var b=this,c=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[],d=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;_classCallCheck(this,a),_defineProperty(this,"reset",function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[""],c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:20;b.history=a,b.currIndex=0<a.length-1?a.length-1:0,b.historyLimit=c}),_defineProperty(this,"add",function(a){!b.historyLimit||b.history.length<=b.historyLimit?(b.history.push(a),b.currIndex=b.history.length-1):b.currIndex=b.history.length-1}),_defineProperty(this,"redo",function(){var a=b.history.length;return b.currIndex=b.currIndex+1<a?b.currIndex+1:a-1,b.history[b.currIndex]}),_defineProperty(this,"undo",function(){return b.currIndex=0<b.currIndex-1?b.currIndex-1:0,b.history[b.currIndex]}),this.history=c&&c.length?c:[""],this.currIndex=this.history.length-1,this.historyLimit=d};export default HistoryNavigator;
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _defineProperty from"@babel/runtime/helpers/defineProperty";var HistoryNavigator=function a(){var b=this,c=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[],d=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;_classCallCheck(this,a),_defineProperty(this,"reset",function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[""],c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:20;b.history=a,b.currIndex=0<a.length-1?a.length-1:0,b.historyLimit=c}),_defineProperty(this,"add",function(a){!b.historyLimit||b.history.length<=b.historyLimit?(b.history.push(a),b.currIndex=b.history.length-1):b.currIndex=b.history.length-1}),_defineProperty(this,"redo",function(){var a=b.history.length;return b.currIndex=b.currIndex+1<a?b.currIndex+1:a-1,b.history[b.currIndex]}),_defineProperty(this,"undo",function(){return b.currIndex=0<b.currIndex-1?b.currIndex-1:0,b.history[b.currIndex]}),this.history=c&&0<c.length?c:[""],this.currIndex=this.history.length-1,this.historyLimit=d};export default HistoryNavigator;
@@ -1,4 +1,5 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useLayoutEffect,useState,useEffect}from"react";import throttle from"lodash.throttle";var THROTTLE_MS=100,useIsomorphicLayoutEffect="undefined"==typeof window?useEffect:useLayoutEffect;export var useClientWidth=function(a){var b=a.ref,c=a.throttleMs,d=void 0===c?THROTTLE_MS:c,e=useState(null),f=_slicedToArray(e,2),g=f[0],h=f[1];return useIsomorphicLayoutEffect(function(){var a=function(){b&&(b.innerWidth?h(b.innerWidth):b.current&&h(b.current.clientWidth))},c=throttle(a,d);// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import throttle from"lodash.throttle";import{useLayoutEffect,useState,useEffect}from"react";var THROTTLE_MS=100,useIsomorphicLayoutEffect="undefined"==typeof window?useEffect:useLayoutEffect;export var useClientWidth=function(a){var b=a.ref,c=a.throttleMs,d=void 0===c?THROTTLE_MS:c,e=useState(null),f=_slicedToArray(e,2),g=f[0],h=f[1];return useIsomorphicLayoutEffect(function(){// eslint-disable-next-line unicorn/consistent-function-scoping
2
+ var a=function(){b&&(b.innerWidth?h(b.innerWidth):b.current&&h(b.current.clientWidth))},c=throttle(a,d);// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
2
3
  // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
3
4
  // won't get removed even if the component is unmounted.
4
5
  return window.addEventListener("resize",c,!0),window.requestAnimationFrame(a),function(){return window.removeEventListener("resize",c,!0)}},[]),[g]};useClientWidth.THROTTLE_MS=100;
@@ -1,14 +1,12 @@
1
- import{useEffect}from"react";import{isUndefined}from"@transferwise/neptune-validation";/**
1
+ import{isUndefined}from"@transferwise/neptune-validation";import{useEffect}from"react";/**
2
2
  * useConditionalListener attaches an event to the document when a condition is met.
3
3
  *
4
4
  * @param {bool} attachListener - condition to be met for the listener to be attached
5
- * @param {function} callback - function registered with the event listener
5
+ * @param {Function} callback - function registered with the event listener
6
6
  * @param {string} eventType - type of event to attach to document
7
- *
8
7
  * @usage `useConditionalListener({
9
8
  * eventType: 'click',
10
9
  * callback,
11
10
  * attachListener: condition,
12
11
  * });`
13
- *
14
- * */export var useConditionalListener=function(a){var b=a.attachListener,c=a.callback,d=a.eventType,e=a.parent;useEffect(function(){return b&&!isUndefined(e)&&e.addEventListener(d,c,!0),function(){isUndefined(e)||e.removeEventListener(d,c,!0)}},[b])};
12
+ */export var useConditionalListener=function(a){var b=a.attachListener,c=a.callback,d=a.eventType,e=a.parent;useEffect(function(){return b&&!isUndefined(e)&&e.addEventListener(d,c,!0),function(){isUndefined(e)||e.removeEventListener(d,c,!0)}},[b])};
@@ -3,8 +3,9 @@ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState
3
3
  * Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
4
4
  * Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
5
5
  *
6
+ * @param elRef.elRef
6
7
  * @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
7
8
  * @param {strimng} [loading = 'eager'] - string that contains the type of loading.
8
- *
9
+ * @param elRef.loading
9
10
  * @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
10
- * */export var useHasIntersected=function(a){var b=a.elRef,c=a.loading;if("eager"===c)return[!1];var d=function(){return b&&b.current},e=useState(!1),f=_slicedToArray(e,2),g=f[0],h=f[1],i=function(a,c){a.forEach(function(a){a.isIntersecting&&(h(!0),c.unobserve(b.current))})};return useEffect(function(){var a,c=!1;return"undefined"!=typeof window&&window.IntersectionObserver&&d()?!c&&(a=new IntersectionObserver(i,ObserverParams),a.observe(b.current)):h(!0),function(){c=!0,a&&a.unobserve(b.current)}},[b]),[g]};
11
+ */export var useHasIntersected=function(a){var b=a.elRef,c=a.loading,d=useState(!1),e=_slicedToArray(d,2),f=e[0],g=e[1],h=function(){return b&&b.current},i=function(a,c){a.forEach(function(a){a.isIntersecting&&(g(!0),c.unobserve(b.current))})};return useEffect(function(){var a,c=!1;return"undefined"!=typeof window&&window.IntersectionObserver&&h()?!c&&(a=new IntersectionObserver(i,ObserverParams),a.observe(b.current)):g(!0),function(){c=!0,a&&a.unobserve(b.current)}},[b]),"eager"===c?[!1]:[f]};
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * TODO: mention what to use instead or consider to delete this object
3
+ *
3
4
  * @deprecated
4
5
  */export default{DOWN:40,UP:38,LEFT:37,RIGHT:39,ENTER:13,ESCAPE:27,TAB:9,SPACE:32,BACKSPACE:8,DELETE:46,COMMA:188,PERIOD:190};
@@ -1,10 +1,9 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _fallbackPlacements;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{useState,forwardRef,useEffect}from"react";import PropTypes from"prop-types";import classnames from"classnames";import{usePopper}from"react-popper";import Dimmer from"../../dimmer";import{Position}from"..";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var POPOVER_OFFSET=[0,16],fallbackPlacements=(_fallbackPlacements={},_defineProperty(_fallbackPlacements,Position.TOP,[Position.BOTTOM,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.BOTTOM,[Position.TOP,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.LEFT,[Position.RIGHT,Position.TOP,Position.BOTTOM]),_defineProperty(_fallbackPlacements,Position.RIGHT,[Position.LEFT,Position.TOP,Position.BOTTOM]),_fallbackPlacements),Panel=/*#__PURE__*/forwardRef(function(a,b){var c=a.arrow,d=a.children,e=a.className,f=a.open,g=a.onClose,h=a.position,i=a.anchorRef,j=useState(null),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useState(null),o=_slicedToArray(n,2),p=o[0],q=o[1],r=[];c&&(r.push({name:"arrow",options:{element:l,options:{padding:8// 8px from the edges of the popper
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _fallbackPlacements;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import classnames from"classnames";import PropTypes from"prop-types";import{useState,forwardRef,useEffect}from"react";import{usePopper}from"react-popper";import{Position}from"..";import Dimmer from"../../dimmer";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var POPOVER_OFFSET=[0,16],fallbackPlacements=(_fallbackPlacements={},_defineProperty(_fallbackPlacements,Position.TOP,[Position.BOTTOM,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.BOTTOM,[Position.TOP,Position.RIGHT,Position.LEFT]),_defineProperty(_fallbackPlacements,Position.LEFT,[Position.RIGHT,Position.TOP,Position.BOTTOM]),_defineProperty(_fallbackPlacements,Position.RIGHT,[Position.LEFT,Position.TOP,Position.BOTTOM]),_fallbackPlacements),Panel=/*#__PURE__*/forwardRef(function(a,b){var c=a.arrow,d=a.children,e=a.className,f=a.open,g=a.onClose,h=a.position,i=a.anchorRef,j=useState(null),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useState(null),o=_slicedToArray(n,2),p=o[0],q=o[1],r=[];c&&(r.push({name:"arrow",options:{element:l,options:{padding:8// 8px from the edges of the popper
2
2
  }}}),r.push({name:"offset",options:{offset:POPOVER_OFFSET}})),fallbackPlacements[h]&&r.push({name:"flip",options:{fallbackPlacements:fallbackPlacements[h]}});var s=usePopper(i.current,p,{placement:h,modifiers:r}),t=s.styles,u=s.attributes,v=s.forceUpdate;// If the trigger is not visible when the position is calculated, it will be incorrect. Because this can happen repeatedly (on resize for example),
3
3
  // it is most simple just to always position before opening
4
- return useEffect(function(){f&&v&&v()},[f]),/*#__PURE__*/_jsx(Dimmer,{open:f,onClose:g,transparent:!0,fadeContentOnEnter:!0,fadeContentOnExit:!0,children:/*#__PURE__*/_jsx("div",_objectSpread(_objectSpread({ref:q,style:_objectSpread({},t.popper)},u.popper),{},{className:classnames("np-panel",{"np-panel--open":f},e),children:/*#__PURE__*/_jsxs("div",{ref:b,className:classnames("np-panel__content"),children:[d,c&&/*#__PURE__*/_jsx("div",{className:classnames("np-panel__arrow"),ref:m,style:t.arrow})]})}))})});// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
4
+ return useEffect(function(){f&&v&&v()},[f]),/*#__PURE__*/_jsx(Dimmer,{open:f,transparent:!0,fadeContentOnEnter:!0,fadeContentOnExit:!0,onClose:g,children:/*#__PURE__*/_jsx("div",_objectSpread(_objectSpread({ref:q,style:_objectSpread({},t.popper)},u.popper),{},{className:classnames("np-panel",{"np-panel--open":f},e),children:/*#__PURE__*/_jsxs("div",{ref:b,className:classnames("np-panel__content"),children:[d,c&&/*#__PURE__*/_jsx("div",{ref:m,className:classnames("np-panel__arrow"),style:t.arrow})]})}))})});// By default the flip positioning explores only the opposite alternative. So if left is passed and there's no enough space
5
5
  // the right one gets chosen. If there's no space on both sides popover goes back to the initially chosen one left.
6
6
  // This mapping forces popover to try the four available positions before going back to the initial chosen one.
7
7
  Panel.Position={BOTTOM:Position.BOTTOM,LEFT:Position.LEFT,RIGHT:Position.RIGHT,TOP:Position.TOP},Panel.defaultProps={arrow:!1,className:void 0,open:!1,position:Panel.Position.TOP},Panel.propTypes={arrow:PropTypes.bool,className:PropTypes.string,children:PropTypes.node.isRequired,open:PropTypes.bool,onClose:PropTypes.func.isRequired,position:PropTypes.oneOf([Panel.Position.BOTTOM,Panel.Position.LEFT,Panel.Position.RIGHT,Panel.Position.TOP]),// Ref currently doesn't have a clear defined propType
8
8
  // https://github.com/facebook/prop-types/issues/240
9
- // eslint-disable-next-line
10
9
  anchorRef:PropTypes.shape({current:PropTypes.any}).isRequired};export default Panel;
@@ -1,3 +1,3 @@
1
- /* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */var prepRequirements=function(a){if(!a||!a.length)return[];var b=copyOf(a);return b.forEach(function(a){a.prepared||(prepLegacyAlternatives(a),a.properties=prepFields(a.properties||a.fields),a.type&&"object"!==a.type&&!a.types&&(a.properties.type={type:"string",enum:[a.type],required:!0,hidden:!0},a.type="object"),a.prepared=!0)}),b},prepFields=function(a,b,c){if(!a)return{};var d=copyOf(a);return d=flattenFieldsWithGroups(d),d=transformFieldArrayToMap(d),d=transformNestedKeysToNestedSpecs(d),Object.keys(d).forEach(function(a){d[a]=prepField(d[a],b,c)}),d},prepField=function(a,b,c){var d=copyOf(a);return prepLegacyProps(d),prepType(d),prepPattern(d),prepValidationMessages(d,c),d},flattenFieldsWithGroups=function(a){if(a instanceof Array){var b=[];return a.forEach(function(a){a.fields?b=b.concat(flattenFieldWithGroup(a,a.fields)):a.group?b=b.concat(flattenFieldWithGroup(a,a.group)):b.push(a)}),b}return a},flattenFieldWithGroup=function(a,b){return a.name&&b.length&&!b[0].name&&(b[0].name=a.name),a.width&&b.length&&!b[0].width&&(b[0].width=a.width),a.tooltip&&b.length&&!b[0].help&&(b[0].help={message:a.tooltip}),a.info&&b.length&&!b[0].help&&(b[0].help={message:a.info}),2===b.length&&b.forEach(function(a){a.width="md"}),3===b.length&&(b[0].width="md",b[1].width="md"),b},transformFieldArrayToMap=function(a){if(a instanceof Array){var b={};return a.forEach(function(a){var c=a.key||a.name;delete a.key,b[c]=copyOf(a)}),b}return a},transformNestedKeysToNestedSpecs=function(a){if(a instanceof Array)throw new Error("Expecting a map of fields, not an array");var b={};return Object.keys(a).forEach(function(c){if(0<c.indexOf(".")){// If the key contains a period we need to nest the fields in another object
2
- var d=c.split("."),e=d[0];b[e]||(b[e]={type:"object",properties:{}}),b[e].properties[d[1]]=a[c]}else b[c]=a[c]}),b},prepType=function(a){var b=a.type&&a.type.toLowerCase&&a.type.toLowerCase();switch(b){case"text":a.type="string";break;case"date":a.type="string",a.format="date";break;case"password":a.type="string",a.control="password";break;case"checkbox":a.type="boolean";break;case"select":a.control||(a.control="select"),delete a.type;break;case"radio":a.control="radio",delete a.type;break;case"upload":a.type="string",a.format="base64url";break;case"tel":a.type="string",a.format="phone";break;case"textarea":a.type="string",a.control="textarea";break;default:}a.control||"object"===a.type||(a.control=getControlType(a))},prepLegacyAlternatives=function(a){!a.title&&a.label&&(a.title=a.label),a.title||(a.title=getNameFromType(a.type)),!a.type&&a.name&&(a.type=a.name),!a.description&&a.tooltip&&(a.description=a.tooltip),a.fieldGroups&&!a.fields&&(a.fields=flattenFieldsWithGroups(a.fieldGroups),delete a.fieldGroups)},prepLegacyProps=function(a){a.name&&!a.title&&(a.title=a.name,delete a.name),a.validationRegexp&&(a.pattern=a.validationRegexp,delete a.validationRegexp),a.min&&(a.minimum=a.min,delete a.min),a.max&&(a.maximum=a.max,delete a.max),a.example&&!a.placeholder&&(a.placeholder=a.example,delete a.example),a.tooltip&&!a.help&&(a.help={message:a.tooltip},delete a.tooltip),a.valuesAllowed&&!a.values&&(a.values=a.valuesAllowed,delete a.valuesAllowed),a.values&&a.values.map&&(a.values=prepLegacyValues(a.values)),a.value&&!a.default&&(a.default=a.value,delete a.value),a.values&&a.values&&a.values.length&&a.values[0]&&!a.values[0].value&&a.values[0].label&&!a.placeholder&&(a.placeholder=a.values[0].label,a.values=a.values.slice(1))},prepLegacyValues=function(a){return a.map(prepLegacyValue)},prepLegacyValue=function(a){return!a.label&&a.title&&(a.label=a.title,delete a.title),!a.label&&a.name&&(a.label=a.name,delete a.name),!a.value&&a.code&&(a.value=a.code,delete a.code),!a.value&&a.key&&(a.value=a.key,delete a.key),a},prepPattern=function(a){if(a.pattern)try{RegExp(a.pattern)}catch(b){console.warn("API regexp is invalid"),delete a.pattern}else delete a.pattern},prepValidationMessages=function(a,b){return a.validationMessages=a.validationMessages?a.validationMessages:b,a.validationMessages?void(a.validationMessages.minimum&&(a.validationMessages.min=a.validationMessages.minimum,delete a.validationMessages.minimum),a.validationMessages.maximum&&(a.validationMessages.max=a.validationMessages.maximum,delete a.validationMessages.maximum)):void delete a.validationMessages},getControlType=function(a){if(a.control)return a.control.toLowerCase();if(a.hidden)return"hidden";if(a.values&&a.values.length)return getSelectionType(a);switch(a.type){case"string":return getControlForStringFormat(a.format);case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text";}},getControlForStringFormat=function(a){return"date"===a?"date":"base64url"===a?"file":"password"===a?"password":"uri"===a?"text":"email"===a?"text":"phone"===a?"tel":"text"},getSelectionType=function(a){return a.control?a.control:"select"===a.type?"select":"radio"===a.type?"radio":a.values?3<a.values.length?"select":"radio":"select"},copyOf=function(a){return JSON.parse(JSON.stringify(a))},getNameFromType=function(a){if(a&&0<a.length){var b=a.toLowerCase().split("_").join(" ");// String.replace method only replaces first instance
1
+ /* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */var prepRequirements=function(a){if(!a||0===a.length)return[];var b=copyOf(a);return b.forEach(function(a){a.prepared||(prepLegacyAlternatives(a),a.properties=prepFields(a.properties||a.fields),a.type&&"object"!==a.type&&!a.types&&(a.properties.type={type:"string",enum:[a.type],required:!0,hidden:!0},a.type="object"),a.prepared=!0)}),b},prepFields=function(a,b,c){if(!a)return{};var d=copyOf(a);return d=flattenFieldsWithGroups(d),d=transformFieldArrayToMap(d),d=transformNestedKeysToNestedSpecs(d),Object.keys(d).forEach(function(a){d[a]=prepField(d[a],b,c)}),d},prepField=function(a,b,c){var d=copyOf(a);return prepLegacyProps(d),prepType(d),prepPattern(d),prepValidationMessages(d,c),d},flattenFieldsWithGroups=function(a){if(Array.isArray(a)){var b=[];return a.forEach(function(a){a.fields?b=b.concat(flattenFieldWithGroup(a,a.fields)):a.group?b=b.concat(flattenFieldWithGroup(a,a.group)):b.push(a)}),b}return a},flattenFieldWithGroup=function(a,b){return a.name&&0<b.length&&!b[0].name&&(b[0].name=a.name),a.width&&0<b.length&&!b[0].width&&(b[0].width=a.width),a.tooltip&&0<b.length&&!b[0].help&&(b[0].help={message:a.tooltip}),a.info&&0<b.length&&!b[0].help&&(b[0].help={message:a.info}),2===b.length&&b.forEach(function(a){a.width="md"}),3===b.length&&(b[0].width="md",b[1].width="md"),b},transformFieldArrayToMap=function(a){if(Array.isArray(a)){var b={};return a.forEach(function(a){var c=a.key||a.name;delete a.key,b[c]=copyOf(a)}),b}return a},transformNestedKeysToNestedSpecs=function(a){if(Array.isArray(a))throw new TypeError("Expecting a map of fields, not an array");var b={};return Object.keys(a).forEach(function(c){if(0<c.indexOf(".")){// If the key contains a period we need to nest the fields in another object
2
+ var d=c.split("."),e=d[0];b[e]||(b[e]={type:"object",properties:{}}),b[e].properties[d[1]]=a[c]}else b[c]=a[c]}),b},prepType=function(a){var b=a.type&&a.type.toLowerCase&&a.type.toLowerCase();switch(b){case"text":a.type="string";break;case"date":a.type="string",a.format="date";break;case"password":a.type="string",a.control="password";break;case"checkbox":a.type="boolean";break;case"select":a.control||(a.control="select"),delete a.type;break;case"radio":a.control="radio",delete a.type;break;case"upload":a.type="string",a.format="base64url";break;case"tel":a.type="string",a.format="phone";break;case"textarea":a.type="string",a.control="textarea";break;default:}a.control||"object"===a.type||(a.control=getControlType(a))},prepLegacyAlternatives=function(a){!a.title&&a.label&&(a.title=a.label),a.title||(a.title=getNameFromType(a.type)),!a.type&&a.name&&(a.type=a.name),!a.description&&a.tooltip&&(a.description=a.tooltip),a.fieldGroups&&!a.fields&&(a.fields=flattenFieldsWithGroups(a.fieldGroups),delete a.fieldGroups)},prepLegacyProps=function(a){a.name&&!a.title&&(a.title=a.name,delete a.name),a.validationRegexp&&(a.pattern=a.validationRegexp,delete a.validationRegexp),a.min&&(a.minimum=a.min,delete a.min),a.max&&(a.maximum=a.max,delete a.max),a.example&&!a.placeholder&&(a.placeholder=a.example,delete a.example),a.tooltip&&!a.help&&(a.help={message:a.tooltip},delete a.tooltip),a.valuesAllowed&&!a.values&&(a.values=a.valuesAllowed,delete a.valuesAllowed),a.values&&a.values.map&&(a.values=prepLegacyValues(a.values)),a.value&&!a.default&&(a.default=a.value,delete a.value),a.values&&a.values&&0<a.values.length&&a.values[0]&&!a.values[0].value&&a.values[0].label&&!a.placeholder&&(a.placeholder=a.values[0].label,a.values=a.values.slice(1))},prepLegacyValues=function(a){return a.map(prepLegacyValue)},prepLegacyValue=function(a){return!a.label&&a.title&&(a.label=a.title,delete a.title),!a.label&&a.name&&(a.label=a.name,delete a.name),!a.value&&a.code&&(a.value=a.code,delete a.code),!a.value&&a.key&&(a.value=a.key,delete a.key),a},prepPattern=function(a){if(a.pattern)try{new RegExp(a.pattern)}catch(b){console.warn("API regexp is invalid"),delete a.pattern}else delete a.pattern},prepValidationMessages=function(a,b){return a.validationMessages=a.validationMessages?a.validationMessages:b,a.validationMessages?void(a.validationMessages.minimum&&(a.validationMessages.min=a.validationMessages.minimum,delete a.validationMessages.minimum),a.validationMessages.maximum&&(a.validationMessages.max=a.validationMessages.maximum,delete a.validationMessages.maximum)):void delete a.validationMessages},getControlType=function(a){if(a.control)return a.control.toLowerCase();if(a.hidden)return"hidden";if(a.values&&0<a.values.length)return getSelectionType(a);switch(a.type){case"string":return getControlForStringFormat(a.format);case"number":case"integer":return"number";case"boolean":return"checkbox";default:return"text";}},getControlForStringFormat=function(a){return"date"===a?"date":"base64url"===a?"file":"password"===a?"password":"uri"===a?"text":"email"===a?"text":"phone"===a?"tel":"text"},getSelectionType=function(a){return a.control?a.control:"select"===a.type?"select":"radio"===a.type?"radio":a.values?3<a.values.length?"select":"radio":"select"},copyOf=function(a){return JSON.parse(JSON.stringify(a))},getNameFromType=function(a){if(a&&0<a.length){var b=a.toLowerCase().split("_").join(" ");// String.replace method only replaces first instance
3
3
  return b.charAt(0).toUpperCase()+b.slice(1)}return""};export{prepFields,getControlType};
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import{Position,Breakpoint}from"..";import BottomSheet from"../bottomSheet";import Panel from"../panel";import SizeSwapper from"../../sizeSwapper";import{jsx as _jsx}from"react/jsx-runtime";var ResponsivePanel=function(a){var b=a.anchorRef,c=a.arrow,d=a.children,e=a.className,f=a.onClose,g=a.open,h=a.position,i="undefined"==typeof window?void 0:window,j=[{items:[/*#__PURE__*/_jsx(BottomSheet,{open:g,className:e,onClose:f,children:d},"bottomSheet")]},{items:[/*#__PURE__*/_jsx(Panel,{arrow:c,open:g,position:h,anchorRef:b,className:e,onClose:f,children:d},"panel")],breakpoint:Breakpoint.SMALL}];return/*#__PURE__*/_jsx(SizeSwapper,{items:j,ref:i,inline:!0})};ResponsivePanel.defaultProps={arrow:!1,className:void 0,open:!1,position:Position.TOP},ResponsivePanel.propTypes={arrow:PropTypes.bool,children:PropTypes.node.isRequired,className:PropTypes.string,/** Function attached to document click and keydown. It gets called when a close condition provided is met. */onClose:PropTypes.func.isRequired,open:PropTypes.bool,anchorRef:PropTypes.shape({current:PropTypes.shape({})}).isRequired,position:PropTypes.oneOf(["top","right","left","bottom"])};export default ResponsivePanel;
1
+ import PropTypes from"prop-types";import{Position,Breakpoint}from"..";import SizeSwapper from"../../sizeSwapper";import BottomSheet from"../bottomSheet";import Panel from"../panel";import{jsx as _jsx}from"react/jsx-runtime";var ResponsivePanel=function(a){var b=a.anchorRef,c=a.arrow,d=a.children,e=a.className,f=a.onClose,g=a.open,h=a.position,i="undefined"==typeof window?void 0:window,j=[{items:[/*#__PURE__*/_jsx(BottomSheet,{open:g,className:e,onClose:f,children:d},"bottomSheet")]},{items:[/*#__PURE__*/_jsx(Panel,{arrow:c,open:g,position:h,anchorRef:b,className:e,onClose:f,children:d},"panel")],breakpoint:Breakpoint.SMALL}];return/*#__PURE__*/_jsx(SizeSwapper,{ref:i,items:j,inline:!0})};ResponsivePanel.defaultProps={arrow:!1,className:void 0,open:!1,position:Position.TOP},ResponsivePanel.propTypes={arrow:PropTypes.bool,children:PropTypes.node.isRequired,className:PropTypes.string,/** Function attached to document click and keydown. It gets called when a close condition provided is met. */onClose:PropTypes.func.isRequired,open:PropTypes.bool,anchorRef:PropTypes.shape({current:PropTypes.shape({})}).isRequired,position:PropTypes.oneOf(["top","right","left","bottom"])};export default ResponsivePanel;
@@ -1 +1 @@
1
- import{getDistanceToNextSymbol,getDistanceToPreviousSymbol}from"../getDistanceToSymbol";import getCountOfSymbolsInSelection from"../getCountOfSymbolsInSelection";var getCursorPositionAfteractionstroke=function(a,b,c,d,e){var f=b;switch(a){case"Backspace":b===c&&(f-=getDistanceToPreviousSymbol(b,d),f=0<f?f-1:0);break;case"Paste":f+=e+getCountOfSymbolsInSelection(b,b+e,d)+getDistanceToNextSymbol(b+e,d);break;case"Cut":case"Delete":break;default:f+=1+getDistanceToNextSymbol(b,d);}return f};export default getCursorPositionAfteractionstroke;
1
+ import getCountOfSymbolsInSelection from"../getCountOfSymbolsInSelection";import{getDistanceToNextSymbol,getDistanceToPreviousSymbol}from"../getDistanceToSymbol";var getCursorPositionAfteractionstroke=function(a,b,c,d,e){var f=b;switch(a){case"Backspace":b===c&&(f-=getDistanceToPreviousSymbol(b,d),f=0<f?f-1:0);break;case"Paste":f+=e+getCountOfSymbolsInSelection(b,b+e,d)+getDistanceToNextSymbol(b+e,d);break;case"Cut":case"Delete":break;default:f+=1+getDistanceToNextSymbol(b,d);}return f};export default getCursorPositionAfteractionstroke;
@@ -1 +1 @@
1
- var unformatWithPattern=function(a,b){var c=[""];return a&&a.length&&(c=a.toString().split(""),c=c.filter(function(a){return-1===getSymbolsInPattern(b).indexOf(a)})),c.join("")},getSymbolsInPattern=function(a){return a.split("").filter(function(a){return"*"!==a})};export default unformatWithPattern;
1
+ var unformatWithPattern=function(a,b){var c=[""];return a&&0<a.length&&(c=a.toString().split(""),c=c.filter(function(a){return!getSymbolsInPattern(b).includes(a)})),c.join("")},getSymbolsInPattern=function(a){return a.split("").filter(function(a){return"*"!==a})};export default unformatWithPattern;
@@ -1,5 +1,4 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState}from"react";import{useIntl}from"react-intl";import classNames from"classnames";import PropTypes from"prop-types";import Select from"../select";import{Size,DateMode,MonthFormat}from"../common";import{explodeDate,convertToLocalMidnight}from"./utils";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import{useDirection}from"../common/hooks";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=["en-US","ja-JP"],INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b=a.disabled,c=a.size,d=a.value,e=a.dayLabel,f=a.monthLabel,g=a.yearLabel,h=a.monthFormat,i=a.mode,j=a.onChange,k=a.onFocus,l=a.onBlur,m=a.placeholders,n=a.id,o=useDirection(),p=o.isRTL,q=useIntl(),r=q.locale,s=function(){return d&&isDateValid(d)?"string"==typeof d?convertToLocalMidnight(d):d:null},t=function(a){var b=INITIAL_DEFAULT_STATE;if(d&&isDateValid(d)){var c=s();b=explodeDate(c),isMonthAndYearFormat(d)&&(b.day=null)}return b[a]},u=useState(function(){return t("day")}),v=_slicedToArray(u,2),w=v[0],x=v[1],y=useState(function(){return t("month")}),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(function(){return t("year")}),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(s),H=_slicedToArray(G,2),I=H[0],J=H[1],K=function(a){if(!isDateValid(a))return"";switch(i){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},L=function(){var a=getMonthNames(r,h);return/*#__PURE__*/ (// eslint-disable-next-line
2
- _jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:f}),/*#__PURE__*/_jsx(Select,{name:"month",className:"form-control",onChange:function(a){return P(a)},disabled:b,placeholder:m.month,options:M(),size:c,selected:null===A?null:{value:A,label:a[A]}})]}))},M=function(){var a=[],b=getMonthNames(r,h);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},N=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:w,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:A,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:E,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||R(INITIAL_DEFAULT_STATE),i===DateMode.MONTH_YEAR?0<=b&&c&&(b!==A||c!==E)&&R(e):a&&0<=b&&c&&(a!==w||b!==A||c!==E)&&R(e)},O=function(a){var b=S(a.target.value,A,E),c=b.checkedDay;x(c),N(c,A,E)},P=function(a){if(!a)return B(null),void N(w,null,E);var b=a?a.value:0,c=S(w,b,E),d=c.checkedDay;B(b),w&&d!==w&&x(d),N(d,b,E)},Q=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
3
- var d=S(w,A,b),e=d.checkedDay;w&&e!==w&&x(e),F(c),N(e,A,c)}else F(c),N(w,A,null)},R=function(a){a!==I&&(J(a),j(K(a)||null))},S=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},T=i===DateMode.MONTH_YEAR,U=classNames({"col-sm-8":T,"col-sm-5":!T,"pull-right":p}),V=-1<MonthBeforeDay.indexOf(r);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:n,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?k&&k():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?l&&l():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[V&&/*#__PURE__*/_jsx("div",{className:U,children:L()}),!T&&/*#__PURE__*/_jsx("div",{className:classNames("col-sm-3",{"pull-right":p}),children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(c),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:e}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:w||"",onChange:function(a){return O(a)},placeholder:m.day,disabled:b})]})})}),!V&&/*#__PURE__*/_jsx("div",{className:U,children:L()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(c),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:g}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:m.year,value:E||"",onChange:function(a){return Q(a)},disabled:b})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import classNames from"classnames";import PropTypes from"prop-types";import{useState}from"react";import{useIntl}from"react-intl";import{Size,DateMode,MonthFormat}from"../common";import{getMonthNames,isDateValid,isMonthAndYearFormat}from"../common/dateUtils";import{useDirection}from"../common/hooks";import Select from"../select";import messages from"./DateInput.messages";import{explodeDate,convertToLocalMidnight}from"./utils";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthBeforeDay=new Set(["en-US","ja-JP"]),INITIAL_DEFAULT_STATE={year:null,month:null,day:null},DateInput=function(a){var b,c,d,e=a.disabled,f=a.size,g=a.value,h=a.dayLabel,i=a.monthLabel,j=a.yearLabel,k=a.monthFormat,l=a.mode,m=a.onChange,n=a.onFocus,o=a.onBlur,p=a.placeholders,q=a.id,r=useDirection(),s=r.isRTL,t=useIntl(),u=t.locale,v=t.formatMessage,w=function(){return g&&isDateValid(g)?"string"==typeof g?convertToLocalMidnight(g):g:null},x=function(a){var b=INITIAL_DEFAULT_STATE;if(g&&isDateValid(g)){var c=w();b=explodeDate(c),isMonthAndYearFormat(g)&&(b.day=null)}return b[a]},y=useState(function(){return x("day")}),z=_slicedToArray(y,2),A=z[0],B=z[1],C=useState(function(){return x("month")}),D=_slicedToArray(C,2),E=D[0],F=D[1],G=useState(function(){return x("year")}),H=_slicedToArray(G,2),I=H[0],J=H[1],K=useState(w),L=_slicedToArray(K,2),M=L[0],N=L[1];h=h||v(messages.dayLabel),i=i||v(messages.monthLabel),j=j||v(messages.yearLabel),p={day:(null===(b=p)||void 0===b?void 0:b.day)||"DD",month:(null===(c=p)||void 0===c?void 0:c.month)||v(messages.monthLabel),year:(null===(d=p)||void 0===d?void 0:d.year)||"YYYY"};var O=function(a){if(!isDateValid(a))return"";switch(l){case DateMode.MONTH_YEAR:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2)].join("-");case DateMode.DAY_MONTH_YEAR:default:return[a.getFullYear(),"0".concat(a.getMonth()+1).slice(-2),"0".concat(a.getDate()).slice(-2)].join("-");}},P=function(){var a=getMonthNames(u,k);return/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:i}),/*#__PURE__*/_jsx(Select,{name:"month",className:"form-control",disabled:e,placeholder:p.month,options:Q(),size:f,selected:null===E?null:{value:E,label:a[E]},onChange:function(a){return T(a)}})]})},Q=function(){var a=[],b=getMonthNames(u,k);return b.forEach(function(b,c){a.push({value:c,label:b})}),a},R=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:A,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:E,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:I,d=null!=a&&null!=b&&null!=c?new Date(c,b,a):null,e=isDateValid(d)?d:null;e||V(INITIAL_DEFAULT_STATE),l===DateMode.MONTH_YEAR?0<=b&&c&&(b!==E||c!==I)&&V(e):a&&0<=b&&c&&(a!==A||b!==E||c!==I)&&V(e)},S=function(a){var b=W(a.target.value,E,I),c=b.checkedDay;B(c),R(c,E,I)},T=function(a){if(!a)return F(null),void R(A,null,I);var b=a?a.value:0,c=W(A,b,I),d=c.checkedDay;F(b),A&&d!==A&&B(d),R(d,b,I)},U=function(a){var b=a.target.value,c=4<b.length?b.slice(0,4):b;if(4===c.toString().length){// Correct day based on year and month.
2
+ var d=W(A,E,b),e=d.checkedDay;A&&e!==A&&B(e),J(c),R(e,E,c)}else J(c),R(A,E,null)},V=function(a){a!==M&&(N(a),m(O(a)||null))},W=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=a,e=new Date(c||2e3,b+1,0).getDate();return a||(d=null),(a&&0>a||"00"===a)&&(d=1),(a&&b||31<a)&&(d=a>e?e:a),{checkedDay:d,checkedMonth:b,checkedYear:c}},X=l===DateMode.MONTH_YEAR,Y=classNames({"col-sm-8":X,"col-sm-5":!X,"pull-right":s}),Z=MonthBeforeDay.has(u);return/*#__PURE__*/_jsx("div",{className:"tw-date",id:q,onFocus:function onFocus(a){return shouldPropagateOnFocus(a)?n&&n():a.stopPropagation()},onBlur:function onBlur(a){return shouldPropagateOnBlur(a)?o&&o():a.stopPropagation()},children:/*#__PURE__*/_jsxs("div",{className:"row",children:[Z&&/*#__PURE__*/_jsx("div",{className:Y,children:P()}),!X&&/*#__PURE__*/_jsx("div",{className:classNames("col-sm-3",{"pull-right":s}),children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:h}),/*#__PURE__*/_jsx("input",{type:"number",name:"day",className:"form-control",value:A||"",placeholder:p.day,disabled:e,onChange:function(a){return S(a)}})]})})}),!Z&&/*#__PURE__*/_jsx("div",{className:Y,children:P()}),/*#__PURE__*/_jsx("div",{className:"col-sm-4",children:/*#__PURE__*/_jsx("div",{className:"input-group-".concat(f),children:/*#__PURE__*/_jsxs("label",{children:[/*#__PURE__*/_jsx("span",{className:"sr-only",children:j}),/*#__PURE__*/_jsx("input",{type:"number",name:"year",className:"form-control",placeholder:p.year,value:I||"",disabled:e,onChange:function(a){return U(a)}})]})})})]})})};// Should only propagate if the relatedTarget is not part of this DateInput component.
4
3
  function shouldPropagateOnFocus(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c&&c.closest(".tw-date");return d!==e}// Should only propagate if the relatedTarget or the activeElement is not part of this DateInput component.
5
- function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,dayLabel:"Day",monthLabel:"Month",yearLabel:"Year",monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,placeholders:{day:"DD",month:"Month",year:"YYYY"},id:""};export default DateInput;
4
+ function shouldPropagateOnBlur(a){var b=a.target,c=a.relatedTarget,d=b.closest(".tw-date"),e=c||(document.activeElement===b?null:document.activeElement),f=e&&e.closest(".tw-date");return d!==f}DateInput.propTypes={disabled:PropTypes.bool,size:PropTypes.oneOf(["sm","md","lg"]),value:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(Date)]),onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,dayLabel:PropTypes.string,monthLabel:PropTypes.string,yearLabel:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),mode:PropTypes.oneOf(["day-month-year","month-year"]),placeholders:PropTypes.shape({day:PropTypes.node,month:PropTypes.node,year:PropTypes.node}),id:PropTypes.string},DateInput.defaultProps={disabled:!1,size:Size.MEDIUM,value:null,onFocus:null,onBlur:null,monthFormat:MonthFormat.LONG,mode:DateMode.DAY_MONTH_YEAR,id:""};export default DateInput;
@@ -0,0 +1 @@
1
+ import{defineMessages}from"react-intl";export default defineMessages({monthLabel:{id:"neptune.DateInput.month.label"},dayLabel:{id:"neptune.DateInput.day.label"},yearLabel:{id:"neptune.DateInput.year.label"}});
@@ -1,3 +1,3 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{createRef,PureComponent}from"react";import PropTypes from"prop-types";import KeyCodes from"../common/keyCodes";import{Size,MonthFormat,Breakpoint}from"../common";import{isWithinRange,moveToWithinRange}from"../common/dateUtils";import{getStartOfDay}from"./getStartOfDay";import DateTrigger from"./dateTrigger";import DayCalendar from"./dayCalendar";import MonthCalendar from"./monthCalendar";import YearCalendar from"./yearCalendar";import BottomSheet from"../common/bottomSheet";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MODE={DAY:"day",MONTH:"month",YEAR:"year"},DateLookup=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"element",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"dropdown",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"getWindowSize",function(){return"undefined"!=typeof window&&window.innerWidth||"undefined"!=typeof document&&document.documentElement.clientWidth}),_defineProperty(_assertThisInitialized(d),"open",function(){var a=d.props.onFocus;d.setState({open:!0,mode:MODE.DAY,isMobile:d.getWindowSize()<=Breakpoint.SMALL},function(){d.adjustIfOffscreen(),d.focusOn(".tw-date-lookup-header-current")}),a&&a(),window.addEventListener("resize",d.resizeHandler),document.addEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"resizeHandler",function(){return d.setState({isMobile:d.getWindowSize()<=Breakpoint.SMALL},d.adjustIfOffscreen())}),_defineProperty(_assertThisInitialized(d),"adjustIfOffscreen",function(){if(!d.state.isMobile&&d.open&&d.dropdown&&d.dropdown.current){var a=d.dropdown.current,b=a.getBoundingClientRect(),c=b.right>d.getWindowSize(),e=0>b.left;c&&a.classList[e?"remove":"add"]("dropdown-menu-xs-right")}}),_defineProperty(_assertThisInitialized(d),"close",function(){var a=d.props.onBlur;d.setState({open:!1}),a&&a(),window.removeEventListener("resize",d.adjustIfOffscreen),document.removeEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"handleOutsideClick",function(a){var b=d.state.isMobile;if(d.state.open&&!b){var c=d.element.current.querySelector(".dropdown-menu");c&&!c.contains(a.target)&&d.close()}}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){var b=d.state.open;switch(a.keyCode){case KeyCodes.LEFT:b?d.adjustDate(-1,-1,-1):d.open(),a.preventDefault();break;case KeyCodes.UP:b?d.adjustDate(-7,-4,-4):d.open(),a.preventDefault();break;case KeyCodes.RIGHT:b?d.adjustDate(1,1,1):d.open(),a.preventDefault();break;case KeyCodes.DOWN:b?d.adjustDate(7,4,4):d.open(),a.preventDefault();break;case KeyCodes.ESCAPE:d.close(),a.preventDefault();break;default:}}),_defineProperty(_assertThisInitialized(d),"adjustDate",function(a,b,c){var e,f=d.state,g=f.selectedDate,h=f.min,i=f.max,j=f.mode;e=g?new Date(j===MODE.YEAR?g.getFullYear()+c:g.getFullYear(),j===MODE.MONTH?g.getMonth()+b:g.getMonth(),j===MODE.DAY?g.getDate()+a:g.getDate()):getStartOfDay(new Date),e=moveToWithinRange(e,h,i),+e!=+g&&d.props.onChange(e)}),_defineProperty(_assertThisInitialized(d),"focusOn",function(a,b){var c=d.element.current.querySelector(a);c?c.focus():b&&d.focusOn(b)}),_defineProperty(_assertThisInitialized(d),"switchMode",function(a){d.setState({mode:a},function(){d.focusOn(".active",".today")})}),_defineProperty(_assertThisInitialized(d),"switchToDays",function(){return d.switchMode(MODE.DAY)}),_defineProperty(_assertThisInitialized(d),"switchToMonths",function(){return d.switchMode(MODE.MONTH)}),_defineProperty(_assertThisInitialized(d),"switchToYears",function(){return d.switchMode(MODE.YEAR)}),_defineProperty(_assertThisInitialized(d),"handleSelectedDateUpdate",function(a){d.setState({selectedDate:a},function(){d.props.onChange(a),d.close(),d.focusOn(".btn")})}),_defineProperty(_assertThisInitialized(d),"handleViewDateUpdate",function(a){var b=a.month,c=void 0===b?d.state.viewMonth:b,e=a.year,f=void 0===e?d.state.viewYear:e;d.setState({viewMonth:c,viewYear:f})}),_defineProperty(_assertThisInitialized(d),"getCalendar",function(){var a=d.state,b=a.selectedDate,c=a.min,e=a.max,f=a.viewMonth,g=a.viewYear,h=a.mode,i=d.props,j=i.placeholder,k=i.monthFormat;return/*#__PURE__*/_jsxs(_Fragment,{children:[h===MODE.DAY&&/*#__PURE__*/_jsx(DayCalendar,{selectedDate:b,min:c,max:e,viewMonth:f,viewYear:g,monthFormat:k,onSelect:d.handleSelectedDateUpdate,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.MONTH&&/*#__PURE__*/_jsx(MonthCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToDays,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.YEAR&&/*#__PURE__*/_jsx(YearCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToMonths,onViewDateUpdate:d.handleViewDateUpdate})]})}),_defineProperty(_assertThisInitialized(d),"handleClear",function(){d.props.onChange(null),d.focusOn(".np-date-trigger")}),d.state={selectedDate:getStartOfDay(a.value),min:getStartOfDay(a.min),max:getStartOfDay(a.max),viewMonth:(a.value||new Date).getMonth(),viewYear:(a.value||new Date).getFullYear(),open:!1,mode:MODE.DAY,isMobile:!1},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentDidUpdate",value:function componentDidUpdate(a){+this.props.value!=+a.value&&this.state.open&&this.focusOn(".active")}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState=function(){}}},{key:"render",value:function render(){var a=this.state,b=a.selectedDate,c=a.open,d=a.isMobile,e=this.props,f=e.size,g=e.placeholder,h=e.label,i=e.monthFormat,j=e.disabled,k=e.clearable,l=e.value;return/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{createRef,PureComponent}from"react";import{Size,MonthFormat,Breakpoint}from"../common";import BottomSheet from"../common/bottomSheet";import{isWithinRange,moveToWithinRange}from"../common/dateUtils";import KeyCodes from"../common/keyCodes";import DateTrigger from"./dateTrigger";import DayCalendar from"./dayCalendar";import{getStartOfDay}from"./getStartOfDay";import MonthCalendar from"./monthCalendar";import YearCalendar from"./yearCalendar";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MODE={DAY:"day",MONTH:"month",YEAR:"year"},DateLookup=/*#__PURE__*/function(a){function b(a){var d;return _classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"element",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"dropdown",/*#__PURE__*/createRef()),_defineProperty(_assertThisInitialized(d),"getWindowSize",function(){return"undefined"!=typeof window&&window.innerWidth||"undefined"!=typeof document&&document.documentElement.clientWidth}),_defineProperty(_assertThisInitialized(d),"open",function(){var a=d.props.onFocus;d.setState({open:!0,mode:MODE.DAY,isMobile:d.getWindowSize()<=Breakpoint.SMALL},function(){d.adjustIfOffscreen(),d.focusOn(".tw-date-lookup-header-current")}),a&&a(),window.addEventListener("resize",d.resizeHandler),document.addEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"resizeHandler",function(){return d.setState({isMobile:d.getWindowSize()<=Breakpoint.SMALL},d.adjustIfOffscreen())}),_defineProperty(_assertThisInitialized(d),"adjustIfOffscreen",function(){if(!d.state.isMobile&&d.open&&d.dropdown&&d.dropdown.current){var a=d.dropdown.current,b=a.getBoundingClientRect(),c=b.right>d.getWindowSize(),e=0>b.left;c&&a.classList[e?"remove":"add"]("dropdown-menu-xs-right")}}),_defineProperty(_assertThisInitialized(d),"close",function(){var a=d.props.onBlur;d.setState({open:!1}),a&&a(),window.removeEventListener("resize",d.adjustIfOffscreen),document.removeEventListener("click",d.handleOutsideClick,!0)}),_defineProperty(_assertThisInitialized(d),"handleOutsideClick",function(a){var b=d.state.isMobile;if(d.state.open&&!b){var c=d.element.current.querySelector(".dropdown-menu");c&&!c.contains(a.target)&&d.close()}}),_defineProperty(_assertThisInitialized(d),"handleKeyDown",function(a){var b=d.state.open;switch(a.keyCode){case KeyCodes.LEFT:b?d.adjustDate(-1,-1,-1):d.open(),a.preventDefault();break;case KeyCodes.UP:b?d.adjustDate(-7,-4,-4):d.open(),a.preventDefault();break;case KeyCodes.RIGHT:b?d.adjustDate(1,1,1):d.open(),a.preventDefault();break;case KeyCodes.DOWN:b?d.adjustDate(7,4,4):d.open(),a.preventDefault();break;case KeyCodes.ESCAPE:d.close(),a.preventDefault();break;default:}}),_defineProperty(_assertThisInitialized(d),"adjustDate",function(a,b,c){var e,f=d.state,g=f.selectedDate,h=f.min,i=f.max,j=f.mode;e=g?new Date(j===MODE.YEAR?g.getFullYear()+c:g.getFullYear(),j===MODE.MONTH?g.getMonth()+b:g.getMonth(),j===MODE.DAY?g.getDate()+a:g.getDate()):getStartOfDay(new Date),e=moveToWithinRange(e,h,i),+e!=+g&&d.props.onChange(e)}),_defineProperty(_assertThisInitialized(d),"focusOn",function(a,b){var c=d.element.current.querySelector(a);c?c.focus():b&&d.focusOn(b)}),_defineProperty(_assertThisInitialized(d),"switchMode",function(a){d.setState({mode:a},function(){d.focusOn(".active",".today")})}),_defineProperty(_assertThisInitialized(d),"switchToDays",function(){return d.switchMode(MODE.DAY)}),_defineProperty(_assertThisInitialized(d),"switchToMonths",function(){return d.switchMode(MODE.MONTH)}),_defineProperty(_assertThisInitialized(d),"switchToYears",function(){return d.switchMode(MODE.YEAR)}),_defineProperty(_assertThisInitialized(d),"handleSelectedDateUpdate",function(a){d.setState({selectedDate:a},function(){d.props.onChange(a),d.close(),d.focusOn(".btn")})}),_defineProperty(_assertThisInitialized(d),"handleViewDateUpdate",function(a){var b=a.month,c=void 0===b?d.state.viewMonth:b,e=a.year,f=void 0===e?d.state.viewYear:e;d.setState({viewMonth:c,viewYear:f})}),_defineProperty(_assertThisInitialized(d),"getCalendar",function(){var a=d.state,b=a.selectedDate,c=a.min,e=a.max,f=a.viewMonth,g=a.viewYear,h=a.mode,i=d.props,j=i.placeholder,k=i.monthFormat;return/*#__PURE__*/_jsxs(_Fragment,{children:[h===MODE.DAY&&/*#__PURE__*/_jsx(DayCalendar,{selectedDate:b,min:c,max:e,viewMonth:f,viewYear:g,monthFormat:k,onSelect:d.handleSelectedDateUpdate,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.MONTH&&/*#__PURE__*/_jsx(MonthCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToDays,onLabelClick:d.switchToYears,onViewDateUpdate:d.handleViewDateUpdate}),h===MODE.YEAR&&/*#__PURE__*/_jsx(YearCalendar,{selectedDate:b,min:c,max:e,viewYear:g,placeholder:j,onSelect:d.switchToMonths,onViewDateUpdate:d.handleViewDateUpdate})]})}),_defineProperty(_assertThisInitialized(d),"handleClear",function(){d.props.onChange(null),d.focusOn(".np-date-trigger")}),d.state={selectedDate:getStartOfDay(a.value),min:getStartOfDay(a.min),max:getStartOfDay(a.max),viewMonth:(a.value||new Date).getMonth(),viewYear:(a.value||new Date).getFullYear(),open:!1,mode:MODE.DAY,isMobile:!1},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"componentDidUpdate",value:function componentDidUpdate(a){+this.props.value!=+a.value&&this.state.open&&this.focusOn(".active")}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState=function(){}}},{key:"render",value:function render(){var a=this.state,b=a.selectedDate,c=a.open,d=a.isMobile,e=this.props,f=e.size,g=e.placeholder,h=e.label,i=e.monthFormat,j=e.disabled,k=e.clearable,l=e.value;return/*#__PURE__*/_jsxs("div",{// eslint-disable-line jsx-a11y/no-static-element-interactions
2
2
  ref:this.element,className:"btn-group btn-block dropdown ".concat(c?"open":""),onKeyDown:this.handleKeyDown,children:[/*#__PURE__*/_jsx(DateTrigger,{selectedDate:b,size:f,placeholder:g,label:h,monthFormat:i,disabled:j,onClick:this.open,onClear:!j&&k&&l?this.handleClear:null}),d?/*#__PURE__*/_jsx(BottomSheet,{open:c,onClose:this.close,children:this.getCalendar()}):c&&/*#__PURE__*/_jsx("div",{ref:this.dropdown,className:"dropdown-menu tw-date-lookup-menu",children:this.getCalendar()})]})}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(a,b){var c=getStartOfDay(a.value),d=getStartOfDay(a.min),e=getStartOfDay(a.max),f=+b.selectedDate!=+c,g=+b.min!=+d,h=+b.max!=+e;if(f||g||h){var i=f?c:b.selectedDate,j=g?d:b.min,k=h?e:b.max;// make sure that selected date is within allowed range
3
3
  if(!isWithinRange(i,j,k))return a.onChange(moveToWithinRange(i,j,k)),null;var l=(i||new Date).getMonth(),m=(i||new Date).getFullYear();return{selectedDate:i,min:j,max:k,viewMonth:l,viewYear:m}}return null}}]),b}(PureComponent);DateLookup.propTypes={value:PropTypes.instanceOf(Date).isRequired,min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string,label:PropTypes.string,monthFormat:PropTypes.oneOf(["long","short"]),disabled:PropTypes.bool,onChange:PropTypes.func.isRequired,onFocus:PropTypes.func,onBlur:PropTypes.func,clearable:PropTypes.bool},DateLookup.defaultProps={min:null,max:null,size:Size.MEDIUM,placeholder:"",label:"",monthFormat:MonthFormat.LONG,disabled:!1,onFocus:null,onBlur:null,clearable:!1};export default DateLookup;
@@ -1 +1 @@
1
- import{useIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import{CrossCircle}from"@transferwise/icons";import{isKey}from"@transferwise/neptune-validation";import messages from"./DateTrigger.messages";import Chevron from"../../chevron";import{Size,Position}from"../../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{onClick:h,className:"btn btn-".concat(c," btn-input dropdown-toggle np-date-trigger np-date-trigger--").concat(c),disabled:g,type:"button",children:[e&&/*#__PURE__*/_jsx("span",{className:"control-label small m-r-1",children:e}),b?/*#__PURE__*/_jsx("span",{children:formatDate(b,k,{day:"numeric",month:f,year:"numeric"})}):/*#__PURE__*/_jsx("span",{className:"form-control-placeholder visible-xs-inline visible-sm-inline visible-md-inline visible-lg-inline visible-xl-inline",children:d}),i?/*#__PURE__*/_jsx("span",{onClick:function(a){a.stopPropagation(),a.preventDefault(),i()},onKeyDown:function handleKeyDown(a){(isKey({keyType:"Space",event:a})||isKey({keyType:"Enter",event:a}))&&(a.stopPropagation(),a.preventDefault(),i())},role:"button",tabIndex:0,className:"clear-btn d-flex align-items-center","aria-label":l(messages.ariaLabel),children:/*#__PURE__*/_jsx(CrossCircle,{filled:!0,size:c===Size.SMALL?16:24})}):/*#__PURE__*/_jsx(Chevron,{orientation:Position.BOTTOM,disabled:g})]})};DateTrigger.propTypes={selectedDate:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string.isRequired,label:PropTypes.string.isRequired,monthFormat:PropTypes.oneOf(["short","long"]).isRequired,disabled:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired,onClear:PropTypes.func},DateTrigger.defaultProps={selectedDate:null,size:Size.MEDIUM,onClear:void 0};export default DateTrigger;
1
+ import{formatDate}from"@transferwise/formatting";import{CrossCircle}from"@transferwise/icons";import{isKey}from"@transferwise/neptune-validation";import PropTypes from"prop-types";import{useIntl}from"react-intl";import Chevron from"../../chevron";import{Size,Position}from"../../common";import messages from"./DateTrigger.messages";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DateTrigger=function(a){var b=a.selectedDate,c=a.size,d=a.placeholder,e=a.label,f=a.monthFormat,g=a.disabled,h=a.onClick,i=a.onClear,j=useIntl(),k=j.locale,l=j.formatMessage;return/*#__PURE__*/_jsxs("button",{className:"btn btn-".concat(c," btn-input dropdown-toggle np-date-trigger np-date-trigger--").concat(c),disabled:g,type:"button",onClick:h,children:[e&&/*#__PURE__*/_jsx("span",{className:"control-label small m-r-1",children:e}),b?/*#__PURE__*/_jsx("span",{children:formatDate(b,k,{day:"numeric",month:f,year:"numeric"})}):/*#__PURE__*/_jsx("span",{className:"form-control-placeholder visible-xs-inline visible-sm-inline visible-md-inline visible-lg-inline visible-xl-inline",children:d}),i?/*#__PURE__*/_jsx("span",{role:"button",tabIndex:0,className:"clear-btn d-flex align-items-center","aria-label":l(messages.ariaLabel),onClick:function(a){a.stopPropagation(),a.preventDefault(),i()},onKeyDown:function handleKeyDown(a){(isKey({keyType:"Space",event:a})||isKey({keyType:"Enter",event:a}))&&(a.stopPropagation(),a.preventDefault(),i())},children:/*#__PURE__*/_jsx(CrossCircle,{filled:!0,size:c===Size.SMALL?16:24})}):/*#__PURE__*/_jsx(Chevron,{orientation:Position.BOTTOM,disabled:g})]})};DateTrigger.propTypes={selectedDate:PropTypes.instanceOf(Date),size:PropTypes.oneOf(["sm","md","lg"]),placeholder:PropTypes.string.isRequired,label:PropTypes.string.isRequired,monthFormat:PropTypes.oneOf(["short","long"]).isRequired,disabled:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired,onClear:PropTypes.func},DateTrigger.defaultProps={selectedDate:null,size:Size.MEDIUM,onClear:void 0};export default DateTrigger;
@@ -1 +1 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{PureComponent}from"react";import{injectIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import{MonthFormat}from"../../common";import Header from"../header";import DayCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(f,e),g,{month:h,year:"numeric"}),onLabelClick:i,onPreviousClick:this.selectPreviousMonth,onNextClick:this.selectNextMonth}),/*#__PURE__*/_jsx(DayCalendarTable,{selectedDate:b,min:c,max:d,viewMonth:e,viewYear:f,onSelect:j})]})}}]),b}(PureComponent);DayCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,monthFormat:PropTypes.oneOf([MonthFormat.LONG,MonthFormat.SHORT]).isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},DayCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendar);
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{MonthFormat}from"../../common";import Header from"../header";import DayCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DayCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"selectPreviousMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:0>=c?11:c-1,year:0>=c?d-1:d})}),_defineProperty(_assertThisInitialized(a),"selectNextMonth",function(){var b=a.props,c=b.viewMonth,d=b.viewYear;a.props.onViewDateUpdate({month:11<=c?0:c+1,year:11<=c?d+1:d})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewMonth,f=a.viewYear,g=a.intl.locale,h=a.monthFormat,i=a.onLabelClick,j=a.onSelect;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(f,e),g,{month:h,year:"numeric"}),onLabelClick:i,onPreviousClick:this.selectPreviousMonth,onNextClick:this.selectNextMonth}),/*#__PURE__*/_jsx(DayCalendarTable,{selectedDate:b,min:c,max:d,viewMonth:e,viewYear:f,onSelect:j})]})}}]),b}(PureComponent);DayCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,monthFormat:PropTypes.oneOf([MonthFormat.LONG,MonthFormat.SHORT]).isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},DayCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendar);
@@ -1,4 +1,4 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{PureComponent}from"react";import{injectIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import{getDayNames,isWithinRange}from"../../../common/dateUtils";import{getStartOfDay}from"../../getStartOfDay";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SHORT_DAY_FORMAT={day:"numeric"},DayCalendarTable=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"getTableStructure",function(){var b=a.props,c=b.viewMonth,d=b.viewYear,e=new Date(d,c,1).getDay();0===e&&(e=7);var f,g=new Date(d,c+1,0).getDate(),h=[],j=[];// Pad first week
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import{getDayNames,isWithinRange}from"../../../common/dateUtils";import{getStartOfDay}from"../../getStartOfDay";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SHORT_DAY_FORMAT={day:"numeric"},DayCalendarTable=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"getTableStructure",function(){var b=a.props,c=b.viewMonth,d=b.viewYear,e=new Date(d,c,1).getDay();0===e&&(e=7);var f,g=new Date(d,c+1,0).getDate(),h=[],j=[];// Pad first week
2
2
  for(f=1;f<e;f+=1)h.push(!1);// Fill in days
3
- for(f=1;f<=g;f+=1)h.push(f),0==(e+f-1)%7&&(j.push(h),h=[]);if(h.length){// Pad last week
4
- for(f=h.length;7>f;f+=1)h.push(!1);j.push(h)}return j}),_defineProperty(_assertThisInitialized(a),"days",getDayNames(a.props.intl.locale,"short")),_defineProperty(_assertThisInitialized(a),"daysShort",getDayNames(a.props.intl.locale,"narrow")),_defineProperty(_assertThisInitialized(a),"selectDay",function(b){var c=a.props,d=c.viewMonth,e=c.viewYear,f=c.onSelect;f(new Date(e,d,b))}),_defineProperty(_assertThisInitialized(a),"isDisabled",function(b){var c=a.props,d=c.min,e=c.max,f=c.viewMonth,g=c.viewYear,h=new Date(g,f,b);return!isWithinRange(h,d,e)}),_defineProperty(_assertThisInitialized(a),"isActive",function(b){var c=a.props,d=c.selectedDate,e=c.viewMonth,f=c.viewYear;return!!(d&&+new Date(f,e,b)==+d)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.viewMonth,d=b.viewYear,e=b.intl.locale,f=this.getTableStructure();return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{children:/*#__PURE__*/_jsx("tr",{children:this.days.map(function(b,c){return/*#__PURE__*/_jsxs("th",{className:"text-xs-center",children:[/*#__PURE__*/_jsx("span",{className:"hidden-xs",children:b.substring(0,3)}),/*#__PURE__*/_jsx("span",{className:"visible-xs-inline-block",children:a.daysShort[c].substring(0,2)})]},b)})})}),/*#__PURE__*/_jsx("tbody",{children:f.map(function(b,f){return/*#__PURE__*/_jsx("tr",{children:b.map(function(b,f){return/*#__PURE__*/_jsx("td",{className:4<f?"default":"",children:b&&/*#__PURE__*/_jsx(TableLink,{item:b,type:"day",title:formatDate(new Date(d,c,b),e,SHORT_DAY_FORMAT),longTitle:formatDate(new Date(d,c,b),e),active:a.isActive(b),disabled:a.isDisabled(b),today:+getStartOfDay(new Date)==+new Date(d,c,b),onClick:a.selectDay})},f)})},f)})})]})}}]),b}(PureComponent);DayCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,onSelect:PropTypes.func.isRequired},DayCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendarTable);
3
+ for(f=1;f<=g;f+=1)h.push(f),0==(e+f-1)%7&&(j.push(h),h=[]);if(0<h.length){// Pad last week
4
+ for(f=h.length;7>f;f+=1)h.push(!1);j.push(h)}return j}),_defineProperty(_assertThisInitialized(a),"days",getDayNames(a.props.intl.locale,"short")),_defineProperty(_assertThisInitialized(a),"daysShort",getDayNames(a.props.intl.locale,"narrow")),_defineProperty(_assertThisInitialized(a),"selectDay",function(b){var c=a.props,d=c.viewMonth,e=c.viewYear,f=c.onSelect;f(new Date(e,d,b))}),_defineProperty(_assertThisInitialized(a),"isDisabled",function(b){var c=a.props,d=c.min,e=c.max,f=c.viewMonth,g=c.viewYear,h=new Date(g,f,b);return!isWithinRange(h,d,e)}),_defineProperty(_assertThisInitialized(a),"isActive",function(b){var c=a.props,d=c.selectedDate,e=c.viewMonth,f=c.viewYear;return!!(d&&+new Date(f,e,b)==+d)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this,b=this.props,c=b.viewMonth,d=b.viewYear,e=b.intl.locale,f=this.getTableStructure();return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{children:/*#__PURE__*/_jsx("tr",{children:this.days.map(function(b,c){return/*#__PURE__*/_jsxs("th",{className:"text-xs-center",children:[/*#__PURE__*/_jsx("span",{className:"hidden-xs",children:b.slice(0,3)}),/*#__PURE__*/_jsx("span",{className:"visible-xs-inline-block",children:a.daysShort[c].slice(0,2)})]},b)})})}),/*#__PURE__*/_jsx("tbody",{children:f.map(function(b,f){return/*#__PURE__*/_jsx("tr",{children:b.map(function(b,f){return/*#__PURE__*/_jsx("td",{className:4<f?"default":"",children:b&&/*#__PURE__*/_jsx(TableLink,{item:b,type:"day",title:formatDate(new Date(d,c,b),e,SHORT_DAY_FORMAT),longTitle:formatDate(new Date(d,c,b),e),active:a.isActive(b),disabled:a.isDisabled(b),today:+getStartOfDay(new Date)==+new Date(d,c,b),onClick:a.selectDay})},f)})},f)})})]})}}]),b}(PureComponent);DayCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewMonth:PropTypes.number.isRequired,viewYear:PropTypes.number.isRequired,onSelect:PropTypes.func.isRequired},DayCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(DayCalendarTable);
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import Chevron from"../../chevron";import{Position,Size}from"../../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var btnClasses="btn-link p-a-0 text-no-decoration font-weight-bold",Header=function(a){var b=a.label,c=a.onLabelClick,d=a.onPreviousClick,e=a.onNextClick;return/*#__PURE__*/_jsxs("div",{className:"text-xs-center p-t-1 p-b-2 clearfix",children:[/*#__PURE__*/_jsx("div",{className:"pull-xs-left",children:/*#__PURE__*/_jsx("button",{type:"button",onClick:d,className:btnClasses,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.LEFT,size:Size.MEDIUM})})}),b&&/*#__PURE__*/_jsx("button",{type:"button",onClick:c,className:"tw-date-lookup-header-current ".concat(btnClasses),children:b}),/*#__PURE__*/_jsx("div",{className:"pull-xs-right",children:/*#__PURE__*/_jsx("button",{type:"button",onClick:e,className:btnClasses,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.RIGHT,size:Size.MEDIUM})})})]})};Header.propTypes={label:PropTypes.string,onLabelClick:PropTypes.func,onPreviousClick:PropTypes.func.isRequired,onNextClick:PropTypes.func.isRequired},Header.defaultProps={label:null,onLabelClick:function onLabelClick(){}};export default Header;
1
+ import PropTypes from"prop-types";import Chevron from"../../chevron";import{Position,Size}from"../../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var buttonClasses="btn-link p-a-0 text-no-decoration font-weight-bold",Header=function(a){var b=a.label,c=a.onLabelClick,d=a.onPreviousClick,e=a.onNextClick;return/*#__PURE__*/_jsxs("div",{className:"text-xs-center p-t-1 p-b-2 clearfix",children:[/*#__PURE__*/_jsx("div",{className:"pull-xs-left",children:/*#__PURE__*/_jsx("button",{type:"button",className:buttonClasses,onClick:d,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.LEFT,size:Size.MEDIUM})})}),b&&/*#__PURE__*/_jsx("button",{type:"button",className:"tw-date-lookup-header-current ".concat(buttonClasses),onClick:c,children:b}),/*#__PURE__*/_jsx("div",{className:"pull-xs-right",children:/*#__PURE__*/_jsx("button",{type:"button",className:buttonClasses,onClick:e,children:/*#__PURE__*/_jsx(Chevron,{orientation:Position.RIGHT,size:Size.MEDIUM})})})]})};Header.propTypes={label:PropTypes.string,onLabelClick:PropTypes.func,onPreviousClick:PropTypes.func.isRequired,onNextClick:PropTypes.func.isRequired},Header.defaultProps={label:null,onLabelClick:function onLabelClick(){}};export default Header;
@@ -1 +1 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{PureComponent}from"react";import{injectIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import Header from"../header";import MonthCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(e,0),f,{year:"numeric"}),onLabelClick:h,onPreviousClick:this.selectPreviousYear,onNextClick:this.selectNextYear}),/*#__PURE__*/_jsx(MonthCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:g,onSelect:this.onMonthSelect})]})}}]),b}(PureComponent);MonthCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},MonthCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(MonthCalendar);
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{PureComponent}from"react";import{injectIntl}from"react-intl";import Header from"../header";import MonthCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var MonthCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onMonthSelect",function(b){a.props.onViewDateUpdate({month:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear-1})}),_defineProperty(_assertThisInitialized(a),"selectNextYear",function(){a.props.onViewDateUpdate({year:a.props.viewYear+1})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.intl.locale,g=a.placeholder,h=a.onLabelClick;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{label:formatDate(new Date(e,0),f,{year:"numeric"}),onLabelClick:h,onPreviousClick:this.selectPreviousYear,onNextClick:this.selectNextYear}),/*#__PURE__*/_jsx(MonthCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:g,onSelect:this.onMonthSelect})]})}}]),b}(PureComponent);MonthCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onLabelClick:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},MonthCalendar.defaultProps={selectedDate:null,min:null,max:null};export default injectIntl(MonthCalendar);
@@ -1 +1 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{useIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=3,COLS=4,MONTH_ONLY_FORMAY={month:"short"},MonthCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"month",title:formatDate(new Date(e,a),i,MONTH_ONLY_FORMAY),active:!!(b&&a===b.getMonth()&&e===b.getFullYear()),disabled:k(a),today:e===new Date().getFullYear()&&a===new Date().getMonth(),onClick:g})},k=function(a){var b=new Date(e,a);return!!(c&&b<new Date(c.getFullYear(),c.getMonth())||d&&b>new Date(d.getFullYear(),d.getMonth()))};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"3",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(b*COLS+c)},c)})},b)})})]})};MonthCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},MonthCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default MonthCalendarTable;
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{useIntl}from"react-intl";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=3,COLS=4,MONTH_ONLY_FORMAY={month:"short"},MonthCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"month",title:formatDate(new Date(e,a),i,MONTH_ONLY_FORMAY),active:!!(b&&a===b.getMonth()&&e===b.getFullYear()),disabled:k(a),today:e===new Date().getFullYear()&&a===new Date().getMonth(),onClick:g})},k=function(a){var b=new Date(e,a);return!!(c&&b<new Date(c.getFullYear(),c.getMonth())||d&&b>new Date(d.getFullYear(),d.getMonth()))};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"3",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(b*COLS+c)},c)})},b)})})]})};MonthCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},MonthCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default MonthCalendarTable;
@@ -1,2 +1,2 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{PureComponent}from"react";import PropTypes from"prop-types";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var TableLink=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onClick",function(b){b.preventDefault(),a.props.disabled||a.props.onClick(a.props.item)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.item,c=a.type,d=a.title,e=a.longTitle,f=a.active,g=a.disabled,h=a.today;return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx("button",{type:"button",onClick:this.onClick,className:"tw-date-lookup-".concat(c,"-option ").concat(f?"active":""," ").concat(h?"today":""),disabled:g,"aria-label":e,children:d||b})})}}]),b}(PureComponent);TableLink.propTypes={item:PropTypes.number.isRequired,// day (1-31), month (0-11) or year (2018 etc)
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{PureComponent}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var TableLink=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onClick",function(b){b.preventDefault(),a.props.disabled||a.props.onClick(a.props.item)}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.item,c=a.type,d=a.title,e=a.longTitle,f=a.active,g=a.disabled,h=a.today;return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx("button",{type:"button",className:"tw-date-lookup-".concat(c,"-option ").concat(f?"active":""," ").concat(h?"today":""),disabled:g,"aria-label":e,onClick:this.onClick,children:d||b})})}}]),b}(PureComponent);TableLink.propTypes={item:PropTypes.number.isRequired,// day (1-31), month (0-11) or year (2018 etc)
2
2
  type:PropTypes.oneOf(["day","month","year"]).isRequired,title:PropTypes.string,longTitle:PropTypes.string,active:PropTypes.bool.isRequired,disabled:PropTypes.bool.isRequired,today:PropTypes.bool.isRequired,onClick:PropTypes.func.isRequired},TableLink.defaultProps={title:null,longTitle:null};export default TableLink;
@@ -1 +1 @@
1
- import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import{PureComponent}from"react";import PropTypes from"prop-types";import Header from"../header";import YearCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{onPreviousClick:this.selectPreviousYears,onNextClick:this.selectNextYears}),/*#__PURE__*/_jsx(YearCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:f,onSelect:this.onYearSelect})]})}}]),b}(PureComponent);YearCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},YearCalendar.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendar;
1
+ import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _defineProperty from"@babel/runtime/helpers/defineProperty";function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}import PropTypes from"prop-types";import{PureComponent}from"react";import Header from"../header";import YearCalendarTable from"./table";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var YearCalendar=/*#__PURE__*/function(a){function b(){var a;_classCallCheck(this,b);for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return a=c.call.apply(c,[this].concat(e)),_defineProperty(_assertThisInitialized(a),"onYearSelect",function(b){a.props.onViewDateUpdate({year:b}),a.props.onSelect()}),_defineProperty(_assertThisInitialized(a),"selectPreviousYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear-20})}),_defineProperty(_assertThisInitialized(a),"selectNextYears",function(){a.props.onViewDateUpdate({year:a.props.viewYear+20})}),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder;return/*#__PURE__*/_jsxs("div",{children:[/*#__PURE__*/_jsx(Header,{onPreviousClick:this.selectPreviousYears,onNextClick:this.selectNextYears}),/*#__PURE__*/_jsx(YearCalendarTable,{selectedDate:b,min:c,max:d,viewYear:e,placeholder:f,onSelect:this.onYearSelect})]})}}]),b}(PureComponent);YearCalendar.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired,onViewDateUpdate:PropTypes.func.isRequired},YearCalendar.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendar;
@@ -1 +1 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{useIntl}from"react-intl";import PropTypes from"prop-types";import{formatDate}from"@transferwise/formatting";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=5,COLS=4,YEAR_ONLY_FORMAT={year:"numeric"},YearCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"year",title:formatDate(new Date(a,0),i,YEAR_ONLY_FORMAT),active:!!(b&&a===b.getFullYear()),disabled:!!(c&&a<c.getFullYear()||d&&a>d.getFullYear()),today:a===new Date().getFullYear(),onClick:g})};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"4",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(e-e%20+b*COLS+c)},c)})},b)})})]})};YearCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},YearCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendarTable;
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{formatDate}from"@transferwise/formatting";import PropTypes from"prop-types";import{useIntl}from"react-intl";import TableLink from"../../tableLink";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var ROWS=5,COLS=4,YEAR_ONLY_FORMAT={year:"numeric"},YearCalendarTable=function(a){var b=a.selectedDate,c=a.min,d=a.max,e=a.viewYear,f=a.placeholder,g=a.onSelect,h=useIntl(),i=h.locale,j=function(a){return/*#__PURE__*/_jsx(TableLink,{item:a,type:"year",title:formatDate(new Date(a,0),i,YEAR_ONLY_FORMAT),active:!!(b&&a===b.getFullYear()),disabled:!!(c&&a<c.getFullYear()||d&&a>d.getFullYear()),today:a===new Date().getFullYear(),onClick:g})};return/*#__PURE__*/_jsxs("table",{className:"table table-condensed table-bordered tw-date-lookup-calendar m-b-0",children:[/*#__PURE__*/_jsx("thead",{className:"sr-only",children:/*#__PURE__*/_jsx("tr",{children:/*#__PURE__*/_jsx("th",{colSpan:"4",children:f})})}),/*#__PURE__*/_jsx("tbody",{children:_toConsumableArray([,,,,,]).map(function(a,b){return/*#__PURE__*/_jsx("tr",{children:_toConsumableArray(Array(COLS)).map(function(a,c){return/*#__PURE__*/_jsx("td",{children:j(e-e%20+b*COLS+c)},c)})},b)})})]})};YearCalendarTable.propTypes={selectedDate:PropTypes.instanceOf(Date),min:PropTypes.instanceOf(Date),max:PropTypes.instanceOf(Date),viewYear:PropTypes.number.isRequired,placeholder:PropTypes.string.isRequired,onSelect:PropTypes.func.isRequired},YearCalendarTable.defaultProps={selectedDate:null,min:null,max:null};export default YearCalendarTable;
@@ -1,5 +1,5 @@
1
- import PropTypes from"prop-types";import requiredIf from"react-required-if";import classNames from"classnames";import SizeSwapper from"../sizeSwapper";import NavigationOption from"../navigationOption";import Tile from"../tile";import{Presentation,Type}from"./decisionEnums";import{Size,Breakpoint}from"../common";import{useDirection}from"../common/hooks";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var Decision=function(a){var b=a.options,c=a.presentation,d=a.type,e=a.size,f=useDirection(),g=f.isRTL;if(d===Type.NAVIGATION){var h=Presentation.LIST_BLOCK,i=Presentation.LIST_BLOCK_GRID;if(c===h||c===i){var j=e===Size.SMALL,k=c===i,l=[{items:[],layout:SizeSwapper.Layout.COLUMN},{items:[],breakpoint:j?Breakpoint.EXTRA_SMALL:Breakpoint.SMALL,wrap:k}];return b.forEach(function(a,b){var c=a.description,d=a.disabled,e=a.href,f=a.target,g=a.media,h=g.block,i=g.list,m=a.onClick,n=a.title;l[0].items.push(/*#__PURE__*/_jsx(NavigationOption,{complex:!1,content:c,disabled:d,href:e,target:f,// eslint-disable-line react/no-array-index-key
2
- media:i,onClick:m,showMediaAtAllSizes:!0,title:n},"nav-".concat(b))),l[1].items.push(/*#__PURE__*/_jsx(Tile,{className:classNames("np-decision__tile".concat(j?"--small":""),{"np-decision__tile--fixed-width":k}),description:c,disabled:d,href:e,target:f,// eslint-disable-line react/no-array-index-key
3
- media:h,onClick:m,size:j?Size.SMALL:Size.MEDIUM,title:n},"tile-".concat(b)))}),/*#__PURE__*/_jsx("div",{className:classNames("np-decision",{"np-decision--small":j,"np-decision--grid":k,"np-decision--rtl":g}),children:/*#__PURE__*/_jsx(SizeSwapper,{items:l})})}// LIST
4
- return b.map(function(a,b){var c=a.title,d=a.description,e=a.disabled,f=a.href,g=a.target,h=a.media.list,i=a.onClick;return/*#__PURE__*/_jsx(NavigationOption,{complex:!1,content:d,disabled:e,href:f,target:g,// eslint-disable-line react/no-array-index-key
5
- media:h,onClick:i,showMediaAtAllSizes:!0,title:c},"nav-".concat(b))})}return/*#__PURE__*/_jsx(_Fragment,{})};Decision.propTypes={/** A list of elements to be rendered */options:PropTypes.arrayOf(PropTypes.shape({description:PropTypes.node,disabled:PropTypes.bool,href:requiredIf(PropTypes.string,function(a){return a.type===Type.NAVIGATION}),target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),media:PropTypes.shape({block:PropTypes.node.isRequired,list:PropTypes.node.isRequired}),onClick:PropTypes.func.isRequired,title:PropTypes.node.isRequired})).isRequired,/** Handles the display mode of the component */presentation:PropTypes.oneOf(["LIST","LIST_BLOCK","LIST_BLOCK_GRID"]),/** Size currently affects only Tile dimension */size:PropTypes.oneOf(["sm","md"]),/** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */type:PropTypes.oneOf(["NAVIGATION"])},Decision.defaultProps={presentation:Presentation.LIST,size:Size.MEDIUM,type:Type.NAVIGATION};export default Decision;
1
+ import classNames from"classnames";import PropTypes from"prop-types";import requiredIf from"react-required-if";import{Size,Breakpoint}from"../common";import{useDirection}from"../common/hooks";import NavigationOption from"../navigationOption";import SizeSwapper from"../sizeSwapper";import Tile from"../tile";import{Presentation,Type}from"./decisionEnums";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var Decision=function(a){var b=a.options,c=a.presentation,d=a.type,e=a.size,f=useDirection(),g=f.isRTL;if(d===Type.NAVIGATION){var h=Presentation.LIST_BLOCK,i=Presentation.LIST_BLOCK_GRID;if(c===h||c===i){var j=e===Size.SMALL,k=c===i,l=[{items:[],layout:SizeSwapper.Layout.COLUMN},{items:[],breakpoint:j?Breakpoint.EXTRA_SMALL:Breakpoint.SMALL,wrap:k}];return b.forEach(function(a,b){var c=a.description,d=a.disabled,e=a.href,f=a.target,g=a.media,h=g.block,i=g.list,m=a.onClick,n=a.title;l[0].items.push(/*#__PURE__*/_jsx(NavigationOption// eslint-disable-next-line react/no-array-index-key
2
+ ,{complex:!1,content:c,disabled:d,href:e,target:f,media:i,showMediaAtAllSizes:!0,title:n,onClick:m},"nav-".concat(b))),l[1].items.push(/*#__PURE__*/_jsx(Tile// eslint-disable-next-line react/no-array-index-key
3
+ ,{className:classNames("np-decision__tile".concat(j?"--small":""),{"np-decision__tile--fixed-width":k}),description:c,disabled:d,href:e,target:f,media:h,size:j?Size.SMALL:Size.MEDIUM,title:n,onClick:m},"tile-".concat(b)))}),/*#__PURE__*/_jsx("div",{className:classNames("np-decision",{"np-decision--small":j,"np-decision--grid":k,"np-decision--rtl":g}),children:/*#__PURE__*/_jsx(SizeSwapper,{items:l})})}// LIST
4
+ return b.map(function(a,b){var c=a.title,d=a.description,e=a.disabled,f=a.href,g=a.target,h=a.media.list,i=a.onClick;return/*#__PURE__*/_jsx(NavigationOption// eslint-disable-next-line react/no-array-index-key
5
+ ,{complex:!1,content:d,disabled:e,href:f,target:g,media:h,showMediaAtAllSizes:!0,title:c,onClick:i},"nav-".concat(b))})}return/*#__PURE__*/_jsx(_Fragment,{})};Decision.propTypes={/** A list of elements to be rendered */options:PropTypes.arrayOf(PropTypes.shape({description:PropTypes.node,disabled:PropTypes.bool,href:requiredIf(PropTypes.string,function(a){return a.type===Type.NAVIGATION}),target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),media:PropTypes.shape({block:PropTypes.node.isRequired,list:PropTypes.node.isRequired}),onClick:PropTypes.func.isRequired,title:PropTypes.node.isRequired})).isRequired,/** Handles the display mode of the component */presentation:PropTypes.oneOf(["LIST","LIST_BLOCK","LIST_BLOCK_GRID"]),/** Size currently affects only Tile dimension */size:PropTypes.oneOf(["sm","md"]),/** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */type:PropTypes.oneOf(["NAVIGATION"])},Decision.defaultProps={presentation:Presentation.LIST,size:Size.MEDIUM,type:Type.NAVIGATION};export default Decision;
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";var _alignmentClassMap;import PropTypes from"prop-types";import classNames from"classnames";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var isLayoutHorizontal=function(a){return 0<=[Layout.HORIZONTAL_LEFT_ALIGNED,Layout.HORIZONTAL_RIGHT_ALIGNED,Layout.HORIZONTAL_JUSTIFIED].indexOf(a)},alignmentClassMap=(_alignmentClassMap={},_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_RIGHT_ALIGNED,"text-sm-right"),_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_JUSTIFIED,"text-sm-justify"),_alignmentClassMap),DefinitionList=function(a){var b=a.definitions,c=a.layout,d=a.muted;return/*#__PURE__*/_jsx("dl",{className:classNames("tw-definition-list d-flex ",{"text-muted":d,"flex-column":c===Layout.VERTICAL_ONE_COLUMN,"tw-definition-list--columns flex-column flex-row--sm":c===Layout.VERTICAL_TWO_COLUMN,"tw-definition-list--horizontal flex-column":isLayoutHorizontal(c)}),children:b.filter(function(a){return a}).map(function(a){var b=a.title,d=a.value,e=a.key;return/*#__PURE__*/_jsxs("div",{className:"tw-definition-list__item",children:[/*#__PURE__*/_jsx("dt",{children:b}),/*#__PURE__*/_jsx("dd",{className:alignmentClassMap[c]||"",children:d})]},e)})})};DefinitionList.propTypes={definitions:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.node.isRequired,value:PropTypes.node.isRequired,key:PropTypes.string.isRequired})),layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED","HORIZONTAL_RIGHT_ALIGNED"]),muted:PropTypes.bool},DefinitionList.defaultProps={definitions:[],layout:Layout.VERTICAL_TWO_COLUMN,muted:!1};export default DefinitionList;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";var _alignmentClassMap;import classNames from"classnames";import PropTypes from"prop-types";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var isLayoutHorizontal=function(a){return[Layout.HORIZONTAL_LEFT_ALIGNED,Layout.HORIZONTAL_RIGHT_ALIGNED,Layout.HORIZONTAL_JUSTIFIED].includes(a)},alignmentClassMap=(_alignmentClassMap={},_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_RIGHT_ALIGNED,"text-sm-right"),_defineProperty(_alignmentClassMap,Layout.HORIZONTAL_JUSTIFIED,"text-sm-justify"),_alignmentClassMap),DefinitionList=function(a){var b=a.definitions,c=a.layout,d=a.muted;return/*#__PURE__*/_jsx("dl",{className:classNames("tw-definition-list d-flex ",{"text-muted":d,"flex-column":c===Layout.VERTICAL_ONE_COLUMN,"tw-definition-list--columns flex-column flex-row--sm":c===Layout.VERTICAL_TWO_COLUMN,"tw-definition-list--horizontal flex-column":isLayoutHorizontal(c)}),children:b.filter(function(a){return a}).map(function(a){var b=a.title,d=a.value,e=a.key;return/*#__PURE__*/_jsxs("div",{className:"tw-definition-list__item",children:[/*#__PURE__*/_jsx("dt",{children:b}),/*#__PURE__*/_jsx("dd",{className:alignmentClassMap[c]||"",children:d})]},e)})})};DefinitionList.propTypes={definitions:PropTypes.arrayOf(PropTypes.shape({title:PropTypes.node.isRequired,value:PropTypes.node.isRequired,key:PropTypes.string.isRequired})),layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED","HORIZONTAL_RIGHT_ALIGNED"]),muted:PropTypes.bool},DefinitionList.defaultProps={definitions:[],layout:Layout.VERTICAL_TWO_COLUMN,muted:!1};export default DefinitionList;
@@ -1,5 +1,5 @@
1
- import{useEffect,useRef}from"react";import PropTypes from"prop-types";import classNames from"classnames";import CSSTransition from"react-transition-group/CSSTransition";import withNextPortal from"../withNextPortal/withNextPortal";import{addNoScrollBodyClass,removeNoScrollBodyClass}from"../common";import FocusBoundary from"../common/focusBoundary";import DimmerManager from"./dimmerManager";import{isIosDevice}from"../common/deviceDetection";import{jsx as _jsx}from"react/jsx-runtime";export var EXIT_ANIMATION=350;var dimmerManager=new DimmerManager,Dimmer=function(a){var b=a.children,c=a.className,d=a.disableClickToClose,e=a.fadeContentOnEnter,f=a.fadeContentOnExit,g=a.transparent,h=a.onClose,i=a.open,j=a.scrollable,k=useRef(),l=!d&&h?function closeOnClick(a){a.target===k.current&&h(a)}:void 0,m=function(a){"Escape"!==a.key||(a.stopPropagation(),h&&dimmerManager.isTop(k)&&h(a))},n=function(a){var b=a.target.className.startsWith("dimmer");// disable scroll on iOS devices for Dimmer area
1
+ import classNames from"classnames";import PropTypes from"prop-types";import{useEffect,useRef}from"react";import CSSTransition from"react-transition-group/CSSTransition";import{addNoScrollBodyClass,removeNoScrollBodyClass}from"../common";import{isIosDevice}from"../common/deviceDetection";import FocusBoundary from"../common/focusBoundary";import withNextPortal from"../withNextPortal/withNextPortal";import DimmerManager from"./dimmerManager";import{jsx as _jsx}from"react/jsx-runtime";export var EXIT_ANIMATION=350;var dimmerManager=new DimmerManager,handleTouchMove=function(a){var b=a.target.className.startsWith("dimmer");// disable scroll on iOS devices for Dimmer area
2
2
  // this is because of bug in WebKit https://bugs.webkit.org/show_bug.cgi?id=220908
3
3
  // note: scrolling still works for children(s) as expected
4
- isIosDevice()&&b&&(a.stopPropagation(),a.preventDefault())};return useEffect(function(){return i&&(document.addEventListener("keydown",m),k.current&&k.current.addEventListener("touchmove",n),!g&&addNoScrollBodyClass()),function(){document.removeEventListener("keydown",m),k.current&&k.current.removeEventListener("touchmove",n),removeNoScrollBodyClass()}},[i]),/*#__PURE__*/_jsx(CSSTransition,{in:i,appear:!0// Wait for animation to finish before unmount.
5
- ,timeout:{enter:0,exit:EXIT_ANIMATION},classNames:{enter:classNames({"dimmer--enter-fade":e}),enterDone:classNames("dimmer--enter-done",{"dimmer--enter-fade":e}),exit:classNames("dimmer--exit",{"dimmer--exit-fade":f})},onEnter:function onEnter(){return dimmerManager.add(k)},onExited:function onExited(){return dimmerManager.remove(k)},unmountOnExit:!0,children:/*#__PURE__*/_jsx("div",{className:classNames("dimmer",{"dimmer--scrollable":j,"dimmer--transparent":g},c),onClick:l,ref:k,role:"presentation",children:/*#__PURE__*/_jsx(FocusBoundary,{children:b})})})};Dimmer.propTypes={children:PropTypes.node,className:PropTypes.string,disableClickToClose:PropTypes.bool,fadeContentOnEnter:PropTypes.bool,fadeContentOnExit:PropTypes.bool,/** Sets the background to transparent and prevents body scroll locking */transparent:PropTypes.bool,onClose:PropTypes.func,open:PropTypes.bool,scrollable:PropTypes.bool},Dimmer.defaultProps={children:null,className:void 0,disableClickToClose:!1,fadeContentOnEnter:!1,fadeContentOnExit:!1,transparent:!1,onClose:void 0,open:!1,scrollable:!1};export{Dimmer};export default withNextPortal(Dimmer);
4
+ isIosDevice()&&b&&(a.stopPropagation(),a.preventDefault())},Dimmer=function(a){var b=a.children,c=a.className,d=a.disableClickToClose,e=a.fadeContentOnEnter,f=a.fadeContentOnExit,g=a.transparent,h=a.onClose,i=a.open,j=a.scrollable,k=useRef(),l=!d&&h?function closeOnClick(a){a.target===k.current&&h(a)}:void 0,m=function(a){"Escape"!==a.key||(a.stopPropagation(),h&&dimmerManager.isTop(k)&&h(a))};return useEffect(function(){return i&&(document.addEventListener("keydown",m),k.current&&k.current.addEventListener("touchmove",handleTouchMove)),function(){document.removeEventListener("keydown",m),k.current&&k.current.removeEventListener("touchmove",handleTouchMove)}},[i]),/*#__PURE__*/_jsx(CSSTransition,{in:i,appear:!0// Wait for animation to finish before unmount.
5
+ ,timeout:{enter:0,exit:EXIT_ANIMATION},classNames:{enter:classNames({"dimmer--enter-fade":e}),enterDone:classNames("dimmer--enter-done",{"dimmer--enter-fade":e}),exit:classNames("dimmer--exit",{"dimmer--exit-fade":f})},unmountOnExit:!0,onEnter:function onEnter(){return dimmerManager.add(k)},onExited:function onExited(){return dimmerManager.remove(k)},children:/*#__PURE__*/_jsx(DimmerContentWrapper,{scrollBody:!g,children:/*#__PURE__*/_jsx("div",{ref:k,className:classNames("dimmer",{"dimmer--scrollable":j,"dimmer--transparent":g},c),role:"presentation",onClick:l,children:/*#__PURE__*/_jsx(FocusBoundary,{children:b})})})})};export var DimmerContentWrapper=function(a){var b=a.children,c=a.scrollBody;return useEffect(function(){return c&&addNoScrollBodyClass(),function(){c&&removeNoScrollBodyClass()}},[]),b};Dimmer.propTypes={children:PropTypes.node,className:PropTypes.string,disableClickToClose:PropTypes.bool,fadeContentOnEnter:PropTypes.bool,fadeContentOnExit:PropTypes.bool,/** Sets the background to transparent and prevents body scroll locking */transparent:PropTypes.bool,onClose:PropTypes.func,open:PropTypes.bool,scrollable:PropTypes.bool},Dimmer.defaultProps={children:null,className:void 0,disableClickToClose:!1,fadeContentOnEnter:!1,fadeContentOnExit:!1,transparent:!1,onClose:void 0,open:!1,scrollable:!1};export{Dimmer};export default withNextPortal(Dimmer);
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import classNames from"classnames";import SlidingPanel from"../slidingPanel";import Dimmer from"../dimmer";import{Position}from"../common/propsValues/position";import{logActionRequiredIf}from"../utilities";import CloseButton from"../common/closeButton";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Drawer=function(a){var b=a.children,c=a.footerContent,d=a.headerTitle,e=a.onClose,f=a.open,g=a.position;return logActionRequiredIf("Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.",!e),/*#__PURE__*/_jsx(Dimmer,{open:f,onClose:e,children:/*#__PURE__*/_jsx(SlidingPanel,{open:f,position:g,children:/*#__PURE__*/_jsxs("div",{className:"np-drawer",children:[/*#__PURE__*/_jsxs("div",{className:classNames("np-drawer-header","np-drawer-p-x",{"np-drawer-header--withborder":d}),children:[/*#__PURE__*/_jsx(CloseButton,{className:"np-drawer-header",onClick:e}),d&&/*#__PURE__*/_jsx("div",{className:"align-heading m-l-2",children:/*#__PURE__*/_jsx("div",{className:"np-drawer-header--title h3",children:d})})]}),b&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-content","np-drawer-p-x","np-drawer-p-y"),children:b}),c&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-footer","np-drawer-p-x"),children:c})]})})})};Drawer.propTypes={/** The content to appear in the drawer body. */children:PropTypes.node,/** The content to appear in the drawer footer. */footerContent:PropTypes.node,/** The content to appear in the drawer header. */headerTitle:PropTypes.string,/** The action to perform on close click. */onClose:PropTypes.func,/** The status of Drawer either open or not. */open:PropTypes.bool,/** The placement of Drawer on the screen either left or right. */position:PropTypes.oneOf(["left","right"])},Drawer.defaultProps={children:null,footerContent:null,headerTitle:null,onClose:null,open:!1,position:Position.RIGHT};export default Drawer;
1
+ import classNames from"classnames";import PropTypes from"prop-types";import CloseButton from"../common/closeButton";import{Position}from"../common/propsValues/position";import Dimmer from"../dimmer";import SlidingPanel from"../slidingPanel";import{logActionRequiredIf}from"../utilities";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Drawer=function(a){var b=a.children,c=a.footerContent,d=a.headerTitle,e=a.onClose,f=a.open,g=a.position;return logActionRequiredIf("Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.",!e),/*#__PURE__*/_jsx(Dimmer,{open:f,onClose:e,children:/*#__PURE__*/_jsx(SlidingPanel,{open:f,position:g,children:/*#__PURE__*/_jsxs("div",{className:"np-drawer",children:[/*#__PURE__*/_jsxs("div",{className:classNames("np-drawer-header",{"np-drawer-header--withborder":d}),children:[/*#__PURE__*/_jsx(CloseButton,{onClick:e}),d&&/*#__PURE__*/_jsx("div",{className:"np-drawer-header--title h3",children:d})]}),b&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-content"),children:b}),c&&/*#__PURE__*/_jsx("div",{className:classNames("np-drawer-footer"),children:c})]})})})};Drawer.propTypes={/** The content to appear in the drawer body. */children:PropTypes.node,/** The content to appear in the drawer footer. */footerContent:PropTypes.node,/** The content to appear in the drawer header. */headerTitle:PropTypes.string,/** The action to perform on close click. */onClose:PropTypes.func,/** The status of Drawer either open or not. */open:PropTypes.bool,/** The placement of Drawer on the screen either left or right. */position:PropTypes.oneOf(["left","right"])},Drawer.defaultProps={children:null,footerContent:null,headerTitle:null,onClose:null,open:!1,position:Position.RIGHT};export default Drawer;
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import DefinitionList from"../definitionList";import{prepFields}from"../common/requirements";import createDefinitions from"./utils/createDefinitions";import{Layout}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DynamicFieldDefinitionList=function(a){var b=a.model,c=a.title,d=a.layout,e=a.fields;return/*#__PURE__*/_jsxs(_Fragment,{children:[c&&/*#__PURE__*/_jsx("div",{className:"m-t-1",children:/*#__PURE__*/_jsx("div",{className:"p-t-3 h4",children:c})}),/*#__PURE__*/_jsx(DefinitionList,{layout:d,definitions:createDefinitions(prepFields(e),b)})]})};DynamicFieldDefinitionList.propTypes={model:PropTypes.shape({}).isRequired,fields:PropTypes.shape({}).isRequired,title:PropTypes.string,layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED"])},DynamicFieldDefinitionList.defaultProps={title:null,layout:Layout.VERTICAL_TWO_COLUMN};export default DynamicFieldDefinitionList;
1
+ import PropTypes from"prop-types";import{Layout}from"../common";import{prepFields}from"../common/requirements";import DefinitionList from"../definitionList";import createDefinitions from"./utils/createDefinitions";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var DynamicFieldDefinitionList=function(a){var b=a.model,c=a.title,d=a.layout,e=a.fields;return/*#__PURE__*/_jsxs(_Fragment,{children:[c&&/*#__PURE__*/_jsx("div",{className:"m-t-1",children:/*#__PURE__*/_jsx("div",{className:"p-t-3 h4",children:c})}),/*#__PURE__*/_jsx(DefinitionList,{layout:d,definitions:createDefinitions(prepFields(e),b)})]})};DynamicFieldDefinitionList.propTypes={model:PropTypes.shape({}).isRequired,fields:PropTypes.shape({}).isRequired,title:PropTypes.string,layout:PropTypes.oneOf(["VERTICAL_TWO_COLUMN","VERTICAL_ONE_COLUMN","HORIZONTAL_JUSTIFIED","HORIZONTAL_LEFT_ALIGNED"])},DynamicFieldDefinitionList.defaultProps={title:null,layout:Layout.VERTICAL_TWO_COLUMN};export default DynamicFieldDefinitionList;
@@ -1,10 +1,8 @@
1
- import{useIntl}from"react-intl";import PropTypes from"prop-types";import classNames from"classnames";import{formatDate,formatNumber}from"@transferwise/formatting";import{formatUsingPattern}from"../utils/text-format";/**
1
+ import{formatDate,formatNumber}from"@transferwise/formatting";import classNames from"classnames";import PropTypes from"prop-types";import{useIntl}from"react-intl";import{formatUsingPattern}from"../utils/text-format";/**
2
2
  *
3
3
  * @param {Array} options
4
4
  * @param {string|number} value
5
5
  */import{jsx as _jsx}from"react/jsx-runtime";var getValueLabel=function(a,b){var c=a.find(function(a){return a.value===b});return c&&c.label?c.label:b},mask=function(a){return Array(a.length+1).join("*")},FormattedValue=function(a){var b=a.field,c=a.value,d=useIntl(),e=d.locale,f=[];switch(b.tagClassName&&b.tagClassName.h3&&(f.push("h3"),f.push("formatted-value__h3-custom-alignment")),b.control){case"select":case"radio":return/*#__PURE__*/_jsx("span",{children:getValueLabel(b.values,c)});case"date":return/*#__PURE__*/_jsx("span",{children:formatDate(c instanceof Date?c:new Date(c),e)});case"number":return/*#__PURE__*/_jsx("span",{children:formatNumber(c,e)});case"password":return/*#__PURE__*/_jsx("span",{children:mask(c)});case"file":return/*#__PURE__*/_jsx("div",{className:"thumbnail",children:/*#__PURE__*/_jsx("img",{alt:b.title,src:c})});case"checkbox":return/*#__PURE__*/_jsx("span",{children:JSON.stringify(c)});default:return/*#__PURE__*/_jsx("span",{className:classNames(f),children:formatUsingPattern(c,b.displayFormat)});}};/**
6
6
  *
7
7
  * @param {string} value
8
- */FormattedValue.propTypes={field:PropTypes.shape({control:PropTypes.string.isRequired,displayFormat:PropTypes.string,refreshRequirementsOnChange:PropTypes.bool,title:PropTypes.string.isRequired,type:PropTypes.string.isRequired,width:PropTypes.string,tagClassName:PropTypes.shape({h3:PropTypes.bool}),// eslint-disable-next-line react/forbid-prop-types
9
- values:PropTypes.arrayOf(PropTypes.shape({value:PropTypes.any}))}).isRequired,// eslint-disable-next-line react/forbid-prop-types
10
- value:PropTypes.any.isRequired};export default FormattedValue;
8
+ */FormattedValue.propTypes={field:PropTypes.shape({control:PropTypes.string.isRequired,displayFormat:PropTypes.string,refreshRequirementsOnChange:PropTypes.bool,title:PropTypes.string.isRequired,type:PropTypes.string.isRequired,width:PropTypes.string,tagClassName:PropTypes.shape({h3:PropTypes.bool}),values:PropTypes.arrayOf(PropTypes.shape({value:PropTypes.any}))}).isRequired,value:PropTypes.any.isRequired};export default FormattedValue;
@@ -1 +1 @@
1
- var formatUsingPattern=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",b=1<arguments.length?arguments[1]:void 0;if("string"!=typeof b)return a;var c=b;0<c.indexOf("||")&&(c=c.substring(0,b.indexOf("||")));for(var d="",separators=0,e=a.length,f=0;e;)positionIsSeparator(c,f)?(d+=c[f],separators+=1):(d+=a[f-separators],e-=1),f+=1;var g=countSeparatorsAfterCursor(c,f);return g&&(d+=c.substr(f,g)),d},countSeparatorsAfterCursor=function(a,b){for(var separators=0;positionIsSeparator(a,b+separators);)separators+=1;return separators},positionIsSeparator=function(a,b){return a[b]&&"*"!==a[b]};export{formatUsingPattern};
1
+ var formatUsingPattern=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",b=1<arguments.length?arguments[1]:void 0;if("string"!=typeof b)return a;var c=b;0<c.indexOf("||")&&(c=c.slice(0,Math.max(0,b.indexOf("||"))));for(var d="",separators=0,e=a.length,f=0;e;)positionIsSeparator(c,f)?(d+=c[f],separators+=1):(d+=a[f-separators],e-=1),f+=1;var g=countSeparatorsAfterCursor(c,f);return g&&(d+=c.slice(f,g)),d},countSeparatorsAfterCursor=function(a,b){for(var separators=0;positionIsSeparator(a,b+separators);)separators+=1;return separators},positionIsSeparator=function(a,b){return a[b]&&"*"!==a[b]};export{formatUsingPattern};
@@ -1,2 +1,2 @@
1
1
  import EmphasisHtmlTransformer from"./EmphasisHtmlTransformer";import{jsx as _jsx}from"react/jsx-runtime";var SUPPORTED_TAGS=["important","positive","negative","warning"],emphasisHtmlTransformer=new EmphasisHtmlTransformer(SUPPORTED_TAGS),Emphasis=function(a){var b=a.text,c=void 0===b?void 0:b;if(!c)return null;var d=emphasisHtmlTransformer.transform(c);// eslint-disable-next-line react/no-danger
2
- return d?/*#__PURE__*/_jsx("span",{dangerouslySetInnerHTML:{__html:d}}):null};export default Emphasis;
2
+ return d?/*#__PURE__*/_jsx("em",{dangerouslySetInnerHTML:{__html:d}}):null};export default Emphasis;
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useRef}from"react";import PropTypes from"prop-types";import classNames from"classnames";import Header from"../header";import Stepper from"../stepper";import AnimatedLabel from"./animatedLabel";import BackButton from"./backButton";import CloseButton from"../common/closeButton";import{Breakpoint,Layout}from"../common";import{useClientWidth}from"../common/hooks";import Logo from"../logo";// Size switches on parent container which may or may not have the same size as the window.
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import classNames from"classnames";import PropTypes from"prop-types";import{useRef}from"react";import{Breakpoint,Layout}from"../common";import CloseButton from"../common/closeButton";import{useClientWidth}from"../common/hooks";import Header from"../header";import Logo from"../logo";import Stepper from"../stepper";import AnimatedLabel from"./animatedLabel";import BackButton from"./backButton";// Size switches on parent container which may or may not have the same size as the window.
2
2
  import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var containerBreakpoints={"np-flow-navigation--sm":Breakpoint.SMALL,"np-flow-navigation--lg":Breakpoint.LARGE},FlowNavigation=function(a){var b=a.activeStep,c=a.avatar,d=a.logo,e=a.onClose,f=a.onGoBack,g=a.done,h=a.steps,i=useRef(null),j=useClientWidth({ref:i}),k=_slicedToArray(j,1),l=k[0],m=e&&/*#__PURE__*/_jsx(CloseButton,{onClick:e}),n=l<Breakpoint.SMALL,o=g?null:c;return/*#__PURE__*/_jsx("div",{ref:i,className:classNames("np-flow-navigation d-flex align-items-center justify-content-center p-y-3",{"np-flow-navigation--border-bottom":!g}),children:/*#__PURE__*/_jsx(Header,{className:classNames("np-flow-navigation__content p-x-3",{"np-flow-navigation--hidden":!l,"np-flow-navigation--xs-max":n},Object.keys(containerBreakpoints).filter(function(a){return l>=containerBreakpoints[a]})),leftContent:n?function getLeftContentSmall(){var a=f&&0<b;return/*#__PURE__*/_jsxs(_Fragment,{children:[a&&/*#__PURE__*/_jsx(BackButton,{label:/*#__PURE__*/_jsx(AnimatedLabel,{className:"m-x-1",labels:h.map(function(a){return a.label}),activeLabel:b-1}),onClick:f}),/*#__PURE__*/_jsx("div",{className:classNames("np-flow-navigation--flag",{"np-flow-navigation--flag__hidden":a,"np-flow-navigation--flag__display":!a})})]})}():d,rightContent:/*#__PURE__*/_jsxs(_Fragment,{children:[o,o&&m&&/*#__PURE__*/_jsx("span",{className:"separator"}),m]}),bottomContent:!g&&/*#__PURE__*/_jsx(Stepper,{activeStep:b,steps:h,className:classNames("np-flow-navigation__stepper")}),layout:l<Breakpoint.LARGE?Layout.VERTICAL:Layout.HORIZONTAL})})};FlowNavigation.defaultProps={activeStep:0,avatar:void 0,logo:/*#__PURE__*/_jsx(Logo,{}),onGoBack:void 0,onClose:void 0,done:!1},FlowNavigation.propTypes={activeStep:PropTypes.number,/** An Avatar */avatar:PropTypes.element,logo:PropTypes.node,/** Called when the close button is clicked. If not provided the close button won't show */onClose:PropTypes.func,/** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */onGoBack:PropTypes.func,done:PropTypes.bool,/** Steps to be displayed in stepper. If you don't need the stepper, please use OverlayHeader instead */steps:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,onClick:PropTypes.func,hoverLabel:PropTypes.node})).isRequired};export default FlowNavigation;