@transferwise/components 0.0.0-experimental-5e2f01a → 0.0.0-experimental-d8ad171

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 (611) hide show
  1. package/build/es/no-polyfill/accordion/Accordion.js +1 -1
  2. package/build/es/no-polyfill/accordion/Accordion.story.js +1 -1
  3. package/build/es/no-polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
  4. package/build/es/no-polyfill/actionButton/ActionButton.js +1 -1
  5. package/build/es/no-polyfill/actionButton/ActionButton.spec.js +1 -1
  6. package/build/es/no-polyfill/actionButton/ActionButton.story.js +1 -1
  7. package/build/es/no-polyfill/actionOption/ActionOption.js +1 -1
  8. package/build/es/no-polyfill/actionOption/ActionOption.story.js +1 -1
  9. package/build/es/no-polyfill/alert/Alert.js +1 -1
  10. package/build/es/no-polyfill/alert/Alert.story.js +1 -1
  11. package/build/es/no-polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  12. package/build/es/no-polyfill/alert/withArrow/alertArrowPositions.js +1 -1
  13. package/build/es/no-polyfill/alert/withArrow/withArrow.js +1 -1
  14. package/build/es/no-polyfill/avatar/Avatar.js +1 -1
  15. package/build/es/no-polyfill/avatar/Avatar.story.js +1 -1
  16. package/build/es/no-polyfill/avatar/avatarTypes.js +1 -1
  17. package/build/es/no-polyfill/avatar/colors/colors.js +2 -2
  18. package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.js +1 -1
  19. package/build/es/no-polyfill/avatarWrapper/AvatarWrapper.story.js +1 -1
  20. package/build/es/no-polyfill/badge/Badge.js +1 -1
  21. package/build/es/no-polyfill/body/Body.js +2 -2
  22. package/build/es/no-polyfill/body/Body.spec.js +1 -1
  23. package/build/es/no-polyfill/body/Body.story.js +1 -1
  24. package/build/es/no-polyfill/button/Button.js +5 -5
  25. package/build/es/no-polyfill/button/Button.story.js +1 -1
  26. package/build/es/no-polyfill/button/classMap.js +1 -1
  27. package/build/es/no-polyfill/button/legacyUtils/legacyUtils.js +2 -2
  28. package/build/es/no-polyfill/card/Card.js +1 -1
  29. package/build/es/no-polyfill/checkbox/Checkbox.js +1 -1
  30. package/build/es/no-polyfill/checkbox/Checkbox.story.js +1 -1
  31. package/build/es/no-polyfill/checkboxButton/CheckboxButton.js +1 -1
  32. package/build/es/no-polyfill/checkboxButton/CheckboxButton.spec.js +1 -1
  33. package/build/es/no-polyfill/checkboxButton/CheckboxButton.story.js +1 -1
  34. package/build/es/no-polyfill/checkboxOption/CheckboxOption.js +1 -1
  35. package/build/es/no-polyfill/checkboxOption/CheckboxOption.spec.js +1 -1
  36. package/build/es/no-polyfill/checkboxOption/CheckboxOption.story.js +1 -1
  37. package/build/es/no-polyfill/chevron/Chevron.js +1 -1
  38. package/build/es/no-polyfill/chevron/Chevron.story.js +1 -1
  39. package/build/es/no-polyfill/chips/Chip.js +1 -1
  40. package/build/es/no-polyfill/chips/Chips.js +1 -1
  41. package/build/es/no-polyfill/chips/Chips.spec.js +1 -1
  42. package/build/es/no-polyfill/chips/Chips.story.js +1 -1
  43. package/build/es/no-polyfill/circularButton/CircularButton.js +1 -1
  44. package/build/es/no-polyfill/common/DOMOperations/DOMOperations.js +3 -3
  45. package/build/es/no-polyfill/common/Option/Option.js +1 -1
  46. package/build/es/no-polyfill/common/RadioButton/RadioButton.js +1 -1
  47. package/build/es/no-polyfill/common/bottomSheet/BottomSheet.js +4 -4
  48. package/build/es/no-polyfill/common/bottomSheet/BottomSheet.spec.js +1 -1
  49. package/build/es/no-polyfill/common/bottomSheet/BottomSheet.story.js +2 -2
  50. package/build/es/no-polyfill/common/closeButton/CloseButton.js +1 -1
  51. package/build/es/no-polyfill/common/dateUtils/getDayNames/getDayNames.js +2 -2
  52. package/build/es/no-polyfill/common/dateUtils/getMonthNames/getMonthNames.js +1 -1
  53. package/build/es/no-polyfill/common/dateUtils/isDateValid/isDateValid.js +1 -1
  54. package/build/es/no-polyfill/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.js +1 -1
  55. package/build/es/no-polyfill/common/deviceDetection/deviceDetection.js +1 -1
  56. package/build/es/no-polyfill/common/direction.js +1 -1
  57. package/build/es/no-polyfill/common/domHelpers/index.js +1 -1
  58. package/build/es/no-polyfill/common/fakeEvents.js +1 -1
  59. package/build/es/no-polyfill/common/fileType.js +1 -1
  60. package/build/es/no-polyfill/common/flowHeader/FlowHeader.js +1 -1
  61. package/build/es/no-polyfill/common/focusBoundary/FocusBoundary.js +1 -1
  62. package/build/es/no-polyfill/common/focusBoundary/FocusBoundary.spec.js +1 -1
  63. package/build/es/no-polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
  64. package/build/es/no-polyfill/common/focusBoundary/utils/resetFocus.js +1 -1
  65. package/build/es/no-polyfill/common/historyNavigator/historyNavigator.js +1 -1
  66. package/build/es/no-polyfill/common/hooks/useClientWidth/useClientWidth.js +3 -3
  67. package/build/es/no-polyfill/common/hooks/useConditionalListener/useConditionalListener.js +1 -1
  68. package/build/es/no-polyfill/common/hooks/useDirection/useDirection.js +1 -1
  69. package/build/es/no-polyfill/common/hooks/useHasIntersected/useHasIntersected.js +2 -2
  70. package/build/es/no-polyfill/common/hooks/useLayout/useLayout.js +1 -1
  71. package/build/es/no-polyfill/common/key.js +1 -1
  72. package/build/es/no-polyfill/common/locale/index.js +7 -7
  73. package/build/es/no-polyfill/common/panel/Panel.js +6 -6
  74. package/build/es/no-polyfill/common/propsValues/breakpoint.js +1 -1
  75. package/build/es/no-polyfill/common/propsValues/control.js +1 -1
  76. package/build/es/no-polyfill/common/propsValues/dateMode.js +1 -1
  77. package/build/es/no-polyfill/common/propsValues/layouts.js +1 -1
  78. package/build/es/no-polyfill/common/propsValues/markdownNodeType.js +1 -1
  79. package/build/es/no-polyfill/common/propsValues/monthFormat.js +1 -1
  80. package/build/es/no-polyfill/common/propsValues/position.js +1 -1
  81. package/build/es/no-polyfill/common/propsValues/profileType.js +1 -1
  82. package/build/es/no-polyfill/common/propsValues/scroll.js +1 -1
  83. package/build/es/no-polyfill/common/propsValues/sentiment.js +1 -1
  84. package/build/es/no-polyfill/common/propsValues/size.js +1 -1
  85. package/build/es/no-polyfill/common/propsValues/status.js +1 -1
  86. package/build/es/no-polyfill/common/propsValues/type.js +1 -1
  87. package/build/es/no-polyfill/common/propsValues/typography.js +1 -1
  88. package/build/es/no-polyfill/common/propsValues/variant.js +1 -1
  89. package/build/es/no-polyfill/common/propsValues/width.js +1 -1
  90. package/build/es/no-polyfill/common/requirements.js +2 -2
  91. package/build/es/no-polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
  92. package/build/es/no-polyfill/common/textFormat/formatWithPattern/formatWithPattern.js +2 -2
  93. package/build/es/no-polyfill/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.js +1 -1
  94. package/build/es/no-polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
  95. package/build/es/no-polyfill/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.js +1 -1
  96. package/build/es/no-polyfill/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js +1 -1
  97. package/build/es/no-polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
  98. package/build/es/no-polyfill/common/theme.js +1 -1
  99. package/build/es/no-polyfill/criticalBanner/CriticalCommsBanner.js +1 -1
  100. package/build/es/no-polyfill/criticalBanner/CriticalCommsBanner.story.js +1 -1
  101. package/build/es/no-polyfill/dateInput/DateInput.js +4 -10
  102. package/build/es/no-polyfill/dateInput/DateInput.story.js +1 -1
  103. package/build/es/no-polyfill/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.js +1 -1
  104. package/build/es/no-polyfill/dateInput/utils/explodeDate/explodeDate.js +1 -1
  105. package/build/es/no-polyfill/dateLookup/DateLookup.js +3 -4
  106. package/build/es/no-polyfill/dateLookup/dateHeader/DateHeader.js +1 -1
  107. package/build/es/no-polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  108. package/build/es/no-polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
  109. package/build/es/no-polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +4 -5
  110. package/build/es/no-polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
  111. package/build/es/no-polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  112. package/build/es/no-polyfill/dateLookup/tableLink/TableLink.js +1 -1
  113. package/build/es/no-polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
  114. package/build/es/no-polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  115. package/build/es/no-polyfill/decision/Decision.js +5 -5
  116. package/build/es/no-polyfill/decision/decisionEnums.js +2 -2
  117. package/build/es/no-polyfill/definitionList/DefinitionList.js +1 -1
  118. package/build/es/no-polyfill/dimmer/Dimmer.js +3 -3
  119. package/build/es/no-polyfill/dimmer/Dimmer.story.js +2 -2
  120. package/build/es/no-polyfill/dimmer/dimmerManager/DimmerManager.js +3 -3
  121. package/build/es/no-polyfill/display/Display.js +1 -1
  122. package/build/es/no-polyfill/display/Display.story.js +2 -2
  123. package/build/es/no-polyfill/drawer/Drawer.js +1 -1
  124. package/build/es/no-polyfill/dropFade/DropFade.js +3 -3
  125. package/build/es/no-polyfill/dropFade/DropFade.story.js +1 -1
  126. package/build/es/no-polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
  127. package/build/es/no-polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +1 -1
  128. package/build/es/no-polyfill/dynamicFieldDefinitionList/utils/createDefinitions.js +2 -2
  129. package/build/es/no-polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
  130. package/build/es/no-polyfill/emphasis/Emphasis.js +2 -2
  131. package/build/es/no-polyfill/emphasis/EmphasisHtmlTransformer.js +2 -2
  132. package/build/es/no-polyfill/flowNavigation/FlowNavigation.js +2 -2
  133. package/build/es/no-polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  134. package/build/es/no-polyfill/flowNavigation/backButton/BackButton.js +1 -1
  135. package/build/es/no-polyfill/header/Header.js +2 -2
  136. package/build/es/no-polyfill/header/Header.spec.js +1 -1
  137. package/build/es/no-polyfill/header/Header.story.js +2 -1
  138. package/build/es/no-polyfill/i18n/index.js +1 -1
  139. package/build/es/no-polyfill/image/Image.js +2 -2
  140. package/build/es/no-polyfill/info/Info.js +1 -1
  141. package/build/es/no-polyfill/info/Info.story.js +1 -1
  142. package/build/es/no-polyfill/info/infoPresentations.js +1 -1
  143. package/build/es/no-polyfill/inlineAlert/InlineAlert.js +1 -1
  144. package/build/es/no-polyfill/inputWithDisplayFormat/InputWithDisplayFormat.js +1 -1
  145. package/build/es/no-polyfill/inputs/Input.js +1 -1
  146. package/build/es/no-polyfill/inputs/TextArea.js +1 -1
  147. package/build/es/no-polyfill/inputs/_common.js +2 -2
  148. package/build/es/no-polyfill/instructionsList/InstructionsList.js +3 -3
  149. package/build/es/no-polyfill/link/Link.js +2 -2
  150. package/build/es/no-polyfill/link/Link.spec.js +1 -1
  151. package/build/es/no-polyfill/link/Link.story.js +1 -1
  152. package/build/es/no-polyfill/listItem/ListItem.js +1 -1
  153. package/build/es/no-polyfill/listItem/ListItem.spec.js +1 -1
  154. package/build/es/no-polyfill/listItem/ListItem.story.js +1 -1
  155. package/build/es/no-polyfill/loader/Loader.js +2 -2
  156. package/build/es/no-polyfill/loader/Loader.story.js +1 -1
  157. package/build/es/no-polyfill/logo/Logo.js +1 -1
  158. package/build/es/no-polyfill/logo/Logo.story.js +1 -1
  159. package/build/es/no-polyfill/logo/logoTypes.js +1 -1
  160. package/build/es/no-polyfill/markdown/Markdown.js +1 -1
  161. package/build/es/no-polyfill/modal/Modal.js +1 -1
  162. package/build/es/no-polyfill/modal/Modal.story.js +2 -2
  163. package/build/es/no-polyfill/money/Money.js +1 -1
  164. package/build/es/no-polyfill/money/Money.story.js +1 -1
  165. package/build/es/no-polyfill/moneyInput/MoneyInput.js +1 -1
  166. package/build/es/no-polyfill/moneyInput/MoneyInput.story.js +1 -1
  167. package/build/es/no-polyfill/moneyInput/currencyFormatting.js +2 -2
  168. package/build/es/no-polyfill/navigationOption/NavigationOption.js +1 -1
  169. package/build/es/no-polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
  170. package/build/es/no-polyfill/nudge/Nudge.js +1 -1
  171. package/build/es/no-polyfill/overlayHeader/OverlayHeader.js +1 -1
  172. package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  173. package/build/es/no-polyfill/phoneNumberInput/data/countries.js +1 -1
  174. package/build/es/no-polyfill/phoneNumberInput/utils/cleanNumber/cleanNumber.js +1 -1
  175. package/build/es/no-polyfill/phoneNumberInput/utils/excludeCountries/excludeCountries.js +2 -2
  176. package/build/es/no-polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +1 -1
  177. package/build/es/no-polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +1 -1
  178. package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
  179. package/build/es/no-polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
  180. package/build/es/no-polyfill/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +1 -1
  181. package/build/es/no-polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +1 -1
  182. package/build/es/no-polyfill/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +1 -1
  183. package/build/es/no-polyfill/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +1 -1
  184. package/build/es/no-polyfill/phoneNumberInput/utils/longestMatchingPrefix/index.js +1 -1
  185. package/build/es/no-polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +3 -3
  186. package/build/es/no-polyfill/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +2 -2
  187. package/build/es/no-polyfill/popover/Popover.js +2 -2
  188. package/build/es/no-polyfill/processIndicator/ProcessIndicator.js +4 -4
  189. package/build/es/no-polyfill/progress/Progress.js +1 -1
  190. package/build/es/no-polyfill/progress/Progress.story.js +1 -1
  191. package/build/es/no-polyfill/progressBar/ProgressBar.js +1 -1
  192. package/build/es/no-polyfill/progressBar/ProgressBar.story.js +1 -1
  193. package/build/es/no-polyfill/provider/Provider.js +1 -1
  194. package/build/es/no-polyfill/provider/Provider.spec.js +1 -1
  195. package/build/es/no-polyfill/provider/Provider.story.js +1 -1
  196. package/build/es/no-polyfill/provider/direction/DirectionProvider.js +1 -1
  197. package/build/es/no-polyfill/provider/direction/DirectionProvider.spec.js +1 -1
  198. package/build/es/no-polyfill/provider/language/LanguageProvider.js +1 -1
  199. package/build/es/no-polyfill/provider/language/LanguageProvider.spec.js +1 -1
  200. package/build/es/no-polyfill/radio/Radio.js +1 -1
  201. package/build/es/no-polyfill/radioGroup/RadioGroup.js +2 -2
  202. package/build/es/no-polyfill/radioOption/RadioOption.js +1 -1
  203. package/build/es/no-polyfill/section/Section.js +1 -1
  204. package/build/es/no-polyfill/section/Section.spec.js +1 -1
  205. package/build/es/no-polyfill/section/Section.story.js +1 -1
  206. package/build/es/no-polyfill/select/Select.js +8 -9
  207. package/build/es/no-polyfill/select/option/Option.js +1 -1
  208. package/build/es/no-polyfill/select/searchBox/SearchBox.js +1 -1
  209. package/build/es/no-polyfill/sizeSwapper/SizeSwapper.js +3 -3
  210. package/build/es/no-polyfill/slidingPanel/SlidingPanel.js +2 -2
  211. package/build/es/no-polyfill/snackbar/Snackbar.js +1 -1
  212. package/build/es/no-polyfill/snackbar/SnackbarContext.js +1 -1
  213. package/build/es/no-polyfill/snackbar/SnackbarProvider.js +1 -1
  214. package/build/es/no-polyfill/snackbar/useSnackbar.js +1 -1
  215. package/build/es/no-polyfill/statusIcon/StatusIcon.js +1 -1
  216. package/build/es/no-polyfill/statusIcon/StatusIcon.story.js +1 -1
  217. package/build/es/no-polyfill/stepper/Stepper.js +1 -1
  218. package/build/es/no-polyfill/stepper/deviceDetection.js +2 -2
  219. package/build/es/no-polyfill/sticky/Sticky.js +1 -1
  220. package/build/es/no-polyfill/summary/Summary.js +1 -1
  221. package/build/es/no-polyfill/switch/Switch.js +1 -1
  222. package/build/es/no-polyfill/switch/Switch.story.js +1 -1
  223. package/build/es/no-polyfill/switchOption/SwitchOption.js +1 -1
  224. package/build/es/no-polyfill/switchOption/SwitchOption.story.js +1 -1
  225. package/build/es/no-polyfill/tabs/Tab.js +1 -1
  226. package/build/es/no-polyfill/tabs/TabList.js +1 -1
  227. package/build/es/no-polyfill/tabs/TabPanel.js +1 -1
  228. package/build/es/no-polyfill/tabs/Tabs.js +1 -5
  229. package/build/es/no-polyfill/tabs/utils.js +2 -2
  230. package/build/es/no-polyfill/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +1 -1
  231. package/build/es/no-polyfill/tile/Tile.js +1 -1
  232. package/build/es/no-polyfill/title/Title.js +1 -1
  233. package/build/es/no-polyfill/title/Title.spec.js +1 -1
  234. package/build/es/no-polyfill/title/Title.story.js +1 -1
  235. package/build/es/no-polyfill/tooltip/Tooltip.js +7 -7
  236. package/build/es/no-polyfill/tooltip/Tooltip.spec.js +1 -1
  237. package/build/es/no-polyfill/tooltip/Tooltip.story.js +1 -1
  238. package/build/es/no-polyfill/typeahead/Typeahead.js +1 -1
  239. package/build/es/no-polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
  240. package/build/es/no-polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
  241. package/build/es/no-polyfill/typeahead/util/highlight.js +1 -1
  242. package/build/es/no-polyfill/upload/Upload.js +2 -6
  243. package/build/es/no-polyfill/upload/steps/completeStep/completeStep.js +1 -1
  244. package/build/es/no-polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
  245. package/build/es/no-polyfill/upload/steps/processingStep/processingStep.js +1 -1
  246. package/build/es/no-polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  247. package/build/es/no-polyfill/upload/uploadSteps.js +1 -1
  248. package/build/es/no-polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
  249. package/build/es/no-polyfill/upload/utils/getFileType/getFileType.js +1 -1
  250. package/build/es/no-polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +1 -1
  251. package/build/es/no-polyfill/upload/utils/isSizeValid/isSizeValid.js +1 -1
  252. package/build/es/no-polyfill/upload/utils/isTypeValid/isTypeValid.js +1 -1
  253. package/build/es/no-polyfill/upload/utils/postData/postData.js +1 -1
  254. package/build/es/no-polyfill/upload/utils/requestMedia/requestMedia.js +1 -1
  255. package/build/es/no-polyfill/uploadInput/UploadInput.js +7 -7
  256. package/build/es/no-polyfill/uploadInput/UploadInput.spec.js +1 -1
  257. package/build/es/no-polyfill/uploadInput/UploadInput.story.js +1 -1
  258. package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
  259. package/build/es/no-polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -3
  260. package/build/es/no-polyfill/uploadInput/uploadButton/defaults.js +1 -1
  261. package/build/es/no-polyfill/uploadInput/uploadButton/getAllowedFileTypes.js +3 -3
  262. package/build/es/no-polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
  263. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
  264. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
  265. package/build/es/no-polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
  266. package/build/es/no-polyfill/utilities/deprecatedProperty/deprecatedProperty.js +1 -1
  267. package/build/es/no-polyfill/utilities/logActionRequired.js +1 -1
  268. package/build/es/no-polyfill/withDisplayFormat/WithDisplayFormat.js +3 -4
  269. package/build/es/no-polyfill/withNextPortal/withNextPortal.js +1 -1
  270. package/build/es/polyfill/accordion/Accordion.js +1 -1
  271. package/build/es/polyfill/accordion/Accordion.story.js +1 -1
  272. package/build/es/polyfill/accordion/AccordionItem/AccordionItem.js +1 -1
  273. package/build/es/polyfill/actionButton/ActionButton.js +1 -1
  274. package/build/es/polyfill/actionButton/ActionButton.spec.js +1 -1
  275. package/build/es/polyfill/actionButton/ActionButton.story.js +1 -1
  276. package/build/es/polyfill/actionOption/ActionOption.js +1 -1
  277. package/build/es/polyfill/actionOption/ActionOption.story.js +1 -1
  278. package/build/es/polyfill/alert/Alert.js +1 -1
  279. package/build/es/polyfill/alert/Alert.story.js +1 -1
  280. package/build/es/polyfill/alert/inlineMarkdown/InlineMarkdown.js +1 -1
  281. package/build/es/polyfill/alert/withArrow/alertArrowPositions.js +1 -1
  282. package/build/es/polyfill/alert/withArrow/withArrow.js +1 -1
  283. package/build/es/polyfill/avatar/Avatar.js +1 -1
  284. package/build/es/polyfill/avatar/Avatar.story.js +1 -1
  285. package/build/es/polyfill/avatar/avatarTypes.js +1 -1
  286. package/build/es/polyfill/avatar/colors/colors.js +2 -2
  287. package/build/es/polyfill/avatarWrapper/AvatarWrapper.js +1 -1
  288. package/build/es/polyfill/avatarWrapper/AvatarWrapper.story.js +1 -1
  289. package/build/es/polyfill/badge/Badge.js +1 -1
  290. package/build/es/polyfill/body/Body.js +2 -2
  291. package/build/es/polyfill/body/Body.spec.js +1 -1
  292. package/build/es/polyfill/body/Body.story.js +1 -1
  293. package/build/es/polyfill/button/Button.js +5 -5
  294. package/build/es/polyfill/button/Button.story.js +1 -1
  295. package/build/es/polyfill/button/classMap.js +1 -1
  296. package/build/es/polyfill/button/legacyUtils/legacyUtils.js +2 -2
  297. package/build/es/polyfill/card/Card.js +1 -1
  298. package/build/es/polyfill/checkbox/Checkbox.js +1 -1
  299. package/build/es/polyfill/checkbox/Checkbox.story.js +1 -1
  300. package/build/es/polyfill/checkboxButton/CheckboxButton.js +1 -1
  301. package/build/es/polyfill/checkboxButton/CheckboxButton.spec.js +1 -1
  302. package/build/es/polyfill/checkboxButton/CheckboxButton.story.js +1 -1
  303. package/build/es/polyfill/checkboxOption/CheckboxOption.js +1 -1
  304. package/build/es/polyfill/checkboxOption/CheckboxOption.spec.js +1 -1
  305. package/build/es/polyfill/checkboxOption/CheckboxOption.story.js +1 -1
  306. package/build/es/polyfill/chevron/Chevron.js +1 -1
  307. package/build/es/polyfill/chevron/Chevron.story.js +1 -1
  308. package/build/es/polyfill/chips/Chip.js +1 -1
  309. package/build/es/polyfill/chips/Chips.js +1 -1
  310. package/build/es/polyfill/chips/Chips.spec.js +1 -1
  311. package/build/es/polyfill/chips/Chips.story.js +1 -1
  312. package/build/es/polyfill/circularButton/CircularButton.js +1 -1
  313. package/build/es/polyfill/common/DOMOperations/DOMOperations.js +3 -3
  314. package/build/es/polyfill/common/Option/Option.js +1 -1
  315. package/build/es/polyfill/common/RadioButton/RadioButton.js +1 -1
  316. package/build/es/polyfill/common/bottomSheet/BottomSheet.js +4 -4
  317. package/build/es/polyfill/common/bottomSheet/BottomSheet.spec.js +1 -1
  318. package/build/es/polyfill/common/bottomSheet/BottomSheet.story.js +2 -2
  319. package/build/es/polyfill/common/closeButton/CloseButton.js +1 -1
  320. package/build/es/polyfill/common/dateUtils/getDayNames/getDayNames.js +2 -2
  321. package/build/es/polyfill/common/dateUtils/getMonthNames/getMonthNames.js +1 -1
  322. package/build/es/polyfill/common/dateUtils/isDateValid/isDateValid.js +1 -1
  323. package/build/es/polyfill/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.js +1 -1
  324. package/build/es/polyfill/common/deviceDetection/deviceDetection.js +1 -1
  325. package/build/es/polyfill/common/direction.js +1 -1
  326. package/build/es/polyfill/common/domHelpers/index.js +1 -1
  327. package/build/es/polyfill/common/fakeEvents.js +1 -1
  328. package/build/es/polyfill/common/fileType.js +1 -1
  329. package/build/es/polyfill/common/flowHeader/FlowHeader.js +1 -1
  330. package/build/es/polyfill/common/focusBoundary/FocusBoundary.js +1 -1
  331. package/build/es/polyfill/common/focusBoundary/FocusBoundary.spec.js +1 -1
  332. package/build/es/polyfill/common/focusBoundary/utils/getFocusableElements.js +2 -2
  333. package/build/es/polyfill/common/focusBoundary/utils/resetFocus.js +1 -1
  334. package/build/es/polyfill/common/historyNavigator/historyNavigator.js +1 -1
  335. package/build/es/polyfill/common/hooks/useClientWidth/useClientWidth.js +3 -3
  336. package/build/es/polyfill/common/hooks/useConditionalListener/useConditionalListener.js +1 -1
  337. package/build/es/polyfill/common/hooks/useDirection/useDirection.js +1 -1
  338. package/build/es/polyfill/common/hooks/useHasIntersected/useHasIntersected.js +2 -2
  339. package/build/es/polyfill/common/hooks/useLayout/useLayout.js +1 -1
  340. package/build/es/polyfill/common/key.js +1 -1
  341. package/build/es/polyfill/common/locale/index.js +8 -8
  342. package/build/es/polyfill/common/panel/Panel.js +6 -6
  343. package/build/es/polyfill/common/propsValues/breakpoint.js +1 -1
  344. package/build/es/polyfill/common/propsValues/control.js +1 -1
  345. package/build/es/polyfill/common/propsValues/dateMode.js +1 -1
  346. package/build/es/polyfill/common/propsValues/layouts.js +1 -1
  347. package/build/es/polyfill/common/propsValues/markdownNodeType.js +1 -1
  348. package/build/es/polyfill/common/propsValues/monthFormat.js +1 -1
  349. package/build/es/polyfill/common/propsValues/position.js +1 -1
  350. package/build/es/polyfill/common/propsValues/profileType.js +1 -1
  351. package/build/es/polyfill/common/propsValues/scroll.js +1 -1
  352. package/build/es/polyfill/common/propsValues/sentiment.js +1 -1
  353. package/build/es/polyfill/common/propsValues/size.js +1 -1
  354. package/build/es/polyfill/common/propsValues/status.js +1 -1
  355. package/build/es/polyfill/common/propsValues/type.js +1 -1
  356. package/build/es/polyfill/common/propsValues/typography.js +1 -1
  357. package/build/es/polyfill/common/propsValues/variant.js +1 -1
  358. package/build/es/polyfill/common/propsValues/width.js +1 -1
  359. package/build/es/polyfill/common/requirements.js +2 -2
  360. package/build/es/polyfill/common/responsivePanel/ResponsivePanel.js +1 -1
  361. package/build/es/polyfill/common/textFormat/formatWithPattern/formatWithPattern.js +2 -2
  362. package/build/es/polyfill/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.js +1 -1
  363. package/build/es/polyfill/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.js +1 -1
  364. package/build/es/polyfill/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.js +1 -1
  365. package/build/es/polyfill/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.js +1 -1
  366. package/build/es/polyfill/common/textFormat/unformatWithPattern/unformatWithPattern.js +1 -1
  367. package/build/es/polyfill/common/theme.js +1 -1
  368. package/build/es/polyfill/criticalBanner/CriticalCommsBanner.js +1 -1
  369. package/build/es/polyfill/criticalBanner/CriticalCommsBanner.story.js +1 -1
  370. package/build/es/polyfill/dateInput/DateInput.js +4 -10
  371. package/build/es/polyfill/dateInput/DateInput.story.js +1 -1
  372. package/build/es/polyfill/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.js +1 -1
  373. package/build/es/polyfill/dateInput/utils/explodeDate/explodeDate.js +1 -1
  374. package/build/es/polyfill/dateLookup/DateLookup.js +3 -4
  375. package/build/es/polyfill/dateLookup/dateHeader/DateHeader.js +1 -1
  376. package/build/es/polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  377. package/build/es/polyfill/dateLookup/dayCalendar/DayCalendar.js +1 -1
  378. package/build/es/polyfill/dateLookup/dayCalendar/table/DayCalendarTable.js +4 -5
  379. package/build/es/polyfill/dateLookup/monthCalendar/MonthCalendar.js +1 -1
  380. package/build/es/polyfill/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  381. package/build/es/polyfill/dateLookup/tableLink/TableLink.js +1 -1
  382. package/build/es/polyfill/dateLookup/yearCalendar/YearCalendar.js +1 -1
  383. package/build/es/polyfill/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  384. package/build/es/polyfill/decision/Decision.js +5 -5
  385. package/build/es/polyfill/decision/decisionEnums.js +2 -2
  386. package/build/es/polyfill/definitionList/DefinitionList.js +1 -1
  387. package/build/es/polyfill/dimmer/Dimmer.js +3 -3
  388. package/build/es/polyfill/dimmer/Dimmer.story.js +2 -2
  389. package/build/es/polyfill/dimmer/dimmerManager/DimmerManager.js +3 -3
  390. package/build/es/polyfill/display/Display.js +1 -1
  391. package/build/es/polyfill/display/Display.story.js +2 -2
  392. package/build/es/polyfill/drawer/Drawer.js +1 -1
  393. package/build/es/polyfill/dropFade/DropFade.js +3 -3
  394. package/build/es/polyfill/dropFade/DropFade.story.js +1 -1
  395. package/build/es/polyfill/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +1 -1
  396. package/build/es/polyfill/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +2 -2
  397. package/build/es/polyfill/dynamicFieldDefinitionList/utils/createDefinitions.js +2 -2
  398. package/build/es/polyfill/dynamicFieldDefinitionList/utils/text-format.js +1 -1
  399. package/build/es/polyfill/emphasis/Emphasis.js +2 -2
  400. package/build/es/polyfill/emphasis/EmphasisHtmlTransformer.js +2 -2
  401. package/build/es/polyfill/flowNavigation/FlowNavigation.js +2 -2
  402. package/build/es/polyfill/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  403. package/build/es/polyfill/flowNavigation/backButton/BackButton.js +1 -1
  404. package/build/es/polyfill/header/Header.js +2 -2
  405. package/build/es/polyfill/header/Header.spec.js +1 -1
  406. package/build/es/polyfill/header/Header.story.js +2 -1
  407. package/build/es/polyfill/i18n/index.js +1 -1
  408. package/build/es/polyfill/image/Image.js +2 -2
  409. package/build/es/polyfill/info/Info.js +1 -1
  410. package/build/es/polyfill/info/Info.story.js +1 -1
  411. package/build/es/polyfill/info/infoPresentations.js +1 -1
  412. package/build/es/polyfill/inlineAlert/InlineAlert.js +1 -1
  413. package/build/es/polyfill/inputWithDisplayFormat/InputWithDisplayFormat.js +1 -1
  414. package/build/es/polyfill/inputs/Input.js +1 -1
  415. package/build/es/polyfill/inputs/TextArea.js +1 -1
  416. package/build/es/polyfill/inputs/_common.js +2 -2
  417. package/build/es/polyfill/instructionsList/InstructionsList.js +3 -3
  418. package/build/es/polyfill/link/Link.js +2 -2
  419. package/build/es/polyfill/link/Link.spec.js +1 -1
  420. package/build/es/polyfill/link/Link.story.js +1 -1
  421. package/build/es/polyfill/listItem/ListItem.js +1 -1
  422. package/build/es/polyfill/listItem/ListItem.spec.js +1 -1
  423. package/build/es/polyfill/listItem/ListItem.story.js +1 -1
  424. package/build/es/polyfill/loader/Loader.js +2 -2
  425. package/build/es/polyfill/loader/Loader.story.js +1 -1
  426. package/build/es/polyfill/logo/Logo.js +1 -1
  427. package/build/es/polyfill/logo/Logo.story.js +1 -1
  428. package/build/es/polyfill/logo/logoTypes.js +1 -1
  429. package/build/es/polyfill/markdown/Markdown.js +1 -1
  430. package/build/es/polyfill/modal/Modal.js +1 -1
  431. package/build/es/polyfill/modal/Modal.story.js +2 -2
  432. package/build/es/polyfill/money/Money.js +1 -1
  433. package/build/es/polyfill/money/Money.story.js +1 -1
  434. package/build/es/polyfill/moneyInput/MoneyInput.js +1 -1
  435. package/build/es/polyfill/moneyInput/MoneyInput.story.js +1 -1
  436. package/build/es/polyfill/moneyInput/currencyFormatting.js +3 -3
  437. package/build/es/polyfill/navigationOption/NavigationOption.js +1 -1
  438. package/build/es/polyfill/navigationOptionsList/NavigationOptionsList.js +1 -1
  439. package/build/es/polyfill/nudge/Nudge.js +1 -1
  440. package/build/es/polyfill/overlayHeader/OverlayHeader.js +1 -1
  441. package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  442. package/build/es/polyfill/phoneNumberInput/data/countries.js +1 -1
  443. package/build/es/polyfill/phoneNumberInput/utils/cleanNumber/cleanNumber.js +1 -1
  444. package/build/es/polyfill/phoneNumberInput/utils/excludeCountries/excludeCountries.js +3 -3
  445. package/build/es/polyfill/phoneNumberInput/utils/explodeNumberModel/index.js +2 -2
  446. package/build/es/polyfill/phoneNumberInput/utils/filterOptionsForQuery/index.js +2 -2
  447. package/build/es/polyfill/phoneNumberInput/utils/findCountryByCode/index.js +1 -1
  448. package/build/es/polyfill/phoneNumberInput/utils/findCountryByPrefix/index.js +1 -1
  449. package/build/es/polyfill/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +1 -1
  450. package/build/es/polyfill/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +2 -2
  451. package/build/es/polyfill/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +1 -1
  452. package/build/es/polyfill/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +2 -2
  453. package/build/es/polyfill/phoneNumberInput/utils/longestMatchingPrefix/index.js +1 -1
  454. package/build/es/polyfill/phoneNumberInput/utils/setDefaultPrefix/index.js +3 -3
  455. package/build/es/polyfill/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +2 -2
  456. package/build/es/polyfill/popover/Popover.js +2 -2
  457. package/build/es/polyfill/processIndicator/ProcessIndicator.js +4 -4
  458. package/build/es/polyfill/progress/Progress.js +1 -1
  459. package/build/es/polyfill/progress/Progress.story.js +1 -1
  460. package/build/es/polyfill/progressBar/ProgressBar.js +1 -1
  461. package/build/es/polyfill/progressBar/ProgressBar.story.js +1 -1
  462. package/build/es/polyfill/provider/Provider.js +1 -1
  463. package/build/es/polyfill/provider/Provider.spec.js +1 -1
  464. package/build/es/polyfill/provider/Provider.story.js +1 -1
  465. package/build/es/polyfill/provider/direction/DirectionProvider.js +1 -1
  466. package/build/es/polyfill/provider/direction/DirectionProvider.spec.js +1 -1
  467. package/build/es/polyfill/provider/language/LanguageProvider.js +1 -1
  468. package/build/es/polyfill/provider/language/LanguageProvider.spec.js +1 -1
  469. package/build/es/polyfill/radio/Radio.js +1 -1
  470. package/build/es/polyfill/radioGroup/RadioGroup.js +2 -2
  471. package/build/es/polyfill/radioOption/RadioOption.js +1 -1
  472. package/build/es/polyfill/section/Section.js +1 -1
  473. package/build/es/polyfill/section/Section.spec.js +1 -1
  474. package/build/es/polyfill/section/Section.story.js +1 -1
  475. package/build/es/polyfill/select/Select.js +8 -9
  476. package/build/es/polyfill/select/option/Option.js +2 -2
  477. package/build/es/polyfill/select/searchBox/SearchBox.js +1 -1
  478. package/build/es/polyfill/sizeSwapper/SizeSwapper.js +3 -3
  479. package/build/es/polyfill/slidingPanel/SlidingPanel.js +2 -2
  480. package/build/es/polyfill/snackbar/Snackbar.js +1 -1
  481. package/build/es/polyfill/snackbar/SnackbarContext.js +1 -1
  482. package/build/es/polyfill/snackbar/SnackbarProvider.js +1 -1
  483. package/build/es/polyfill/snackbar/useSnackbar.js +1 -1
  484. package/build/es/polyfill/statusIcon/StatusIcon.js +1 -1
  485. package/build/es/polyfill/statusIcon/StatusIcon.story.js +1 -1
  486. package/build/es/polyfill/stepper/Stepper.js +1 -1
  487. package/build/es/polyfill/stepper/deviceDetection.js +2 -2
  488. package/build/es/polyfill/sticky/Sticky.js +1 -1
  489. package/build/es/polyfill/summary/Summary.js +1 -1
  490. package/build/es/polyfill/switch/Switch.js +1 -1
  491. package/build/es/polyfill/switch/Switch.story.js +1 -1
  492. package/build/es/polyfill/switchOption/SwitchOption.js +1 -1
  493. package/build/es/polyfill/switchOption/SwitchOption.story.js +1 -1
  494. package/build/es/polyfill/tabs/Tab.js +1 -1
  495. package/build/es/polyfill/tabs/TabList.js +1 -1
  496. package/build/es/polyfill/tabs/TabPanel.js +1 -1
  497. package/build/es/polyfill/tabs/Tabs.js +1 -5
  498. package/build/es/polyfill/tabs/utils.js +2 -2
  499. package/build/es/polyfill/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +1 -1
  500. package/build/es/polyfill/tile/Tile.js +1 -1
  501. package/build/es/polyfill/title/Title.js +1 -1
  502. package/build/es/polyfill/title/Title.spec.js +1 -1
  503. package/build/es/polyfill/title/Title.story.js +1 -1
  504. package/build/es/polyfill/tooltip/Tooltip.js +7 -7
  505. package/build/es/polyfill/tooltip/Tooltip.spec.js +1 -1
  506. package/build/es/polyfill/tooltip/Tooltip.story.js +1 -1
  507. package/build/es/polyfill/typeahead/Typeahead.js +1 -1
  508. package/build/es/polyfill/typeahead/typeaheadInput/TypeaheadInput.js +1 -1
  509. package/build/es/polyfill/typeahead/typeaheadOption/TypeaheadOption.js +1 -1
  510. package/build/es/polyfill/typeahead/util/highlight.js +1 -1
  511. package/build/es/polyfill/upload/Upload.js +2 -6
  512. package/build/es/polyfill/upload/steps/completeStep/completeStep.js +1 -1
  513. package/build/es/polyfill/upload/steps/mediaUploadStep/mediaUploadStep.js +1 -1
  514. package/build/es/polyfill/upload/steps/processingStep/processingStep.js +1 -1
  515. package/build/es/polyfill/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
  516. package/build/es/polyfill/upload/uploadSteps.js +1 -1
  517. package/build/es/polyfill/upload/utils/asyncFileRead/asyncFileRead.js +1 -1
  518. package/build/es/polyfill/upload/utils/getFileType/getFileType.js +1 -1
  519. package/build/es/polyfill/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +2 -2
  520. package/build/es/polyfill/upload/utils/isSizeValid/isSizeValid.js +1 -1
  521. package/build/es/polyfill/upload/utils/isTypeValid/isTypeValid.js +1 -1
  522. package/build/es/polyfill/upload/utils/postData/postData.js +1 -1
  523. package/build/es/polyfill/upload/utils/requestMedia/requestMedia.js +1 -1
  524. package/build/es/polyfill/uploadInput/UploadInput.js +7 -7
  525. package/build/es/polyfill/uploadInput/UploadInput.spec.js +1 -1
  526. package/build/es/polyfill/uploadInput/UploadInput.story.js +1 -1
  527. package/build/es/polyfill/uploadInput/uploadButton/UploadButton.js +1 -1
  528. package/build/es/polyfill/uploadInput/uploadButton/UploadButton.spec.js +3 -3
  529. package/build/es/polyfill/uploadInput/uploadButton/defaults.js +1 -1
  530. package/build/es/polyfill/uploadInput/uploadButton/getAllowedFileTypes.js +3 -3
  531. package/build/es/polyfill/uploadInput/uploadButton/getAllowedFileTypes.spec.js +1 -1
  532. package/build/es/polyfill/uploadInput/uploadItem/UploadItem.js +2 -2
  533. package/build/es/polyfill/uploadInput/uploadItem/UploadItem.spec.js +1 -1
  534. package/build/es/polyfill/uploadInput/uploadItem/UploadItemBody.js +1 -1
  535. package/build/es/polyfill/utilities/deprecatedProperty/deprecatedProperty.js +1 -1
  536. package/build/es/polyfill/utilities/logActionRequired.js +1 -1
  537. package/build/es/polyfill/withDisplayFormat/WithDisplayFormat.js +3 -4
  538. package/build/es/polyfill/withNextPortal/withNextPortal.js +1 -1
  539. package/build/main.css +1 -4236
  540. package/build/styles/accordion/Accordion.css +1 -59
  541. package/build/styles/actionButton/ActionButton.css +1 -41
  542. package/build/styles/avatar/Avatar.css +1 -240
  543. package/build/styles/badge/Badge.css +1 -66
  544. package/build/styles/button/Button.css +1 -17
  545. package/build/styles/card/Card.css +1 -88
  546. package/build/styles/checkboxButton/CheckboxButton.css +1 -21
  547. package/build/styles/chips/Chip.css +1 -169
  548. package/build/styles/circularButton/CircularButton.css +1 -175
  549. package/build/styles/common/Option/Option.css +1 -74
  550. package/build/styles/common/RadioButton/RadioButton.css +1 -3
  551. package/build/styles/common/bottomSheet/BottomSheet.css +1 -44
  552. package/build/styles/common/closeButton/CloseButton.css +1 -44
  553. package/build/styles/common/panel/Panel.css +1 -67
  554. package/build/styles/criticalBanner/CriticalCommsBanner.css +1 -73
  555. package/build/styles/dateInput/DateInput.css +1 -3
  556. package/build/styles/dateLookup/DateLookup.css +1 -80
  557. package/build/styles/dateLookup/dateTrigger/DateTrigger.css +1 -53
  558. package/build/styles/decision/Decision.css +1 -69
  559. package/build/styles/definitionList/DefinitionList.css +1 -48
  560. package/build/styles/dimmer/Dimmer.css +1 -68
  561. package/build/styles/drawer/Drawer.css +1 -77
  562. package/build/styles/dropFade/DropFade.css +1 -19
  563. package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +1 -4
  564. package/build/styles/emphasis/Emphasis.css +1 -25
  565. package/build/styles/flowNavigation/FlowNavigation.css +1 -85
  566. package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -26
  567. package/build/styles/flowNavigation/backButton/BackButton.css +1 -28
  568. package/build/styles/header/Header.css +1 -20
  569. package/build/styles/image/Image.css +1 -12
  570. package/build/styles/info/Info.css +1 -37
  571. package/build/styles/inputs/Input.css +1 -53
  572. package/build/styles/inputs/TextArea.css +1 -59
  573. package/build/styles/instructionsList/InstructionsList.css +1 -30
  574. package/build/styles/link/Link.css +1 -12
  575. package/build/styles/listItem/ListItem.css +1 -6
  576. package/build/styles/loader/Loader.css +1 -294
  577. package/build/styles/logo/Logo.css +1 -10
  578. package/build/styles/main.css +1 -4236
  579. package/build/styles/modal/Modal.css +1 -133
  580. package/build/styles/moneyInput/MoneyInput.css +1 -128
  581. package/build/styles/navigationOption/NavigationOption.css +1 -61
  582. package/build/styles/navigationOptionsList/NavigationOptionsList.css +1 -12
  583. package/build/styles/nudge/Nudge.css +1 -138
  584. package/build/styles/overlayHeader/OverlayHeader.css +1 -31
  585. package/build/styles/phoneNumberInput/PhoneNumberInput.css +1 -17
  586. package/build/styles/popover/Popover.css +1 -40
  587. package/build/styles/progress/Progress.css +1 -35
  588. package/build/styles/progressBar/ProgressBar.css +1 -9
  589. package/build/styles/section/Section.css +1 -8
  590. package/build/styles/select/Select.css +1 -322
  591. package/build/styles/slidingPanel/SlidingPanel.css +1 -96
  592. package/build/styles/snackbar/Snackbar.css +1 -85
  593. package/build/styles/statusIcon/StatusIcon.css +1 -50
  594. package/build/styles/stepper/Stepper.css +1 -139
  595. package/build/styles/summary/Summary.css +1 -86
  596. package/build/styles/switch/Switch.css +1 -64
  597. package/build/styles/tabs/Tabs.css +1 -104
  598. package/build/styles/tile/Tile.css +1 -58
  599. package/build/styles/tooltip/Tooltip.css +1 -37
  600. package/build/styles/typeahead/Typeahead.css +1 -167
  601. package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +1 -6
  602. package/build/styles/upload/Upload.css +1 -15
  603. package/build/styles/uploadInput/UploadInput.css +1 -53
  604. package/build/styles/uploadInput/uploadButton/UploadButton.css +1 -44
  605. package/build/styles/uploadInput/uploadItem/UploadItem.css +1 -60
  606. package/build/types/actionButton/ActionButton.d.ts +3 -0
  607. package/build/types/actionButton/ActionButton.story.d.ts +1 -0
  608. package/build/types/button/Button.story.d.ts +24 -24
  609. package/build/umd/no-polyfill/main.js +1 -1
  610. package/build/umd/polyfill/main.js +1 -1
  611. package/package.json +1 -1
@@ -1 +1 @@
1
- import{within}from"@testing-library/react";import userEvent from"@testing-library/user-event";import{Status}from"../common";import{render,screen,waitFor,waitForElementToBeRemoved}from"../test-utils";import UploadInput from"./UploadInput";import{TEST_IDS as UPLOAD_BUTTON_TEST_IDS}from"./uploadButton/UploadButton";import{TEST_IDS as UPLOAD_ITEM_TEST_IDS}from"./uploadItem/UploadItem";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";const spiedDateObject=jest.spyOn(global,"Date");describe("UploadInput",()=>{const a=new File(["foo"],"foo.png",{type:"image/png"}),b=new File(["foo"],"foo.jpg",{type:"image/jpeg"}),c=[{id:1,filename:"purchase-receipt.pdf",status:Status.SUCCEEDED},{id:2,filename:"CoWork-0317-invoice.pdf",status:Status.PROCESSING}],d={onUploadFile:jest.fn().mockResolvedValue({id:1}).mockResolvedValueOnce({id:2}).mockResolvedValueOnce({id:3}),onDeleteFile:jest.fn().mockResolvedValue({})},e=function(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:d;return render(/*#__PURE__*/_jsx(UploadInput,{...a}))};beforeEach(()=>{spiedDateObject.mockImplementation(()=>({getTime:jest.fn().mockReturnValue(Math.random())}))}),afterAll(()=>{spiedDateObject.mockRestore()}),describe("single file upload",()=>{it("should trigger onUploadFiles & onFilesChange with a single FormData entry containing `file` field",async()=>{spiedDateObject.mockImplementation(()=>({getTime:jest.fn().mockReturnValueOnce("11111111").mockReturnValueOnce("22222222")}));const c=jest.fn();e({...d,onFilesChange:c});const f=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);userEvent.upload(f,[a,b]),await waitFor(()=>{expect(d.onUploadFile).toHaveBeenCalledTimes(1)}),expect(c).toHaveBeenCalledTimes(2),expect(c).toHaveBeenNthCalledWith(1,[{filename:"foo.png",id:`foo.png_3_${"11111111"}`,status:"pending",url:void 0}]),expect(c).toHaveBeenNthCalledWith(2,[{filename:"foo.png",id:2,status:"succeeded",url:void 0}])}),it("should render only one file even if multiple ones were supplied",()=>{e({...d,files:c}),expect(screen.getByText(c[0].filename)).toBeInTheDocument(),c.slice(1,c.length).forEach(a=>{expect(screen.queryByText(a.filename)).not.toBeInTheDocument()})})}),describe("multiple file upload",()=>{it("should render all files",()=>{e({...d,files:c,multiple:!0}),c.forEach(a=>{expect(screen.getByText(a.filename)).toBeInTheDocument()})}),it("should render the UploadButton also",()=>{e({...d,files:c,multiple:!0}),expect(screen.getByText("Upload files")).toBeInTheDocument()}),it("should trigger onUploadFile with multiple FormData entries containing `file` fields",async()=>{e({...d,multiple:!0}),d.onUploadFile.mockClear(),expect(screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput)).toHaveAttribute("multiple");const c=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);userEvent.upload(c,[a,b]),await waitFor(()=>{expect(d.onUploadFile).toHaveBeenCalledTimes(2)})})}),describe("file deletion",()=>{const a=jest.fn();beforeEach(()=>{a.mockClear()}),it("should delete file with modal confirmation",async()=>{e({...d,files:c,multiple:!0,onFilesChange:a});const b=screen.getAllByTestId(UPLOAD_ITEM_TEST_IDS.uploadItem)[0];within(b).getByLabelText("Remove file",{exact:!1}).click(),screen.getByText("Remove").click(),await waitForElementToBeRemoved(b),expect(d.onDeleteFile).toHaveBeenCalledWith(c[0].id),expect(a).toHaveBeenCalledTimes(2),expect(a).toHaveBeenNthCalledWith(1,[{error:void 0,filename:"purchase-receipt.pdf",id:1,status:"processing"},{filename:"CoWork-0317-invoice.pdf",id:2,status:"processing"}]),expect(a).toHaveBeenLastCalledWith([{filename:"CoWork-0317-invoice.pdf",id:2,status:"processing"}])}),it("should delete file with failed state without modal confirmation",()=>{const b=[{id:1,filename:"purchase-receipt.pdf",status:Status.FAILED}];e({...d,files:b,multiple:!0,onFilesChange:a});const c=screen.getAllByTestId(UPLOAD_ITEM_TEST_IDS.uploadItem)[0];within(c).getByLabelText("Remove file",{exact:!1}).click(),expect(c).not.toBeInTheDocument(),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenCalledWith([])}),it("should not render delete button when no delete callback is provided",()=>{e({...d,files:c,multiple:!0,onDeleteFile:void 0}),expect(screen.queryByLabelText("Remove file ",{exact:!1})).not.toBeInTheDocument()})}),describe("Max File Upload limit",()=>{it("should show max file number in the description next to the upload button",async()=>{e({...d,multiple:!0,maxFiles:2}),await waitFor(()=>{expect(screen.getByText(/Maximum 2 files\./)).toBeInTheDocument()})}),it("should show given error when maxFiles limit is applied and more files are uploaded",async()=>{const c=jest.fn();e({...d,multiple:!0,maxFiles:3,maxFilesErrorMessage:"Maximum files message from prop",onUploadFile:c}),c.mockImplementation(a=>{const b=a.get("file");return Promise.resolve({file:b,id:Math.random()})});const f=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);userEvent.upload(f,[a,b]);const g=new File(["foo2"],"foo2.png",{type:"image/png"}),h=new File(["foo2"],"foo2.jpg",{type:"image/jpeg"});userEvent.upload(f,[g,h]),await waitFor(()=>{expect(screen.getByText("Maximum files message from prop")).toBeInTheDocument()})}),it("should show default error when maxFiles limit exceeds and no error message provided",async()=>{const c=jest.fn();e({...d,multiple:!0,maxFiles:2,onUploadFile:c}),c.mockImplementation(a=>{const b=a.get("file");return Promise.resolve({file:b,id:Math.random()})});const f=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),g=new File(["foo2"],"foo2.png",{type:"image/png"});userEvent.upload(f,[a,b,g]),await waitFor(()=>{expect(screen.getByText("Sorry, this upload failed because we can only accept 2 files at once.")).toBeInTheDocument()})})}),describe("Misc",()=>{it("should attach the input id accepted from props to the input components",()=>{const a="LabelText";render(/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:"testInputId",children:a}),/*#__PURE__*/_jsx(UploadInput,{...d,id:"testInputId"})]})),expect(screen.getByLabelText(a)).toHaveAttribute("id","testInputId")}),it("should show the file size error when provided in props",async()=>{const a="file oversized";e({...d,sizeLimit:1,sizeLimitErrorMessage:a});const b=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),c=new File([""],"testFile.png",{type:"image/png"});Object.defineProperty(c,"size",{value:2048}),userEvent.upload(b,[c]),await waitFor(()=>{expect(screen.getByText(a)).toBeInTheDocument()})})})});
1
+ import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";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/es.object.get-own-property-descriptors.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.promise.js";import _regeneratorRuntime from"@babel/runtime/regenerator";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{within}from"@testing-library/react";import userEvent from"@testing-library/user-event";import{Status}from"../common";import{render,screen,waitFor,waitForElementToBeRemoved}from"../test-utils";import UploadInput from"./UploadInput";import{TEST_IDS as UPLOAD_BUTTON_TEST_IDS}from"./uploadButton/UploadButton";import{TEST_IDS as UPLOAD_ITEM_TEST_IDS}from"./uploadItem/UploadItem";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 spiedDateObject=jest.spyOn(global,"Date");describe("UploadInput",function(){var a=new File(["foo"],"foo.png",{type:"image/png"}),b=new File(["foo"],"foo.jpg",{type:"image/jpeg"}),c=[{id:1,filename:"purchase-receipt.pdf",status:Status.SUCCEEDED},{id:2,filename:"CoWork-0317-invoice.pdf",status:Status.PROCESSING}],d={onUploadFile:jest.fn().mockResolvedValue({id:1}).mockResolvedValueOnce({id:2}).mockResolvedValueOnce({id:3}),onDeleteFile:jest.fn().mockResolvedValue({})},e=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:d;return render(/*#__PURE__*/_jsx(UploadInput,_objectSpread({},a)))};beforeEach(function(){spiedDateObject.mockImplementation(function(){return{getTime:jest.fn().mockReturnValue(Math.random())}})}),afterAll(function(){spiedDateObject.mockRestore()}),describe("single file upload",function(){it("should trigger onUploadFiles & onFilesChange with a single FormData entry containing `file` field",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(){var f,g,h,i;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return f="11111111",g="22222222",spiedDateObject.mockImplementation(function(){return{getTime:jest.fn().mockReturnValueOnce(f).mockReturnValueOnce(g)}}),h=jest.fn(),e(_objectSpread(_objectSpread({},d),{},{onFilesChange:h})),i=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),userEvent.upload(i,[a,b]),c.next=9,waitFor(function(){expect(d.onUploadFile).toHaveBeenCalledTimes(1)});case 9:expect(h).toHaveBeenCalledTimes(2),expect(h).toHaveBeenNthCalledWith(1,[{filename:"foo.png",id:"foo.png_3_".concat(f),status:"pending",url:void 0}]),expect(h).toHaveBeenNthCalledWith(2,[{filename:"foo.png",id:2,status:"succeeded",url:void 0}]);case 12:case"end":return c.stop();}},c)}))),it("should render only one file even if multiple ones were supplied",function(){e(_objectSpread(_objectSpread({},d),{},{files:c})),expect(screen.getByText(c[0].filename)).toBeInTheDocument(),c.slice(1,c.length).forEach(function(a){expect(screen.queryByText(a.filename)).not.toBeInTheDocument()})})}),describe("multiple file upload",function(){it("should render all files",function(){e(_objectSpread(_objectSpread({},d),{},{files:c,multiple:!0})),c.forEach(function(a){expect(screen.getByText(a.filename)).toBeInTheDocument()})}),it("should render the UploadButton also",function(){e(_objectSpread(_objectSpread({},d),{},{files:c,multiple:!0})),expect(screen.getByText("Upload files")).toBeInTheDocument()}),it("should trigger onUploadFile with multiple FormData entries containing `file` fields",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(){var f;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return e(_objectSpread(_objectSpread({},d),{},{multiple:!0})),d.onUploadFile.mockClear(),expect(screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput)).toHaveAttribute("multiple"),f=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),userEvent.upload(f,[a,b]),c.next=7,waitFor(function(){expect(d.onUploadFile).toHaveBeenCalledTimes(2)});case 7:case"end":return c.stop();}},c)})))}),describe("file deletion",function(){var a=jest.fn();beforeEach(function(){a.mockClear()}),it("should delete file with modal confirmation",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function b(){var f;return _regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e(_objectSpread(_objectSpread({},d),{},{files:c,multiple:!0,onFilesChange:a})),f=screen.getAllByTestId(UPLOAD_ITEM_TEST_IDS.uploadItem)[0],within(f).getByLabelText("Remove file",{exact:!1}).click(),screen.getByText("Remove").click(),b.next=6,waitForElementToBeRemoved(f);case 6:expect(d.onDeleteFile).toHaveBeenCalledWith(c[0].id),expect(a).toHaveBeenCalledTimes(2),expect(a).toHaveBeenNthCalledWith(1,[{error:void 0,filename:"purchase-receipt.pdf",id:1,status:"processing"},{filename:"CoWork-0317-invoice.pdf",id:2,status:"processing"}]),expect(a).toHaveBeenLastCalledWith([{filename:"CoWork-0317-invoice.pdf",id:2,status:"processing"}]);case 10:case"end":return b.stop();}},b)}))),it("should delete file with failed state without modal confirmation",function(){var b=[{id:1,filename:"purchase-receipt.pdf",status:Status.FAILED}];e(_objectSpread(_objectSpread({},d),{},{files:b,multiple:!0,onFilesChange:a}));var c=screen.getAllByTestId(UPLOAD_ITEM_TEST_IDS.uploadItem)[0];within(c).getByLabelText("Remove file",{exact:!1}).click(),expect(c).not.toBeInTheDocument(),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenCalledWith([])}),it("should not render delete button when no delete callback is provided",function(){e(_objectSpread(_objectSpread({},d),{},{files:c,multiple:!0,onDeleteFile:void 0})),expect(screen.queryByLabelText("Remove file ",{exact:!1})).not.toBeInTheDocument()})}),describe("Max File Upload limit",function(){it("should show max file number in the description next to the upload button",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function a(){return _regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e(_objectSpread(_objectSpread({},d),{},{multiple:!0,maxFiles:2})),a.next=3,waitFor(function(){expect(screen.getByText(/Maximum 2 files\./)).toBeInTheDocument()});case 3:case"end":return a.stop();}},a)}))),it("should show given error when maxFiles limit is applied and more files are uploaded",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(){var f,g,h,i,j;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return f="Maximum files message from prop",g=jest.fn(),e(_objectSpread(_objectSpread({},d),{},{multiple:!0,maxFiles:3,maxFilesErrorMessage:f,onUploadFile:g})),g.mockImplementation(function(a){var b=a.get("file");return Promise.resolve({file:b,id:Math.random()})}),h=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),userEvent.upload(h,[a,b]),i=new File(["foo2"],"foo2.png",{type:"image/png"}),j=new File(["foo2"],"foo2.jpg",{type:"image/jpeg"}),userEvent.upload(h,[i,j]),c.next=11,waitFor(function(){expect(screen.getByText(f)).toBeInTheDocument()});case 11:case"end":return c.stop();}},c)}))),it("should show default error when maxFiles limit exceeds and no error message provided",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function c(){var f,g,h,i;return _regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return f="Sorry, this upload failed because we can only accept 2 files at once.",g=jest.fn(),e(_objectSpread(_objectSpread({},d),{},{multiple:!0,maxFiles:2,onUploadFile:g})),g.mockImplementation(function(a){var b=a.get("file");return Promise.resolve({file:b,id:Math.random()})}),h=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),i=new File(["foo2"],"foo2.png",{type:"image/png"}),userEvent.upload(h,[a,b,i]),c.next=9,waitFor(function(){expect(screen.getByText(f)).toBeInTheDocument()});case 9:case"end":return c.stop();}},c)})))}),describe("Misc",function(){it("should attach the input id accepted from props to the input components",function(){var a="LabelText";render(/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("label",{htmlFor:"testInputId",children:a}),/*#__PURE__*/_jsx(UploadInput,_objectSpread(_objectSpread({},d),{},{id:"testInputId"}))]})),expect(screen.getByLabelText(a)).toHaveAttribute("id","testInputId")}),it("should show the file size error when provided in props",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function a(){var b,c,f,g,h;return _regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=1024,c=2*b,f="file oversized",e(_objectSpread(_objectSpread({},d),{},{sizeLimit:1,sizeLimitErrorMessage:f})),g=screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput),h=new File([""],"testFile.png",{type:"image/png"}),Object.defineProperty(h,"size",{value:c}),userEvent.upload(g,[h]),a.next=10,waitFor(function(){expect(screen.getByText(f)).toBeInTheDocument()});case 10:case"end":return a.stop();}},a)})))})});
@@ -1 +1 @@
1
- import{action}from"@storybook/addon-actions";import{Status}from"../common";import UploadInput from"./UploadInput";import{jsx as _jsx}from"react/jsx-runtime";const meta={title:"Forms/UploadInput",component:UploadInput,tags:["autodocs"]};export default meta;const files=[{id:1,filename:"purchase-receipt.pdf",url:"https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg"},{id:2,filename:"receipt failed.png",status:Status.FAILED},{id:3,filename:"receipt failed with error string.png",status:Status.SUCCEEDED},{id:4,filename:"receipt failed with error object.png",status:Status.SUCCEEDED}],createDelayedPromise=function(){let{successful:a=!0,delaySeconds:b=3,response:c={id:Math.round(1e4*Math.random()),url:"#"}}=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return new Promise((d,e)=>{setTimeout(()=>a?d(c):e(new Error("Unexpected error")),1e3*b)})},props={onUploadFile:()=>createDelayedPromise(),onDeleteFile:()=>createDelayedPromise()},Template=a=>/*#__PURE__*/_jsx(UploadInput,{...a});export const SingleFile=Template.bind({});SingleFile.args={...props};export const MultipleFiles=Template.bind({});MultipleFiles.args={...props,multiple:!0};export const UploadInputWithDescriptionFromProps=Template.bind({});UploadInputWithDescriptionFromProps.args={...props,multiple:!0,description:"Custom file description from prop"};export const Disabled=Template.bind({});Disabled.args={...props,disabled:!0};export const WithAnyFileType=Template.bind({});WithAnyFileType.args={...props,fileTypes:"*"};export const WithSingleFileType=Template.bind({});WithSingleFileType.args={...props,fileTypes:".zip,application/zip"};export const WithMultipleExistingFiles=Template.bind({});WithMultipleExistingFiles.args={...props,files,multiple:!0};export const WithoutDelete=Template.bind({});WithoutDelete.args={...props,files,onDeleteFile:void 0,multiple:!0};export const WithUploadFailed=Template.bind({});WithUploadFailed.args={...props,files:files.slice(0),onUploadFile:()=>createDelayedPromise({successful:!1}),multiple:!0};export const WithDeleteFailed=Template.bind({});WithDeleteFailed.args={...props,files:files.slice(0),onDeleteFile:()=>createDelayedPromise({successful:!1}),multiple:!0};export const CustomConfirmMessage=Template.bind({});CustomConfirmMessage.args={...props,files:files.slice(0),deleteConfirm:{title:"Sure you want to remove this invoice?",body:/*#__PURE__*/_jsx("img",{alt:"brand logo",src:"https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"})}};export const withManualDownloadHandler=Template.bind({});withManualDownloadHandler.args={...props,files,onDownload:action("Manual download handler")};export const withFilesChangeHandler=Template.bind({});withFilesChangeHandler.args={...props,files,onFilesChange:action("Files change handler")};export const withMaxFilesToUploadLimit=Template.bind({});withMaxFilesToUploadLimit.args={...props,multiple:!0,maxFiles:5,maxFilesErrorMessage:"Can't upload as maximum number of files allowed are already uploaded"};export const withFileSizeErrorMessage=Template.bind({});withFileSizeErrorMessage.args={...props,sizeLimit:1,sizeLimitErrorMessage:"The file is oversized"};export const withCustomUploadButtonTitle=Template.bind({});withCustomUploadButtonTitle.args={...props,uploadButtonTitle:"Upload the VAT receipts for FY 2022-23"};
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.object.to-string.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.array.slice.js";import{action}from"@storybook/addon-actions";import{Status}from"../common";import UploadInput from"./UploadInput";import{jsx as _jsx}from"react/jsx-runtime";var meta={title:"Forms/UploadInput",component:UploadInput,tags:["autodocs"]};export default meta;var files=[{id:1,filename:"purchase-receipt.pdf",url:"https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg"},{id:2,filename:"receipt failed.png",status:Status.FAILED},{id:3,filename:"receipt failed with error string.png",status:Status.SUCCEEDED},{id:4,filename:"receipt failed with error object.png",status:Status.SUCCEEDED}],createDelayedPromise=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.successful,c=a.delaySeconds,d=void 0===c?3:c,e=a.response,f=void 0===e?{id:Math.round(1e4*Math.random()),url:"#"}:e;return new Promise(function(a,c){setTimeout(function(){return!(void 0!==b)||b?a(f):c(new Error("Unexpected error"))},1e3*d)})},props={onUploadFile:function onUploadFile(){return createDelayedPromise()},onDeleteFile:function onDeleteFile(){return createDelayedPromise()}},Template=function(a){return/*#__PURE__*/_jsx(UploadInput,_objectSpread({},a))};export var SingleFile=Template.bind({});SingleFile.args=_objectSpread({},props);export var MultipleFiles=Template.bind({});MultipleFiles.args=_objectSpread(_objectSpread({},props),{},{multiple:!0});export var UploadInputWithDescriptionFromProps=Template.bind({});UploadInputWithDescriptionFromProps.args=_objectSpread(_objectSpread({},props),{},{multiple:!0,description:"Custom file description from prop"});export var Disabled=Template.bind({});Disabled.args=_objectSpread(_objectSpread({},props),{},{disabled:!0});export var WithAnyFileType=Template.bind({});WithAnyFileType.args=_objectSpread(_objectSpread({},props),{},{fileTypes:"*"});export var WithSingleFileType=Template.bind({});WithSingleFileType.args=_objectSpread(_objectSpread({},props),{},{fileTypes:".zip,application/zip"});export var WithMultipleExistingFiles=Template.bind({});WithMultipleExistingFiles.args=_objectSpread(_objectSpread({},props),{},{files:files,multiple:!0});export var WithoutDelete=Template.bind({});WithoutDelete.args=_objectSpread(_objectSpread({},props),{},{files:files,onDeleteFile:void 0,multiple:!0});export var WithUploadFailed=Template.bind({});WithUploadFailed.args=_objectSpread(_objectSpread({},props),{},{files:files.slice(0),onUploadFile:function onUploadFile(){return createDelayedPromise({successful:!1})},multiple:!0});export var WithDeleteFailed=Template.bind({});WithDeleteFailed.args=_objectSpread(_objectSpread({},props),{},{files:files.slice(0),onDeleteFile:function onDeleteFile(){return createDelayedPromise({successful:!1})},multiple:!0});export var CustomConfirmMessage=Template.bind({});CustomConfirmMessage.args=_objectSpread(_objectSpread({},props),{},{files:files.slice(0),deleteConfirm:{title:"Sure you want to remove this invoice?",body:/*#__PURE__*/_jsx("img",{alt:"brand logo",src:"https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"})}});export var withManualDownloadHandler=Template.bind({});withManualDownloadHandler.args=_objectSpread(_objectSpread({},props),{},{files:files,onDownload:action("Manual download handler")});export var withFilesChangeHandler=Template.bind({});withFilesChangeHandler.args=_objectSpread(_objectSpread({},props),{},{files:files,onFilesChange:action("Files change handler")});export var withMaxFilesToUploadLimit=Template.bind({});withMaxFilesToUploadLimit.args=_objectSpread(_objectSpread({},props),{},{multiple:!0,maxFiles:5,maxFilesErrorMessage:"Can't upload as maximum number of files allowed are already uploaded"});export var withFileSizeErrorMessage=Template.bind({});withFileSizeErrorMessage.args=_objectSpread(_objectSpread({},props),{},{sizeLimit:1,sizeLimitErrorMessage:"The file is oversized"});export var withCustomUploadButtonTitle=Template.bind({});withCustomUploadButtonTitle.args=_objectSpread(_objectSpread({},props),{},{uploadButtonTitle:"Upload the VAT receipts for FY 2022-23"});
@@ -1 +1 @@
1
- import{PlusCircle as PlusIcon,Upload as UploadIcon}from"@transferwise/icons";import{useTheme}from"@wise/components-theming";import classNames from"classnames";import{useRef,useState}from"react";import{useIntl}from"react-intl";import Body from"../../body";import{Typography}from"../../common";import{useDirection}from"../../common/hooks";import MESSAGES from"./UploadButton.messages";import{DEFAULT_SIZE_LIMIT,imageFileTypes}from"./defaults";import getAllowedFileTypes from"./getAllowedFileTypes";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export let TEST_IDS=/*#__PURE__*/function(a){return a.uploadInput="uploadInput",a.mediaBody="mediaBody",a}({});const onDragOver=a=>{a.preventDefault()},DEFAULT_FILE_INPUT_ID="np-upload-button",UploadButton=a=>{function b(){if(e)return e;const a=u(),b="*"===a?o(MESSAGES.allFileTypes):a;return o(MESSAGES.instructions,{fileTypes:b,size:Math.round(k/1e3)})}let{disabled:c,multiple:d,description:e,fileTypes:j=imageFileTypes,sizeLimit:k=DEFAULT_SIZE_LIMIT,maxFiles:f,onChange:g,id:l=DEFAULT_FILE_INPUT_ID,uploadButtonTitle:h,multipleFileInputWithFilesAdded:i}=a;const{isModern:m}=useTheme(),{isRTL:n}=useDirection(),{formatMessage:o}=useIntl(),p=useRef(null),[q,r]=useState(!1),s=useRef(0),t=()=>{s.current=0,r(!1)},u=()=>"*"===j?j:Array.isArray(j)?getAllowedFileTypes(j).join(", "):getAllowedFileTypes([j]).join(", ");return/*#__PURE__*/_jsxs("div",{className:classNames("np-upload-button-container","droppable",{"droppable-dropping":q}),...(!c&&{onDragEnter:a=>{a.preventDefault(),s.current+=1,1===s.current&&r(!0)},onDragLeave:a=>{a.preventDefault(),s.current-=1,0===s.current&&r(!1)},onDrop:a=>{a.preventDefault(),t(),a.dataTransfer&&a.dataTransfer.files&&a.dataTransfer.files[0]&&g(a.dataTransfer.files)},onDragOver}),children:[/*#__PURE__*/_jsx("input",{ref:p,id:l,type:"file",...function(){const a="*"===u();return a?null:Array.isArray(j)?{accept:j.join(",")}:{accept:j}}(),...(d&&{multiple:!0}),className:"tw-droppable-input",disabled:c,name:"file-upload","data-testid":TEST_IDS.uploadInput,onChange:a=>{const{files:b}=a.target;b&&(g(b),p.current&&(p.current.value=""))}}),/*#__PURE__*/_jsx("label",{htmlFor:l,className:classNames("btn","np-upload-accent","np-upload-button",{disabled:c,"np-upload-input--square-top":i}),children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:/*#__PURE__*/_jsx(UploadIcon,{size:24,className:"text-link"})}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx(Body,{type:Typography.BODY_LARGE_BOLD,className:"d-block",children:function(){return h?h:o(d?MESSAGES.uploadFiles:MESSAGES.uploadFile)}()}),function(){return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsxs(Body,{className:classNames({"text-primary":!c,small:!m,"font-weight-normal":!m}),children:[b(),f&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("br",{}),`Maximum ${f} files.`]})]})})}()]})]})}),q&&/*#__PURE__*/_jsxs("div",{className:classNames("droppable-card","droppable-dropping-card","droppable-card-content",{"np-upload-input--square-top":i}),children:[/*#__PURE__*/_jsx(PlusIcon,{className:"m-x-1",size:24}),/*#__PURE__*/_jsx("div",{children:o(MESSAGES.dropFile)})]})]})};export default UploadButton;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";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.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.to-string.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";import{PlusCircle as PlusIcon,Upload as UploadIcon}from"@transferwise/icons";import{useTheme}from"@wise/components-theming";import classNames from"classnames";import{useRef,useState}from"react";import{useIntl}from"react-intl";import Body from"../../body";import{Typography}from"../../common";import{useDirection}from"../../common/hooks";import MESSAGES from"./UploadButton.messages";import{DEFAULT_SIZE_LIMIT,imageFileTypes}from"./defaults";import getAllowedFileTypes from"./getAllowedFileTypes";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var TEST_IDS=/*#__PURE__*/function(a){return a.uploadInput="uploadInput",a.mediaBody="mediaBody",a}({});var onDragOver=function(a){a.preventDefault()},DEFAULT_FILE_INPUT_ID="np-upload-button",UploadButton=function(a){function b(){if(e)return e;var a=C(),b="*"===a?u(MESSAGES.allFileTypes):a;return u(MESSAGES.instructions,{fileTypes:b,size:Math.round(i/1e3)})}var c=a.disabled,d=a.multiple,e=a.description,f=a.fileTypes,g=void 0===f?imageFileTypes:f,h=a.sizeLimit,i=void 0===h?DEFAULT_SIZE_LIMIT:h,j=a.maxFiles,k=a.onChange,l=a.id,m=void 0===l?DEFAULT_FILE_INPUT_ID:l,n=a.uploadButtonTitle,o=a.multipleFileInputWithFilesAdded,p=useTheme(),q=p.isModern,r=useDirection(),s=r.isRTL,t=useIntl(),u=t.formatMessage,v=useRef(null),w=useState(!1),x=_slicedToArray(w,2),y=x[0],z=x[1],A=useRef(0),B=function(){A.current=0,z(!1)},C=function(){return"*"===g?g:Array.isArray(g)?getAllowedFileTypes(g).join(", "):getAllowedFileTypes([g]).join(", ")};return/*#__PURE__*/_jsxs("div",_objectSpread(_objectSpread({className:classNames("np-upload-button-container","droppable",{"droppable-dropping":y})},!c&&{onDragEnter:function onDragEnter(a){a.preventDefault(),A.current+=1,1===A.current&&z(!0)},onDragLeave:function onDragLeave(a){a.preventDefault(),A.current-=1,0===A.current&&z(!1)},onDrop:function onDrop(a){a.preventDefault(),B(),a.dataTransfer&&a.dataTransfer.files&&a.dataTransfer.files[0]&&k(a.dataTransfer.files)},onDragOver:onDragOver}),{},{children:[/*#__PURE__*/_jsx("input",_objectSpread(_objectSpread(_objectSpread({ref:v,id:m,type:"file"},function(){var a="*"===C();return a?null:Array.isArray(g)?{accept:g.join(",")}:{accept:g}}()),d&&{multiple:!0}),{},{className:"tw-droppable-input",disabled:c,name:"file-upload","data-testid":TEST_IDS.uploadInput,onChange:function filesSelected(a){var b=a.target.files;b&&(k(b),v.current&&(v.current.value=""))}})),/*#__PURE__*/_jsx("label",{htmlFor:m,className:classNames("btn","np-upload-accent","np-upload-button",{disabled:c,"np-upload-input--square-top":o}),children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:/*#__PURE__*/_jsx(UploadIcon,{size:24,className:"text-link"})}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx(Body,{type:Typography.BODY_LARGE_BOLD,className:"d-block",children:function(){return n?n:u(d?MESSAGES.uploadFiles:MESSAGES.uploadFile)}()}),function(){return/*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsxs(Body,{className:classNames({"text-primary":!c,small:!q,"font-weight-normal":!q}),children:[b(),j&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx("br",{}),"Maximum ".concat(j," files.")]})]})})}()]})]})}),y&&/*#__PURE__*/_jsxs("div",{className:classNames("droppable-card","droppable-dropping-card","droppable-card-content",{"np-upload-input--square-top":o}),children:[/*#__PURE__*/_jsx(PlusIcon,{className:"m-x-1",size:24}),/*#__PURE__*/_jsx("div",{children:u(MESSAGES.dropFile)})]})]}))};export default UploadButton;
@@ -1,3 +1,3 @@
1
- import{render,screen,userEvent}from"../../test-utils";import UploadButton,{TEST_IDS}from"./UploadButton";import{imageFileTypes}from"./defaults";import{jsx as _jsx}from"react/jsx-runtime";describe("UploadButton",()=>{const a=new File(["foo"],"foo.png",{type:"image/png"}),b=new File(["foo"],"foo.jpg",{type:"image/jpg"}),c={onChange:jest.fn(),multipleFileInputWithFilesAdded:!0},d=function(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:c;return render(/*#__PURE__*/_jsx(UploadButton,{...a}))};describe("single file upload",()=>{beforeEach(()=>{d()}),it("should render the file input form",()=>{expect(screen.getByText("Upload file")).toBeInTheDocument()}),it("should render the file input button with title, if provided",()=>{d({...c,uploadButtonTitle:"Upload your id"}),expect(screen.getByText("Upload your id")).toBeInTheDocument()}),it("should set accept to imageTypes",()=>{expect(screen.getByTestId(TEST_IDS.uploadInput)).toHaveAttribute("accept",imageFileTypes.join(","))}),it("trigger onChange callback with a FileList",()=>{const d=screen.getByTestId(TEST_IDS.uploadInput);// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2
- userEvent.upload(d,[a,b]),expect(c.onChange).toHaveBeenCalledTimes(1),expect(c.onChange.mock.calls[0][0]).toHaveLength(1)})}),describe("multiple file upload",()=>{beforeEach(()=>{c.onChange.mockClear(),d({...c,multiple:!0})}),it("should disable the file input",()=>{expect(screen.getByTestId(TEST_IDS.uploadInput)).toHaveAttribute("multiple")}),it("trigger onChange callback with a FileList",()=>{const d=screen.getByTestId(TEST_IDS.uploadInput);// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3
- userEvent.upload(d,[a,b]),expect(c.onChange).toHaveBeenCalledTimes(1),expect(c.onChange.mock.calls[0][0]).toHaveLength(2)})}),describe("disabled state",()=>{beforeEach(()=>{d({...c,disabled:!0})}),it("should disable the file input",()=>{expect(screen.getByTestId(TEST_IDS.uploadInput)).toBeDisabled()})}),describe("accept all file types",()=>{beforeEach(()=>{d({...c,fileTypes:["*"]})}),it("should not add accept attribute to file input",()=>{expect(screen.getByTestId(TEST_IDS.uploadInput)).not.toHaveAttribute("accept")})}),describe("description for the button",()=>{it("should show default description based on the default file types provided",()=>{d({...c}),expect(screen.getByText("PDF, JPG, JPEG, PNG, less than 5MB")).toBeInTheDocument()}),it("should show default all files allowed description if all files are accepted",()=>{d({...c,fileTypes:["*"]}),expect(screen.getByText("All file types, less than 5MB")).toBeInTheDocument()}),it("should show custom description if provided",()=>{d({...c,fileTypes:["*"],description:"Test description"}),expect(screen.getByText("Test description")).toBeInTheDocument()}),it("should show maxFiles next to the description, if provided",()=>{d({...c,fileTypes:["*"],maxFiles:5}),expect(screen.getByText(/Maximum 5 files\./)).toBeInTheDocument()})})});
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.to-string.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";import"core-js/modules/es.array.join.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{render,screen,userEvent}from"../../test-utils";import UploadButton,{TEST_IDS}from"./UploadButton";import{imageFileTypes}from"./defaults";import{jsx as _jsx}from"react/jsx-runtime";describe("UploadButton",function(){var a=new File(["foo"],"foo.png",{type:"image/png"}),b=new File(["foo"],"foo.jpg",{type:"image/jpg"}),c={onChange:jest.fn(),multipleFileInputWithFilesAdded:!0},d=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:c;return render(/*#__PURE__*/_jsx(UploadButton,_objectSpread({},a)))};describe("single file upload",function(){beforeEach(function(){d()}),it("should render the file input form",function(){expect(screen.getByText("Upload file")).toBeInTheDocument()}),it("should render the file input button with title, if provided",function(){d(_objectSpread(_objectSpread({},c),{},{uploadButtonTitle:"Upload your id"})),expect(screen.getByText("Upload your id")).toBeInTheDocument()}),it("should set accept to imageTypes",function(){expect(screen.getByTestId(TEST_IDS.uploadInput)).toHaveAttribute("accept",imageFileTypes.join(","))}),it("trigger onChange callback with a FileList",function(){var d=screen.getByTestId(TEST_IDS.uploadInput);// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2
+ userEvent.upload(d,[a,b]),expect(c.onChange).toHaveBeenCalledTimes(1),expect(c.onChange.mock.calls[0][0]).toHaveLength(1)})}),describe("multiple file upload",function(){beforeEach(function(){c.onChange.mockClear(),d(_objectSpread(_objectSpread({},c),{},{multiple:!0}))}),it("should disable the file input",function(){expect(screen.getByTestId(TEST_IDS.uploadInput)).toHaveAttribute("multiple")}),it("trigger onChange callback with a FileList",function(){var d=screen.getByTestId(TEST_IDS.uploadInput);// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3
+ userEvent.upload(d,[a,b]),expect(c.onChange).toHaveBeenCalledTimes(1),expect(c.onChange.mock.calls[0][0]).toHaveLength(2)})}),describe("disabled state",function(){beforeEach(function(){d(_objectSpread(_objectSpread({},c),{},{disabled:!0}))}),it("should disable the file input",function(){expect(screen.getByTestId(TEST_IDS.uploadInput)).toBeDisabled()})}),describe("accept all file types",function(){beforeEach(function(){d(_objectSpread(_objectSpread({},c),{},{fileTypes:["*"]}))}),it("should not add accept attribute to file input",function(){expect(screen.getByTestId(TEST_IDS.uploadInput)).not.toHaveAttribute("accept")})}),describe("description for the button",function(){it("should show default description based on the default file types provided",function(){d(_objectSpread({},c)),expect(screen.getByText("PDF, JPG, JPEG, PNG, less than 5MB")).toBeInTheDocument()}),it("should show default all files allowed description if all files are accepted",function(){d(_objectSpread(_objectSpread({},c),{},{fileTypes:["*"]})),expect(screen.getByText("All file types, less than 5MB")).toBeInTheDocument()}),it("should show custom description if provided",function(){d(_objectSpread(_objectSpread({},c),{},{fileTypes:["*"],description:"Test description"})),expect(screen.getByText("Test description")).toBeInTheDocument()}),it("should show maxFiles next to the description, if provided",function(){d(_objectSpread(_objectSpread({},c),{},{fileTypes:["*"],maxFiles:5})),expect(screen.getByText(/Maximum 5 files\./)).toBeInTheDocument()})})});
@@ -1 +1 @@
1
- import{FileType}from"../../common";export const DEFAULT_SIZE_LIMIT=5e3;export const imageFileTypes=[FileType.PDF,FileType.JPG,FileType.PNG];
1
+ import{FileType}from"../../common";export var DEFAULT_SIZE_LIMIT=5e3;export var imageFileTypes=[FileType.PDF,FileType.JPG,FileType.PNG];
@@ -1,3 +1,3 @@
1
- const getAllowedFileTypes=a=>a.map(a=>a.split(",").filter(a=>!a.includes("/"))// Filter out mime types
2
- .map(a=>a.replace(".","").toUpperCase())// Remove dot and convert extensions to uppercase to be displayed in the instructions
3
- .join(", "));export default getAllowedFileTypes;
1
+ import"core-js/modules/es.array.map.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";var getAllowedFileTypes=function(a){return a.map(function(a){return a.split(",").filter(function(a){return!a.includes("/")})// Filter out mime types
2
+ .map(function(a){return a.replace(".","").toUpperCase()})// Remove dot and convert extensions to uppercase to be displayed in the instructions
3
+ .join(", ")})};export default getAllowedFileTypes;
@@ -1 +1 @@
1
- import{FileType}from"../../common";import getAllowedFileTypes from"./getAllowedFileTypes";describe("getAllowedFileTypes",()=>{let a;describe("using predefined FileTypes",()=>{beforeAll(()=>{a=getAllowedFileTypes([FileType.PNG,FileType.JPG])}),it("parses allowed file extensions from FileType[] array",()=>{expect(a).toStrictEqual(["PNG","JPG, JPEG"])})}),describe("using custom file extensions and mime types",()=>{beforeAll(()=>{a=getAllowedFileTypes([".xls,.xlm,application/vnd.ms-excel",".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc,application/msword"])}),it("parses allowed file extensions from FileType[] array",()=>{expect(a).toStrictEqual(["XLS, XLM","DOCX","DOC"])})}),describe("when all file types are allowed",()=>{beforeAll(()=>{a=getAllowedFileTypes(["*"])}),it("should return the wildcard character",()=>{expect(a).toStrictEqual(["*"])})})});
1
+ import{FileType}from"../../common";import getAllowedFileTypes from"./getAllowedFileTypes";describe("getAllowedFileTypes",function(){var a;describe("using predefined FileTypes",function(){beforeAll(function(){a=getAllowedFileTypes([FileType.PNG,FileType.JPG])}),it("parses allowed file extensions from FileType[] array",function(){expect(a).toStrictEqual(["PNG","JPG, JPEG"])})}),describe("using custom file extensions and mime types",function(){beforeAll(function(){a=getAllowedFileTypes([".xls,.xlm,application/vnd.ms-excel",".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc,application/msword"])}),it("parses allowed file extensions from FileType[] array",function(){expect(a).toStrictEqual(["XLS, XLM","DOCX","DOC"])})}),describe("when all file types are allowed",function(){beforeAll(function(){a=getAllowedFileTypes(["*"])}),it("should return the wildcard character",function(){expect(a).toStrictEqual(["*"])})})});
@@ -1,2 +1,2 @@
1
- import{AlertCircle,CrossCircleFill}from"@transferwise/icons";import{useTheme}from"@wise/components-theming";import classNames from"classnames";import{useIntl}from"react-intl";import Body from"../../body";import{Size,Status,Typography,Sentiment}from"../../common";import ProcessIndicator from"../../processIndicator/ProcessIndicator";import StatusIcon from"../../statusIcon/StatusIcon";import MESSAGES from"./UploadItem.messages";import{UploadItemBody}from"./UploadItemBody";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export let TEST_IDS=/*#__PURE__*/function(a){return a.uploadItem="uploadItem",a.mediaBody="mediaBody",a}({});const UploadItem=a=>{let{file:b,canDelete:c,onDelete:d,onDownload:e,singleFileUpload:f}=a;const{formatMessage:g}=useIntl(),{status:h,filename:i,error:j,url:k}=b,{isModern:l}=useTheme(),m=[Status.SUCCEEDED,void 0].includes(h)&&!!k,n=()=>"object"==typeof j&&j.message||j||g(MESSAGES.uploadingFailed);return/*#__PURE__*/_jsx("div",{className:classNames("np-upload-item",{"np-upload-item__link":m}),"data-testid":TEST_IDS.uploadItem,children:/*#__PURE__*/_jsxs("div",{className:"np-upload-item__body",children:[/*#__PURE__*/_jsx(UploadItemBody,{url:m?k:void 0,singleFileUpload:f,onDownload:a=>{e&&(a.preventDefault(),e(b))},children:/*#__PURE__*/_jsx("div",{className:"np-upload-button",children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:(()=>{if(j||h===Status.FAILED)return l?/*#__PURE__*/_jsx(StatusIcon,{size:Size.SMALL,sentiment:Sentiment.NEGATIVE}):/*#__PURE__*/_jsx(AlertCircle,{size:24,className:"text-negative"});let a;switch(h){case Status.PROCESSING:case Status.PENDING:a=/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.PROCESSING});break;case Status.SUCCEEDED:case Status.DONE:default:a=l?/*#__PURE__*/_jsx(StatusIcon,{size:Size.SMALL,sentiment:Sentiment.POSITIVE}):/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.SUCCEEDED});}return l?a:/*#__PURE__*/_jsx("span",{style:{transform:"scale(0.8335)"},children:a});// Scale down ProcessIndicator to be 20px*20px to match `icons`
2
- })()}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx(Body,{className:"text-word-break d-block text-primary",children:(()=>i||g(MESSAGES.uploadedFile))()}),(()=>{if(j||h===Status.FAILED)return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,className:"text-negative",children:n()});switch(h){case Status.PENDING:return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,children:g(MESSAGES.uploading)});case Status.PROCESSING:return/*#__PURE__*/_jsx(Body,{children:g(MESSAGES.deleting)});case Status.SUCCEEDED:case Status.DONE:default:return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,className:"text-positive",children:g(MESSAGES.uploaded)});}})()]})]})})}),c&&/*#__PURE__*/_jsx("button",{"aria-label":g(MESSAGES.removeFile,{filename:i}),className:classNames("btn","np-upload-item__remove-button","media-left",{"np-upload-item--single-file":f}),type:"button",onClick:()=>d(),children:/*#__PURE__*/_jsx(CrossCircleFill,{size:16})})]})})};export default UploadItem;
1
+ import _typeof from"@babel/runtime/helpers/typeof";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import{AlertCircle,CrossCircleFill}from"@transferwise/icons";import{useTheme}from"@wise/components-theming";import classNames from"classnames";import{useIntl}from"react-intl";import Body from"../../body";import{Size,Status,Typography,Sentiment}from"../../common";import ProcessIndicator from"../../processIndicator/ProcessIndicator";import StatusIcon from"../../statusIcon/StatusIcon";import MESSAGES from"./UploadItem.messages";import{UploadItemBody}from"./UploadItemBody";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var TEST_IDS=/*#__PURE__*/function(a){return a.uploadItem="uploadItem",a.mediaBody="mediaBody",a}({});var UploadItem=function(a){var b=a.file,c=a.canDelete,d=a.onDelete,e=a.onDownload,f=a.singleFileUpload,g=useIntl(),h=g.formatMessage,i=b.status,j=b.filename,k=b.error,l=b.url,m=useTheme(),n=m.isModern,o=[Status.SUCCEEDED,void 0].includes(i)&&!!l,p=function(){return"object"===_typeof(k)&&k.message||k||h(MESSAGES.uploadingFailed)};return/*#__PURE__*/_jsx("div",{className:classNames("np-upload-item",{"np-upload-item__link":o}),"data-testid":TEST_IDS.uploadItem,children:/*#__PURE__*/_jsxs("div",{className:"np-upload-item__body",children:[/*#__PURE__*/_jsx(UploadItemBody,{url:o?l:void 0,singleFileUpload:f,onDownload:function onDownloadFile(a){e&&(a.preventDefault(),e(b))},children:/*#__PURE__*/_jsx("div",{className:"np-upload-button",children:/*#__PURE__*/_jsxs("div",{className:"media",children:[/*#__PURE__*/_jsx("div",{className:"np-upload-icon media-left",children:function getIcon(){if(k||i===Status.FAILED)return n?/*#__PURE__*/_jsx(StatusIcon,{size:Size.SMALL,sentiment:Sentiment.NEGATIVE}):/*#__PURE__*/_jsx(AlertCircle,{size:24,className:"text-negative"});var a;switch(i){case Status.PROCESSING:case Status.PENDING:a=/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.PROCESSING});break;case Status.SUCCEEDED:case Status.DONE:default:a=n?/*#__PURE__*/_jsx(StatusIcon,{size:Size.SMALL,sentiment:Sentiment.POSITIVE}):/*#__PURE__*/_jsx(ProcessIndicator,{size:Size.EXTRA_SMALL,status:Status.SUCCEEDED});}return n?a:/*#__PURE__*/_jsx("span",{style:{transform:"scale(0.8335)"},children:a});// Scale down ProcessIndicator to be 20px*20px to match `icons`
2
+ }()}),/*#__PURE__*/_jsxs("div",{className:"media-body text-xs-left","data-testid":TEST_IDS.mediaBody,children:[/*#__PURE__*/_jsx(Body,{className:"text-word-break d-block text-primary",children:function getTitle(){return j||h(MESSAGES.uploadedFile)}()}),function getDescription(){if(k||i===Status.FAILED)return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,className:"text-negative",children:p()});switch(i){case Status.PENDING:return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,children:h(MESSAGES.uploading)});case Status.PROCESSING:return/*#__PURE__*/_jsx(Body,{children:h(MESSAGES.deleting)});case Status.SUCCEEDED:case Status.DONE:default:return/*#__PURE__*/_jsx(Body,{type:Typography.BODY_DEFAULT_BOLD,className:"text-positive",children:h(MESSAGES.uploaded)});}}()]})]})})}),c&&/*#__PURE__*/_jsx("button",{"aria-label":h(MESSAGES.removeFile,{filename:j}),className:classNames("btn","np-upload-item__remove-button","media-left",{"np-upload-item--single-file":f}),type:"button",onClick:function onClick(){return d()},children:/*#__PURE__*/_jsx(CrossCircleFill,{size:16})})]})})};export default UploadItem;
@@ -1 +1 @@
1
- import userEvent from"@testing-library/user-event";import{Status}from"../../common";import{render,screen}from"../../test-utils";import UploadItem from"./UploadItem";import{jsx as _jsx}from"react/jsx-runtime";describe("UploadItem",()=>{const a={file:{id:1,filename:"purchase-receipt.pdf",status:Status.SUCCEEDED,url:"https://wise.com"},canDelete:!0,onDelete:jest.fn(),singleFileUpload:!0},b=function(){let b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:a;return render(/*#__PURE__*/_jsx(UploadItem,{...b}))};describe("filename",()=>{it("should display the filename",()=>{b(),expect(screen.getByText(a.file.filename)).toBeInTheDocument()}),it("should display the default filename when it is missing",()=>{b({...a,file:{...a.file,filename:void 0}}),expect(screen.getByText("Uploaded file")).toBeInTheDocument()})}),describe("description",()=>{it("should display the default uploading copy while file upload is in progress",()=>{b({...a,file:{...a.file,status:Status.PENDING}}),expect(screen.getByText("Uploading...")).toBeInTheDocument()}),it("should display the default deleting copy while file deletion is in progress",()=>{b({...a,file:{...a.file,status:Status.PROCESSING}}),expect(screen.getByText("Deleting...")).toBeInTheDocument()}),it("should display the default success copy when file upload is complete",()=>{b({...a,file:{...a.file,status:Status.SUCCEEDED}}),expect(screen.getByText("Uploaded")).toBeInTheDocument()})}),describe("failed uploads",()=>{it("should display the error.message from an API response",()=>{b({...a,file:{...a.file,status:Status.FAILED,error:{message:"An API error object with message field"}}}),expect(screen.getByText("An API error object with message field")).toBeInTheDocument()}),it("should display the error if it is supplied as a string",()=>{b({...a,file:{...a.file,status:Status.FAILED,error:"An API error string"}}),expect(screen.getByText("An API error string")).toBeInTheDocument()}),it("should display default error message when error is missing but status is FAILED",()=>{b({...a,file:{...a.file,status:Status.FAILED}}),expect(screen.getByText("Uploading failed")).toBeInTheDocument()}),it("should display the error even if status is missing",()=>{b({...a,file:{...a.file,error:"An API error string without status"}}),expect(screen.getByText("An API error string without status")).toBeInTheDocument()})}),describe("file deletion",()=>{it("should render the remove file button when deleteFile prop is supplied",()=>{b(),expect(screen.getByLabelText("Remove file ",{exact:!1})).toBeInTheDocument()}),it("should not render the remove file button when canDelete prop is false",()=>{b({...a,canDelete:!1}),expect(screen.queryByLabelText("Remove file ",{exact:!1})).not.toBeInTheDocument()})}),describe("manual file download handler",()=>{it("calls onDownload handler provided through props",()=>{const c=jest.fn();b({...a,onDownload:c}),userEvent.click(screen.getAllByRole("link")[0]),expect(c).toHaveBeenCalledTimes(1),expect(c).toHaveBeenCalledWith(a.file)})})});
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.to-string.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 userEvent from"@testing-library/user-event";import{Status}from"../../common";import{render,screen}from"../../test-utils";import UploadItem from"./UploadItem";import{jsx as _jsx}from"react/jsx-runtime";describe("UploadItem",function(){var a={file:{id:1,filename:"purchase-receipt.pdf",status:Status.SUCCEEDED,url:"https://wise.com"},canDelete:!0,onDelete:jest.fn(),singleFileUpload:!0},b=function(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:a;return render(/*#__PURE__*/_jsx(UploadItem,_objectSpread({},b)))};describe("filename",function(){it("should display the filename",function(){b(),expect(screen.getByText(a.file.filename)).toBeInTheDocument()}),it("should display the default filename when it is missing",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{filename:void 0})})),expect(screen.getByText("Uploaded file")).toBeInTheDocument()})}),describe("description",function(){it("should display the default uploading copy while file upload is in progress",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.PENDING})})),expect(screen.getByText("Uploading...")).toBeInTheDocument()}),it("should display the default deleting copy while file deletion is in progress",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.PROCESSING})})),expect(screen.getByText("Deleting...")).toBeInTheDocument()}),it("should display the default success copy when file upload is complete",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.SUCCEEDED})})),expect(screen.getByText("Uploaded")).toBeInTheDocument()})}),describe("failed uploads",function(){it("should display the error.message from an API response",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.FAILED,error:{message:"An API error object with message field"}})})),expect(screen.getByText("An API error object with message field")).toBeInTheDocument()}),it("should display the error if it is supplied as a string",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.FAILED,error:"An API error string"})})),expect(screen.getByText("An API error string")).toBeInTheDocument()}),it("should display default error message when error is missing but status is FAILED",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{status:Status.FAILED})})),expect(screen.getByText("Uploading failed")).toBeInTheDocument()}),it("should display the error even if status is missing",function(){b(_objectSpread(_objectSpread({},a),{},{file:_objectSpread(_objectSpread({},a.file),{},{error:"An API error string without status"})})),expect(screen.getByText("An API error string without status")).toBeInTheDocument()})}),describe("file deletion",function(){it("should render the remove file button when deleteFile prop is supplied",function(){b(),expect(screen.getByLabelText("Remove file ",{exact:!1})).toBeInTheDocument()}),it("should not render the remove file button when canDelete prop is false",function(){b(_objectSpread(_objectSpread({},a),{},{canDelete:!1})),expect(screen.queryByLabelText("Remove file ",{exact:!1})).not.toBeInTheDocument()})}),describe("manual file download handler",function(){it("calls onDownload handler provided through props",function(){var c=jest.fn();b(_objectSpread(_objectSpread({},a),{},{onDownload:c})),userEvent.click(screen.getAllByRole("link")[0]),expect(c).toHaveBeenCalledTimes(1),expect(c).toHaveBeenCalledWith(a.file)})})});
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";export const UploadItemBody=a=>{let{children:b,url:c,onDownload:d,singleFileUpload:e}=a;return c?/*#__PURE__*/_jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:e?"np-upload-item--single-file":"",onClick:d,children:b}):/*#__PURE__*/_jsx("div",{children:b})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";export var UploadItemBody=function(a){var b=a.children,c=a.url,d=a.onDownload,e=a.singleFileUpload;return c?/*#__PURE__*/_jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:e?"np-upload-item--single-file":"",onClick:d,children:b}):/*#__PURE__*/_jsx("div",{children:b})};
@@ -1 +1 @@
1
- import{logActionRequired}from"../logActionRequired";const deprecatedMessage=a=>{let{component:b,propName:c,message:d,expiryDate:e}=a;const f=[`${b} has deprecated the use of ${c}.`];return d&&f.push(d),e&&f.push(`${c} will be removed on or after ${e.toLocaleString("en-GB",{year:"numeric",month:"numeric",day:"numeric"})}`),f.join(" ")},deprecated=(a,b)=>{let{component:c,message:d="",newProp:e=null,expiryDate:f=null}=b;return function(b,g){const h=e?`Please use ${e} instead.`:d;null!=b[g]&&"undefined"!=typeof b[g]&&logActionRequired(deprecatedMessage({component:c,propName:g,message:h,expiryDate:f}));for(var i=arguments.length,j=Array(2<i?i-2:0),k=2;k<i;k++)j[k-2]=arguments[k];return a(b,g,...j)}};export default deprecated;
1
+ import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.join.js";import{logActionRequired}from"../logActionRequired";var deprecatedMessage=function(a){var b=a.component,c=a.propName,d=a.message,e=a.expiryDate,f=["".concat(b," has deprecated the use of ").concat(c,".")];return d&&f.push(d),e&&f.push("".concat(c," will be removed on or after ").concat(e.toLocaleString("en-GB",{year:"numeric",month:"numeric",day:"numeric"}))),f.join(" ")},deprecated=function(a,b){var c=b.component,d=b.message,e=void 0===d?"":d,f=b.newProp,g=void 0===f?null:f,h=b.expiryDate,i=void 0===h?null:h;return function(b,d){var f=g?"Please use ".concat(g," instead."):e;null!=b[d]&&"undefined"!=typeof b[d]&&logActionRequired(deprecatedMessage({component:c,propName:d,message:f,expiryDate:i}));for(var h=arguments.length,j=Array(2<h?h-2:0),k=2;k<h;k++)j[k-2]=arguments[k];return a.apply(void 0,[b,d].concat(j))}};export default deprecated;
@@ -1 +1 @@
1
- export function logActionRequired(a){["development","test"].includes(process?.env?.NODE_ENV)&&console.warn(a)}export function logActionRequiredIf(a,b){b&&logActionRequired(a)}
1
+ import"core-js/modules/es.array.includes.js";export function logActionRequired(a){var b,c;["development","test"].includes(null===(b=process)||void 0===b||null===(c=b.env)||void 0===c?void 0:c.NODE_ENV)&&console.warn(a)}export function logActionRequiredIf(a,b){b&&logActionRequired(a)}
@@ -1,8 +1,7 @@
1
- import PropTypes from"prop-types";import{Component}from"react";import{HistoryNavigator}from"../common";import{formatWithPattern,getCountOfSymbolsInSelection,getCursorPositionAfterKeystroke,unformatWithPattern,getDistanceToPreviousSymbol,getDistanceToNextSymbol}from"../common/textFormat";class WithDisplayFormat extends Component{constructor(a){super(a);const{value:b,displayPattern:c}=a,d=unformatWithPattern(b,c);this.state={value:formatWithPattern(d,c),historyNavigator:new HistoryNavigator,prevDisplayPattern:a.displayPattern,triggerType:null,triggerEvent:null}}static getDerivedStateFromProps(a,b){const{displayPattern:c}=a,{prevDisplayPattern:d}=b;if(b.prevDisplayPattern!==c){const{value:a,historyNavigator:e}=b,f=unformatWithPattern(a,d);return e.reset(),{prevDisplayPattern:c,value:formatWithPattern(f,c),triggerType:null,triggerEvent:null,pastedLength:0}}return null}getUserAction=a=>{const{triggerEvent:b,triggerType:c,value:d}=this.state,{displayPattern:e}=this.props,f=String.fromCharCode(b.which).toLowerCase();return"Paste"===c||"Cut"===c?c:(b.ctrlKey||b.metaKey)&&"z"===f?b.shiftKey?"Redo":"Undo":b.ctrlKey&&"d"===f?"Delete":"undefined"==typeof b.key&&a.length<=unformatWithPattern(d,e).length?"Backspace":b.key;// Detect mouse event redo
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";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.filter.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.array.splice.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.function.name.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{Component}from"react";import{HistoryNavigator}from"../common";import{formatWithPattern,getCountOfSymbolsInSelection,getCursorPositionAfterKeystroke,unformatWithPattern,getDistanceToPreviousSymbol,getDistanceToNextSymbol}from"../common/textFormat";var WithDisplayFormat=/*#__PURE__*/function(a){function b(a){var d;_classCallCheck(this,b),d=c.call(this,a),_defineProperty(_assertThisInitialized(d),"getUserAction",function(a){var b=d.state,c=b.triggerEvent,e=b.triggerType,f=b.value,g=d.props.displayPattern,h=String.fromCharCode(c.which).toLowerCase();return"Paste"===e||"Cut"===e?e:(c.ctrlKey||c.metaKey)&&"z"===h?c.shiftKey?"Redo":"Undo":c.ctrlKey&&"d"===h?"Delete":"undefined"==typeof c.key&&a.length<=unformatWithPattern(f,g).length?"Backspace":c.key;// Detect mouse event redo
2
2
  // Android Fix.
3
- };resetEvent=()=>{this.setState({triggerType:null,triggerEvent:null,pastedLength:0})};detectUndoRedo=a=>{const b=String.fromCharCode(a.which).toLowerCase();return(a.ctrlKey||a.metaKey)&&"z"===b?a.shiftKey?"Redo":"Undo":null};handleOnKeyDown=a=>{a.persist();const{selectionStart:b,selectionEnd:c}=a.target,{historyNavigator:d}=this.state,{displayPattern:e}=this.props;// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
4
- let f="";"Undo"===this.detectUndoRedo(a)?(f=formatWithPattern(d.undo(),e),this.setState({value:f,triggerType:"Undo"})):"Redo"===this.detectUndoRedo(a)?(f=formatWithPattern(d.redo(),e),this.setState({value:f,triggerType:"Redo"})):this.setState({triggerEvent:a,triggerType:"KeyDown",selectionStart:b,selectionEnd:c})};handleOnPaste=a=>{const{displayPattern:b}=this.props,c=unformatWithPattern(a.clipboardData.getData("Text"),b).length;this.setState({triggerType:"Paste",pastedLength:c})};handleOnCut=()=>{this.setState({triggerType:"Cut"})};isKeyAllowed=a=>{const{displayPattern:b}=this.props,c=b.split("").filter(a=>"*"!==a);return!c.includes(a)};handleOnChange=a=>{const{historyNavigator:b,triggerEvent:c,triggerType:d}=this.state,{displayPattern:e,onChange:f}=this.props,{value:g}=a.target;let h=unformatWithPattern(g,e);const i=null===c?// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
5
- "Paste":this.getUserAction(h);if(this.isKeyAllowed(i)&&"Undo"!==d&&"Redo"!==d){("Backspace"===i||"Delete"===i)&&(h=this.handleDelete(h,i));const a=formatWithPattern(h,e);b.add(h),this.handleCursorPositioning(i);const c=unformatWithPattern(a,e);this.setState({value:a},this.resetEvent(),f(c))}};handleOnBlur=a=>{const{displayPattern:b,onBlur:c}=this.props;c&&c(unformatWithPattern(a.target.value,b))};handleOnFocus=a=>{const{displayPattern:b,onFocus:c}=this.props;c&&(this.handleOnChange(a),c(unformatWithPattern(a.target.value,b)))};handleDelete=(a,b)=>{const{displayPattern:c}=this.props,{selectionStart:d,selectionEnd:e}=this.state,f=[...a];if(d===e){let a=d-getCountOfSymbolsInSelection(0,d,c),e=0,g=getDistanceToNextSymbol(d,c);"Backspace"===b&&(a-=1,g=getDistanceToPreviousSymbol(d,c)),0<=a&&g&&(e=1),f.splice(a,e)}return f.join("")};handleCursorPositioning=a=>{const{displayPattern:b}=this.props,{triggerEvent:c,selectionStart:d,selectionEnd:e,pastedLength:f}=this.state,g=getCursorPositionAfterKeystroke(a,d,e,b,f);setTimeout(()=>{c&&c.target.setSelectionRange(g,g),this.setState({selectionStart:g,selectionEnd:g})},0)};render(){const{type:a,inputMode:b,className:c,id:d,name:e,placeholder:f,readOnly:g,required:h,minLength:i,maxLength:j,disabled:k,autoComplete:l}=this.props,{value:m}=this.state,n={type:a,inputMode:b,className:c,id:d,name:e,placeholder:f,readOnly:g,required:h,minLength:i,maxLength:j,disabled:k,autoComplete:l,value:m,onFocus:this.handleOnFocus,onBlur:this.handleOnBlur,onPaste:this.handleOnPaste,onKeyDown:this.handleOnKeyDown,onChange:this.handleOnChange,onCut:this.handleOnCut};return this.props.render(n)}}WithDisplayFormat.propTypes={/**
3
+ }),_defineProperty(_assertThisInitialized(d),"resetEvent",function(){d.setState({triggerType:null,triggerEvent:null,pastedLength:0})}),_defineProperty(_assertThisInitialized(d),"detectUndoRedo",function(a){var b=String.fromCharCode(a.which).toLowerCase();return(a.ctrlKey||a.metaKey)&&"z"===b?a.shiftKey?"Redo":"Undo":null}),_defineProperty(_assertThisInitialized(d),"handleOnKeyDown",function(a){a.persist();var b=a.target,c=b.selectionStart,e=b.selectionEnd,f=d.state.historyNavigator,g=d.props.displayPattern,h="";"Undo"===d.detectUndoRedo(a)?(h=formatWithPattern(f.undo(),g),d.setState({value:h,triggerType:"Undo"})):"Redo"===d.detectUndoRedo(a)?(h=formatWithPattern(f.redo(),g),d.setState({value:h,triggerType:"Redo"})):d.setState({triggerEvent:a,triggerType:"KeyDown",selectionStart:c,selectionEnd:e})}),_defineProperty(_assertThisInitialized(d),"handleOnPaste",function(a){var b=d.props.displayPattern,c=unformatWithPattern(a.clipboardData.getData("Text"),b).length;d.setState({triggerType:"Paste",pastedLength:c})}),_defineProperty(_assertThisInitialized(d),"handleOnCut",function(){d.setState({triggerType:"Cut"})}),_defineProperty(_assertThisInitialized(d),"isKeyAllowed",function(a){var b=d.props.displayPattern,c=b.split("").filter(function(a){return"*"!==a});return!c.includes(a)}),_defineProperty(_assertThisInitialized(d),"handleOnChange",function(a){var b=d.state,c=b.historyNavigator,e=b.triggerEvent,f=b.triggerType,g=d.props,h=g.displayPattern,i=g.onChange,j=a.target.value,k=unformatWithPattern(j,h),l=null===e?// triggerEvent can be null only in case of "autofilling" (via password manager extension or browser build-in one) events
4
+ "Paste":d.getUserAction(k);if(d.isKeyAllowed(l)&&"Undo"!==f&&"Redo"!==f){("Backspace"===l||"Delete"===l)&&(k=d.handleDelete(k,l));var m=formatWithPattern(k,h);c.add(k),d.handleCursorPositioning(l);var n=unformatWithPattern(m,h);d.setState({value:m},d.resetEvent(),i(n))}}),_defineProperty(_assertThisInitialized(d),"handleOnBlur",function(a){var b=d.props,c=b.displayPattern,e=b.onBlur;e&&e(unformatWithPattern(a.target.value,c))}),_defineProperty(_assertThisInitialized(d),"handleOnFocus",function(a){var b=d.props,c=b.displayPattern,e=b.onFocus;e&&(d.handleOnChange(a),e(unformatWithPattern(a.target.value,c)))}),_defineProperty(_assertThisInitialized(d),"handleDelete",function(a,b){var c=d.props.displayPattern,e=d.state,f=e.selectionStart,g=e.selectionEnd,h=_toConsumableArray(a);if(f===g){var i=f-getCountOfSymbolsInSelection(0,f,c),j=0,k=getDistanceToNextSymbol(f,c);"Backspace"===b&&(i-=1,k=getDistanceToPreviousSymbol(f,c)),0<=i&&k&&(j=1),h.splice(i,j)}return h.join("")}),_defineProperty(_assertThisInitialized(d),"handleCursorPositioning",function(a){var b=d.props.displayPattern,c=d.state,e=c.triggerEvent,f=c.selectionStart,g=c.selectionEnd,h=c.pastedLength,i=getCursorPositionAfterKeystroke(a,f,g,b,h);setTimeout(function(){e&&e.target.setSelectionRange(i,i),d.setState({selectionStart:i,selectionEnd:i})},0)});var e=a.value,f=a.displayPattern,g=unformatWithPattern(e,f);return d.state={value:formatWithPattern(g,f),historyNavigator:new HistoryNavigator,prevDisplayPattern:a.displayPattern,triggerType:null,triggerEvent:null},d}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.type,c=a.inputMode,d=a.className,e=a.id,f=a.name,g=a.placeholder,h=a.readOnly,i=a.required,j=a.minLength,k=a.maxLength,l=a.disabled,m=a.autoComplete,n=this.state.value,o={type:b,inputMode:c,className:d,id:e,name:f,placeholder:g,readOnly:h,required:i,minLength:j,maxLength:k,disabled:l,autoComplete:m,value:n,onFocus:this.handleOnFocus,onBlur:this.handleOnBlur,onPaste:this.handleOnPaste,onKeyDown:this.handleOnKeyDown,onChange:this.handleOnChange,onCut:this.handleOnCut};return this.props.render(o)}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(a,b){var c=a.displayPattern,d=b.prevDisplayPattern;if(b.prevDisplayPattern!==c){var e=b.value,f=b.historyNavigator,g=unformatWithPattern(e,d);return f.reset(),{prevDisplayPattern:c,value:formatWithPattern(g,c),triggerType:null,triggerEvent:null,pastedLength:0}}return null}}]),b}(Component);WithDisplayFormat.propTypes={/**
6
5
  * autocomplete hides our form help so we need to disable it when help text
7
6
  * is present. Chrome ignores autocomplete=off, the only way to disable it is
8
7
  * to provide an 'invalid' value, for which 'disabled' serves.
@@ -1 +1 @@
1
- import{useState,useEffect}from"react";import{createPortal}from"react-dom";import{jsx as _jsx}from"react/jsx-runtime";export default function withNextPortalWrapper(a){return function(b){const[c,d]=useState(!1);return useEffect(()=>{d(!0)},[d]),c?/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(a,{...b}),document.body):null}}
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";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.to-string.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,useEffect}from"react";import{createPortal}from"react-dom";import{jsx as _jsx}from"react/jsx-runtime";export default function withNextPortalWrapper(a){return function(b){var c=useState(!1),d=_slicedToArray(c,2),e=d[0],f=d[1];return useEffect(function(){f(!0)},[f]),e?/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(a,_objectSpread({},b)),document.body):null}}