@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 _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","className","disabled","onChange"];import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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 PropTypes from"prop-types";import classNames from"classnames";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var CheckboxButton=function(a){var b=a.checked,c=a.className,d=a.disabled,e=a.onChange,f=_objectWithoutProperties(a,_excluded);return/*#__PURE__*/_jsxs("span",{className:classNames("np-checkbox-button",c),children:[/*#__PURE__*/_jsx("input",_objectSpread(_objectSpread({},f),{},{type:"checkbox",disabled:d,checked:b,onChange:e})),/*#__PURE__*/_jsx("span",{className:"tw-checkbox-button",children:/*#__PURE__*/_jsx("span",{className:"tw-checkbox-check"})})]})};CheckboxButton.propTypes={/* Provide this if the CheckboxButton is being used without a label */"aria-label":PropTypes.string,checked:PropTypes.bool,className:PropTypes.string,disabled:PropTypes.bool,onChange:PropTypes.func.isRequired},CheckboxButton.defaultProps={"aria-label":void 0,checked:!1,className:void 0,disabled:!1};export default CheckboxButton;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","className","disabled","onChange"];import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var CheckboxButton=function(a){var b=a.checked,c=a.className,d=a.disabled,e=a.onChange,f=_objectWithoutProperties(a,_excluded);return/*#__PURE__*/_jsxs("span",{className:classNames("np-checkbox-button",c),children:[/*#__PURE__*/_jsx("input",_objectSpread(_objectSpread({},f),{},{type:"checkbox",disabled:d,checked:b,onChange:e})),/*#__PURE__*/_jsx("span",{className:"tw-checkbox-button",children:/*#__PURE__*/_jsx("span",{className:"tw-checkbox-check"})})]})};CheckboxButton.propTypes={/* Provide this if the CheckboxButton is being used without a label */"aria-label":PropTypes.string,checked:PropTypes.bool,className:PropTypes.string,disabled:PropTypes.bool,onChange:PropTypes.func.isRequired},CheckboxButton.defaultProps={"aria-label":void 0,checked:!1,className:void 0,disabled:!1};export default CheckboxButton;
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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"core-js/modules/es.function.name.js";import PropTypes from"prop-types";import Option from"../common/Option";import CheckboxButton from"../checkboxButton";import{jsx as _jsx}from"react/jsx-runtime";var CheckboxOption=function(a){var b=a.media,c=a.title,d=a.content,e=a.name,f=a.checked,g=a.onChange,h=a.complex,i=a.disabled,j=a.showMediaAtAllSizes;return/*#__PURE__*/_jsx(Option,_objectSpread(_objectSpread({},{media:b,title:c,content:d,name:e,complex:h,disabled:i,showMediaAtAllSizes:j}),{},{button:/*#__PURE__*/_jsx(CheckboxButton,{checked:f,disabled:i,onChange:function onChange(){return g(!f)}})}))};CheckboxOption.propTypes={checked:PropTypes.bool,complex:PropTypes.bool,content:PropTypes.node,disabled:PropTypes.bool,id:PropTypes.string,media:PropTypes.node,name:PropTypes.string.isRequired,onChange:PropTypes.func.isRequired,title:PropTypes.node.isRequired,showMediaAtAllSizes:PropTypes.bool},CheckboxOption.defaultProps={checked:!1,complex:!1,content:null,disabled:!1,id:void 0,media:null,showMediaAtAllSizes:!1};export default CheckboxOption;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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"core-js/modules/es.function.name.js";import PropTypes from"prop-types";import CheckboxButton from"../checkboxButton";import Option from"../common/Option";import{jsx as _jsx}from"react/jsx-runtime";var CheckboxOption=function(a){var b=a.media,c=a.title,d=a.content,e=a.name,f=a.checked,g=a.onChange,h=a.complex,i=a.disabled,j=a.showMediaAtAllSizes;return/*#__PURE__*/_jsx(Option,_objectSpread(_objectSpread({},{media:b,title:c,content:d,name:e,complex:h,disabled:i,showMediaAtAllSizes:j}),{},{button:/*#__PURE__*/_jsx(CheckboxButton,{checked:f,disabled:i,onChange:function onChange(){return g(!f)}})}))};CheckboxOption.propTypes={checked:PropTypes.bool,complex:PropTypes.bool,content:PropTypes.node,disabled:PropTypes.bool,id:PropTypes.string,media:PropTypes.node,name:PropTypes.string.isRequired,onChange:PropTypes.func.isRequired,title:PropTypes.node.isRequired,showMediaAtAllSizes:PropTypes.bool},CheckboxOption.defaultProps={checked:!1,complex:!1,content:null,disabled:!1,id:void 0,media:null,showMediaAtAllSizes:!1};export default CheckboxOption;
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";var _CONTAINER_SIZE;import PropTypes from"prop-types";import classNames from"classnames";import{ChevronUp}from"@transferwise/icons";import{Size,Position}from"../common";import{jsx as _jsx}from"react/jsx-runtime";var CONTAINER_SIZE=(_CONTAINER_SIZE={},_defineProperty(_CONTAINER_SIZE,Size.EXTRA_SMALL,10),_defineProperty(_CONTAINER_SIZE,Size.SMALL,16),_defineProperty(_CONTAINER_SIZE,Size.MEDIUM,24),_CONTAINER_SIZE),ExtraSmallChevron=function(a){var b=a.className;return/*#__PURE__*/_jsx("span",{className:classNames("tw-icon","tw-icon-chevron",b),role:"presentation","aria-hidden":!0,children:/*#__PURE__*/_jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",focusable:"false",children:/*#__PURE__*/_jsx("path",{fillRule:"evenodd",d:"M4.9995 2.0865L0.0635004 6.7645L1.2745 7.9125L4.9995 4.3835L8.7245 7.9135L9.9355 6.7645L4.9995 2.0865Z"})})})};ExtraSmallChevron.propTypes={className:PropTypes.string},ExtraSmallChevron.defaultProps={className:null};var Chevron=function(a){var b=a.orientation,c=a.size,d=a.disabled,e=a.className,f=classNames("tw-chevron",{"chevron-color":!d},"".concat([b]).toLowerCase(),e),g=CONTAINER_SIZE[c];return c===Size.EXTRA_SMALL?/*#__PURE__*/_jsx(ExtraSmallChevron,{className:f}):/*#__PURE__*/_jsx(ChevronUp,{className:f,size:g})};Chevron.propTypes={orientation:PropTypes.oneOf(["top","bottom","left","right"]),size:PropTypes.oneOf(["xs","sm","md"]),disabled:PropTypes.bool,className:PropTypes.string},Chevron.defaultProps={orientation:Position.BOTTOM,size:Size.SMALL,disabled:!1,className:null};export default Chevron;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";var _CONTAINER_SIZE;import{ChevronUp}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{Size,Position}from"../common";import{jsx as _jsx}from"react/jsx-runtime";var CONTAINER_SIZE=(_CONTAINER_SIZE={},_defineProperty(_CONTAINER_SIZE,Size.EXTRA_SMALL,10),_defineProperty(_CONTAINER_SIZE,Size.SMALL,16),_defineProperty(_CONTAINER_SIZE,Size.MEDIUM,24),_CONTAINER_SIZE),ExtraSmallChevron=function(a){var b=a.className;return/*#__PURE__*/_jsx("span",{className:classNames("tw-icon","tw-icon-chevron",b),role:"presentation","aria-hidden":!0,children:/*#__PURE__*/_jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",focusable:"false",children:/*#__PURE__*/_jsx("path",{fillRule:"evenodd",d:"M4.9995 2.0865L0.0635004 6.7645L1.2745 7.9125L4.9995 4.3835L8.7245 7.9135L9.9355 6.7645L4.9995 2.0865Z"})})})};ExtraSmallChevron.propTypes={className:PropTypes.string},ExtraSmallChevron.defaultProps={className:null};var Chevron=function(a){var b=a.orientation,c=a.size,d=a.disabled,e=a.className,f=classNames("tw-chevron",{"chevron-color":!d},"".concat([b]).toLowerCase(),e),g=CONTAINER_SIZE[c];return c===Size.EXTRA_SMALL?/*#__PURE__*/_jsx(ExtraSmallChevron,{className:f}):/*#__PURE__*/_jsx(ChevronUp,{className:f,size:g})};Chevron.propTypes={orientation:PropTypes.oneOf(["top","bottom","left","right"]),size:PropTypes.oneOf(["xs","sm","md"]),disabled:PropTypes.bool,className:PropTypes.string},Chevron.defaultProps={orientation:Position.BOTTOM,size:Size.SMALL,disabled:!1,className:null};export default Chevron;
@@ -1,5 +1,11 @@
1
- import classNames from"classnames";import{Cross as CrossIcon}from"@transferwise/icons";import{useDirection}from"../common/hooks";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";/**
1
+ import{Cross as CrossIcon}from"@transferwise/icons";import classNames from"classnames";import{useDirection}from"../common/hooks";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";/**
2
2
  * `Chip` component
3
3
  *
4
4
  * Docs link: https://transferwise.github.io/neptune-web/components/internal/Chip
5
- */export default function Chip(a){var b=a.label,c=a.onRemove,d=a.hasError,e=a.className,f=void 0===e?void 0:e,g=useDirection(),h=g.isRTL;return/*#__PURE__*/_jsxs("div",{className:classNames("chip","d-inline-flex","align-items-center","m-t-1",{"has-error":void 0!==d&&d,"p-r-1 p-l-2":!h,"p-l-1 p-r-2":h},f),children:[b,/*#__PURE__*/_jsx("button",{type:"button",className:classNames("btn-unstyled chip-remove",{"m-l-2":!h,"m-r-2":h}),onClick:c,children:/*#__PURE__*/_jsx(CrossIcon,{})})]})}
5
+ *
6
+ * @param root0
7
+ * @param root0.label
8
+ * @param root0.onRemove
9
+ * @param root0.hasError
10
+ * @param root0.className
11
+ */var Chip=function(a){var b=a.label,c=a.onRemove,d=a.hasError,e=a.className,f=void 0===e?void 0:e,g=useDirection(),h=g.isRTL;return/*#__PURE__*/_jsxs("div",{className:classNames("chip","d-inline-flex","align-items-center","m-t-1",{"has-error":void 0!==d&&d,"p-r-1 p-l-2":!h,"p-l-1 p-r-2":h},f),children:[b,/*#__PURE__*/_jsx("button",{type:"button",className:classNames("btn-unstyled chip-remove",{"m-l-2":!h,"m-r-2":h}),onClick:c,children:/*#__PURE__*/_jsx(CrossIcon,{})})]})};export default Chip;
@@ -1 +1 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","children","disabled","icon","priority","type"];import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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{cloneElement}from"react";import PropTypes from"prop-types";import classNames from"classnames";import{ControlType,Priority}from"../common";import{typeClassMap,priorityClassMap}from"../button/classMap";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var CircularButton=function(a){var b=a.className,c=a.children,d=a.disabled,e=a.icon,f=a.priority,g=a.type,h=_objectWithoutProperties(a,_excluded),i=classNames("btn np-btn",typeClassMap[g],priorityClassMap[f]),j=24===e.props.size?e:/*#__PURE__*/cloneElement(e,{size:24});return/*#__PURE__*/_jsxs("label",{className:classNames("np-circular-btn",f,g,d?"disabled":"",b),children:[/*#__PURE__*/_jsx("input",_objectSpread({type:"button","aria-label":c,className:i,disabled:d},h)),j,/*#__PURE__*/_jsx("span",{className:"np-circular-btn__label",children:c})]})};CircularButton.propTypes={className:PropTypes.string,children:PropTypes.string.isRequired,disabled:PropTypes.bool,icon:PropTypes.element.isRequired,onClick:PropTypes.func.isRequired,priority:PropTypes.oneOf(["primary","secondary"]),type:PropTypes.oneOf(["accent","positive","negative"])},CircularButton.defaultProps={className:void 0,disabled:!1,priority:Priority.PRIMARY,type:ControlType.ACCENT};export default CircularButton;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","children","disabled","icon","priority","type"];import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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{cloneElement}from"react";import{typeClassMap,priorityClassMap}from"../button/classMap";import{ControlType,Priority}from"../common";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var CircularButton=function(a){var b=a.className,c=a.children,d=a.disabled,e=a.icon,f=a.priority,g=a.type,h=_objectWithoutProperties(a,_excluded),i=classNames("btn np-btn",typeClassMap[g],priorityClassMap[f]),j=24===e.props.size?e:/*#__PURE__*/cloneElement(e,{size:24});return/*#__PURE__*/_jsxs("label",{className:classNames("np-circular-btn",f,g,d?"disabled":"",b),children:[/*#__PURE__*/_jsx("input",_objectSpread({type:"button","aria-label":c,className:i,disabled:d},h)),j,/*#__PURE__*/_jsx("span",{className:"np-circular-btn__label",children:c})]})};CircularButton.propTypes={className:PropTypes.string,children:PropTypes.string.isRequired,disabled:PropTypes.bool,icon:PropTypes.element.isRequired,onClick:PropTypes.func.isRequired,priority:PropTypes.oneOf(["primary","secondary"]),type:PropTypes.oneOf(["accent","positive","negative"])},CircularButton.defaultProps={className:void 0,disabled:!1,priority:Priority.PRIMARY,type:ControlType.ACCENT};export default CircularButton;
@@ -1 +1 @@
1
- import PropTypes from"prop-types";import classNames from"classnames";import requiredIf from"react-required-if";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Option=function(a){var b=a.as,c=a.href,d=a.target,e=a.media,f=a.title,g=a.content,h=a.onClick,i=a.htmlFor,j=a.disabled,k=a.button,l=a.decision,m=a.complex,n=a.className,o=a.inverseMediaCircle,p=a.showMediaAtAllSizes,q=a.showMediaCircle;return/*#__PURE__*/_jsxs(b,{className:classNames(n,"media",{"decision-complex":m,decision:l,disabled:j,"tw-option__sm-media":p}),href:c,onClick:h,htmlFor:i,target:d,disabled:j&&"button"===b,children:[e&&/*#__PURE__*/_jsx("div",{className:"media-left",children:q?/*#__PURE__*/_jsx("div",{className:classNames("circle circle-sm text-primary",{"circle-inverse":o}),children:e}):/*#__PURE__*/_jsx("div",{className:"tw-option__no-media-circle",children:e})}),/*#__PURE__*/_jsxs("div",{className:"media-body",children:[/*#__PURE__*/_jsx("div",{className:"h5",children:f}),g&&/*#__PURE__*/_jsx("div",{className:"decision__content",children:g})]}),/*#__PURE__*/_jsx("div",{className:"media-right",children:k})]})};Option.propTypes={media:PropTypes.node,htmlFor:PropTypes.string,title:PropTypes.node.isRequired,content:PropTypes.node,onClick:PropTypes.func,href:requiredIf(PropTypes.string,function(a){return"a"===a.as}),target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),as:PropTypes.string,disabled:PropTypes.bool,button:PropTypes.node,decision:PropTypes.bool,complex:PropTypes.bool,inverseMediaCircle:PropTypes.bool,className:PropTypes.string,showMediaAtAllSizes:PropTypes.bool,showMediaCircle:PropTypes.bool},Option.defaultProps={as:"label",media:"",content:null,htmlFor:null,disabled:!1,button:null,onClick:null,href:null,target:void 0,decision:!0,complex:!1,inverseMediaCircle:!0,className:null,showMediaAtAllSizes:!1,showMediaCircle:!0};export default Option;
1
+ import classNames from"classnames";import PropTypes from"prop-types";import requiredIf from"react-required-if";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Option=function(a){var b=a.as,c=a.href,d=a.target,e=a.media,f=a.title,g=a.content,h=a.onClick,i=a.htmlFor,j=a.disabled,k=a.button,l=a.decision,m=a.complex,n=a.className,o=a.inverseMediaCircle,p=a.showMediaAtAllSizes,q=a.showMediaCircle;return/*#__PURE__*/_jsxs(b,{className:classNames(n,"media",{"decision-complex":m,decision:l,disabled:j,"tw-option__sm-media":p}),href:c,htmlFor:i,target:d,disabled:j&&"button"===b,onClick:h,children:[e&&/*#__PURE__*/_jsx("div",{className:"media-left",children:q?/*#__PURE__*/_jsx("div",{className:classNames("circle circle-sm text-primary",{"circle-inverse":o}),children:e}):/*#__PURE__*/_jsx("div",{className:"tw-option__no-media-circle",children:e})}),/*#__PURE__*/_jsxs("div",{className:"media-body",children:[/*#__PURE__*/_jsx("div",{className:"h5",children:f}),g&&/*#__PURE__*/_jsx("div",{className:"decision__content",children:g})]}),/*#__PURE__*/_jsx("div",{className:"media-right",children:k})]})};Option.propTypes={media:PropTypes.node,htmlFor:PropTypes.string,title:PropTypes.node.isRequired,content:PropTypes.node,onClick:PropTypes.func,href:requiredIf(PropTypes.string,function(a){return"a"===a.as}),target:PropTypes.oneOf(["_self","_blank","_parent","_top"]),as:PropTypes.string,disabled:PropTypes.bool,button:PropTypes.node,decision:PropTypes.bool,complex:PropTypes.bool,inverseMediaCircle:PropTypes.bool,className:PropTypes.string,showMediaAtAllSizes:PropTypes.bool,showMediaCircle:PropTypes.bool},Option.defaultProps={as:"label",media:"",content:null,htmlFor:null,disabled:!1,button:null,onClick:null,href:null,target:void 0,decision:!0,complex:!1,inverseMediaCircle:!0,className:null,showMediaAtAllSizes:!1,showMediaCircle:!0};export default Option;
@@ -0,0 +1 @@
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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"core-js/modules/es.function.name.js";import"core-js/modules/es.array.concat.js";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{FastFlag as FastFlagIcon}from"@transferwise/icons";import PropTypes from"prop-types";import{Component}from"react";import{Checkbox}from"../..";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 OptionDocumentation=/*#__PURE__*/function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),a.state={complex:!1,disabled:!1,hasMedia:!0},a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"createStateLink",value:function createStateLink(a){var b=this;return function(c){return b.setState(_defineProperty({},a,c))}}},{key:"render",value:function render(){var a,b=this.props,c=b.type,d=b.Option,e=b.name,f=b.callbackName,g=b.callback,h=b.callbackString,i=b.propName,j=b.propValue,k=b.title,l=b.content,m=b.extra,n=this.state,o=n.complex,p=n.disabled,q=n.hasMedia;return/*#__PURE__*/_jsx("div",{className:"container",id:"".concat(c,"-option-docs"),children:/*#__PURE__*/_jsxs("div",{className:"section",children:[/*#__PURE__*/_jsxs("div",{className:"row",children:[/*#__PURE__*/_jsxs("div",{className:"col-md-6",children:[/*#__PURE__*/_jsx("h2",{children:k}),/*#__PURE__*/_jsx("p",{children:l})]}),/*#__PURE__*/_jsx("div",{className:"col-md-6",children:/*#__PURE__*/_jsx(d,_objectSpread({id:"".concat(c,"-option"),name:"".concat(c,"-option"),title:k,content:getContentForComplexState(o),complex:o,disabled:p,media:q?/*#__PURE__*/_jsx(FastFlagIcon,{}):void 0},(a={},_defineProperty(a,i,j),_defineProperty(a,f,g),a)))})]}),/*#__PURE__*/_jsxs("div",{className:"row m-t-5",children:[/*#__PURE__*/_jsxs("div",{className:"col-md-6",children:[/*#__PURE__*/_jsx(function Code(){return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx("pre",{className:"tw-docs-code",children:"<".concat(e,"\n id=\"").concat(c,"-option\"\n name=\"").concat(c,"-option\"\n title=\"").concat(k,"\"\n content=\"").concat(getContentForComplexState(o),"\"").concat(boolProperty(i,j)).concat(boolProperty("complex",o)).concat(boolProperty("disabled",p),"\n ").concat(f,"={").concat(h,"}").concat(q?"\n media={<FastFlagIcon />}":"","\n/>")})})},{}),m]}),/*#__PURE__*/_jsxs("div",{className:"col-md-6",children:[/*#__PURE__*/_jsxs("div",{className:"row",children:[/*#__PURE__*/_jsx("div",{className:"col-md-6",children:/*#__PURE__*/_jsx(Checkbox,{id:"".concat(c,"-option-complex"),label:"Complex",checked:o,onChange:this.createStateLink("complex")})}),/*#__PURE__*/_jsx("div",{className:"col-md-6 m-b-0",children:/*#__PURE__*/_jsx(Checkbox,{id:"".concat(c,"-option-disabled"),label:"Disabled",checked:p,onChange:this.createStateLink("disabled")})})]}),/*#__PURE__*/_jsx("div",{className:"row m-t-2",children:/*#__PURE__*/_jsx("div",{className:"col-md-6",children:/*#__PURE__*/_jsx(Checkbox,{id:"".concat(c,"-option-media"),label:"Has media",checked:q,onChange:this.createStateLink("hasMedia")})})})]})]})]})})}}]),b}(Component);function getContentForComplexState(a){return a?"Complex items should be used for items with long descriptions. Their button and media will be aligned to the top.":"Normally, the button and icon are vertically centered."}function boolProperty(a,b){return b?"\n ".concat(a):""}OptionDocumentation.propTypes={type:PropTypes.string.isRequired,Option:PropTypes.func.isRequired,name:PropTypes.string.isRequired,callbackName:PropTypes.string.isRequired,callback:PropTypes.func.isRequired,callbackString:PropTypes.string.isRequired,propName:PropTypes.string,propValue:PropTypes.bool,title:PropTypes.string.isRequired,content:PropTypes.string.isRequired,extra:PropTypes.string},OptionDocumentation.defaultProps={propName:null,propValue:!1,extra:""};export default OptionDocumentation;
@@ -1 +1 @@
1
- import"core-js/modules/es.function.name.js";import PropTypes from"prop-types";import classNames from"classnames";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 RadioButton=function(a){var b=a.id,c=a.value,d=a.name,e=a.checked,f=a.onChange,g=a.disabled,h=a.readOnly;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("input",{type:"radio",className:"sr-only",id:b,value:c,name:d,checked:e,onChange:function onChange(){return e?null:f(c)},disabled:g||h}),/*#__PURE__*/_jsx("span",{className:classNames("tw-radio-button",{checked:e,disabled:g||h}),children:/*#__PURE__*/_jsx("span",{className:"tw-radio-check"})})]})};RadioButton.propTypes={id:PropTypes.string,name:PropTypes.string.isRequired,checked:PropTypes.bool,onChange:PropTypes.func,disabled:PropTypes.bool,value:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),readOnly:PropTypes.bool},RadioButton.defaultProps={checked:!1,onChange:function onChange(){},disabled:!1,id:null,value:"",readOnly:!1};export default RadioButton;
1
+ import"core-js/modules/es.function.name.js";import classNames from"classnames";import PropTypes from"prop-types";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 RadioButton=function(a){var b=a.id,c=a.value,d=a.name,e=a.checked,f=a.onChange,g=a.disabled,h=a.readOnly;return/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("input",{type:"radio",className:"sr-only",id:b,value:c,name:d,checked:e,disabled:g||h,onChange:function onChange(){return e?null:f(c)}}),/*#__PURE__*/_jsx("span",{className:classNames("tw-radio-button",{checked:e,disabled:g||h}),children:/*#__PURE__*/_jsx("span",{className:"tw-radio-check"})})]})};RadioButton.propTypes={id:PropTypes.string,name:PropTypes.string.isRequired,checked:PropTypes.bool,onChange:PropTypes.func,disabled:PropTypes.bool,value:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),readOnly:PropTypes.bool},RadioButton.defaultProps={checked:!1,onChange:function onChange(){},disabled:!1,id:null,value:"",readOnly:!1};export default RadioButton;
@@ -1,12 +1,10 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"core-js/modules/es.array.concat.js";import{useRef,useState}from"react";import classNames from"classnames";import Dimmer from"../../dimmer";import SlidingPanel from"../../slidingPanel";import CloseButton from"../closeButton";import{isServerSideRendering}from"../domHelpers";import{useConditionalListener}from"../hooks";import{Position}from"../propsValues/position";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var INITIAL_Y_POSITION=0,CONTENT_SCROLL_THRESHOLD=1,MOVE_OFFSET_THRESHOLD=50;/**
2
- * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/
3
- *
4
- * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
5
- */function BottomSheet(a){function b(a){null!==g.current&&(g.current.style.transform="translateY(".concat(a,"px)"))}function c(){m(!1),o.current=INITIAL_Y_POSITION,null!==g.current&&g.current.style.removeProperty("transform"),a.onClose&&a.onClose()}function d(){// stop moving component
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import"core-js/modules/es.array.concat.js";import classNames from"classnames";import{useRef,useState}from"react";import Dimmer from"../../dimmer";import SlidingPanel from"../../slidingPanel";import CloseButton from"../closeButton";import{isServerSideRendering}from"../domHelpers";import{useConditionalListener}from"../hooks";import{Position}from"../propsValues/position";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var INITIAL_Y_POSITION=0,CONTENT_SCROLL_THRESHOLD=1,MOVE_OFFSET_THRESHOLD=50,BottomSheet=function(a){function b(a){null!==g.current&&(g.current.style.transform="translateY(".concat(a,"px)"))}function c(){m(!1),o.current=INITIAL_Y_POSITION,null!==g.current&&g.current.style.removeProperty("transform"),a.onClose&&a.onClose()}function d(){// stop moving component
6
2
  cancelAnimationFrame(n.current),m(!1),o.current>MOVE_OFFSET_THRESHOLD&&e()?c():b(INITIAL_Y_POSITION),o.current=INITIAL_Y_POSITION}function e(){var a;return(null===i||void 0===i||null===(a=i.current)||void 0===a?void 0:a.scrollTop)!==void 0&&i.current.scrollTop<=CONTENT_SCROLL_THRESHOLD}/**
7
3
  * Calculates how hard user moves component,
8
4
  * result value used to determine whether to hide component or re-position to default state
5
+ *
6
+ * @param afterMoveYCoordinate
9
7
  */function f(a){return a-p.current}/**
10
8
  * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component
11
9
  * and ensures space for safe zone (32px) at the top.
12
- */var g=useRef(null),h=useRef(null),i=useRef(null),j=useState(!1),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useRef(0),o=useRef(0),p=useRef(0);useConditionalListener({attachListener:a.open&&!isServerSideRendering(),callback:function callback(){if(null!==h.current){var a=h.current.classList;e()?a.remove("np-bottom-sheet--top-bar--shadow"):a.add("np-bottom-sheet--top-bar--shadow")}},eventType:"scroll",parent:isServerSideRendering()?void 0:document});var q=function(a){return function(b){p.current=(a?b.touches[0]:b).clientY,m(!0)}},r=function(a){return function(c){if(l){var d=a?c.touches[0]:c,h=d.clientY,i=f(h);i>INITIAL_Y_POSITION&&e()&&(o.current=i,n.current=requestAnimationFrame(function(){n.current!==void 0&&null!==g.current&&b(i)}))}}};return/*#__PURE__*/_jsx(Dimmer,{open:a.open,onClose:c,fadeContentOnEnter:!0,fadeContentOnExit:!0,children:/*#__PURE__*/_jsxs(SlidingPanel,{open:a.open,position:Position.BOTTOM,ref:g,className:classNames("np-bottom-sheet",a.className),onTouchStart:q(!0),onTouchMove:r(!0),onTouchEnd:d,onMouseDown:q(!1),onMouseMove:r(!1),onMouseUp:d,role:"dialog",children:[/*#__PURE__*/_jsxs("div",{className:"np-bottom-sheet--top-bar",ref:h,children:[/*#__PURE__*/_jsx("div",{className:"np-bottom-sheet--handler"}),/*#__PURE__*/_jsx(CloseButton,{onClick:c,size:16,className:"sr-only np-bottom-sheet--close-btn"})]}),/*#__PURE__*/_jsx("div",{style:function(){var a=isServerSideRendering()?0:window.innerHeight,b="".concat(100*(.01*a),"px");return{maxHeight:"calc(".concat(b," - ").concat("64px"," - ").concat("32px",")")}}(),className:"np-bottom-sheet--content",ref:i,children:a.children})]})})}export default BottomSheet;
10
+ */var g=useRef(null),h=useRef(null),i=useRef(null),j=useState(!1),k=_slicedToArray(j,2),l=k[0],m=k[1],n=useRef(0),o=useRef(0),p=useRef(0);useConditionalListener({attachListener:a.open&&!isServerSideRendering(),callback:function callback(){if(null!==h.current){var a=h.current.classList;e()?a.remove("np-bottom-sheet--top-bar--shadow"):a.add("np-bottom-sheet--top-bar--shadow")}},eventType:"scroll",parent:isServerSideRendering()?void 0:document});var q=function(a){return function(b){p.current=(a?b.touches[0]:b).clientY,m(!0)}},r=function(a){return function(c){if(l){var d=a?c.touches[0]:c,h=d.clientY,i=f(h);i>INITIAL_Y_POSITION&&e()&&(o.current=i,n.current=requestAnimationFrame(function(){n.current!==void 0&&null!==g.current&&b(i)}))}}};return/*#__PURE__*/_jsx(Dimmer,{open:a.open,fadeContentOnEnter:!0,fadeContentOnExit:!0,onClose:c,children:/*#__PURE__*/_jsxs(SlidingPanel,{ref:g,open:a.open,position:Position.BOTTOM,className:classNames("np-bottom-sheet",a.className),role:"dialog",onTouchStart:q(!0),onTouchMove:r(!0),onTouchEnd:d,onMouseDown:q(!1),onMouseMove:r(!1),onMouseUp:d,children:[/*#__PURE__*/_jsxs("div",{ref:h,className:"np-bottom-sheet--top-bar",children:[/*#__PURE__*/_jsx("div",{className:"np-bottom-sheet--handler"}),/*#__PURE__*/_jsx(CloseButton,{size:16,className:"sr-only np-bottom-sheet--close-btn",onClick:c})]}),/*#__PURE__*/_jsx("div",{ref:i,style:function(){var a=isServerSideRendering()?0:window.innerHeight,b="".concat(100*(.01*a),"px");return{maxHeight:"calc(".concat(b," - ").concat("64px"," - ").concat("32px",")")}}(),className:"np-bottom-sheet--content",children:a.children})]})})};export default BottomSheet;
@@ -1 +1 @@
1
- import"core-js/modules/es.object.values.js";import{forwardRef}from"react";import PropTypes from"prop-types";import classNames from"classnames";import{useIntl}from"react-intl";import{Cross as CrossIcon}from"@transferwise/icons";import messages from"./CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";export var CloseButton=/*#__PURE__*/forwardRef(function(a,b){var c=useIntl(),d=a.onClick,e=a.className,f=a.size;return/*#__PURE__*/_jsx("button",{ref:b,type:"button",className:classNames("np-close-button close btn-link text-no-decoration",{"np-close-button--large":f===CloseButton.Size.LARGE},e),"aria-label":c.formatMessage(messages.ariaLabel),onClick:d,children:/*#__PURE__*/_jsx(CrossIcon,{size:f})})});CloseButton.Size={SMALL:16,LARGE:24},CloseButton.propTypes={onClick:PropTypes.func.isRequired,className:PropTypes.string,size:PropTypes.oneOf(Object.values(CloseButton.Size))},CloseButton.defaultProps={className:null,size:CloseButton.Size.LARGE};export default CloseButton;
1
+ import"core-js/modules/es.object.values.js";import{Cross as CrossIcon}from"@transferwise/icons";import classNames from"classnames";import PropTypes from"prop-types";import{forwardRef}from"react";import{useIntl}from"react-intl";import messages from"./CloseButton.messages";import{jsx as _jsx}from"react/jsx-runtime";export var CloseButton=/*#__PURE__*/forwardRef(function(a,b){var c=useIntl(),d=a.onClick,e=a.className,f=a.size;return/*#__PURE__*/_jsx("button",{ref:b,type:"button",className:classNames("np-close-button close btn-link text-no-decoration",{"np-close-button--large":f===CloseButton.Size.LARGE},e),"aria-label":c.formatMessage(messages.ariaLabel),onClick:d,children:/*#__PURE__*/_jsx(CrossIcon,{size:f})})});CloseButton.Size={SMALL:16,LARGE:24},CloseButton.propTypes={onClick:PropTypes.func.isRequired,className:PropTypes.string,size:PropTypes.oneOf(Object.values(CloseButton.Size))},CloseButton.defaultProps={className:null,size:CloseButton.Size.LARGE};export default CloseButton;
@@ -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"core-js/
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;import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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;import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.get-own-property-descriptors.js";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
- import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.array.join.js";/* 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
+ import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.array.join.js";/* 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
- import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.join.js";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
+ import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.array.join.js";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"core-js/modules/es.array.join.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.regexp.to-string.js";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"core-js/modules/es.array.iterator.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.regexp.to-string.js";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";import"core-js/modules/es.reflect.construct.js";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";import"core-js/modules/es.reflect.construct.js";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"core-js/modules/es.array.concat.js";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"core-js/modules/es.array.concat.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.map.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.slice.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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";import"core-js/modules/es.reflect.construct.js";import"core-js/modules/es.array.concat.js";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"core-js/modules/es.array.map.js";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"core-js/modules/es.array.map.js";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;