@transferwise/components 46.161.3 → 46.162.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/build/FlowNavigation/FlowNavigation.js +24 -7
- package/build/FlowNavigation/FlowNavigation.js.map +1 -1
- package/build/FlowNavigation/FlowNavigation.mjs +24 -7
- package/build/FlowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/types/FlowNavigation/FlowNavigation.d.ts +4 -1
- package/build/types/FlowNavigation/FlowNavigation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/FlowNavigation/FlowNavigation.tsx +16 -9
- package/src/FlowNavigation/_stories/FlowNavigation.story.tsx +108 -0
- package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +68 -17
|
@@ -36,6 +36,18 @@ var FlowNavigation_messages = require('./FlowNavigation.messages.js');
|
|
|
36
36
|
var AnimatedLabel = require('./AnimatedLabel/AnimatedLabel.js');
|
|
37
37
|
var IconButton = require('../IconButton/IconButton.js');
|
|
38
38
|
var icons = require('@transferwise/icons');
|
|
39
|
+
require('../StatusIcon/StatusIcon.js');
|
|
40
|
+
require('../Body/Body.js');
|
|
41
|
+
require('../Prompt/PrimitivePrompt/PrimitivePrompt.js');
|
|
42
|
+
require('../Button/Button.resolver.js');
|
|
43
|
+
require('../_deprecated/Badge/Badge.js');
|
|
44
|
+
require('@wise/art');
|
|
45
|
+
require('@transferwise/neptune-validation');
|
|
46
|
+
require('../Provider/Direction/DirectionProvider.js');
|
|
47
|
+
require('../Primitives/PrimitiveButton/PrimitiveButton.js');
|
|
48
|
+
require('../Primitives/PrimitiveAnchor/PrimitiveAnchor.js');
|
|
49
|
+
require('../Link/Link.messages.js');
|
|
50
|
+
var CriticalBanner = require('../Prompt/CriticalBanner/CriticalBanner.js');
|
|
39
51
|
|
|
40
52
|
const defaultLogo = /*#__PURE__*/jsxRuntime.jsx(Logo.default, {});
|
|
41
53
|
const FlowNavigation = ({
|
|
@@ -46,6 +58,7 @@ const FlowNavigation = ({
|
|
|
46
58
|
onClose,
|
|
47
59
|
onGoBack,
|
|
48
60
|
steps,
|
|
61
|
+
banner = null,
|
|
49
62
|
showBottomBorder = true
|
|
50
63
|
}) => {
|
|
51
64
|
const intl = reactIntl.useIntl();
|
|
@@ -95,13 +108,17 @@ const FlowNavigation = ({
|
|
|
95
108
|
}) : null,
|
|
96
109
|
layout: !screenLg ? layouts.Layout.VERTICAL : layouts.Layout.HORIZONTAL
|
|
97
110
|
});
|
|
98
|
-
return /*#__PURE__*/jsxRuntime.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
112
|
+
children: [banner && /*#__PURE__*/jsxRuntime.jsx(CriticalBanner.CriticalBanner, {
|
|
113
|
+
...banner
|
|
114
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Container.default, {
|
|
115
|
+
size: "fluid",
|
|
116
|
+
className: clsx.clsx('np-flow-navigation', {
|
|
117
|
+
'np-flow-navigation--border-bottom': showBottomBorder,
|
|
118
|
+
'np-flow-navigation--no-steps': !hasSteps || done
|
|
119
|
+
}),
|
|
120
|
+
children: flowHeaderContent
|
|
121
|
+
})]
|
|
105
122
|
});
|
|
106
123
|
};
|
|
107
124
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.js","sources":["../../src/FlowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { Layout } from '../common';\nimport { CloseButton } from '../common/CloseButton';\nimport FlowHeader from '../common/FlowHeader/FlowHeader';\nimport Logo from '../Logo';\nimport Stepper, { type Step } from '../Stepper/Stepper';\nimport Container from '../Container';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './AnimatedLabel';\nimport IconButton from '../IconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nconst defaultLogo = <Logo />;\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: (() => void) | React.MouseEventHandler<HTMLButtonElement>;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If not provided, the stepper won't show. */\n steps?: readonly Step[];\n /**\n * Controls whether the bottom border is displayed.\n * @default true\n */\n showBottomBorder?: boolean;\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = defaultLogo,\n done = false,\n onClose,\n onGoBack,\n steps,\n showBottomBorder = true,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const hasSteps = steps && steps.length > 0;\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n const newAvatar = done ? null : avatar;\n\n const flowHeaderContent = (\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && hasSteps && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && hasSteps ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n );\n\n return (\n <Container\n
|
|
1
|
+
{"version":3,"file":"FlowNavigation.js","sources":["../../src/FlowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { Layout } from '../common';\nimport { CloseButton } from '../common/CloseButton';\nimport FlowHeader from '../common/FlowHeader/FlowHeader';\nimport Logo from '../Logo';\nimport Stepper, { type Step } from '../Stepper/Stepper';\nimport Container from '../Container';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './AnimatedLabel';\nimport IconButton from '../IconButton';\nimport { ArrowLeft } from '@transferwise/icons';\nimport { CriticalBanner, CriticalBannerProps } from '../Prompt';\n\nconst defaultLogo = <Logo />;\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: (() => void) | React.MouseEventHandler<HTMLButtonElement>;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If not provided, the stepper won't show. */\n steps?: readonly Step[];\n /** Optional critical banner data, to be displayed above the flow navigation. */\n banner?: CriticalBannerProps | null;\n /**\n * Controls whether the bottom border is displayed.\n * @default true\n */\n showBottomBorder?: boolean;\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = defaultLogo,\n done = false,\n onClose,\n onGoBack,\n steps,\n banner = null,\n showBottomBorder = true,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const hasSteps = steps && steps.length > 0;\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n const newAvatar = done ? null : avatar;\n\n const flowHeaderContent = (\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && hasSteps && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && hasSteps ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n );\n\n return (\n <>\n {banner && <CriticalBanner {...banner} />}\n <Container\n size=\"fluid\"\n className={clsx('np-flow-navigation', {\n 'np-flow-navigation--border-bottom': showBottomBorder,\n 'np-flow-navigation--no-steps': !hasSteps || done,\n })}\n >\n {flowHeaderContent}\n </Container>\n </>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["defaultLogo","_jsx","Logo","FlowNavigation","activeStep","avatar","logo","done","onClose","onGoBack","steps","banner","showBottomBorder","intl","useIntl","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","hasSteps","length","displayGoBack","closeButton","CloseButton","size","onClick","newAvatar","flowHeaderContent","FlowHeader","className","clsx","leftContent","_jsxs","_Fragment","children","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedLabel","activeLabel","rightContent","bottomContent","Stepper","layout","Layout","VERTICAL","HORIZONTAL","CriticalBanner","Container"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,WAAW,gBAAGC,cAAA,CAACC,YAAI,KAAG;AAyB5B,MAAMC,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAAM;AACNC,EAAAA,IAAI,GAAGN,WAAW;AAClBO,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ;EACRC,KAAK;AACLC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,gBAAgB,GAAG;AAAI,CACH,KAAI;AACxB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;AACtB,EAAA,MAAMC,QAAQ,GAAGC,2BAAa,CAACC,wBAAU,CAACC,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,wBAAU,CAACG,KAAK,CAAC;EAEhD,MAAMC,QAAQ,GAAGX,KAAK,IAAIA,KAAK,CAACY,MAAM,GAAG,CAAC;EAC1C,MAAMC,aAAa,GAAGd,QAAQ,IAAI,IAAI,IAAIL,UAAU,GAAG,CAAC;EAExD,MAAMoB,WAAW,GAAGhB,OAAO,IAAI,IAAI,iBAAIP,cAAA,CAACwB,uBAAW,EAAA;AAACC,IAAAA,IAAI,EAAC,IAAI;AAACC,IAAAA,OAAO,EAAE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TA,SAAS,IAAIJ,WAAW,iBAAIvB,cAAA,CAAA,MAAA,EAAA;AAAM8B,QAAAA,SAAS,EAAC;OAAO,CAAG,EACtDP,WAAW;AAAA,KACT,CACN;IACDuB,aAAa,EACX,CAACxC,IAAI,IAAIc,QAAQ,gBACfpB,cAAA,CAAC+C,eAAO,EAAA;AACN5C,MAAAA,UAAU,EAAEA,UAAW;AACvBM,MAAAA,KAAK,EAAEA,KAAM;MACbqB,SAAS,EAAEC,SAAI,CAAC,6BAA6B;KAAE,CAC/C,GACA,IACL;IACDiB,MAAM,EAAE,CAAC9B,QAAQ,GAAG+B,cAAM,CAACC,QAAQ,GAAGD,cAAM,CAACE;AAAW,GAAA,CAE3D;EAED,oBACElB,eAAA,CAAAC,mBAAA,EAAA;AAAAC,IAAAA,QAAA,EAAA,CACGzB,MAAM,iBAAIV,cAAA,CAACoD,6BAAc,EAAA;MAAA,GAAK1C;AAAM,KAAC,CAAG,eACzCV,cAAA,CAACqD,iBAAS,EAAA;AACR5B,MAAAA,IAAI,EAAC,OAAO;AACZK,MAAAA,SAAS,EAAEC,SAAI,CAAC,oBAAoB,EAAE;AACpC,QAAA,mCAAmC,EAAEpB,gBAAgB;QACrD,8BAA8B,EAAE,CAACS,QAAQ,IAAId;AAC9C,OAAA,CAAE;AAAA6B,MAAAA,QAAA,EAEFP;AAAiB,KACT,CACb;AAAA,GAAA,CAAG;AAEP;;"}
|
|
@@ -32,6 +32,18 @@ import messages from './FlowNavigation.messages.mjs';
|
|
|
32
32
|
import AnimatedLabel from './AnimatedLabel/AnimatedLabel.mjs';
|
|
33
33
|
import IconButton from '../IconButton/IconButton.mjs';
|
|
34
34
|
import { ArrowLeft } from '@transferwise/icons';
|
|
35
|
+
import '../StatusIcon/StatusIcon.mjs';
|
|
36
|
+
import '../Body/Body.mjs';
|
|
37
|
+
import '../Prompt/PrimitivePrompt/PrimitivePrompt.mjs';
|
|
38
|
+
import '../Button/Button.resolver.mjs';
|
|
39
|
+
import '../_deprecated/Badge/Badge.mjs';
|
|
40
|
+
import '@wise/art';
|
|
41
|
+
import '@transferwise/neptune-validation';
|
|
42
|
+
import '../Provider/Direction/DirectionProvider.mjs';
|
|
43
|
+
import '../Primitives/PrimitiveButton/PrimitiveButton.mjs';
|
|
44
|
+
import '../Primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
|
|
45
|
+
import '../Link/Link.messages.mjs';
|
|
46
|
+
import { CriticalBanner } from '../Prompt/CriticalBanner/CriticalBanner.mjs';
|
|
35
47
|
|
|
36
48
|
const defaultLogo = /*#__PURE__*/jsx(Logo, {});
|
|
37
49
|
const FlowNavigation = ({
|
|
@@ -42,6 +54,7 @@ const FlowNavigation = ({
|
|
|
42
54
|
onClose,
|
|
43
55
|
onGoBack,
|
|
44
56
|
steps,
|
|
57
|
+
banner = null,
|
|
45
58
|
showBottomBorder = true
|
|
46
59
|
}) => {
|
|
47
60
|
const intl = useIntl();
|
|
@@ -91,13 +104,17 @@ const FlowNavigation = ({
|
|
|
91
104
|
}) : null,
|
|
92
105
|
layout: !screenLg ? Layout.VERTICAL : Layout.HORIZONTAL
|
|
93
106
|
});
|
|
94
|
-
return /*#__PURE__*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
107
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
108
|
+
children: [banner && /*#__PURE__*/jsx(CriticalBanner, {
|
|
109
|
+
...banner
|
|
110
|
+
}), /*#__PURE__*/jsx(Container, {
|
|
111
|
+
size: "fluid",
|
|
112
|
+
className: clsx('np-flow-navigation', {
|
|
113
|
+
'np-flow-navigation--border-bottom': showBottomBorder,
|
|
114
|
+
'np-flow-navigation--no-steps': !hasSteps || done
|
|
115
|
+
}),
|
|
116
|
+
children: flowHeaderContent
|
|
117
|
+
})]
|
|
101
118
|
});
|
|
102
119
|
};
|
|
103
120
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.mjs","sources":["../../src/FlowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { Layout } from '../common';\nimport { CloseButton } from '../common/CloseButton';\nimport FlowHeader from '../common/FlowHeader/FlowHeader';\nimport Logo from '../Logo';\nimport Stepper, { type Step } from '../Stepper/Stepper';\nimport Container from '../Container';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './AnimatedLabel';\nimport IconButton from '../IconButton';\nimport { ArrowLeft } from '@transferwise/icons';\n\nconst defaultLogo = <Logo />;\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: (() => void) | React.MouseEventHandler<HTMLButtonElement>;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If not provided, the stepper won't show. */\n steps?: readonly Step[];\n /**\n * Controls whether the bottom border is displayed.\n * @default true\n */\n showBottomBorder?: boolean;\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = defaultLogo,\n done = false,\n onClose,\n onGoBack,\n steps,\n showBottomBorder = true,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const hasSteps = steps && steps.length > 0;\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n const newAvatar = done ? null : avatar;\n\n const flowHeaderContent = (\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && hasSteps && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && hasSteps ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n );\n\n return (\n <Container\n
|
|
1
|
+
{"version":3,"file":"FlowNavigation.mjs","sources":["../../src/FlowNavigation/FlowNavigation.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\nimport { Breakpoint } from '@transferwise/neptune-tokens';\n\nimport { Layout } from '../common';\nimport { CloseButton } from '../common/CloseButton';\nimport FlowHeader from '../common/FlowHeader/FlowHeader';\nimport Logo from '../Logo';\nimport Stepper, { type Step } from '../Stepper/Stepper';\nimport Container from '../Container';\n\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport messages from './FlowNavigation.messages';\nimport AnimatedLabel from './AnimatedLabel';\nimport IconButton from '../IconButton';\nimport { ArrowLeft } from '@transferwise/icons';\nimport { CriticalBanner, CriticalBannerProps } from '../Prompt';\n\nconst defaultLogo = <Logo />;\n\nexport interface FlowNavigationProps {\n /** @default 0 */\n activeStep?: number;\n avatar?: React.ReactNode;\n /** @default <Logo /> */\n logo?: React.ReactNode;\n /** @default false */\n done?: boolean;\n /** Called when the close button is clicked. If not provided the close button won't show */\n onClose?: (() => void) | React.MouseEventHandler<HTMLButtonElement>;\n /** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */\n onGoBack?: () => void;\n /** Steps to be displayed in stepper. If not provided, the stepper won't show. */\n steps?: readonly Step[];\n /** Optional critical banner data, to be displayed above the flow navigation. */\n banner?: CriticalBannerProps | null;\n /**\n * Controls whether the bottom border is displayed.\n * @default true\n */\n showBottomBorder?: boolean;\n}\n\nconst FlowNavigation = ({\n activeStep = 0,\n avatar,\n logo = defaultLogo,\n done = false,\n onClose,\n onGoBack,\n steps,\n banner = null,\n showBottomBorder = true,\n}: FlowNavigationProps) => {\n const intl = useIntl();\n const screenSm = useScreenSize(Breakpoint.SMALL);\n const screenLg = useScreenSize(Breakpoint.LARGE);\n\n const hasSteps = steps && steps.length > 0;\n const displayGoBack = onGoBack != null && activeStep > 0;\n\n const closeButton = onClose != null && <CloseButton size=\"lg\" onClick={onClose} />;\n const newAvatar = done ? null : avatar;\n\n const flowHeaderContent = (\n <FlowHeader\n className={clsx(\n 'np-flow-navigation__content',\n screenSm == null\n ? 'np-flow-navigation--hidden'\n : {\n 'np-flow-navigation--xs-max': !screenSm,\n // Size switches on parent container which may or may not have the same size as the window.\n 'np-flow-navigation--sm': screenSm,\n 'np-flow-navigation--lg': screenLg,\n },\n )}\n leftContent={\n <>\n {!screenSm && displayGoBack ? (\n <IconButton\n size={40}\n priority=\"tertiary\"\n type=\"default\"\n aria-label={intl.formatMessage(messages.back)}\n onClick={onGoBack}\n >\n <ArrowLeft />\n </IconButton>\n ) : (\n <div className=\"np-flow-header__left\">{logo}</div>\n )}\n {!screenSm && !done && hasSteps && (\n <AnimatedLabel className=\"m-x-1\" steps={steps} activeLabel={activeStep} />\n )}\n </>\n }\n rightContent={\n <div className=\"np-flow-header__right d-flex align-items-center justify-content-end order-2--lg\">\n {newAvatar}\n {newAvatar && closeButton && <span className=\"m-x-1\" />}\n {closeButton}\n </div>\n }\n bottomContent={\n !done && hasSteps ? (\n <Stepper\n activeStep={activeStep}\n steps={steps}\n className={clsx('np-flow-navigation__stepper')}\n />\n ) : null\n }\n layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}\n />\n );\n\n return (\n <>\n {banner && <CriticalBanner {...banner} />}\n <Container\n size=\"fluid\"\n className={clsx('np-flow-navigation', {\n 'np-flow-navigation--border-bottom': showBottomBorder,\n 'np-flow-navigation--no-steps': !hasSteps || done,\n })}\n >\n {flowHeaderContent}\n </Container>\n </>\n );\n};\n\nexport default FlowNavigation;\n"],"names":["defaultLogo","_jsx","Logo","FlowNavigation","activeStep","avatar","logo","done","onClose","onGoBack","steps","banner","showBottomBorder","intl","useIntl","screenSm","useScreenSize","Breakpoint","SMALL","screenLg","LARGE","hasSteps","length","displayGoBack","closeButton","CloseButton","size","onClick","newAvatar","flowHeaderContent","FlowHeader","className","clsx","leftContent","_jsxs","_Fragment","children","IconButton","priority","type","formatMessage","messages","back","ArrowLeft","AnimatedLabel","activeLabel","rightContent","bottomContent","Stepper","layout","Layout","VERTICAL","HORIZONTAL","CriticalBanner","Container"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,WAAW,gBAAGC,GAAA,CAACC,IAAI,KAAG;AAyB5B,MAAMC,cAAc,GAAGA,CAAC;AACtBC,EAAAA,UAAU,GAAG,CAAC;EACdC,MAAM;AACNC,EAAAA,IAAI,GAAGN,WAAW;AAClBO,EAAAA,IAAI,GAAG,KAAK;EACZC,OAAO;EACPC,QAAQ;EACRC,KAAK;AACLC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,gBAAgB,GAAG;AAAI,CACH,KAAI;AACxB,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE;AACtB,EAAA,MAAMC,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,KAAK,CAAC;AAChD,EAAA,MAAMC,QAAQ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Step } from '../Stepper/Stepper';
|
|
2
|
+
import { CriticalBannerProps } from '../Prompt';
|
|
2
3
|
export interface FlowNavigationProps {
|
|
3
4
|
/** @default 0 */
|
|
4
5
|
activeStep?: number;
|
|
@@ -13,12 +14,14 @@ export interface FlowNavigationProps {
|
|
|
13
14
|
onGoBack?: () => void;
|
|
14
15
|
/** Steps to be displayed in stepper. If not provided, the stepper won't show. */
|
|
15
16
|
steps?: readonly Step[];
|
|
17
|
+
/** Optional critical banner data, to be displayed above the flow navigation. */
|
|
18
|
+
banner?: CriticalBannerProps | null;
|
|
16
19
|
/**
|
|
17
20
|
* Controls whether the bottom border is displayed.
|
|
18
21
|
* @default true
|
|
19
22
|
*/
|
|
20
23
|
showBottomBorder?: boolean;
|
|
21
24
|
}
|
|
22
|
-
declare const FlowNavigation: ({ activeStep, avatar, logo, done, onClose, onGoBack, steps, showBottomBorder, }: FlowNavigationProps) => import("react").JSX.Element;
|
|
25
|
+
declare const FlowNavigation: ({ activeStep, avatar, logo, done, onClose, onGoBack, steps, banner, showBottomBorder, }: FlowNavigationProps) => import("react").JSX.Element;
|
|
23
26
|
export default FlowNavigation;
|
|
24
27
|
//# sourceMappingURL=FlowNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/FlowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAQA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/FlowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAQA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,EAAkB,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIhE,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,wBAAwB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACxB,gFAAgF;IAChF,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,cAAc,GAAI,yFAUrB,mBAAmB,gCA8ErB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import messages from './FlowNavigation.messages';
|
|
|
14
14
|
import AnimatedLabel from './AnimatedLabel';
|
|
15
15
|
import IconButton from '../IconButton';
|
|
16
16
|
import { ArrowLeft } from '@transferwise/icons';
|
|
17
|
+
import { CriticalBanner, CriticalBannerProps } from '../Prompt';
|
|
17
18
|
|
|
18
19
|
const defaultLogo = <Logo />;
|
|
19
20
|
|
|
@@ -31,6 +32,8 @@ export interface FlowNavigationProps {
|
|
|
31
32
|
onGoBack?: () => void;
|
|
32
33
|
/** Steps to be displayed in stepper. If not provided, the stepper won't show. */
|
|
33
34
|
steps?: readonly Step[];
|
|
35
|
+
/** Optional critical banner data, to be displayed above the flow navigation. */
|
|
36
|
+
banner?: CriticalBannerProps | null;
|
|
34
37
|
/**
|
|
35
38
|
* Controls whether the bottom border is displayed.
|
|
36
39
|
* @default true
|
|
@@ -46,6 +49,7 @@ const FlowNavigation = ({
|
|
|
46
49
|
onClose,
|
|
47
50
|
onGoBack,
|
|
48
51
|
steps,
|
|
52
|
+
banner = null,
|
|
49
53
|
showBottomBorder = true,
|
|
50
54
|
}: FlowNavigationProps) => {
|
|
51
55
|
const intl = useIntl();
|
|
@@ -112,15 +116,18 @@ const FlowNavigation = ({
|
|
|
112
116
|
);
|
|
113
117
|
|
|
114
118
|
return (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'np-flow-navigation
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
<>
|
|
120
|
+
{banner && <CriticalBanner {...banner} />}
|
|
121
|
+
<Container
|
|
122
|
+
size="fluid"
|
|
123
|
+
className={clsx('np-flow-navigation', {
|
|
124
|
+
'np-flow-navigation--border-bottom': showBottomBorder,
|
|
125
|
+
'np-flow-navigation--no-steps': !hasSteps || done,
|
|
126
|
+
})}
|
|
127
|
+
>
|
|
128
|
+
{flowHeaderContent}
|
|
129
|
+
</Container>
|
|
130
|
+
</>
|
|
124
131
|
);
|
|
125
132
|
};
|
|
126
133
|
|
|
@@ -538,3 +538,111 @@ export const BorderControl: Story = {
|
|
|
538
538
|
);
|
|
539
539
|
},
|
|
540
540
|
};
|
|
541
|
+
|
|
542
|
+
export const WithCriticalBanner: Story = {
|
|
543
|
+
args: {
|
|
544
|
+
profileType: ProfileType.PERSONAL,
|
|
545
|
+
showCloseButton: true,
|
|
546
|
+
showMobileBackButton: true,
|
|
547
|
+
avatarURL: '../tapestry-01.png',
|
|
548
|
+
},
|
|
549
|
+
parameters: {
|
|
550
|
+
chromatic: {
|
|
551
|
+
viewports,
|
|
552
|
+
},
|
|
553
|
+
padding: '0',
|
|
554
|
+
},
|
|
555
|
+
render: (args) => {
|
|
556
|
+
const [activeStep, setActiveStep] = useState(2);
|
|
557
|
+
|
|
558
|
+
const steps = [
|
|
559
|
+
{
|
|
560
|
+
label: 'Recipient',
|
|
561
|
+
onClick: () => setActiveStep(0),
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
label: 'Amount',
|
|
565
|
+
hoverLabel: (
|
|
566
|
+
<>
|
|
567
|
+
You send 100 GBP <br />
|
|
568
|
+
You get 99.39 GBP{' '}
|
|
569
|
+
</>
|
|
570
|
+
),
|
|
571
|
+
...(activeStep > 1 && { onClick: () => setActiveStep(1) }),
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
label: 'Review',
|
|
575
|
+
...(activeStep > 2 && { onClick: () => setActiveStep(2) }),
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
label: 'Pay',
|
|
579
|
+
...(activeStep > 3 && { onClick: () => setActiveStep(3) }),
|
|
580
|
+
},
|
|
581
|
+
];
|
|
582
|
+
|
|
583
|
+
return (
|
|
584
|
+
<>
|
|
585
|
+
{/* With critical banner - negative sentiment */}
|
|
586
|
+
<FlowNavigation
|
|
587
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
588
|
+
logo={<Logo />}
|
|
589
|
+
activeStep={activeStep}
|
|
590
|
+
steps={steps}
|
|
591
|
+
banner={{
|
|
592
|
+
sentiment: 'negative',
|
|
593
|
+
title: 'Action required',
|
|
594
|
+
description: 'Please verify your identity to continue with this transfer.',
|
|
595
|
+
action: {
|
|
596
|
+
label: 'Verify now',
|
|
597
|
+
onClick: () => console.log('Verify clicked'),
|
|
598
|
+
},
|
|
599
|
+
}}
|
|
600
|
+
onClose={args.showCloseButton ? () => {} : undefined}
|
|
601
|
+
onGoBack={
|
|
602
|
+
args.showMobileBackButton
|
|
603
|
+
? () => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)
|
|
604
|
+
: undefined
|
|
605
|
+
}
|
|
606
|
+
/>
|
|
607
|
+
|
|
608
|
+
<Container size="narrow" className="m-y-5">
|
|
609
|
+
<Body className="text-xs-center">
|
|
610
|
+
<Display type={Typography.DISPLAY_SMALL}>Critical Banner Examples</Display>
|
|
611
|
+
</Body>
|
|
612
|
+
</Container>
|
|
613
|
+
|
|
614
|
+
{/* With critical banner - warning sentiment */}
|
|
615
|
+
<FlowNavigation
|
|
616
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
617
|
+
logo={<Logo />}
|
|
618
|
+
activeStep={activeStep}
|
|
619
|
+
steps={steps}
|
|
620
|
+
banner={{
|
|
621
|
+
sentiment: 'warning',
|
|
622
|
+
title: 'Rate expires soon',
|
|
623
|
+
description:
|
|
624
|
+
'Your guaranteed rate will expire in 2 hours. Complete your transfer to lock it in.',
|
|
625
|
+
action: {
|
|
626
|
+
label: 'Continue',
|
|
627
|
+
onClick: () => console.log('Continue clicked'),
|
|
628
|
+
},
|
|
629
|
+
actionSecondary: {
|
|
630
|
+
label: 'Cancel transfer',
|
|
631
|
+
onClick: () => console.log('Cancel clicked'),
|
|
632
|
+
},
|
|
633
|
+
}}
|
|
634
|
+
onClose={args.showCloseButton ? () => {} : undefined}
|
|
635
|
+
onGoBack={
|
|
636
|
+
args.showMobileBackButton
|
|
637
|
+
? () => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)
|
|
638
|
+
: undefined
|
|
639
|
+
}
|
|
640
|
+
/>
|
|
641
|
+
|
|
642
|
+
<Container size="narrow" className="m-y-3">
|
|
643
|
+
<Body>Example content below the navigation</Body>
|
|
644
|
+
</Container>
|
|
645
|
+
</>
|
|
646
|
+
);
|
|
647
|
+
},
|
|
648
|
+
};
|
|
@@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import AvatarView from '../../AvatarView';
|
|
4
4
|
import { ProfileType } from '../../common';
|
|
5
5
|
import Logo from '../../Logo';
|
|
6
|
+
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
6
7
|
import { allModes } from '../../../.storybook/modes';
|
|
7
8
|
|
|
8
9
|
import FlowNavigation, { FlowNavigationProps } from '../FlowNavigation';
|
|
@@ -45,23 +46,6 @@ export const EmptySteps: Story = {
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
export const LongLabel: Story = {
|
|
48
|
-
parameters: {
|
|
49
|
-
chromatic: {
|
|
50
|
-
viewports: [360],
|
|
51
|
-
},
|
|
52
|
-
viewport: {
|
|
53
|
-
options: {
|
|
54
|
-
narrow: {
|
|
55
|
-
name: '360px',
|
|
56
|
-
styles: { width: '360px', height: '600px' },
|
|
57
|
-
type: 'mobile',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
globals: {
|
|
63
|
-
viewport: 'narrow',
|
|
64
|
-
},
|
|
65
49
|
render: () => (
|
|
66
50
|
<FlowNavigation
|
|
67
51
|
{...baseProps}
|
|
@@ -75,4 +59,71 @@ export const LongLabel: Story = {
|
|
|
75
59
|
activeStep={2}
|
|
76
60
|
/>
|
|
77
61
|
),
|
|
62
|
+
...withVariantConfig(['mobile']),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const CriticalBannerMobile: Story = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<>
|
|
68
|
+
<FlowNavigation
|
|
69
|
+
{...baseProps}
|
|
70
|
+
steps={[
|
|
71
|
+
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
72
|
+
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
73
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: noop },
|
|
74
|
+
{ label: 'Review', onClick: noop },
|
|
75
|
+
{ label: 'Pay', onClick: noop },
|
|
76
|
+
]}
|
|
77
|
+
activeStep={2}
|
|
78
|
+
banner={{
|
|
79
|
+
sentiment: 'negative',
|
|
80
|
+
title: 'Action required',
|
|
81
|
+
description: 'Please verify your identity to continue with this transfer.',
|
|
82
|
+
action: {
|
|
83
|
+
label: 'Verify now',
|
|
84
|
+
onClick: noop,
|
|
85
|
+
},
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
<FlowNavigation
|
|
89
|
+
{...baseProps}
|
|
90
|
+
steps={[
|
|
91
|
+
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
92
|
+
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
93
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: noop },
|
|
94
|
+
{ label: 'Review', onClick: noop },
|
|
95
|
+
{ label: 'Pay', onClick: noop },
|
|
96
|
+
]}
|
|
97
|
+
activeStep={1}
|
|
98
|
+
banner={{
|
|
99
|
+
sentiment: 'warning',
|
|
100
|
+
title: 'Rate expires soon',
|
|
101
|
+
description:
|
|
102
|
+
'Your guaranteed rate will expire in 2 hours. Complete your transfer to lock it in.',
|
|
103
|
+
action: {
|
|
104
|
+
label: 'Continue',
|
|
105
|
+
onClick: noop,
|
|
106
|
+
},
|
|
107
|
+
actionSecondary: {
|
|
108
|
+
label: 'Cancel',
|
|
109
|
+
onClick: noop,
|
|
110
|
+
},
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
<FlowNavigation
|
|
114
|
+
{...baseProps}
|
|
115
|
+
steps={[
|
|
116
|
+
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
117
|
+
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
118
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: noop },
|
|
119
|
+
]}
|
|
120
|
+
activeStep={0}
|
|
121
|
+
banner={{
|
|
122
|
+
sentiment: 'neutral',
|
|
123
|
+
description: 'This is a neutral informational banner without a title.',
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</>
|
|
127
|
+
),
|
|
128
|
+
...withVariantConfig(['mobile']),
|
|
78
129
|
};
|