@transferwise/components 46.126.0 → 46.128.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/alert/Alert.js +3 -0
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +3 -0
- package/build/alert/Alert.mjs.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/inputs/SelectInput.js +81 -12
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +81 -13
- package/build/inputs/SelectInput.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 +36 -28
- package/build/prompt/ActionPrompt/ActionPrompt.js +6 -4
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +6 -4
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/styles/main.css +36 -28
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +4 -0
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +7 -5
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +3 -2
- package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -0
- package/build/styles/sentimentSurface/SentimentSurface.css +21 -21
- package/build/types/alert/Alert.d.ts +15 -0
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +19 -0
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- 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/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +7 -0
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +4 -2
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
- package/package.json +3 -3
- 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/alert/Alert.story.tsx +4 -0
- package/src/alert/Alert.test.story.tsx +1 -1
- package/src/alert/Alert.tsx +16 -0
- 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/iconButton/IconButton.story.tsx +173 -48
- package/src/iconButton/IconButton.test.story.tsx +194 -0
- package/src/index.ts +1 -0
- package/src/inputs/SelectInput.story.tsx +33 -20
- package/src/inputs/SelectInput.test.story.tsx +1285 -5
- package/src/inputs/SelectInput.tsx +93 -15
- 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/listItem/_stories/ListItem.story.tsx +0 -1
- package/src/logo/Logo.story.tsx +24 -5
- package/src/main.css +36 -28
- 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/ActionPrompt/ActionPrompt.accessibility.docs.mdx +2 -18
- package/src/prompt/ActionPrompt/ActionPrompt.css +4 -0
- package/src/prompt/ActionPrompt/ActionPrompt.less +5 -1
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +323 -108
- package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +86 -3
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +17 -6
- package/src/prompt/InfoPrompt/InfoPrompt.accessibility.docs.mdx +79 -0
- package/src/prompt/InfoPrompt/InfoPrompt.css +7 -5
- package/src/prompt/InfoPrompt/InfoPrompt.less +8 -8
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +112 -82
- package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +54 -1
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +4 -2
- package/src/prompt/InlinePrompt/InlinePrompt.accessibility.docs.mdx +63 -0
- package/src/prompt/InlinePrompt/InlinePrompt.css +3 -2
- package/src/prompt/InlinePrompt/InlinePrompt.less +2 -2
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +38 -40
- package/src/prompt/InlinePrompt/InlinePrompt.test.story.tsx +21 -0
- package/src/prompt/InlinePrompt/InlinePrompt.test.tsx +23 -4
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +1 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +1 -0
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +2 -1
- package/src/sentimentSurface/SentimentSurface.css +21 -21
- package/src/sentimentSurface/SentimentSurface.docs.mdx +1 -1
- package/src/sentimentSurface/SentimentSurface.less +13 -13
- package/src/sentimentSurface/SentimentSurface.test.story.tsx +47 -0
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { action } from 'storybook/actions';
|
|
4
|
-
import { Clock,
|
|
4
|
+
import { Clock, Taxi, Travel } from '@transferwise/icons';
|
|
5
5
|
import { lorem5 } from '../../test-utils';
|
|
6
6
|
import Link from '../../link';
|
|
7
7
|
import { InlinePrompt, InlinePromptProps } from './InlinePrompt';
|
|
@@ -144,7 +144,6 @@ export const Sentiments: StoryObj<PreviewStoryArgs> = {
|
|
|
144
144
|
</>
|
|
145
145
|
);
|
|
146
146
|
},
|
|
147
|
-
decorators: [withComponentGrid()],
|
|
148
147
|
};
|
|
149
148
|
|
|
150
149
|
/**
|
|
@@ -164,6 +163,30 @@ export const Loading: StoryObj<PreviewStoryArgs> = {
|
|
|
164
163
|
},
|
|
165
164
|
};
|
|
166
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Inline prompt is usually associated with a different component, such as `Input` or `ListItem`.
|
|
168
|
+
* When those components are disabled, the prompt is often used to communicate to the user why they
|
|
169
|
+
* cannot interact with them. For that reason, the prompt cannot inherit the usual disabled visual
|
|
170
|
+
* style, and it must retain its interactivity. To bring these 2 components visually closer to each
|
|
171
|
+
* other, `muted` prop introduces slightly reduced opacity and luminosity as well as a special
|
|
172
|
+
* backslash circle icon.
|
|
173
|
+
*/
|
|
174
|
+
export const Muted: StoryObj<PreviewStoryArgs> = {
|
|
175
|
+
argTypes: previewArgTypes,
|
|
176
|
+
args: {
|
|
177
|
+
muted: true,
|
|
178
|
+
previewMedia: false,
|
|
179
|
+
},
|
|
180
|
+
render: (args: PreviewStoryArgs) => {
|
|
181
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
182
|
+
return (
|
|
183
|
+
<InlinePrompt {...props} {...previewProps}>
|
|
184
|
+
Please <Link href="#">confirm your residential address</Link> to activate this feature.
|
|
185
|
+
</InlinePrompt>
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
167
190
|
/**
|
|
168
191
|
* `InlinePrompt` can include a single instance of the `Link` component, which can be rendered as
|
|
169
192
|
* either HTML anchor or button. That element will spread across the whole surface of the Prompt
|
|
@@ -194,60 +217,37 @@ export const Interactivity: StoryObj<PreviewStoryArgs> = {
|
|
|
194
217
|
</InlinePrompt>
|
|
195
218
|
</>
|
|
196
219
|
),
|
|
197
|
-
decorators: [withComponentGrid()],
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Inline prompt is usually associated with a different component, such as `Input` or `ListItem`.
|
|
202
|
-
* When those components are disabled, the prompt is often used to communicate to the user why they
|
|
203
|
-
* cannot interact with them. For that reason, the prompt cannot inherit the usual disabled visual
|
|
204
|
-
* style, and it must retain its interactivity. To bring these 2 components visually closer to each
|
|
205
|
-
* other, `muted` prop introduces slightly reduced opacity and luminosity as well as a special
|
|
206
|
-
* backslash circle icon.
|
|
207
|
-
*/
|
|
208
|
-
export const Muted: StoryObj<PreviewStoryArgs> = {
|
|
209
|
-
argTypes: previewArgTypes,
|
|
210
|
-
args: {
|
|
211
|
-
muted: true,
|
|
212
|
-
previewMedia: false,
|
|
213
|
-
},
|
|
214
|
-
render: (args: PreviewStoryArgs) => {
|
|
215
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
216
|
-
return (
|
|
217
|
-
<InlinePrompt {...props} {...previewProps}>
|
|
218
|
-
Please <Link href="#">confirm your residential address</Link> to activate this feature.
|
|
219
|
-
</InlinePrompt>
|
|
220
|
-
);
|
|
221
|
-
},
|
|
222
220
|
};
|
|
223
221
|
|
|
224
222
|
/**
|
|
225
223
|
* While all main sentiments (`warning`, `negative`, `positive` and`neutral`) are associated with a
|
|
226
224
|
* default `StatusIcon`s, we also allow for Icon overrides to bring the prompt's visual language
|
|
227
225
|
* 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.
|
|
226
|
+
* It's also possible to override the default StatusIcon's accessible name announced by screen
|
|
227
|
+
* readers via `mediaLabel` prop, which is especially useful for the `proposition` sentiment.
|
|
228
|
+
* <br /><br />
|
|
229
|
+
* **NB**: If you're setting a label on a custom Icon, the accessible name should be provided via
|
|
230
|
+
* Icon's `title` prop instead.
|
|
230
231
|
*/
|
|
231
232
|
export const IconOverrides: StoryObj<PreviewStoryArgs> = {
|
|
232
233
|
render: (args: PreviewStoryArgs) => {
|
|
233
234
|
return (
|
|
234
235
|
<>
|
|
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.
|
|
236
|
+
<InlinePrompt {...args} sentiment="negative" mediaLabel="Rejected: ">
|
|
237
|
+
This prompt uses default Icon, but with a custom label for screen readers.
|
|
240
238
|
</InlinePrompt>
|
|
241
|
-
<InlinePrompt {...args} media={<Clock />} sentiment="warning"
|
|
239
|
+
<InlinePrompt {...args} media={<Clock title="Processing: " />} sentiment="warning">
|
|
242
240
|
The account verification is taking longer than usual.
|
|
243
241
|
</InlinePrompt>
|
|
244
|
-
<InlinePrompt {...args} media={<
|
|
245
|
-
|
|
242
|
+
<InlinePrompt {...args} media={<Travel title="Activated: " />} sentiment="positive">
|
|
243
|
+
Your travel account is set up and ready to use.
|
|
244
|
+
</InlinePrompt>
|
|
245
|
+
<InlinePrompt {...args} media={<Taxi title="Taxi addon: " />} sentiment="proposition">
|
|
246
|
+
Connect Wise with your taxi app to get exclusive discounts.
|
|
246
247
|
</InlinePrompt>
|
|
247
248
|
</>
|
|
248
249
|
);
|
|
249
250
|
},
|
|
250
|
-
decorators: [withComponentGrid()],
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
/**
|
|
@@ -278,7 +278,6 @@ export const SizingStrategies: StoryObj<PreviewStoryArgs> = {
|
|
|
278
278
|
</>
|
|
279
279
|
);
|
|
280
280
|
},
|
|
281
|
-
decorators: [withComponentGrid()],
|
|
282
281
|
};
|
|
283
282
|
|
|
284
283
|
/**
|
|
@@ -306,5 +305,4 @@ export const SentimentAwareness: StoryObj<PreviewStoryArgs> = {
|
|
|
306
305
|
</>
|
|
307
306
|
);
|
|
308
307
|
},
|
|
309
|
-
decorators: [withComponentGrid()],
|
|
310
308
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { Travel } from '@transferwise/icons';
|
|
3
|
+
import { InlinePrompt } from './InlinePrompt';
|
|
4
|
+
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Prompts/InlinePrompt/Tests',
|
|
8
|
+
component: InlinePrompt,
|
|
9
|
+
tags: ['!autodocs'],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof InlinePrompt>;
|
|
13
|
+
|
|
14
|
+
export const TinyScreen: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<InlinePrompt sentiment="positive" media={<Travel />}>
|
|
17
|
+
Your travel money account is now active and ready to use for international transactions.
|
|
18
|
+
</InlinePrompt>
|
|
19
|
+
),
|
|
20
|
+
...withVariantConfig(['400%']),
|
|
21
|
+
};
|
|
@@ -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 />,
|
|
@@ -124,9 +136,16 @@ describe('InlinePrompt', () => {
|
|
|
124
136
|
expect(screen.getByTestId('prompt')).not.toHaveClass('wds-inline-prompt--full-width');
|
|
125
137
|
});
|
|
126
138
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
describe('width', () => {
|
|
140
|
+
it('applies auto width class by default', () => {
|
|
141
|
+
render(<InlinePrompt {...defaultProps} data-testid="prompt" />);
|
|
142
|
+
expect(screen.getByTestId('prompt')).toHaveClass('wds-inline-prompt--auto-width');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('strips the class if `width` is set to `full`', () => {
|
|
146
|
+
render(<InlinePrompt {...defaultProps} width="full" data-testid="prompt" />);
|
|
147
|
+
expect(screen.getByTestId('prompt')).not.toHaveClass('wds-inline-prompt--auto-width');
|
|
148
|
+
});
|
|
130
149
|
});
|
|
131
150
|
});
|
|
132
151
|
});
|
|
@@ -94,7 +94,7 @@ export const InlinePrompt = ({
|
|
|
94
94
|
className={clsx(
|
|
95
95
|
'wds-inline-prompt',
|
|
96
96
|
{
|
|
97
|
-
'wds-inline-prompt--
|
|
97
|
+
'wds-inline-prompt--auto-width': width !== 'full',
|
|
98
98
|
'wds-inline-prompt--muted': muted,
|
|
99
99
|
'wds-inline-prompt--loading': loading,
|
|
100
100
|
},
|
|
@@ -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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Source, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as stories from './SentimentSurface.story';
|
|
3
3
|
|
|
4
|
-
<Meta title="
|
|
4
|
+
<Meta title="Foundations/SentimentSurface/Developer Guide" />
|
|
5
5
|
|
|
6
6
|
# Developer Guide
|
|
7
7
|
|
|
@@ -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 {
|
|
@@ -124,3 +124,50 @@ export const ButtonsAcrossThemes: Story = {
|
|
|
124
124
|
</div>
|
|
125
125
|
),
|
|
126
126
|
};
|
|
127
|
+
|
|
128
|
+
export const NeutralSentimentOnNeutralBackground: Story = {
|
|
129
|
+
render: () => (
|
|
130
|
+
<div
|
|
131
|
+
style={{
|
|
132
|
+
display: 'flex',
|
|
133
|
+
flexDirection: 'column',
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<SentimentSurface
|
|
137
|
+
sentiment="neutral"
|
|
138
|
+
style={{
|
|
139
|
+
padding: '16px',
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<Button v2>Primary</Button>
|
|
143
|
+
<Button v2 priority="secondary" style={{ marginLeft: '8px' }}>
|
|
144
|
+
Secondary
|
|
145
|
+
</Button>
|
|
146
|
+
<Button v2 priority="secondary-neutral" style={{ marginLeft: '8px' }}>
|
|
147
|
+
Secondary Neutral
|
|
148
|
+
</Button>
|
|
149
|
+
<Button v2 priority="tertiary" style={{ marginLeft: '8px' }}>
|
|
150
|
+
Tertiary
|
|
151
|
+
</Button>
|
|
152
|
+
</SentimentSurface>
|
|
153
|
+
<SentimentSurface
|
|
154
|
+
sentiment="neutral"
|
|
155
|
+
emphasis="elevated"
|
|
156
|
+
style={{
|
|
157
|
+
padding: '16px',
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<Button v2>Primary</Button>
|
|
161
|
+
<Button v2 priority="secondary" style={{ marginLeft: '8px' }}>
|
|
162
|
+
Secondary
|
|
163
|
+
</Button>
|
|
164
|
+
<Button v2 priority="secondary-neutral" style={{ marginLeft: '8px' }}>
|
|
165
|
+
Secondary Neutral
|
|
166
|
+
</Button>
|
|
167
|
+
<Button v2 priority="tertiary" style={{ marginLeft: '8px' }}>
|
|
168
|
+
Tertiary
|
|
169
|
+
</Button>
|
|
170
|
+
</SentimentSurface>
|
|
171
|
+
</div>
|
|
172
|
+
),
|
|
173
|
+
};
|
package/src/tile/Tile.test.tsx
CHANGED
|
@@ -17,16 +17,6 @@ describe(Tile, () => {
|
|
|
17
17
|
jest.clearAllMocks();
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it('matches snapshot when regular size', () => {
|
|
21
|
-
const { asFragment } = render(<Tile {...defaultProps} />);
|
|
22
|
-
expect(asFragment()).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('matches snapshot when small size', () => {
|
|
26
|
-
const { asFragment } = render(<Tile size={Size.SMALL} {...defaultProps} />);
|
|
27
|
-
expect(asFragment()).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
20
|
it('calls onClick when anchor is clicked', () => {
|
|
31
21
|
render(<Tile {...defaultProps} />);
|
|
32
22
|
|
|
@@ -4,16 +4,6 @@ import { userEvent } from '@testing-library/user-event';
|
|
|
4
4
|
import Tooltip from '.';
|
|
5
5
|
|
|
6
6
|
describe('Tooltip Component', () => {
|
|
7
|
-
it('renders an empty list when no items are passed', () => {
|
|
8
|
-
expect(
|
|
9
|
-
render(
|
|
10
|
-
<Tooltip label="Test Tooltip">
|
|
11
|
-
<span>Hover me</span>
|
|
12
|
-
</Tooltip>,
|
|
13
|
-
).container,
|
|
14
|
-
).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
7
|
it('initially is hidden (test with toBeInTheDocument)', () => {
|
|
18
8
|
render(
|
|
19
9
|
<Tooltip label="Test Tooltip">
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`AccordionItem open / close renders an item closed 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="np-accordion-item"
|
|
7
|
-
id="test-accordion"
|
|
8
|
-
>
|
|
9
|
-
<button
|
|
10
|
-
aria-controls="test-accordion-section"
|
|
11
|
-
aria-expanded="false"
|
|
12
|
-
class="np-option decision"
|
|
13
|
-
id="test-accordion-control"
|
|
14
|
-
>
|
|
15
|
-
<div
|
|
16
|
-
class="media"
|
|
17
|
-
>
|
|
18
|
-
<div
|
|
19
|
-
class="media-body"
|
|
20
|
-
>
|
|
21
|
-
<div
|
|
22
|
-
aria-level="4"
|
|
23
|
-
class="np-text-body-large-bold text-primary np-option__title"
|
|
24
|
-
role="heading"
|
|
25
|
-
>
|
|
26
|
-
This is title number one
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
<div
|
|
30
|
-
class="media-right"
|
|
31
|
-
>
|
|
32
|
-
<span
|
|
33
|
-
class="tw-icon tw-icon-chevron-up tw-chevron chevron-color bottom"
|
|
34
|
-
data-testid="chevron-up-icon"
|
|
35
|
-
>
|
|
36
|
-
<svg
|
|
37
|
-
aria-hidden="true"
|
|
38
|
-
fill="currentColor"
|
|
39
|
-
focusable="false"
|
|
40
|
-
height="24"
|
|
41
|
-
role="none"
|
|
42
|
-
viewBox="0 0 24 24"
|
|
43
|
-
width="24"
|
|
44
|
-
>
|
|
45
|
-
<path
|
|
46
|
-
clip-rule="evenodd"
|
|
47
|
-
d="m12 9.414 7.293 7.293 1.414-1.414L12.714 7.3a1.01 1.01 0 0 0-1.428 0l-7.993 7.993 1.414 1.414z"
|
|
48
|
-
fill-rule="evenodd"
|
|
49
|
-
/>
|
|
50
|
-
</svg>
|
|
51
|
-
</span>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</button>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
exports[`AccordionItem open / close renders an item open 1`] = `
|
|
60
|
-
<div>
|
|
61
|
-
<div
|
|
62
|
-
class="np-accordion-item np-accordion-item--open"
|
|
63
|
-
id="test-accordion"
|
|
64
|
-
>
|
|
65
|
-
<button
|
|
66
|
-
aria-controls="test-accordion-section"
|
|
67
|
-
aria-expanded="true"
|
|
68
|
-
class="np-option decision"
|
|
69
|
-
id="test-accordion-control"
|
|
70
|
-
>
|
|
71
|
-
<div
|
|
72
|
-
class="media"
|
|
73
|
-
>
|
|
74
|
-
<div
|
|
75
|
-
class="media-body"
|
|
76
|
-
>
|
|
77
|
-
<div
|
|
78
|
-
aria-level="4"
|
|
79
|
-
class="np-text-body-large-bold text-primary np-option__title"
|
|
80
|
-
role="heading"
|
|
81
|
-
>
|
|
82
|
-
This is title number one
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
<div
|
|
86
|
-
class="media-right"
|
|
87
|
-
>
|
|
88
|
-
<span
|
|
89
|
-
class="tw-icon tw-icon-chevron-up tw-chevron chevron-color top"
|
|
90
|
-
data-testid="chevron-up-icon"
|
|
91
|
-
>
|
|
92
|
-
<svg
|
|
93
|
-
aria-hidden="true"
|
|
94
|
-
fill="currentColor"
|
|
95
|
-
focusable="false"
|
|
96
|
-
height="24"
|
|
97
|
-
role="none"
|
|
98
|
-
viewBox="0 0 24 24"
|
|
99
|
-
width="24"
|
|
100
|
-
>
|
|
101
|
-
<path
|
|
102
|
-
clip-rule="evenodd"
|
|
103
|
-
d="m12 9.414 7.293 7.293 1.414-1.414L12.714 7.3a1.01 1.01 0 0 0-1.428 0l-7.993 7.993 1.414 1.414z"
|
|
104
|
-
fill-rule="evenodd"
|
|
105
|
-
/>
|
|
106
|
-
</svg>
|
|
107
|
-
</span>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</button>
|
|
111
|
-
<div
|
|
112
|
-
aria-labelledby="test-accordion-control"
|
|
113
|
-
id="test-accordion-section"
|
|
114
|
-
role="region"
|
|
115
|
-
>
|
|
116
|
-
<span
|
|
117
|
-
class="np-text-body-large np-accordion-item__content d-block"
|
|
118
|
-
>
|
|
119
|
-
Lauri Ipsum has been the industry standard dummy text ever since the 1500s.
|
|
120
|
-
</span>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`ActionButton by default renders the button 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<button
|
|
6
|
-
class="np-action-btn np-text-body-default-bold btn-priority-1"
|
|
7
|
-
type="button"
|
|
8
|
-
>
|
|
9
|
-
Personal profile
|
|
10
|
-
</button>
|
|
11
|
-
</div>
|
|
12
|
-
`;
|