@transferwise/components 46.37.0 → 46.39.0
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.
- package/README.md +1 -1
- package/build/index.js +179 -357
- package/build/index.js.map +1 -1
- package/build/index.mjs +173 -350
- package/build/index.mjs.map +1 -1
- package/build/main.css +127 -108
- package/build/styles/main.css +127 -108
- package/build/styles/uploadInput/UploadInput.css +25 -27
- package/build/styles/uploadInput/uploadButton/UploadButton.css +24 -38
- package/build/styles/uploadInput/uploadItem/UploadItem.css +81 -46
- package/build/types/actionButton/ActionButton.d.ts +2 -2
- package/build/types/actionButton/ActionButton.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +0 -1
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/alert/Alert.d.ts +0 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts +4 -11
- package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts.map +1 -1
- package/build/types/alert/inlineMarkdown/index.d.ts +2 -1
- package/build/types/alert/inlineMarkdown/index.d.ts.map +1 -1
- package/build/types/avatar/Avatar.d.ts +0 -1
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/colors/colors.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/body/Body.d.ts +2 -2
- package/build/types/body/Body.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +0 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +3 -3
- package/build/types/button/classMap.d.ts +6 -6
- package/build/types/card/Card.d.ts +16 -20
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/card/index.d.ts +2 -1
- package/build/types/card/index.d.ts.map +1 -1
- package/build/types/checkbox/Checkbox.d.ts +15 -20
- package/build/types/checkbox/Checkbox.d.ts.map +1 -1
- package/build/types/checkbox/index.d.ts +2 -2
- package/build/types/checkbox/index.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +2 -3
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/chevron/Chevron.d.ts +0 -1
- package/build/types/chevron/Chevron.d.ts.map +1 -1
- package/build/types/chips/Chip.d.ts +0 -1
- package/build/types/chips/Chip.d.ts.map +1 -1
- package/build/types/chips/Chips.d.ts +0 -1
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +0 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/RadioButton/RadioButton.d.ts +0 -1
- package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
- package/build/types/common/action/Action.d.ts +0 -1
- package/build/types/common/action/Action.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +4 -5
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/common/commonProps.d.ts +0 -1
- package/build/types/common/commonProps.d.ts.map +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts +0 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
- package/build/types/common/hooks/useDirection/useDirection.d.ts.map +1 -1
- package/build/types/common/hooks/useResizeObserver.d.ts +0 -1
- package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +8 -8
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +0 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +8 -9
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +0 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +0 -1
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts +0 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +0 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts +0 -1
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts +0 -1
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts +0 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +0 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts +1 -2
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +19 -24
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/definitionList/index.d.ts +2 -1
- package/build/types/definitionList/index.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +18 -36
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/drawer/index.d.ts +2 -1
- package/build/types/drawer/index.d.ts.map +1 -1
- package/build/types/dropFade/DropFade.d.ts.map +1 -1
- package/build/types/emphasis/Emphasis.d.ts +0 -1
- package/build/types/emphasis/Emphasis.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +0 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +0 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +5 -17
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/index.d.ts +2 -2
- package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
- package/build/types/header/Header.d.ts +0 -1
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +0 -1
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/index.d.ts +5 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -3
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/info/index.d.ts +1 -1
- package/build/types/info/index.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +0 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +0 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/InputGroup.d.ts +0 -1
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SearchInput.d.ts +0 -1
- package/build/types/inputs/SearchInput.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +0 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/TextArea.d.ts +0 -1
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts +0 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_ButtonInput.d.ts +0 -1
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts +0 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +0 -1
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +0 -1
- package/build/types/label/Label.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts +0 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +15 -23
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/logo/index.d.ts +1 -2
- package/build/types/logo/index.d.ts.map +1 -1
- package/build/types/markdown/Markdown.d.ts +0 -1
- package/build/types/markdown/Markdown.d.ts.map +1 -1
- package/build/types/money/Money.d.ts +0 -1
- package/build/types/money/Money.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/navigationOption/NavigationOption.d.ts +0 -1
- package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts +9 -18
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/overlayHeader/index.d.ts +2 -1
- package/build/types/overlayHeader/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +0 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +0 -1
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/progress/Progress.d.ts +0 -1
- package/build/types/progress/Progress.d.ts.map +1 -1
- package/build/types/progressBar/ProgressBar.d.ts +0 -1
- package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
- package/build/types/provider/Provider.d.ts +0 -1
- package/build/types/provider/Provider.d.ts.map +1 -1
- package/build/types/radio/Radio.d.ts +0 -1
- package/build/types/radio/Radio.d.ts.map +1 -1
- package/build/types/radioGroup/RadioGroup.d.ts +0 -1
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/radioOption/RadioOption.d.ts +0 -1
- package/build/types/radioOption/RadioOption.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts +0 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/select/index.d.ts +1 -1
- package/build/types/select/index.d.ts.map +1 -1
- package/build/types/select/option/index.d.ts +1 -1
- package/build/types/select/option/index.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +3 -3
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts +2 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarContext.d.ts +0 -1
- package/build/types/snackbar/SnackbarContext.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarProvider.d.ts +0 -1
- package/build/types/snackbar/SnackbarProvider.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +0 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/sticky/Sticky.d.ts +32 -4
- package/build/types/sticky/Sticky.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +0 -1
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/build/types/tabs/TabList.d.ts +1 -1
- package/build/types/tabs/TabPanel.d.ts +4 -4
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +8 -0
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +0 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- package/build/types/tile/Tile.d.ts +16 -37
- package/build/types/tile/Tile.d.ts.map +1 -1
- package/build/types/tile/index.d.ts +1 -1
- package/build/types/tile/index.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts +0 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts.map +1 -1
- package/build/types/typeahead/util/highlight.d.ts +0 -1
- package/build/types/typeahead/util/highlight.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +20 -20
- package/build/types/upload/steps/completeStep/completeStep.d.ts +10 -10
- package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts +8 -8
- package/build/types/upload/steps/processingStep/processingStep.d.ts +8 -8
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts +9 -9
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +0 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/types.d.ts +9 -1
- package/build/types/uploadInput/types.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -6
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +0 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/types/withNextPortal/withNextPortal.d.ts +0 -1
- package/build/types/withNextPortal/withNextPortal.d.ts.map +1 -1
- package/package.json +24 -27
- package/src/accordion/Accordion.spec.js +5 -5
- package/src/accordion/AccordionItem/AccordionItem.spec.js +2 -2
- package/src/actionButton/ActionButton.spec.tsx +4 -5
- package/src/alert/Alert.spec.tsx +4 -4
- package/src/alert/Alert.story.tsx +6 -5
- package/src/alert/inlineMarkdown/InlineMarkdown.tsx +13 -0
- package/src/alert/inlineMarkdown/index.ts +2 -0
- package/src/button/Button.spec.js +4 -5
- package/src/card/{Card.spec.js → Card.spec.tsx} +4 -4
- package/src/card/{Card.story.js → Card.story.tsx} +6 -15
- package/src/card/{Card.js → Card.tsx} +23 -34
- package/src/card/index.ts +2 -0
- package/src/carousel/Carousel.spec.tsx +17 -17
- package/src/checkbox/{Checkbox.spec.js → Checkbox.spec.tsx} +5 -7
- package/src/checkbox/{Checkbox.js → Checkbox.tsx} +19 -41
- package/src/checkbox/index.ts +2 -0
- package/src/checkboxButton/CheckboxButton.spec.tsx +0 -2
- package/src/checkboxOption/CheckboxOption.spec.tsx +0 -2
- package/src/chevron/Chevron.spec.tsx +0 -1
- package/src/chips/Chips.spec.tsx +0 -1
- package/src/chips/Chips.story.tsx +5 -3
- package/src/circularButton/CircularButton.spec.tsx +4 -5
- package/src/common/RadioButton/RadioButton.spec.tsx +2 -2
- package/src/common/card/Card.story.tsx +1 -0
- package/src/common/closeButton/CloseButton.spec.tsx +0 -1
- package/src/common/flowHeader/FlowHeader.spec.tsx +0 -1
- package/src/dateInput/DateInput.story.tsx +21 -16
- package/src/dateLookup/DateLookup.rtl.spec.tsx +18 -16
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +47 -44
- package/src/dateLookup/DateLookup.tests.story.tsx +4 -2
- package/src/decision/Decision.spec.js +0 -2
- package/src/decision/Decision.tsx +1 -1
- package/src/definitionList/{DefinitionList.story.js → DefinitionList.story.tsx} +22 -2
- package/src/definitionList/DefinitionList.tsx +95 -0
- package/src/definitionList/index.ts +2 -0
- package/src/dimmer/Dimmer.rtl.spec.js +10 -10
- package/src/drawer/{Drawer.rtl.spec.js → Drawer.rtl.spec.tsx} +6 -4
- package/src/drawer/{Drawer.story.js → Drawer.story.tsx} +20 -28
- package/src/drawer/{Drawer.js → Drawer.tsx} +26 -31
- package/src/drawer/index.ts +2 -0
- package/src/emphasis/Emphasis.spec.tsx +0 -1
- package/src/field/Field.spec.tsx +2 -2
- package/src/flowNavigation/FlowNavigation.spec.js +0 -2
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +0 -1
- package/src/flowNavigation/backButton/BackButton.tsx +29 -0
- package/src/flowNavigation/backButton/index.ts +2 -0
- package/src/header/Header.spec.tsx +6 -6
- package/src/image/Image.spec.tsx +0 -1
- package/src/index.ts +5 -0
- package/src/info/Info.story.tsx +15 -9
- package/src/info/Info.tsx +2 -2
- package/src/info/index.ts +1 -1
- package/src/inlineAlert/InlineAlert.spec.tsx +0 -1
- package/src/inputs/SelectInput.spec.tsx +26 -47
- package/src/link/Link.spec.tsx +0 -1
- package/src/listItem/ListItem.spec.tsx +0 -1
- package/src/logo/Logo.story.tsx +3 -6
- package/src/logo/{Logo.js → Logo.tsx} +25 -35
- package/src/logo/index.ts +1 -0
- package/src/main.css +127 -108
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +2 -2
- package/src/moneyInput/MoneyInput.story.tsx +1 -4
- package/src/overlayHeader/{OverlayHeader.spec.js → OverlayHeader.spec.tsx} +1 -1
- package/src/overlayHeader/{OverlayHeader.story.js → OverlayHeader.story.tsx} +10 -2
- package/src/overlayHeader/{OverlayHeader.js → OverlayHeader.tsx} +12 -19
- package/src/overlayHeader/index.ts +2 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -0
- package/src/popover/Popover.spec.tsx +10 -10
- package/src/progress/Progress.spec.tsx +0 -1
- package/src/progressBar/ProgressBar.spec.tsx +0 -1
- package/src/section/Section.story.tsx +0 -2
- package/src/segmentedControl/SegmentedControl.spec.tsx +10 -11
- package/src/select/Select.spec.js +71 -71
- package/src/slidingPanel/SlidingPanel.spec.js +2 -1
- package/src/slidingPanel/SlidingPanel.tsx +3 -0
- package/src/snackbar/Snackbar.story.tsx +20 -100
- package/src/snackbar/Snackbar.tests.story.tsx +281 -0
- package/src/snackbar/Snackbar.tsx +8 -12
- package/src/sticky/Sticky.spec.tsx +71 -0
- package/src/sticky/Sticky.story.tsx +72 -15
- package/src/sticky/Sticky.tsx +49 -5
- package/src/test-utils/Parameters.d.ts +8 -0
- package/src/test-utils/index.js +1 -1
- package/src/test-utils/jest.setup.js +2 -0
- package/src/test-utils/story-config.ts +5 -0
- package/src/tile/{Tile.spec.js → Tile.spec.tsx} +1 -1
- package/src/tile/{Tile.js → Tile.tsx} +24 -35
- package/src/tooltip/Tooltip.spec.tsx +15 -16
- package/src/uploadInput/UploadInput.css +25 -27
- package/src/uploadInput/UploadInput.less +24 -23
- package/src/uploadInput/UploadInput.spec.tsx +9 -10
- package/src/uploadInput/UploadInput.story.tsx +8 -130
- package/src/uploadInput/UploadInput.tests.story.tsx +212 -0
- package/src/uploadInput/UploadInput.tsx +1 -4
- package/src/uploadInput/types.ts +11 -1
- package/src/uploadInput/uploadButton/UploadButton.css +24 -38
- package/src/uploadInput/uploadButton/UploadButton.less +27 -40
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +4 -5
- package/src/uploadInput/uploadButton/UploadButton.tsx +12 -37
- package/src/uploadInput/uploadItem/UploadItem.css +81 -46
- package/src/uploadInput/uploadItem/UploadItem.less +75 -40
- package/src/uploadInput/uploadItem/UploadItem.spec.tsx +4 -4
- package/src/uploadInput/uploadItem/UploadItem.tsx +30 -25
- package/src/uploadInput/uploadItem/UploadItemBody.tsx +1 -1
- package/build/types/logo/logoTypes.d.ts +0 -6
- package/build/types/logo/logoTypes.d.ts.map +0 -1
- package/src/alert/inlineMarkdown/InlineMarkdown.js +0 -21
- package/src/alert/inlineMarkdown/index.js +0 -1
- package/src/card/index.js +0 -1
- package/src/checkbox/index.js +0 -3
- package/src/definitionList/DefinitionList.js +0 -100
- package/src/definitionList/index.js +0 -1
- package/src/drawer/index.js +0 -1
- package/src/flowNavigation/backButton/BackButton.js +0 -32
- package/src/flowNavigation/backButton/BackButton.spec.js +0 -16
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +0 -37
- package/src/flowNavigation/backButton/index.js +0 -3
- package/src/logo/index.js +0 -2
- package/src/logo/logoTypes.ts +0 -6
- package/src/overlayHeader/index.js +0 -1
- package/src/snackbar/Snackbar.spec.js +0 -112
- package/src/sticky/Sticky.spec.js +0 -34
- /package/src/checkbox/__snapshots__/{Checkbox.spec.js.snap → Checkbox.spec.tsx.snap} +0 -0
- /package/src/drawer/__snapshots__/{Drawer.rtl.spec.js.snap → Drawer.rtl.spec.tsx.snap} +0 -0
- /package/src/logo/{Logo.spec.js → Logo.spec.tsx} +0 -0
- /package/src/logo/__snapshots__/{Logo.spec.js.snap → Logo.spec.tsx.snap} +0 -0
- /package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap} +0 -0
- /package/src/tile/{Tile.story.js → Tile.story.tsx} +0 -0
- /package/src/tile/__snapshots__/{Tile.spec.js.snap → Tile.spec.tsx.snap} +0 -0
- /package/src/tile/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Status } from '../common';
|
|
5
|
+
|
|
6
|
+
import UploadInput, { UploadInputProps } from './UploadInput';
|
|
7
|
+
import { UploadedFile, UploadResponse } from './types';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof UploadInput> = {
|
|
10
|
+
title: 'Forms/UploadInput/Tests',
|
|
11
|
+
component: UploadInput,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryFn<UploadInputProps>;
|
|
16
|
+
|
|
17
|
+
const files = [
|
|
18
|
+
{
|
|
19
|
+
id: 1,
|
|
20
|
+
filename: 'purchase-receipt-0.pdf',
|
|
21
|
+
url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 2,
|
|
25
|
+
filename: 'purchase-receipt-1.pdf',
|
|
26
|
+
url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 2,
|
|
30
|
+
filename: 'receipt failed.png',
|
|
31
|
+
status: Status.FAILED,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 3,
|
|
35
|
+
filename: 'receipt failed With error string.png',
|
|
36
|
+
status: Status.FAILED,
|
|
37
|
+
error: 'Something went wrong',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 4,
|
|
41
|
+
filename: 'receipt failed With error object.png',
|
|
42
|
+
status: Status.FAILED,
|
|
43
|
+
error: { message: 'Something went wrong' },
|
|
44
|
+
},
|
|
45
|
+
] satisfies UploadedFile[];
|
|
46
|
+
|
|
47
|
+
const createDelayedPromise = async ({
|
|
48
|
+
successful = true,
|
|
49
|
+
delaySeconds = 3,
|
|
50
|
+
response = { id: Math.round(Math.random() * 10000), url: '#' },
|
|
51
|
+
}: {
|
|
52
|
+
successful?: boolean;
|
|
53
|
+
delaySeconds?: number;
|
|
54
|
+
response?: UploadResponse;
|
|
55
|
+
} = {}): Promise<UploadResponse> =>
|
|
56
|
+
new Promise((resolve, reject) => {
|
|
57
|
+
setTimeout(
|
|
58
|
+
() => (successful ? resolve(response) : reject(new Error('Unexpected error'))),
|
|
59
|
+
delaySeconds * 1000,
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const props = {
|
|
64
|
+
onUploadFile: async (formData: FormData) => {
|
|
65
|
+
return createDelayedPromise();
|
|
66
|
+
},
|
|
67
|
+
onDeleteFile: async (id: string | number) => {
|
|
68
|
+
return createDelayedPromise();
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const Template: Story = (args: UploadInputProps) => <UploadInput {...args} />;
|
|
73
|
+
|
|
74
|
+
export const UploadInputWithDescriptionFromProps: Story = Template.bind({});
|
|
75
|
+
UploadInputWithDescriptionFromProps.args = {
|
|
76
|
+
...props,
|
|
77
|
+
multiple: true,
|
|
78
|
+
description: 'Custom file description from prop',
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Disabled: Story = Template.bind({});
|
|
82
|
+
Disabled.args = { ...props, disabled: true };
|
|
83
|
+
|
|
84
|
+
export const WithAnyFileType: Story = Template.bind({});
|
|
85
|
+
WithAnyFileType.args = { ...props, fileTypes: '*' };
|
|
86
|
+
|
|
87
|
+
export const WithSingleFileType: Story = Template.bind({});
|
|
88
|
+
WithSingleFileType.args = { ...props, fileTypes: '.zip,application/zip' };
|
|
89
|
+
|
|
90
|
+
export const WithMultipleExistingFiles: Story = Template.bind({});
|
|
91
|
+
WithMultipleExistingFiles.args = {
|
|
92
|
+
...props,
|
|
93
|
+
files,
|
|
94
|
+
multiple: true,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const WithFileErrors: Story = Template.bind({});
|
|
98
|
+
WithFileErrors.args = {
|
|
99
|
+
...props,
|
|
100
|
+
files: [
|
|
101
|
+
{
|
|
102
|
+
id: 1,
|
|
103
|
+
filename: 'Error with default message.png',
|
|
104
|
+
status: Status.FAILED,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 2,
|
|
108
|
+
filename: 'Error with `string` error.png',
|
|
109
|
+
status: Status.FAILED,
|
|
110
|
+
error: 'Single string error',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 3,
|
|
114
|
+
filename: 'Error with `obj` error ({ message : `string` }).png',
|
|
115
|
+
status: Status.FAILED,
|
|
116
|
+
error: { message: 'Single obj error' },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 4,
|
|
120
|
+
filename: 'Error with single error passed in `array`.png',
|
|
121
|
+
status: Status.FAILED,
|
|
122
|
+
errors: ['Single error in array'],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 5,
|
|
126
|
+
filename: 'Error with multiple `string` errors passed in `array`.png',
|
|
127
|
+
status: Status.FAILED,
|
|
128
|
+
errors: ['Error 1', 'Error 2', 'Error 3'],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 6,
|
|
132
|
+
filename: 'Error with multiple `obj` errors passed in `array`.png',
|
|
133
|
+
status: Status.FAILED,
|
|
134
|
+
errors: [{ message: 'Error 1' }, { message: 'Error 2' }, { message: 'Error 3' }],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
multiple: true,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const WithoutDelete: Story = Template.bind({});
|
|
141
|
+
WithoutDelete.args = {
|
|
142
|
+
...props,
|
|
143
|
+
files,
|
|
144
|
+
onDeleteFile: undefined,
|
|
145
|
+
multiple: true,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const WithUploadFailed: Story = Template.bind({});
|
|
149
|
+
WithUploadFailed.args = {
|
|
150
|
+
...props,
|
|
151
|
+
files: files.slice(0),
|
|
152
|
+
onUploadFile: async () => createDelayedPromise({ successful: false }),
|
|
153
|
+
multiple: true,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const WithDeleteFailed: Story = Template.bind({});
|
|
157
|
+
WithDeleteFailed.args = {
|
|
158
|
+
...props,
|
|
159
|
+
files: files.slice(0),
|
|
160
|
+
onDeleteFile: async () => createDelayedPromise({ successful: false }),
|
|
161
|
+
multiple: true,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const CustomConfirmMessage: Story = Template.bind({});
|
|
165
|
+
CustomConfirmMessage.args = {
|
|
166
|
+
...props,
|
|
167
|
+
files: files.slice(0),
|
|
168
|
+
deleteConfirm: {
|
|
169
|
+
title: 'Sure you want to remove this invoice?',
|
|
170
|
+
body: (
|
|
171
|
+
<img
|
|
172
|
+
alt="brand logo"
|
|
173
|
+
src="https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"
|
|
174
|
+
/>
|
|
175
|
+
),
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const WithManualDownloadHandler: Story = Template.bind({});
|
|
180
|
+
WithManualDownloadHandler.args = {
|
|
181
|
+
...props,
|
|
182
|
+
files,
|
|
183
|
+
onDownload: action('Manual download handler'),
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const WithFilesChangeHandler: Story = Template.bind({});
|
|
187
|
+
WithFilesChangeHandler.args = {
|
|
188
|
+
...props,
|
|
189
|
+
files,
|
|
190
|
+
onFilesChange: action('Files change handler'),
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const WithMaxFilesToUploadLimit: Story = Template.bind({});
|
|
194
|
+
WithMaxFilesToUploadLimit.args = {
|
|
195
|
+
...props,
|
|
196
|
+
multiple: true,
|
|
197
|
+
maxFiles: 5,
|
|
198
|
+
maxFilesErrorMessage: "Can't upload as maximum number of files allowed are already uploaded",
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const WithFileSizeErrorMessage: Story = Template.bind({});
|
|
202
|
+
WithFileSizeErrorMessage.args = {
|
|
203
|
+
...props,
|
|
204
|
+
sizeLimit: 1,
|
|
205
|
+
sizeLimitErrorMessage: 'The file is oversized',
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const WithCustomUploadButtonTitle: Story = Template.bind({});
|
|
209
|
+
WithCustomUploadButtonTitle.args = {
|
|
210
|
+
...props,
|
|
211
|
+
uploadButtonTitle: 'Upload the VAT receipts for FY 2022-23',
|
|
212
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useTheme } from '@wise/components-theming';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
2
|
import { useEffect, useRef, useState } from 'react';
|
|
4
3
|
import { useIntl } from 'react-intl';
|
|
@@ -128,7 +127,6 @@ const UploadInput = ({
|
|
|
128
127
|
sizeLimitErrorMessage,
|
|
129
128
|
uploadButtonTitle,
|
|
130
129
|
}: UploadInputProps) => {
|
|
131
|
-
const { isModern } = useTheme();
|
|
132
130
|
const [markedFileForDelete, setMarkedFileForDelete] = useState<UploadedFile | null>(null);
|
|
133
131
|
const [mounted, setMounted] = useState(false);
|
|
134
132
|
const { formatMessage } = useIntl();
|
|
@@ -301,7 +299,7 @@ const UploadInput = ({
|
|
|
301
299
|
|
|
302
300
|
return (
|
|
303
301
|
<>
|
|
304
|
-
<div className={classNames('np-upload-input', className, { disabled
|
|
302
|
+
<div className={classNames('np-upload-input', className, { disabled })}>
|
|
305
303
|
{uploadedFiles.map((file) => (
|
|
306
304
|
<UploadItem
|
|
307
305
|
key={file.id}
|
|
@@ -329,7 +327,6 @@ const UploadInput = ({
|
|
|
329
327
|
sizeLimit={sizeLimit}
|
|
330
328
|
description={description}
|
|
331
329
|
maxFiles={maxFiles}
|
|
332
|
-
multipleFileInputWithFilesAdded={multiple && uploadedFiles.length > 0}
|
|
333
330
|
onChange={addFiles}
|
|
334
331
|
/>
|
|
335
332
|
)}
|
package/src/uploadInput/types.ts
CHANGED
|
@@ -19,9 +19,14 @@ export type UploadResponse = {
|
|
|
19
19
|
url?: string;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Optionally
|
|
22
|
+
* Optionally sets translated error message when a file gets rejected
|
|
23
23
|
*/
|
|
24
24
|
error?: UploadError;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optionally sets translated error messages when a file gets rejected
|
|
28
|
+
*/
|
|
29
|
+
errors?: UploadError[];
|
|
25
30
|
[key: string]: any;
|
|
26
31
|
};
|
|
27
32
|
|
|
@@ -46,6 +51,11 @@ export type UploadedFile = {
|
|
|
46
51
|
*/
|
|
47
52
|
error?: UploadError;
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Any API errors array. The messages should be localized.
|
|
56
|
+
*/
|
|
57
|
+
errors?: UploadError[];
|
|
58
|
+
|
|
49
59
|
/**
|
|
50
60
|
* Optional. An external URL where the file can be opened from.
|
|
51
61
|
*/
|
|
@@ -1,49 +1,35 @@
|
|
|
1
|
-
.np-upload-button {
|
|
2
|
-
|
|
3
|
-
border: 0 !important;
|
|
4
|
-
padding: 12px 16px;
|
|
5
|
-
padding: var(--size-12) var(--size-16);
|
|
6
|
-
}
|
|
7
|
-
.np-upload-button.np-upload-accent {
|
|
8
|
-
color: #00a2dd;
|
|
9
|
-
color: var(--color-interactive-accent);
|
|
10
|
-
}
|
|
11
|
-
label.np-upload-button:not(.disabled):hover,
|
|
12
|
-
label.np-upload-button:not(.disabled):focus-visible,
|
|
13
|
-
label.np-upload-button:not(.disabled):active {
|
|
14
|
-
background-color: rgba(134,167,189,0.10196);
|
|
15
|
-
background-color: var(--color-background-neutral);
|
|
16
|
-
}
|
|
17
|
-
.np-theme-personal label.np-upload-button:not(.disabled):hover,
|
|
18
|
-
.np-theme-personal label.np-upload-button:not(.disabled):focus-visible,
|
|
19
|
-
.np-theme-personal label.np-upload-button:not(.disabled):active {
|
|
20
|
-
background-color: var(--color-background-screen-hover);
|
|
21
|
-
}
|
|
22
|
-
.np-theme-personal .disabled label.np-upload-button:not(.disabled):hover,
|
|
23
|
-
.np-theme-personal .disabled label.np-upload-button:not(.disabled):focus-visible,
|
|
24
|
-
.np-theme-personal .disabled label.np-upload-button:not(.disabled):active {
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
.np-upload-button .np-upload-icon {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
.np-upload-button-container.droppable {
|
|
32
|
-
border: 0;
|
|
1
|
+
.np-upload-button-container {
|
|
2
|
+
border-style: solid;
|
|
33
3
|
}
|
|
34
4
|
.np-upload-button-container .droppable-card-content {
|
|
35
5
|
display: flex;
|
|
36
6
|
}
|
|
37
|
-
.np-
|
|
38
|
-
border-
|
|
39
|
-
border-
|
|
7
|
+
.np-upload-button-container.droppable-dropping {
|
|
8
|
+
border-color: #c9cbce !important;
|
|
9
|
+
border-color: var(--color-interactive-secondary) !important;
|
|
40
10
|
}
|
|
41
11
|
.np-upload-button-container input[type="file"] {
|
|
42
12
|
opacity: 0;
|
|
43
13
|
z-index: -1;
|
|
44
14
|
position: absolute;
|
|
45
15
|
}
|
|
46
|
-
.np-upload-button-container
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
.np-upload-button-container .np-upload-button {
|
|
17
|
+
border: none;
|
|
18
|
+
}
|
|
19
|
+
.np-upload-button {
|
|
20
|
+
width: 100%;
|
|
21
|
+
padding: 16px;
|
|
22
|
+
padding: var(--padding-small);
|
|
23
|
+
border-radius: 0;
|
|
24
|
+
}
|
|
25
|
+
label.np-upload-button:not(.disabled):hover,
|
|
26
|
+
label.np-upload-button:not(.disabled):active {
|
|
27
|
+
background-color: var(--color-background-screen-hover);
|
|
28
|
+
}
|
|
29
|
+
.disabled label.np-upload-button:not(.disabled):hover,
|
|
30
|
+
.disabled label.np-upload-button:not(.disabled):active {
|
|
31
|
+
background-color: transparent;
|
|
32
|
+
}
|
|
33
|
+
.np-upload-button .media {
|
|
34
|
+
align-items: flex-start;
|
|
49
35
|
}
|
|
@@ -1,57 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
.np-upload-button-container {
|
|
2
|
+
border-style: solid;
|
|
2
3
|
|
|
3
|
-
.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
padding: var(--size-12) var(--size-16);
|
|
4
|
+
.droppable-card-content {
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
&.
|
|
9
|
-
color: var(--color-interactive-
|
|
8
|
+
&.droppable-dropping {
|
|
9
|
+
border-color: var(--color-interactive-secondary) !important;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
input[type="file"] {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
z-index: -1;
|
|
15
|
+
position: absolute;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.np-upload-button {
|
|
19
|
+
border: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.np-upload-button {
|
|
24
|
+
width: 100%;
|
|
25
|
+
padding: var(--padding-small);
|
|
26
|
+
border-radius: 0;
|
|
27
|
+
|
|
12
28
|
label& {
|
|
13
29
|
&:not(.disabled) {
|
|
14
30
|
&:hover,
|
|
15
|
-
&:focus-visible,
|
|
16
31
|
&:active {
|
|
17
|
-
background-color: var(--color-background-
|
|
18
|
-
|
|
19
|
-
.np-theme-personal & {
|
|
20
|
-
background-color: var(--color-background-screen-hover);
|
|
21
|
-
}
|
|
32
|
+
background-color: var(--color-background-screen-hover);
|
|
22
33
|
|
|
23
|
-
.
|
|
34
|
+
.disabled & {
|
|
24
35
|
background-color: transparent;
|
|
25
36
|
}
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
align-items: center;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.np-upload-button-container {
|
|
37
|
-
&.droppable {
|
|
38
|
-
border: 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.droppable-card-content {
|
|
42
|
-
display: flex;
|
|
43
|
-
.np-theme-personal & {
|
|
44
|
-
border-radius: @small-border-minus-one;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
input[type="file"] {
|
|
49
|
-
opacity: 0;
|
|
50
|
-
z-index: -1;
|
|
51
|
-
position: absolute;
|
|
52
|
-
|
|
53
|
-
&:focus-visible + label {
|
|
54
|
-
background-color: var(--color-background-neutral); // Tab focus style
|
|
55
|
-
}
|
|
41
|
+
.media {
|
|
42
|
+
align-items: flex-start;
|
|
56
43
|
}
|
|
57
44
|
}
|
|
@@ -9,7 +9,6 @@ describe('UploadButton', () => {
|
|
|
9
9
|
|
|
10
10
|
const props: UploadButtonProps = {
|
|
11
11
|
onChange: jest.fn(),
|
|
12
|
-
multipleFileInputWithFilesAdded: true,
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
const renderComponent = (customProps = props) => render(<UploadButton {...customProps} />);
|
|
@@ -36,9 +35,9 @@ describe('UploadButton', () => {
|
|
|
36
35
|
);
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
it('trigger onChange callback with a FileList', () => {
|
|
38
|
+
it('trigger onChange callback with a FileList', async () => {
|
|
40
39
|
const input = screen.getByTestId(TEST_IDS.uploadInput);
|
|
41
|
-
userEvent.upload(input, [pngFile, jpgFile]);
|
|
40
|
+
await userEvent.upload(input, [pngFile, jpgFile]);
|
|
42
41
|
|
|
43
42
|
expect(props.onChange).toHaveBeenCalledTimes(1);
|
|
44
43
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -56,9 +55,9 @@ describe('UploadButton', () => {
|
|
|
56
55
|
expect(screen.getByTestId(TEST_IDS.uploadInput)).toHaveAttribute('multiple');
|
|
57
56
|
});
|
|
58
57
|
|
|
59
|
-
it('trigger onChange callback with a FileList', () => {
|
|
58
|
+
it('trigger onChange callback with a FileList', async () => {
|
|
60
59
|
const input = screen.getByTestId(TEST_IDS.uploadInput);
|
|
61
|
-
userEvent.upload(input, [pngFile, jpgFile]);
|
|
60
|
+
await userEvent.upload(input, [pngFile, jpgFile]);
|
|
62
61
|
|
|
63
62
|
expect(props.onChange).toHaveBeenCalledTimes(1);
|
|
64
63
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { PlusCircle as PlusIcon, Upload as UploadIcon } from '@transferwise/icons';
|
|
2
|
-
import { useTheme } from '@wise/components-theming';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { ChangeEvent, DragEvent, useRef, useState } from 'react';
|
|
5
4
|
import { useIntl } from 'react-intl';
|
|
6
5
|
|
|
7
6
|
import Body from '../../body';
|
|
8
7
|
import { FileType, Typography } from '../../common';
|
|
9
|
-
import { useDirection } from '../../common/hooks';
|
|
10
8
|
|
|
11
9
|
import MESSAGES from './UploadButton.messages';
|
|
12
10
|
import { DEFAULT_SIZE_LIMIT, imageFileTypes } from './defaults';
|
|
@@ -60,11 +58,6 @@ export type UploadButtonProps = {
|
|
|
60
58
|
* Title for the upload button
|
|
61
59
|
*/
|
|
62
60
|
uploadButtonTitle?: string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Are there any uploaded items on a multiple-file upload? Used for calculating border radiuses
|
|
66
|
-
*/
|
|
67
|
-
multipleFileInputWithFilesAdded: boolean;
|
|
68
61
|
};
|
|
69
62
|
|
|
70
63
|
export enum TEST_IDS {
|
|
@@ -87,10 +80,7 @@ const UploadButton = ({
|
|
|
87
80
|
onChange,
|
|
88
81
|
id = DEFAULT_FILE_INPUT_ID,
|
|
89
82
|
uploadButtonTitle,
|
|
90
|
-
multipleFileInputWithFilesAdded,
|
|
91
83
|
}: UploadButtonProps) => {
|
|
92
|
-
const { isModern } = useTheme();
|
|
93
|
-
const { isRTL } = useDirection();
|
|
94
84
|
const { formatMessage } = useIntl();
|
|
95
85
|
const inputReference = useRef<HTMLInputElement>(null);
|
|
96
86
|
|
|
@@ -167,7 +157,7 @@ const UploadButton = ({
|
|
|
167
157
|
const areAllFilesAllowed = getFileTypesDescription() === '*';
|
|
168
158
|
|
|
169
159
|
if (areAllFilesAllowed) {
|
|
170
|
-
return {}; //file input by default allows all files
|
|
160
|
+
return {}; // file input by default allows all files
|
|
171
161
|
}
|
|
172
162
|
|
|
173
163
|
if (Array.isArray(fileTypes)) {
|
|
@@ -179,23 +169,15 @@ const UploadButton = ({
|
|
|
179
169
|
|
|
180
170
|
function renderDescription() {
|
|
181
171
|
return (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{maxFiles && (
|
|
192
|
-
<>
|
|
193
|
-
<br />
|
|
194
|
-
{`Maximum ${maxFiles} files.`}
|
|
195
|
-
</>
|
|
196
|
-
)}
|
|
197
|
-
</Body>
|
|
198
|
-
</>
|
|
172
|
+
<Body className={classNames({ 'text-primary': !disabled })}>
|
|
173
|
+
{getDescription()}
|
|
174
|
+
{maxFiles && (
|
|
175
|
+
<>
|
|
176
|
+
<br />
|
|
177
|
+
{`Maximum ${maxFiles} files.`}
|
|
178
|
+
</>
|
|
179
|
+
)}
|
|
180
|
+
</Body>
|
|
199
181
|
);
|
|
200
182
|
}
|
|
201
183
|
|
|
@@ -226,15 +208,9 @@ const UploadButton = ({
|
|
|
226
208
|
onChange={filesSelected}
|
|
227
209
|
/>
|
|
228
210
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
|
229
|
-
<label
|
|
230
|
-
htmlFor={id}
|
|
231
|
-
className={classNames('btn', 'np-upload-accent', 'np-upload-button', {
|
|
232
|
-
disabled,
|
|
233
|
-
'np-upload-input--square-top': multipleFileInputWithFilesAdded,
|
|
234
|
-
})}
|
|
235
|
-
>
|
|
211
|
+
<label htmlFor={id} className={classNames('btn', 'np-upload-button')}>
|
|
236
212
|
<div className="media">
|
|
237
|
-
<div className="np-upload-icon media-left">
|
|
213
|
+
<div className="np-upload-icon media-middle media-left">
|
|
238
214
|
<UploadIcon size={24} className="text-link" />
|
|
239
215
|
</div>
|
|
240
216
|
<div className="media-body text-xs-left" data-testid={TEST_IDS.mediaBody}>
|
|
@@ -253,7 +229,6 @@ const UploadButton = ({
|
|
|
253
229
|
'droppable-card',
|
|
254
230
|
'droppable-dropping-card',
|
|
255
231
|
'droppable-card-content',
|
|
256
|
-
{ 'np-upload-input--square-top': multipleFileInputWithFilesAdded },
|
|
257
232
|
)}
|
|
258
233
|
>
|
|
259
234
|
<PlusIcon className="m-x-1" size={24} />
|