@transferwise/components 46.126.0 → 46.127.1
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/listItem/Prompt/ListItemPrompt.js +5 -4
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +6 -2
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +21 -21
- package/build/styles/main.css +21 -21
- package/build/styles/sentimentSurface/SentimentSurface.css +21 -21
- package/build/types/listItem/ListItem.d.ts +1 -1
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts +2 -3
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/accordion/Accordion.test.js +0 -6
- package/src/accordion/AccordionItem/AccordionItem.test.js +0 -10
- package/src/actionButton/ActionButton.test.tsx +0 -4
- package/src/avatarWrapper/AvatarWrapper.test.tsx +0 -53
- package/src/checkbox/Checkbox.test.tsx +0 -5
- package/src/chevron/Chevron.test.tsx +0 -7
- package/src/chips/Chips.test.tsx +0 -8
- package/src/common/RadioButton/RadioButton.test.tsx +0 -18
- package/src/common/bottomSheet/BottomSheet.test.tsx +0 -9
- package/src/common/card/Card.test.tsx +0 -6
- package/src/common/closeButton/CloseButton.test.tsx +0 -4
- package/src/common/panel/Panel.test.tsx +0 -6
- package/src/flowNavigation/FlowNavigation.test.js +0 -10
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +71 -9
- package/src/listItem/Prompt/ListItemPrompt.test.tsx +31 -0
- package/src/listItem/Prompt/ListItemPrompt.tsx +8 -2
- package/src/logo/Logo.story.tsx +24 -5
- package/src/main.css +21 -21
- package/src/overlayHeader/OverlayHeader.test.tsx +0 -3
- package/src/popover/Popover.test.tsx +0 -25
- package/src/promoCard/PromoCard.test.tsx +0 -6
- package/src/promoCard/PromoCardGroup.test.tsx +0 -5
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +13 -10
- package/src/prompt/InlinePrompt/InlinePrompt.test.tsx +13 -1
- package/src/sentimentSurface/SentimentSurface.css +21 -21
- package/src/sentimentSurface/SentimentSurface.less +13 -13
- package/src/sentimentSurface/SentimentSurface.story.tsx +1 -1
- package/src/sentimentSurface/SentimentSurface.test.story.tsx +48 -1
- package/src/tile/Tile.test.tsx +0 -10
- package/src/tooltip/Tooltip.test.tsx +0 -10
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.test.js.snap +0 -124
- package/src/accordion/__snapshots__/Accordion.test.js.snap +0 -3
- package/src/actionButton/__snapshots__/ActionButton.test.tsx.snap +0 -12
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.test.tsx.snap +0 -156
- package/src/checkbox/__snapshots__/Checkbox.test.tsx.snap +0 -40
- package/src/chevron/__snapshots__/Chevron.test.tsx.snap +0 -24
- package/src/chips/__snapshots__/Chips.test.tsx.snap +0 -153
- package/src/common/RadioButton/__snapshots__/RadioButton.test.tsx.snap +0 -58
- package/src/common/bottomSheet/__snapshots__/BottomSheet.test.tsx.snap +0 -80
- package/src/common/card/__snapshots__/Card.test.tsx.snap +0 -10
- package/src/common/closeButton/__snapshots__/CloseButton.test.tsx.snap +0 -30
- package/src/common/flowHeader/FlowHeader.test.tsx +0 -22
- package/src/common/flowHeader/__snapshots__/FlowHeader.test.tsx.snap +0 -33
- package/src/common/panel/__snapshots__/Panel.test.tsx.snap +0 -3
- package/src/flowNavigation/__snapshots__/FlowNavigation.test.js.snap +0 -262
- package/src/logo/Logo.test.tsx +0 -55
- package/src/logo/__snapshots__/Logo.test.tsx.snap +0 -281
- package/src/overlayHeader/__snapshots__/OverlayHeader.test.tsx.snap +0 -65
- package/src/popover/__snapshots__/Popover.test.tsx.snap +0 -51
- package/src/promoCard/__snapshots__/PromoCard.test.tsx.snap +0 -40
- package/src/promoCard/__snapshots__/PromoCardGroup.test.tsx.snap +0 -80
- package/src/tile/__snapshots__/Tile.test.tsx.snap +0 -55
- package/src/tooltip/__snapshots__/Tooltip.test.tsx.snap +0 -32
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '../_stories/subcomponents';
|
|
12
12
|
import { ListItem } from '../ListItem';
|
|
13
13
|
import { Prompt, type ListItemPromptProps } from './ListItemPrompt';
|
|
14
|
+
import { Clock } from '@transferwise/icons';
|
|
14
15
|
|
|
15
16
|
const meta: Meta<ListItemPromptProps> = {
|
|
16
17
|
component: Prompt,
|
|
@@ -66,7 +67,7 @@ export const Playground: Story = {
|
|
|
66
67
|
subtitle={lorem10}
|
|
67
68
|
media={MEDIA.avatarSingle}
|
|
68
69
|
control={CONTROLS.switch}
|
|
69
|
-
prompt={<Prompt {...args} />}
|
|
70
|
+
prompt={<ListItem.Prompt {...args} />}
|
|
70
71
|
/>
|
|
71
72
|
</List>
|
|
72
73
|
),
|
|
@@ -86,28 +87,89 @@ export const Sentiment: Story = {
|
|
|
86
87
|
subtitle={lorem10}
|
|
87
88
|
media={MEDIA.avatarSingle}
|
|
88
89
|
control={CONTROLS.switch}
|
|
89
|
-
prompt={
|
|
90
|
+
prompt={
|
|
91
|
+
<ListItem.Prompt sentiment={Sentiments.NEUTRAL}>
|
|
92
|
+
This is a neutral prompt.
|
|
93
|
+
</ListItem.Prompt>
|
|
94
|
+
}
|
|
90
95
|
/>
|
|
91
96
|
<ListItem
|
|
92
97
|
title={lorem5}
|
|
93
98
|
subtitle={lorem10}
|
|
94
99
|
media={MEDIA.avatarSingle}
|
|
95
100
|
control={CONTROLS.switch}
|
|
96
|
-
prompt={
|
|
101
|
+
prompt={
|
|
102
|
+
<ListItem.Prompt sentiment={Sentiments.POSITIVE}>
|
|
103
|
+
This is a positive prompt.
|
|
104
|
+
</ListItem.Prompt>
|
|
105
|
+
}
|
|
97
106
|
/>
|
|
98
107
|
<ListItem
|
|
99
108
|
title={lorem5}
|
|
100
109
|
subtitle={lorem10}
|
|
101
110
|
media={MEDIA.avatarSingle}
|
|
102
111
|
control={CONTROLS.switch}
|
|
103
|
-
prompt={
|
|
112
|
+
prompt={
|
|
113
|
+
<ListItem.Prompt sentiment={Sentiments.WARNING}>
|
|
114
|
+
This is a warning prompt.
|
|
115
|
+
</ListItem.Prompt>
|
|
116
|
+
}
|
|
104
117
|
/>
|
|
105
118
|
<ListItem
|
|
106
119
|
title={lorem5}
|
|
107
120
|
subtitle={lorem10}
|
|
108
121
|
media={MEDIA.avatarSingle}
|
|
109
122
|
control={CONTROLS.switch}
|
|
110
|
-
prompt={
|
|
123
|
+
prompt={
|
|
124
|
+
<ListItem.Prompt sentiment={Sentiments.NEGATIVE}>
|
|
125
|
+
This is a negative prompt.
|
|
126
|
+
</ListItem.Prompt>
|
|
127
|
+
}
|
|
128
|
+
/>
|
|
129
|
+
</List>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* While all main sentiments (`warning`, `negative`, `positive` and `neutral`) are associated with a
|
|
135
|
+
* default `StatusIcon`s, we also allow for Icon overrides to bring the prompt's visual language
|
|
136
|
+
* closer to the prompt's content. <br /><br />
|
|
137
|
+
* It's also possible to override the default StatusIcon's accessible name announced by screen
|
|
138
|
+
* readers via `mediaLabel` prop, which is especially useful for the `proposition` sentiment.
|
|
139
|
+
* <br /><br />
|
|
140
|
+
* **NB**: If you're setting a label on a custom Icon, the accessible name should be provided via
|
|
141
|
+
* Icon's `title` prop instead.
|
|
142
|
+
*/
|
|
143
|
+
export const IconOverrides: Story = {
|
|
144
|
+
parameters: {
|
|
145
|
+
controls: { disable: true },
|
|
146
|
+
actions: { disable: true },
|
|
147
|
+
a11y: { disable: true },
|
|
148
|
+
knobs: { disable: true },
|
|
149
|
+
},
|
|
150
|
+
render: (args) => (
|
|
151
|
+
<List>
|
|
152
|
+
<ListItem
|
|
153
|
+
title={lorem5}
|
|
154
|
+
subtitle={lorem10}
|
|
155
|
+
media={MEDIA.avatarSingle}
|
|
156
|
+
control={CONTROLS.switch}
|
|
157
|
+
prompt={
|
|
158
|
+
<ListItem.Prompt sentiment={Sentiments.WARNING} mediaLabel="Processing: ">
|
|
159
|
+
This prompt uses default Icon, but with a custom label for screen readers.
|
|
160
|
+
</ListItem.Prompt>
|
|
161
|
+
}
|
|
162
|
+
/>
|
|
163
|
+
<ListItem
|
|
164
|
+
title={lorem5}
|
|
165
|
+
subtitle={lorem10}
|
|
166
|
+
media={MEDIA.avatarSingle}
|
|
167
|
+
control={CONTROLS.switch}
|
|
168
|
+
prompt={
|
|
169
|
+
<ListItem.Prompt sentiment={Sentiments.WARNING} media={<Clock title="Processing: " />}>
|
|
170
|
+
This prompt uses custom Icon with a custom label for screen readers.
|
|
171
|
+
</ListItem.Prompt>
|
|
172
|
+
}
|
|
111
173
|
/>
|
|
112
174
|
</List>
|
|
113
175
|
),
|
|
@@ -135,13 +197,13 @@ export const Interactivity: Story = {
|
|
|
135
197
|
media={MEDIA.avatarSingle}
|
|
136
198
|
control={CONTROLS.switch}
|
|
137
199
|
prompt={
|
|
138
|
-
<Prompt sentiment={args.sentiment}>
|
|
200
|
+
<ListItem.Prompt sentiment={args.sentiment}>
|
|
139
201
|
This prompt includes a{' '}
|
|
140
202
|
<Link href="https://wise.com" target="_blank" rel="noreferrer">
|
|
141
203
|
link to some resource
|
|
142
204
|
</Link>{' '}
|
|
143
205
|
to help the user in their journey.
|
|
144
|
-
</Prompt>
|
|
206
|
+
</ListItem.Prompt>
|
|
145
207
|
}
|
|
146
208
|
/>
|
|
147
209
|
|
|
@@ -151,13 +213,13 @@ export const Interactivity: Story = {
|
|
|
151
213
|
media={MEDIA.avatarSingle}
|
|
152
214
|
control={CONTROLS.switch}
|
|
153
215
|
prompt={
|
|
154
|
-
<Prompt sentiment={args.sentiment}>
|
|
216
|
+
<ListItem.Prompt sentiment={args.sentiment}>
|
|
155
217
|
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
156
218
|
This prompt includes an <Link onClick={action('inline button')}>
|
|
157
219
|
inline button
|
|
158
220
|
</Link>{' '}
|
|
159
221
|
than can e.g. trigger a modal.
|
|
160
|
-
</Prompt>
|
|
222
|
+
</ListItem.Prompt>
|
|
161
223
|
}
|
|
162
224
|
/>
|
|
163
225
|
</List>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Clock } from '@transferwise/icons';
|
|
1
2
|
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
2
3
|
import { Sentiment } from '../../common';
|
|
3
4
|
import { ListItem } from '../ListItem';
|
|
@@ -18,6 +19,8 @@ describe('ListItem.Prompt', () => {
|
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
describe('render icon', () => {
|
|
22
|
+
const customLabel = 'Custom icon label';
|
|
23
|
+
|
|
21
24
|
it.each([
|
|
22
25
|
[Sentiment.NEUTRAL, 'info-icon'],
|
|
23
26
|
[Sentiment.POSITIVE, 'check-icon'],
|
|
@@ -32,6 +35,34 @@ describe('ListItem.Prompt', () => {
|
|
|
32
35
|
);
|
|
33
36
|
expect(screen.getByTestId(iconId)).toBeInTheDocument();
|
|
34
37
|
});
|
|
38
|
+
|
|
39
|
+
it('should accept accessible name override for a status icon', () => {
|
|
40
|
+
render(
|
|
41
|
+
<ListItem
|
|
42
|
+
title="Test Title"
|
|
43
|
+
prompt={
|
|
44
|
+
<ListItem.Prompt sentiment={Sentiment.NEGATIVE} mediaLabel={customLabel}>
|
|
45
|
+
Message
|
|
46
|
+
</ListItem.Prompt>
|
|
47
|
+
}
|
|
48
|
+
/>,
|
|
49
|
+
);
|
|
50
|
+
expect(screen.getByLabelText(customLabel)).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should accept icon accessible name override', () => {
|
|
54
|
+
render(
|
|
55
|
+
<ListItem
|
|
56
|
+
title="Test Title"
|
|
57
|
+
prompt={
|
|
58
|
+
<ListItem.Prompt sentiment={Sentiment.NEGATIVE} media={<Clock title={customLabel} />}>
|
|
59
|
+
Message
|
|
60
|
+
</ListItem.Prompt>
|
|
61
|
+
}
|
|
62
|
+
/>,
|
|
63
|
+
);
|
|
64
|
+
expect(screen.getByLabelText(customLabel)).toBeInTheDocument();
|
|
65
|
+
});
|
|
35
66
|
});
|
|
36
67
|
|
|
37
68
|
describe('muted state', () => {
|
|
@@ -3,7 +3,10 @@ import { Sentiment } from '../../common';
|
|
|
3
3
|
import { ListItemContext, type ListItemContextData } from '../ListItemContext';
|
|
4
4
|
import { InlinePrompt, type InlinePromptProps } from '../../prompt';
|
|
5
5
|
|
|
6
|
-
export type ListItemPromptProps = Pick<
|
|
6
|
+
export type ListItemPromptProps = Pick<
|
|
7
|
+
InlinePromptProps,
|
|
8
|
+
'children' | 'sentiment' | 'mediaLabel' | 'media' | 'loading'
|
|
9
|
+
>;
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* This component allows for rendering an Inline Prompt. <br />
|
|
@@ -15,6 +18,8 @@ export const Prompt = ({
|
|
|
15
18
|
sentiment = Sentiment.NEUTRAL,
|
|
16
19
|
mediaLabel,
|
|
17
20
|
children,
|
|
21
|
+
media,
|
|
22
|
+
loading,
|
|
18
23
|
}: ListItemPromptProps) => {
|
|
19
24
|
const { ids, props } = useContext<ListItemContextData>(ListItemContext);
|
|
20
25
|
const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);
|
|
@@ -23,6 +28,8 @@ export const Prompt = ({
|
|
|
23
28
|
<InlinePrompt
|
|
24
29
|
id={ids.prompt}
|
|
25
30
|
sentiment={sentiment}
|
|
31
|
+
media={media}
|
|
32
|
+
loading={loading}
|
|
26
33
|
mediaLabel={mediaLabel}
|
|
27
34
|
muted={isLongLivedMuted}
|
|
28
35
|
className="wds-list-item-prompt"
|
|
@@ -33,4 +40,3 @@ export const Prompt = ({
|
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
Prompt.displayName = 'ListItem.Prompt';
|
|
36
|
-
export default Prompt;
|
package/src/logo/Logo.story.tsx
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
|
-
import Logo from '.';
|
|
3
|
+
import Logo, { LogoType } from '.';
|
|
4
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
component: Logo,
|
|
7
8
|
title: 'Content/Logo',
|
|
8
|
-
render: (
|
|
9
|
+
render: () => {
|
|
9
10
|
return (
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
11
|
+
<>
|
|
12
|
+
<div>
|
|
13
|
+
{Object.values(LogoType).map((type) => (
|
|
14
|
+
<div key={type} className="m-a-2">
|
|
15
|
+
<Logo type={type} />
|
|
16
|
+
</div>
|
|
17
|
+
))}
|
|
18
|
+
</div>
|
|
19
|
+
<div className="bg--dark">
|
|
20
|
+
{Object.values(LogoType).map((type) => (
|
|
21
|
+
<div key={type} className="m-a-2">
|
|
22
|
+
<Logo type={type} inverse />
|
|
23
|
+
</div>
|
|
24
|
+
))}
|
|
25
|
+
</div>
|
|
26
|
+
</>
|
|
13
27
|
);
|
|
14
28
|
},
|
|
15
29
|
} satisfies Meta<typeof Logo>;
|
|
@@ -22,3 +36,8 @@ export const Basic: Story = {
|
|
|
22
36
|
inverse: false,
|
|
23
37
|
},
|
|
24
38
|
};
|
|
39
|
+
|
|
40
|
+
export const Mobile: Story = {
|
|
41
|
+
...Basic,
|
|
42
|
+
...withVariantConfig(['mobile']),
|
|
43
|
+
};
|
package/src/main.css
CHANGED
|
@@ -304,18 +304,18 @@
|
|
|
304
304
|
--color-sentiment-interactive-primary: #454745;
|
|
305
305
|
--color-sentiment-interactive-primary-hover: #353635;
|
|
306
306
|
--color-sentiment-interactive-primary-active: #232423;
|
|
307
|
-
--color-sentiment-interactive-secondary:
|
|
308
|
-
--color-sentiment-interactive-secondary-hover:
|
|
309
|
-
--color-sentiment-interactive-secondary-active:
|
|
310
|
-
--color-sentiment-interactive-secondary-neutral:
|
|
311
|
-
--color-sentiment-interactive-secondary-neutral-hover:
|
|
312
|
-
--color-sentiment-interactive-secondary-neutral-active:
|
|
307
|
+
--color-sentiment-interactive-secondary: rgba(62, 59, 7, 0.07);
|
|
308
|
+
--color-sentiment-interactive-secondary-hover: rgba(62, 59, 7, 0.12);
|
|
309
|
+
--color-sentiment-interactive-secondary-active: rgba(62, 59, 7, 0.17);
|
|
310
|
+
--color-sentiment-interactive-secondary-neutral: rgba(62, 59, 7, 0.07);
|
|
311
|
+
--color-sentiment-interactive-secondary-neutral-hover: rgba(62, 59, 7, 0.12);
|
|
312
|
+
--color-sentiment-interactive-secondary-neutral-active: rgba(62, 59, 7, 0.17);
|
|
313
313
|
--color-sentiment-interactive-control: #F1F1ED;
|
|
314
314
|
--color-sentiment-interactive-control-hover: #E7E7E1;
|
|
315
315
|
--color-sentiment-interactive-control-active: #DFDED5;
|
|
316
|
-
--color-sentiment-background-surface:
|
|
317
|
-
--color-sentiment-background-surface-hover:
|
|
318
|
-
--color-sentiment-background-surface-active:
|
|
316
|
+
--color-sentiment-background-surface: rgba(62, 59, 7, 0.07);
|
|
317
|
+
--color-sentiment-background-surface-hover: rgba(62, 59, 7, 0.12);
|
|
318
|
+
--color-sentiment-background-surface-active: rgba(62, 59, 7, 0.17);
|
|
319
319
|
}
|
|
320
320
|
.np-theme-personal .wds-sentiment-surface-neutral-elevated,
|
|
321
321
|
.np-theme-business .wds-sentiment-surface-neutral-elevated,
|
|
@@ -331,9 +331,9 @@
|
|
|
331
331
|
--color-sentiment-interactive-secondary: #454745;
|
|
332
332
|
--color-sentiment-interactive-secondary-hover: #353635;
|
|
333
333
|
--color-sentiment-interactive-secondary-active: #232423;
|
|
334
|
-
--color-sentiment-interactive-secondary-neutral: #
|
|
335
|
-
--color-sentiment-interactive-secondary-neutral-hover: #
|
|
336
|
-
--color-sentiment-interactive-secondary-neutral-active: #
|
|
334
|
+
--color-sentiment-interactive-secondary-neutral: #585958;
|
|
335
|
+
--color-sentiment-interactive-secondary-neutral-hover: #6A6C6A;
|
|
336
|
+
--color-sentiment-interactive-secondary-neutral-active: #7D7E7D;
|
|
337
337
|
--color-sentiment-interactive-control: #454745;
|
|
338
338
|
--color-sentiment-interactive-control-hover: #353635;
|
|
339
339
|
--color-sentiment-interactive-control-active: #232423;
|
|
@@ -352,18 +352,18 @@
|
|
|
352
352
|
--color-sentiment-interactive-primary: #F1F1ED;
|
|
353
353
|
--color-sentiment-interactive-primary-hover: #E7E7E1;
|
|
354
354
|
--color-sentiment-interactive-primary-active: #DFDED5;
|
|
355
|
-
--color-sentiment-interactive-secondary:
|
|
356
|
-
--color-sentiment-interactive-secondary-hover:
|
|
357
|
-
--color-sentiment-interactive-secondary-active:
|
|
358
|
-
--color-sentiment-interactive-secondary-neutral:
|
|
359
|
-
--color-sentiment-interactive-secondary-neutral-hover:
|
|
360
|
-
--color-sentiment-interactive-secondary-neutral-active:
|
|
355
|
+
--color-sentiment-interactive-secondary: rgba(255, 255, 255, 0.1);
|
|
356
|
+
--color-sentiment-interactive-secondary-hover: rgba(255, 255, 255, 0.2);
|
|
357
|
+
--color-sentiment-interactive-secondary-active: rgba(255, 255, 255, 0.3);
|
|
358
|
+
--color-sentiment-interactive-secondary-neutral: rgba(255, 255, 255, 0.1);
|
|
359
|
+
--color-sentiment-interactive-secondary-neutral-hover: rgba(255, 255, 255, 0.2);
|
|
360
|
+
--color-sentiment-interactive-secondary-neutral-active: rgba(255, 255, 255, 0.3);
|
|
361
361
|
--color-sentiment-interactive-control: #2A2C29;
|
|
362
362
|
--color-sentiment-interactive-control-hover: #414441;
|
|
363
363
|
--color-sentiment-interactive-control-active: #595B58;
|
|
364
|
-
--color-sentiment-background-surface:
|
|
365
|
-
--color-sentiment-background-surface-hover:
|
|
366
|
-
--color-sentiment-background-surface-active:
|
|
364
|
+
--color-sentiment-background-surface: rgba(255, 255, 255, 0.1);
|
|
365
|
+
--color-sentiment-background-surface-hover: rgba(255, 255, 255, 0.2);
|
|
366
|
+
--color-sentiment-background-surface-active: rgba(255, 255, 255, 0.3);
|
|
367
367
|
}
|
|
368
368
|
.np-theme-personal--dark .wds-sentiment-surface-neutral-elevated,
|
|
369
369
|
.np-theme-business--dark .wds-sentiment-surface-neutral-elevated,
|
|
@@ -11,9 +11,6 @@ describe('OverlayHeader', () => {
|
|
|
11
11
|
logo: <img alt="logo_desktop" src="img_desktop" width="138" height="24" />,
|
|
12
12
|
onClose: jest.fn(),
|
|
13
13
|
};
|
|
14
|
-
it('renders as expected', () => {
|
|
15
|
-
expect(render(<OverlayHeader {...props} />).container).toMatchSnapshot();
|
|
16
|
-
});
|
|
17
14
|
|
|
18
15
|
it('renders separator only if avatar and onClose are provided', () => {
|
|
19
16
|
const { container } = render(<OverlayHeader {...props} />);
|
|
@@ -22,19 +22,6 @@ describe('Popover', () => {
|
|
|
22
22
|
let rerender;
|
|
23
23
|
|
|
24
24
|
describe('on desktop', () => {
|
|
25
|
-
it('renders when is open', async () => {
|
|
26
|
-
render(
|
|
27
|
-
<Popover {...props}>
|
|
28
|
-
<button type="button">Open</button>
|
|
29
|
-
</Popover>,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
await userEvent.click(screen.getByText('Open'));
|
|
33
|
-
|
|
34
|
-
await waitForPanel();
|
|
35
|
-
expect(getPanel()).toMatchSnapshot();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
25
|
describe('title', () => {
|
|
39
26
|
it('renders title', async () => {
|
|
40
27
|
({ container, rerender } = render(
|
|
@@ -122,18 +109,6 @@ describe('Popover', () => {
|
|
|
122
109
|
global.innerWidth = Breakpoint.SMALL - 1;
|
|
123
110
|
});
|
|
124
111
|
|
|
125
|
-
it('renders when is open', async () => {
|
|
126
|
-
({ container } = render(
|
|
127
|
-
<Popover {...props}>
|
|
128
|
-
<button type="button">Open</button>
|
|
129
|
-
</Popover>,
|
|
130
|
-
));
|
|
131
|
-
|
|
132
|
-
await userEvent.click(screen.getByText('Open'));
|
|
133
|
-
|
|
134
|
-
expect(container).toMatchSnapshot();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
112
|
it('renders BottomSheet onClick', async () => {
|
|
138
113
|
render(
|
|
139
114
|
<Popover {...props}>
|
|
@@ -26,12 +26,6 @@ describe('PromoCard', () => {
|
|
|
26
26
|
};
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('matches snapshot', () => {
|
|
30
|
-
const { container } = render(<PromoCard {...defaultProps} id="test-promo-card" />);
|
|
31
|
-
|
|
32
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
29
|
it('renders', () => {
|
|
36
30
|
const props = {
|
|
37
31
|
...defaultProps,
|
|
@@ -41,11 +41,6 @@ describe('PromoCardGroup', () => {
|
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
it('matches snapshot', () => {
|
|
45
|
-
const { container } = render(<PromoCardGroup {...defaultProps} />);
|
|
46
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
44
|
it('renders', () => {
|
|
50
45
|
const props = {
|
|
51
46
|
...defaultProps,
|
|
@@ -225,24 +225,27 @@ export const Muted: StoryObj<PreviewStoryArgs> = {
|
|
|
225
225
|
* While all main sentiments (`warning`, `negative`, `positive` and`neutral`) are associated with a
|
|
226
226
|
* default `StatusIcon`s, we also allow for Icon overrides to bring the prompt's visual language
|
|
227
227
|
* closer to the prompt's content. <br /><br />
|
|
228
|
-
* It's also possible to override the default
|
|
229
|
-
* via `mediaLabel` prop, which is especially useful for the `proposition` sentiment.
|
|
228
|
+
* It's also possible to override the default StatusIcon's accessible name announced by screen
|
|
229
|
+
* readers via `mediaLabel` prop, which is especially useful for the `proposition` sentiment.
|
|
230
|
+
* <br /><br />
|
|
231
|
+
* **NB**: If you're setting a label on a custom Icon, the accessible name should be provided via
|
|
232
|
+
* Icon's `title` prop instead.
|
|
230
233
|
*/
|
|
231
234
|
export const IconOverrides: StoryObj<PreviewStoryArgs> = {
|
|
232
235
|
render: (args: PreviewStoryArgs) => {
|
|
233
236
|
return (
|
|
234
237
|
<>
|
|
235
|
-
<InlinePrompt {...args}
|
|
236
|
-
|
|
237
|
-
</InlinePrompt>
|
|
238
|
-
<InlinePrompt {...args} media={<Taxi />} sentiment="proposition" mediaLabel="Taxi addon: ">
|
|
239
|
-
Connect Wise with your taxi app to get exclusive discounts.
|
|
238
|
+
<InlinePrompt {...args} sentiment="negative" mediaLabel="Rejected: ">
|
|
239
|
+
This prompt uses default Icon, but with a custom label for screen readers.
|
|
240
240
|
</InlinePrompt>
|
|
241
|
-
<InlinePrompt {...args} media={<Clock />} sentiment="warning"
|
|
241
|
+
<InlinePrompt {...args} media={<Clock title="Processing: " />} sentiment="warning">
|
|
242
242
|
The account verification is taking longer than usual.
|
|
243
243
|
</InlinePrompt>
|
|
244
|
-
<InlinePrompt {...args} media={<
|
|
245
|
-
|
|
244
|
+
<InlinePrompt {...args} media={<Travel title="Activated: " />} sentiment="positive">
|
|
245
|
+
Your travel account is set up and ready to use.
|
|
246
|
+
</InlinePrompt>
|
|
247
|
+
<InlinePrompt {...args} media={<Taxi title="Taxi addon: " />} sentiment="proposition">
|
|
248
|
+
Connect Wise with your taxi app to get exclusive discounts.
|
|
246
249
|
</InlinePrompt>
|
|
247
250
|
</>
|
|
248
251
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Clock } from '@transferwise/icons';
|
|
1
2
|
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
2
3
|
import { InlinePrompt, InlinePromptProps } from './InlinePrompt';
|
|
3
4
|
import { Sentiment } from '../../common';
|
|
@@ -91,11 +92,22 @@ describe('InlinePrompt', () => {
|
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
it('should allow for customisation of aria label', () => {
|
|
95
|
+
it('should allow for customisation of aria label for StatusIcon', () => {
|
|
95
96
|
render(<InlinePrompt {...defaultProps} sentiment={sentiment} mediaLabel={mediaLabel} />);
|
|
96
97
|
expect(screen.getByLabelText(mediaLabel)).toBeInTheDocument();
|
|
97
98
|
});
|
|
98
99
|
|
|
100
|
+
it('should allow for customisation of aria label for a custom Icon', () => {
|
|
101
|
+
render(
|
|
102
|
+
<InlinePrompt
|
|
103
|
+
{...defaultProps}
|
|
104
|
+
sentiment={sentiment}
|
|
105
|
+
media={<Clock title={mediaLabel} />}
|
|
106
|
+
/>,
|
|
107
|
+
);
|
|
108
|
+
expect(screen.getByLabelText(mediaLabel)).toBeInTheDocument();
|
|
109
|
+
});
|
|
110
|
+
|
|
99
111
|
it('should retain custom label while muted', () => {
|
|
100
112
|
render(
|
|
101
113
|
<InlinePrompt {...defaultProps} sentiment={sentiment} mediaLabel={mediaLabel} muted />,
|
|
@@ -304,18 +304,18 @@
|
|
|
304
304
|
--color-sentiment-interactive-primary: #454745;
|
|
305
305
|
--color-sentiment-interactive-primary-hover: #353635;
|
|
306
306
|
--color-sentiment-interactive-primary-active: #232423;
|
|
307
|
-
--color-sentiment-interactive-secondary:
|
|
308
|
-
--color-sentiment-interactive-secondary-hover:
|
|
309
|
-
--color-sentiment-interactive-secondary-active:
|
|
310
|
-
--color-sentiment-interactive-secondary-neutral:
|
|
311
|
-
--color-sentiment-interactive-secondary-neutral-hover:
|
|
312
|
-
--color-sentiment-interactive-secondary-neutral-active:
|
|
307
|
+
--color-sentiment-interactive-secondary: rgba(62, 59, 7, 0.07);
|
|
308
|
+
--color-sentiment-interactive-secondary-hover: rgba(62, 59, 7, 0.12);
|
|
309
|
+
--color-sentiment-interactive-secondary-active: rgba(62, 59, 7, 0.17);
|
|
310
|
+
--color-sentiment-interactive-secondary-neutral: rgba(62, 59, 7, 0.07);
|
|
311
|
+
--color-sentiment-interactive-secondary-neutral-hover: rgba(62, 59, 7, 0.12);
|
|
312
|
+
--color-sentiment-interactive-secondary-neutral-active: rgba(62, 59, 7, 0.17);
|
|
313
313
|
--color-sentiment-interactive-control: #F1F1ED;
|
|
314
314
|
--color-sentiment-interactive-control-hover: #E7E7E1;
|
|
315
315
|
--color-sentiment-interactive-control-active: #DFDED5;
|
|
316
|
-
--color-sentiment-background-surface:
|
|
317
|
-
--color-sentiment-background-surface-hover:
|
|
318
|
-
--color-sentiment-background-surface-active:
|
|
316
|
+
--color-sentiment-background-surface: rgba(62, 59, 7, 0.07);
|
|
317
|
+
--color-sentiment-background-surface-hover: rgba(62, 59, 7, 0.12);
|
|
318
|
+
--color-sentiment-background-surface-active: rgba(62, 59, 7, 0.17);
|
|
319
319
|
}
|
|
320
320
|
.np-theme-personal .wds-sentiment-surface-neutral-elevated,
|
|
321
321
|
.np-theme-business .wds-sentiment-surface-neutral-elevated,
|
|
@@ -331,9 +331,9 @@
|
|
|
331
331
|
--color-sentiment-interactive-secondary: #454745;
|
|
332
332
|
--color-sentiment-interactive-secondary-hover: #353635;
|
|
333
333
|
--color-sentiment-interactive-secondary-active: #232423;
|
|
334
|
-
--color-sentiment-interactive-secondary-neutral: #
|
|
335
|
-
--color-sentiment-interactive-secondary-neutral-hover: #
|
|
336
|
-
--color-sentiment-interactive-secondary-neutral-active: #
|
|
334
|
+
--color-sentiment-interactive-secondary-neutral: #585958;
|
|
335
|
+
--color-sentiment-interactive-secondary-neutral-hover: #6A6C6A;
|
|
336
|
+
--color-sentiment-interactive-secondary-neutral-active: #7D7E7D;
|
|
337
337
|
--color-sentiment-interactive-control: #454745;
|
|
338
338
|
--color-sentiment-interactive-control-hover: #353635;
|
|
339
339
|
--color-sentiment-interactive-control-active: #232423;
|
|
@@ -352,18 +352,18 @@
|
|
|
352
352
|
--color-sentiment-interactive-primary: #F1F1ED;
|
|
353
353
|
--color-sentiment-interactive-primary-hover: #E7E7E1;
|
|
354
354
|
--color-sentiment-interactive-primary-active: #DFDED5;
|
|
355
|
-
--color-sentiment-interactive-secondary:
|
|
356
|
-
--color-sentiment-interactive-secondary-hover:
|
|
357
|
-
--color-sentiment-interactive-secondary-active:
|
|
358
|
-
--color-sentiment-interactive-secondary-neutral:
|
|
359
|
-
--color-sentiment-interactive-secondary-neutral-hover:
|
|
360
|
-
--color-sentiment-interactive-secondary-neutral-active:
|
|
355
|
+
--color-sentiment-interactive-secondary: rgba(255, 255, 255, 0.1);
|
|
356
|
+
--color-sentiment-interactive-secondary-hover: rgba(255, 255, 255, 0.2);
|
|
357
|
+
--color-sentiment-interactive-secondary-active: rgba(255, 255, 255, 0.3);
|
|
358
|
+
--color-sentiment-interactive-secondary-neutral: rgba(255, 255, 255, 0.1);
|
|
359
|
+
--color-sentiment-interactive-secondary-neutral-hover: rgba(255, 255, 255, 0.2);
|
|
360
|
+
--color-sentiment-interactive-secondary-neutral-active: rgba(255, 255, 255, 0.3);
|
|
361
361
|
--color-sentiment-interactive-control: #2A2C29;
|
|
362
362
|
--color-sentiment-interactive-control-hover: #414441;
|
|
363
363
|
--color-sentiment-interactive-control-active: #595B58;
|
|
364
|
-
--color-sentiment-background-surface:
|
|
365
|
-
--color-sentiment-background-surface-hover:
|
|
366
|
-
--color-sentiment-background-surface-active:
|
|
364
|
+
--color-sentiment-background-surface: rgba(255, 255, 255, 0.1);
|
|
365
|
+
--color-sentiment-background-surface-hover: rgba(255, 255, 255, 0.2);
|
|
366
|
+
--color-sentiment-background-surface-active: rgba(255, 255, 255, 0.3);
|
|
367
367
|
}
|
|
368
368
|
.np-theme-personal--dark .wds-sentiment-surface-neutral-elevated,
|
|
369
369
|
.np-theme-business--dark .wds-sentiment-surface-neutral-elevated,
|
|
@@ -178,12 +178,12 @@
|
|
|
178
178
|
.np-theme-business--bright-green & {
|
|
179
179
|
&-base {
|
|
180
180
|
.sentiment-surface-tokens(
|
|
181
|
-
#454745, #353635, #232423,
|
|
182
|
-
#454745, #353635, #232423,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
#F1F1ED, #E7E7E1, #DFDED5,
|
|
186
|
-
|
|
181
|
+
#454745, #353635, #232423, // content-primary (default, hover, active)
|
|
182
|
+
#454745, #353635, #232423, // interactive-primary
|
|
183
|
+
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17), // interactive-secondary
|
|
184
|
+
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17), // interactive-secondary-neutral
|
|
185
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
186
|
+
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17) // background-surface
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
&-elevated {
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
192
192
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
193
193
|
#454745, #353635, #232423, // interactive-secondary
|
|
194
|
-
#
|
|
194
|
+
#585958, #6A6C6A, #7D7E7D, // interactive-secondary-neutral
|
|
195
195
|
#454745, #353635, #232423, // interactive-control
|
|
196
196
|
#454745, #353635, #232423 // background-surface
|
|
197
197
|
);
|
|
@@ -205,12 +205,12 @@
|
|
|
205
205
|
.np-theme-platform--forest-green & {
|
|
206
206
|
&-base {
|
|
207
207
|
.sentiment-surface-tokens(
|
|
208
|
-
#F1F1ED, #E7E7E1, #DFDED5,
|
|
209
|
-
#F1F1ED, #E7E7E1, #DFDED5,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
#2A2C29, #414441, #595B58,
|
|
213
|
-
|
|
208
|
+
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
209
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
210
|
+
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30), // interactive-secondary
|
|
211
|
+
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30), // interactive-secondary-neutral
|
|
212
|
+
#2A2C29, #414441, #595B58, // interactive-control
|
|
213
|
+
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30) // background-surface
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
216
|
&-elevated {
|
|
@@ -31,7 +31,7 @@ const withComponentGrid = (Story: () => JSX.Element) => (
|
|
|
31
31
|
*/
|
|
32
32
|
const meta: Meta<typeof SentimentSurface> = {
|
|
33
33
|
component: SentimentSurface,
|
|
34
|
-
title: '
|
|
34
|
+
title: 'Content/SentimentSurface',
|
|
35
35
|
argTypes: {
|
|
36
36
|
sentiment: {
|
|
37
37
|
control: 'select',
|