@transferwise/components 46.64.0 → 46.66.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/common/bottomSheet/BottomSheet.js +8 -2
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +8 -2
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/decision/Decision.js +4 -0
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +4 -0
- package/build/decision/Decision.mjs.map +1 -1
- package/build/drawer/Drawer.js +5 -3
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +5 -3
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +1 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +1 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +89 -15
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +90 -16
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/main.css +10 -1
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +10 -1
- package/build/styles/main.css +10 -1
- package/build/switch/Switch.js +3 -27
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +3 -27
- package/build/switch/Switch.mjs.map +1 -1
- package/build/tile/Tile.js +2 -0
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +2 -0
- package/build/tile/Tile.mjs.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts +3 -3
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts +1 -0
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +4 -3
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +3 -3
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/build/types/tile/Tile.d.ts +3 -1
- package/build/types/tile/Tile.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/bottomSheet/BottomSheet.tsx +13 -4
- package/src/decision/Decision.spec.tsx +166 -0
- package/src/decision/Decision.story.tsx +208 -202
- package/src/decision/Decision.tsx +26 -2
- package/src/drawer/Drawer.tsx +7 -5
- package/src/flowNavigation/FlowNavigation.story.js +69 -17
- package/src/flowNavigation/FlowNavigation.tsx +1 -5
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +10 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +10 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +64 -27
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +102 -20
- package/src/main.css +10 -1
- package/src/switch/Switch.story.tsx +4 -7
- package/src/switch/Switch.tsx +1 -24
- package/src/switch/__snapshots__/Switch.spec.tsx.snap +2 -44
- package/src/tile/Tile.tsx +4 -0
- package/src/decision/Decision.spec.js +0 -127
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +0 -25
|
@@ -24,63 +24,64 @@ export const Basic = () => {
|
|
|
24
24
|
const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
),
|
|
42
|
-
},
|
|
43
|
-
title: 'Hank Miller',
|
|
27
|
+
<Decision
|
|
28
|
+
options={[
|
|
29
|
+
{
|
|
30
|
+
description: 'Short text test.',
|
|
31
|
+
onClick: action('clicked'),
|
|
32
|
+
href: '#href1',
|
|
33
|
+
disabled,
|
|
34
|
+
media: {
|
|
35
|
+
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
|
+
list: (
|
|
37
|
+
<Avatar size="md" type="initials">
|
|
38
|
+
HM
|
|
39
|
+
</Avatar>
|
|
40
|
+
),
|
|
44
41
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
'aria-label': 'Click to see something',
|
|
43
|
+
title: 'Hank Miller',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
description:
|
|
47
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
48
|
+
onClick: action('clicked'),
|
|
49
|
+
disabled,
|
|
50
|
+
href: '#href2',
|
|
51
|
+
media: {
|
|
52
|
+
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
53
|
+
list: (
|
|
54
|
+
<Avatar size="md" type="initials">
|
|
55
|
+
HM
|
|
56
|
+
</Avatar>
|
|
57
|
+
),
|
|
60
58
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
60
|
+
title: 'Hank Miller',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
description: "I'm disabled and don't require an onClick or href.",
|
|
64
|
+
media: {
|
|
65
|
+
block: <Illustration name="briefcase" alt="" disablePadding />,
|
|
66
|
+
list: (
|
|
67
|
+
<img
|
|
68
|
+
src="https://wise.com/public-resources/assets/illustrations/business_account_web_small.svg"
|
|
69
|
+
alt=""
|
|
70
|
+
width="100"
|
|
71
|
+
/>
|
|
72
|
+
),
|
|
75
73
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
'aria-label': 'This option is disabled.',
|
|
75
|
+
disabled: true,
|
|
76
|
+
title: 'Hank Miller',
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
presentation={presentation}
|
|
80
|
+
type={DecisionType.NAVIGATION}
|
|
81
|
+
showMediaCircleInList={showMediaCircleInList}
|
|
82
|
+
isContainerAligned={isContainerAligned}
|
|
83
|
+
size={size}
|
|
84
|
+
/>
|
|
84
85
|
);
|
|
85
86
|
};
|
|
86
87
|
|
|
@@ -94,160 +95,165 @@ export const grid = () => {
|
|
|
94
95
|
const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
|
|
95
96
|
|
|
96
97
|
return (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
),
|
|
117
|
-
},
|
|
118
|
-
title: 'Hank Miller',
|
|
98
|
+
<Decision
|
|
99
|
+
options={[
|
|
100
|
+
{
|
|
101
|
+
description: 'Short text test.',
|
|
102
|
+
onClick: action('clicked'),
|
|
103
|
+
href: '#href1',
|
|
104
|
+
disabled,
|
|
105
|
+
media: {
|
|
106
|
+
block: (
|
|
107
|
+
<img
|
|
108
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
109
|
+
alt=""
|
|
110
|
+
/>
|
|
111
|
+
),
|
|
112
|
+
list: (
|
|
113
|
+
<Avatar size="md" type="initials">
|
|
114
|
+
HM
|
|
115
|
+
</Avatar>
|
|
116
|
+
),
|
|
119
117
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
118
|
+
'aria-label': 'Click to see something',
|
|
119
|
+
title: 'Hank Miller',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
description:
|
|
123
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
124
|
+
onClick: action('clicked'),
|
|
125
|
+
disabled,
|
|
126
|
+
href: '#href2',
|
|
127
|
+
media: {
|
|
128
|
+
block: (
|
|
129
|
+
<img
|
|
130
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
131
|
+
alt=""
|
|
132
|
+
/>
|
|
133
|
+
),
|
|
134
|
+
list: (
|
|
135
|
+
<Avatar size="md" type="initials">
|
|
136
|
+
HM
|
|
137
|
+
</Avatar>
|
|
138
|
+
),
|
|
140
139
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
140
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
141
|
+
title: 'Hank Miller',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
description:
|
|
145
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
146
|
+
onClick: action('clicked'),
|
|
147
|
+
href: '#href3',
|
|
148
|
+
media: {
|
|
149
|
+
block: (
|
|
150
|
+
<img
|
|
151
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
152
|
+
alt=""
|
|
153
|
+
/>
|
|
154
|
+
),
|
|
155
|
+
list: (
|
|
156
|
+
<Avatar size="md" type="initials">
|
|
157
|
+
HM
|
|
158
|
+
</Avatar>
|
|
159
|
+
),
|
|
161
160
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
161
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
162
|
+
disabled,
|
|
163
|
+
title: 'Hank Miller',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
description:
|
|
167
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
168
|
+
onClick: action('clicked'),
|
|
169
|
+
href: '#href1',
|
|
170
|
+
disabled,
|
|
171
|
+
media: {
|
|
172
|
+
block: (
|
|
173
|
+
<img
|
|
174
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
175
|
+
alt=""
|
|
176
|
+
/>
|
|
177
|
+
),
|
|
178
|
+
list: (
|
|
179
|
+
<Avatar size="md" type="initials">
|
|
180
|
+
HM
|
|
181
|
+
</Avatar>
|
|
182
|
+
),
|
|
182
183
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
184
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
185
|
+
title: 'Hank Miller',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
description:
|
|
189
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
190
|
+
onClick: action('clicked'),
|
|
191
|
+
href: '#href1',
|
|
192
|
+
disabled,
|
|
193
|
+
media: {
|
|
194
|
+
block: (
|
|
195
|
+
<img
|
|
196
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
197
|
+
alt=""
|
|
198
|
+
/>
|
|
199
|
+
),
|
|
200
|
+
list: (
|
|
201
|
+
<Avatar size="md" type="initials">
|
|
202
|
+
HM
|
|
203
|
+
</Avatar>
|
|
204
|
+
),
|
|
203
205
|
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
206
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
207
|
+
title: 'Hank Miller',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
description:
|
|
211
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
212
|
+
onClick: action('clicked'),
|
|
213
|
+
href: '#href1',
|
|
214
|
+
disabled,
|
|
215
|
+
media: {
|
|
216
|
+
block: (
|
|
217
|
+
<img
|
|
218
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
219
|
+
alt=""
|
|
220
|
+
/>
|
|
221
|
+
),
|
|
222
|
+
list: (
|
|
223
|
+
<Avatar size="md" type="initials">
|
|
224
|
+
HM
|
|
225
|
+
</Avatar>
|
|
226
|
+
),
|
|
224
227
|
},
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
229
|
+
title: 'Hank Miller',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
description:
|
|
233
|
+
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
234
|
+
onClick: action('clicked'),
|
|
235
|
+
href: '#href1',
|
|
236
|
+
disabled,
|
|
237
|
+
media: {
|
|
238
|
+
block: (
|
|
239
|
+
<img
|
|
240
|
+
src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
|
|
241
|
+
alt=""
|
|
242
|
+
/>
|
|
243
|
+
),
|
|
244
|
+
list: (
|
|
245
|
+
<Avatar size="md" type="initials">
|
|
246
|
+
HM
|
|
247
|
+
</Avatar>
|
|
248
|
+
),
|
|
245
249
|
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
'aria-label': 'Click here to send money to Hank Miller.',
|
|
251
|
+
title: 'Hank Miller',
|
|
252
|
+
},
|
|
253
|
+
]}
|
|
254
|
+
presentation={presentation}
|
|
255
|
+
type={DecisionType.NAVIGATION}
|
|
256
|
+
size={size}
|
|
257
|
+
/>
|
|
252
258
|
);
|
|
253
259
|
};
|
|
@@ -6,6 +6,7 @@ import NavigationOption from '../navigationOption';
|
|
|
6
6
|
import Tile from '../tile';
|
|
7
7
|
|
|
8
8
|
interface DecisionOption {
|
|
9
|
+
'aria-label'?: string;
|
|
9
10
|
description?: React.ReactNode;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
href?: string;
|
|
@@ -58,10 +59,23 @@ const Decision = ({
|
|
|
58
59
|
|
|
59
60
|
if (type === DecisionType.NAVIGATION) {
|
|
60
61
|
const renderedOptions = options.map(
|
|
61
|
-
(
|
|
62
|
+
(
|
|
63
|
+
{
|
|
64
|
+
'aria-label': ariaLabel,
|
|
65
|
+
title,
|
|
66
|
+
description,
|
|
67
|
+
disabled,
|
|
68
|
+
href,
|
|
69
|
+
target,
|
|
70
|
+
media: { list },
|
|
71
|
+
onClick,
|
|
72
|
+
},
|
|
73
|
+
key,
|
|
74
|
+
) => (
|
|
62
75
|
<NavigationOption
|
|
63
76
|
// eslint-disable-next-line react/no-array-index-key
|
|
64
77
|
key={`nav-${key}`}
|
|
78
|
+
aria-label={ariaLabel}
|
|
65
79
|
complex={false}
|
|
66
80
|
content={description}
|
|
67
81
|
disabled={disabled}
|
|
@@ -100,7 +114,16 @@ const Decision = ({
|
|
|
100
114
|
{breakpoint
|
|
101
115
|
? options.map(
|
|
102
116
|
(
|
|
103
|
-
{
|
|
117
|
+
{
|
|
118
|
+
'aria-label': ariaLabel,
|
|
119
|
+
description,
|
|
120
|
+
disabled,
|
|
121
|
+
href,
|
|
122
|
+
target,
|
|
123
|
+
media: { block },
|
|
124
|
+
onClick,
|
|
125
|
+
title,
|
|
126
|
+
},
|
|
104
127
|
key,
|
|
105
128
|
) => (
|
|
106
129
|
<Tile
|
|
@@ -109,6 +132,7 @@ const Decision = ({
|
|
|
109
132
|
className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {
|
|
110
133
|
'np-decision__tile--fixed-width': isGrid,
|
|
111
134
|
})}
|
|
135
|
+
aria-label={ariaLabel}
|
|
112
136
|
description={description}
|
|
113
137
|
disabled={disabled}
|
|
114
138
|
href={href}
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { useContext, useId } from 'react';
|
|
2
|
+
import { HTMLAttributes, useContext, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Position, Typography } from '../common';
|
|
5
5
|
import { CloseButton } from '../common/closeButton';
|
|
@@ -10,7 +10,7 @@ import SlidingPanel from '../slidingPanel';
|
|
|
10
10
|
import Title from '../title';
|
|
11
11
|
import { logActionRequiredIf } from '../utilities';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type DrawerProps = {
|
|
14
14
|
/** The content to appear in the drawer body. */
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
className?: string;
|
|
@@ -24,7 +24,7 @@ export interface DrawerProps {
|
|
|
24
24
|
position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;
|
|
25
25
|
/** The action to perform on close click. */
|
|
26
26
|
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
27
|
-
}
|
|
27
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;
|
|
28
28
|
|
|
29
29
|
export default function Drawer({
|
|
30
30
|
children,
|
|
@@ -34,6 +34,8 @@ export default function Drawer({
|
|
|
34
34
|
onClose,
|
|
35
35
|
open = false,
|
|
36
36
|
position = 'right',
|
|
37
|
+
role = 'dialog',
|
|
38
|
+
'aria-labelledby': ariaLabelledBy,
|
|
37
39
|
}: DrawerProps) {
|
|
38
40
|
logActionRequiredIf(
|
|
39
41
|
'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',
|
|
@@ -50,9 +52,9 @@ export default function Drawer({
|
|
|
50
52
|
<SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>
|
|
51
53
|
<div
|
|
52
54
|
id={overlayId}
|
|
53
|
-
role=
|
|
55
|
+
role={role}
|
|
54
56
|
aria-modal
|
|
55
|
-
aria-labelledby={headerTitle ? titleId : undefined}
|
|
57
|
+
aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}
|
|
56
58
|
className={clsx('np-drawer', className)}
|
|
57
59
|
>
|
|
58
60
|
<div
|
|
@@ -6,11 +6,14 @@ import Avatar, { AvatarType } from '../avatar';
|
|
|
6
6
|
import AvatarWrapper from '../avatarWrapper';
|
|
7
7
|
import Body from '../body';
|
|
8
8
|
import Button from '../button';
|
|
9
|
-
import { ProfileType, Size } from '../common';
|
|
9
|
+
import { ProfileType, Size, Typography } from '../common';
|
|
10
10
|
import Logo from '../logo';
|
|
11
11
|
import OverlayHeader from '../overlayHeader';
|
|
12
12
|
|
|
13
13
|
import FlowNavigation from './FlowNavigation';
|
|
14
|
+
import { lorem10 } from '../test-utils';
|
|
15
|
+
import Display from '../display';
|
|
16
|
+
import Sticky from '../sticky';
|
|
14
17
|
|
|
15
18
|
export default {
|
|
16
19
|
component: FlowNavigation,
|
|
@@ -51,26 +54,12 @@ export const Variants = () => {
|
|
|
51
54
|
steps={[
|
|
52
55
|
{
|
|
53
56
|
label: 'Amount',
|
|
54
|
-
hoverLabel:
|
|
55
|
-
<>
|
|
56
|
-
<div>
|
|
57
|
-
<strong>100 GBP</strong>
|
|
58
|
-
</div>
|
|
59
|
-
0.2351 ETH
|
|
60
|
-
</>
|
|
61
|
-
),
|
|
57
|
+
hoverLabel: <strong>100 GBP</strong>,
|
|
62
58
|
onClick: () => setActiveStep(0),
|
|
63
59
|
},
|
|
64
60
|
{
|
|
65
61
|
label: 'You',
|
|
66
|
-
hoverLabel:
|
|
67
|
-
<>
|
|
68
|
-
<div>
|
|
69
|
-
<strong>Elena Durante</strong>
|
|
70
|
-
</div>
|
|
71
|
-
elenadurante@test.com
|
|
72
|
-
</>
|
|
73
|
-
),
|
|
62
|
+
hoverLabel: <>Elena Durante - elenadurante@test.com</>,
|
|
74
63
|
onClick: () => setActiveStep(1),
|
|
75
64
|
},
|
|
76
65
|
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(2) },
|
|
@@ -201,6 +190,69 @@ export const Variants = () => {
|
|
|
201
190
|
) : null;
|
|
202
191
|
};
|
|
203
192
|
|
|
193
|
+
export const SendFlow = () => {
|
|
194
|
+
const [activeStep, setActiveStep] = useState(2);
|
|
195
|
+
const steps = [
|
|
196
|
+
{
|
|
197
|
+
label: 'Recipient',
|
|
198
|
+
onClick: handleStepClick(0),
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
label: 'Amount',
|
|
202
|
+
hoverLabel: (
|
|
203
|
+
<>
|
|
204
|
+
You send 100 GBP <br />
|
|
205
|
+
You get 99.39 GBP{' '}
|
|
206
|
+
</>
|
|
207
|
+
),
|
|
208
|
+
...(activeStep > 1 && { onClick: handleStepClick(1) }),
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
label: 'Review',
|
|
212
|
+
...(activeStep > 2 && { onClick: handleStepClick(2) }),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: 'Pay',
|
|
216
|
+
...(activeStep > 3 && { onClick: handleStepClick(3) }),
|
|
217
|
+
},
|
|
218
|
+
];
|
|
219
|
+
function handleStepClick(step) {
|
|
220
|
+
return () => {
|
|
221
|
+
setActiveStep(step);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return (
|
|
225
|
+
<>
|
|
226
|
+
<FlowNavigation
|
|
227
|
+
avatar={
|
|
228
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
229
|
+
<ProfileIcon />
|
|
230
|
+
</Avatar>
|
|
231
|
+
}
|
|
232
|
+
logo={<Logo />}
|
|
233
|
+
activeStep={activeStep}
|
|
234
|
+
steps={steps}
|
|
235
|
+
onClose={() => alert('close & move away')}
|
|
236
|
+
onGoBack={() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0)}
|
|
237
|
+
/>
|
|
238
|
+
|
|
239
|
+
<Body className="m-a-3">
|
|
240
|
+
<Display type={Typography.DISPLAY_SMALL}>{steps[activeStep].label} Step</Display>
|
|
241
|
+
<br />
|
|
242
|
+
{lorem10}
|
|
243
|
+
</Body>
|
|
244
|
+
|
|
245
|
+
<Sticky>
|
|
246
|
+
<div className="d-flex justify-content-center align-items-center p-a-3">
|
|
247
|
+
<Button disabled={activeStep === 3} block onClick={() => setActiveStep(activeStep + 1)}>
|
|
248
|
+
Continue
|
|
249
|
+
</Button>
|
|
250
|
+
</div>
|
|
251
|
+
</Sticky>
|
|
252
|
+
</>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
|
|
204
256
|
export const WithOverlayHeaderComparison = () => {
|
|
205
257
|
const [activeStep, setActiveStep] = useState(4);
|
|
206
258
|
const [closed, setClosed] = useState(false);
|
|
@@ -71,11 +71,7 @@ const FlowNavigation = ({
|
|
|
71
71
|
<div className="np-flow-header__left">{logo}</div>
|
|
72
72
|
)}
|
|
73
73
|
{!screenSm && !done && (
|
|
74
|
-
<AnimatedLabel
|
|
75
|
-
className="m-x-1"
|
|
76
|
-
labels={steps.map((step) => step.label)}
|
|
77
|
-
activeLabel={activeStep}
|
|
78
|
-
/>
|
|
74
|
+
<AnimatedLabel className="m-x-1" steps={steps} activeLabel={activeStep} />
|
|
79
75
|
)}
|
|
80
76
|
</>
|
|
81
77
|
}
|