@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.
Files changed (104) hide show
  1. package/build/container/Container.js.map +1 -1
  2. package/build/container/Container.mjs.map +1 -1
  3. package/build/flowNavigation/FlowNavigation.js +56 -42
  4. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  5. package/build/flowNavigation/FlowNavigation.mjs +56 -42
  6. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  7. package/build/main.css +41 -20
  8. package/build/overlayHeader/OverlayHeader.js +3 -0
  9. package/build/overlayHeader/OverlayHeader.js.map +1 -1
  10. package/build/overlayHeader/OverlayHeader.mjs +3 -0
  11. package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
  12. package/build/prompt/CriticalBanner/CriticalBanner.js +4 -1
  13. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  14. package/build/prompt/CriticalBanner/CriticalBanner.mjs +4 -1
  15. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  16. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  17. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  18. package/build/styles/css/neptune.css +11 -11
  19. package/build/styles/flowNavigation/FlowNavigation.css +16 -2
  20. package/build/styles/less/legacy-variables.less +1 -1
  21. package/build/styles/less/neptune-tokens.less +2 -2
  22. package/build/styles/main.css +41 -20
  23. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +2 -1
  24. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +2 -1
  25. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +2 -1
  26. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +2 -1
  27. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
  28. package/build/styles/props/custom-media.css +1 -1
  29. package/build/styles/props/neptune-tokens.css +1 -1
  30. package/build/styles/sentimentSurface/SentimentSurface.css +1 -1
  31. package/build/styles/styles/less/neptune.css +11 -11
  32. package/build/types/container/Container.d.ts +2 -2
  33. package/build/types/container/Container.d.ts.map +1 -1
  34. package/build/types/flowNavigation/FlowNavigation.d.ts +15 -3
  35. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  36. package/build/types/iconButton/IconButton.d.ts +1 -1
  37. package/build/types/overlayHeader/OverlayHeader.d.ts +6 -0
  38. package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
  39. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
  40. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +1 -1
  41. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  42. package/package.json +15 -15
  43. package/src/body/Body.story.tsx +1 -5
  44. package/src/calendar/Calendar.story.tsx +1 -4
  45. package/src/checkbox/Checkbox.story.tsx +1 -4
  46. package/src/chevron/Chevron.story.tsx +1 -1
  47. package/src/container/Container.story.tsx +1 -4
  48. package/src/container/Container.tsx +2 -2
  49. package/src/dateInput/DateInput.story.tsx +1 -4
  50. package/src/dateLookup/DateLookup.story.tsx +1 -4
  51. package/src/decision/Decision.story.tsx +1 -4
  52. package/src/definitionList/DefinitionList.story.tsx +1 -4
  53. package/src/dimmer/Dimmer.story.tsx +1 -5
  54. package/src/display/Display.story.tsx +1 -4
  55. package/src/emphasis/Emphasis.story.tsx +1 -5
  56. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +1 -4
  57. package/src/field/Field.story.tsx +1 -4
  58. package/src/flowNavigation/FlowNavigation.css +16 -2
  59. package/src/flowNavigation/FlowNavigation.less +20 -4
  60. package/src/flowNavigation/FlowNavigation.story.tsx +249 -0
  61. package/src/flowNavigation/FlowNavigation.tsx +91 -58
  62. package/src/header/Header.story.tsx +1 -4
  63. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +1 -4
  64. package/src/inputs/InputGroup.story.tsx +1 -4
  65. package/src/inputs/SearchInput.story.tsx +1 -4
  66. package/src/inputs/TextArea.story.tsx +1 -4
  67. package/src/instructionsList/InstructionsList.story.tsx +1 -4
  68. package/src/label/Label.story.tsx +1 -4
  69. package/src/link/Link.story.tsx +1 -4
  70. package/src/loader/Loader.story.tsx +1 -1
  71. package/src/main.css +41 -20
  72. package/src/markdown/Markdown.story.tsx +1 -5
  73. package/src/money/Money.story.tsx +0 -1
  74. package/src/moneyInput/MoneyInput.story.tsx +1 -4
  75. package/src/overlayHeader/OverlayHeader.story.tsx +4 -0
  76. package/src/overlayHeader/OverlayHeader.tsx +6 -0
  77. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -4
  78. package/src/promoCard/PromoCard.story.tsx +1 -4
  79. package/src/promoCard/PromoCardGroup.story.tsx +1 -4
  80. package/src/prompt/ActionPrompt/ActionPrompt.css +2 -1
  81. package/src/prompt/ActionPrompt/ActionPrompt.less +2 -1
  82. package/src/prompt/CriticalBanner/CriticalBanner.css +2 -1
  83. package/src/prompt/CriticalBanner/CriticalBanner.less +2 -1
  84. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +1 -1
  85. package/src/prompt/CriticalBanner/CriticalBanner.tsx +6 -3
  86. package/src/prompt/InfoPrompt/InfoPrompt.css +2 -1
  87. package/src/prompt/InfoPrompt/InfoPrompt.less +2 -1
  88. package/src/prompt/InlinePrompt/InlinePrompt.css +2 -1
  89. package/src/prompt/InlinePrompt/InlinePrompt.less +2 -1
  90. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
  91. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  92. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +1 -1
  93. package/src/radio/Radio.story.tsx +1 -4
  94. package/src/radioGroup/RadioGroup.story.tsx +1 -4
  95. package/src/segmentedControl/SegmentedControl.story.tsx +1 -4
  96. package/src/sentimentSurface/SentimentSurface.css +1 -1
  97. package/src/statusIcon/StatusIcon.story.tsx +1 -1
  98. package/src/styles/less/neptune.css +11 -11
  99. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +1 -4
  100. package/src/title/Title.story.tsx +1 -5
  101. package/src/typeahead/Typeahead.story.tsx +1 -4
  102. package/src/upload/Upload.story.tsx +1 -4
  103. package/src/uploadInput/UploadInput.story.tsx +1 -4
  104. package/src/flowNavigation/FlowNavigation.test.js +0 -190
@@ -1,10 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { fn } from 'storybook/test';
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 Upload from '.';
9
6
  import { MAX_SIZE_DEFAULT } from './Upload';
10
7
 
@@ -1,9 +1,6 @@
1
1
  import { StoryFn, Meta } from '@storybook/react-webpack5';
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 { Field } from '../field/Field';
8
5
 
9
6
  import UploadInput, { UploadInputProps } from './UploadInput';
@@ -1,190 +0,0 @@
1
- import { Breakpoint } from '@transferwise/neptune-tokens';
2
- import AvatarView from '../avatarView';
3
- import { mockMatchMedia, render, screen } from '../test-utils';
4
-
5
- import FlowNavigation from './FlowNavigation';
6
-
7
- mockMatchMedia();
8
-
9
- jest.mock('./animatedLabel', () => {
10
- return function ({ className, activeLabel }) {
11
- return (
12
- <div className={className} data-testid={`activeLabel-${activeLabel}`}>
13
- AnimatedLabel
14
- </div>
15
- );
16
- };
17
- });
18
-
19
- describe('FlowNavigation', () => {
20
- beforeEach(() => {
21
- window.innerWidth = Breakpoint.LARGE + 1;
22
- });
23
-
24
- const props = {
25
- avatar: <AvatarView profileName="Tim Mike" />,
26
- logo: <img alt="logo" src="logo.svg" width="138" height="24" />,
27
- onClose: jest.fn(),
28
- steps: [
29
- {
30
- label: 'label-0',
31
- },
32
- { label: 'label-1' },
33
- { label: 'label-2' },
34
- ],
35
- activeStep: 0,
36
- };
37
-
38
- it(`renders full Logo`, () => {
39
- render(<FlowNavigation {...props} />);
40
- expect(logoFull()).toBeInTheDocument();
41
- });
42
-
43
- it(`renders separator if avatar and onClose are provided`, () => {
44
- const { container } = render(<FlowNavigation {...props} />);
45
-
46
- expect(container.querySelector('span.m-x-1')).toBeInTheDocument();
47
- });
48
-
49
- it(`doesn't render separator if avatar or onClose are not provided`, () => {
50
- const { container, rerender } = render(<FlowNavigation {...props} onClose={null} />);
51
-
52
- expect(container.querySelector('.separator')).not.toBeInTheDocument();
53
-
54
- rerender(<FlowNavigation {...props} avatar={null} />);
55
-
56
- expect(container.querySelector('.separator')).not.toBeInTheDocument();
57
- });
58
-
59
- it(`doesn't render separator if done is true`, () => {
60
- const { container, rerender } = render(<FlowNavigation {...props} onClose={null} />);
61
-
62
- expect(container.querySelector('.separator')).not.toBeInTheDocument();
63
-
64
- rerender(<FlowNavigation {...props} avatar={null} done />);
65
-
66
- expect(container.querySelector('.separator')).not.toBeInTheDocument();
67
- });
68
-
69
- it(`renders border based on done`, () => {
70
- const { container, rerender } = render(<FlowNavigation {...props} onClose={null} />);
71
-
72
- expect(container.querySelector('.np-flow-navigation--border-bottom')).toBeInTheDocument();
73
-
74
- rerender(<FlowNavigation {...props} avatar={null} done />);
75
-
76
- expect(container.querySelector('.np-flow-navigation--border-bottom')).not.toBeInTheDocument();
77
- });
78
-
79
- it(`hides stepper when done is true`, () => {
80
- const { container, rerender } = render(<FlowNavigation {...props} onClose={null} />);
81
-
82
- expect(container.querySelector('.np-flow-navigation__stepper')).toBeInTheDocument();
83
-
84
- rerender(<FlowNavigation {...props} avatar={null} done />);
85
-
86
- expect(container.querySelector('.np-flow-navigation__stepper')).not.toBeInTheDocument();
87
- });
88
-
89
- it(`does not render stepper when steps is empty`, () => {
90
- const { container } = render(<FlowNavigation {...props} steps={[]} />);
91
-
92
- expect(container.querySelector('.np-flow-navigation__stepper')).not.toBeInTheDocument();
93
- expect(container.querySelector('.tw-stepper')).not.toBeInTheDocument();
94
- });
95
-
96
- it(`hides label when done is true`, () => {
97
- const { rerender } = render(<FlowNavigation {...props} done={false} />);
98
-
99
- expect(screen.getByText('label-0')).toBeInTheDocument();
100
-
101
- rerender(<FlowNavigation {...props} done />);
102
-
103
- expect(screen.queryByText('label-0')).not.toBeInTheDocument();
104
- });
105
-
106
- it(`renders xs-max class`, () => {
107
- window.innerWidth = Breakpoint.SMALL - 1;
108
- const { container } = render(<FlowNavigation {...props} onClose={null} />);
109
-
110
- expect(container.querySelector('.np-flow-navigation--xs-max')).toBeInTheDocument();
111
- });
112
-
113
- it(`renders sm class`, () => {
114
- window.innerWidth = Breakpoint.SMALL;
115
- const { container } = render(<FlowNavigation {...props} onClose={null} />);
116
-
117
- expect(container.querySelector('.np-flow-navigation--sm')).toBeInTheDocument();
118
- });
119
-
120
- it(`renders lg class`, () => {
121
- window.innerWidth = Breakpoint.LARGE;
122
- const { container } = render(<FlowNavigation {...props} onClose={null} />);
123
-
124
- expect(container.querySelector('.np-flow-navigation--lg')).toBeInTheDocument();
125
- });
126
-
127
- describe('on mobile', () => {
128
- beforeEach(() => {
129
- window.innerWidth = Breakpoint.SMALL - 1;
130
- });
131
-
132
- it('renders Logo', () => {
133
- render(<FlowNavigation {...props} />);
134
- expect(screen.getByAltText('logo')).toBeInTheDocument();
135
- });
136
-
137
- it('renders flag if activeStep <= 0 onGoBack or is not provided', () => {
138
- const { rerender } = render(
139
- <FlowNavigation {...props} activeStep={0} onGoBack={undefined} />,
140
- );
141
-
142
- const flag = screen.queryByAltText('logo');
143
-
144
- expect(flag).toBeInTheDocument();
145
-
146
- rerender(<FlowNavigation {...props} activeStep={1} onGoBack={undefined} />);
147
-
148
- expect(flag).toBeInTheDocument();
149
-
150
- rerender(<FlowNavigation {...props} activeStep={0} onGoBack={jest.fn()} />);
151
-
152
- expect(flag).toBeInTheDocument();
153
-
154
- rerender(<FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />);
155
-
156
- expect(flag).not.toBeInTheDocument();
157
- });
158
-
159
- it('renders BackButton with AnimatedLabel if onGoBack is provided and activeStep > 0', () => {
160
- const { rerender } = render(<FlowNavigation {...props} onGoBack={jest.fn()} />);
161
-
162
- expect(
163
- screen.queryByRole('button', { name: /back to previous step/i }),
164
- ).not.toBeInTheDocument();
165
-
166
- rerender(<FlowNavigation {...props} activeStep={1} />);
167
- expect(
168
- screen.queryByRole('button', { name: /back to previous step/i }),
169
- ).not.toBeInTheDocument();
170
-
171
- rerender(<FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />);
172
-
173
- expect(screen.getByRole('button', { name: /back to previous step/i })).toBeInTheDocument();
174
- expect(screen.getByText('AnimatedLabel')).toBeInTheDocument();
175
- });
176
-
177
- it('renders correct AnimatedLabel', () => {
178
- const { rerender } = render(
179
- <FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />,
180
- );
181
-
182
- expect(screen.getByTestId('activeLabel-1')).toBeInTheDocument();
183
-
184
- rerender(<FlowNavigation {...props} activeStep={2} onGoBack={jest.fn()} />);
185
-
186
- expect(screen.getByTestId('activeLabel-2')).toBeInTheDocument();
187
- });
188
- });
189
- const logoFull = () => screen.getByAltText(`logo`);
190
- });