@transferwise/components 46.166.0 → 46.167.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/CardContainer/CardContainer.js +34 -0
- package/build/CardContainer/CardContainer.js.map +1 -0
- package/build/CardContainer/CardContainer.mjs +30 -0
- package/build/CardContainer/CardContainer.mjs.map +1 -0
- package/build/CardWidget/CardWidget.js +98 -0
- package/build/CardWidget/CardWidget.js.map +1 -0
- package/build/CardWidget/CardWidget.mjs +94 -0
- package/build/CardWidget/CardWidget.mjs.map +1 -0
- package/build/CardWidget/CardWidgetAction.js +73 -0
- package/build/CardWidget/CardWidgetAction.js.map +1 -0
- package/build/CardWidget/CardWidgetAction.mjs +68 -0
- package/build/CardWidget/CardWidgetAction.mjs.map +1 -0
- package/build/ListItem/ListItem.js +2 -0
- package/build/ListItem/ListItem.js.map +1 -1
- package/build/ListItem/ListItem.mjs +2 -0
- package/build/ListItem/ListItem.mjs.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +2 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +194 -0
- package/build/styles/CardContainer/CardContainer.css +108 -0
- package/build/styles/CardWidget/CardWidget.css +78 -0
- package/build/styles/ListItem/ListItem.css +8 -0
- package/build/styles/main.css +194 -0
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/CardContainer/CardContainer.d.ts +8 -0
- package/build/types/CardContainer/CardContainer.d.ts.map +1 -0
- package/build/types/CardContainer/CardContainer.types.d.ts +55 -0
- package/build/types/CardContainer/CardContainer.types.d.ts.map +1 -0
- package/build/types/CardContainer/_stories/helpers.d.ts +3 -0
- package/build/types/CardContainer/_stories/helpers.d.ts.map +1 -0
- package/build/types/CardContainer/index.d.ts +3 -0
- package/build/types/CardContainer/index.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.d.ts +10 -0
- package/build/types/CardWidget/CardWidget.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.types.d.ts +55 -0
- package/build/types/CardWidget/CardWidget.types.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts +54 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts.map +1 -0
- package/build/types/CardWidget/index.d.ts +4 -0
- package/build/types/CardWidget/index.d.ts.map +1 -0
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts.map +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/CardContainer/CardContainer.css +108 -0
- package/src/CardContainer/CardContainer.less +171 -0
- package/src/CardContainer/CardContainer.test.tsx +150 -0
- package/src/CardContainer/CardContainer.tsx +51 -0
- package/src/CardContainer/CardContainer.types.ts +62 -0
- package/src/CardContainer/_stories/CardContainer.story.tsx +167 -0
- package/src/CardContainer/_stories/CardContainer.test.story.tsx +103 -0
- package/src/CardContainer/_stories/helpers.tsx +50 -0
- package/src/CardContainer/index.ts +6 -0
- package/src/CardWidget/CardWidget.css +78 -0
- package/src/CardWidget/CardWidget.less +107 -0
- package/src/CardWidget/CardWidget.test.tsx +221 -0
- package/src/CardWidget/CardWidget.tsx +78 -0
- package/src/CardWidget/CardWidget.types.ts +63 -0
- package/src/CardWidget/CardWidgetAction.tsx +128 -0
- package/src/CardWidget/_stories/CardWidget.story.tsx +238 -0
- package/src/CardWidget/_stories/CardWidget.test.story.tsx +350 -0
- package/src/CardWidget/index.ts +3 -0
- package/src/ListItem/ListItem.css +8 -0
- package/src/ListItem/ListItem.less +8 -0
- package/src/ListItem/ListItem.test.tsx +20 -0
- package/src/ListItem/ListItem.tsx +3 -1
- package/src/ListItem/_stories/ListItem.layout.test.story.tsx +1 -1
- package/src/ListItem/_stories/ListItem.story.tsx +1 -1
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.docs.mdx +122 -0
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.story.tsx +0 -2
- package/src/index.ts +13 -0
- package/src/main.css +194 -0
- package/src/main.less +2 -0
- package/src/FlowNavigation/_stories/FlowNavigation.CriticalBanner.docs.mdx +0 -66
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Prompts/CriticalBanner/Developer Guide" tags={['new']} />
|
|
4
|
+
|
|
5
|
+
# Developer Guide
|
|
6
|
+
|
|
7
|
+
**Note:** Any usages of `Layout`, `Flow` or `HashRouterFlow` rely on the `global-critical-banner` feature flag being enabled. Whilst this flag is currently disabled in production, it's recommended to test with this flag enabled in staging, to ensure the critical banner behaves as expected for your users.
|
|
8
|
+
|
|
9
|
+
Typically `CriticalBanner` should be used in one of three ways. Pick the one that matches the page or flow you're building and avoid using CriticalBanner as a standalone component.
|
|
10
|
+
|
|
11
|
+
- `Layout` via `@transferwise/navigation-ui` - Fetched automatically from navigation-service (for non-flow layouts)
|
|
12
|
+
- `Flow` / `HashRouterFlow` via `@transferwise/flow` - Fetched automatically from navigation-service (for flows)
|
|
13
|
+
- `FlowNavigation` via `@transferwise/components` - Passed in by you through the `banner` prop (for custom solutions)
|
|
14
|
+
|
|
15
|
+
If your page uses `Layout`, `Flow` or `HashRouterFlow`, you don't need to render `CriticalBanner` yourself. These components fetch the banner, cache it and render it for you automatically.
|
|
16
|
+
|
|
17
|
+
## Layout from @transferwise/navigation-ui
|
|
18
|
+
|
|
19
|
+
`Layout` has no banner prop. It fetches the critical banner from navigation-service on the client and renders it above the page content.
|
|
20
|
+
|
|
21
|
+
Requirements:
|
|
22
|
+
|
|
23
|
+
- `@transferwise/navigation-ui` `4.46.0` or later
|
|
24
|
+
- The page must use the composable layout, and `global-critical-banner` feature flags in navigation-service control this. The legacy layout doesn't render the banner.
|
|
25
|
+
|
|
26
|
+
<Source
|
|
27
|
+
code={`import { Layout, fetchNavigationData, type NavigationData } from '@transferwise/navigation-ui';
|
|
28
|
+
|
|
29
|
+
// Optional: fetch initial navigation data server side, so the banner cache is scoped correctly.
|
|
30
|
+
export const getServerSideProps = async () => {
|
|
31
|
+
const navigationData = await fetchNavigationData({
|
|
32
|
+
httpClient,
|
|
33
|
+
navigationServiceUrl: process.env.NAVIGATION_SERVICE_URL,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return { props: { navigationData } };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const Page = ({ navigationData }: { navigationData: NavigationData }) => (
|
|
40
|
+
<Layout navigationData={navigationData} onMixpanelEvent={trackEvent}>
|
|
41
|
+
{ /* Page content */ }
|
|
42
|
+
</Layout>
|
|
43
|
+
);
|
|
44
|
+
`}
|
|
45
|
+
language="typescript"
|
|
46
|
+
dark
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
`Layout` also handles:
|
|
50
|
+
|
|
51
|
+
- saving the collapsed or expanded state when the user toggles the banner
|
|
52
|
+
- caching the banner for the session, so the entry animation only plays for new or changed banners
|
|
53
|
+
- sending Mixpanel events for toggles and action clicks through `onMixpanelEvent`
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Flow / HashRouterFlow from @transferwise/flow
|
|
57
|
+
|
|
58
|
+
`Flow` and `HashRouterFlow`, from `@transferwise/flow` render `FlowNavigationWrapper` from `@transferwise/navigation-ui`. It fetches, caches and renders the critical banner the same way `Layout` does. You don't need to pass a banner, but do require `@transferwise/navigation-ui` as a dependency.
|
|
59
|
+
|
|
60
|
+
Requirements:
|
|
61
|
+
|
|
62
|
+
- `@transferwise/flow` `13.0.0` or later
|
|
63
|
+
- `@transferwise/navigation-ui` `4.51.0` or later, which is a required peer dependency
|
|
64
|
+
|
|
65
|
+
You can pass two optional properties in the `navigation` options:
|
|
66
|
+
|
|
67
|
+
- `navigationData`: initial navigation data, usually fetched server side, so the banner cache is scoped correctly. If you leave it out, the banner is fetched on the client.
|
|
68
|
+
- `onMixpanelEvent`: called when the user toggles the banner or clicks its action.
|
|
69
|
+
|
|
70
|
+
<Source
|
|
71
|
+
code={`import { HashRouterFlow } from '@transferwise/flow';
|
|
72
|
+
import type { NavigationData } from '@transferwise/navigation-ui';
|
|
73
|
+
|
|
74
|
+
const SendFlow = ({ navigationData }: { navigationData?: NavigationData }) => (
|
|
75
|
+
<HashRouterFlow
|
|
76
|
+
steps={steps}
|
|
77
|
+
trackEvent={trackEvent}
|
|
78
|
+
navigation={{
|
|
79
|
+
profile,
|
|
80
|
+
onClose,
|
|
81
|
+
navigationData,
|
|
82
|
+
onMixpanelEvent: trackEvent,
|
|
83
|
+
}}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
`}
|
|
87
|
+
language="typescript"
|
|
88
|
+
dark
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
## FlowNavigation from @transferwise/components
|
|
92
|
+
|
|
93
|
+
`FlowNavigation` from `@transferwise/components` renders a critical banner above the navigation when you pass a `banner` prop. Use this if you build your flow with `FlowNavigation` directly. You're responsible for getting the banner data.
|
|
94
|
+
|
|
95
|
+
`banner` accepts either:
|
|
96
|
+
|
|
97
|
+
- `CriticalBannerProps`, the same props `CriticalBanner` takes
|
|
98
|
+
- the legacy `CriticalBannerData` shape returned by navigation-service. `FlowNavigation` maps it to `CriticalBannerProps` for you.
|
|
99
|
+
|
|
100
|
+
<Source
|
|
101
|
+
code={`import { FlowNavigation, type CriticalBannerProps } from '@transferwise/components';
|
|
102
|
+
|
|
103
|
+
const banner: CriticalBannerProps = {
|
|
104
|
+
sentiment: 'negative',
|
|
105
|
+
title: 'Action required',
|
|
106
|
+
description: 'Please verify your identity to continue with this transfer.',
|
|
107
|
+
action: { label: 'Verify now', onClick: handleVerify },
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
<FlowNavigation
|
|
111
|
+
banner={banner}
|
|
112
|
+
steps={steps}
|
|
113
|
+
activeStep={activeStep}
|
|
114
|
+
avatar={avatar}
|
|
115
|
+
onClose={onClose}
|
|
116
|
+
/>;
|
|
117
|
+
`}
|
|
118
|
+
language="typescript"
|
|
119
|
+
dark
|
|
120
|
+
/>
|
|
121
|
+
|
|
122
|
+
Requires `@transferwise/components` `46.162.0` or later. Support for the legacy `CriticalBannerData` shape was added in `46.164.0`.
|
|
@@ -14,8 +14,6 @@ import { CriticalBanner, type CriticalBannerProps } from '..';
|
|
|
14
14
|
* **Design guidance**: <a href="https://docs.wise.design/components/critical-banner" target="_blank">wise.design/components/critical-banner</a>
|
|
15
15
|
*
|
|
16
16
|
* Can be controlled or uncontrolled. When `onToggle` is provided, the consumer manages the expanded state via `expanded` and the banner calls `onToggle` when the user clicks the chevron. When `onToggle` is not provided, the banner manages its own expanded state internally and toggles it when the user clicks the chevron.
|
|
17
|
-
*
|
|
18
|
-
* **Using with FlowNavigation**: See the [FlowNavigation Critical Banner Guide](?path=/docs/navigation-flownavigation-critical-banner-guide--docs) for integration patterns and data mapping examples.
|
|
19
17
|
*/
|
|
20
18
|
const meta = {
|
|
21
19
|
component: CriticalBanner,
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
* Types
|
|
5
5
|
*/
|
|
6
6
|
export type { ContainerProps } from './Container';
|
|
7
|
+
export type {
|
|
8
|
+
CardContainerProps,
|
|
9
|
+
CardContainerSpotlight,
|
|
10
|
+
CardContainerPadding,
|
|
11
|
+
} from './CardContainer';
|
|
12
|
+
export type {
|
|
13
|
+
CardWidgetProps,
|
|
14
|
+
CardWidgetHeader,
|
|
15
|
+
CardWidgetTitleAction,
|
|
16
|
+
CardWidgetActionButton,
|
|
17
|
+
} from './CardWidget';
|
|
7
18
|
export type { LogoProps, LogoSize, LogoAssetName } from './Logo';
|
|
8
19
|
export type { FlowNavigationProps, CriticalBannerLegacyData } from './FlowNavigation';
|
|
9
20
|
export type { AccordionItem, AccordionProps } from './Accordion';
|
|
@@ -218,6 +229,8 @@ export { default as Chevron } from './Chevron';
|
|
|
218
229
|
export { Chip, default as Chips } from './Chips';
|
|
219
230
|
export { default as CircularButton } from './CircularButton';
|
|
220
231
|
export { default as Container } from './Container';
|
|
232
|
+
export { default as CardContainer } from './CardContainer';
|
|
233
|
+
export { default as CardWidget } from './CardWidget';
|
|
221
234
|
export { default as Option } from './common/Option';
|
|
222
235
|
export { default as BottomSheet } from './common/BottomSheet';
|
|
223
236
|
export { default as BaseCard } from './common/BaseCard';
|
package/src/main.css
CHANGED
|
@@ -26203,6 +26203,192 @@ a[data-toggle="tooltip"] {
|
|
|
26203
26203
|
.wds-container--fluid {
|
|
26204
26204
|
max-inline-size: var(--wds-container-width-fluid);
|
|
26205
26205
|
}
|
|
26206
|
+
.wds-card-container {
|
|
26207
|
+
--CardContainer-shadow: var(--CardContainer-theme-shadow, none);
|
|
26208
|
+
--CardContainer-background-color: var(--color-background-screen);
|
|
26209
|
+
--CardContainer-border-color: var(--color-border-neutral);
|
|
26210
|
+
--CardContainer-border-radius: var(--radius-large);
|
|
26211
|
+
--CardContainer-padding-block: var(--size-8);
|
|
26212
|
+
--CardContainer-padding-inline: var(--size-8);
|
|
26213
|
+
background-color: var(--CardContainer-background-color);
|
|
26214
|
+
border: 1px solid var(--CardContainer-border-color);
|
|
26215
|
+
border-radius: var(--CardContainer-border-radius);
|
|
26216
|
+
box-sizing: border-box;
|
|
26217
|
+
display: flex;
|
|
26218
|
+
flex-direction: column;
|
|
26219
|
+
padding-block: var(--CardContainer-padding-block);
|
|
26220
|
+
padding-inline: var(--CardContainer-padding-inline);
|
|
26221
|
+
inline-size: 100%;
|
|
26222
|
+
}
|
|
26223
|
+
@media (min-width: 840px) {
|
|
26224
|
+
.wds-card-container {
|
|
26225
|
+
--CardContainer-padding-block: var(--size-16);
|
|
26226
|
+
--CardContainer-padding-inline: var(--size-16);
|
|
26227
|
+
}
|
|
26228
|
+
}
|
|
26229
|
+
.wds-card-container--padding-none {
|
|
26230
|
+
--CardContainer-padding-block: 0px;
|
|
26231
|
+
--CardContainer-padding-inline: 0px;
|
|
26232
|
+
overflow: clip;
|
|
26233
|
+
}
|
|
26234
|
+
.wds-card-container--active {
|
|
26235
|
+
--CardContainer-background-color: var(--color-background-elevated);
|
|
26236
|
+
--CardContainer-border-color: color-mix(in srgb, var(--color-border-neutral) 25%, transparent);
|
|
26237
|
+
box-shadow: var(--CardContainer-shadow);
|
|
26238
|
+
}
|
|
26239
|
+
.wds-card-container--inactive {
|
|
26240
|
+
--CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
26241
|
+
border-width: 0;
|
|
26242
|
+
padding-block: calc(var(--CardContainer-padding-block) + 1px);
|
|
26243
|
+
padding-inline: calc(var(--CardContainer-padding-inline) + 1px);
|
|
26244
|
+
position: relative;
|
|
26245
|
+
}
|
|
26246
|
+
.wds-card-container--interactive:has(
|
|
26247
|
+
> a[href]:hover,
|
|
26248
|
+
> button:enabled:hover,
|
|
26249
|
+
> a[href]:focus-visible,
|
|
26250
|
+
> button:enabled:focus-visible
|
|
26251
|
+
).wds-card-container--active {
|
|
26252
|
+
--CardContainer-border-color: color-mix(in srgb, var(--color-border-neutral) 75%, transparent);
|
|
26253
|
+
}
|
|
26254
|
+
.wds-card-container--interactive:has(
|
|
26255
|
+
> a[href]:hover,
|
|
26256
|
+
> button:enabled:hover,
|
|
26257
|
+
> a[href]:focus-visible,
|
|
26258
|
+
> button:enabled:focus-visible
|
|
26259
|
+
).wds-card-container--inactive {
|
|
26260
|
+
--CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
26261
|
+
}
|
|
26262
|
+
.wds-card-container--interactive:has(> a[href]:active, > button:enabled:active).wds-card-container--active {
|
|
26263
|
+
--CardContainer-border-color: var(--color-border-neutral);
|
|
26264
|
+
}
|
|
26265
|
+
.wds-card-container--interactive:has(> a[href]:active, > button:enabled:active).wds-card-container--inactive {
|
|
26266
|
+
--CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
26267
|
+
}
|
|
26268
|
+
.wds-card-container__border {
|
|
26269
|
+
container-type: size;
|
|
26270
|
+
inset: 0;
|
|
26271
|
+
pointer-events: none;
|
|
26272
|
+
position: absolute;
|
|
26273
|
+
}
|
|
26274
|
+
.wds-card-container__border svg {
|
|
26275
|
+
display: block;
|
|
26276
|
+
block-size: 100%;
|
|
26277
|
+
inline-size: 100%;
|
|
26278
|
+
}
|
|
26279
|
+
.wds-card-container__border rect {
|
|
26280
|
+
--CardContainer-border-dash-size: calc(var(--size-12) * 0.5);
|
|
26281
|
+
--CardContainer-border-stroke-radius: calc(min(var(--CardContainer-border-radius), 50cqh, 50cqw) - 0.5px);
|
|
26282
|
+
fill: none;
|
|
26283
|
+
block-size: calc(100% - 1px);
|
|
26284
|
+
rx: var(--CardContainer-border-stroke-radius);
|
|
26285
|
+
ry: var(--CardContainer-border-stroke-radius);
|
|
26286
|
+
stroke: var(--color-border-neutral);
|
|
26287
|
+
stroke-dasharray: var(--CardContainer-border-dash-size) var(--CardContainer-border-dash-size);
|
|
26288
|
+
inline-size: calc(100% - 1px);
|
|
26289
|
+
x: 0.5px;
|
|
26290
|
+
y: 0.5px;
|
|
26291
|
+
}
|
|
26292
|
+
/**
|
|
26293
|
+
* The active spotlight's resting shadow, only designed for the light themes. Set on every theme
|
|
26294
|
+
* root, as a nested ThemeProvider renders its own, so a card follows its nearest theme: a dark or
|
|
26295
|
+
* green provider inside a light one turns the shadow off.
|
|
26296
|
+
*
|
|
26297
|
+
* There is no shadow or elevation token in @transferwise/neptune-tokens, so the value is
|
|
26298
|
+
* component-scoped for now, the way PromoCard scopes `--Card-box-shadow`. It is the "Card Active
|
|
26299
|
+
* shadow" effect style from Figma: `#0e0f0c` at 4%, kept literal so it doesn't drift with a
|
|
26300
|
+
* theme's tokens. Collapses to a token reference once one is minted.
|
|
26301
|
+
*/
|
|
26302
|
+
.np-theme-personal {
|
|
26303
|
+
--CardContainer-theme-shadow: 0 2px 12px rgba(14, 15, 12, 0.04), 0 2px 32px rgba(14, 15, 12, 0.04);
|
|
26304
|
+
}
|
|
26305
|
+
.np-theme-personal.np-theme-personal--dark,
|
|
26306
|
+
.np-theme-personal.np-theme-personal--bright-green,
|
|
26307
|
+
.np-theme-personal.np-theme-personal--forest-green,
|
|
26308
|
+
.np-theme-personal.np-theme-business--dark,
|
|
26309
|
+
.np-theme-personal.np-theme-business--bright-green,
|
|
26310
|
+
.np-theme-personal.np-theme-business--forest-green,
|
|
26311
|
+
.np-theme-personal.np-theme-platform--forest-green {
|
|
26312
|
+
--CardContainer-theme-shadow: none;
|
|
26313
|
+
}
|
|
26314
|
+
.wds-card-widget {
|
|
26315
|
+
--CardWidget-inset: var(--size-8);
|
|
26316
|
+
--CardWidget-header-spacing: var(--size-8);
|
|
26317
|
+
--CardWidget-actions-gap: var(--size-8);
|
|
26318
|
+
}
|
|
26319
|
+
.wds-card-widget__header {
|
|
26320
|
+
align-items: center;
|
|
26321
|
+
-moz-column-gap: var(--size-24);
|
|
26322
|
+
column-gap: var(--size-24);
|
|
26323
|
+
container-type: inline-size;
|
|
26324
|
+
display: flex;
|
|
26325
|
+
flex-wrap: wrap;
|
|
26326
|
+
padding-inline-start: var(--CardWidget-inset);
|
|
26327
|
+
row-gap: var(--size-8);
|
|
26328
|
+
}
|
|
26329
|
+
.wds-card-widget__header + .wds-card-widget__content {
|
|
26330
|
+
margin-block-start: var(--CardWidget-header-spacing);
|
|
26331
|
+
}
|
|
26332
|
+
.wds-card-widget__title {
|
|
26333
|
+
align-items: center;
|
|
26334
|
+
color: var(--color-content-secondary);
|
|
26335
|
+
display: grid;
|
|
26336
|
+
flex: 1 1 0;
|
|
26337
|
+
margin: 0;
|
|
26338
|
+
min-block-size: var(--size-32);
|
|
26339
|
+
}
|
|
26340
|
+
@container (width <= 360px) {
|
|
26341
|
+
.wds-card-widget__title {
|
|
26342
|
+
flex-basis: auto;
|
|
26343
|
+
}
|
|
26344
|
+
}
|
|
26345
|
+
.wds-card-widget__title-link.np-link {
|
|
26346
|
+
color: inherit;
|
|
26347
|
+
display: inline;
|
|
26348
|
+
font: inherit;
|
|
26349
|
+
justify-self: start;
|
|
26350
|
+
letter-spacing: inherit;
|
|
26351
|
+
text-align: start;
|
|
26352
|
+
-webkit-text-decoration: none;
|
|
26353
|
+
text-decoration: none;
|
|
26354
|
+
}
|
|
26355
|
+
.wds-card-widget__title-link.np-link:hover,
|
|
26356
|
+
.wds-card-widget__title-link.np-link:focus-visible {
|
|
26357
|
+
-webkit-text-decoration: underline;
|
|
26358
|
+
text-decoration: underline;
|
|
26359
|
+
}
|
|
26360
|
+
.wds-card-widget__title-link.np-link .tw-icon {
|
|
26361
|
+
display: inline-block;
|
|
26362
|
+
vertical-align: text-bottom;
|
|
26363
|
+
}
|
|
26364
|
+
.wds-card-widget__title-link.np-link .wds-card-widget__title-chevron {
|
|
26365
|
+
white-space: nowrap;
|
|
26366
|
+
}
|
|
26367
|
+
.wds-card-widget__title-link.np-link .wds-card-widget__title-chevron .tw-icon {
|
|
26368
|
+
margin: 0;
|
|
26369
|
+
}
|
|
26370
|
+
.wds-card-widget__actions {
|
|
26371
|
+
align-self: start;
|
|
26372
|
+
align-items: center;
|
|
26373
|
+
display: flex;
|
|
26374
|
+
flex: none;
|
|
26375
|
+
gap: var(--CardWidget-actions-gap);
|
|
26376
|
+
}
|
|
26377
|
+
.wds-card-widget--with-header .wds-card-widget__content {
|
|
26378
|
+
padding-inline: var(--CardWidget-inset);
|
|
26379
|
+
}
|
|
26380
|
+
.wds-card-widget:has(.wds-card-widget__title-link:hover, .wds-card-widget__title-link:focus-visible).wds-card-container--active {
|
|
26381
|
+
--CardContainer-border-color: color-mix(in srgb, var(--color-border-neutral) 75%, transparent);
|
|
26382
|
+
}
|
|
26383
|
+
.wds-card-widget:has(.wds-card-widget__title-link:hover, .wds-card-widget__title-link:focus-visible).wds-card-container--inactive {
|
|
26384
|
+
--CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
26385
|
+
}
|
|
26386
|
+
.wds-card-widget:has(.wds-card-widget__title-link:active).wds-card-container--active {
|
|
26387
|
+
--CardContainer-border-color: var(--color-border-neutral);
|
|
26388
|
+
}
|
|
26389
|
+
.wds-card-widget:has(.wds-card-widget__title-link:active).wds-card-container--inactive {
|
|
26390
|
+
--CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
26391
|
+
}
|
|
26206
26392
|
.critical-comms {
|
|
26207
26393
|
border-radius: var(--radius-medium);
|
|
26208
26394
|
overflow: hidden;
|
|
@@ -29190,6 +29376,14 @@ button.np-option {
|
|
|
29190
29376
|
padding-inline: 0;
|
|
29191
29377
|
container-type: inline-size;
|
|
29192
29378
|
}
|
|
29379
|
+
.wds-list-item-paddingY-8 {
|
|
29380
|
+
padding-block: var(--size-8);
|
|
29381
|
+
padding-inline: 0;
|
|
29382
|
+
}
|
|
29383
|
+
.wds-list-item-paddingY-16 {
|
|
29384
|
+
padding-block: var(--size-16);
|
|
29385
|
+
padding-inline: 0;
|
|
29386
|
+
}
|
|
29193
29387
|
.wds-list-item-paddingY-24 {
|
|
29194
29388
|
padding-block: var(--size-24);
|
|
29195
29389
|
padding-inline: 0;
|
package/src/main.less
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
@import "./PocketSurface/PocketSurface.less";
|
|
5
5
|
|
|
6
6
|
@import "./Container/Container.less";
|
|
7
|
+
@import "./CardContainer/CardContainer.less";
|
|
8
|
+
@import "./CardWidget/CardWidget.less";
|
|
7
9
|
@import "./_deprecated/CriticalBanner/CriticalCommsBanner.less";
|
|
8
10
|
@import "./Accordion/Accordion.less";
|
|
9
11
|
@import "./_deprecated/ActionButton/ActionButton.less";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
|
-
<Meta title="Navigation/FlowNavigation/Critical Banner Guide" />
|
|
4
|
-
|
|
5
|
-
# Critical Banner in FlowNavigation
|
|
6
|
-
|
|
7
|
-
The `FlowNavigation` component supports displaying critical banners above the navigation, by passing a `banner` prop.
|
|
8
|
-
|
|
9
|
-
`banner` accepts either the internal `CriticalBannerProps` shape, or the legacy backend `CriticalBannerData` shape (e.g. as received from `navigation-service`/`navigation-ui`) — `FlowNavigation` maps the legacy shape to `CriticalBannerProps` internally, so no manual mapping is required.
|
|
10
|
-
|
|
11
|
-
## Basic Usage
|
|
12
|
-
|
|
13
|
-
When you're using `FlowNavigation` directly from `@transferwise/components`.
|
|
14
|
-
|
|
15
|
-
<Source
|
|
16
|
-
code={`import { FlowNavigation, CriticalBannerProps } from '@transferwise/components';
|
|
17
|
-
|
|
18
|
-
const banner: CriticalBannerProps = {
|
|
19
|
-
sentiment: 'negative',
|
|
20
|
-
title: 'Action required',
|
|
21
|
-
description: 'Please verify your identity to continue with this transfer.',
|
|
22
|
-
action: {
|
|
23
|
-
label: 'Verify now',
|
|
24
|
-
onClick: () => {
|
|
25
|
-
// Handle action
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
<FlowNavigation
|
|
31
|
-
banner={banner}
|
|
32
|
-
steps={steps}
|
|
33
|
-
activeStep={activeStep}
|
|
34
|
-
avatar={avatar}
|
|
35
|
-
onClose={onClose}
|
|
36
|
-
/>;
|
|
37
|
-
`}
|
|
38
|
-
language="typescript"
|
|
39
|
-
dark
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
## Using Legacy Backend Data
|
|
43
|
-
|
|
44
|
-
If your application receives banner data from a backend service (e.g. navigation-ui) in the legacy shape, you can pass it directly to `banner` — `FlowNavigation` maps it to the internal `CriticalBannerProps` shape automatically.
|
|
45
|
-
|
|
46
|
-
<Source
|
|
47
|
-
code={`import { FlowNavigation, CriticalBannerData } from '@transferwise/components';
|
|
48
|
-
|
|
49
|
-
const banner: CriticalBannerData = {
|
|
50
|
-
id: 'banner-123',
|
|
51
|
-
title: 'Your account requires attention', // Rendered as the banner description
|
|
52
|
-
subtitle: 'Action required', // Rendered as the banner title
|
|
53
|
-
style: 'WARNING',
|
|
54
|
-
action: { label: 'Take action', href: '/action' },
|
|
55
|
-
collapsed: false, // Rendered expanded
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
<FlowNavigation
|
|
59
|
-
banner={banner}
|
|
60
|
-
steps={steps}
|
|
61
|
-
activeStep={activeStep}
|
|
62
|
-
/>;
|
|
63
|
-
`}
|
|
64
|
-
language="typescript"
|
|
65
|
-
dark
|
|
66
|
-
/>
|