@transferwise/components 46.88.2 → 46.89.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/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +19 -3
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +19 -3
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +23 -20
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +20 -17
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatar/avatarTypes.js +3 -1
- package/build/avatar/avatarTypes.js.map +1 -1
- package/build/avatar/avatarTypes.mjs +3 -1
- package/build/avatar/avatarTypes.mjs.map +1 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js +2 -2
- package/build/button/Button.mjs +2 -2
- package/build/button/LegacyButton.js.map +1 -1
- package/build/button/LegacyButton.mjs.map +1 -1
- package/build/carousel/Carousel.js +9 -8
- package/build/carousel/Carousel.js.map +1 -1
- package/build/carousel/Carousel.mjs +9 -8
- package/build/carousel/Carousel.mjs.map +1 -1
- package/build/common/action/Action.js +26 -15
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +26 -15
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.js +2 -1
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +2 -1
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +10 -73
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +11 -74
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/iconButton/IconButton.js +2 -2
- package/build/iconButton/IconButton.js.map +1 -1
- package/build/iconButton/IconButton.mjs +2 -2
- package/build/iconButton/IconButton.mjs.map +1 -1
- package/build/link/Link.js +2 -2
- package/build/link/Link.mjs +2 -2
- package/build/main.css +50 -75
- package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.js.map +1 -0
- package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.mjs.map +1 -0
- package/build/primitives/PrimitiveButton/{src/PrimitiveButton.js → PrimitiveButton.js} +1 -1
- package/build/primitives/PrimitiveButton/PrimitiveButton.js.map +1 -0
- package/build/primitives/PrimitiveButton/{src/PrimitiveButton.mjs → PrimitiveButton.mjs} +1 -1
- package/build/primitives/PrimitiveButton/PrimitiveButton.mjs.map +1 -0
- package/build/styles/actionOption/ActionOption.css +4 -0
- package/build/styles/alert/Alert.css +4 -0
- package/build/styles/carousel/Carousel.css +0 -8
- package/build/styles/common/closeButton/CloseButton.css +15 -0
- package/build/styles/criticalBanner/CriticalCommsBanner.css +33 -73
- package/build/styles/main.css +50 -75
- package/build/table/TableCell.js +7 -1
- package/build/table/TableCell.js.map +1 -1
- package/build/table/TableCell.mjs +7 -1
- package/build/table/TableCell.mjs.map +1 -1
- package/build/test-utils/assets/wise-card.svg +1 -0
- package/build/types/actionButton/ActionButton.d.ts +6 -0
- package/build/types/actionButton/ActionButton.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +2 -1
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/alert/Alert.d.ts +3 -4
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/avatarTypes.d.ts +3 -0
- package/build/types/avatar/avatarTypes.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +3 -0
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/button/LegacyButton.d.ts +27 -0
- package/build/types/button/LegacyButton.d.ts.map +1 -1
- package/build/types/carousel/Carousel.d.ts.map +1 -1
- package/build/types/common/action/Action.d.ts +5 -2
- package/build/types/common/action/Action.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +3 -3
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +2 -2
- package/build/types/iconButton/IconButton.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.d.ts → PrimitiveAnchor.d.ts} +1 -1
- package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.types.d.ts → PrimitiveAnchor.types.d.ts} +1 -1
- package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveAnchor/index.d.ts +2 -2
- package/build/types/primitives/PrimitiveAnchor/index.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.d.ts → PrimitiveButton.d.ts} +1 -1
- package/build/types/primitives/PrimitiveButton/PrimitiveButton.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.types.d.ts → PrimitiveButton.types.d.ts} +1 -1
- package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -0
- package/build/types/primitives/PrimitiveButton/index.d.ts +2 -2
- package/build/types/primitives/PrimitiveButton/index.d.ts.map +1 -1
- package/build/types/table/TableCell.d.ts +6 -3
- package/build/types/table/TableCell.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/actionButton/ActionButton.story.tsx +6 -1
- package/src/actionButton/ActionButton.tsx +6 -0
- package/src/actionOption/ActionOption.css +4 -0
- package/src/actionOption/ActionOption.less +5 -0
- package/src/actionOption/ActionOption.story.tsx +9 -6
- package/src/actionOption/ActionOption.tsx +29 -5
- package/src/alert/Alert.css +4 -0
- package/src/alert/Alert.less +4 -0
- package/src/alert/Alert.spec.tsx +0 -30
- package/src/alert/Alert.story.tsx +74 -2
- package/src/alert/Alert.tsx +18 -21
- package/src/avatar/Avatar.tsx +3 -0
- package/src/avatar/avatarTypes.ts +3 -1
- package/src/badge/Badge.tsx +3 -0
- package/src/button/LegacyButton.tsx +27 -0
- package/src/carousel/Carousel.css +0 -8
- package/src/carousel/Carousel.less +0 -7
- package/src/carousel/Carousel.spec.tsx +2 -2
- package/src/carousel/Carousel.tsx +11 -10
- package/src/common/action/Action.tsx +40 -22
- package/src/common/closeButton/CloseButton.css +15 -0
- package/src/common/closeButton/CloseButton.less +10 -0
- package/src/common/closeButton/CloseButton.tsx +4 -3
- package/src/criticalBanner/CriticalCommsBanner.css +33 -73
- package/src/criticalBanner/CriticalCommsBanner.less +37 -64
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +26 -4
- package/src/criticalBanner/CriticalCommsBanner.tsx +8 -50
- package/src/iconButton/IconButton.tsx +4 -1
- package/src/main.css +50 -75
- package/src/main.less +1 -0
- package/src/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.tsx → PrimitiveAnchor.tsx} +1 -1
- package/src/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.types.ts → PrimitiveAnchor.types.ts} +1 -1
- package/src/primitives/PrimitiveAnchor/index.ts +6 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
- package/src/primitives/PrimitiveButton/{src/PrimitiveButton.tsx → PrimitiveButton.tsx} +2 -2
- package/src/primitives/PrimitiveButton/{src/PrimitiveButton.types.ts → PrimitiveButton.types.ts} +1 -1
- package/src/primitives/PrimitiveButton/index.ts +6 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +1 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +1 -1
- package/src/table/Table.story.tsx +59 -1
- package/src/table/TableCell.spec.tsx +17 -0
- package/src/table/TableCell.tsx +14 -5
- package/src/test-utils/assets/wise-card.svg +1 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +0 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +0 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +0 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +0 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveAnchor/src/index.d.ts +0 -3
- package/build/types/primitives/PrimitiveAnchor/src/index.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.types.d.ts.map +0 -1
- package/build/types/primitives/PrimitiveButton/src/index.d.ts +0 -3
- package/build/types/primitives/PrimitiveButton/src/index.d.ts.map +0 -1
- package/src/primitives/PrimitiveAnchor/src/index.ts +0 -6
- package/src/primitives/PrimitiveButton/src/index.ts +0 -6
- /package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.js → PrimitiveAnchor.js} +0 -0
- /package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.mjs → PrimitiveAnchor.mjs} +0 -0
package/src/alert/Alert.tsx
CHANGED
|
@@ -2,14 +2,7 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
import Body from '../body/Body';
|
|
5
|
-
import {
|
|
6
|
-
CloseButton,
|
|
7
|
-
Sentiment,
|
|
8
|
-
Size,
|
|
9
|
-
Typography,
|
|
10
|
-
Variant,
|
|
11
|
-
WDS_LIVE_REGION_DELAY_MS,
|
|
12
|
-
} from '../common';
|
|
5
|
+
import { CloseButton, Sentiment, Size, Typography, WDS_LIVE_REGION_DELAY_MS } from '../common';
|
|
13
6
|
|
|
14
7
|
import StatusIcon from '../statusIcon';
|
|
15
8
|
import Title from '../title/Title';
|
|
@@ -32,6 +25,7 @@ type AlertTypeResolved = `${
|
|
|
32
25
|
| Sentiment.POSITIVE
|
|
33
26
|
| Sentiment.NEUTRAL
|
|
34
27
|
| Sentiment.WARNING
|
|
28
|
+
| Sentiment.PENDING
|
|
35
29
|
| Sentiment.NEGATIVE}`;
|
|
36
30
|
export type AlertType = AlertTypeResolved | AlertTypeDeprecated;
|
|
37
31
|
|
|
@@ -63,7 +57,6 @@ export interface AlertProps {
|
|
|
63
57
|
onDismiss?: React.MouseEventHandler<HTMLButtonElement>;
|
|
64
58
|
/** The type dictates which icon and colour will be used */
|
|
65
59
|
type?: AlertType;
|
|
66
|
-
variant?: `${Variant}`;
|
|
67
60
|
/** @deprecated Use `InlineAlert` instead. */
|
|
68
61
|
arrow?: `${AlertArrowPosition}`;
|
|
69
62
|
/** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */
|
|
@@ -96,7 +89,6 @@ export default function Alert({
|
|
|
96
89
|
message,
|
|
97
90
|
title,
|
|
98
91
|
type = 'neutral',
|
|
99
|
-
variant = 'desktop',
|
|
100
92
|
arrow,
|
|
101
93
|
children,
|
|
102
94
|
size,
|
|
@@ -186,15 +178,10 @@ export default function Alert({
|
|
|
186
178
|
}}
|
|
187
179
|
onTouchMove={() => setShouldFire(false)}
|
|
188
180
|
>
|
|
189
|
-
<div
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
>
|
|
193
|
-
{icon ? (
|
|
194
|
-
<div className="alert__icon">{icon}</div>
|
|
195
|
-
) : (
|
|
196
|
-
<StatusIcon size={Size.LARGE} sentiment={resolvedType} iconLabel={statusIconLabel} />
|
|
197
|
-
)}
|
|
181
|
+
<div className="alert__icon">
|
|
182
|
+
{icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}
|
|
183
|
+
</div>
|
|
184
|
+
<div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>
|
|
198
185
|
<div className="alert__message">
|
|
199
186
|
<div>
|
|
200
187
|
{title && (
|
|
@@ -206,11 +193,21 @@ export default function Alert({
|
|
|
206
193
|
{children || <InlineMarkdown>{message}</InlineMarkdown>}
|
|
207
194
|
</Body>
|
|
208
195
|
</div>
|
|
209
|
-
{action &&
|
|
196
|
+
{action && (
|
|
197
|
+
<Action
|
|
198
|
+
action={action}
|
|
199
|
+
variant="action-button"
|
|
200
|
+
className="alert__action"
|
|
201
|
+
sentiment="default"
|
|
202
|
+
priority="secondary-neutral"
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
210
205
|
</div>
|
|
211
206
|
</div>
|
|
212
207
|
{onDismiss && (
|
|
213
|
-
<
|
|
208
|
+
<div className="alert__close">
|
|
209
|
+
<CloseButton ref={closeButtonReference} size="xs" onClick={onDismiss} />
|
|
210
|
+
</div>
|
|
214
211
|
)}
|
|
215
212
|
</div>
|
|
216
213
|
</div>
|
package/src/avatar/Avatar.tsx
CHANGED
|
@@ -15,6 +15,9 @@ export type AvatarTheme = 'light' | 'dark';
|
|
|
15
15
|
|
|
16
16
|
export type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated `Avatar` is deprecated please use `AvatarView` instead
|
|
20
|
+
*/
|
|
18
21
|
export interface AvatarProps {
|
|
19
22
|
backgroundColor?: string;
|
|
20
23
|
backgroundColorSeed?: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `Avatar` is deprecated please use `AvatarView` instead
|
|
3
|
+
*/
|
|
2
4
|
export enum AvatarType {
|
|
3
5
|
THUMBNAIL = 'thumbnail',
|
|
4
6
|
ICON = 'icon',
|
package/src/badge/Badge.tsx
CHANGED
|
@@ -18,6 +18,9 @@ import { BadgeAssetsProps } from '.';
|
|
|
18
18
|
*/
|
|
19
19
|
type DeprecatedSizes = SizeSmall | SizeMedium | SizeLarge;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated `Badge` is deprecated please use `<AvatarView badge={..} />` instead
|
|
23
|
+
*/
|
|
21
24
|
export type BadgeProps = {
|
|
22
25
|
badge: ReactNode;
|
|
23
26
|
children: ReactNode;
|
|
@@ -30,6 +30,15 @@ type DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';
|
|
|
30
30
|
/** @deprecated */
|
|
31
31
|
type DeprecatedSizes = SizeExtraSmall;
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use new button instead APIs
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* import { Button, ButtonProps } from '@transferwise/components';
|
|
38
|
+
*
|
|
39
|
+
* <Button v2>...</Button>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
33
42
|
export type CommonProps = {
|
|
34
43
|
v2?: false;
|
|
35
44
|
|
|
@@ -60,10 +69,28 @@ export type CommonProps = {
|
|
|
60
69
|
htmlType?: 'submit' | 'reset' | 'button';
|
|
61
70
|
};
|
|
62
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated use new button instead APIs
|
|
74
|
+
* @example
|
|
75
|
+
* ```
|
|
76
|
+
* import { Button, ButtonProps } from '@transferwise/components';
|
|
77
|
+
*
|
|
78
|
+
* <Button v2>...</Button>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
63
81
|
export type ButtonProps = CommonProps & Omit<React.ComponentPropsWithRef<'button'>, 'type'>;
|
|
64
82
|
|
|
65
83
|
type AnchorProps = CommonProps & Omit<React.ComponentPropsWithRef<'a'>, 'type'>;
|
|
66
84
|
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated use new button instead APIs
|
|
87
|
+
* @example
|
|
88
|
+
* ```
|
|
89
|
+
* import { Button, ButtonProps } from '@transferwise/components';
|
|
90
|
+
*
|
|
91
|
+
* <Button v2>...</Button>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
67
94
|
export type LegacyButtonProps = ButtonProps | AnchorProps;
|
|
68
95
|
|
|
69
96
|
/**
|
|
@@ -99,14 +99,6 @@
|
|
|
99
99
|
padding: 24px;
|
|
100
100
|
padding: var(--size-24);
|
|
101
101
|
}
|
|
102
|
-
.carousel__scroll-button {
|
|
103
|
-
width: 32px;
|
|
104
|
-
width: var(--size-32);
|
|
105
|
-
height: 32px;
|
|
106
|
-
height: var(--size-32);
|
|
107
|
-
align-items: center;
|
|
108
|
-
justify-content: center;
|
|
109
|
-
}
|
|
110
102
|
.carousel__indicators {
|
|
111
103
|
display: flex;
|
|
112
104
|
justify-content: center;
|
|
@@ -107,13 +107,6 @@
|
|
|
107
107
|
padding: var(--size-24);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.carousel__scroll-button {
|
|
111
|
-
width: var(--size-32);
|
|
112
|
-
height: var(--size-32);
|
|
113
|
-
align-items: center;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
110
|
.carousel__indicators {
|
|
118
111
|
display: flex;
|
|
119
112
|
justify-content: center;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { fireEvent, render, screen } from '
|
|
2
|
-
import { userEvent } from '../test-utils';
|
|
1
|
+
import { userEvent, fireEvent, render, screen, mockMatchMedia } from '../test-utils';
|
|
3
2
|
|
|
4
3
|
import Display from '../display';
|
|
5
4
|
import Title from '../title';
|
|
6
5
|
|
|
7
6
|
import Carousel, { type CarouselCard } from './Carousel';
|
|
8
7
|
|
|
8
|
+
mockMatchMedia();
|
|
9
9
|
jest.mock('@wise/components-theming', () => ({
|
|
10
10
|
...jest.requireActual<Record<string, unknown>>('@wise/components-theming'),
|
|
11
11
|
useTheme: jest.fn().mockReturnValue({ theme: 'personal' }),
|
|
@@ -2,7 +2,7 @@ import { ChevronLeft, ChevronRight } from '@transferwise/icons';
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import IconButton from '../iconButton';
|
|
6
6
|
import Title from '../title';
|
|
7
7
|
import type { PromoCardLinkProps } from '../promoCard/PromoCard';
|
|
8
8
|
import PromoCard from '../promoCard/PromoCard';
|
|
@@ -169,29 +169,30 @@ const Carousel: React.FC<CarouselProps> = ({ header, className, cards, onClick }
|
|
|
169
169
|
header
|
|
170
170
|
)}
|
|
171
171
|
{areActionButtonsEnabled ? (
|
|
172
|
-
<div className="hidden-xs">
|
|
173
|
-
<
|
|
174
|
-
|
|
172
|
+
<div className="hidden-xs d-inline-flex">
|
|
173
|
+
<IconButton
|
|
174
|
+
size={32}
|
|
175
175
|
tabIndex={-1}
|
|
176
|
-
priority="
|
|
176
|
+
priority="tertiary"
|
|
177
177
|
disabled={!isLeftActionButtonEnabled}
|
|
178
178
|
aria-hidden="true"
|
|
179
179
|
data-testid="scroll-carousel-left"
|
|
180
180
|
onClick={() => scrollCarousel('left')}
|
|
181
181
|
>
|
|
182
182
|
<ChevronLeft />
|
|
183
|
-
</
|
|
184
|
-
<
|
|
183
|
+
</IconButton>
|
|
184
|
+
<IconButton
|
|
185
|
+
size={32}
|
|
185
186
|
tabIndex={-1}
|
|
186
|
-
className="
|
|
187
|
-
priority="
|
|
187
|
+
className="m-l-1"
|
|
188
|
+
priority="tertiary"
|
|
188
189
|
aria-hidden="true"
|
|
189
190
|
data-testid="scroll-carousel-right"
|
|
190
191
|
disabled={scrollIsAtEnd}
|
|
191
192
|
onClick={() => scrollCarousel()}
|
|
192
193
|
>
|
|
193
194
|
<ChevronRight />
|
|
194
|
-
</
|
|
195
|
+
</IconButton>
|
|
195
196
|
</div>
|
|
196
197
|
) : null}
|
|
197
198
|
</div>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import Link from '../../link';
|
|
3
3
|
import { Typography } from '../propsValues/typography';
|
|
4
|
-
import ActionButton from '../../actionButton';
|
|
5
4
|
import { Priority } from '../propsValues/control';
|
|
5
|
+
import Button from '../../button';
|
|
6
|
+
import { ButtonPriority, ButtonSentiment } from '../../button/Button.types';
|
|
6
7
|
|
|
7
8
|
export type ActionOptions = {
|
|
8
9
|
'aria-label'?: string;
|
|
@@ -13,12 +14,20 @@ export type ActionOptions = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
type Props = {
|
|
16
|
-
variant?: 'button' | 'action-button';
|
|
17
17
|
action: ActionOptions;
|
|
18
18
|
className?: string;
|
|
19
|
+
variant?: 'button' | 'action-button';
|
|
20
|
+
sentiment?: ButtonSentiment;
|
|
21
|
+
priority?: ButtonPriority;
|
|
19
22
|
};
|
|
20
23
|
|
|
21
|
-
export function Action({
|
|
24
|
+
export function Action({
|
|
25
|
+
action,
|
|
26
|
+
className,
|
|
27
|
+
variant = 'button',
|
|
28
|
+
sentiment = 'default',
|
|
29
|
+
priority = Priority.SECONDARY,
|
|
30
|
+
}: Props) {
|
|
22
31
|
if ('href' in action) {
|
|
23
32
|
return (
|
|
24
33
|
<Link
|
|
@@ -34,23 +43,32 @@ export function Action({ action, className, variant = 'button' }: Props) {
|
|
|
34
43
|
);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
switch (variant) {
|
|
47
|
+
case 'action-button':
|
|
48
|
+
return (
|
|
49
|
+
<Button
|
|
50
|
+
v2
|
|
51
|
+
size="sm"
|
|
52
|
+
sentiment={sentiment}
|
|
53
|
+
aria-label={action['aria-label']}
|
|
54
|
+
priority={priority}
|
|
55
|
+
className={clsx(className)}
|
|
56
|
+
onClick={action.onClick}
|
|
57
|
+
>
|
|
58
|
+
{action.text}
|
|
59
|
+
</Button>
|
|
60
|
+
);
|
|
61
|
+
case 'button':
|
|
62
|
+
default:
|
|
63
|
+
return (
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
aria-label={action['aria-label']}
|
|
67
|
+
className={clsx('btn-unstyled np-text-link-large', className)}
|
|
68
|
+
onClick={action.onClick}
|
|
69
|
+
>
|
|
70
|
+
{action.text}
|
|
71
|
+
</button>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
56
74
|
}
|
|
@@ -39,6 +39,21 @@
|
|
|
39
39
|
width: var(--size-64);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
.np-theme-personal .np-close-button--x-small {
|
|
43
|
+
height: 24px;
|
|
44
|
+
height: var(--size-24);
|
|
45
|
+
width: 24px;
|
|
46
|
+
width: var(--size-24);
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
}
|
|
49
|
+
@media (max-width: 320px) {
|
|
50
|
+
.np-theme-personal .np-close-button--x-small {
|
|
51
|
+
height: 48px;
|
|
52
|
+
height: var(--size-48);
|
|
53
|
+
width: 48px;
|
|
54
|
+
width: var(--size-48);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
42
57
|
.np-theme-personal .np-close-button--large {
|
|
43
58
|
height: 40px;
|
|
44
59
|
height: var(--size-40);
|
|
@@ -33,6 +33,16 @@
|
|
|
33
33
|
border-radius: var(--radius-full);
|
|
34
34
|
transition: background-color 0.1s ease;
|
|
35
35
|
|
|
36
|
+
&--x-small {
|
|
37
|
+
height: var(--size-24);
|
|
38
|
+
width: var(--size-24);
|
|
39
|
+
@media (--screen-400-zoom) {
|
|
40
|
+
height: var(--size-48);
|
|
41
|
+
width: var(--size-48);
|
|
42
|
+
}
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
&--large {
|
|
37
47
|
height: var(--size-40);
|
|
38
48
|
width: var(--size-40);
|
|
@@ -3,7 +3,7 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
|
|
6
|
-
import { Size, SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';
|
|
6
|
+
import { Size, SizeLarge, SizeMedium, SizeSmall, SizeExtraSmall } from '../propsValues/size';
|
|
7
7
|
|
|
8
8
|
import messages from './CloseButton.messages';
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ export type CloseButtonProps = Pick<
|
|
|
11
11
|
React.ComponentPropsWithoutRef<'button'>,
|
|
12
12
|
'aria-label' | 'className' | 'onClick'
|
|
13
13
|
> & {
|
|
14
|
-
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
14
|
+
size?: SizeExtraSmall | SizeSmall | SizeMedium | SizeLarge;
|
|
15
15
|
filled?: boolean;
|
|
16
16
|
isDisabled?: boolean;
|
|
17
17
|
testId?: string;
|
|
@@ -45,6 +45,7 @@ export const CloseButton = forwardRef(function CloseButton(
|
|
|
45
45
|
'close btn-link',
|
|
46
46
|
'text-no-decoration',
|
|
47
47
|
{
|
|
48
|
+
'np-close-button--x-small': size === Size.EXTRA_SMALL,
|
|
48
49
|
'np-close-button--large': size === Size.MEDIUM,
|
|
49
50
|
'np-close-button--x-large': size === Size.LARGE,
|
|
50
51
|
},
|
|
@@ -56,7 +57,7 @@ export const CloseButton = forwardRef(function CloseButton(
|
|
|
56
57
|
data-testid={testId}
|
|
57
58
|
onClick={onClick}
|
|
58
59
|
>
|
|
59
|
-
<Icon size={size === Size.SMALL ? 16 : 24} />
|
|
60
|
+
<Icon size={size === Size.SMALL || size === Size.EXTRA_SMALL ? 16 : 24} />
|
|
60
61
|
</button>
|
|
61
62
|
);
|
|
62
63
|
});
|
|
@@ -1,76 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
height: 48px;
|
|
31
|
-
}
|
|
32
|
-
.np-theme-personal div.critical-comms .cta-btn,
|
|
33
|
-
.np-theme-personal--dark div.critical-comms .cta-btn {
|
|
34
|
-
background-color: var(--color-contrast);
|
|
35
|
-
}
|
|
36
|
-
.np-theme-personal div.critical-comms .cta-btn:not(.disabled):not(:disabled):focus,
|
|
37
|
-
.np-theme-personal--dark div.critical-comms .cta-btn:not(.disabled):not(:disabled):focus {
|
|
38
|
-
outline-color: var(--color-contrast);
|
|
39
|
-
}
|
|
40
|
-
@media (max-width: 767px) {
|
|
41
|
-
div.critical-comms {
|
|
42
|
-
display: inline;
|
|
43
|
-
display: initial;
|
|
1
|
+
.np-theme-personal .critical-comms .alert-warning {
|
|
2
|
+
color: var(--color-contrast-overlay);
|
|
3
|
+
background-color: var(--color-sentiment-negative);
|
|
4
|
+
}
|
|
5
|
+
.np-theme-personal .critical-comms .alert-warning .np-text-title-body {
|
|
6
|
+
color: var(--color-contrast-overlay);
|
|
7
|
+
}
|
|
8
|
+
.np-theme-personal .critical-comms .status-circle.warning {
|
|
9
|
+
background-color: #ffffff;
|
|
10
|
+
background-color: var(--color-background-screen);
|
|
11
|
+
}
|
|
12
|
+
.np-theme-personal .critical-comms .status-circle.warning .status-icon {
|
|
13
|
+
color: var(--color-contrast-theme);
|
|
14
|
+
}
|
|
15
|
+
.np-theme-personal .critical-comms .alert__message .alert__action {
|
|
16
|
+
margin-top: 16px;
|
|
17
|
+
margin-top: var(--size-16);
|
|
18
|
+
}
|
|
19
|
+
.np-theme-personal .critical-comms .wds-Button {
|
|
20
|
+
--Button-background: var(--color-contrast-overlay);
|
|
21
|
+
--Button-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
22
|
+
--Button-background-active: var(--color-sentiment-negative-secondary-active);
|
|
23
|
+
}
|
|
24
|
+
@media (min-width: 768px) {
|
|
25
|
+
.np-theme-personal .critical-comms .alert-warning .alert__message {
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
align-items: center;
|
|
29
|
+
width: 100%;
|
|
44
30
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
div.critical-comms .critical-comms--subtitle {
|
|
50
|
-
color: var(--critical-comms-subtitle-color);
|
|
51
|
-
}
|
|
52
|
-
div.critical-comms .critical-comms--cta {
|
|
53
|
-
padding-left: 0;
|
|
54
|
-
}
|
|
55
|
-
@media (max-width: 767px) {
|
|
56
|
-
div.critical-comms .critical-comms--cta {
|
|
57
|
-
padding-left: var(--critical-comms-subtitle-color-padding-left);
|
|
58
|
-
padding-top: var(--critical-comms-vertical-spacing);
|
|
59
|
-
min-width: 100%;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
div.critical-comms .critical-comms-body {
|
|
63
|
-
display: flex;
|
|
64
|
-
width: 100%;
|
|
65
|
-
}
|
|
66
|
-
@media (max-width: 767px) {
|
|
67
|
-
div.critical-comms .critical-comms-body {
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
@media (max-width: 767px) {
|
|
72
|
-
div.critical-comms .critical-comms-content {
|
|
73
|
-
padding-top: var(--critical-comms-vertical-spacing);
|
|
74
|
-
flex-wrap: wrap;
|
|
31
|
+
.np-theme-personal .critical-comms .alert-warning .alert__message .alert__action {
|
|
32
|
+
margin-top: 0;
|
|
33
|
+
margin-left: 16px;
|
|
34
|
+
margin-left: var(--padding-small);
|
|
75
35
|
}
|
|
76
36
|
}
|
|
@@ -1,78 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.np-theme-personal--dark & {
|
|
10
|
-
--critical-comms-background-color: var(--color-sentiment-negative);
|
|
11
|
-
--critical-comms-title-color: var(--color-contrast);
|
|
12
|
-
--critical-comms-subtitle-color: var(--color-contrast);
|
|
13
|
-
--critical-comms-subtitle-color-padding-left: 0;
|
|
14
|
-
--critical-comms-vertical-spacing: var(--size-16);
|
|
15
|
-
|
|
16
|
-
padding: var(--padding-medium);
|
|
17
|
-
|
|
18
|
-
.tw-icon-alert-circle-fill {
|
|
19
|
-
color: var(--color-contrast);
|
|
20
|
-
|
|
21
|
-
svg {
|
|
22
|
-
width: 48px;
|
|
23
|
-
height: 48px;
|
|
1
|
+
.np-theme-personal {
|
|
2
|
+
.critical-comms {
|
|
3
|
+
.alert-warning {
|
|
4
|
+
color: var(--color-contrast-overlay);
|
|
5
|
+
background-color: var(--color-sentiment-negative);
|
|
6
|
+
|
|
7
|
+
.np-text-title-body {
|
|
8
|
+
color: var(--color-contrast-overlay);
|
|
24
9
|
}
|
|
25
10
|
}
|
|
26
11
|
|
|
27
|
-
.
|
|
28
|
-
background-color: var(--color-
|
|
12
|
+
.status-circle.warning {
|
|
13
|
+
background-color: var(--color-background-screen);
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
.status-icon {
|
|
16
|
+
color: var(--color-contrast-theme);
|
|
32
17
|
}
|
|
33
18
|
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
background-color: var(--critical-comms-background-color);
|
|
37
|
-
display: flex;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
align-items: center;
|
|
40
|
-
|
|
41
|
-
@media (--screen-sm-max) {
|
|
42
|
-
display: initial;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.critical-comms--title {
|
|
46
|
-
color: var(--critical-comms-title-color);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.critical-comms--subtitle {
|
|
50
|
-
color: var(--critical-comms-subtitle-color);
|
|
51
|
-
}
|
|
52
19
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding-left: var(--critical-comms-subtitle-color-padding-left);
|
|
58
|
-
padding-top: var(--critical-comms-vertical-spacing);
|
|
59
|
-
min-width: 100%;
|
|
20
|
+
.alert__message {
|
|
21
|
+
.alert__action {
|
|
22
|
+
margin-top: var(--size-16);
|
|
23
|
+
}
|
|
60
24
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.critical-comms-body {
|
|
64
|
-
display: flex;
|
|
65
|
-
width: 100%;
|
|
66
25
|
|
|
67
|
-
|
|
68
|
-
|
|
26
|
+
.wds-Button {
|
|
27
|
+
--Button-background: var(--color-contrast-overlay);
|
|
28
|
+
--Button-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
29
|
+
--Button-background-active: var(--color-sentiment-negative-secondary-active);
|
|
69
30
|
}
|
|
70
31
|
}
|
|
71
32
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
33
|
+
|
|
34
|
+
@media (--screen-md) {
|
|
35
|
+
.critical-comms {
|
|
36
|
+
.alert-warning {
|
|
37
|
+
.alert__message {
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
|
|
43
|
+
.alert__action {
|
|
44
|
+
margin-top: 0;
|
|
45
|
+
margin-left: var(--padding-small);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
76
49
|
}
|
|
77
50
|
}
|
|
78
|
-
}
|
|
51
|
+
}
|