@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
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
|
|
4
3
|
import Body from '../body';
|
|
5
4
|
import { Size, Typography } from '../common';
|
|
6
5
|
import Title from '../title';
|
|
7
6
|
|
|
8
|
-
export
|
|
7
|
+
export interface TileProps {
|
|
8
|
+
/** Classes to apply to the Tile container */
|
|
9
|
+
className?: string;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
href?: string;
|
|
13
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
14
|
+
/** Accepts only Avatar and images */
|
|
15
|
+
media: React.ReactNode;
|
|
16
|
+
/** Function called onClick or onKeyDown */
|
|
17
|
+
onClick?: (event?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
18
|
+
/** The size applied to Tile */
|
|
19
|
+
size?: `${Size.SMALL | Size.MEDIUM}`;
|
|
20
|
+
title: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function Tile({
|
|
9
24
|
className,
|
|
10
25
|
description,
|
|
11
26
|
disabled,
|
|
@@ -13,10 +28,10 @@ export const Tile = ({
|
|
|
13
28
|
target,
|
|
14
29
|
media,
|
|
15
30
|
onClick,
|
|
16
|
-
size,
|
|
31
|
+
size = 'md',
|
|
17
32
|
title,
|
|
18
|
-
})
|
|
19
|
-
const isSmall = size ===
|
|
33
|
+
}: TileProps) {
|
|
34
|
+
const isSmall = size === 'sm';
|
|
20
35
|
const Element = href ? 'a' : 'button';
|
|
21
36
|
|
|
22
37
|
return (
|
|
@@ -36,13 +51,13 @@ export const Tile = ({
|
|
|
36
51
|
)}
|
|
37
52
|
href={href}
|
|
38
53
|
target={target}
|
|
39
|
-
onClick={disabled ?
|
|
54
|
+
onClick={disabled ? undefined : onClick}
|
|
40
55
|
onKeyDown={
|
|
41
56
|
disabled
|
|
42
|
-
?
|
|
57
|
+
? undefined
|
|
43
58
|
: ({ key }) => {
|
|
44
59
|
if (key === 'Enter' || key === ' ') {
|
|
45
|
-
onClick();
|
|
60
|
+
onClick?.();
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
}
|
|
@@ -58,30 +73,4 @@ export const Tile = ({
|
|
|
58
73
|
) : null}
|
|
59
74
|
</Element>
|
|
60
75
|
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
Tile.propTypes = {
|
|
64
|
-
/** Classes to apply to the Tile container */
|
|
65
|
-
className: PropTypes.string,
|
|
66
|
-
description: PropTypes.node,
|
|
67
|
-
disabled: PropTypes.bool,
|
|
68
|
-
href: PropTypes.string,
|
|
69
|
-
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
70
|
-
/** Accepts only Avatar and images */
|
|
71
|
-
media: PropTypes.node.isRequired,
|
|
72
|
-
/** Function called onClick or onKeyDown */
|
|
73
|
-
onClick: PropTypes.func,
|
|
74
|
-
/** The size applied to Tile */
|
|
75
|
-
size: PropTypes.oneOf(['sm', 'md']),
|
|
76
|
-
title: PropTypes.node.isRequired,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Tile.defaultProps = {
|
|
80
|
-
className: '',
|
|
81
|
-
description: null,
|
|
82
|
-
disabled: false,
|
|
83
|
-
size: Size.MEDIUM,
|
|
84
|
-
target: undefined,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export default Tile;
|
|
76
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import React from 'react';
|
|
2
|
+
import { userEvent } from '@testing-library/user-event';
|
|
4
3
|
|
|
5
4
|
import Tooltip from '.';
|
|
6
5
|
|
|
@@ -26,7 +25,7 @@ describe('Tooltip Component', () => {
|
|
|
26
25
|
expect(tooltip).toHaveAttribute('aria-hidden', 'true');
|
|
27
26
|
});
|
|
28
27
|
|
|
29
|
-
it('should render the tooltip label when closed', () => {
|
|
28
|
+
it('should render the tooltip label when closed', async () => {
|
|
30
29
|
render(
|
|
31
30
|
<Tooltip label="Test Tooltip">
|
|
32
31
|
<span>Hover me</span>
|
|
@@ -36,11 +35,11 @@ describe('Tooltip Component', () => {
|
|
|
36
35
|
const tooltip = screen.getByRole('tooltip', { hidden: true });
|
|
37
36
|
expect(tooltip).toHaveAttribute('aria-hidden', 'true');
|
|
38
37
|
|
|
39
|
-
userEvent.hover(triggerElement);
|
|
38
|
+
await userEvent.hover(triggerElement);
|
|
40
39
|
expect(tooltip).toHaveAttribute('aria-hidden', 'false');
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
it('should display the tooltip on mouse hover', () => {
|
|
42
|
+
it('should display the tooltip on mouse hover', async () => {
|
|
44
43
|
render(
|
|
45
44
|
<Tooltip label="Test Tooltip">
|
|
46
45
|
<span>Hover over me!</span>
|
|
@@ -48,13 +47,13 @@ describe('Tooltip Component', () => {
|
|
|
48
47
|
);
|
|
49
48
|
const triggerElement = screen.getByText('Hover over me!');
|
|
50
49
|
|
|
51
|
-
userEvent.hover(triggerElement);
|
|
50
|
+
await userEvent.hover(triggerElement);
|
|
52
51
|
|
|
53
52
|
const tooltipElement = screen.queryByText('Test Tooltip');
|
|
54
53
|
expect(tooltipElement).toBeVisible();
|
|
55
54
|
});
|
|
56
55
|
|
|
57
|
-
it('should hide the tooltip on mouse out', () => {
|
|
56
|
+
it('should hide the tooltip on mouse out', async () => {
|
|
58
57
|
render(
|
|
59
58
|
<Tooltip label="Test Tooltip">
|
|
60
59
|
<span>Hover me</span>
|
|
@@ -62,16 +61,16 @@ describe('Tooltip Component', () => {
|
|
|
62
61
|
);
|
|
63
62
|
const triggerElement = screen.getByText('Hover me');
|
|
64
63
|
|
|
65
|
-
userEvent.hover(triggerElement);
|
|
64
|
+
await userEvent.hover(triggerElement);
|
|
66
65
|
let tooltipElement = screen.getByText('Test Tooltip');
|
|
67
66
|
expect(tooltipElement).toBeVisible();
|
|
68
67
|
|
|
69
|
-
userEvent.unhover(triggerElement);
|
|
68
|
+
await userEvent.unhover(triggerElement);
|
|
70
69
|
tooltipElement = screen.getByRole('tooltip', { hidden: true });
|
|
71
70
|
expect(tooltipElement).toHaveAttribute('aria-hidden', 'true');
|
|
72
71
|
});
|
|
73
72
|
|
|
74
|
-
it('should display the tooltip on focus', () => {
|
|
73
|
+
it('should display the tooltip on focus', async () => {
|
|
75
74
|
render(
|
|
76
75
|
<Tooltip label="Test Tooltip">
|
|
77
76
|
<span>Focus me</span>
|
|
@@ -79,12 +78,12 @@ describe('Tooltip Component', () => {
|
|
|
79
78
|
);
|
|
80
79
|
const triggerElement = screen.getByText('Focus me');
|
|
81
80
|
|
|
82
|
-
userEvent.tab();
|
|
81
|
+
await userEvent.tab();
|
|
83
82
|
const tooltipElement = screen.getByText('Test Tooltip');
|
|
84
83
|
expect(tooltipElement).toBeVisible();
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
it('should hide the tooltip on blur', () => {
|
|
86
|
+
it('should hide the tooltip on blur', async () => {
|
|
88
87
|
render(
|
|
89
88
|
<Tooltip label="Test Tooltip">
|
|
90
89
|
<span>Focus me</span>
|
|
@@ -92,16 +91,16 @@ describe('Tooltip Component', () => {
|
|
|
92
91
|
);
|
|
93
92
|
const triggerElement = screen.getByText('Focus me');
|
|
94
93
|
|
|
95
|
-
userEvent.tab();
|
|
94
|
+
await userEvent.tab();
|
|
96
95
|
let tooltipElement = screen.getByRole('tooltip', { hidden: true });
|
|
97
96
|
expect(tooltipElement).toBeVisible();
|
|
98
97
|
|
|
99
|
-
userEvent.tab({ shift: true }); // Blur the element
|
|
98
|
+
await userEvent.tab({ shift: true }); // Blur the element
|
|
100
99
|
tooltipElement = screen.getByRole('tooltip', { hidden: true });
|
|
101
100
|
expect(tooltipElement).toHaveAttribute('aria-hidden', 'true');
|
|
102
101
|
});
|
|
103
102
|
|
|
104
|
-
it('should display the tooltip when the "children" prop is a React element', () => {
|
|
103
|
+
it('should display the tooltip when the "children" prop is a React element', async () => {
|
|
105
104
|
render(
|
|
106
105
|
<Tooltip label="Test Tooltip">
|
|
107
106
|
<button type="button">Click me</button>
|
|
@@ -109,7 +108,7 @@ describe('Tooltip Component', () => {
|
|
|
109
108
|
);
|
|
110
109
|
const triggerElement = screen.getByText('Click me');
|
|
111
110
|
|
|
112
|
-
userEvent.hover(triggerElement);
|
|
111
|
+
await userEvent.hover(triggerElement);
|
|
113
112
|
const tooltipElement = screen.getByRole('tooltip', { hidden: true });
|
|
114
113
|
expect(tooltipElement).toBeVisible();
|
|
115
114
|
});
|
|
@@ -1,46 +1,40 @@
|
|
|
1
|
-
.np-upload-input {
|
|
2
|
-
border: 1px solid #c9cbce;
|
|
3
|
-
border: 1px solid var(--color-interactive-secondary);
|
|
4
|
-
border-radius: 10px;
|
|
5
|
-
border-radius: var(--radius-small);
|
|
6
|
-
}
|
|
7
|
-
.np-upload-input:has(:focus-visible) {
|
|
8
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
9
|
-
outline-offset: var(--ring-outline-offset);
|
|
10
|
-
}
|
|
11
1
|
.np-upload-input.form-control {
|
|
12
2
|
height: auto;
|
|
13
3
|
padding: 0;
|
|
14
4
|
padding: initial;
|
|
15
5
|
}
|
|
16
|
-
.np-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
.np-upload-input > div:first-child,
|
|
7
|
+
.np-upload-input > div:first-child .np-upload-item--single-file,
|
|
8
|
+
.np-upload-input > div:first-child .np-upload-item--link {
|
|
9
|
+
border-top-left-radius: 10px;
|
|
10
|
+
border-top-left-radius: var(--radius-small);
|
|
11
|
+
border-top-right-radius: 10px;
|
|
12
|
+
border-top-right-radius: var(--radius-small);
|
|
13
|
+
}
|
|
14
|
+
.np-upload-input > div:last-child {
|
|
15
|
+
border-bottom-left-radius: 10px;
|
|
16
|
+
border-bottom-left-radius: var(--radius-small);
|
|
17
|
+
border-bottom-right-radius: 10px;
|
|
18
|
+
border-bottom-right-radius: var(--radius-small);
|
|
19
19
|
}
|
|
20
20
|
.np-theme-personal .np-upload-input.disabled .btn {
|
|
21
21
|
cursor: inherit;
|
|
22
22
|
}
|
|
23
|
-
.np-theme-personal .np-upload-input .np-upload-button {
|
|
24
|
-
border-radius: calc(10px - 1px);
|
|
25
|
-
border-radius: calc(var(--radius-small) - 1px);
|
|
26
|
-
padding: 16px;
|
|
27
|
-
padding: var(--padding-small);
|
|
28
|
-
}
|
|
29
|
-
.np-theme-personal .np-upload-input .np-upload-input--square-top {
|
|
30
|
-
border-top-right-radius: 0px;
|
|
31
|
-
border-top-left-radius: 0px;
|
|
32
|
-
}
|
|
33
|
-
.np-theme-personal .np-upload-input .np-upload-item__remove-button {
|
|
34
|
-
border-radius: 0;
|
|
35
|
-
border-radius: initial;
|
|
36
|
-
}
|
|
37
23
|
.np-theme-personal .np-upload-input .np-upload-icon {
|
|
38
24
|
color: var(--color-interactive-primary);
|
|
39
25
|
}
|
|
40
26
|
.np-theme-personal .np-upload-input .media-body {
|
|
27
|
+
padding-right: 32px;
|
|
28
|
+
padding-right: var(--size-32);
|
|
41
29
|
color: var(--color-content-link);
|
|
42
30
|
white-space: break-spaces;
|
|
43
31
|
}
|
|
32
|
+
@media (max-width: 320px) {
|
|
33
|
+
.np-theme-personal .np-upload-input .media-body {
|
|
34
|
+
padding-right: 64px;
|
|
35
|
+
padding-right: var(--size-64);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
44
38
|
.np-theme-personal .np-upload-input .media-body .np-text-body-large-bold {
|
|
45
39
|
-webkit-text-decoration: underline;
|
|
46
40
|
text-decoration: underline;
|
|
@@ -55,6 +49,10 @@
|
|
|
55
49
|
.np-theme-personal .np-upload-input .media-body .text-negative {
|
|
56
50
|
color: var(--color-sentiment-negative) !important;
|
|
57
51
|
}
|
|
52
|
+
.np-theme-personal .np-upload-input-errors {
|
|
53
|
+
padding-left: 0;
|
|
54
|
+
list-style-position: inside;
|
|
55
|
+
}
|
|
58
56
|
.np-theme-personal .np-upload-input .status-circle {
|
|
59
57
|
width: 24px;
|
|
60
58
|
width: var(--size-x-small);
|
|
@@ -3,49 +3,45 @@
|
|
|
3
3
|
@import (reference) './uploadItem/UploadItem.less';
|
|
4
4
|
|
|
5
5
|
.np-upload-input {
|
|
6
|
-
border: 1px solid var(--color-interactive-secondary);
|
|
7
|
-
border-radius: var(--radius-small);
|
|
8
|
-
|
|
9
|
-
&:has(:focus-visible) {
|
|
10
|
-
.ring();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
&.form-control {
|
|
14
7
|
height: auto;
|
|
15
8
|
padding: initial;
|
|
16
9
|
}
|
|
10
|
+
|
|
11
|
+
& > div {
|
|
12
|
+
&:first-child,
|
|
13
|
+
&:first-child .np-upload-item--single-file,
|
|
14
|
+
&:first-child .np-upload-item--link {
|
|
15
|
+
border-top-left-radius: var(--radius-small);
|
|
16
|
+
border-top-right-radius: var(--radius-small);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:last-child {
|
|
20
|
+
border-bottom-left-radius: var(--radius-small);
|
|
21
|
+
border-bottom-right-radius: var(--radius-small);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
.np-theme-personal {
|
|
20
27
|
.np-upload-input {
|
|
21
|
-
border-radius: var(--radius-small);
|
|
22
|
-
|
|
23
28
|
&.disabled .btn {
|
|
24
29
|
cursor: inherit;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
.np-upload-button {
|
|
28
|
-
border-radius: @small-border-minus-one;
|
|
29
|
-
padding: var(--padding-small);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.np-upload-input--square-top {
|
|
33
|
-
border-top-right-radius: 0px;
|
|
34
|
-
border-top-left-radius: 0px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.np-upload-item__remove-button {
|
|
38
|
-
border-radius: unset;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
32
|
.np-upload-icon {
|
|
42
33
|
color: var(--color-interactive-primary);
|
|
43
34
|
}
|
|
44
35
|
|
|
45
36
|
.media-body {
|
|
37
|
+
padding-right: var(--size-32);
|
|
46
38
|
color: var(--color-content-link);
|
|
47
39
|
white-space: break-spaces;
|
|
48
40
|
|
|
41
|
+
@media (--screen-400-zoom) {
|
|
42
|
+
padding-right: var(--size-64);
|
|
43
|
+
}
|
|
44
|
+
|
|
49
45
|
.np-text-body-large-bold {
|
|
50
46
|
text-decoration: underline;
|
|
51
47
|
.link-underline();
|
|
@@ -62,6 +58,11 @@
|
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
&-errors {
|
|
62
|
+
padding-left: 0;
|
|
63
|
+
list-style-position: inside;
|
|
64
|
+
}
|
|
65
|
+
|
|
65
66
|
.status-circle {
|
|
66
67
|
width: var(--size-x-small);
|
|
67
68
|
height: var(--size-x-small);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { within } from '@testing-library/react';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
2
|
+
import { userEvent } from '@testing-library/user-event';
|
|
3
3
|
|
|
4
4
|
import { Status } from '../common';
|
|
5
5
|
import { mockMatchMedia, render, screen, waitFor, waitForElementToBeRemoved } from '../test-utils';
|
|
@@ -9,6 +9,8 @@ import { TEST_IDS as UPLOAD_BUTTON_TEST_IDS } from './uploadButton/UploadButton'
|
|
|
9
9
|
import { TEST_IDS as UPLOAD_ITEM_TEST_IDS } from './uploadItem/UploadItem';
|
|
10
10
|
import { act } from 'react';
|
|
11
11
|
|
|
12
|
+
const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTimeAsync });
|
|
13
|
+
|
|
12
14
|
mockMatchMedia();
|
|
13
15
|
|
|
14
16
|
describe('UploadInput', () => {
|
|
@@ -58,10 +60,7 @@ describe('UploadInput', () => {
|
|
|
58
60
|
renderComponent({ ...props, onFilesChange });
|
|
59
61
|
|
|
60
62
|
const input = screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);
|
|
61
|
-
|
|
62
|
-
await act(async () => {
|
|
63
|
-
await jest.runOnlyPendingTimersAsync();
|
|
64
|
-
});
|
|
63
|
+
await user.upload(input, [pngFile, jpgFile]);
|
|
65
64
|
|
|
66
65
|
expect(props.onUploadFile).toHaveBeenCalledTimes(1);
|
|
67
66
|
expect(onFilesChange).toHaveBeenCalledTimes(2);
|
|
@@ -116,7 +115,7 @@ describe('UploadInput', () => {
|
|
|
116
115
|
expect(screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput)).toHaveAttribute('multiple');
|
|
117
116
|
|
|
118
117
|
const input = screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);
|
|
119
|
-
|
|
118
|
+
await user.upload(input, [pngFile, jpgFile]);
|
|
120
119
|
|
|
121
120
|
await waitFor(() => {
|
|
122
121
|
expect(props.onUploadFile).toHaveBeenCalledTimes(2);
|
|
@@ -244,11 +243,11 @@ describe('UploadInput', () => {
|
|
|
244
243
|
});
|
|
245
244
|
|
|
246
245
|
const input = screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);
|
|
247
|
-
|
|
246
|
+
await user.upload(input, [pngFile, jpgFile]);
|
|
248
247
|
|
|
249
248
|
const pngFile2 = new File(['foo2'], 'foo2.png', { type: 'image/png' });
|
|
250
249
|
const jpgFile2 = new File(['foo2'], 'foo2.jpg', { type: 'image/jpeg' });
|
|
251
|
-
|
|
250
|
+
await user.upload(input, [pngFile2, jpgFile2]);
|
|
252
251
|
|
|
253
252
|
await waitFor(() => {
|
|
254
253
|
expect(screen.getByText(maxFilesReachedMessage)).toBeInTheDocument();
|
|
@@ -274,7 +273,7 @@ describe('UploadInput', () => {
|
|
|
274
273
|
const input = screen.getByTestId(UPLOAD_BUTTON_TEST_IDS.uploadInput);
|
|
275
274
|
const pngFile2 = new File(['foo2'], 'foo2.png', { type: 'image/png' });
|
|
276
275
|
|
|
277
|
-
|
|
276
|
+
await user.upload(input, [pngFile, jpgFile, pngFile2]);
|
|
278
277
|
|
|
279
278
|
await waitFor(() => {
|
|
280
279
|
expect(screen.getByText(defaultMaxFilesReachedMessage)).toBeInTheDocument();
|
|
@@ -305,7 +304,7 @@ describe('UploadInput', () => {
|
|
|
305
304
|
const overSizedFile = new File([''], 'testFile.png', { type: 'image/png' });
|
|
306
305
|
Object.defineProperty(overSizedFile, 'size', { value: twoKbInBytes });
|
|
307
306
|
|
|
308
|
-
|
|
307
|
+
await user.upload(input, overSizedFile);
|
|
309
308
|
await waitFor(() => {
|
|
310
309
|
expect(screen.getByText(sizeLimitErrorMessage)).toBeInTheDocument();
|
|
311
310
|
});
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Story, Meta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
import { Status } from '../common';
|
|
1
|
+
import { StoryFn, Meta } from '@storybook/react';
|
|
5
2
|
|
|
6
3
|
import UploadInput, { UploadInputProps } from './UploadInput';
|
|
7
4
|
import { UploadResponse } from './types';
|
|
@@ -13,31 +10,9 @@ const meta: Meta<typeof UploadInput> = {
|
|
|
13
10
|
};
|
|
14
11
|
|
|
15
12
|
export default meta;
|
|
13
|
+
type Story = StoryFn<UploadInputProps>;
|
|
16
14
|
|
|
17
|
-
const
|
|
18
|
-
{
|
|
19
|
-
id: 1,
|
|
20
|
-
filename: 'purchase-receipt.pdf',
|
|
21
|
-
url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: 2,
|
|
25
|
-
filename: 'receipt failed.png',
|
|
26
|
-
status: Status.FAILED,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 3,
|
|
30
|
-
filename: 'receipt failed with error string.png',
|
|
31
|
-
status: Status.SUCCEEDED,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 4,
|
|
35
|
-
filename: 'receipt failed with error object.png',
|
|
36
|
-
status: Status.SUCCEEDED,
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
const createDelayedPromise = ({
|
|
15
|
+
const createDelayedPromise = async ({
|
|
41
16
|
successful = true,
|
|
42
17
|
delaySeconds = 3,
|
|
43
18
|
response = { id: Math.round(Math.random() * 10000), url: '#' },
|
|
@@ -54,115 +29,18 @@ const createDelayedPromise = ({
|
|
|
54
29
|
});
|
|
55
30
|
|
|
56
31
|
const props = {
|
|
57
|
-
onUploadFile: (
|
|
32
|
+
onUploadFile: async () => {
|
|
58
33
|
return createDelayedPromise();
|
|
59
34
|
},
|
|
60
|
-
onDeleteFile: (
|
|
35
|
+
onDeleteFile: async () => {
|
|
61
36
|
return createDelayedPromise();
|
|
62
37
|
},
|
|
63
38
|
};
|
|
64
39
|
|
|
65
|
-
const Template: Story
|
|
40
|
+
const Template: Story = (args: UploadInputProps) => <UploadInput {...args} />;
|
|
66
41
|
|
|
67
|
-
export const SingleFile: Story
|
|
42
|
+
export const SingleFile: Story = Template.bind({});
|
|
68
43
|
SingleFile.args = { ...props };
|
|
69
44
|
|
|
70
|
-
export const MultipleFiles: Story
|
|
45
|
+
export const MultipleFiles: Story = Template.bind({});
|
|
71
46
|
MultipleFiles.args = { ...props, multiple: true };
|
|
72
|
-
|
|
73
|
-
export const UploadInputWithDescriptionFromProps: Story<UploadInputProps> = Template.bind({});
|
|
74
|
-
UploadInputWithDescriptionFromProps.args = {
|
|
75
|
-
...props,
|
|
76
|
-
multiple: true,
|
|
77
|
-
description: 'Custom file description from prop',
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const Disabled: Story<UploadInputProps> = Template.bind({});
|
|
81
|
-
Disabled.args = { ...props, disabled: true };
|
|
82
|
-
|
|
83
|
-
export const WithAnyFileType: Story<UploadInputProps> = Template.bind({});
|
|
84
|
-
WithAnyFileType.args = { ...props, fileTypes: '*' };
|
|
85
|
-
|
|
86
|
-
export const WithSingleFileType: Story<UploadInputProps> = Template.bind({});
|
|
87
|
-
WithSingleFileType.args = { ...props, fileTypes: '.zip,application/zip' };
|
|
88
|
-
|
|
89
|
-
export const WithMultipleExistingFiles: Story<UploadInputProps> = Template.bind({});
|
|
90
|
-
WithMultipleExistingFiles.args = {
|
|
91
|
-
...props,
|
|
92
|
-
files,
|
|
93
|
-
multiple: true,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const WithoutDelete: Story<UploadInputProps> = Template.bind({});
|
|
97
|
-
WithoutDelete.args = {
|
|
98
|
-
...props,
|
|
99
|
-
files,
|
|
100
|
-
onDeleteFile: undefined,
|
|
101
|
-
multiple: true,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const WithUploadFailed: Story<UploadInputProps> = Template.bind({});
|
|
105
|
-
WithUploadFailed.args = {
|
|
106
|
-
...props,
|
|
107
|
-
files: files.slice(0),
|
|
108
|
-
onUploadFile: () => createDelayedPromise({ successful: false }),
|
|
109
|
-
multiple: true,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const WithDeleteFailed: Story<UploadInputProps> = Template.bind({});
|
|
113
|
-
WithDeleteFailed.args = {
|
|
114
|
-
...props,
|
|
115
|
-
files: files.slice(0),
|
|
116
|
-
onDeleteFile: () => createDelayedPromise({ successful: false }),
|
|
117
|
-
multiple: true,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const CustomConfirmMessage: Story<UploadInputProps> = Template.bind({});
|
|
121
|
-
CustomConfirmMessage.args = {
|
|
122
|
-
...props,
|
|
123
|
-
files: files.slice(0),
|
|
124
|
-
deleteConfirm: {
|
|
125
|
-
title: 'Sure you want to remove this invoice?',
|
|
126
|
-
body: (
|
|
127
|
-
<img
|
|
128
|
-
alt="brand logo"
|
|
129
|
-
src="https://wise.com/public-resources/assets/logos/wise/brand_logo.svg"
|
|
130
|
-
/>
|
|
131
|
-
),
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const withManualDownloadHandler: Story<UploadInputProps> = Template.bind({});
|
|
136
|
-
withManualDownloadHandler.args = {
|
|
137
|
-
...props,
|
|
138
|
-
files,
|
|
139
|
-
onDownload: action('Manual download handler'),
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const withFilesChangeHandler: Story<UploadInputProps> = Template.bind({});
|
|
143
|
-
withFilesChangeHandler.args = {
|
|
144
|
-
...props,
|
|
145
|
-
files,
|
|
146
|
-
onFilesChange: action('Files change handler'),
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const withMaxFilesToUploadLimit: Story<UploadInputProps> = Template.bind({});
|
|
150
|
-
withMaxFilesToUploadLimit.args = {
|
|
151
|
-
...props,
|
|
152
|
-
multiple: true,
|
|
153
|
-
maxFiles: 5,
|
|
154
|
-
maxFilesErrorMessage: "Can't upload as maximum number of files allowed are already uploaded",
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export const withFileSizeErrorMessage: Story<UploadInputProps> = Template.bind({});
|
|
158
|
-
withFileSizeErrorMessage.args = {
|
|
159
|
-
...props,
|
|
160
|
-
sizeLimit: 1,
|
|
161
|
-
sizeLimitErrorMessage: 'The file is oversized',
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export const withCustomUploadButtonTitle: Story<UploadInputProps> = Template.bind({});
|
|
165
|
-
withCustomUploadButtonTitle.args = {
|
|
166
|
-
...props,
|
|
167
|
-
uploadButtonTitle: 'Upload the VAT receipts for FY 2022-23',
|
|
168
|
-
};
|