@transferwise/components 46.166.0 → 46.168.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/CardContainer/CardContainer.js +34 -0
- package/build/CardContainer/CardContainer.js.map +1 -0
- package/build/CardContainer/CardContainer.mjs +30 -0
- package/build/CardContainer/CardContainer.mjs.map +1 -0
- package/build/CardWidget/CardWidget.js +98 -0
- package/build/CardWidget/CardWidget.js.map +1 -0
- package/build/CardWidget/CardWidget.mjs +94 -0
- package/build/CardWidget/CardWidget.mjs.map +1 -0
- package/build/CardWidget/CardWidgetAction.js +73 -0
- package/build/CardWidget/CardWidgetAction.js.map +1 -0
- package/build/CardWidget/CardWidgetAction.mjs +68 -0
- package/build/CardWidget/CardWidgetAction.mjs.map +1 -0
- package/build/Link/Link.js.map +1 -1
- package/build/Link/Link.mjs.map +1 -1
- package/build/ListItem/ListItem.js +2 -0
- package/build/ListItem/ListItem.js.map +1 -1
- package/build/ListItem/ListItem.mjs +2 -0
- package/build/ListItem/ListItem.mjs.map +1 -1
- package/build/Loader/Loader.js.map +1 -1
- package/build/Loader/Loader.mjs.map +1 -1
- package/build/Prompt/PrimitivePrompt/PrimitivePrompt.js +2 -1
- package/build/Prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/Prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -1
- package/build/Prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/Prompt/Snackbar/Snackbar.js +205 -0
- package/build/Prompt/Snackbar/Snackbar.js.map +1 -0
- package/build/Prompt/Snackbar/Snackbar.messages.js +14 -0
- package/build/Prompt/Snackbar/Snackbar.messages.js.map +1 -0
- package/build/Prompt/Snackbar/Snackbar.messages.mjs +10 -0
- package/build/Prompt/Snackbar/Snackbar.messages.mjs.map +1 -0
- package/build/Prompt/Snackbar/Snackbar.mjs +203 -0
- package/build/Prompt/Snackbar/Snackbar.mjs.map +1 -0
- package/build/Prompt/Snackbar/SnackbarContext.js.map +1 -0
- package/build/Prompt/Snackbar/SnackbarContext.mjs.map +1 -0
- package/build/Prompt/Snackbar/SnackbarPortal.js +12 -0
- package/build/Prompt/Snackbar/SnackbarPortal.js.map +1 -0
- package/build/Prompt/Snackbar/SnackbarPortal.mjs +8 -0
- package/build/Prompt/Snackbar/SnackbarPortal.mjs.map +1 -0
- package/build/Prompt/Snackbar/SnackbarProvider.js +42 -0
- package/build/Prompt/Snackbar/SnackbarProvider.js.map +1 -0
- package/build/Prompt/Snackbar/SnackbarProvider.mjs +38 -0
- package/build/Prompt/Snackbar/SnackbarProvider.mjs.map +1 -0
- package/build/Prompt/Snackbar/constants.js +17 -0
- package/build/Prompt/Snackbar/constants.js.map +1 -0
- package/build/Prompt/Snackbar/constants.mjs +11 -0
- package/build/Prompt/Snackbar/constants.mjs.map +1 -0
- package/build/Prompt/Snackbar/useSnackbar.js.map +1 -0
- package/build/Prompt/Snackbar/useSnackbar.mjs.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarAutoDismiss.js +66 -0
- package/build/Prompt/Snackbar/useSnackbarAutoDismiss.js.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarAutoDismiss.mjs +62 -0
- package/build/Prompt/Snackbar/useSnackbarAutoDismiss.mjs.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarManager.js +153 -0
- package/build/Prompt/Snackbar/useSnackbarManager.js.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarManager.mjs +149 -0
- package/build/Prompt/Snackbar/useSnackbarManager.mjs.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.js +135 -0
- package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.js.map +1 -0
- package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.mjs +131 -0
- package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.mjs.map +1 -0
- package/build/Section/Section.js.map +1 -1
- package/build/Section/Section.mjs.map +1 -1
- package/build/_deprecated/Select/Select.js +1 -1
- package/build/_deprecated/Select/Select.js.map +1 -1
- package/build/_deprecated/Select/Select.mjs +1 -1
- package/build/_deprecated/Select/Select.mjs.map +1 -1
- package/build/common/BottomSheet/BottomSheet.js +1 -3
- package/build/common/BottomSheet/BottomSheet.js.map +1 -1
- package/build/common/BottomSheet/BottomSheet.mjs +1 -3
- package/build/common/BottomSheet/BottomSheet.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +7 -3
- package/build/index.js.map +1 -1
- package/build/index.mjs +5 -3
- package/build/index.mjs.map +1 -1
- package/build/main.css +331 -75
- package/build/styles/CardContainer/CardContainer.css +108 -0
- package/build/styles/CardWidget/CardWidget.css +78 -0
- package/build/styles/IconButton/IconButton.css +3 -4
- package/build/styles/ListItem/ListItem.css +8 -0
- package/build/styles/Prompt/Snackbar/Snackbar.css +134 -0
- package/build/styles/main.css +331 -75
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/CardContainer/CardContainer.d.ts +8 -0
- package/build/types/CardContainer/CardContainer.d.ts.map +1 -0
- package/build/types/CardContainer/CardContainer.types.d.ts +55 -0
- package/build/types/CardContainer/CardContainer.types.d.ts.map +1 -0
- package/build/types/CardContainer/_stories/helpers.d.ts +3 -0
- package/build/types/CardContainer/_stories/helpers.d.ts.map +1 -0
- package/build/types/CardContainer/index.d.ts +3 -0
- package/build/types/CardContainer/index.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.d.ts +10 -0
- package/build/types/CardWidget/CardWidget.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.types.d.ts +55 -0
- package/build/types/CardWidget/CardWidget.types.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts +54 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts.map +1 -0
- package/build/types/CardWidget/index.d.ts +4 -0
- package/build/types/CardWidget/index.d.ts.map +1 -0
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/Link/Link.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts.map +1 -1
- package/build/types/Loader/Loader.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Prompt/PrimitivePrompt/PrimitivePrompt.d.ts +11 -0
- package/build/types/Prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/build/types/Prompt/Snackbar/Snackbar.d.ts +62 -0
- package/build/types/Prompt/Snackbar/Snackbar.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/Snackbar.messages.d.ts +9 -0
- package/build/types/Prompt/Snackbar/Snackbar.messages.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/Snackbar.types.d.ts +12 -0
- package/build/types/Prompt/Snackbar/Snackbar.types.d.ts.map +1 -0
- package/build/types/{Snackbar → Prompt/Snackbar}/SnackbarContext.d.ts +2 -2
- package/build/types/Prompt/Snackbar/SnackbarContext.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts +4 -0
- package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/SnackbarProvider.d.ts +13 -0
- package/build/types/Prompt/Snackbar/SnackbarProvider.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/constants.d.ts +9 -0
- package/build/types/Prompt/Snackbar/constants.d.ts.map +1 -0
- package/build/types/{Snackbar → Prompt/Snackbar}/index.d.ts +1 -1
- package/build/types/Prompt/Snackbar/index.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/useSnackbar.d.ts +3 -0
- package/build/types/Prompt/Snackbar/useSnackbar.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/useSnackbarAutoDismiss.d.ts +13 -0
- package/build/types/Prompt/Snackbar/useSnackbarAutoDismiss.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/useSnackbarManager.d.ts +20 -0
- package/build/types/Prompt/Snackbar/useSnackbarManager.d.ts.map +1 -0
- package/build/types/Prompt/Snackbar/useSnackbarSwipeDismiss.d.ts +22 -0
- package/build/types/Prompt/Snackbar/useSnackbarSwipeDismiss.d.ts.map +1 -0
- package/build/types/Section/Section.d.ts +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/_deprecated/Select/Select.d.ts +1 -1
- package/build/types/common/BottomSheet/BottomSheet.d.ts +1 -3
- package/build/types/common/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/index.d.ts +9 -5
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/CardContainer/CardContainer.css +108 -0
- package/src/CardContainer/CardContainer.less +171 -0
- package/src/CardContainer/CardContainer.test.tsx +150 -0
- package/src/CardContainer/CardContainer.tsx +51 -0
- package/src/CardContainer/CardContainer.types.ts +62 -0
- package/src/CardContainer/_stories/CardContainer.story.tsx +167 -0
- package/src/CardContainer/_stories/CardContainer.test.story.tsx +103 -0
- package/src/CardContainer/_stories/helpers.tsx +50 -0
- package/src/CardContainer/index.ts +6 -0
- package/src/CardWidget/CardWidget.css +78 -0
- package/src/CardWidget/CardWidget.less +107 -0
- package/src/CardWidget/CardWidget.test.tsx +221 -0
- package/src/CardWidget/CardWidget.tsx +78 -0
- package/src/CardWidget/CardWidget.types.ts +63 -0
- package/src/CardWidget/CardWidgetAction.tsx +128 -0
- package/src/CardWidget/_stories/CardWidget.story.tsx +238 -0
- package/src/CardWidget/_stories/CardWidget.test.story.tsx +350 -0
- package/src/CardWidget/index.ts +3 -0
- package/src/IconButton/IconButton.css +3 -4
- package/src/IconButton/IconButton.less +14 -1
- package/src/Link/Link.tsx +1 -1
- package/src/ListItem/AdditionalInfo/_stories/ListItemAdditionalInfo.story.tsx +1 -1
- package/src/ListItem/AvatarView/_stories/ListItemAvatarView.story.tsx +3 -3
- package/src/ListItem/ListItem.css +8 -0
- package/src/ListItem/ListItem.less +8 -0
- package/src/ListItem/ListItem.test.tsx +20 -0
- package/src/ListItem/ListItem.tsx +3 -1
- package/src/ListItem/_stories/ListItem.disabled.story.tsx +1 -1
- package/src/ListItem/_stories/ListItem.layout.test.story.tsx +1 -1
- package/src/ListItem/_stories/ListItem.scenarios.story.tsx +2 -2
- package/src/ListItem/_stories/ListItem.story.tsx +1 -1
- package/src/Loader/Loader.tsx +1 -1
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.docs.mdx +122 -0
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.story.tsx +0 -2
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.test.tsx +24 -1
- package/src/Prompt/PrimitivePrompt/PrimitivePrompt.tsx +8 -2
- package/src/Prompt/Snackbar/Snackbar.css +134 -0
- package/src/Prompt/Snackbar/Snackbar.less +159 -0
- package/src/Prompt/Snackbar/Snackbar.messages.ts +9 -0
- package/src/Prompt/Snackbar/Snackbar.test.tsx +1079 -0
- package/src/Prompt/Snackbar/Snackbar.tsx +245 -0
- package/src/Prompt/Snackbar/Snackbar.types.ts +17 -0
- package/src/{Snackbar → Prompt/Snackbar}/SnackbarContext.ts +2 -2
- package/src/Prompt/Snackbar/SnackbarPortal.tsx +8 -0
- package/src/Prompt/Snackbar/SnackbarProvider.test.tsx +783 -0
- package/src/Prompt/Snackbar/SnackbarProvider.tsx +41 -0
- package/src/Prompt/Snackbar/_stories/Snackbar.accessibility.docs.mdx +58 -0
- package/src/{Snackbar → Prompt/Snackbar}/_stories/Snackbar.rtl.test.story.tsx +17 -9
- package/src/Prompt/Snackbar/_stories/Snackbar.story.tsx +416 -0
- package/src/Prompt/Snackbar/_stories/Snackbar.test.story.tsx +263 -0
- package/src/Prompt/Snackbar/constants.ts +10 -0
- package/src/{Snackbar → Prompt/Snackbar}/index.ts +1 -1
- package/src/Prompt/Snackbar/useSnackbarAutoDismiss.ts +74 -0
- package/src/Prompt/Snackbar/useSnackbarManager.ts +169 -0
- package/src/Prompt/Snackbar/useSnackbarSwipeDismiss.ts +169 -0
- package/src/Section/Section.tsx +1 -1
- package/src/_deprecated/Select/Select.tsx +1 -1
- package/src/_deprecated/Select/_stories/Select.story.tsx +1 -1
- package/src/common/BottomSheet/BottomSheet.tsx +1 -3
- package/src/i18n/en.json +1 -0
- package/src/index.ts +18 -5
- package/src/main.css +331 -75
- package/src/main.less +3 -1
- package/build/Snackbar/Snackbar.js +0 -128
- package/build/Snackbar/Snackbar.js.map +0 -1
- package/build/Snackbar/Snackbar.mjs +0 -123
- package/build/Snackbar/Snackbar.mjs.map +0 -1
- package/build/Snackbar/SnackbarContext.js.map +0 -1
- package/build/Snackbar/SnackbarContext.mjs.map +0 -1
- package/build/Snackbar/SnackbarProvider.js +0 -46
- package/build/Snackbar/SnackbarProvider.js.map +0 -1
- package/build/Snackbar/SnackbarProvider.mjs +0 -42
- package/build/Snackbar/SnackbarProvider.mjs.map +0 -1
- package/build/Snackbar/useSnackbar.js.map +0 -1
- package/build/Snackbar/useSnackbar.mjs.map +0 -1
- package/build/styles/Snackbar/Snackbar.css +0 -71
- package/build/types/Snackbar/Snackbar.d.ts +0 -16
- package/build/types/Snackbar/Snackbar.d.ts.map +0 -1
- package/build/types/Snackbar/SnackbarContext.d.ts.map +0 -1
- package/build/types/Snackbar/SnackbarProvider.d.ts +0 -6
- package/build/types/Snackbar/SnackbarProvider.d.ts.map +0 -1
- package/build/types/Snackbar/index.d.ts.map +0 -1
- package/build/types/Snackbar/useSnackbar.d.ts +0 -3
- package/build/types/Snackbar/useSnackbar.d.ts.map +0 -1
- package/src/FlowNavigation/_stories/FlowNavigation.CriticalBanner.docs.mdx +0 -66
- package/src/Snackbar/Snackbar.css +0 -71
- package/src/Snackbar/Snackbar.less +0 -80
- package/src/Snackbar/Snackbar.test.tsx +0 -206
- package/src/Snackbar/Snackbar.tsx +0 -129
- package/src/Snackbar/SnackbarProvider.tsx +0 -33
- package/src/Snackbar/_stories/Snackbar.story.tsx +0 -89
- package/src/Snackbar/_stories/Snackbar.test.story.tsx +0 -139
- /package/build/{Snackbar → Prompt/Snackbar}/SnackbarContext.js +0 -0
- /package/build/{Snackbar → Prompt/Snackbar}/SnackbarContext.mjs +0 -0
- /package/build/{Snackbar → Prompt/Snackbar}/useSnackbar.js +0 -0
- /package/build/{Snackbar → Prompt/Snackbar}/useSnackbar.mjs +0 -0
- /package/src/{Snackbar → Prompt/Snackbar}/useSnackbar.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.js","sources":["../../src/Snackbar/Snackbar.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport Button from '../Button';\nimport Body from '../Body';\nimport type { ThemeDark, ThemeLight } from '../common';\nimport withNextPortal from '../WithNextPortal/WithNextPortal';\n\nconst CSS_TRANSITION_DURATION = 400;\n\nexport interface SnackbarProps {\n action?: {\n label: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n };\n text: React.ReactNode;\n /** @deprecated Has no effect. Snackbar theming is based on ThemeProvider. */\n theme?: ThemeLight | ThemeDark;\n timeout: number;\n timestamp: number;\n}\n\ninterface SnackbarState extends Pick<SnackbarProps, 'action' | 'text'> {\n visible: boolean;\n}\n\nexport const Snackbar = (props: SnackbarProps) => {\n const bodyRef = useRef<HTMLSpanElement>(null);\n const leaveTimeout = useRef(0);\n const transitionTimeout = useRef(0);\n /** The props of the last committed render, as `this.props` was in the class component. */\n const committedProps = useRef(props);\n\n const [state, setState] = useState<SnackbarState>({\n visible: false,\n text: '',\n });\n\n useEffect(\n () => () => {\n window.clearTimeout(leaveTimeout.current);\n window.clearTimeout(transitionTimeout.current);\n },\n [],\n );\n\n // Runs after every render to mirror the componentDidUpdate lifecycle this component previously\n // relied on, including the shouldComponentUpdate guard that ignored every update without text.\n // Layout, not passive, so a notification is shown or replaced before the browser paints, as\n // componentDidUpdate did. Both rules below are disabled on purpose: the dependency-less effect\n // and its synchronous state updates are what keep this conversion behaviour-identical.\n /* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */\n useLayoutEffect(() => {\n const previousProps = committedProps.current;\n committedProps.current = props;\n\n const { action, text, timestamp } = props;\n\n // shouldComponentUpdate bailed out whenever the incoming text was empty. That also blocked the\n // updates scheduled below, so a Snackbar whose text is cleared stays on screen until it is\n // given text again. Preserved here deliberately to keep this refactor behaviour-identical.\n const updateWhileTextIsPresent = (update: () => void) => {\n if (committedProps.current.text) {\n update();\n }\n };\n\n const setLeaveTimeout = () => {\n leaveTimeout.current = window.setTimeout(() => {\n updateWhileTextIsPresent(() => setState((current) => ({ ...current, visible: false })));\n }, committedProps.current.timeout);\n };\n\n const show = () => {\n setState((current) => ({ ...current, visible: true, action, text }));\n setLeaveTimeout();\n };\n\n if (!text) {\n return;\n }\n\n if (!previousProps.text) {\n show();\n } else if (previousProps.timestamp !== timestamp) {\n window.clearTimeout(leaveTimeout.current);\n\n if (state.visible) {\n setState((current) => ({ ...current, visible: false }));\n transitionTimeout.current = window.setTimeout(() => {\n updateWhileTextIsPresent(show);\n }, CSS_TRANSITION_DURATION);\n } else {\n show();\n }\n }\n });\n /* eslint-enable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */\n\n const { action, text, visible } = state;\n const { timeout } = props;\n\n return (\n <div className=\"snackbar\" aria-live=\"assertive\" role=\"alert\">\n <CSSTransition\n nodeRef={bodyRef}\n in={visible}\n classNames=\"snackbar__text-container\"\n timeout={{\n appear: 0,\n enter: timeout,\n exit: CSS_TRANSITION_DURATION,\n }}\n unmountOnExit\n >\n <Body ref={bodyRef} as=\"span\" className=\"snackbar__text\">\n {text}\n {action ? (\n <Button className=\"snackbar__text__action\" v2 size=\"sm\" onClick={action.onClick}>\n {action.label}\n </Button>\n ) : null}\n </Body>\n </CSSTransition>\n </div>\n );\n};\n\nexport default withNextPortal(Snackbar);\n"],"names":["CSS_TRANSITION_DURATION","Snackbar","props","bodyRef","useRef","leaveTimeout","transitionTimeout","committedProps","state","setState","useState","visible","text","useEffect","window","clearTimeout","current","useLayoutEffect","previousProps","action","timestamp","updateWhileTextIsPresent","update","setLeaveTimeout","setTimeout","timeout","show","_jsx","className","role","children","CSSTransition","nodeRef","in","classNames","appear","enter","exit","unmountOnExit","_jsxs","Body","ref","as","Button","v2","size","onClick","label","withNextPortal"],"mappings":";;;;;;;;;;;AAQA,MAAMA,uBAAuB,GAAG,GAAG;AAkB5B,MAAMC,QAAQ,GAAIC,KAAoB,IAAI;AAC/C,EAAA,MAAMC,OAAO,GAAGC,YAAM,CAAkB,IAAI,CAAC;AAC7C,EAAA,MAAMC,YAAY,GAAGD,YAAM,CAAC,CAAC,CAAC;AAC9B,EAAA,MAAME,iBAAiB,GAAGF,YAAM,CAAC,CAAC,CAAC;AACnC;AACA,EAAA,MAAMG,cAAc,GAAGH,YAAM,CAACF,KAAK,CAAC;AAEpC,EAAA,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ,CAAgB;AAChDC,IAAAA,OAAO,EAAE,KAAK;AACdC,IAAAA,IAAI,EAAE;AACP,GAAA,CAAC;EAEFC,eAAS,CACP,MAAM,MAAK;AACTC,IAAAA,MAAM,CAACC,YAAY,CAACV,YAAY,CAACW,OAAO,CAAC;AACzCF,IAAAA,MAAM,CAACC,YAAY,CAACT,iBAAiB,CAACU,OAAO,CAAC;EAChD,CAAC,EACD,EAAE,CACH;AAED;AACA;AACA;AACA;AACA;AACA;AACAC,EAAAA,qBAAe,CAAC,MAAK;AACnB,IAAA,MAAMC,aAAa,GAAGX,cAAc,CAACS,OAAO;IAC5CT,cAAc,CAACS,OAA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EV;AAEA,qBAAeC,sBAAc,CAAC/C,QAAQ,CAAC;;;"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
|
2
|
-
import { CSSTransition } from 'react-transition-group';
|
|
3
|
-
import Button from '../Button/Button.resolver.mjs';
|
|
4
|
-
import Body from '../Body/Body.mjs';
|
|
5
|
-
import withNextPortalWrapper from '../WithNextPortal/WithNextPortal.mjs';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
const CSS_TRANSITION_DURATION = 400;
|
|
9
|
-
const Snackbar = props => {
|
|
10
|
-
const bodyRef = useRef(null);
|
|
11
|
-
const leaveTimeout = useRef(0);
|
|
12
|
-
const transitionTimeout = useRef(0);
|
|
13
|
-
/** The props of the last committed render, as `this.props` was in the class component. */
|
|
14
|
-
const committedProps = useRef(props);
|
|
15
|
-
const [state, setState] = useState({
|
|
16
|
-
visible: false,
|
|
17
|
-
text: ''
|
|
18
|
-
});
|
|
19
|
-
useEffect(() => () => {
|
|
20
|
-
window.clearTimeout(leaveTimeout.current);
|
|
21
|
-
window.clearTimeout(transitionTimeout.current);
|
|
22
|
-
}, []);
|
|
23
|
-
// Runs after every render to mirror the componentDidUpdate lifecycle this component previously
|
|
24
|
-
// relied on, including the shouldComponentUpdate guard that ignored every update without text.
|
|
25
|
-
// Layout, not passive, so a notification is shown or replaced before the browser paints, as
|
|
26
|
-
// componentDidUpdate did. Both rules below are disabled on purpose: the dependency-less effect
|
|
27
|
-
// and its synchronous state updates are what keep this conversion behaviour-identical.
|
|
28
|
-
/* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */
|
|
29
|
-
useLayoutEffect(() => {
|
|
30
|
-
const previousProps = committedProps.current;
|
|
31
|
-
committedProps.current = props;
|
|
32
|
-
const {
|
|
33
|
-
action,
|
|
34
|
-
text,
|
|
35
|
-
timestamp
|
|
36
|
-
} = props;
|
|
37
|
-
// shouldComponentUpdate bailed out whenever the incoming text was empty. That also blocked the
|
|
38
|
-
// updates scheduled below, so a Snackbar whose text is cleared stays on screen until it is
|
|
39
|
-
// given text again. Preserved here deliberately to keep this refactor behaviour-identical.
|
|
40
|
-
const updateWhileTextIsPresent = update => {
|
|
41
|
-
if (committedProps.current.text) {
|
|
42
|
-
update();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const setLeaveTimeout = () => {
|
|
46
|
-
leaveTimeout.current = window.setTimeout(() => {
|
|
47
|
-
updateWhileTextIsPresent(() => setState(current => ({
|
|
48
|
-
...current,
|
|
49
|
-
visible: false
|
|
50
|
-
})));
|
|
51
|
-
}, committedProps.current.timeout);
|
|
52
|
-
};
|
|
53
|
-
const show = () => {
|
|
54
|
-
setState(current => ({
|
|
55
|
-
...current,
|
|
56
|
-
visible: true,
|
|
57
|
-
action,
|
|
58
|
-
text
|
|
59
|
-
}));
|
|
60
|
-
setLeaveTimeout();
|
|
61
|
-
};
|
|
62
|
-
if (!text) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (!previousProps.text) {
|
|
66
|
-
show();
|
|
67
|
-
} else if (previousProps.timestamp !== timestamp) {
|
|
68
|
-
window.clearTimeout(leaveTimeout.current);
|
|
69
|
-
if (state.visible) {
|
|
70
|
-
setState(current => ({
|
|
71
|
-
...current,
|
|
72
|
-
visible: false
|
|
73
|
-
}));
|
|
74
|
-
transitionTimeout.current = window.setTimeout(() => {
|
|
75
|
-
updateWhileTextIsPresent(show);
|
|
76
|
-
}, CSS_TRANSITION_DURATION);
|
|
77
|
-
} else {
|
|
78
|
-
show();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
/* eslint-enable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */
|
|
83
|
-
const {
|
|
84
|
-
action,
|
|
85
|
-
text,
|
|
86
|
-
visible
|
|
87
|
-
} = state;
|
|
88
|
-
const {
|
|
89
|
-
timeout
|
|
90
|
-
} = props;
|
|
91
|
-
return /*#__PURE__*/jsx("div", {
|
|
92
|
-
className: "snackbar",
|
|
93
|
-
"aria-live": "assertive",
|
|
94
|
-
role: "alert",
|
|
95
|
-
children: /*#__PURE__*/jsx(CSSTransition, {
|
|
96
|
-
nodeRef: bodyRef,
|
|
97
|
-
in: visible,
|
|
98
|
-
classNames: "snackbar__text-container",
|
|
99
|
-
timeout: {
|
|
100
|
-
appear: 0,
|
|
101
|
-
enter: timeout,
|
|
102
|
-
exit: CSS_TRANSITION_DURATION
|
|
103
|
-
},
|
|
104
|
-
unmountOnExit: true,
|
|
105
|
-
children: /*#__PURE__*/jsxs(Body, {
|
|
106
|
-
ref: bodyRef,
|
|
107
|
-
as: "span",
|
|
108
|
-
className: "snackbar__text",
|
|
109
|
-
children: [text, action ? /*#__PURE__*/jsx(Button, {
|
|
110
|
-
className: "snackbar__text__action",
|
|
111
|
-
v2: true,
|
|
112
|
-
size: "sm",
|
|
113
|
-
onClick: action.onClick,
|
|
114
|
-
children: action.label
|
|
115
|
-
}) : null]
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
var SnackbarPortal = withNextPortalWrapper(Snackbar);
|
|
121
|
-
|
|
122
|
-
export { Snackbar, SnackbarPortal as default };
|
|
123
|
-
//# sourceMappingURL=Snackbar.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.mjs","sources":["../../src/Snackbar/Snackbar.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport Button from '../Button';\nimport Body from '../Body';\nimport type { ThemeDark, ThemeLight } from '../common';\nimport withNextPortal from '../WithNextPortal/WithNextPortal';\n\nconst CSS_TRANSITION_DURATION = 400;\n\nexport interface SnackbarProps {\n action?: {\n label: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n };\n text: React.ReactNode;\n /** @deprecated Has no effect. Snackbar theming is based on ThemeProvider. */\n theme?: ThemeLight | ThemeDark;\n timeout: number;\n timestamp: number;\n}\n\ninterface SnackbarState extends Pick<SnackbarProps, 'action' | 'text'> {\n visible: boolean;\n}\n\nexport const Snackbar = (props: SnackbarProps) => {\n const bodyRef = useRef<HTMLSpanElement>(null);\n const leaveTimeout = useRef(0);\n const transitionTimeout = useRef(0);\n /** The props of the last committed render, as `this.props` was in the class component. */\n const committedProps = useRef(props);\n\n const [state, setState] = useState<SnackbarState>({\n visible: false,\n text: '',\n });\n\n useEffect(\n () => () => {\n window.clearTimeout(leaveTimeout.current);\n window.clearTimeout(transitionTimeout.current);\n },\n [],\n );\n\n // Runs after every render to mirror the componentDidUpdate lifecycle this component previously\n // relied on, including the shouldComponentUpdate guard that ignored every update without text.\n // Layout, not passive, so a notification is shown or replaced before the browser paints, as\n // componentDidUpdate did. Both rules below are disabled on purpose: the dependency-less effect\n // and its synchronous state updates are what keep this conversion behaviour-identical.\n /* eslint-disable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */\n useLayoutEffect(() => {\n const previousProps = committedProps.current;\n committedProps.current = props;\n\n const { action, text, timestamp } = props;\n\n // shouldComponentUpdate bailed out whenever the incoming text was empty. That also blocked the\n // updates scheduled below, so a Snackbar whose text is cleared stays on screen until it is\n // given text again. Preserved here deliberately to keep this refactor behaviour-identical.\n const updateWhileTextIsPresent = (update: () => void) => {\n if (committedProps.current.text) {\n update();\n }\n };\n\n const setLeaveTimeout = () => {\n leaveTimeout.current = window.setTimeout(() => {\n updateWhileTextIsPresent(() => setState((current) => ({ ...current, visible: false })));\n }, committedProps.current.timeout);\n };\n\n const show = () => {\n setState((current) => ({ ...current, visible: true, action, text }));\n setLeaveTimeout();\n };\n\n if (!text) {\n return;\n }\n\n if (!previousProps.text) {\n show();\n } else if (previousProps.timestamp !== timestamp) {\n window.clearTimeout(leaveTimeout.current);\n\n if (state.visible) {\n setState((current) => ({ ...current, visible: false }));\n transitionTimeout.current = window.setTimeout(() => {\n updateWhileTextIsPresent(show);\n }, CSS_TRANSITION_DURATION);\n } else {\n show();\n }\n }\n });\n /* eslint-enable react-hooks/exhaustive-deps, react-hooks/set-state-in-effect */\n\n const { action, text, visible } = state;\n const { timeout } = props;\n\n return (\n <div className=\"snackbar\" aria-live=\"assertive\" role=\"alert\">\n <CSSTransition\n nodeRef={bodyRef}\n in={visible}\n classNames=\"snackbar__text-container\"\n timeout={{\n appear: 0,\n enter: timeout,\n exit: CSS_TRANSITION_DURATION,\n }}\n unmountOnExit\n >\n <Body ref={bodyRef} as=\"span\" className=\"snackbar__text\">\n {text}\n {action ? (\n <Button className=\"snackbar__text__action\" v2 size=\"sm\" onClick={action.onClick}>\n {action.label}\n </Button>\n ) : null}\n </Body>\n </CSSTransition>\n </div>\n );\n};\n\nexport default withNextPortal(Snackbar);\n"],"names":["CSS_TRANSITION_DURATION","Snackbar","props","bodyRef","useRef","leaveTimeout","transitionTimeout","committedProps","state","setState","useState","visible","text","useEffect","window","clearTimeout","current","useLayoutEffect","previousProps","action","timestamp","updateWhileTextIsPresent","update","setLeaveTimeout","setTimeout","timeout","show","_jsx","className","role","children","CSSTransition","nodeRef","in","classNames","appear","enter","exit","unmountOnExit","_jsxs","Body","ref","as","Button","v2","size","onClick","label","withNextPortal"],"mappings":";;;;;;;AAQA,MAAMA,uBAAuB,GAAG,GAAG;AAkB5B,MAAMC,QAAQ,GAAIC,KAAoB,IAAI;AAC/C,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAAkB,IAAI,CAAC;AAC7C,EAAA,MAAMC,YAAY,GAAGD,MAAM,CAAC,CAAC,CAAC;AAC9B,EAAA,MAAME,iBAAiB,GAAGF,MAAM,CAAC,CAAC,CAAC;AACnC;AACA,EAAA,MAAMG,cAAc,GAAGH,MAAM,CAACF,KAAK,CAAC;AAEpC,EAAA,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAgB;AAChDC,IAAAA,OAAO,EAAE,KAA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AAAA,EAAE,EAAC,MAAM;AAACd,QAAAA,SAAS,EAAC,gBAAgB;AAAAE,QAAAA,QAAA,GACrDlB,IAAI,EACJO,MAAM,gBACLQ,GAAA,CAACgB,MAAM,EAAA;AAACf,UAAAA,SAAS,EAAC,wBAAwB;UAACgB,EAAE,EAAA,IAAA;AAACC,UAAAA,IAAI,EAAC,IAAI;UAACC,OAAO,EAAE3B,MAAM,CAAC2B,OAAQ;UAAAhB,QAAA,EAC7EX,MAAM,CAAC4B;SACF,CAAC,GACP,IAAI;OACJ;KACO;AACjB,GAAK,CAAC;AAEV;AAEA,qBAAeC,qBAAc,CAAC/C,QAAQ,CAAC;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarContext.js","sources":["../../src/Snackbar/SnackbarContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { SnackbarProps } from './Snackbar';\n\nexport type SnackbarContextType = {\n createSnackbar: (props: Omit<SnackbarProps, 'timeout' | 'timestamp'>) => void;\n};\n\nexport const SnackbarContext = createContext<SnackbarContextType>({ createSnackbar: () => {} });\n\nexport const SnackbarConsumer = SnackbarContext.Consumer;\n"],"names":["SnackbarContext","createContext","createSnackbar","SnackbarConsumer","Consumer"],"mappings":";;;;AAQO,MAAMA,eAAe,gBAAGC,mBAAa,CAAsB;EAAEC,cAAc,EAAEA,MAAK,CAAE;AAAC,CAAE;AAEvF,MAAMC,gBAAgB,GAAGH,eAAe,CAACI;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarContext.mjs","sources":["../../src/Snackbar/SnackbarContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { SnackbarProps } from './Snackbar';\n\nexport type SnackbarContextType = {\n createSnackbar: (props: Omit<SnackbarProps, 'timeout' | 'timestamp'>) => void;\n};\n\nexport const SnackbarContext = createContext<SnackbarContextType>({ createSnackbar: () => {} });\n\nexport const SnackbarConsumer = SnackbarContext.Consumer;\n"],"names":["SnackbarContext","createContext","createSnackbar","SnackbarConsumer","Consumer"],"mappings":";;AAQO,MAAMA,eAAe,gBAAGC,aAAa,CAAsB;EAAEC,cAAc,EAAEA,MAAK,CAAE;AAAC,CAAE;AAEvF,MAAMC,gBAAgB,GAAGH,eAAe,CAACI;;"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var Snackbar = require('./Snackbar.js');
|
|
7
|
-
var SnackbarContext = require('./SnackbarContext.js');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
|
|
10
|
-
function SnackbarProvider({
|
|
11
|
-
timeout = 4500,
|
|
12
|
-
children
|
|
13
|
-
}) {
|
|
14
|
-
const [state, setState] = React.useState({
|
|
15
|
-
text: '',
|
|
16
|
-
timestamp: 0
|
|
17
|
-
});
|
|
18
|
-
const {
|
|
19
|
-
action,
|
|
20
|
-
text,
|
|
21
|
-
timestamp
|
|
22
|
-
} = state;
|
|
23
|
-
return /*#__PURE__*/jsxRuntime.jsxs(SnackbarContext.SnackbarContext.Provider, {
|
|
24
|
-
value: React.useMemo(() => ({
|
|
25
|
-
createSnackbar: ({
|
|
26
|
-
action,
|
|
27
|
-
text
|
|
28
|
-
}) => {
|
|
29
|
-
setState({
|
|
30
|
-
action,
|
|
31
|
-
text,
|
|
32
|
-
timestamp: Date.now()
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}), []),
|
|
36
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Snackbar.default, {
|
|
37
|
-
action: action,
|
|
38
|
-
text: text,
|
|
39
|
-
timestamp: timestamp,
|
|
40
|
-
timeout: timeout
|
|
41
|
-
}), children]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.default = SnackbarProvider;
|
|
46
|
-
//# sourceMappingURL=SnackbarProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarProvider.js","sources":["../../src/Snackbar/SnackbarProvider.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\n\nimport SnackbarPortal, { SnackbarProps } from './Snackbar';\nimport { SnackbarContext } from './SnackbarContext';\n\nexport interface SnackbarProviderProps {\n timeout?: number;\n children?: React.ReactNode;\n}\n\nexport default function SnackbarProvider({ timeout = 4500, children }: SnackbarProviderProps) {\n const [state, setState] = useState<Omit<SnackbarProps, 'timeout'>>({\n text: '',\n timestamp: 0,\n });\n const { action, text, timestamp } = state;\n\n return (\n <SnackbarContext.Provider\n value={useMemo(\n () => ({\n createSnackbar: ({ action, text }) => {\n setState({ action, text, timestamp: Date.now() });\n },\n }),\n [],\n )}\n >\n <SnackbarPortal action={action} text={text} timestamp={timestamp} timeout={timeout} />\n {children}\n </SnackbarContext.Provider>\n );\n}\n"],"names":["SnackbarProvider","timeout","children","state","setState","useState","text","timestamp","action","_jsxs","SnackbarContext","Provider","value","useMemo","createSnackbar","Date","now","_jsx","SnackbarPortal"],"mappings":";;;;;;;;;AAUc,SAAUA,gBAAgBA,CAAC;AAAEC,EAAAA,OAAO,GAAG,IAAI;AAAEC,EAAAA;AAAQ,CAAyB,EAAA;AAC1F,EAAA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ,CAAiC;AACjEC,IAAAA,IAAI,EAAE,EAAE;AACRC,IAAAA,SAAS,EAAE;AACZ,GAAA,CAAC;EACF,MAAM;IAAEC,MAAM;IAAEF,IAAI;AAAEC,IAAAA;AAAS,GAAE,GAAGJ,KAAK;AAEzC,EAAA,oBACEM,eAAA,CAACC,+BAAe,CAACC,QAAQ,EAAA;IACvBC,KAAK,EAAEC,aAAO,CACZ,OAAO;AACLC,MAAAA,cAAc,EAAEA,CAAC;QAAEN,MAAM;AAAEF,QAAAA;AAAI,OAAE,KAAI;AACnCF,QAAAA,QAAQ,CAAC;UAAEI,MAAM;UAAEF,IAAI;AAAEC,UAAAA,SAAS,EAAEQ,IAAI,CAACC,GAAG;AAAE,SAAE,CAAC;AACnD,MAAA;KACD,CAAC,EACF,EAAE,CACF;IAAAd,QAAA,EAAA,cAEFe,cAAA,CAACC,gBAAc,EAAA;AAACV,MAAAA,MAAM,EAAEA,MAAO;AAACF,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,SAAS,EAAEA,SAAU;AAACN,MAAAA,OAAO,EAAEA;KAAQ,CACnF,EAACC,QAAQ;AAAA,GACe,CAAC;AAE/B;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useState, useMemo } from 'react';
|
|
2
|
-
import SnackbarPortal from './Snackbar.mjs';
|
|
3
|
-
import { SnackbarContext } from './SnackbarContext.mjs';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
function SnackbarProvider({
|
|
7
|
-
timeout = 4500,
|
|
8
|
-
children
|
|
9
|
-
}) {
|
|
10
|
-
const [state, setState] = useState({
|
|
11
|
-
text: '',
|
|
12
|
-
timestamp: 0
|
|
13
|
-
});
|
|
14
|
-
const {
|
|
15
|
-
action,
|
|
16
|
-
text,
|
|
17
|
-
timestamp
|
|
18
|
-
} = state;
|
|
19
|
-
return /*#__PURE__*/jsxs(SnackbarContext.Provider, {
|
|
20
|
-
value: useMemo(() => ({
|
|
21
|
-
createSnackbar: ({
|
|
22
|
-
action,
|
|
23
|
-
text
|
|
24
|
-
}) => {
|
|
25
|
-
setState({
|
|
26
|
-
action,
|
|
27
|
-
text,
|
|
28
|
-
timestamp: Date.now()
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}), []),
|
|
32
|
-
children: [/*#__PURE__*/jsx(SnackbarPortal, {
|
|
33
|
-
action: action,
|
|
34
|
-
text: text,
|
|
35
|
-
timestamp: timestamp,
|
|
36
|
-
timeout: timeout
|
|
37
|
-
}), children]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { SnackbarProvider as default };
|
|
42
|
-
//# sourceMappingURL=SnackbarProvider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarProvider.mjs","sources":["../../src/Snackbar/SnackbarProvider.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\n\nimport SnackbarPortal, { SnackbarProps } from './Snackbar';\nimport { SnackbarContext } from './SnackbarContext';\n\nexport interface SnackbarProviderProps {\n timeout?: number;\n children?: React.ReactNode;\n}\n\nexport default function SnackbarProvider({ timeout = 4500, children }: SnackbarProviderProps) {\n const [state, setState] = useState<Omit<SnackbarProps, 'timeout'>>({\n text: '',\n timestamp: 0,\n });\n const { action, text, timestamp } = state;\n\n return (\n <SnackbarContext.Provider\n value={useMemo(\n () => ({\n createSnackbar: ({ action, text }) => {\n setState({ action, text, timestamp: Date.now() });\n },\n }),\n [],\n )}\n >\n <SnackbarPortal action={action} text={text} timestamp={timestamp} timeout={timeout} />\n {children}\n </SnackbarContext.Provider>\n );\n}\n"],"names":["SnackbarProvider","timeout","children","state","setState","useState","text","timestamp","action","_jsxs","SnackbarContext","Provider","value","useMemo","createSnackbar","Date","now","_jsx","SnackbarPortal"],"mappings":";;;;;AAUc,SAAUA,gBAAgBA,CAAC;AAAEC,EAAAA,OAAO,GAAG,IAAI;AAAEC,EAAAA;AAAQ,CAAyB,EAAA;AAC1F,EAAA,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAiC;AACjEC,IAAAA,IAAI,EAAE,EAAE;AACRC,IAAAA,SAAS,EAAE;AACZ,GAAA,CAAC;EACF,MAAM;IAAEC,MAAM;IAAEF,IAAI;AAAEC,IAAAA;AAAS,GAAE,GAAGJ,KAAK;AAEzC,EAAA,oBACEM,IAAA,CAACC,eAAe,CAACC,QAAQ,EAAA;IACvBC,KAAK,EAAEC,OAAO,CACZ,OAAO;AACLC,MAAAA,cAAc,EAAEA,CAAC;QAAEN,MAAM;AAAEF,QAAAA;AAAI,OAAE,KAAI;AACnCF,QAAAA,QAAQ,CAAC;UAAEI,MAAM;UAAEF,IAAI;AAAEC,UAAAA,SAAS,EAAEQ,IAAI,CAACC,GAAG;AAAE,SAAE,CAAC;AACnD,MAAA;KACD,CAAC,EACF,EAAE,CACF;IAAAd,QAAA,EAAA,cAEFe,GAAA,CAACC,cAAc,EAAA;AAACV,MAAAA,MAAM,EAAEA,MAAO;AAACF,MAAAA,IAAI,EAAEA,IAAK;AAACC,MAAAA,SAAS,EAAEA,SAAU;AAACN,MAAAA,OAAO,EAAEA;KAAQ,CACnF,EAACC,QAAQ;AAAA,GACe,CAAC;AAE/B;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSnackbar.js","sources":["../../src/Snackbar/useSnackbar.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport { SnackbarContext } from './SnackbarContext';\n\nfunction useSnackbar() {\n const { createSnackbar } = useContext(SnackbarContext);\n\n return createSnackbar;\n}\n\nexport default useSnackbar;\n"],"names":["useSnackbar","createSnackbar","useContext","SnackbarContext"],"mappings":";;;;;;;AAIA,SAASA,WAAWA,GAAA;EAClB,MAAM;AAAEC,IAAAA;AAAc,GAAE,GAAGC,gBAAU,CAACC,+BAAe,CAAC;AAEtD,EAAA,OAAOF,cAAc;AACvB;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSnackbar.mjs","sources":["../../src/Snackbar/useSnackbar.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport { SnackbarContext } from './SnackbarContext';\n\nfunction useSnackbar() {\n const { createSnackbar } = useContext(SnackbarContext);\n\n return createSnackbar;\n}\n\nexport default useSnackbar;\n"],"names":["useSnackbar","createSnackbar","useContext","SnackbarContext"],"mappings":";;;AAIA,SAASA,WAAWA,GAAA;EAClB,MAAM;AAAEC,IAAAA;AAAc,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;AAEtD,EAAA,OAAOF,cAAc;AACvB;;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
.snackbar {
|
|
2
|
-
text-align: center;
|
|
3
|
-
position: fixed;
|
|
4
|
-
inset-block-end: 0;
|
|
5
|
-
inset-inline-start: 0;
|
|
6
|
-
inset-inline-end: 0;
|
|
7
|
-
z-index: 1060;
|
|
8
|
-
}
|
|
9
|
-
.snackbar__text {
|
|
10
|
-
background: #37517e;
|
|
11
|
-
color: #ffffff;
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
border-radius: 2px;
|
|
14
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
text-align: start;
|
|
18
|
-
font-size: var(--wds-font-size-body);
|
|
19
|
-
margin-block: 0;
|
|
20
|
-
margin-inline: var(--size-16);
|
|
21
|
-
padding-block: var(--size-8);
|
|
22
|
-
padding-inline: var(--size-16);
|
|
23
|
-
inline-size: calc(100% - var(--size-32));
|
|
24
|
-
transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
25
|
-
}
|
|
26
|
-
.np-theme-personal .snackbar__text {
|
|
27
|
-
box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
|
|
28
|
-
position: relative;
|
|
29
|
-
background: var(--color-contrast-theme);
|
|
30
|
-
border-radius: var(--radius-small);
|
|
31
|
-
color: var(--color-contrast-overlay);
|
|
32
|
-
}
|
|
33
|
-
.np-theme-personal .snackbar__text::after {
|
|
34
|
-
display: block;
|
|
35
|
-
border-radius: inherit;
|
|
36
|
-
block-size: 100%;
|
|
37
|
-
inline-size: 100%;
|
|
38
|
-
content: "";
|
|
39
|
-
position: absolute;
|
|
40
|
-
inset-inline-start: 0;
|
|
41
|
-
inset-block-start: 0;
|
|
42
|
-
z-index: -1;
|
|
43
|
-
background-color: var(--color-background-neutral);
|
|
44
|
-
}
|
|
45
|
-
.np-theme-personal--dark .snackbar__text,
|
|
46
|
-
.np-theme-personal--forest-green .snackbar__text {
|
|
47
|
-
box-shadow: none;
|
|
48
|
-
}
|
|
49
|
-
@media (min-width: 600px) {
|
|
50
|
-
.snackbar__text {
|
|
51
|
-
inline-size: auto;
|
|
52
|
-
max-inline-size: 600px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
.snackbar__text__action {
|
|
56
|
-
flex-shrink: 0;
|
|
57
|
-
margin-inline-start: var(--size-16);
|
|
58
|
-
}
|
|
59
|
-
.snackbar__text-container-enter,
|
|
60
|
-
.snackbar__text-container-exit {
|
|
61
|
-
transform: translateY(calc(100% + 10px));
|
|
62
|
-
}
|
|
63
|
-
.snackbar__text-container-enter-active {
|
|
64
|
-
transform: translateY(-16px);
|
|
65
|
-
transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
|
|
66
|
-
}
|
|
67
|
-
@media (min-width: 600px) {
|
|
68
|
-
.snackbar__text-container-enter-active {
|
|
69
|
-
transform: translateY(-24px);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ThemeDark, ThemeLight } from '../common';
|
|
2
|
-
export interface SnackbarProps {
|
|
3
|
-
action?: {
|
|
4
|
-
label: string;
|
|
5
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
-
};
|
|
7
|
-
text: React.ReactNode;
|
|
8
|
-
/** @deprecated Has no effect. Snackbar theming is based on ThemeProvider. */
|
|
9
|
-
theme?: ThemeLight | ThemeDark;
|
|
10
|
-
timeout: number;
|
|
11
|
-
timestamp: number;
|
|
12
|
-
}
|
|
13
|
-
export declare const Snackbar: (props: SnackbarProps) => import("react").JSX.Element;
|
|
14
|
-
declare const _default: (props: SnackbarProps) => import("react").ReactPortal | null;
|
|
15
|
-
export default _default;
|
|
16
|
-
//# sourceMappingURL=Snackbar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAKvD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;KACtD,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,gCAoG5C,CAAC;;AAEF,wBAAwC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarContext.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/SnackbarContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,IAAI,CAAC;CAC/E,CAAC;AAEF,eAAO,MAAM,eAAe,8CAAmE,CAAC;AAEhG,eAAO,MAAM,gBAAgB,+CAA2B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarProvider.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/SnackbarProvider.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,OAAc,EAAE,QAAQ,EAAE,EAAE,qBAAqB,+BAsB3F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSnackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/useSnackbar.ts"],"names":[],"mappings":"AAIA,iBAAS,WAAW,uFAInB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
<Meta title="Navigation/FlowNavigation/Critical Banner Guide" />
|
|
4
|
-
|
|
5
|
-
# Critical Banner in FlowNavigation
|
|
6
|
-
|
|
7
|
-
The `FlowNavigation` component supports displaying critical banners above the navigation, by passing a `banner` prop.
|
|
8
|
-
|
|
9
|
-
`banner` accepts either the internal `CriticalBannerProps` shape, or the legacy backend `CriticalBannerData` shape (e.g. as received from `navigation-service`/`navigation-ui`) — `FlowNavigation` maps the legacy shape to `CriticalBannerProps` internally, so no manual mapping is required.
|
|
10
|
-
|
|
11
|
-
## Basic Usage
|
|
12
|
-
|
|
13
|
-
When you're using `FlowNavigation` directly from `@transferwise/components`.
|
|
14
|
-
|
|
15
|
-
<Source
|
|
16
|
-
code={`import { FlowNavigation, CriticalBannerProps } from '@transferwise/components';
|
|
17
|
-
|
|
18
|
-
const banner: CriticalBannerProps = {
|
|
19
|
-
sentiment: 'negative',
|
|
20
|
-
title: 'Action required',
|
|
21
|
-
description: 'Please verify your identity to continue with this transfer.',
|
|
22
|
-
action: {
|
|
23
|
-
label: 'Verify now',
|
|
24
|
-
onClick: () => {
|
|
25
|
-
// Handle action
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
<FlowNavigation
|
|
31
|
-
banner={banner}
|
|
32
|
-
steps={steps}
|
|
33
|
-
activeStep={activeStep}
|
|
34
|
-
avatar={avatar}
|
|
35
|
-
onClose={onClose}
|
|
36
|
-
/>;
|
|
37
|
-
`}
|
|
38
|
-
language="typescript"
|
|
39
|
-
dark
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
## Using Legacy Backend Data
|
|
43
|
-
|
|
44
|
-
If your application receives banner data from a backend service (e.g. navigation-ui) in the legacy shape, you can pass it directly to `banner` — `FlowNavigation` maps it to the internal `CriticalBannerProps` shape automatically.
|
|
45
|
-
|
|
46
|
-
<Source
|
|
47
|
-
code={`import { FlowNavigation, CriticalBannerData } from '@transferwise/components';
|
|
48
|
-
|
|
49
|
-
const banner: CriticalBannerData = {
|
|
50
|
-
id: 'banner-123',
|
|
51
|
-
title: 'Your account requires attention', // Rendered as the banner description
|
|
52
|
-
subtitle: 'Action required', // Rendered as the banner title
|
|
53
|
-
style: 'WARNING',
|
|
54
|
-
action: { label: 'Take action', href: '/action' },
|
|
55
|
-
collapsed: false, // Rendered expanded
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
<FlowNavigation
|
|
59
|
-
banner={banner}
|
|
60
|
-
steps={steps}
|
|
61
|
-
activeStep={activeStep}
|
|
62
|
-
/>;
|
|
63
|
-
`}
|
|
64
|
-
language="typescript"
|
|
65
|
-
dark
|
|
66
|
-
/>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
.snackbar {
|
|
2
|
-
text-align: center;
|
|
3
|
-
position: fixed;
|
|
4
|
-
inset-block-end: 0;
|
|
5
|
-
inset-inline-start: 0;
|
|
6
|
-
inset-inline-end: 0;
|
|
7
|
-
z-index: 1060;
|
|
8
|
-
}
|
|
9
|
-
.snackbar__text {
|
|
10
|
-
background: #37517e;
|
|
11
|
-
color: #ffffff;
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
border-radius: 2px;
|
|
14
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
text-align: start;
|
|
18
|
-
font-size: var(--wds-font-size-body);
|
|
19
|
-
margin-block: 0;
|
|
20
|
-
margin-inline: var(--size-16);
|
|
21
|
-
padding-block: var(--size-8);
|
|
22
|
-
padding-inline: var(--size-16);
|
|
23
|
-
inline-size: calc(100% - var(--size-32));
|
|
24
|
-
transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
25
|
-
}
|
|
26
|
-
.np-theme-personal .snackbar__text {
|
|
27
|
-
box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
|
|
28
|
-
position: relative;
|
|
29
|
-
background: var(--color-contrast-theme);
|
|
30
|
-
border-radius: var(--radius-small);
|
|
31
|
-
color: var(--color-contrast-overlay);
|
|
32
|
-
}
|
|
33
|
-
.np-theme-personal .snackbar__text::after {
|
|
34
|
-
display: block;
|
|
35
|
-
border-radius: inherit;
|
|
36
|
-
block-size: 100%;
|
|
37
|
-
inline-size: 100%;
|
|
38
|
-
content: "";
|
|
39
|
-
position: absolute;
|
|
40
|
-
inset-inline-start: 0;
|
|
41
|
-
inset-block-start: 0;
|
|
42
|
-
z-index: -1;
|
|
43
|
-
background-color: var(--color-background-neutral);
|
|
44
|
-
}
|
|
45
|
-
.np-theme-personal--dark .snackbar__text,
|
|
46
|
-
.np-theme-personal--forest-green .snackbar__text {
|
|
47
|
-
box-shadow: none;
|
|
48
|
-
}
|
|
49
|
-
@media (min-width: 600px) {
|
|
50
|
-
.snackbar__text {
|
|
51
|
-
inline-size: auto;
|
|
52
|
-
max-inline-size: 600px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
.snackbar__text__action {
|
|
56
|
-
flex-shrink: 0;
|
|
57
|
-
margin-inline-start: var(--size-16);
|
|
58
|
-
}
|
|
59
|
-
.snackbar__text-container-enter,
|
|
60
|
-
.snackbar__text-container-exit {
|
|
61
|
-
transform: translateY(calc(100% + 10px));
|
|
62
|
-
}
|
|
63
|
-
.snackbar__text-container-enter-active {
|
|
64
|
-
transform: translateY(-16px);
|
|
65
|
-
transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
|
|
66
|
-
}
|
|
67
|
-
@media (min-width: 600px) {
|
|
68
|
-
.snackbar__text-container-enter-active {
|
|
69
|
-
transform: translateY(-24px);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
@import (reference) "./../styles/variables/zindex.less";
|
|
2
|
-
@import (reference) "./../styles/variables/neptune-tokens.less";
|
|
3
|
-
|
|
4
|
-
.snackbar {
|
|
5
|
-
text-align: center;
|
|
6
|
-
position: fixed;
|
|
7
|
-
bottom: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
|
|
10
|
-
right: 0;
|
|
11
|
-
|
|
12
|
-
z-index: @zindex-mobile-nav;
|
|
13
|
-
|
|
14
|
-
&__text {
|
|
15
|
-
background: @color-navy-background-elevated;
|
|
16
|
-
color: @color-navy-content-primary;
|
|
17
|
-
display: inline-flex;
|
|
18
|
-
border-radius: 2px;
|
|
19
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
text-align: left;
|
|
23
|
-
|
|
24
|
-
font-size: var(--wds-font-size-body);
|
|
25
|
-
margin: 0 var(--size-16);
|
|
26
|
-
padding: var(--size-8) var(--size-16);
|
|
27
|
-
width: calc(100% - var(--size-32));
|
|
28
|
-
transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
29
|
-
|
|
30
|
-
.np-theme-personal & {
|
|
31
|
-
box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
|
|
32
|
-
position: relative;
|
|
33
|
-
background: var(--color-contrast-theme);
|
|
34
|
-
border-radius: var(--radius-small);
|
|
35
|
-
color: var(--color-contrast-overlay);
|
|
36
|
-
|
|
37
|
-
&::after {
|
|
38
|
-
display: block;
|
|
39
|
-
border-radius: inherit;
|
|
40
|
-
height: 100%;
|
|
41
|
-
width: 100%;
|
|
42
|
-
content: "";
|
|
43
|
-
position: absolute;
|
|
44
|
-
left: 0;
|
|
45
|
-
top: 0;
|
|
46
|
-
z-index: -1;
|
|
47
|
-
background-color: var(--color-background-neutral);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.np-theme-personal--dark &,
|
|
52
|
-
.np-theme-personal--forest-green & {
|
|
53
|
-
box-shadow: none;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@media (--screen-sm) {
|
|
57
|
-
width: auto;
|
|
58
|
-
max-width: 600px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&__action {
|
|
62
|
-
flex-shrink: 0;
|
|
63
|
-
margin-left: var(--size-16);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&-container-enter,
|
|
67
|
-
&-container-exit {
|
|
68
|
-
transform: translateY(calc(100% + 10px));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&-container-enter-active {
|
|
72
|
-
transform: translateY(-16px);
|
|
73
|
-
transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
|
|
74
|
-
|
|
75
|
-
@media (--screen-sm) {
|
|
76
|
-
transform: translateY(-24px);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|