@transferwise/components 46.147.0 → 46.148.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/main.css +53 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js +78 -68
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +79 -69
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
- package/build/styles/main.css +53 -0
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.story.tsx +25 -0
- package/src/avatarLayout/AvatarLayout.story.tsx +10 -0
- package/src/avatarView/AvatarView.story.tsx +8 -0
- package/src/body/Body.story.tsx +12 -0
- package/src/button/_stories/Button.story.tsx +7 -1
- package/src/calendar/Calendar.story.tsx +19 -7
- package/src/carousel/Carousel.story.tsx +35 -0
- package/src/checkbox/Checkbox.story.tsx +20 -0
- package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
- package/src/chevron/Chevron.story.tsx +6 -0
- package/src/chips/Chips.story.tsx +23 -0
- package/src/circularButton/CircularButton.story.tsx +13 -0
- package/src/common/baseCard/BaseCard.story.tsx +12 -0
- package/src/common/bottomSheet/BottomSheet.story.tsx +21 -0
- package/src/common/circle/Circle.story.tsx +11 -0
- package/src/container/Container.story.tsx +12 -0
- package/src/dateInput/DateInput.story.tsx +20 -0
- package/src/dateLookup/DateLookup.story.tsx +23 -0
- package/src/decision/Decision.story.tsx +36 -0
- package/src/definitionList/DefinitionList.story.tsx +16 -0
- package/src/dimmer/Dimmer.story.tsx +24 -0
- package/src/display/Display.story.tsx +11 -0
- package/src/divider/Divider.story.tsx +6 -0
- package/src/drawer/Drawer.story.tsx +25 -0
- package/src/dropFade/DropFade.story.tsx +27 -0
- package/src/emphasis/Emphasis.story.tsx +10 -0
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +37 -0
- package/src/field/Field.story.tsx +16 -0
- package/src/flowNavigation/FlowNavigation.story.tsx +25 -0
- package/src/header/Header.story.tsx +17 -0
- package/src/iconButton/IconButton.story.tsx +14 -0
- package/src/image/Image.story.tsx +11 -0
- package/src/info/Info.story.tsx +10 -0
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +23 -0
- package/src/inputs/InputGroup.story.tsx +37 -0
- package/src/inputs/SearchInput.story.tsx +22 -0
- package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +42 -0
- package/src/inputs/TextArea.story.tsx +22 -0
- package/src/instructionsList/InstructionsList.story.tsx +19 -0
- package/src/label/Label.story.tsx +17 -0
- package/src/link/Link.story.tsx +11 -0
- package/src/list/List.story.tsx +19 -0
- package/src/listItem/_stories/ListItem.story.tsx +20 -0
- package/src/loader/Loader.story.tsx +6 -0
- package/src/logo/Logo.story.tsx +6 -0
- package/src/main.css +53 -0
- package/src/markdown/Markdown.story.tsx +17 -0
- package/src/modal/Modal.story.tsx +23 -0
- package/src/money/Money.story.tsx +7 -0
- package/src/moneyInput/MoneyInput.story.tsx +34 -0
- package/src/nudge/Nudge.story.tsx +17 -0
- package/src/overlayHeader/OverlayHeader.story.tsx +10 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +23 -0
- package/src/popover/Popover.story.tsx +12 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +11 -0
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +11 -0
- package/src/processIndicator/ProcessIndicator.story.tsx +10 -0
- package/src/progress/Progress.story.tsx +6 -0
- package/src/progressBar/ProgressBar.story.tsx +12 -0
- package/src/promoCard/PromoCard.story.tsx +15 -0
- package/src/promoCard/PromoCardGroup.story.tsx +28 -0
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +31 -0
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +9 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +72 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +180 -169
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +25 -6
- package/src/prompt/CriticalBanner/CriticalBanner.test.tsx +37 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +92 -83
- package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
- package/src/radio/Radio.story.tsx +34 -0
- package/src/radioGroup/RadioGroup.story.tsx +26 -0
- package/src/section/Section.story.tsx +15 -0
- package/src/segmentedControl/SegmentedControl.story.tsx +27 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +11 -0
- package/src/slidingPanel/SlidingPanel.story.tsx +19 -0
- package/src/snackbar/Snackbar.story.tsx +24 -0
- package/src/statusIcon/StatusIcon.story.tsx +6 -0
- package/src/stepper/Stepper.story.tsx +30 -0
- package/src/sticky/Sticky.story.tsx +22 -1
- package/src/switch/Switch.story.tsx +17 -0
- package/src/table/Table.story.tsx +32 -0
- package/src/tabs/Tabs.story.tsx +31 -0
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +23 -0
- package/src/tile/Tile.story.tsx +13 -0
- package/src/title/Title.story.tsx +12 -0
- package/src/tooltip/Tooltip.story.tsx +8 -0
- package/src/typeahead/Typeahead.story.tsx +33 -0
- package/src/upload/Upload.story.tsx +24 -0
- package/src/uploadInput/UploadInput.story.tsx +31 -0
|
@@ -2,6 +2,10 @@ import { ReactElement, useState } from 'react';
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
import { Bank, Star, Suitcase, Briefcase } from '@transferwise/icons';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
import { lorem10, lorem20 } from '../../test-utils';
|
|
6
10
|
import Button from '../../button';
|
|
7
11
|
import Title from '../../title';
|
|
@@ -186,6 +190,33 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
186
190
|
},
|
|
187
191
|
};
|
|
188
192
|
|
|
193
|
+
export const Sandbox = createSandboxStory({
|
|
194
|
+
code: `const App = () => {
|
|
195
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
196
|
+
|
|
197
|
+
if (dismissed) {
|
|
198
|
+
return (
|
|
199
|
+
<Button v2 size="md" onClick={() => setDismissed(false)}>
|
|
200
|
+
Show prompt again
|
|
201
|
+
</Button>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<ActionPrompt
|
|
207
|
+
sentiment="neutral"
|
|
208
|
+
title="Action Required"
|
|
209
|
+
description="Please complete the following action to continue."
|
|
210
|
+
media={{ avatar: { asset: <Bank /> } }}
|
|
211
|
+
action={{ label: 'Continue', onClick: () => console.log('action clicked') }}
|
|
212
|
+
actionSecondary={{ label: 'Cancel', onClick: () => console.log('cancel clicked') }}
|
|
213
|
+
onDismiss={() => setDismissed(true)}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
};`,
|
|
217
|
+
scope: globalScope,
|
|
218
|
+
});
|
|
219
|
+
|
|
189
220
|
/**
|
|
190
221
|
* ActionPrompt supports multiple sentiments to communicate different types of messages:
|
|
191
222
|
* - `neutral` (default): General prompts
|
|
@@ -64,6 +64,15 @@ Screen readers announce the banner content whenever:
|
|
|
64
64
|
- The user toggles between collapsed and expanded states
|
|
65
65
|
- The content (title, description, or action labels) changes
|
|
66
66
|
|
|
67
|
+
## Reduced Motion
|
|
68
|
+
|
|
69
|
+
`CriticalBanner` respects the user's reduced motion preference. When reduced motion is on, the component does not show:
|
|
70
|
+
|
|
71
|
+
- the entry animation that reveals the banner from above when it first appears
|
|
72
|
+
- the collapse and expand animation used when the user toggles the banner content
|
|
73
|
+
|
|
74
|
+
The same content is still rendered and announced. Reduced motion only removes the visual movement.
|
|
75
|
+
|
|
67
76
|
## Media
|
|
68
77
|
|
|
69
78
|
Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
5
5
|
--Prompt-border-radius: 0;
|
|
6
6
|
container-type: inline-size;
|
|
7
|
+
position: relative;
|
|
7
8
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
8
9
|
--critical-banner-duration: 150ms;
|
|
9
10
|
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
@@ -124,6 +125,48 @@
|
|
|
124
125
|
min-width: fit-content;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
.wds-critical-banner-overhang-query {
|
|
129
|
+
container-name: critical-banner-overhang;
|
|
130
|
+
container-type: inline-size;
|
|
131
|
+
inline-size: 100%;
|
|
132
|
+
}
|
|
133
|
+
.wds-critical-banner__entry-mask {
|
|
134
|
+
display: grid;
|
|
135
|
+
grid-template-rows: 0fr;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
138
|
+
}
|
|
139
|
+
@container critical-banner-overhang (max-width: 600px) {
|
|
140
|
+
.wds-critical-banner__entry-mask {
|
|
141
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
142
|
+
}
|
|
143
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang {
|
|
144
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
145
|
+
}
|
|
146
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
|
|
147
|
+
content: "";
|
|
148
|
+
position: absolute;
|
|
149
|
+
right: 0;
|
|
150
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
151
|
+
left: 0;
|
|
152
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
background: radial-gradient(circle at 100% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 0 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat, radial-gradient(circle at 0% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 100% 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.wds-critical-banner__entry-track {
|
|
158
|
+
min-height: 0;
|
|
159
|
+
}
|
|
160
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
161
|
+
from {
|
|
162
|
+
grid-template-rows: 0fr;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
}
|
|
165
|
+
to {
|
|
166
|
+
grid-template-rows: 1fr;
|
|
167
|
+
overflow: visible;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
127
170
|
@media (prefers-reduced-motion: reduce) {
|
|
128
171
|
.wds-critical-banner__description,
|
|
129
172
|
.wds-critical-banner__title,
|
|
@@ -131,4 +174,9 @@
|
|
|
131
174
|
.wds-critical-banner__toggle {
|
|
132
175
|
transition: none !important;
|
|
133
176
|
}
|
|
177
|
+
.wds-critical-banner__entry-mask {
|
|
178
|
+
animation: none;
|
|
179
|
+
grid-template-rows: 1fr;
|
|
180
|
+
overflow: visible;
|
|
181
|
+
}
|
|
134
182
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
8
8
|
--Prompt-border-radius: 0;
|
|
9
9
|
container-type: inline-size;
|
|
10
|
+
position: relative;
|
|
10
11
|
|
|
11
12
|
// Animation variables
|
|
12
13
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
@@ -144,6 +145,71 @@
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
// Entry animation: after a 500ms delay, reveal the already-positioned banner
|
|
149
|
+
// over 400ms. The mask clips only during the reveal, then becomes visible so the
|
|
150
|
+
// overhang and actions are not clipped after the animation.
|
|
151
|
+
.wds-critical-banner-overhang-query {
|
|
152
|
+
container-name: critical-banner-overhang;
|
|
153
|
+
container-type: inline-size;
|
|
154
|
+
inline-size: 100%;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.wds-critical-banner__entry-mask {
|
|
158
|
+
display: grid;
|
|
159
|
+
grid-template-rows: 0fr;
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
162
|
+
|
|
163
|
+
@container critical-banner-overhang (max-width: @wds-critical-banner-mobile-overhang-max) {
|
|
164
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
165
|
+
|
|
166
|
+
.wds-critical-banner-overhang {
|
|
167
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
168
|
+
|
|
169
|
+
&::after {
|
|
170
|
+
content: "";
|
|
171
|
+
position: absolute;
|
|
172
|
+
right: 0;
|
|
173
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
174
|
+
left: 0;
|
|
175
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
background:
|
|
178
|
+
radial-gradient(
|
|
179
|
+
circle at 100% 100%,
|
|
180
|
+
transparent var(--critical-banner-mobile-overhang-size),
|
|
181
|
+
var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)
|
|
182
|
+
)
|
|
183
|
+
0 0 / var(--critical-banner-mobile-overhang-size)
|
|
184
|
+
var(--critical-banner-mobile-overhang-size) no-repeat,
|
|
185
|
+
radial-gradient(
|
|
186
|
+
circle at 0% 100%,
|
|
187
|
+
transparent var(--critical-banner-mobile-overhang-size),
|
|
188
|
+
var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)
|
|
189
|
+
)
|
|
190
|
+
100% 0 / var(--critical-banner-mobile-overhang-size)
|
|
191
|
+
var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.wds-critical-banner__entry-track {
|
|
198
|
+
min-height: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
202
|
+
from {
|
|
203
|
+
grid-template-rows: 0fr;
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
to {
|
|
208
|
+
grid-template-rows: 1fr;
|
|
209
|
+
overflow: visible;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
147
213
|
// Reduced motion support
|
|
148
214
|
@media (prefers-reduced-motion: reduce) {
|
|
149
215
|
.wds-critical-banner__description,
|
|
@@ -152,4 +218,10 @@
|
|
|
152
218
|
.wds-critical-banner__toggle {
|
|
153
219
|
transition: none !important;
|
|
154
220
|
}
|
|
221
|
+
|
|
222
|
+
.wds-critical-banner__entry-mask {
|
|
223
|
+
animation: none;
|
|
224
|
+
grid-template-rows: 1fr;
|
|
225
|
+
overflow: visible;
|
|
226
|
+
}
|
|
155
227
|
}
|