@transferwise/components 0.0.0-experimental-27bf250 → 0.0.0-experimental-bbf9517
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/ListItem.js +2 -2
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +2 -2
- package/build/listItem/ListItem.mjs.map +1 -1
- 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 +4 -2
- package/build/styles/main.css +4 -2
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +4 -2
- 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 +1 -1
- 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/ListItem.tsx +2 -2
- 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 +4 -2
- 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/InfoPrompt/InfoPrompt.css +4 -2
- package/src/prompt/InfoPrompt/InfoPrompt.less +5 -4
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +13 -10
- package/src/prompt/InlinePrompt/InlinePrompt.test.tsx +13 -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
|
@@ -36,49 +36,10 @@ describe('FlowNavigationAvatar', () => {
|
|
|
36
36
|
|
|
37
37
|
expect(screen.getByText('M')).toBeInTheDocument();
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
describe('AND profileType', () => {
|
|
41
|
-
it('renders as BUSINESS profile type with an icon', () => {
|
|
42
|
-
const { container } = render(
|
|
43
|
-
<AvatarWrapper name={name} profileType={ProfileType.BUSINESS} />,
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('renders as PERSONAL profile type with an icon', () => {
|
|
50
|
-
const { container } = render(
|
|
51
|
-
<AvatarWrapper name={name} profileType={ProfileType.PERSONAL} />,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('AND avatar url', () => {
|
|
58
|
-
it('renders the image', () => {
|
|
59
|
-
const { container } = render(
|
|
60
|
-
<AvatarWrapper
|
|
61
|
-
url="https://wise.com"
|
|
62
|
-
name={name}
|
|
63
|
-
profileType={ProfileType.BUSINESS}
|
|
64
|
-
avatarProps={{ theme: 'dark' }}
|
|
65
|
-
/>,
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
39
|
});
|
|
73
40
|
});
|
|
74
41
|
|
|
75
42
|
describe('with nothing passed', () => {
|
|
76
|
-
it('renders a personal icon', () => {
|
|
77
|
-
const { container } = render(<AvatarWrapper />);
|
|
78
|
-
|
|
79
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
43
|
it('renders aria-label', () => {
|
|
83
44
|
render(<AvatarWrapper aria-label="test" />);
|
|
84
45
|
|
|
@@ -86,20 +47,6 @@ describe('FlowNavigationAvatar', () => {
|
|
|
86
47
|
});
|
|
87
48
|
});
|
|
88
49
|
|
|
89
|
-
describe('with a badge url passed', () => {
|
|
90
|
-
it('renders the badge', () => {
|
|
91
|
-
const { container } = render(
|
|
92
|
-
<AvatarWrapper
|
|
93
|
-
badgeUrl="https://badge.com"
|
|
94
|
-
badgeAltText="badge alt text"
|
|
95
|
-
badgeProps={{ size: Size.LARGE } as BadgeProps}
|
|
96
|
-
/>,
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
50
|
describe('with a badge status icon passed', () => {
|
|
104
51
|
it('renders the badge', () => {
|
|
105
52
|
render(<AvatarWrapper badgeStatusIcon={Sentiment.POSITIVE} />);
|
|
@@ -19,11 +19,6 @@ describe('Checkbox', () => {
|
|
|
19
19
|
jest.clearAllMocks();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it('renders the given label', () => {
|
|
23
|
-
const { container } = render(<Checkbox {...props} />);
|
|
24
|
-
expect(container).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
22
|
it('is enabled by default', () => {
|
|
28
23
|
const { container } = render(<Checkbox {...props} />);
|
|
29
24
|
expect(getCheckboxContainer(container)).not.toHaveClass('disabled');
|
|
@@ -43,11 +43,4 @@ describe('Chevron', () => {
|
|
|
43
43
|
expect(container.querySelector('.tw-icon-chevron-up')).not.toHaveClass('chevron-color');
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
describe('custom xs icon', () => {
|
|
48
|
-
it('renders', () => {
|
|
49
|
-
const { container } = render(<Chevron size={Size.EXTRA_SMALL} />);
|
|
50
|
-
expect(container).toMatchSnapshot();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
46
|
});
|
package/src/chips/Chips.test.tsx
CHANGED
|
@@ -53,10 +53,6 @@ const filterProps = {
|
|
|
53
53
|
|
|
54
54
|
describe('Chips', () => {
|
|
55
55
|
describe('Choice Chips', () => {
|
|
56
|
-
it(`renders as expected`, () => {
|
|
57
|
-
expect(render(<Chips {...choiceProps} />).container).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
56
|
it(`will pass previous state, updated state, and selected value on select`, () => {
|
|
61
57
|
render(<Chips {...choiceProps} />);
|
|
62
58
|
const accounting = screen.getByText('Accounting');
|
|
@@ -69,10 +65,6 @@ describe('Chips', () => {
|
|
|
69
65
|
});
|
|
70
66
|
|
|
71
67
|
describe('Filter Chips', () => {
|
|
72
|
-
it(`renders as expected`, () => {
|
|
73
|
-
expect(render(<Chips {...filterProps} />).container).toMatchSnapshot();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
68
|
it(`will pass previous state, updated state, and selected value on select`, () => {
|
|
77
69
|
render(<Chips {...filterProps} />);
|
|
78
70
|
const accounting = screen.getByText('Accounting');
|
|
@@ -3,24 +3,6 @@ import { screen, render, userEvent } from '../../test-utils';
|
|
|
3
3
|
import RadioButton from '.';
|
|
4
4
|
|
|
5
5
|
describe('Radio button', () => {
|
|
6
|
-
it('renders correctly', () => {
|
|
7
|
-
const { container } = render(<RadioButton id="an-id" name="a-name" value="a-value" />);
|
|
8
|
-
|
|
9
|
-
expect(container).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('renders checked state correctly', () => {
|
|
13
|
-
const { container } = render(<RadioButton name="radio-name" checked />);
|
|
14
|
-
|
|
15
|
-
expect(container).toMatchSnapshot();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders disabled state correctly', () => {
|
|
19
|
-
const { container } = render(<RadioButton name="radio-name" disabled />);
|
|
20
|
-
|
|
21
|
-
expect(container).toMatchSnapshot();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
6
|
it('responds to user input', async () => {
|
|
25
7
|
const onChange = jest.fn();
|
|
26
8
|
render(
|
|
@@ -5,15 +5,6 @@ import BottomSheet from './BottomSheet';
|
|
|
5
5
|
mockMatchMedia();
|
|
6
6
|
|
|
7
7
|
describe('BottomSheet', () => {
|
|
8
|
-
it('renders content when open', () => {
|
|
9
|
-
const { baseElement } = render(
|
|
10
|
-
<BottomSheet open onClose={jest.fn()}>
|
|
11
|
-
<b>Test Content</b>
|
|
12
|
-
</BottomSheet>,
|
|
13
|
-
);
|
|
14
|
-
expect(baseElement).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
8
|
it('does not renders when closed', () => {
|
|
18
9
|
const { container } = render(
|
|
19
10
|
<BottomSheet open={false} onClose={jest.fn()}>
|
|
@@ -10,12 +10,6 @@ describe('Card', () => {
|
|
|
10
10
|
testId: 'test-card',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
it('matches snapshot', () => {
|
|
14
|
-
const { container } = render(<Card {...defaultProps} />);
|
|
15
|
-
|
|
16
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
13
|
it('renders', () => {
|
|
20
14
|
const props = {
|
|
21
15
|
...defaultProps,
|
|
@@ -8,10 +8,6 @@ const props = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
describe('CloseButton', () => {
|
|
11
|
-
it(`renders as expected`, () => {
|
|
12
|
-
expect(render(<CloseButton {...props} />).container).toMatchSnapshot();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
11
|
describe('tabIndex', () => {
|
|
16
12
|
it('should not have tabIndex by default', () => {
|
|
17
13
|
render(<CloseButton {...props} />);
|
|
@@ -20,12 +20,6 @@ describe('Panel', () => {
|
|
|
20
20
|
onClose: jest.fn(),
|
|
21
21
|
} satisfies PanelProps;
|
|
22
22
|
|
|
23
|
-
it('renders', () => {
|
|
24
|
-
const { container } = render(<Panel {...props} />);
|
|
25
|
-
|
|
26
|
-
expect(container).toMatchSnapshot();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
23
|
it('renders arrow', () => {
|
|
30
24
|
const { rerender } = render(<Panel {...props} arrow={false} />);
|
|
31
25
|
|
|
@@ -35,10 +35,6 @@ describe('FlowNavigation', () => {
|
|
|
35
35
|
activeStep: 0,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
it(`renders as expected`, () => {
|
|
39
|
-
expect(render(<FlowNavigation {...props} />).container).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
38
|
it(`renders full Logo`, () => {
|
|
43
39
|
render(<FlowNavigation {...props} />);
|
|
44
40
|
expect(logoFull()).toBeInTheDocument();
|
|
@@ -126,12 +122,6 @@ describe('FlowNavigation', () => {
|
|
|
126
122
|
window.innerWidth = Breakpoint.SMALL - 1;
|
|
127
123
|
});
|
|
128
124
|
|
|
129
|
-
it('renders as expected', () => {
|
|
130
|
-
expect(
|
|
131
|
-
render(<FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />).container,
|
|
132
|
-
).toMatchSnapshot();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
125
|
it('renders Logo', () => {
|
|
136
126
|
render(<FlowNavigation {...props} />);
|
|
137
127
|
expect(screen.getByAltText('logo')).toBeInTheDocument();
|
|
@@ -406,7 +406,7 @@ function View({
|
|
|
406
406
|
aria-describedby={describedByIds}
|
|
407
407
|
href={(controlProps as ListItemNavigationProps)?.href}
|
|
408
408
|
target={(controlProps as ListItemNavigationProps)?.target}
|
|
409
|
-
className={clsx('wds-list-item-view
|
|
409
|
+
className={clsx('wds-list-item-view', {
|
|
410
410
|
'wds-list-item-control': controlType === 'navigation',
|
|
411
411
|
fullyInteractive: !isPartiallyInteractive,
|
|
412
412
|
})}
|
|
@@ -424,7 +424,7 @@ function View({
|
|
|
424
424
|
if (isPartiallyInteractive || controlType === 'non-interactive') {
|
|
425
425
|
return (
|
|
426
426
|
<div className={clsx('wds-list-item-gridWrapper', className)}>
|
|
427
|
-
<div className=
|
|
427
|
+
<div className="wds-list-item-view">{children}</div>
|
|
428
428
|
|
|
429
429
|
{renderExtras()}
|
|
430
430
|
</div>
|
|
@@ -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
|
@@ -5442,7 +5442,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5442
5442
|
stroke: currentColor;
|
|
5443
5443
|
}
|
|
5444
5444
|
.wds-info-prompt {
|
|
5445
|
-
--Prompt-border-radius: var(--radius-medium);
|
|
5446
5445
|
--Prompt-gap: var(--size-8);
|
|
5447
5446
|
--Prompt-padding: 12px;
|
|
5448
5447
|
}
|
|
@@ -5458,11 +5457,14 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5458
5457
|
.wds-info-prompt__title,
|
|
5459
5458
|
.wds-info-prompt__description {
|
|
5460
5459
|
display: block;
|
|
5460
|
+
color: var(--color-sentiment-primary);
|
|
5461
5461
|
}
|
|
5462
5462
|
.wds-info-prompt__action {
|
|
5463
|
-
align-self: flex-start;
|
|
5464
5463
|
margin-top: var(--Prompt-gap);
|
|
5465
5464
|
}
|
|
5465
|
+
.wds-info-prompt__media {
|
|
5466
|
+
display: flex;
|
|
5467
|
+
}
|
|
5466
5468
|
.wds-info-prompt__media svg {
|
|
5467
5469
|
width: 24px;
|
|
5468
5470
|
height: 24px;
|
|
@@ -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,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.wds-info-prompt {
|
|
2
|
-
--Prompt-border-radius: var(--radius-medium);
|
|
3
2
|
--Prompt-gap: var(--size-8);
|
|
4
3
|
--Prompt-padding: 12px;
|
|
5
4
|
}
|
|
@@ -15,11 +14,14 @@
|
|
|
15
14
|
.wds-info-prompt__title,
|
|
16
15
|
.wds-info-prompt__description {
|
|
17
16
|
display: block;
|
|
17
|
+
color: var(--color-sentiment-primary);
|
|
18
18
|
}
|
|
19
19
|
.wds-info-prompt__action {
|
|
20
|
-
align-self: flex-start;
|
|
21
20
|
margin-top: var(--Prompt-gap);
|
|
22
21
|
}
|
|
22
|
+
.wds-info-prompt__media {
|
|
23
|
+
display: flex;
|
|
24
|
+
}
|
|
23
25
|
.wds-info-prompt__media svg {
|
|
24
26
|
width: 24px;
|
|
25
27
|
height: 24px;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.wds-info-prompt {
|
|
2
|
-
--Prompt-border-radius: var(--radius-medium);
|
|
3
2
|
--Prompt-gap: var(--size-8);
|
|
4
3
|
--Prompt-padding: 12px;
|
|
5
4
|
|
|
@@ -12,18 +11,20 @@
|
|
|
12
11
|
justify-content: flex-start; /* Top align when title exists */
|
|
13
12
|
}
|
|
14
13
|
}
|
|
14
|
+
|
|
15
15
|
&__title,
|
|
16
16
|
&__description {
|
|
17
17
|
display: block;
|
|
18
|
+
color: var(--color-sentiment-primary);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
&__action {
|
|
21
|
-
align-self: flex-start;
|
|
22
22
|
margin-top: var(--Prompt-gap);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&__media {
|
|
26
|
-
|
|
26
|
+
display: flex;
|
|
27
|
+
|
|
27
28
|
svg {
|
|
28
29
|
width: 24px;
|
|
29
30
|
height: 24px;
|
|
@@ -33,4 +34,4 @@
|
|
|
33
34
|
.wds-prompt__media-wrapper {
|
|
34
35
|
padding: 0;
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
}
|