@transferwise/components 46.36.1 → 46.38.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 +169 -348
- package/build/index.js.map +1 -1
- package/build/index.mjs +164 -342
- 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/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- 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 +4 -5
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/alert/Alert.d.ts +1 -2
- 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 +3 -3
- 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 +1 -2
- package/build/types/chips/Chip.d.ts.map +1 -1
- package/build/types/chips/Chips.d.ts +1 -2
- 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/bottomSheet/BottomSheet.d.ts +2 -2
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +5 -6
- 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/flowHeader/FlowHeader.d.ts +1 -1
- package/build/types/common/flowHeader/FlowHeader.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 +1 -2
- package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +11 -11
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +1 -2
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +9 -10
- 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 +3 -3
- 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 +1 -2
- 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 +3 -3
- package/build/types/flowNavigation/backButton/index.d.ts +1 -1
- 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 +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +0 -1
- package/build/types/info/Info.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 +1 -2
- 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 +1 -2
- 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 +1 -2
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts +1 -2
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_ButtonInput.d.ts +1 -2
- 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/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 +1 -2
- package/build/types/progress/Progress.d.ts.map +1 -1
- package/build/types/progressBar/ProgressBar.d.ts +1 -2
- package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +1 -1
- package/build/types/promoCard/PromoCard.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/provider/direction/DirectionProvider.d.ts +2 -2
- package/build/types/provider/direction/DirectionProvider.d.ts.map +1 -1
- package/build/types/provider/language/LanguageProvider.d.ts +2 -2
- package/build/types/provider/language/LanguageProvider.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/Option.d.ts +2 -1
- package/build/types/select/option/Option.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 +2 -2
- 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 +3 -4
- 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 +1 -1
- 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/tooltip/Tooltip.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 +1 -2
- 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 +4 -4
- 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 +3 -4
- package/src/accordion/AccordionItem/AccordionItem.tsx +5 -2
- package/src/actionOption/ActionOption.tsx +4 -5
- package/src/alert/Alert.tsx +1 -1
- package/src/alert/inlineMarkdown/InlineMarkdown.tsx +13 -0
- package/src/alert/inlineMarkdown/index.ts +2 -0
- package/src/body/Body.tsx +4 -3
- 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/checkbox/{Checkbox.spec.js → Checkbox.spec.tsx} +5 -5
- package/src/checkbox/{Checkbox.js → Checkbox.tsx} +19 -41
- package/src/checkbox/index.ts +2 -0
- package/src/chips/Chip.tsx +5 -6
- package/src/chips/Chips.tsx +1 -2
- package/src/common/bottomSheet/BottomSheet.tsx +2 -9
- package/src/common/closeButton/CloseButton.tsx +1 -1
- package/src/common/flowHeader/FlowHeader.tsx +1 -1
- package/src/common/hooks/useResizeObserver.ts +1 -1
- package/src/common/panel/Panel.spec.tsx +1 -1
- package/src/common/panel/Panel.tsx +7 -7
- package/src/common/polymorphicWithOverrides/PolymorphicWithOverrides.tsx +1 -1
- 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.tsx +2 -10
- package/src/drawer/{Drawer.rtl.spec.js → Drawer.rtl.spec.tsx} +4 -2
- 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.tsx +1 -3
- package/src/index.ts +4 -0
- package/src/inputs/Input.tsx +1 -1
- package/src/inputs/SearchInput.tsx +1 -1
- package/src/inputs/SelectInput.tsx +4 -4
- package/src/inputs/TextArea.tsx +1 -1
- package/src/inputs/_BottomSheet.tsx +1 -1
- package/src/inputs/_ButtonInput.tsx +1 -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/progress/Progress.tsx +3 -15
- package/src/progressBar/ProgressBar.tsx +1 -2
- package/src/promoCard/PromoCard.tsx +2 -2
- package/src/promoCard/PromoCardContext.spec.tsx +1 -1
- package/src/provider/direction/DirectionProvider.tsx +2 -5
- package/src/provider/language/LanguageProvider.tsx +2 -2
- package/src/section/Section.story.tsx +0 -2
- package/src/segmentedControl/SegmentedControl.tsx +2 -2
- package/src/select/option/Option.tsx +6 -18
- package/src/slidingPanel/SlidingPanel.spec.js +2 -1
- package/src/slidingPanel/SlidingPanel.tsx +4 -1
- 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/ssr.spec.js +6 -0
- 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/switchOption/SwitchOption.tsx +5 -7
- package/src/tabs/Tabs.js +3 -3
- package/src/test-utils/Parameters.d.ts +8 -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.tsx +2 -1
- package/src/uploadInput/UploadInput.css +25 -27
- package/src/uploadInput/UploadInput.less +24 -23
- package/src/uploadInput/UploadInput.story.tsx +60 -10
- package/src/uploadInput/UploadInput.tsx +3 -6
- 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 +0 -1
- 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.tsx +33 -29
- package/src/uploadInput/uploadItem/UploadItemBody.tsx +1 -1
- package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -3
- 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/logo/index.js +0 -2
- package/src/logo/logoTypes.ts +0 -6
- package/src/snackbar/Snackbar.spec.js +0 -112
- package/src/sticky/Sticky.spec.js +0 -34
- /package/src/card/{Card.spec.js → Card.spec.tsx} +0 -0
- /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/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
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { PromoCardContext, usePromoCardContext } from './PromoCardContext';
|
|
5
5
|
|
|
6
6
|
// A simple component that consumes the context
|
|
7
|
-
const TestComponent: React.FC = () => {
|
|
7
|
+
const TestComponent: React.FC<Record<string, never>> = () => {
|
|
8
8
|
const context = usePromoCardContext();
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
import { LayoutDirection, Direction } from '../../common/direction';
|
|
4
4
|
|
|
@@ -6,9 +6,6 @@ export const DirectionContext = createContext<LayoutDirection>(Direction.LTR);
|
|
|
6
6
|
|
|
7
7
|
export type DirectionProviderProps = PropsWithChildren<{ direction: LayoutDirection }>;
|
|
8
8
|
|
|
9
|
-
export const DirectionProvider = ({
|
|
10
|
-
direction,
|
|
11
|
-
children,
|
|
12
|
-
}: DirectionProviderProps): ReactElement => {
|
|
9
|
+
export const DirectionProvider = ({ direction, children }: DirectionProviderProps) => {
|
|
13
10
|
return <DirectionContext.Provider value={direction}>{children}</DirectionContext.Provider>;
|
|
14
11
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_LOCALE } from '../../common/locale';
|
|
4
4
|
|
|
@@ -6,6 +6,6 @@ export const LanguageContext = createContext<string>(DEFAULT_LOCALE);
|
|
|
6
6
|
|
|
7
7
|
export type LanguageProviderProps = PropsWithChildren<{ locale: string }>;
|
|
8
8
|
|
|
9
|
-
export const LanguageProvider = ({ locale, children }: LanguageProviderProps)
|
|
9
|
+
export const LanguageProvider = ({ locale, children }: LanguageProviderProps) => {
|
|
10
10
|
return <LanguageContext.Provider value={locale}>{children}</LanguageContext.Provider>;
|
|
11
11
|
};
|
|
@@ -83,7 +83,6 @@ export const WithCards = () => {
|
|
|
83
83
|
return (
|
|
84
84
|
<Section>
|
|
85
85
|
<Header title="Section with cards" />
|
|
86
|
-
{/* @ts-expect-error TODO: remove once Card is migrated to TypeScript */}
|
|
87
86
|
<Card
|
|
88
87
|
title="What's in the box?!"
|
|
89
88
|
details="Click me to reveal."
|
|
@@ -93,7 +92,6 @@ export const WithCards = () => {
|
|
|
93
92
|
>
|
|
94
93
|
<div>Hello there!</div>
|
|
95
94
|
</Card>
|
|
96
|
-
{/* @ts-expect-error TODO: remove once Card is migrated to TypeScript */}
|
|
97
95
|
<Card
|
|
98
96
|
title="What's in the box?!"
|
|
99
97
|
details="Click me to reveal."
|
|
@@ -104,7 +104,7 @@ const SegmentedControl = ({
|
|
|
104
104
|
};
|
|
105
105
|
return mode === 'input' ? (
|
|
106
106
|
<label
|
|
107
|
-
ref={segment.ref as React.
|
|
107
|
+
ref={segment.ref as React.MutableRefObject<HTMLLabelElement | null>}
|
|
108
108
|
key={segment.id}
|
|
109
109
|
htmlFor={segment.id}
|
|
110
110
|
className={classNames('segmented-control__segment', {
|
|
@@ -132,7 +132,7 @@ const SegmentedControl = ({
|
|
|
132
132
|
</label>
|
|
133
133
|
) : (
|
|
134
134
|
<button
|
|
135
|
-
ref={segment.ref as React.
|
|
135
|
+
ref={segment.ref as React.MutableRefObject<HTMLButtonElement | null>}
|
|
136
136
|
key={segment.id}
|
|
137
137
|
type="button"
|
|
138
138
|
role="tab"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IdIconProps } from '@transferwise/icons';
|
|
1
2
|
import { Flag } from '@wise/art';
|
|
2
|
-
import
|
|
3
|
+
import classNames from 'classnames';
|
|
3
4
|
import { cloneElement, ReactElement, ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
import Body from '../../body';
|
|
@@ -12,6 +13,7 @@ export type Props<T> = {
|
|
|
12
13
|
note?: ReactNode;
|
|
13
14
|
secondary?: ReactNode;
|
|
14
15
|
icon?: ReactNode;
|
|
16
|
+
/** @deprecated */
|
|
15
17
|
classNames?: Record<string, string>;
|
|
16
18
|
selected?: boolean;
|
|
17
19
|
};
|
|
@@ -22,13 +24,10 @@ function Option<T>({
|
|
|
22
24
|
note = '',
|
|
23
25
|
secondary = '',
|
|
24
26
|
icon,
|
|
25
|
-
classNames = {},
|
|
26
27
|
selected = false,
|
|
27
28
|
}: Props<T>) {
|
|
28
|
-
const { isModern } = useTheme();
|
|
29
|
-
|
|
30
29
|
const iconElement = icon
|
|
31
|
-
? cloneElement(icon as ReactElement
|
|
30
|
+
? cloneElement(icon as ReactElement<IdIconProps>, {
|
|
32
31
|
size: 24,
|
|
33
32
|
className: 'tw-icon',
|
|
34
33
|
})
|
|
@@ -38,26 +37,15 @@ function Option<T>({
|
|
|
38
37
|
<Body as="span" type={Typography.BODY_LARGE} className={selected ? 'text-ellipsis' : undefined}>
|
|
39
38
|
{label}
|
|
40
39
|
{note && (
|
|
41
|
-
<Body as="span" className=
|
|
40
|
+
<Body as="span" className="m-l-1">
|
|
42
41
|
{note}
|
|
43
42
|
</Body>
|
|
44
43
|
)}
|
|
45
44
|
</Body>
|
|
46
45
|
);
|
|
47
46
|
|
|
48
|
-
const secondaryElementClassNames = (): string | undefined => {
|
|
49
|
-
let classes: string | undefined = undefined;
|
|
50
|
-
if (selected) {
|
|
51
|
-
classes = 'text-ellipsis';
|
|
52
|
-
}
|
|
53
|
-
if (isModern) {
|
|
54
|
-
return classes;
|
|
55
|
-
}
|
|
56
|
-
return `${classes ? classes + ' ' : ''}body-2`;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
47
|
const secondaryElement = secondary && (
|
|
60
|
-
<Body className={
|
|
48
|
+
<Body className={classNames(selected && 'text-ellipsis')}>{secondary}</Body>
|
|
61
49
|
);
|
|
62
50
|
|
|
63
51
|
return iconElement ? (
|
|
@@ -11,6 +11,7 @@ describe('SlidingPanel', () => {
|
|
|
11
11
|
className: undefined,
|
|
12
12
|
slidingPanelPositionFixed: false,
|
|
13
13
|
showSlidingPanelBorder: false,
|
|
14
|
+
testId: undefined,
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
it('renders with right props', () => {
|
|
@@ -24,7 +25,7 @@ describe('SlidingPanel', () => {
|
|
|
24
25
|
|
|
25
26
|
expect(cssTransition()).toHaveLength(1);
|
|
26
27
|
|
|
27
|
-
expect(cssTransition().props()).
|
|
28
|
+
expect(cssTransition().props()).toEqual({
|
|
28
29
|
className: 'sliding-panel sliding-panel--open-left',
|
|
29
30
|
children: null,
|
|
30
31
|
});
|
|
@@ -12,6 +12,7 @@ export interface SlidingPanelProps
|
|
|
12
12
|
open: boolean;
|
|
13
13
|
showSlidingPanelBorder?: boolean;
|
|
14
14
|
slidingPanelPositionFixed?: boolean;
|
|
15
|
+
testId?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const SlidingPanel = forwardRef(
|
|
@@ -23,9 +24,10 @@ const SlidingPanel = forwardRef(
|
|
|
23
24
|
slidingPanelPositionFixed,
|
|
24
25
|
className,
|
|
25
26
|
children,
|
|
27
|
+
testId,
|
|
26
28
|
...rest
|
|
27
29
|
}: Omit<SlidingPanelProps, 'ref'>,
|
|
28
|
-
reference: React.ForwardedRef<HTMLDivElement>,
|
|
30
|
+
reference: React.ForwardedRef<HTMLDivElement | null>,
|
|
29
31
|
) => {
|
|
30
32
|
const localReference = useRef<HTMLDivElement>(null as never);
|
|
31
33
|
useImperativeHandle(reference, () => localReference.current, []);
|
|
@@ -44,6 +46,7 @@ const SlidingPanel = forwardRef(
|
|
|
44
46
|
>
|
|
45
47
|
<div
|
|
46
48
|
ref={localReference}
|
|
49
|
+
data-testid={testId}
|
|
47
50
|
className={classNames(
|
|
48
51
|
'sliding-panel',
|
|
49
52
|
`sliding-panel--open-${position}`,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { number } from '@storybook/addon-knobs';
|
|
3
|
-
import { StoryContext } from '@storybook/react';
|
|
4
|
-
import { userEvent,
|
|
5
|
-
import {
|
|
3
|
+
import type { StoryContext } from '@storybook/react';
|
|
4
|
+
import { userEvent, within } from '@storybook/test';
|
|
5
|
+
import { wait } from '../test-utils/wait';
|
|
6
6
|
|
|
7
7
|
import Button from '../button';
|
|
8
|
-
import CheckboxOption from '../checkboxOption/CheckboxOption';
|
|
9
|
-
import { wait } from '../test-utils/wait';
|
|
10
8
|
|
|
11
9
|
import { Snackbar } from './Snackbar';
|
|
12
10
|
import { SnackbarConsumer } from './SnackbarContext';
|
|
@@ -17,113 +15,35 @@ export default {
|
|
|
17
15
|
title: 'Dialogs/Snackbar',
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
export const
|
|
18
|
+
export const Basic = () => {
|
|
21
19
|
const timeout = number('timeout (ms)', 10000000);
|
|
22
20
|
|
|
23
21
|
return (
|
|
24
22
|
<SnackbarProvider timeout={timeout}>
|
|
25
23
|
<SnackbarConsumer>
|
|
26
24
|
{({ createSnackbar }) => (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Button>
|
|
42
|
-
<div className="p-t-3">
|
|
43
|
-
<CheckboxOption
|
|
44
|
-
title="In mobile view, snackbar is full-width, not centered"
|
|
45
|
-
media={<Mobile />}
|
|
46
|
-
/>
|
|
47
|
-
<CheckboxOption
|
|
48
|
-
title="In RTL, snackbar is not left aligned"
|
|
49
|
-
content={
|
|
50
|
-
<a
|
|
51
|
-
href="https://transferwise.atlassian.net/browse/DS-4642"
|
|
52
|
-
target="_blank"
|
|
53
|
-
rel="noreferrer"
|
|
54
|
-
>
|
|
55
|
-
Bug DS-4642
|
|
56
|
-
</a>
|
|
57
|
-
}
|
|
58
|
-
media={<Switch />}
|
|
59
|
-
/>
|
|
60
|
-
<CheckboxOption
|
|
61
|
-
title="In RTL, snackbar has proper padding on left and right of button"
|
|
62
|
-
content={
|
|
63
|
-
<a
|
|
64
|
-
href="https://transferwise.atlassian.net/browse/DS-4643"
|
|
65
|
-
target="_blank"
|
|
66
|
-
rel="noreferrer"
|
|
67
|
-
>
|
|
68
|
-
Bug DS-4643
|
|
69
|
-
</a>
|
|
70
|
-
}
|
|
71
|
-
media={<Switch />}
|
|
72
|
-
/>
|
|
73
|
-
<CheckboxOption
|
|
74
|
-
title="In light mode, snackbar has drop shadow"
|
|
75
|
-
content={
|
|
76
|
-
<a
|
|
77
|
-
href="https://transferwise.atlassian.net/browse/DS-4477"
|
|
78
|
-
target="_blank"
|
|
79
|
-
rel="noreferrer"
|
|
80
|
-
>
|
|
81
|
-
Bug DS-4477
|
|
82
|
-
</a>
|
|
83
|
-
}
|
|
84
|
-
media={<Bulb />}
|
|
85
|
-
/>
|
|
86
|
-
<CheckboxOption title="In dark mode, snackbar has no drop shadow" media={<Theme />} />
|
|
87
|
-
<CheckboxOption
|
|
88
|
-
title="In dark mode, snackbar is inverted and has light background"
|
|
89
|
-
media={<Theme />}
|
|
90
|
-
/>
|
|
91
|
-
<CheckboxOption
|
|
92
|
-
title="Font size is 14 px, not 16px"
|
|
93
|
-
content={
|
|
94
|
-
<a
|
|
95
|
-
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
96
|
-
target="_blank"
|
|
97
|
-
rel="noreferrer"
|
|
98
|
-
>
|
|
99
|
-
Bug DS-3716
|
|
100
|
-
</a>
|
|
101
|
-
}
|
|
102
|
-
media={<Info size="16" />}
|
|
103
|
-
/>
|
|
104
|
-
<CheckboxOption
|
|
105
|
-
title="Snackbar isn't transparent (get some text behind it to make sure)"
|
|
106
|
-
content={
|
|
107
|
-
<a
|
|
108
|
-
href="https://transferwise.atlassian.net/browse/DS-3740"
|
|
109
|
-
target="_blank"
|
|
110
|
-
rel="noreferrer"
|
|
111
|
-
>
|
|
112
|
-
Bug DS-3740
|
|
113
|
-
</a>
|
|
114
|
-
}
|
|
115
|
-
media={<Coins />}
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
</>
|
|
25
|
+
<Button
|
|
26
|
+
block
|
|
27
|
+
onClick={() => {
|
|
28
|
+
createSnackbar({
|
|
29
|
+
action: {
|
|
30
|
+
label: 'View',
|
|
31
|
+
onClick: () => action('View button clicked.'),
|
|
32
|
+
},
|
|
33
|
+
text: <span>Some text</span>,
|
|
34
|
+
});
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
Show Snackbar
|
|
38
|
+
</Button>
|
|
119
39
|
)}
|
|
120
40
|
</SnackbarConsumer>
|
|
121
41
|
</SnackbarProvider>
|
|
122
42
|
);
|
|
123
43
|
};
|
|
124
44
|
|
|
125
|
-
|
|
126
|
-
await wait(0);
|
|
45
|
+
Basic.play = async ({ canvasElement }: StoryContext) => {
|
|
46
|
+
await wait(0);
|
|
127
47
|
const canvas = within(canvasElement);
|
|
128
48
|
await userEvent.click(canvas.getByRole('button'));
|
|
129
49
|
};
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import { Mobile as MobileIcon, Theme, Switch, Bulb, Info, Coins, Team } from '@transferwise/icons';
|
|
4
|
+
import { Snackbar, type SnackbarProps } from './Snackbar';
|
|
5
|
+
import { SnackbarConsumer } from './SnackbarContext';
|
|
6
|
+
import SnackbarProvider from './SnackbarProvider';
|
|
7
|
+
import Button from '../button';
|
|
8
|
+
import CheckboxOption from '../checkboxOption';
|
|
9
|
+
import { storyConfig } from '../test-utils';
|
|
10
|
+
import { wait } from '../test-utils/wait';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Dialogs/Snackbar/Tests',
|
|
14
|
+
component: Snackbar,
|
|
15
|
+
argTypes: {},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const launchSnackbar = async (canvasElement: HTMLElement) => {
|
|
19
|
+
await wait(0);
|
|
20
|
+
const canvas = within(canvasElement);
|
|
21
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type Args = Partial<SnackbarProps> & {
|
|
25
|
+
extraContext: React.ReactNode;
|
|
26
|
+
timeout: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const TIMEOUT = 10000000;
|
|
30
|
+
|
|
31
|
+
const Default = {
|
|
32
|
+
args: {
|
|
33
|
+
timeout: TIMEOUT,
|
|
34
|
+
} as Args,
|
|
35
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
36
|
+
await launchSnackbar(canvasElement);
|
|
37
|
+
},
|
|
38
|
+
render: (args: Args) => {
|
|
39
|
+
return (
|
|
40
|
+
<SnackbarProvider timeout={args.timeout}>
|
|
41
|
+
<SnackbarConsumer>
|
|
42
|
+
{({ createSnackbar }) => (
|
|
43
|
+
<>
|
|
44
|
+
<Button
|
|
45
|
+
block
|
|
46
|
+
onClick={() => {
|
|
47
|
+
createSnackbar({
|
|
48
|
+
action: {
|
|
49
|
+
label: 'View',
|
|
50
|
+
onClick: () => action('View button clicked.'),
|
|
51
|
+
},
|
|
52
|
+
text: <span>Some text</span>,
|
|
53
|
+
});
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
Show Snackbar
|
|
57
|
+
</Button>
|
|
58
|
+
{args.extraContext}
|
|
59
|
+
</>
|
|
60
|
+
)}
|
|
61
|
+
</SnackbarConsumer>
|
|
62
|
+
</SnackbarProvider>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Basic = {
|
|
68
|
+
args: {
|
|
69
|
+
...Default.args,
|
|
70
|
+
extraContext: (
|
|
71
|
+
<div className="p-t-3">
|
|
72
|
+
<CheckboxOption
|
|
73
|
+
title="In light mode, snackbar has drop shadow"
|
|
74
|
+
content={
|
|
75
|
+
<a
|
|
76
|
+
href="https://transferwise.atlassian.net/browse/DS-4477"
|
|
77
|
+
target="_blank"
|
|
78
|
+
rel="noreferrer"
|
|
79
|
+
>
|
|
80
|
+
Bug DS-4477
|
|
81
|
+
</a>
|
|
82
|
+
}
|
|
83
|
+
media={<Bulb />}
|
|
84
|
+
/>
|
|
85
|
+
<CheckboxOption
|
|
86
|
+
title="Font size is 14 px, not 16px"
|
|
87
|
+
content={
|
|
88
|
+
<a
|
|
89
|
+
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
90
|
+
target="_blank"
|
|
91
|
+
rel="noreferrer"
|
|
92
|
+
>
|
|
93
|
+
Bug DS-3716
|
|
94
|
+
</a>
|
|
95
|
+
}
|
|
96
|
+
media={<Info size="16" />}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
) as React.ReactNode,
|
|
100
|
+
},
|
|
101
|
+
play: Default.play,
|
|
102
|
+
render: Default.render,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const Mobile = storyConfig(
|
|
106
|
+
{
|
|
107
|
+
args: {
|
|
108
|
+
...Default.args,
|
|
109
|
+
extraContext: (
|
|
110
|
+
<div className="p-t-3">
|
|
111
|
+
<CheckboxOption
|
|
112
|
+
title="In mobile view, snackbar is full-width, not centered"
|
|
113
|
+
media={<MobileIcon />}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
) as React.ReactNode,
|
|
117
|
+
},
|
|
118
|
+
play: Default.play,
|
|
119
|
+
render: Default.render,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
variants: ['mobile'],
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const switchToDarkMode = async (context: { canvasElement: HTMLElement }) => {
|
|
127
|
+
await Default.play(context);
|
|
128
|
+
|
|
129
|
+
// the snackbar is outside the storybook dom so dark mode doesn't apply
|
|
130
|
+
const body = document.querySelector('div.np-theme-personal');
|
|
131
|
+
if (body) {
|
|
132
|
+
body.setAttribute('class', 'np-theme-personal--dark');
|
|
133
|
+
}
|
|
134
|
+
const snackbar = document.querySelector('div.snackbar');
|
|
135
|
+
if (snackbar) {
|
|
136
|
+
snackbar.setAttribute('class', 'snackbar np-theme-personal--dark');
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const DarkMode = storyConfig(
|
|
141
|
+
{
|
|
142
|
+
args: {
|
|
143
|
+
...Default.args,
|
|
144
|
+
extraContext: (
|
|
145
|
+
<div className="p-t-3">
|
|
146
|
+
<CheckboxOption title="In dark mode, snackbar has no drop shadow" media={<Theme />} />
|
|
147
|
+
<CheckboxOption
|
|
148
|
+
title="In dark mode, snackbar is inverted and has light background"
|
|
149
|
+
media={<Theme />}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
) as React.ReactNode,
|
|
153
|
+
},
|
|
154
|
+
play: switchToDarkMode,
|
|
155
|
+
render: Default.render,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
variants: ['dark'],
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const switchToRTL = async (context: { canvasElement: HTMLElement }) => {
|
|
163
|
+
await Default.play(context);
|
|
164
|
+
// the snackbar is outside the storybook dom so the RTL variant doesn't apply
|
|
165
|
+
const body = document.querySelector('div.storybook-container');
|
|
166
|
+
if (body) {
|
|
167
|
+
body.setAttribute('dir', 'rtl');
|
|
168
|
+
}
|
|
169
|
+
const snackbar = document.querySelector('div.snackbar');
|
|
170
|
+
if (snackbar) {
|
|
171
|
+
snackbar.setAttribute('dir', 'rtl');
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const RTL = storyConfig(
|
|
176
|
+
{
|
|
177
|
+
args: {
|
|
178
|
+
...Default.args,
|
|
179
|
+
extraContext: (
|
|
180
|
+
<div className="p-t-3">
|
|
181
|
+
<CheckboxOption
|
|
182
|
+
title="In RTL, snackbar is not left aligned"
|
|
183
|
+
content={
|
|
184
|
+
<a
|
|
185
|
+
href="https://transferwise.atlassian.net/browse/DS-4642"
|
|
186
|
+
target="_blank"
|
|
187
|
+
rel="noreferrer"
|
|
188
|
+
>
|
|
189
|
+
Bug DS-4642
|
|
190
|
+
</a>
|
|
191
|
+
}
|
|
192
|
+
media={<Switch />}
|
|
193
|
+
/>
|
|
194
|
+
<CheckboxOption
|
|
195
|
+
title="In RTL, snackbar has proper padding on left and right of button"
|
|
196
|
+
content={
|
|
197
|
+
<a
|
|
198
|
+
href="https://transferwise.atlassian.net/browse/DS-4643"
|
|
199
|
+
target="_blank"
|
|
200
|
+
rel="noreferrer"
|
|
201
|
+
>
|
|
202
|
+
Bug DS-4643
|
|
203
|
+
</a>
|
|
204
|
+
}
|
|
205
|
+
media={<Switch />}
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
) as React.ReactNode,
|
|
209
|
+
},
|
|
210
|
+
play: switchToRTL,
|
|
211
|
+
render: Default.render,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
variants: ['rtl'],
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
export const RTLMobile = storyConfig(
|
|
219
|
+
{
|
|
220
|
+
args: {
|
|
221
|
+
...RTL.args,
|
|
222
|
+
},
|
|
223
|
+
play: switchToRTL,
|
|
224
|
+
render: Default.render,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
variants: ['rtl', 'mobile'],
|
|
228
|
+
},
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
export const Zoom400 = storyConfig(
|
|
232
|
+
{
|
|
233
|
+
args: {
|
|
234
|
+
...Default.args,
|
|
235
|
+
extraContext: (
|
|
236
|
+
<div className="p-t-3">
|
|
237
|
+
<CheckboxOption
|
|
238
|
+
content="Snackbar isn't transparent (I'm going to make this text very long so that it will fill up the entire page and go behind the snackbar. This way, when you look at it you will easily be able to tell if the snackbar is transparent and recognize the bug because we don't want it to be transparent. Transparent is bad. When we first did rebrand we had a lot of problems with transparencies. I don't know what happened to them. I don't see them a lot anymore but I also don't remember anybody fixing them.)"
|
|
239
|
+
title={
|
|
240
|
+
<a
|
|
241
|
+
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
242
|
+
target="_blank"
|
|
243
|
+
rel="noreferrer"
|
|
244
|
+
>
|
|
245
|
+
Bug DS-3716
|
|
246
|
+
</a>
|
|
247
|
+
}
|
|
248
|
+
media={<Coins />}
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
),
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
play: Default.play,
|
|
255
|
+
render: Default.render,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
variants: ['400%'],
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
export const MultipleClicks = {
|
|
263
|
+
args: {
|
|
264
|
+
...Default.args,
|
|
265
|
+
extraContext: (
|
|
266
|
+
<div className="p-t-3">
|
|
267
|
+
<CheckboxOption
|
|
268
|
+
title="Snackbar is only shown once even if clicked many times"
|
|
269
|
+
media={<Team />}
|
|
270
|
+
/>
|
|
271
|
+
</div>
|
|
272
|
+
),
|
|
273
|
+
},
|
|
274
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
275
|
+
const canvas = within(canvasElement);
|
|
276
|
+
for (let i = 0; i < 8; i += 1) {
|
|
277
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
render: Default.render,
|
|
281
|
+
};
|
|
@@ -3,7 +3,7 @@ import { CSSTransition } from 'react-transition-group';
|
|
|
3
3
|
|
|
4
4
|
import ActionButton from '../actionButton';
|
|
5
5
|
import Body from '../body';
|
|
6
|
-
import { Theme, ThemeDark, ThemeLight } from '../common';
|
|
6
|
+
import { Theme, type ThemeDark, type ThemeLight } from '../common';
|
|
7
7
|
import { DirectionContext } from '../provider/direction';
|
|
8
8
|
import withNextPortal from '../withNextPortal/withNextPortal';
|
|
9
9
|
|
|
@@ -15,6 +15,7 @@ export interface SnackbarProps {
|
|
|
15
15
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
16
16
|
};
|
|
17
17
|
text: React.ReactNode;
|
|
18
|
+
/** @deprecated */
|
|
18
19
|
theme?: ThemeLight | ThemeDark;
|
|
19
20
|
timeout: number;
|
|
20
21
|
timestamp: number;
|
|
@@ -66,10 +67,10 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
componentDidUpdate(previousProps: SnackbarProps) {
|
|
69
|
-
const { action, text,
|
|
70
|
+
const { action, text, timestamp } = this.props;
|
|
70
71
|
|
|
71
72
|
if (!previousProps.text) {
|
|
72
|
-
this.setState({ visible: true, action, text
|
|
73
|
+
this.setState({ visible: true, action, text }, () => {
|
|
73
74
|
this.setLeaveTimeout();
|
|
74
75
|
});
|
|
75
76
|
} else if (previousProps.timestamp !== timestamp) {
|
|
@@ -78,19 +79,19 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
78
79
|
if (this.state.visible) {
|
|
79
80
|
this.setState({ visible: false }, () => {
|
|
80
81
|
this.transitionTimeout = window.setTimeout(() => {
|
|
81
|
-
this.setState({ visible: true, action, text
|
|
82
|
+
this.setState({ visible: true, action, text });
|
|
82
83
|
this.setLeaveTimeout();
|
|
83
84
|
}, CSS_TRANSITION_DURATION);
|
|
84
85
|
});
|
|
85
86
|
} else {
|
|
86
|
-
this.setState({ visible: true, action, text
|
|
87
|
+
this.setState({ visible: true, action, text });
|
|
87
88
|
this.setLeaveTimeout();
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
render() {
|
|
93
|
-
const { action, text,
|
|
94
|
+
const { action, text, visible } = this.state;
|
|
94
95
|
const { timeout } = this.props;
|
|
95
96
|
|
|
96
97
|
return (
|
|
@@ -106,12 +107,7 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
106
107
|
}}
|
|
107
108
|
unmountOnExit
|
|
108
109
|
>
|
|
109
|
-
<Body
|
|
110
|
-
ref={this.bodyRef}
|
|
111
|
-
as="span"
|
|
112
|
-
className={`snackbar__text snackbar__text--${theme}`}
|
|
113
|
-
aria-live="polite"
|
|
114
|
-
>
|
|
110
|
+
<Body ref={this.bodyRef} as="span" className="snackbar__text" aria-live="polite">
|
|
115
111
|
{text}
|
|
116
112
|
{action ? (
|
|
117
113
|
<ActionButton className="snackbar__text__action" onClick={action.onClick}>
|
package/src/ssr.spec.js
CHANGED
|
@@ -194,6 +194,12 @@ describe('Server side rendering', () => {
|
|
|
194
194
|
Popover: {
|
|
195
195
|
children: <div />,
|
|
196
196
|
},
|
|
197
|
+
Progress: {
|
|
198
|
+
progress: { value: 50, max: 100 },
|
|
199
|
+
},
|
|
200
|
+
ProgressBar: {
|
|
201
|
+
progress: { value: 50, max: 100 },
|
|
202
|
+
},
|
|
197
203
|
Field: {
|
|
198
204
|
model: 'a model',
|
|
199
205
|
type: 'text',
|