@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,5 +1,4 @@
|
|
|
1
|
-
import '@testing-library/
|
|
2
|
-
import user from '@testing-library/user-event';
|
|
1
|
+
import { userEvent } from '@testing-library/user-event';
|
|
3
2
|
import { act } from 'react';
|
|
4
3
|
|
|
5
4
|
import { render, screen, mockMatchMedia } from '../test-utils';
|
|
@@ -55,103 +54,103 @@ describe('DateLookup (events)', () => {
|
|
|
55
54
|
|
|
56
55
|
it('switches to years', async () => {
|
|
57
56
|
const view = await setup();
|
|
58
|
-
openDateLookup(view);
|
|
59
|
-
clickDateButton(view);
|
|
57
|
+
await openDateLookup(view);
|
|
58
|
+
await clickDateButton(view);
|
|
60
59
|
|
|
61
60
|
expect(getActiveYearButton(view)).toHaveFocus();
|
|
62
61
|
|
|
63
|
-
closeDateLookup(view);
|
|
62
|
+
await closeDateLookup(view);
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
it('has aria-label for 20 years', async () => {
|
|
67
66
|
const view = await setup();
|
|
68
|
-
openDateLookup(view);
|
|
69
|
-
clickDateButton(view);
|
|
67
|
+
await openDateLookup(view);
|
|
68
|
+
await clickDateButton(view);
|
|
70
69
|
|
|
71
70
|
expect(getButtonByAriaLabel('next 20 years')).toBeInTheDocument();
|
|
72
71
|
expect(getButtonByAriaLabel('previous 20 years')).toBeInTheDocument();
|
|
73
72
|
|
|
74
|
-
closeDateLookup(view);
|
|
73
|
+
await closeDateLookup(view);
|
|
75
74
|
});
|
|
76
75
|
|
|
77
76
|
it('switches to months', async () => {
|
|
78
77
|
const view = await setup();
|
|
79
|
-
openDateLookup(view);
|
|
80
|
-
clickDateButton(view);
|
|
81
|
-
|
|
78
|
+
await openDateLookup(view);
|
|
79
|
+
await clickDateButton(view);
|
|
80
|
+
await userEvent.click(getActiveYearButton(view));
|
|
82
81
|
|
|
83
82
|
expect(getActiveMonthButton(view)).toHaveFocus();
|
|
84
83
|
|
|
85
|
-
closeDateLookup(view);
|
|
84
|
+
await closeDateLookup(view);
|
|
86
85
|
});
|
|
87
86
|
|
|
88
87
|
it('has aria label for year', async () => {
|
|
89
88
|
const view = await setup();
|
|
90
|
-
openDateLookup(view);
|
|
91
|
-
clickDateButton(view);
|
|
92
|
-
|
|
89
|
+
await openDateLookup(view);
|
|
90
|
+
await clickDateButton(view);
|
|
91
|
+
await userEvent.click(getActiveYearButton(view));
|
|
93
92
|
|
|
94
93
|
expect(getButtonByAriaLabel('next year')).toBeInTheDocument();
|
|
95
94
|
expect(getButtonByAriaLabel('previous year')).toBeInTheDocument();
|
|
96
95
|
|
|
97
|
-
closeDateLookup(view);
|
|
96
|
+
await closeDateLookup(view);
|
|
98
97
|
});
|
|
99
98
|
|
|
100
99
|
it('switches to days', async () => {
|
|
101
100
|
const view = await setup();
|
|
102
|
-
openDateLookup(view);
|
|
103
|
-
clickDateButton(view);
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
await openDateLookup(view);
|
|
102
|
+
await clickDateButton(view);
|
|
103
|
+
await userEvent.click(getActiveYearButton(view));
|
|
104
|
+
await userEvent.click(getActiveMonthButton(view));
|
|
106
105
|
|
|
107
106
|
expect(getActiveDayButton(view)).toHaveFocus();
|
|
108
107
|
|
|
109
|
-
closeDateLookup(view);
|
|
108
|
+
await closeDateLookup(view);
|
|
110
109
|
});
|
|
111
110
|
|
|
112
111
|
it('has aria label for month', async () => {
|
|
113
112
|
const view = await setup();
|
|
114
|
-
openDateLookup(view);
|
|
115
|
-
clickDateButton(view);
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
await openDateLookup(view);
|
|
114
|
+
await clickDateButton(view);
|
|
115
|
+
await userEvent.click(getActiveYearButton(view));
|
|
116
|
+
await userEvent.click(getActiveMonthButton(view));
|
|
118
117
|
|
|
119
118
|
expect(getButtonByAriaLabel('next month')).toBeInTheDocument();
|
|
120
119
|
expect(getButtonByAriaLabel('previous month')).toBeInTheDocument();
|
|
121
120
|
|
|
122
|
-
closeDateLookup(view);
|
|
121
|
+
await closeDateLookup(view);
|
|
123
122
|
});
|
|
124
123
|
|
|
125
124
|
it('updates selected date and closes', async () => {
|
|
126
125
|
const view = await setup();
|
|
127
|
-
openDateLookup(view);
|
|
126
|
+
await openDateLookup(view);
|
|
128
127
|
const d = new Date(2018, 11, 28);
|
|
129
128
|
const newDay = screen.getByText(d.getDate().toString());
|
|
130
|
-
|
|
129
|
+
await userEvent.click(newDay);
|
|
131
130
|
|
|
132
131
|
expect(handleChange).toHaveBeenCalledWith(d);
|
|
133
132
|
expect(getOpenButton(view)).toHaveFocus();
|
|
134
133
|
|
|
135
|
-
closeDateLookup(view);
|
|
134
|
+
await closeDateLookup(view);
|
|
136
135
|
});
|
|
137
136
|
|
|
138
137
|
it('has aria label on selected date', async () => {
|
|
139
138
|
const view = await setup();
|
|
140
|
-
openDateLookup(view);
|
|
139
|
+
await openDateLookup(view);
|
|
141
140
|
const d = new Date(2018, 11, 28);
|
|
142
141
|
const newDay = screen.getByText(d.getDate().toString());
|
|
143
|
-
|
|
144
|
-
openDateLookup(view);
|
|
142
|
+
await userEvent.click(newDay);
|
|
143
|
+
await openDateLookup(view);
|
|
145
144
|
expect(screen.getByRole('button', { name: /selected day/i })).toBeInTheDocument();
|
|
146
145
|
|
|
147
|
-
closeDateLookup(view);
|
|
146
|
+
await closeDateLookup(view);
|
|
148
147
|
});
|
|
149
148
|
|
|
150
149
|
it('supports custom `aria-labelledby` attribute', async () => {
|
|
151
150
|
const view = await setup();
|
|
152
151
|
expect(screen.getByLabelText('Prioritized label')).toHaveClass('input-group');
|
|
153
152
|
|
|
154
|
-
closeDateLookup(view);
|
|
153
|
+
await closeDateLookup(view);
|
|
155
154
|
});
|
|
156
155
|
});
|
|
157
156
|
|
|
@@ -183,29 +182,33 @@ describe('DateLookup (events)', () => {
|
|
|
183
182
|
|
|
184
183
|
it('when user clicks on clear the focus returns to btn', async () => {
|
|
185
184
|
const view = await setup();
|
|
186
|
-
clickClearButton(view);
|
|
185
|
+
await clickClearButton(view);
|
|
187
186
|
expect(getOpenButton(view)).toHaveFocus();
|
|
188
187
|
});
|
|
189
188
|
|
|
190
189
|
it('onChange gets called with null when reset button is clicked', async () => {
|
|
191
190
|
const view = await setup();
|
|
192
|
-
clickClearButton(view);
|
|
191
|
+
await clickClearButton(view);
|
|
193
192
|
expect(props.onChange).toHaveBeenCalledWith(null);
|
|
194
193
|
});
|
|
195
194
|
});
|
|
196
195
|
|
|
197
|
-
const openDateLookup =
|
|
198
|
-
|
|
196
|
+
const openDateLookup = async (
|
|
197
|
+
/** @type {import('@testing-library/react').RenderResult} */ view,
|
|
198
|
+
) => userEvent.click(getOpenButton(view));
|
|
199
199
|
|
|
200
|
-
const clickDateButton =
|
|
201
|
-
|
|
200
|
+
const clickDateButton = async (
|
|
201
|
+
/** @type {import('@testing-library/react').RenderResult} */ view,
|
|
202
|
+
) => userEvent.click(getDateButton(view));
|
|
202
203
|
|
|
203
204
|
// Close dateLookup and removes events attached to documents.
|
|
204
|
-
const closeDateLookup =
|
|
205
|
-
|
|
205
|
+
const closeDateLookup = async (
|
|
206
|
+
/** @type {import('@testing-library/react').RenderResult} */ view,
|
|
207
|
+
) => userEvent.click(view.container);
|
|
206
208
|
|
|
207
|
-
const clickClearButton =
|
|
208
|
-
|
|
209
|
+
const clickClearButton = async (
|
|
210
|
+
/** @type {import('@testing-library/react').RenderResult} */ view,
|
|
211
|
+
) => userEvent.click(getClearButton(view));
|
|
209
212
|
|
|
210
213
|
const getActiveYearButton = (
|
|
211
214
|
/** @type {import('@testing-library/react').RenderResult} */ view,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
|
2
2
|
import { expect, userEvent, within } from '@storybook/test';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
@@ -9,7 +9,9 @@ export default {
|
|
|
9
9
|
title: 'Forms/DateLookup/Tests',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type Story = StoryFn<typeof DateLookup>;
|
|
13
|
+
|
|
14
|
+
const Template: Story = () => {
|
|
13
15
|
const [value, setValue] = useState<Date | null>(new Date(1987, 0, 10, 12, 0, 0));
|
|
14
16
|
|
|
15
17
|
return (
|
|
@@ -30,14 +30,34 @@ const definitions = [
|
|
|
30
30
|
|
|
31
31
|
export const Basic = () => {
|
|
32
32
|
const muted = boolean('muted', false);
|
|
33
|
-
const layout = select(
|
|
33
|
+
const layout = select(
|
|
34
|
+
'layout',
|
|
35
|
+
[
|
|
36
|
+
Layout.VERTICAL_TWO_COLUMN,
|
|
37
|
+
Layout.VERTICAL_ONE_COLUMN,
|
|
38
|
+
Layout.HORIZONTAL_JUSTIFIED,
|
|
39
|
+
Layout.HORIZONTAL_LEFT_ALIGNED,
|
|
40
|
+
Layout.HORIZONTAL_RIGHT_ALIGNED,
|
|
41
|
+
],
|
|
42
|
+
Layout.HORIZONTAL_LEFT_ALIGNED,
|
|
43
|
+
);
|
|
34
44
|
|
|
35
45
|
return <DefinitionList layout={layout} muted={muted} definitions={definitions} />;
|
|
36
46
|
};
|
|
37
47
|
|
|
38
48
|
export const WithActionButtons = () => {
|
|
39
49
|
const muted = boolean('muted', false);
|
|
40
|
-
const layout = select(
|
|
50
|
+
const layout = select(
|
|
51
|
+
'layout',
|
|
52
|
+
[
|
|
53
|
+
Layout.VERTICAL_TWO_COLUMN,
|
|
54
|
+
Layout.VERTICAL_ONE_COLUMN,
|
|
55
|
+
Layout.HORIZONTAL_JUSTIFIED,
|
|
56
|
+
Layout.HORIZONTAL_LEFT_ALIGNED,
|
|
57
|
+
Layout.HORIZONTAL_RIGHT_ALIGNED,
|
|
58
|
+
],
|
|
59
|
+
Layout.HORIZONTAL_LEFT_ALIGNED,
|
|
60
|
+
);
|
|
41
61
|
|
|
42
62
|
return (
|
|
43
63
|
<DefinitionList
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
|
|
3
|
+
import ActionButton from '../actionButton';
|
|
4
|
+
import { Layout } from '../common';
|
|
5
|
+
|
|
6
|
+
interface Definition {
|
|
7
|
+
action?: {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
};
|
|
11
|
+
title: React.ReactNode;
|
|
12
|
+
value: React.ReactNode;
|
|
13
|
+
key: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type DefinitionListLayout =
|
|
17
|
+
`${Layout.VERTICAL_TWO_COLUMN | Layout.VERTICAL_ONE_COLUMN | Layout.HORIZONTAL_JUSTIFIED | Layout.HORIZONTAL_LEFT_ALIGNED | Layout.HORIZONTAL_RIGHT_ALIGNED}`;
|
|
18
|
+
|
|
19
|
+
export interface DefinitionListProps {
|
|
20
|
+
definitions?: Definition[];
|
|
21
|
+
layout?: DefinitionListLayout;
|
|
22
|
+
muted?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const isLayoutHorizontal = (layout: DefinitionListLayout) =>
|
|
26
|
+
layout === Layout.HORIZONTAL_LEFT_ALIGNED ||
|
|
27
|
+
layout === Layout.HORIZONTAL_RIGHT_ALIGNED ||
|
|
28
|
+
layout === Layout.HORIZONTAL_JUSTIFIED;
|
|
29
|
+
|
|
30
|
+
const getAlignmentClasses = (layout: DefinitionListLayout, action: Definition['action']) => {
|
|
31
|
+
const classes = ['d-flex'];
|
|
32
|
+
|
|
33
|
+
if (action) {
|
|
34
|
+
if (isLayoutHorizontal(layout)) {
|
|
35
|
+
classes.push('align-items-center');
|
|
36
|
+
} else {
|
|
37
|
+
classes.push('align-items-start');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (layout === Layout.HORIZONTAL_RIGHT_ALIGNED) {
|
|
42
|
+
classes.push('text-sm-right tw-definition-list--right-aligned-desktop');
|
|
43
|
+
} else {
|
|
44
|
+
classes.push('justify-content-between');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (layout === Layout.HORIZONTAL_JUSTIFIED) {
|
|
48
|
+
classes.push('text-sm-justify');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return classes;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const defaultDefinitions = [] satisfies DefinitionListProps['definitions'];
|
|
55
|
+
|
|
56
|
+
export default function DefinitionList({
|
|
57
|
+
definitions = defaultDefinitions,
|
|
58
|
+
layout = 'VERTICAL_TWO_COLUMN',
|
|
59
|
+
muted,
|
|
60
|
+
}: DefinitionListProps) {
|
|
61
|
+
return (
|
|
62
|
+
<dl
|
|
63
|
+
className={classNames('tw-definition-list d-flex ', {
|
|
64
|
+
'text-muted': muted,
|
|
65
|
+
'flex-column': layout === Layout.VERTICAL_ONE_COLUMN,
|
|
66
|
+
'tw-definition-list--columns flex-column flex-row--sm':
|
|
67
|
+
layout === Layout.VERTICAL_TWO_COLUMN,
|
|
68
|
+
'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout),
|
|
69
|
+
})}
|
|
70
|
+
>
|
|
71
|
+
{definitions
|
|
72
|
+
.filter((definition) => definition)
|
|
73
|
+
.map(({ action, title, value, key }) => (
|
|
74
|
+
<div key={key} className="tw-definition-list__item">
|
|
75
|
+
<dt>{title}</dt>
|
|
76
|
+
<dd className={classNames(...getAlignmentClasses(layout, action))}>
|
|
77
|
+
<div>{value}</div>
|
|
78
|
+
{action ? (
|
|
79
|
+
<div
|
|
80
|
+
className={classNames(
|
|
81
|
+
isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2',
|
|
82
|
+
'tw-definition-list__action',
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
<ActionButton className="tw-definition-list__button" onClick={action.onClick}>
|
|
86
|
+
{action.label}
|
|
87
|
+
</ActionButton>
|
|
88
|
+
</div>
|
|
89
|
+
) : null}
|
|
90
|
+
</dd>
|
|
91
|
+
</div>
|
|
92
|
+
))}
|
|
93
|
+
</dl>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -25,42 +25,42 @@ describe('Dimmer', () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
describe('closing behaviour', () => {
|
|
28
|
-
it('calls onClose if the dimmer is clicked', () => {
|
|
28
|
+
it('calls onClose if the dimmer is clicked', async () => {
|
|
29
29
|
const onClose = jest.fn();
|
|
30
30
|
render(<Dimmer {...props} onClose={onClose} />);
|
|
31
|
-
userEvent.click(screen.getByRole('presentation'));
|
|
31
|
+
await userEvent.click(screen.getByRole('presentation'));
|
|
32
32
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it('does not call onClose if the dimmer content is clicked', () => {
|
|
35
|
+
it('does not call onClose if the dimmer content is clicked', async () => {
|
|
36
36
|
const onClose = jest.fn();
|
|
37
37
|
render(
|
|
38
38
|
<Dimmer {...props} onClose={onClose}>
|
|
39
39
|
<Button onClick={() => {}}>McClicky</Button>
|
|
40
40
|
</Dimmer>,
|
|
41
41
|
);
|
|
42
|
-
userEvent.click(screen.getByRole('button'));
|
|
42
|
+
await userEvent.click(screen.getByRole('button'));
|
|
43
43
|
expect(onClose).toHaveBeenCalledTimes(0);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
it('does not call onClose when clicked if disableClickToClose is true', () => {
|
|
46
|
+
it('does not call onClose when clicked if disableClickToClose is true', async () => {
|
|
47
47
|
const onClose = jest.fn();
|
|
48
48
|
render(<Dimmer {...props} disableClickToClose onClose={onClose} />);
|
|
49
|
-
userEvent.click(screen.getByRole('presentation'));
|
|
49
|
+
await userEvent.click(screen.getByRole('presentation'));
|
|
50
50
|
expect(onClose).toHaveBeenCalledTimes(0);
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
it('calls onClose if the escape key is pressed', () => {
|
|
53
|
+
it('calls onClose if the escape key is pressed', async () => {
|
|
54
54
|
const onClose = jest.fn();
|
|
55
55
|
render(<Dimmer {...props} onClose={onClose} />);
|
|
56
|
-
userEvent.keyboard('{
|
|
56
|
+
await userEvent.keyboard('{Escape}');
|
|
57
57
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
it('does not call onClose if the escape key is pressed when disableClickToClose is true', () => {
|
|
60
|
+
it('does not call onClose if the escape key is pressed when disableClickToClose is true', async () => {
|
|
61
61
|
const onClose = jest.fn();
|
|
62
62
|
render(<Dimmer {...props} disableClickToClose onClose={onClose} />);
|
|
63
|
-
userEvent.keyboard('{
|
|
63
|
+
await userEvent.keyboard('{Escape}');
|
|
64
64
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { DimmerProps } from '../dimmer';
|
|
2
|
+
import { SlidingPanelProps } from '../slidingPanel';
|
|
1
3
|
import { mockMatchMedia, render, screen, userEvent } from '../test-utils';
|
|
2
4
|
|
|
3
5
|
import Drawer from './Drawer';
|
|
@@ -7,7 +9,7 @@ mockMatchMedia();
|
|
|
7
9
|
jest.mock(
|
|
8
10
|
'../dimmer',
|
|
9
11
|
() =>
|
|
10
|
-
function ({ open, children }) {
|
|
12
|
+
function Dimmer({ open, children }: DimmerProps) {
|
|
11
13
|
return open ? <div className="dimmer">{children}</div> : null;
|
|
12
14
|
},
|
|
13
15
|
);
|
|
@@ -15,7 +17,7 @@ jest.mock(
|
|
|
15
17
|
jest.mock(
|
|
16
18
|
'../slidingPanel',
|
|
17
19
|
() =>
|
|
18
|
-
function ({ open, children }) {
|
|
20
|
+
function SlidingPanel({ open, children }: SlidingPanelProps) {
|
|
19
21
|
return open ? <div className="sliding-panel">{children}</div> : null;
|
|
20
22
|
},
|
|
21
23
|
);
|
|
@@ -46,10 +48,10 @@ describe('Drawer', () => {
|
|
|
46
48
|
expect(container).toMatchSnapshot();
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
it('calls onClose when user clicks close button', () => {
|
|
51
|
+
it('calls onClose when user clicks close button', async () => {
|
|
50
52
|
render(<Drawer {...props}>content</Drawer>);
|
|
51
53
|
expect(props.onClose).not.toHaveBeenCalled();
|
|
52
|
-
userEvent.click(getCloseButton());
|
|
54
|
+
await userEvent.click(getCloseButton());
|
|
53
55
|
expect(props.onClose).toHaveBeenCalledTimes(1);
|
|
54
56
|
});
|
|
55
57
|
|
|
@@ -3,7 +3,6 @@ import { useState } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { Section, Button, Input, Modal } from '..';
|
|
5
5
|
import { Position, Priority } from '../common';
|
|
6
|
-
import { storyConfig } from '../test-utils';
|
|
7
6
|
|
|
8
7
|
import Drawer from './Drawer';
|
|
9
8
|
|
|
@@ -17,18 +16,6 @@ export const Basic = () => {
|
|
|
17
16
|
const [openModal, setOpenModal] = useState(false);
|
|
18
17
|
const position = select('position', [Position.LEFT, Position.RIGHT], Position.RIGHT);
|
|
19
18
|
|
|
20
|
-
const handleDrawerClose = (event) => {
|
|
21
|
-
console.log('drawer close');
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
setOpenDrawer(false);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const handleModalClose = (event) => {
|
|
27
|
-
console.log('modal close');
|
|
28
|
-
event.stopPropagation();
|
|
29
|
-
setOpenModal(false);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
19
|
return (
|
|
33
20
|
<>
|
|
34
21
|
<Button disabled={false} block={false} onClick={() => setOpenDrawer(true)}>
|
|
@@ -48,7 +35,11 @@ export const Basic = () => {
|
|
|
48
35
|
</Button>
|
|
49
36
|
</>
|
|
50
37
|
}
|
|
51
|
-
onClose={
|
|
38
|
+
onClose={(event) => {
|
|
39
|
+
console.log('drawer close');
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
setOpenDrawer(false);
|
|
42
|
+
}}
|
|
52
43
|
>
|
|
53
44
|
<p>
|
|
54
45
|
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
@@ -62,23 +53,24 @@ export const Basic = () => {
|
|
|
62
53
|
<Button onClick={() => setOpenModal(true)}>Open Modal</Button>
|
|
63
54
|
<Modal
|
|
64
55
|
body={
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</p>
|
|
77
|
-
</>
|
|
56
|
+
<p className="m-t-4">
|
|
57
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray
|
|
58
|
+
activated charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo,
|
|
59
|
+
cliche lyft marfa ethical waistcoat poke jean shorts. Scenester readymade selvage
|
|
60
|
+
disrupt pok pok. La croix stumptown try-hard chartreuse. I am baby actually poke
|
|
61
|
+
kickstarter, street art jean shorts bespoke chambray activated charcoal ramps marfa
|
|
62
|
+
shoreditch tumeric, I am baby actually poke kickstarter, street art jean shorts
|
|
63
|
+
bespoke chambray activated charcoal ramps marfa shoreditch tumeric tumblr. Mixtape
|
|
64
|
+
cred palo santo, cliche lyft marfa ethical waistcoat poke jean shorts. Scenester
|
|
65
|
+
readymade selvage disrupt pok pok.
|
|
66
|
+
</p>
|
|
78
67
|
}
|
|
79
68
|
open={openModal}
|
|
80
69
|
title="Title"
|
|
81
|
-
onClose={
|
|
70
|
+
onClose={() => {
|
|
71
|
+
console.log('modal close');
|
|
72
|
+
setOpenModal(false);
|
|
73
|
+
}}
|
|
82
74
|
/>
|
|
83
75
|
</Section>
|
|
84
76
|
<p>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { useId } from 'react';
|
|
4
3
|
|
|
5
4
|
import { Position, Typography } from '../common';
|
|
@@ -10,7 +9,31 @@ import SlidingPanel from '../slidingPanel';
|
|
|
10
9
|
import Title from '../title';
|
|
11
10
|
import { logActionRequiredIf } from '../utilities';
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
export interface DrawerProps {
|
|
13
|
+
/** The content to appear in the drawer body. */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
/** The content to appear in the drawer footer. */
|
|
17
|
+
footerContent?: React.ReactNode;
|
|
18
|
+
/** The content to appear in the drawer header. */
|
|
19
|
+
headerTitle?: React.ReactNode;
|
|
20
|
+
/** The status of Drawer either open or not. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
23
|
+
position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;
|
|
24
|
+
/** The action to perform on close click. */
|
|
25
|
+
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function Drawer({
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
footerContent,
|
|
32
|
+
headerTitle,
|
|
33
|
+
onClose,
|
|
34
|
+
open = false,
|
|
35
|
+
position = 'right',
|
|
36
|
+
}: DrawerProps) {
|
|
14
37
|
logActionRequiredIf(
|
|
15
38
|
'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',
|
|
16
39
|
!onClose,
|
|
@@ -46,32 +69,4 @@ const Drawer = ({ children, className, footerContent, headerTitle, onClose, open
|
|
|
46
69
|
</SlidingPanel>
|
|
47
70
|
</Dimmer>
|
|
48
71
|
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
Drawer.propTypes = {
|
|
52
|
-
/** The content to appear in the drawer body. */
|
|
53
|
-
children: PropTypes.node,
|
|
54
|
-
className: PropTypes.string,
|
|
55
|
-
/** The content to appear in the drawer footer. */
|
|
56
|
-
footerContent: PropTypes.node,
|
|
57
|
-
/** The content to appear in the drawer header. */
|
|
58
|
-
headerTitle: PropTypes.node,
|
|
59
|
-
/** The status of Drawer either open or not. */
|
|
60
|
-
open: PropTypes.bool,
|
|
61
|
-
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
62
|
-
position: PropTypes.oneOf(['left', 'right', 'bottom']),
|
|
63
|
-
/** The action to perform on close click. */
|
|
64
|
-
onClose: PropTypes.func,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
Drawer.defaultProps = {
|
|
68
|
-
children: null,
|
|
69
|
-
className: undefined,
|
|
70
|
-
footerContent: null,
|
|
71
|
-
headerTitle: null,
|
|
72
|
-
onClose: null,
|
|
73
|
-
open: false,
|
|
74
|
-
position: Position.RIGHT,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default Drawer;
|
|
72
|
+
}
|
package/src/field/Field.spec.tsx
CHANGED
|
@@ -73,7 +73,7 @@ describe('Field', () => {
|
|
|
73
73
|
button.addEventListener('click', handleClick);
|
|
74
74
|
|
|
75
75
|
const label = screen.getByText('Phone number');
|
|
76
|
-
userEvent.click(label);
|
|
76
|
+
await userEvent.click(label);
|
|
77
77
|
|
|
78
78
|
expect(handleClick).not.toHaveBeenCalled();
|
|
79
79
|
});
|
|
@@ -90,6 +90,6 @@ describe('Field', () => {
|
|
|
90
90
|
expect(screen.getByRole('textbox')).not.toHaveAttribute('id');
|
|
91
91
|
|
|
92
92
|
const label = screen.getByText('Phone number');
|
|
93
|
-
userEvent.click(label);
|
|
93
|
+
await userEvent.click(label);
|
|
94
94
|
});
|
|
95
95
|
});
|