@transferwise/components 46.148.0 → 46.149.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/container/Container.js.map +1 -1
- package/build/container/Container.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +56 -42
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +56 -42
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/main.css +41 -20
- package/build/overlayHeader/OverlayHeader.js +3 -0
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +3 -0
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +4 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +4 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/styles/css/neptune.css +11 -11
- package/build/styles/flowNavigation/FlowNavigation.css +16 -2
- package/build/styles/less/legacy-variables.less +1 -1
- package/build/styles/less/neptune-tokens.less +2 -2
- package/build/styles/main.css +41 -20
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +2 -1
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +2 -1
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +2 -1
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +2 -1
- package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
- package/build/styles/props/custom-media.css +1 -1
- package/build/styles/props/neptune-tokens.css +1 -1
- package/build/styles/sentimentSurface/SentimentSurface.css +1 -1
- package/build/styles/styles/less/neptune.css +11 -11
- package/build/types/container/Container.d.ts +2 -2
- package/build/types/container/Container.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +15 -3
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts +6 -0
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +1 -1
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/body/Body.story.tsx +1 -5
- package/src/calendar/Calendar.story.tsx +1 -4
- package/src/checkbox/Checkbox.story.tsx +1 -4
- package/src/chevron/Chevron.story.tsx +1 -1
- package/src/container/Container.story.tsx +1 -4
- package/src/container/Container.tsx +2 -2
- package/src/dateInput/DateInput.story.tsx +1 -4
- package/src/dateLookup/DateLookup.story.tsx +1 -4
- package/src/decision/Decision.story.tsx +1 -4
- package/src/definitionList/DefinitionList.story.tsx +1 -4
- package/src/dimmer/Dimmer.story.tsx +1 -5
- package/src/display/Display.story.tsx +1 -4
- package/src/emphasis/Emphasis.story.tsx +1 -5
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +1 -4
- package/src/field/Field.story.tsx +1 -4
- package/src/flowNavigation/FlowNavigation.css +16 -2
- package/src/flowNavigation/FlowNavigation.less +20 -4
- package/src/flowNavigation/FlowNavigation.story.tsx +249 -0
- package/src/flowNavigation/FlowNavigation.tsx +91 -58
- package/src/header/Header.story.tsx +1 -4
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +1 -4
- package/src/inputs/InputGroup.story.tsx +1 -4
- package/src/inputs/SearchInput.story.tsx +1 -4
- package/src/inputs/TextArea.story.tsx +1 -4
- package/src/instructionsList/InstructionsList.story.tsx +1 -4
- package/src/label/Label.story.tsx +1 -4
- package/src/link/Link.story.tsx +1 -4
- package/src/loader/Loader.story.tsx +1 -1
- package/src/main.css +41 -20
- package/src/markdown/Markdown.story.tsx +1 -5
- package/src/money/Money.story.tsx +0 -1
- package/src/moneyInput/MoneyInput.story.tsx +1 -4
- package/src/overlayHeader/OverlayHeader.story.tsx +4 -0
- package/src/overlayHeader/OverlayHeader.tsx +6 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -4
- package/src/promoCard/PromoCard.story.tsx +1 -4
- package/src/promoCard/PromoCardGroup.story.tsx +1 -4
- package/src/prompt/ActionPrompt/ActionPrompt.css +2 -1
- package/src/prompt/ActionPrompt/ActionPrompt.less +2 -1
- package/src/prompt/CriticalBanner/CriticalBanner.css +2 -1
- package/src/prompt/CriticalBanner/CriticalBanner.less +2 -1
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +1 -1
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +6 -3
- package/src/prompt/InfoPrompt/InfoPrompt.css +2 -1
- package/src/prompt/InfoPrompt/InfoPrompt.less +2 -1
- package/src/prompt/InlinePrompt/InlinePrompt.css +2 -1
- package/src/prompt/InlinePrompt/InlinePrompt.less +2 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +1 -1
- package/src/radio/Radio.story.tsx +1 -4
- package/src/radioGroup/RadioGroup.story.tsx +1 -4
- package/src/segmentedControl/SegmentedControl.story.tsx +1 -4
- package/src/sentimentSurface/SentimentSurface.css +1 -1
- package/src/statusIcon/StatusIcon.story.tsx +1 -1
- package/src/styles/less/neptune.css +11 -11
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -4
- package/src/title/Title.story.tsx +1 -5
- package/src/typeahead/Typeahead.story.tsx +1 -4
- package/src/upload/Upload.story.tsx +1 -4
- package/src/uploadInput/UploadInput.story.tsx +1 -4
- package/src/flowNavigation/FlowNavigation.test.js +0 -190
|
@@ -25,6 +25,13 @@ export type StoryArgs = FlowNavigationProps & CustomControls;
|
|
|
25
25
|
|
|
26
26
|
type Story = StoryObj<StoryArgs>;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* FlowNavigation component for multi-step flows with progress tracking.
|
|
30
|
+
*
|
|
31
|
+
* **Border Behavior:**
|
|
32
|
+
* - Non-composable (default): Border respects `done` prop when `showBottomBorder=true`.
|
|
33
|
+
* - Composable: Border controlled only by `showBottomBorder`, ignoring the `done` property.
|
|
34
|
+
**/
|
|
28
35
|
const meta: Meta<StoryArgs> = {
|
|
29
36
|
component: FlowNavigation,
|
|
30
37
|
title: 'Navigation/FlowNavigation',
|
|
@@ -32,6 +39,7 @@ const meta: Meta<StoryArgs> = {
|
|
|
32
39
|
showCloseButton: { control: 'boolean', defaultValue: true },
|
|
33
40
|
showMobileBackButton: { control: 'boolean', defaultValue: true },
|
|
34
41
|
done: { control: 'boolean', defaultValue: false },
|
|
42
|
+
showBottomBorder: { control: 'boolean', defaultValue: true },
|
|
35
43
|
avatarURL: { control: 'text', defaultValue: '../tapestry-01.png' },
|
|
36
44
|
profileType: {
|
|
37
45
|
control: 'radio',
|
|
@@ -372,3 +380,244 @@ export const WithOverlayHeaderComparison: Story = {
|
|
|
372
380
|
);
|
|
373
381
|
},
|
|
374
382
|
};
|
|
383
|
+
|
|
384
|
+
export const ComposableVariant: Story = {
|
|
385
|
+
args: {
|
|
386
|
+
profileType: ProfileType.PERSONAL,
|
|
387
|
+
showCloseButton: true,
|
|
388
|
+
showMobileBackButton: true,
|
|
389
|
+
done: false,
|
|
390
|
+
avatarURL: '../tapestry-01.png',
|
|
391
|
+
},
|
|
392
|
+
parameters: {
|
|
393
|
+
padding: '0',
|
|
394
|
+
chromatic: {
|
|
395
|
+
viewports,
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
render: (args) => {
|
|
399
|
+
const [activeStep, setActiveStep] = useState(2);
|
|
400
|
+
const steps = [
|
|
401
|
+
{
|
|
402
|
+
label: 'Recipient',
|
|
403
|
+
onClick: () => setActiveStep(0),
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
label: 'Amount',
|
|
407
|
+
hoverLabel: (
|
|
408
|
+
<>
|
|
409
|
+
You send 100 GBP <br />
|
|
410
|
+
You get 99.39 GBP{' '}
|
|
411
|
+
</>
|
|
412
|
+
),
|
|
413
|
+
...(activeStep > 1 && { onClick: () => setActiveStep(1) }),
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
label: 'Review',
|
|
417
|
+
...(activeStep > 2 && { onClick: () => setActiveStep(2) }),
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
label: 'Pay',
|
|
421
|
+
...(activeStep > 3 && { onClick: () => setActiveStep(3) }),
|
|
422
|
+
},
|
|
423
|
+
];
|
|
424
|
+
return (
|
|
425
|
+
<>
|
|
426
|
+
<FlowNavigation
|
|
427
|
+
composable
|
|
428
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
429
|
+
logo={<Logo />}
|
|
430
|
+
activeStep={activeStep}
|
|
431
|
+
steps={steps}
|
|
432
|
+
onClose={args.showCloseButton ? () => alert('close') : undefined}
|
|
433
|
+
onGoBack={
|
|
434
|
+
args.showMobileBackButton
|
|
435
|
+
? () => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)
|
|
436
|
+
: undefined
|
|
437
|
+
}
|
|
438
|
+
/>
|
|
439
|
+
<Container size="narrow">
|
|
440
|
+
<Body className="m-a-3">
|
|
441
|
+
<Display type={Typography.DISPLAY_SMALL}>{steps[activeStep].label} Step</Display>
|
|
442
|
+
<br />
|
|
443
|
+
{lorem10}
|
|
444
|
+
</Body>
|
|
445
|
+
</Container>
|
|
446
|
+
|
|
447
|
+
<Sticky>
|
|
448
|
+
<Container
|
|
449
|
+
size="narrow"
|
|
450
|
+
className="d-flex justify-content-center align-items-center p-y-3"
|
|
451
|
+
>
|
|
452
|
+
<Button
|
|
453
|
+
v2
|
|
454
|
+
disabled={activeStep === 3}
|
|
455
|
+
block
|
|
456
|
+
onClick={() => setActiveStep(activeStep + 1)}
|
|
457
|
+
>
|
|
458
|
+
Continue
|
|
459
|
+
</Button>
|
|
460
|
+
</Container>
|
|
461
|
+
</Sticky>
|
|
462
|
+
</>
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
export const WithoutStepper: Story = {
|
|
468
|
+
args: {
|
|
469
|
+
profileType: ProfileType.PERSONAL,
|
|
470
|
+
showCloseButton: true,
|
|
471
|
+
avatarURL: '../tapestry-01.png',
|
|
472
|
+
},
|
|
473
|
+
parameters: {
|
|
474
|
+
chromatic: {
|
|
475
|
+
viewports,
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
render: (args) => {
|
|
479
|
+
const [closed, setClosed] = useState(false);
|
|
480
|
+
|
|
481
|
+
if (closed) return <Body className="text-xs-center m-a-3">FlowNavigation closed</Body>;
|
|
482
|
+
|
|
483
|
+
return (
|
|
484
|
+
<FlowNavigation
|
|
485
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
486
|
+
logo={<Logo />}
|
|
487
|
+
onClose={args.showCloseButton ? () => setClosed(true) : undefined}
|
|
488
|
+
/>
|
|
489
|
+
);
|
|
490
|
+
},
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export const BorderControl: Story = {
|
|
494
|
+
args: {
|
|
495
|
+
profileType: ProfileType.PERSONAL,
|
|
496
|
+
avatarURL: '../tapestry-01.png',
|
|
497
|
+
},
|
|
498
|
+
parameters: {
|
|
499
|
+
chromatic: {
|
|
500
|
+
viewports,
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
render: (args) => {
|
|
504
|
+
const [activeStep, setActiveStep] = useState(2);
|
|
505
|
+
|
|
506
|
+
const steps = [
|
|
507
|
+
{
|
|
508
|
+
label: 'Recipient',
|
|
509
|
+
onClick: () => setActiveStep(0),
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
label: 'Amount',
|
|
513
|
+
hoverLabel: (
|
|
514
|
+
<>
|
|
515
|
+
You send 100 GBP <br />
|
|
516
|
+
You get 99.39 GBP{' '}
|
|
517
|
+
</>
|
|
518
|
+
),
|
|
519
|
+
...(activeStep > 1 && { onClick: () => setActiveStep(1) }),
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
label: 'Review',
|
|
523
|
+
...(activeStep > 2 && { onClick: () => setActiveStep(2) }),
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
label: 'Pay',
|
|
527
|
+
...(activeStep > 3 && { onClick: () => setActiveStep(3) }),
|
|
528
|
+
},
|
|
529
|
+
];
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<>
|
|
533
|
+
<Body className="text-xs-center m-b-3">
|
|
534
|
+
<Display type={Typography.DISPLAY_SMALL}>Non-composable Variant</Display>
|
|
535
|
+
<br />
|
|
536
|
+
Border controlled by <code>done</code> property only
|
|
537
|
+
</Body>
|
|
538
|
+
|
|
539
|
+
{/* Non-composable: done=false - SHOWS BORDER */}
|
|
540
|
+
<FlowNavigation
|
|
541
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
542
|
+
logo={<Logo />}
|
|
543
|
+
activeStep={activeStep}
|
|
544
|
+
done={false}
|
|
545
|
+
steps={steps}
|
|
546
|
+
onClose={() => {}}
|
|
547
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
548
|
+
/>
|
|
549
|
+
<Body className="text-xs-center m-b-3">
|
|
550
|
+
<code>done=false</code> → ✅ Border shown
|
|
551
|
+
</Body>
|
|
552
|
+
|
|
553
|
+
{/* Non-composable: done=true - HIDES BORDER */}
|
|
554
|
+
<FlowNavigation
|
|
555
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
556
|
+
logo={<Logo />}
|
|
557
|
+
activeStep={activeStep}
|
|
558
|
+
done
|
|
559
|
+
steps={steps}
|
|
560
|
+
onClose={() => {}}
|
|
561
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
562
|
+
/>
|
|
563
|
+
<Body className="text-xs-center m-b-5">
|
|
564
|
+
<code>done=true</code> → ❌ Border hidden
|
|
565
|
+
</Body>
|
|
566
|
+
|
|
567
|
+
<Body className="text-xs-center m-b-3 m-t-5">
|
|
568
|
+
<Display type={Typography.DISPLAY_SMALL}>Composable Variant</Display>
|
|
569
|
+
<br />
|
|
570
|
+
Border ignores <code>done</code>, follows <code>showBottomBorder</code> only
|
|
571
|
+
</Body>
|
|
572
|
+
|
|
573
|
+
{/* Composable: showBottomBorder=true, done=false - SHOWS BORDER */}
|
|
574
|
+
<FlowNavigation
|
|
575
|
+
composable
|
|
576
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
577
|
+
logo={<Logo />}
|
|
578
|
+
activeStep={activeStep}
|
|
579
|
+
done={false}
|
|
580
|
+
steps={steps}
|
|
581
|
+
showBottomBorder
|
|
582
|
+
onClose={() => {}}
|
|
583
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
584
|
+
/>
|
|
585
|
+
<Body className="text-xs-center m-b-3">
|
|
586
|
+
<code>showBottomBorder=true, done=false</code> → ✅ Border shown
|
|
587
|
+
</Body>
|
|
588
|
+
|
|
589
|
+
{/* Composable: showBottomBorder=true, done=true - SHOWS BORDER */}
|
|
590
|
+
<FlowNavigation
|
|
591
|
+
composable
|
|
592
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
593
|
+
logo={<Logo />}
|
|
594
|
+
activeStep={activeStep}
|
|
595
|
+
done
|
|
596
|
+
steps={steps}
|
|
597
|
+
showBottomBorder
|
|
598
|
+
onClose={() => {}}
|
|
599
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
600
|
+
/>
|
|
601
|
+
<Body className="text-xs-center m-b-3">
|
|
602
|
+
<code>showBottomBorder=true, done=true</code> → ✅ Border shown (ignores done)
|
|
603
|
+
</Body>
|
|
604
|
+
|
|
605
|
+
{/* Composable: showBottomBorder=false, done=false - HIDES BORDER */}
|
|
606
|
+
<FlowNavigation
|
|
607
|
+
composable
|
|
608
|
+
avatar={<AvatarView profileType={args.profileType} />}
|
|
609
|
+
logo={<Logo />}
|
|
610
|
+
activeStep={activeStep}
|
|
611
|
+
done={false}
|
|
612
|
+
steps={steps}
|
|
613
|
+
showBottomBorder={false}
|
|
614
|
+
onClose={() => {}}
|
|
615
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
616
|
+
/>
|
|
617
|
+
<Body className="text-xs-center m-b-3">
|
|
618
|
+
<code>showBottomBorder=false, done=false</code> → ❌ Border hidden
|
|
619
|
+
</Body>
|
|
620
|
+
</>
|
|
621
|
+
);
|
|
622
|
+
},
|
|
623
|
+
};
|
|
@@ -7,6 +7,7 @@ import { CloseButton } from '../common/closeButton';
|
|
|
7
7
|
import FlowHeader from '../common/flowHeader/FlowHeader';
|
|
8
8
|
import Logo from '../logo';
|
|
9
9
|
import Stepper, { type Step } from '../stepper/Stepper';
|
|
10
|
+
import Container from '../container';
|
|
10
11
|
|
|
11
12
|
import { useScreenSize } from '../common/hooks/useScreenSize';
|
|
12
13
|
import messages from './FlowNavigation.messages';
|
|
@@ -14,6 +15,8 @@ import AnimatedLabel from './animatedLabel';
|
|
|
14
15
|
import IconButton from '../iconButton';
|
|
15
16
|
import { ArrowLeft } from '@transferwise/icons';
|
|
16
17
|
|
|
18
|
+
const defaultLogo = <Logo />;
|
|
19
|
+
|
|
17
20
|
export interface FlowNavigationProps {
|
|
18
21
|
/** @default 0 */
|
|
19
22
|
activeStep?: number;
|
|
@@ -26,86 +29,116 @@ export interface FlowNavigationProps {
|
|
|
26
29
|
onClose?: () => void;
|
|
27
30
|
/** Called when the back button is clicked. If not provided the back button won't show. The back button only shows on small screens */
|
|
28
31
|
onGoBack?: () => void;
|
|
29
|
-
/** Steps to be displayed in stepper. If
|
|
30
|
-
steps
|
|
32
|
+
/** Steps to be displayed in stepper. If not provided, the stepper won't show. */
|
|
33
|
+
steps?: readonly Step[];
|
|
34
|
+
/**
|
|
35
|
+
* When true, renders in composable mode using a fluid Container.
|
|
36
|
+
* This allows the FlowNavigation to be used within custom layout containers.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
composable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Controls whether the bottom border is displayed.
|
|
42
|
+
* Only applies to the composable variant. Non-composable variant always uses the done state.
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
showBottomBorder?: boolean;
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
const FlowNavigation = ({
|
|
34
49
|
activeStep = 0,
|
|
35
50
|
avatar,
|
|
36
|
-
logo =
|
|
51
|
+
logo = defaultLogo,
|
|
37
52
|
done = false,
|
|
38
53
|
onClose,
|
|
39
54
|
onGoBack,
|
|
40
55
|
steps,
|
|
56
|
+
composable = false,
|
|
57
|
+
showBottomBorder = true,
|
|
41
58
|
}: FlowNavigationProps) => {
|
|
42
59
|
const intl = useIntl();
|
|
43
|
-
|
|
44
|
-
const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
|
|
45
|
-
|
|
46
60
|
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
47
61
|
const screenLg = useScreenSize(Breakpoint.LARGE);
|
|
48
62
|
|
|
49
|
-
const
|
|
63
|
+
const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
|
|
50
64
|
|
|
65
|
+
const newAvatar = done ? null : avatar;
|
|
51
66
|
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
52
67
|
|
|
68
|
+
const flowHeaderContent = (
|
|
69
|
+
<FlowHeader
|
|
70
|
+
className={clsx(
|
|
71
|
+
'np-flow-navigation__content',
|
|
72
|
+
!composable && 'p-x-3',
|
|
73
|
+
screenSm == null
|
|
74
|
+
? 'np-flow-navigation--hidden'
|
|
75
|
+
: {
|
|
76
|
+
'np-flow-navigation--xs-max': !screenSm,
|
|
77
|
+
// Size switches on parent container which may or may not have the same size as the window.
|
|
78
|
+
'np-flow-navigation--sm': screenSm,
|
|
79
|
+
'np-flow-navigation--lg': screenLg,
|
|
80
|
+
},
|
|
81
|
+
)}
|
|
82
|
+
leftContent={
|
|
83
|
+
<>
|
|
84
|
+
{!screenSm && displayGoBack ? (
|
|
85
|
+
<IconButton
|
|
86
|
+
size={40}
|
|
87
|
+
priority="tertiary"
|
|
88
|
+
type="default"
|
|
89
|
+
aria-label={intl.formatMessage(messages.back)}
|
|
90
|
+
onClick={onGoBack}
|
|
91
|
+
>
|
|
92
|
+
<ArrowLeft />
|
|
93
|
+
</IconButton>
|
|
94
|
+
) : (
|
|
95
|
+
<div className="np-flow-header__left">{logo}</div>
|
|
96
|
+
)}
|
|
97
|
+
{!screenSm && !done && steps && steps.length > 0 && (
|
|
98
|
+
<AnimatedLabel className="m-x-1" steps={steps} activeLabel={activeStep} />
|
|
99
|
+
)}
|
|
100
|
+
</>
|
|
101
|
+
}
|
|
102
|
+
rightContent={
|
|
103
|
+
<div className="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg">
|
|
104
|
+
{newAvatar}
|
|
105
|
+
{newAvatar && closeButton && <span className="m-x-1" />}
|
|
106
|
+
{closeButton}
|
|
107
|
+
</div>
|
|
108
|
+
}
|
|
109
|
+
bottomContent={
|
|
110
|
+
!done && steps && steps.length > 0 ? (
|
|
111
|
+
<Stepper
|
|
112
|
+
activeStep={activeStep}
|
|
113
|
+
steps={steps}
|
|
114
|
+
className={clsx('np-flow-navigation__stepper')}
|
|
115
|
+
/>
|
|
116
|
+
) : null
|
|
117
|
+
}
|
|
118
|
+
layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (composable) {
|
|
123
|
+
return (
|
|
124
|
+
<Container
|
|
125
|
+
size="fluid"
|
|
126
|
+
className={clsx('np-flow-navigation np-flow-navigation--composable', {
|
|
127
|
+
'np-flow-navigation--border-bottom': showBottomBorder,
|
|
128
|
+
})}
|
|
129
|
+
>
|
|
130
|
+
{flowHeaderContent}
|
|
131
|
+
</Container>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
53
135
|
return (
|
|
54
136
|
<div
|
|
55
|
-
className={clsx('np-flow-navigation
|
|
137
|
+
className={clsx('np-flow-navigation p-y-3', {
|
|
56
138
|
'np-flow-navigation--border-bottom': !done,
|
|
57
139
|
})}
|
|
58
140
|
>
|
|
59
|
-
|
|
60
|
-
className={clsx(
|
|
61
|
-
'np-flow-navigation__content p-x-3',
|
|
62
|
-
screenSm == null
|
|
63
|
-
? 'np-flow-navigation--hidden'
|
|
64
|
-
: {
|
|
65
|
-
'np-flow-navigation--xs-max': !screenSm,
|
|
66
|
-
// Size switches on parent container which may or may not have the same size as the window.
|
|
67
|
-
'np-flow-navigation--sm': screenSm,
|
|
68
|
-
'np-flow-navigation--lg': screenLg,
|
|
69
|
-
},
|
|
70
|
-
)}
|
|
71
|
-
leftContent={
|
|
72
|
-
<>
|
|
73
|
-
{!screenSm && displayGoBack ? (
|
|
74
|
-
<IconButton
|
|
75
|
-
size={40}
|
|
76
|
-
priority="tertiary"
|
|
77
|
-
type="default"
|
|
78
|
-
aria-label={intl.formatMessage(messages.back)}
|
|
79
|
-
onClick={onGoBack}
|
|
80
|
-
>
|
|
81
|
-
<ArrowLeft />
|
|
82
|
-
</IconButton>
|
|
83
|
-
) : (
|
|
84
|
-
<div className="np-flow-header__left">{logo}</div>
|
|
85
|
-
)}
|
|
86
|
-
{!screenSm && !done && (
|
|
87
|
-
<AnimatedLabel className="m-x-1" steps={steps} activeLabel={activeStep} />
|
|
88
|
-
)}
|
|
89
|
-
</>
|
|
90
|
-
}
|
|
91
|
-
rightContent={
|
|
92
|
-
<div className="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg">
|
|
93
|
-
{newAvatar}
|
|
94
|
-
{newAvatar && closeButton && <span className="m-x-1" />}
|
|
95
|
-
{closeButton}
|
|
96
|
-
</div>
|
|
97
|
-
}
|
|
98
|
-
bottomContent={
|
|
99
|
-
!done && steps.length > 0 ? (
|
|
100
|
-
<Stepper
|
|
101
|
-
activeStep={activeStep}
|
|
102
|
-
steps={steps}
|
|
103
|
-
className={clsx('np-flow-navigation__stepper')}
|
|
104
|
-
/>
|
|
105
|
-
) : null
|
|
106
|
-
}
|
|
107
|
-
layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}
|
|
108
|
-
/>
|
|
141
|
+
{flowHeaderContent}
|
|
109
142
|
</div>
|
|
110
143
|
);
|
|
111
144
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import Header, { HeaderProps } from './Header';
|
|
3
|
-
import {
|
|
4
|
-
createSandboxStory,
|
|
5
|
-
globalScope,
|
|
6
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
4
|
|
|
8
5
|
const withContainer = (Story: any) => (
|
|
9
6
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { userEvent, within, fn } from 'storybook/test';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
createSandboxStory,
|
|
5
|
-
globalScope,
|
|
6
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
4
|
import InputWithDisplayFormat, { InputWithDisplayFormatProps } from '.';
|
|
8
5
|
import { Field, FieldProps } from '../field/Field';
|
|
9
6
|
import { Meta, type StoryObj } from '@storybook/react-webpack5';
|
|
@@ -2,10 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { Search } from '@transferwise/icons';
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
createSandboxStory,
|
|
7
|
-
globalScope,
|
|
8
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
9
6
|
import { Button } from '..';
|
|
10
7
|
import { Field } from '../field/Field';
|
|
11
8
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
createSandboxStory,
|
|
6
|
-
globalScope,
|
|
7
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
8
5
|
import { Size } from '../common';
|
|
9
6
|
import { Field } from '../field/Field';
|
|
10
7
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
createSandboxStory,
|
|
6
|
-
globalScope,
|
|
7
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
8
5
|
import { Field } from '../field/Field';
|
|
9
6
|
import { Sentiment } from '../common';
|
|
10
7
|
import { TextArea } from './TextArea';
|
|
@@ -4,10 +4,7 @@ import { fn } from 'storybook/test';
|
|
|
4
4
|
import Link from '../link';
|
|
5
5
|
|
|
6
6
|
import InstructionsList, { InstructionsListProps } from './InstructionsList';
|
|
7
|
-
import {
|
|
8
|
-
createSandboxStory,
|
|
9
|
-
globalScope,
|
|
10
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
11
8
|
|
|
12
9
|
export default {
|
|
13
10
|
component: InstructionsList,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSandboxStory,
|
|
3
|
-
globalScope,
|
|
4
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
1
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
2
|
import Info from '../info';
|
|
6
3
|
import { Label } from './Label';
|
|
7
4
|
|
package/src/link/Link.story.tsx
CHANGED
|
@@ -4,10 +4,7 @@ import Title from '../title/Title';
|
|
|
4
4
|
|
|
5
5
|
import SentimentSurface from '../sentimentSurface';
|
|
6
6
|
import Link from '.';
|
|
7
|
-
import {
|
|
8
|
-
createSandboxStory,
|
|
9
|
-
globalScope,
|
|
10
|
-
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
11
8
|
|
|
12
9
|
export default {
|
|
13
10
|
component: Link,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { createSandboxStory }
|
|
2
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
3
|
|
|
4
4
|
import Loader from './Loader';
|
|
5
5
|
|