@transferwise/components 46.136.1 → 46.137.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/common/hooks/useContainerSize.js +30 -0
- package/build/common/hooks/useContainerSize.js.map +1 -0
- package/build/common/hooks/useContainerSize.mjs +28 -0
- package/build/common/hooks/useContainerSize.mjs.map +1 -0
- package/build/common/hooks/useResizeObserver.js +3 -3
- package/build/common/hooks/useResizeObserver.js.map +1 -1
- package/build/common/hooks/useResizeObserver.mjs +3 -3
- package/build/common/hooks/useResizeObserver.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +3 -0
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +3 -0
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/field/Field.js +3 -2
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +3 -2
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/cs.json +2 -0
- package/build/i18n/cs.json.js +2 -0
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +2 -0
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/de.json +2 -0
- package/build/i18n/de.json.js +2 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +2 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/i18n/es.json +2 -0
- package/build/i18n/es.json.js +2 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +2 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +2 -0
- package/build/i18n/fr.json.js +2 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +2 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +2 -0
- package/build/i18n/hu.json.js +2 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +2 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +2 -0
- package/build/i18n/id.json.js +2 -0
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +2 -0
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +2 -0
- package/build/i18n/it.json.js +2 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +2 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +2 -0
- package/build/i18n/ja.json.js +2 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +2 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/nl.json +2 -0
- package/build/i18n/nl.json.js +2 -0
- package/build/i18n/nl.json.js.map +1 -1
- package/build/i18n/nl.json.mjs +2 -0
- package/build/i18n/nl.json.mjs.map +1 -1
- package/build/i18n/pl.json +2 -0
- package/build/i18n/pl.json.js +2 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +2 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +2 -0
- package/build/i18n/pt.json.js +2 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +2 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +2 -0
- package/build/i18n/ro.json.js +2 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +2 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +2 -0
- package/build/i18n/ru.json.js +2 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +2 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/th.json +2 -0
- package/build/i18n/th.json.js +2 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +2 -0
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/tr.json +2 -0
- package/build/i18n/tr.json.js +2 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +2 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +2 -0
- package/build/i18n/zh-CN.json.js +2 -0
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +2 -0
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +2 -0
- package/build/i18n/zh-HK.json.js +2 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +2 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +3 -2
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +3 -2
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/logo/Logo.js +77 -25
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs +79 -27
- package/build/logo/Logo.mjs.map +1 -1
- package/build/logo/logo-assets.js +68 -97
- package/build/logo/logo-assets.js.map +1 -1
- package/build/logo/logo-assets.mjs +62 -90
- package/build/logo/logo-assets.mjs.map +1 -1
- package/build/main.css +225 -59
- package/build/prompt/ActionPrompt/ActionPrompt.js +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +143 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +141 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -0
- package/build/prompt/CriticalBanner/helpers.js +29 -0
- package/build/prompt/CriticalBanner/helpers.js.map +1 -0
- package/build/prompt/CriticalBanner/helpers.mjs +26 -0
- package/build/prompt/CriticalBanner/helpers.mjs.map +1 -0
- package/build/prompt/InfoPrompt/InfoPrompt.js +3 -2
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +3 -2
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +11 -4
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +11 -4
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/prompt/common/Expander/Expander.js +35 -0
- package/build/prompt/common/Expander/Expander.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.js +17 -0
- package/build/prompt/common/Expander/Expander.messages.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.mjs +13 -0
- package/build/prompt/common/Expander/Expander.messages.mjs.map +1 -0
- package/build/prompt/common/Expander/Expander.mjs +33 -0
- package/build/prompt/common/Expander/Expander.mjs.map +1 -0
- package/build/prompt/helpers/promptMedia.js +52 -0
- package/build/prompt/helpers/promptMedia.js.map +1 -0
- package/build/prompt/helpers/promptMedia.mjs +50 -0
- package/build/prompt/helpers/promptMedia.mjs.map +1 -0
- package/build/styles/css/neptune.css +0 -1
- package/build/styles/logo/Logo.css +3 -23
- package/build/styles/main.css +225 -59
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +134 -0
- package/build/styles/prompt/CriticalBanner/CriticalBanner.vars.css +0 -0
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +24 -0
- package/build/styles/prompt/common/Expander/Expander.css +8 -0
- package/build/styles/styles/less/neptune.css +0 -1
- package/build/typeahead/Typeahead.js +3 -2
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +3 -2
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/common/hooks/useContainerSize.d.ts +14 -0
- package/build/types/common/hooks/useContainerSize.d.ts.map +1 -0
- package/build/types/common/hooks/useResizeObserver.d.ts +1 -1
- package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +3 -0
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +33 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/logo/logo-assets.d.ts +33 -9
- package/build/types/logo/logo-assets.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +2 -11
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +39 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts +18 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/index.d.ts +3 -0
- package/build/types/prompt/CriticalBanner/index.d.ts.map +1 -0
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +35 -3
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/build/types/prompt/common/Expander/Expander.d.ts +20 -0
- package/build/types/prompt/common/Expander/Expander.d.ts.map +1 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts +14 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +1 -0
- package/build/types/prompt/helpers/promptMedia.d.ts +22 -0
- package/build/types/prompt/helpers/promptMedia.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +2 -0
- package/build/types/prompt/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +4 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +22 -18
- package/src/alert/Alert.story.tsx +30 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
- package/src/button/_stories/Button.story.tsx +11 -0
- package/src/common/hooks/useContainerSize.test.tsx +125 -0
- package/src/common/hooks/useContainerSize.ts +32 -0
- package/src/common/hooks/useResizeObserver.ts +3 -2
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +4 -0
- package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +1 -1
- package/src/criticalBanner/CriticalCommsBanner.tsx +3 -0
- package/src/i18n/cs.json +2 -0
- package/src/i18n/de.json +2 -0
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/hu.json +2 -0
- package/src/i18n/id.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pl.json +2 -0
- package/src/i18n/pt.json +2 -0
- package/src/i18n/ro.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/th.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/i18n/zh-CN.json +2 -0
- package/src/i18n/zh-HK.json +2 -0
- package/src/index.ts +2 -2
- package/src/logo/Logo.css +3 -23
- package/src/logo/Logo.less +3 -29
- package/src/logo/Logo.story.tsx +117 -89
- package/src/logo/Logo.test.story.tsx +15 -24
- package/src/logo/Logo.tsx +90 -28
- package/src/logo/logo-assets.tsx +36 -92
- package/src/main.css +225 -59
- package/src/main.less +3 -1
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -62
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +113 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +134 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +155 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +635 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +422 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +179 -0
- package/src/prompt/CriticalBanner/CriticalBanner.vars.css +0 -0
- package/src/prompt/CriticalBanner/CriticalBanner.vars.less +6 -0
- package/src/prompt/CriticalBanner/helpers.ts +39 -0
- package/src/prompt/CriticalBanner/index.ts +2 -0
- package/src/prompt/InfoPrompt/InfoPrompt.css +24 -0
- package/src/prompt/InfoPrompt/InfoPrompt.less +23 -0
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +5 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +56 -40
- package/src/prompt/common/Expander/Expander.css +8 -0
- package/src/prompt/common/Expander/Expander.less +9 -0
- package/src/prompt/common/Expander/Expander.messages.ts +14 -0
- package/src/prompt/common/Expander/Expander.test.tsx +167 -0
- package/src/prompt/common/Expander/Expander.tsx +83 -0
- package/src/prompt/helpers/promptMedia.tsx +79 -0
- package/src/prompt/index.ts +4 -0
- package/src/radio/Radio.story.tsx +1 -1
- package/src/section/Section.story.tsx +2 -8
- package/src/sentimentSurface/SentimentSurface.story.tsx +43 -17
- package/src/statusIcon/StatusIcon.test.tsx +0 -2
- package/src/styles/less/neptune.css +0 -1
package/src/main.less
CHANGED
|
@@ -67,6 +67,9 @@
|
|
|
67
67
|
@import "./prompt/PrimitivePrompt/PrimitivePrompt.less";
|
|
68
68
|
@import "./prompt/InlinePrompt/InlinePrompt.less";
|
|
69
69
|
@import "./prompt/InfoPrompt/InfoPrompt.less";
|
|
70
|
+
@import "./prompt/ActionPrompt/ActionPrompt.less";
|
|
71
|
+
@import "./prompt/CriticalBanner/CriticalBanner.less";
|
|
72
|
+
@import "./prompt/common/Expander/Expander.less";
|
|
70
73
|
@import "./radioGroup/RadioGroup.less";
|
|
71
74
|
@import "./section/Section.less";
|
|
72
75
|
@import "./slidingPanel/SlidingPanel.less";
|
|
@@ -91,7 +94,6 @@
|
|
|
91
94
|
@import "./progress/Progress.less";
|
|
92
95
|
@import "./progressBar/ProgressBar.less";
|
|
93
96
|
@import "./legacylistItem/LegacyListItem.less";
|
|
94
|
-
@import "./prompt/ActionPrompt/ActionPrompt.less";
|
|
95
97
|
|
|
96
98
|
// List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
|
|
97
99
|
// Make sure you are not referencing main.less itself in this file!
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import { AriaAttributes, ReactNode, useId } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
|
|
4
|
-
import StatusIcon from '../../statusIcon';
|
|
5
4
|
import Body from '../../body';
|
|
6
5
|
import Button from '../../button';
|
|
7
6
|
import { Breakpoint, Typography } from '../../common';
|
|
8
|
-
import AvatarView, { AvatarViewProps } from '../../avatarView';
|
|
9
|
-
import Image from '../../image';
|
|
10
7
|
import { ButtonProps } from '../../button/Button.types';
|
|
11
8
|
import { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';
|
|
12
|
-
import { BadgeAssetsProps } from '../../badge';
|
|
13
|
-
import { GiftBox } from '@transferwise/icons';
|
|
14
9
|
import { useScreenSize } from '../../common/hooks/useScreenSize';
|
|
10
|
+
import { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';
|
|
15
11
|
|
|
16
12
|
export type ActionPromptProps = {
|
|
17
13
|
title: ReactNode;
|
|
18
14
|
description?: ReactNode;
|
|
19
15
|
/** @default {} */
|
|
20
|
-
media?:
|
|
21
|
-
imgSrc?: string;
|
|
22
|
-
avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
|
|
23
|
-
asset?: AvatarViewProps['children'];
|
|
24
|
-
badge?: Pick<BadgeAssetsProps, 'flagCode'>;
|
|
25
|
-
};
|
|
26
|
-
'aria-label'?: string;
|
|
27
|
-
'aria-hidden'?: boolean;
|
|
28
|
-
};
|
|
16
|
+
media?: PromptMedia;
|
|
29
17
|
action: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {
|
|
30
18
|
label: ButtonProps['children'];
|
|
31
19
|
};
|
|
@@ -74,54 +62,13 @@ export const ActionPrompt = ({
|
|
|
74
62
|
.filter(Boolean)
|
|
75
63
|
.join(' ');
|
|
76
64
|
|
|
77
|
-
const renderMedia = () =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
alt={media['aria-label'] ?? ''}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
if (media?.avatar) {
|
|
89
|
-
const badge = media.avatar.badge
|
|
90
|
-
? media.avatar.badge
|
|
91
|
-
: sentiment === 'proposition'
|
|
92
|
-
? {}
|
|
93
|
-
: { status: sentiment };
|
|
94
|
-
return (
|
|
95
|
-
<AvatarView
|
|
96
|
-
{...media.avatar}
|
|
97
|
-
badge={badge}
|
|
98
|
-
aria-label={media['aria-label']}
|
|
99
|
-
aria-hidden={media['aria-hidden']}
|
|
100
|
-
id={mediaId}
|
|
101
|
-
size={48}
|
|
102
|
-
>
|
|
103
|
-
{media.avatar.asset}
|
|
104
|
-
</AvatarView>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return sentiment === 'proposition' ? (
|
|
108
|
-
<AvatarView
|
|
109
|
-
id={mediaId}
|
|
110
|
-
size={48}
|
|
111
|
-
aria-label={media['aria-label']}
|
|
112
|
-
aria-hidden={media['aria-hidden']}
|
|
113
|
-
>
|
|
114
|
-
<GiftBox />
|
|
115
|
-
</AvatarView>
|
|
116
|
-
) : (
|
|
117
|
-
<StatusIcon
|
|
118
|
-
id={mediaId}
|
|
119
|
-
size={48}
|
|
120
|
-
sentiment={sentiment}
|
|
121
|
-
iconLabel={media['aria-hidden'] ? null : media['aria-label']}
|
|
122
|
-
/>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
65
|
+
const renderMedia = () =>
|
|
66
|
+
renderPromptMedia({
|
|
67
|
+
media,
|
|
68
|
+
sentiment,
|
|
69
|
+
mediaId,
|
|
70
|
+
imgClassName: 'wds-action-prompt--media-image',
|
|
71
|
+
});
|
|
125
72
|
|
|
126
73
|
return (
|
|
127
74
|
<PrimitivePrompt
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Meta, Source, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as CriticalBannerStories from './CriticalBanner.story';
|
|
3
|
+
|
|
4
|
+
<Meta title="Prompts/CriticalBanner/Accessibility" tags={['new']} />
|
|
5
|
+
|
|
6
|
+
# Accessibility
|
|
7
|
+
|
|
8
|
+
Under the hood, `CriticalBanner` is marked as `role="region"` for a section of content that users might want to navigate to directly.
|
|
9
|
+
|
|
10
|
+
By default, it's labelled by the `title` and described by the `description`.
|
|
11
|
+
|
|
12
|
+
## Announcement Behavior
|
|
13
|
+
|
|
14
|
+
`CriticalBanner` is designed for critical messages that require immediate attention. It always uses **`aria-live="assertive"`** to immediately interrupt and announce changes to screen readers.
|
|
15
|
+
|
|
16
|
+
Unlike `InfoPrompt` which offers configurable politeness levels, `CriticalBanner` is always assertive because it communicates critical, time-sensitive information that users must be aware of immediately.
|
|
17
|
+
|
|
18
|
+
### What Gets Announced
|
|
19
|
+
|
|
20
|
+
The component intelligently announces only **visible content**, respecting the collapsed/expanded state:
|
|
21
|
+
|
|
22
|
+
- **Collapsed with title**: Announces title only (description is hidden)
|
|
23
|
+
- **Collapsed without title**: Announces description only (visible up to 2 lines)
|
|
24
|
+
- **Expanded**: Announces title, description, and action button labels (all visible)
|
|
25
|
+
|
|
26
|
+
<Source
|
|
27
|
+
dark
|
|
28
|
+
code={`
|
|
29
|
+
// Collapsed with title - announces: "Your account requires verification"
|
|
30
|
+
<CriticalBanner
|
|
31
|
+
title="Your account requires verification"
|
|
32
|
+
description="Please verify your identity to continue"
|
|
33
|
+
action={{ label: "Verify now", onClick: handleVerify }}
|
|
34
|
+
expanded={false}
|
|
35
|
+
onToggle={handleToggle}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
// Expanded - announces: "Your account requires verification | Please verify your identity to continue | Verify now | Learn more"
|
|
39
|
+
|
|
40
|
+
<CriticalBanner
|
|
41
|
+
title="Your account requires verification"
|
|
42
|
+
description="Please verify your identity to continue"
|
|
43
|
+
action={{ label: 'Verify now', onClick: handleVerify }}
|
|
44
|
+
actionSecondary={{ label: 'Learn more', onClick: handleLearnMore }}
|
|
45
|
+
expanded={true}
|
|
46
|
+
onToggle={handleToggle}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
// Collapsed without title - announces: "Your verification is pending..."
|
|
50
|
+
|
|
51
|
+
<CriticalBanner
|
|
52
|
+
description="Your verification is pending. We'll notify you once complete."
|
|
53
|
+
expanded={false}
|
|
54
|
+
onToggle={handleToggle}
|
|
55
|
+
/>
|
|
56
|
+
`}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
### When Announcements Trigger
|
|
60
|
+
|
|
61
|
+
Screen readers announce the banner content whenever:
|
|
62
|
+
|
|
63
|
+
- The banner first appears in the DOM
|
|
64
|
+
- The user toggles between collapsed and expanded states
|
|
65
|
+
- The content (title, description, or action labels) changes
|
|
66
|
+
|
|
67
|
+
## Media
|
|
68
|
+
|
|
69
|
+
Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
|
|
70
|
+
|
|
71
|
+
<Source
|
|
72
|
+
dark
|
|
73
|
+
code={`
|
|
74
|
+
import { Bank, AlertCircle } from '@transferwise/icons';
|
|
75
|
+
|
|
76
|
+
<CriticalBanner
|
|
77
|
+
title="Bank connection required"
|
|
78
|
+
description="Connect your bank account to continue"
|
|
79
|
+
media={{ avatar: { asset: <Bank title="Bank account" /> } }}
|
|
80
|
+
action={{ label: 'Connect now', onClick: handleConnect }}
|
|
81
|
+
expanded={false}
|
|
82
|
+
onToggle={handleToggle}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<CriticalBanner
|
|
86
|
+
title="Verification required"
|
|
87
|
+
description="We need to verify your identity"
|
|
88
|
+
media={{ avatar: { asset: <AlertCircle title="Alert" /> } }}
|
|
89
|
+
action={{ label: "Start verification", onClick: handleVerify }}
|
|
90
|
+
expanded={false}
|
|
91
|
+
onToggle={handleToggle}
|
|
92
|
+
/>
|
|
93
|
+
`}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
Alternatively, you can use `media['aria-label']` to provide a label for custom images:
|
|
97
|
+
|
|
98
|
+
<Source
|
|
99
|
+
dark
|
|
100
|
+
code={`
|
|
101
|
+
<CriticalBanner
|
|
102
|
+
title="Card blocked"
|
|
103
|
+
description="Your card has been blocked for security reasons"
|
|
104
|
+
media={{
|
|
105
|
+
imgSrc: '/wise-card.svg',
|
|
106
|
+
'aria-label': 'Wise debit card'
|
|
107
|
+
}}
|
|
108
|
+
action={{ label: "Unblock card", onClick: handleUnblock }}
|
|
109
|
+
expanded={false}
|
|
110
|
+
onToggle={handleToggle}
|
|
111
|
+
/>
|
|
112
|
+
`}
|
|
113
|
+
/>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.wds-critical-banner {
|
|
2
|
+
--Prompt-padding: var(--size-16);
|
|
3
|
+
--Prompt-actions-gap: var(--size-8);
|
|
4
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
5
|
+
--Prompt-border-radius: 0;
|
|
6
|
+
container-type: inline-size;
|
|
7
|
+
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
8
|
+
--critical-banner-duration: 150ms;
|
|
9
|
+
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
10
|
+
actions only go full-width below mobile-max token (container query) */
|
|
11
|
+
}
|
|
12
|
+
.wds-critical-banner--media-image {
|
|
13
|
+
width: 48px;
|
|
14
|
+
width: var(--size-48);
|
|
15
|
+
height: 48px;
|
|
16
|
+
height: var(--size-48);
|
|
17
|
+
-o-object-fit: contain;
|
|
18
|
+
object-fit: contain;
|
|
19
|
+
}
|
|
20
|
+
.wds-critical-banner__title {
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
-webkit-line-clamp: 8;
|
|
23
|
+
line-clamp: 8;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
max-height: 192px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
transition: max-height var(--critical-banner-duration) var(--critical-banner-easing);
|
|
28
|
+
}
|
|
29
|
+
.wds-critical-banner--collapsed .wds-critical-banner__title {
|
|
30
|
+
-webkit-line-clamp: 2;
|
|
31
|
+
line-clamp: 2;
|
|
32
|
+
max-height: 48px;
|
|
33
|
+
}
|
|
34
|
+
.wds-critical-banner__description {
|
|
35
|
+
max-height: 30vh;
|
|
36
|
+
opacity: 1;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
transition: max-height var(--critical-banner-duration) var(--critical-banner-easing), opacity var(--critical-banner-duration) var(--critical-banner-easing);
|
|
39
|
+
}
|
|
40
|
+
.wds-critical-banner--collapsed .wds-critical-banner__description--with-title {
|
|
41
|
+
max-height: 0;
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
.wds-critical-banner--collapsed .wds-critical-banner__description:not(.wds-critical-banner__description--with-title) {
|
|
45
|
+
display: -webkit-box;
|
|
46
|
+
-webkit-line-clamp: 2;
|
|
47
|
+
line-clamp: 2;
|
|
48
|
+
-webkit-box-orient: vertical;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
.wds-critical-banner .wds-prompt__content-wrapper {
|
|
52
|
+
grid-template-columns: auto 1fr auto;
|
|
53
|
+
align-items: flex-start;
|
|
54
|
+
transition: row-gap var(--critical-banner-duration) var(--critical-banner-easing);
|
|
55
|
+
}
|
|
56
|
+
.wds-critical-banner--collapsed .wds-prompt__content-wrapper {
|
|
57
|
+
row-gap: 0;
|
|
58
|
+
}
|
|
59
|
+
.wds-critical-banner__text-wrapper {
|
|
60
|
+
position: relative;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
text-align: start;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
max-width: 480px;
|
|
68
|
+
height: 100%;
|
|
69
|
+
padding-top: 3px;
|
|
70
|
+
}
|
|
71
|
+
@media (max-width: 320px) {
|
|
72
|
+
.wds-critical-banner__text-wrapper {
|
|
73
|
+
padding-top: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
@container (max-width: 320px) {
|
|
77
|
+
.wds-critical-banner__text-wrapper {
|
|
78
|
+
padding-top: 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
.wds-critical-banner--collapsed .wds-critical-banner__title,
|
|
82
|
+
.wds-critical-banner--collapsed .wds-critical-banner__description {
|
|
83
|
+
transform: translateY(0);
|
|
84
|
+
}
|
|
85
|
+
.wds-critical-banner__toggle {
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
transition: transform var(--critical-banner-duration) var(--critical-banner-easing);
|
|
88
|
+
}
|
|
89
|
+
.wds-critical-banner__toggle--collapsed {
|
|
90
|
+
transform: rotate(180deg);
|
|
91
|
+
}
|
|
92
|
+
@container (min-width: 768px) {
|
|
93
|
+
.wds-critical-banner__toggle {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
98
|
+
grid-column-start: 2;
|
|
99
|
+
grid-column-end: 3;
|
|
100
|
+
max-height: 200px;
|
|
101
|
+
opacity: 1;
|
|
102
|
+
overflow: visible;
|
|
103
|
+
}
|
|
104
|
+
@container (max-width: 600px) {
|
|
105
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
106
|
+
grid-column: span 3;
|
|
107
|
+
width: 100%;
|
|
108
|
+
}
|
|
109
|
+
.wds-critical-banner .wds-prompt__actions-wrapper .wds-Button {
|
|
110
|
+
flex: 1 1 100%;
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
.wds-critical-banner--collapsed .wds-prompt__actions-wrapper {
|
|
115
|
+
max-height: 0;
|
|
116
|
+
opacity: 0;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
@container (max-width: 600px) {
|
|
121
|
+
.wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
122
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
123
|
+
min-width: -moz-fit-content;
|
|
124
|
+
min-width: fit-content;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
@media (prefers-reduced-motion: reduce) {
|
|
128
|
+
.wds-critical-banner__description,
|
|
129
|
+
.wds-critical-banner__title,
|
|
130
|
+
.wds-critical-banner .wds-prompt__content-wrapper,
|
|
131
|
+
.wds-critical-banner__toggle {
|
|
132
|
+
transition: none !important;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
@import (reference) "./CriticalBanner.vars.less";
|
|
2
|
+
|
|
3
|
+
.wds-critical-banner {
|
|
4
|
+
--Prompt-padding: var(--size-16);
|
|
5
|
+
--Prompt-actions-gap: var(--size-8);
|
|
6
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
7
|
+
--Prompt-border-radius: 0;
|
|
8
|
+
container-type: inline-size;
|
|
9
|
+
|
|
10
|
+
// Animation variables
|
|
11
|
+
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
12
|
+
--critical-banner-duration: 150ms;
|
|
13
|
+
|
|
14
|
+
&--media-image {
|
|
15
|
+
width: var(--size-48);
|
|
16
|
+
height: var(--size-48);
|
|
17
|
+
object-fit: contain;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__title {
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
-webkit-line-clamp: 8;
|
|
23
|
+
line-clamp: 8;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
max-height: 192px; // ~8 lines (24px line-height × 8) - balanced for common cases
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
transition: max-height var(--critical-banner-duration) var(--critical-banner-easing);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&--collapsed &__title {
|
|
31
|
+
-webkit-line-clamp: 2;
|
|
32
|
+
line-clamp: 2;
|
|
33
|
+
max-height: 48px; // ~2 lines (24px line-height × 2)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__description {
|
|
37
|
+
max-height: 30vh;
|
|
38
|
+
opacity: 1;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
transition:
|
|
41
|
+
max-height var(--critical-banner-duration) var(--critical-banner-easing),
|
|
42
|
+
opacity var(--critical-banner-duration) var(--critical-banner-easing);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--collapsed &__description--with-title {
|
|
46
|
+
max-height: 0;
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// When collapsed WITHOUT a title: show 2 lines
|
|
51
|
+
&--collapsed &__description:not(&__description--with-title) {
|
|
52
|
+
display: -webkit-box;
|
|
53
|
+
-webkit-line-clamp: 2;
|
|
54
|
+
line-clamp: 2;
|
|
55
|
+
-webkit-box-orient: vertical;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wds-prompt__content-wrapper {
|
|
60
|
+
grid-template-columns: auto 1fr auto;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
transition: row-gap var(--critical-banner-duration) var(--critical-banner-easing);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--collapsed .wds-prompt__content-wrapper {
|
|
66
|
+
row-gap: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&__text-wrapper {
|
|
70
|
+
position: relative;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
text-align: start;
|
|
76
|
+
min-width: 0;
|
|
77
|
+
max-width: 480px;
|
|
78
|
+
height: 100%;
|
|
79
|
+
|
|
80
|
+
// Padding prevents text shifting when collapsing/expanding layout shift
|
|
81
|
+
padding-top: 3px;
|
|
82
|
+
|
|
83
|
+
@media (--screen-400-zoom) {
|
|
84
|
+
padding-top: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@container (max-width: 320px) {
|
|
88
|
+
padding-top: 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&--collapsed &__title,
|
|
93
|
+
&--collapsed &__description {
|
|
94
|
+
transform: translateY(0);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&__toggle {
|
|
98
|
+
flex-shrink: 0;
|
|
99
|
+
transition: transform var(--critical-banner-duration) var(--critical-banner-easing);
|
|
100
|
+
|
|
101
|
+
&--collapsed {
|
|
102
|
+
transform: rotate(180deg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@container (min-width: @wds-critical-banner-collapsible-max) {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
111
|
+
actions only go full-width below mobile-max token (container query) */
|
|
112
|
+
.wds-prompt__actions-wrapper {
|
|
113
|
+
grid-column-start: 2;
|
|
114
|
+
grid-column-end: 3;
|
|
115
|
+
max-height: 200px;
|
|
116
|
+
opacity: 1;
|
|
117
|
+
overflow: visible;
|
|
118
|
+
|
|
119
|
+
@container (max-width: @wds-critical-banner-action-wrapper-max) {
|
|
120
|
+
grid-column: span 3;
|
|
121
|
+
width: 100%;
|
|
122
|
+
|
|
123
|
+
.wds-Button {
|
|
124
|
+
flex: 1 1 100%;
|
|
125
|
+
width: 100%;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&--collapsed .wds-prompt__actions-wrapper {
|
|
131
|
+
max-height: 0;
|
|
132
|
+
opacity: 0;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&--with-two-actions .wds-prompt__actions-wrapper {
|
|
138
|
+
@container (max-width: @wds-critical-banner-action-wrapper-max) {
|
|
139
|
+
.wds-Button {
|
|
140
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
141
|
+
min-width: fit-content;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Reduced motion support
|
|
148
|
+
@media (prefers-reduced-motion: reduce) {
|
|
149
|
+
.wds-critical-banner__description,
|
|
150
|
+
.wds-critical-banner__title,
|
|
151
|
+
.wds-critical-banner .wds-prompt__content-wrapper,
|
|
152
|
+
.wds-critical-banner__toggle {
|
|
153
|
+
transition: none !important;
|
|
154
|
+
}
|
|
155
|
+
}
|