@transferwise/components 46.37.0 → 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 +159 -317
- package/build/index.js.map +1 -1
- package/build/index.mjs +154 -311
- 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 +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 +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/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 +1 -2
- package/src/alert/inlineMarkdown/InlineMarkdown.tsx +13 -0
- package/src/alert/inlineMarkdown/index.ts +2 -0
- 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/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/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/index.ts +4 -0
- 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/section/Section.story.tsx +0 -2
- 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/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/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 +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 +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 +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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadButton.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadButton/UploadButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UploadButton.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadButton/UploadButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AAMpD,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,QAAQ,EAAE,CAAC;AACzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAEpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,oBAAY,QAAQ;IAClB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;CACxB;AAOD,QAAA,MAAM,YAAY,0GAUf,iBAAiB,gCA6JnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAe,MAAM,UAAU,CAAC;AAKrD,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,Q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al.d.ts","sourceRoot":"","sources":["../../../src/withNextPortal/withNextPortal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withNextPortal.d.ts","sourceRoot":"","sources":["../../../src/withNextPortal/withNextPortal.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,WAET,CAAC,wCAQ1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.38.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
"merge-props": "^6.0.0",
|
|
128
128
|
"prop-types": "^15.8.1",
|
|
129
129
|
"react-popper": "^2.3.0",
|
|
130
|
-
"react-required-if": "^1.0.3",
|
|
131
130
|
"react-transition-group": "^4.4.5"
|
|
132
131
|
},
|
|
133
132
|
"publishConfig": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarkdownNodeType } from '../../common';
|
|
2
|
+
import Markdown from '../../markdown';
|
|
3
|
+
|
|
4
|
+
const allowList = [MarkdownNodeType.STRONG];
|
|
5
|
+
|
|
6
|
+
export interface InlineMarkdownProps {
|
|
7
|
+
children?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function InlineMarkdown(props: InlineMarkdownProps) {
|
|
12
|
+
return <Markdown {...props} as="span" allowList={allowList} blockList={undefined} />;
|
|
13
|
+
}
|
|
@@ -3,27 +3,21 @@ import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import Card from '.';
|
|
6
|
+
import { CardProps } from './Card';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
component: Card,
|
|
9
10
|
title: 'Layouts/Card',
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
const Template = (props) => {
|
|
13
|
+
const Template = (props: Pick<CardProps, 'isExpanded' | 'icon' | 'onClick'>) => {
|
|
13
14
|
const elementType = select('elementType', ['div', 'li'], 'div');
|
|
14
15
|
const title = text('title', 'A card');
|
|
15
16
|
const details = text('details', 'Some details about this card');
|
|
16
17
|
const content = text('content', 'Lorem ipsum dolor sit amet.');
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
<Card
|
|
20
|
-
as={elementType}
|
|
21
|
-
title={title}
|
|
22
|
-
details={details}
|
|
23
|
-
isExpanded={props.isExpanded}
|
|
24
|
-
icon={props.icon}
|
|
25
|
-
onClick={props.onClick}
|
|
26
|
-
>
|
|
20
|
+
<Card as={elementType} title={title} details={details} {...props}>
|
|
27
21
|
{content}
|
|
28
22
|
</Card>
|
|
29
23
|
);
|
|
@@ -36,13 +30,10 @@ export const Basic = () => {
|
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
export const Multiple = () => {
|
|
39
|
-
const [expandedCardIndex, setExpandedCardIndex] = useState(0);
|
|
33
|
+
const [expandedCardIndex, setExpandedCardIndex] = useState<number | null>(0);
|
|
40
34
|
|
|
41
|
-
const handleOnCardClick = (index) => {
|
|
42
|
-
|
|
43
|
-
return setExpandedCardIndex(null);
|
|
44
|
-
}
|
|
45
|
-
setExpandedCardIndex(index);
|
|
35
|
+
const handleOnCardClick = (index: number) => {
|
|
36
|
+
setExpandedCardIndex(index !== expandedCardIndex ? index : null);
|
|
46
37
|
};
|
|
47
38
|
|
|
48
39
|
return (
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
4
|
-
import requiredIf from 'react-required-if';
|
|
5
3
|
|
|
6
4
|
import Body from '../body';
|
|
7
5
|
import Chevron from '../chevron';
|
|
8
6
|
import { Position, Typography } from '../common';
|
|
9
7
|
import Option from '../common/Option';
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export interface CardProps {
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
isExpanded?: boolean;
|
|
13
|
+
title: React.ReactNode;
|
|
14
|
+
details: React.ReactNode;
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
id?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
onClick?: (nextIsExpanded: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Card = forwardRef(function Card(
|
|
24
|
+
{
|
|
13
25
|
'aria-label': ariaLabel,
|
|
14
|
-
as: Element,
|
|
26
|
+
as: Element = 'div',
|
|
15
27
|
isExpanded,
|
|
16
28
|
title,
|
|
17
29
|
details,
|
|
@@ -20,8 +32,10 @@ const Card = forwardRef((props, reference) => {
|
|
|
20
32
|
icon,
|
|
21
33
|
id,
|
|
22
34
|
className,
|
|
23
|
-
|
|
24
|
-
}
|
|
35
|
+
'data-testid': dataTestId,
|
|
36
|
+
}: CardProps,
|
|
37
|
+
reference,
|
|
38
|
+
) {
|
|
25
39
|
const isOpen = !!(isExpanded && children);
|
|
26
40
|
|
|
27
41
|
return (
|
|
@@ -33,7 +47,7 @@ const Card = forwardRef((props, reference) => {
|
|
|
33
47
|
'np-card--has-icon': !!icon,
|
|
34
48
|
})}
|
|
35
49
|
id={id}
|
|
36
|
-
data-testid={
|
|
50
|
+
data-testid={dataTestId}
|
|
37
51
|
>
|
|
38
52
|
<Option
|
|
39
53
|
aria-label={ariaLabel}
|
|
@@ -44,7 +58,7 @@ const Card = forwardRef((props, reference) => {
|
|
|
44
58
|
content={details}
|
|
45
59
|
showMediaAtAllSizes
|
|
46
60
|
button={children && <Chevron orientation={isOpen ? Position.TOP : Position.BOTTOM} />}
|
|
47
|
-
onClick={() =>
|
|
61
|
+
onClick={children ? () => onClick?.(!isExpanded) : undefined}
|
|
48
62
|
/>
|
|
49
63
|
<div
|
|
50
64
|
className={classNames('np-card__divider', {
|
|
@@ -60,29 +74,4 @@ const Card = forwardRef((props, reference) => {
|
|
|
60
74
|
);
|
|
61
75
|
});
|
|
62
76
|
|
|
63
|
-
const hasChildren = ({ children }) => children;
|
|
64
|
-
|
|
65
|
-
Card.propTypes = {
|
|
66
|
-
'aria-label': PropTypes.string,
|
|
67
|
-
as: PropTypes.string,
|
|
68
|
-
isExpanded: requiredIf(PropTypes.bool, hasChildren),
|
|
69
|
-
title: PropTypes.node.isRequired,
|
|
70
|
-
details: PropTypes.node.isRequired,
|
|
71
|
-
onClick: requiredIf(PropTypes.func, hasChildren),
|
|
72
|
-
icon: PropTypes.node,
|
|
73
|
-
children: PropTypes.node,
|
|
74
|
-
id: PropTypes.string,
|
|
75
|
-
className: PropTypes.string,
|
|
76
|
-
'data-testid': PropTypes.string,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Card.defaultProps = {
|
|
80
|
-
'aria-label': undefined,
|
|
81
|
-
as: 'div',
|
|
82
|
-
children: null,
|
|
83
|
-
id: null,
|
|
84
|
-
className: null,
|
|
85
|
-
'data-testid': null,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
77
|
export default Card;
|
|
@@ -2,10 +2,10 @@ import '@testing-library/jest-dom';
|
|
|
2
2
|
|
|
3
3
|
import { render, fireEvent, screen } from '@testing-library/react';
|
|
4
4
|
|
|
5
|
-
import Checkbox from '.';
|
|
5
|
+
import Checkbox, { CheckboxProps } from '.';
|
|
6
6
|
|
|
7
7
|
describe('Checkbox', () => {
|
|
8
|
-
let props;
|
|
8
|
+
let props: CheckboxProps;
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
props = {
|
|
@@ -68,7 +68,7 @@ describe('Checkbox', () => {
|
|
|
68
68
|
|
|
69
69
|
it('has disabled class when the disabled prop is true', () => {
|
|
70
70
|
const { container } = render(<Checkbox {...props} disabled />);
|
|
71
|
-
expect(getCheckboxContainer(container)
|
|
71
|
+
expect(getCheckboxContainer(container)?.firstChild).toHaveClass('disabled');
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it('passes required to checkbox button', () => {
|
|
@@ -117,7 +117,7 @@ describe('Checkbox', () => {
|
|
|
117
117
|
expect(getCheckboxContainer(container)).toHaveClass('checkbox-lg');
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
const getCheckboxContainer = (container) => container.querySelector('.np-checkbox');
|
|
121
|
-
const getLabel = () => screen.getByText('hello').parentElement
|
|
120
|
+
const getCheckboxContainer = (container: HTMLElement) => container.querySelector('.np-checkbox');
|
|
121
|
+
const getLabel = () => screen.getByText('hello').parentElement!;
|
|
122
122
|
const getCheckbox = () => screen.getByRole('checkbox');
|
|
123
123
|
});
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { useTheme } from '@wise/components-theming';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
2
|
|
|
5
3
|
import Body from '../body/Body';
|
|
6
4
|
import CheckboxButton from '../checkboxButton';
|
|
7
5
|
import { Typography } from '../common';
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
export interface CheckboxProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
label: React.ReactNode;
|
|
14
|
+
secondary?: string;
|
|
15
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
onChange: (checked: boolean) => void;
|
|
17
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default function Checkbox({
|
|
10
22
|
id,
|
|
11
23
|
checked,
|
|
12
24
|
required,
|
|
@@ -18,15 +30,13 @@ const Checkbox = ({
|
|
|
18
30
|
onChange,
|
|
19
31
|
onFocus,
|
|
20
32
|
onBlur,
|
|
21
|
-
})
|
|
22
|
-
const { isModern } = useTheme();
|
|
23
|
-
|
|
33
|
+
}: CheckboxProps) {
|
|
24
34
|
const classList = classNames(
|
|
25
35
|
'np-checkbox',
|
|
26
36
|
{
|
|
27
37
|
checkbox: true,
|
|
28
38
|
'checkbox-lg': secondary,
|
|
29
|
-
disabled
|
|
39
|
+
disabled,
|
|
30
40
|
},
|
|
31
41
|
className,
|
|
32
42
|
);
|
|
@@ -51,41 +61,9 @@ const Checkbox = ({
|
|
|
51
61
|
type={secondary ? Typography.BODY_LARGE_BOLD : Typography.BODY_LARGE}
|
|
52
62
|
>
|
|
53
63
|
<span className={required ? 'has-required' : undefined}>{label}</span>
|
|
54
|
-
{secondary &&
|
|
55
|
-
<Body as="span" className={classNames({ secondary: !isModern })}>
|
|
56
|
-
{secondary}
|
|
57
|
-
</Body>
|
|
58
|
-
)}
|
|
64
|
+
{secondary && <Body as="span">{secondary}</Body>}
|
|
59
65
|
</Body>
|
|
60
66
|
</label>
|
|
61
67
|
</div>
|
|
62
68
|
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Checkbox.propTypes = {
|
|
66
|
-
id: PropTypes.string,
|
|
67
|
-
checked: PropTypes.bool,
|
|
68
|
-
required: PropTypes.bool,
|
|
69
|
-
disabled: PropTypes.bool,
|
|
70
|
-
readOnly: PropTypes.bool,
|
|
71
|
-
label: PropTypes.node.isRequired,
|
|
72
|
-
secondary: PropTypes.string,
|
|
73
|
-
onFocus: PropTypes.func,
|
|
74
|
-
onChange: PropTypes.func.isRequired,
|
|
75
|
-
onBlur: PropTypes.func,
|
|
76
|
-
className: PropTypes.string,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Checkbox.defaultProps = {
|
|
80
|
-
id: null,
|
|
81
|
-
checked: false,
|
|
82
|
-
required: false,
|
|
83
|
-
disabled: false,
|
|
84
|
-
readOnly: false,
|
|
85
|
-
secondary: null,
|
|
86
|
-
onFocus: null,
|
|
87
|
-
onBlur: null,
|
|
88
|
-
className: undefined,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default Checkbox;
|
|
69
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
);
|
|
@@ -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>
|