@transferwise/components 46.88.1 → 46.89.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.
Files changed (162) hide show
  1. package/build/actionButton/ActionButton.js.map +1 -1
  2. package/build/actionButton/ActionButton.mjs.map +1 -1
  3. package/build/actionOption/ActionOption.js +19 -3
  4. package/build/actionOption/ActionOption.js.map +1 -1
  5. package/build/actionOption/ActionOption.mjs +19 -3
  6. package/build/actionOption/ActionOption.mjs.map +1 -1
  7. package/build/alert/Alert.js +23 -20
  8. package/build/alert/Alert.js.map +1 -1
  9. package/build/alert/Alert.mjs +20 -17
  10. package/build/alert/Alert.mjs.map +1 -1
  11. package/build/avatar/Avatar.js.map +1 -1
  12. package/build/avatar/Avatar.mjs.map +1 -1
  13. package/build/avatar/avatarTypes.js +3 -1
  14. package/build/avatar/avatarTypes.js.map +1 -1
  15. package/build/avatar/avatarTypes.mjs +3 -1
  16. package/build/avatar/avatarTypes.mjs.map +1 -1
  17. package/build/badge/Badge.js.map +1 -1
  18. package/build/badge/Badge.mjs.map +1 -1
  19. package/build/button/Button.js +2 -2
  20. package/build/button/Button.mjs +2 -2
  21. package/build/button/LegacyButton.js.map +1 -1
  22. package/build/button/LegacyButton.mjs.map +1 -1
  23. package/build/carousel/Carousel.js +9 -8
  24. package/build/carousel/Carousel.js.map +1 -1
  25. package/build/carousel/Carousel.mjs +9 -8
  26. package/build/carousel/Carousel.mjs.map +1 -1
  27. package/build/common/action/Action.js +26 -15
  28. package/build/common/action/Action.js.map +1 -1
  29. package/build/common/action/Action.mjs +26 -15
  30. package/build/common/action/Action.mjs.map +1 -1
  31. package/build/common/closeButton/CloseButton.js +2 -1
  32. package/build/common/closeButton/CloseButton.js.map +1 -1
  33. package/build/common/closeButton/CloseButton.mjs +2 -1
  34. package/build/common/closeButton/CloseButton.mjs.map +1 -1
  35. package/build/criticalBanner/CriticalCommsBanner.js +10 -73
  36. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  37. package/build/criticalBanner/CriticalCommsBanner.mjs +11 -74
  38. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  39. package/build/iconButton/IconButton.js +2 -2
  40. package/build/iconButton/IconButton.js.map +1 -1
  41. package/build/iconButton/IconButton.mjs +2 -2
  42. package/build/iconButton/IconButton.mjs.map +1 -1
  43. package/build/link/Link.js +2 -2
  44. package/build/link/Link.mjs +2 -2
  45. package/build/main.css +46 -75
  46. package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.js.map +1 -0
  47. package/build/primitives/PrimitiveAnchor/PrimitiveAnchor.mjs.map +1 -0
  48. package/build/primitives/PrimitiveButton/{src/PrimitiveButton.js → PrimitiveButton.js} +1 -1
  49. package/build/primitives/PrimitiveButton/PrimitiveButton.js.map +1 -0
  50. package/build/primitives/PrimitiveButton/{src/PrimitiveButton.mjs → PrimitiveButton.mjs} +1 -1
  51. package/build/primitives/PrimitiveButton/PrimitiveButton.mjs.map +1 -0
  52. package/build/select/Select.js.map +1 -1
  53. package/build/select/Select.mjs.map +1 -1
  54. package/build/styles/alert/Alert.css +4 -0
  55. package/build/styles/carousel/Carousel.css +0 -8
  56. package/build/styles/common/closeButton/CloseButton.css +15 -0
  57. package/build/styles/criticalBanner/CriticalCommsBanner.css +33 -73
  58. package/build/styles/main.css +46 -75
  59. package/build/table/TableCell.js +7 -1
  60. package/build/table/TableCell.js.map +1 -1
  61. package/build/table/TableCell.mjs +7 -1
  62. package/build/table/TableCell.mjs.map +1 -1
  63. package/build/test-utils/assets/wise-card.svg +1 -0
  64. package/build/types/actionButton/ActionButton.d.ts +6 -0
  65. package/build/types/actionButton/ActionButton.d.ts.map +1 -1
  66. package/build/types/actionOption/ActionOption.d.ts +2 -1
  67. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  68. package/build/types/alert/Alert.d.ts +3 -4
  69. package/build/types/alert/Alert.d.ts.map +1 -1
  70. package/build/types/avatar/Avatar.d.ts +3 -0
  71. package/build/types/avatar/Avatar.d.ts.map +1 -1
  72. package/build/types/avatar/avatarTypes.d.ts +3 -0
  73. package/build/types/avatar/avatarTypes.d.ts.map +1 -1
  74. package/build/types/badge/Badge.d.ts +3 -0
  75. package/build/types/badge/Badge.d.ts.map +1 -1
  76. package/build/types/button/Button.resolver.d.ts +1 -4
  77. package/build/types/button/Button.resolver.d.ts.map +1 -1
  78. package/build/types/button/LegacyButton.d.ts +30 -7
  79. package/build/types/button/LegacyButton.d.ts.map +1 -1
  80. package/build/types/carousel/Carousel.d.ts.map +1 -1
  81. package/build/types/common/action/Action.d.ts +5 -2
  82. package/build/types/common/action/Action.d.ts.map +1 -1
  83. package/build/types/common/closeButton/CloseButton.d.ts +3 -3
  84. package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
  85. package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
  86. package/build/types/iconButton/IconButton.d.ts +2 -2
  87. package/build/types/iconButton/IconButton.d.ts.map +1 -1
  88. package/build/types/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.d.ts → PrimitiveAnchor.d.ts} +1 -1
  89. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.d.ts.map +1 -0
  90. package/build/types/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.types.d.ts → PrimitiveAnchor.types.d.ts} +1 -1
  91. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -0
  92. package/build/types/primitives/PrimitiveAnchor/index.d.ts +2 -2
  93. package/build/types/primitives/PrimitiveAnchor/index.d.ts.map +1 -1
  94. package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.d.ts → PrimitiveButton.d.ts} +1 -1
  95. package/build/types/primitives/PrimitiveButton/PrimitiveButton.d.ts.map +1 -0
  96. package/build/types/primitives/PrimitiveButton/{src/PrimitiveButton.types.d.ts → PrimitiveButton.types.d.ts} +1 -1
  97. package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -0
  98. package/build/types/primitives/PrimitiveButton/index.d.ts +2 -2
  99. package/build/types/primitives/PrimitiveButton/index.d.ts.map +1 -1
  100. package/build/types/select/Select.d.ts +1 -3
  101. package/build/types/select/Select.d.ts.map +1 -1
  102. package/build/types/table/TableCell.d.ts +6 -3
  103. package/build/types/table/TableCell.d.ts.map +1 -1
  104. package/package.json +4 -4
  105. package/src/actionButton/ActionButton.story.tsx +6 -1
  106. package/src/actionButton/ActionButton.tsx +6 -0
  107. package/src/actionOption/ActionOption.story.tsx +9 -6
  108. package/src/actionOption/ActionOption.tsx +29 -5
  109. package/src/alert/Alert.css +4 -0
  110. package/src/alert/Alert.less +4 -0
  111. package/src/alert/Alert.spec.tsx +0 -30
  112. package/src/alert/Alert.story.tsx +74 -2
  113. package/src/alert/Alert.tsx +18 -21
  114. package/src/avatar/Avatar.tsx +3 -0
  115. package/src/avatar/avatarTypes.ts +3 -1
  116. package/src/badge/Badge.tsx +3 -0
  117. package/src/button/LegacyButton.tsx +31 -9
  118. package/src/carousel/Carousel.css +0 -8
  119. package/src/carousel/Carousel.less +0 -7
  120. package/src/carousel/Carousel.spec.tsx +2 -2
  121. package/src/carousel/Carousel.tsx +11 -10
  122. package/src/common/action/Action.tsx +40 -22
  123. package/src/common/closeButton/CloseButton.css +15 -0
  124. package/src/common/closeButton/CloseButton.less +10 -0
  125. package/src/common/closeButton/CloseButton.tsx +4 -3
  126. package/src/criticalBanner/CriticalCommsBanner.css +33 -73
  127. package/src/criticalBanner/CriticalCommsBanner.less +37 -64
  128. package/src/criticalBanner/CriticalCommsBanner.story.tsx +26 -4
  129. package/src/criticalBanner/CriticalCommsBanner.tsx +8 -50
  130. package/src/iconButton/IconButton.tsx +4 -1
  131. package/src/main.css +46 -75
  132. package/src/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.tsx → PrimitiveAnchor.tsx} +1 -1
  133. package/src/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.types.ts → PrimitiveAnchor.types.ts} +1 -1
  134. package/src/primitives/PrimitiveAnchor/index.ts +6 -2
  135. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +1 -1
  136. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
  137. package/src/primitives/PrimitiveButton/{src/PrimitiveButton.tsx → PrimitiveButton.tsx} +2 -2
  138. package/src/primitives/PrimitiveButton/{src/PrimitiveButton.types.ts → PrimitiveButton.types.ts} +1 -1
  139. package/src/primitives/PrimitiveButton/index.ts +6 -2
  140. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +1 -1
  141. package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +1 -1
  142. package/src/select/Select.tsx +1 -1
  143. package/src/table/Table.story.tsx +59 -1
  144. package/src/table/TableCell.spec.tsx +17 -0
  145. package/src/table/TableCell.tsx +14 -5
  146. package/src/test-utils/assets/wise-card.svg +1 -0
  147. package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +0 -1
  148. package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +0 -1
  149. package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +0 -1
  150. package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +0 -1
  151. package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +0 -1
  152. package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts.map +0 -1
  153. package/build/types/primitives/PrimitiveAnchor/src/index.d.ts +0 -3
  154. package/build/types/primitives/PrimitiveAnchor/src/index.d.ts.map +0 -1
  155. package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +0 -1
  156. package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.types.d.ts.map +0 -1
  157. package/build/types/primitives/PrimitiveButton/src/index.d.ts +0 -3
  158. package/build/types/primitives/PrimitiveButton/src/index.d.ts.map +0 -1
  159. package/src/primitives/PrimitiveAnchor/src/index.ts +0 -6
  160. package/src/primitives/PrimitiveButton/src/index.ts +0 -6
  161. /package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.js → PrimitiveAnchor.js} +0 -0
  162. /package/build/primitives/PrimitiveAnchor/{src/PrimitiveAnchor.mjs → PrimitiveAnchor.mjs} +0 -0
@@ -30,9 +30,20 @@ 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
 
45
+ as?: 'a' | 'button';
46
+
36
47
  /** Makes the button take up the full width of its container */
37
48
  block?: boolean;
38
49
 
@@ -58,17 +69,28 @@ export type CommonProps = {
58
69
  htmlType?: 'submit' | 'reset' | 'button';
59
70
  };
60
71
 
61
- export type ButtonProps = CommonProps &
62
- Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {
63
- as?: 'button';
64
- };
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
+ */
81
+ export type ButtonProps = CommonProps & Omit<React.ComponentPropsWithRef<'button'>, 'type'>;
65
82
 
66
- type AnchorProps = CommonProps &
67
- Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
68
- as?: 'a';
69
- href?: string;
70
- };
83
+ type AnchorProps = CommonProps & Omit<React.ComponentPropsWithRef<'a'>, 'type'>;
71
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
+ */
72
94
  export type LegacyButtonProps = ButtonProps | AnchorProps;
73
95
 
74
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 '@testing-library/react';
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 ActionButton from '../actionButton';
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
- <ActionButton
174
- className="carousel__scroll-button"
172
+ <div className="hidden-xs d-inline-flex">
173
+ <IconButton
174
+ size={32}
175
175
  tabIndex={-1}
176
- priority="secondary"
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
- </ActionButton>
184
- <ActionButton
183
+ </IconButton>
184
+ <IconButton
185
+ size={32}
185
186
  tabIndex={-1}
186
- className="carousel__scroll-button m-l-1"
187
- priority="secondary"
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
- </ActionButton>
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({ action, className, variant = 'button' }: Props) {
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
- return variant === 'button' ? (
38
- <button
39
- type="button"
40
- aria-label={action['aria-label']}
41
- className={clsx('btn-unstyled np-text-link-large', className)}
42
- onClick={action.onClick}
43
- >
44
- {action.text}
45
- </button>
46
- ) : (
47
- <ActionButton
48
- aria-label={action['aria-label']}
49
- priority={Priority.SECONDARY}
50
- className={clsx(className)}
51
- onClick={action.onClick}
52
- >
53
- {action.text}
54
- </ActionButton>
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
- div.critical-comms {
2
- --critical-comms-background-color: var(--color-background-negative);
3
- --critical-comms-title-color: var(--color-content-negative);
4
- --critical-comms-subtitle-color: var(--color-content-secondary);
5
- --critical-comms-subtitle-color-padding-left: var(--size-16);
6
- --critical-comms-vertical-spacing: var(--size-8);
7
- background-color: rgba(255,135,135,0.10196);
8
- background-color: var(--critical-comms-background-color);
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- }
13
- .np-theme-personal div.critical-comms,
14
- .np-theme-personal--dark div.critical-comms {
15
- --critical-comms-background-color: var(--color-sentiment-negative);
16
- --critical-comms-title-color: var(--color-contrast);
17
- --critical-comms-subtitle-color: var(--color-contrast);
18
- --critical-comms-subtitle-color-padding-left: 0;
19
- --critical-comms-vertical-spacing: var(--size-16);
20
- padding: 24px;
21
- padding: var(--padding-medium);
22
- }
23
- .np-theme-personal div.critical-comms .tw-icon-alert-circle-fill,
24
- .np-theme-personal--dark div.critical-comms .tw-icon-alert-circle-fill {
25
- color: var(--color-contrast);
26
- }
27
- .np-theme-personal div.critical-comms .tw-icon-alert-circle-fill svg,
28
- .np-theme-personal--dark div.critical-comms .tw-icon-alert-circle-fill svg {
29
- width: 48px;
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
- div.critical-comms .critical-comms--title {
47
- color: var(--critical-comms-title-color);
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
- div.critical-comms {
2
- --critical-comms-background-color: var(--color-background-negative);
3
- --critical-comms-title-color: var(--color-content-negative);
4
- --critical-comms-subtitle-color: var(--color-content-secondary);
5
- --critical-comms-subtitle-color-padding-left: var(--size-16);
6
- --critical-comms-vertical-spacing: var(--size-8);
7
-
8
- .np-theme-personal &,
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
- .cta-btn {
28
- background-color: var(--color-contrast);
12
+ .status-circle.warning {
13
+ background-color: var(--color-background-screen);
29
14
 
30
- &:not(.disabled,:disabled):focus {
31
- outline-color: var(--color-contrast);
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
- .critical-comms--cta {
54
- padding-left: 0;
55
-
56
- @media (--screen-sm-max) {
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
- @media (--screen-sm-max) {
68
- flex-direction: column;
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
- .critical-comms-content {
73
- @media (--screen-sm-max) {
74
- padding-top: var(--critical-comms-vertical-spacing);
75
- flex-wrap: wrap;
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
+ }
@@ -1,6 +1,7 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta } from '@storybook/react';
2
2
 
3
3
  import CriticalCommsBanner from '.';
4
+ import { storyConfig } from '../test-utils';
4
5
 
5
6
  export default {
6
7
  component: CriticalCommsBanner,
@@ -8,12 +9,33 @@ export default {
8
9
  tags: ['autodocs'],
9
10
  } satisfies Meta<typeof CriticalCommsBanner>;
10
11
 
11
- type Story = StoryObj<typeof CriticalCommsBanner>;
12
-
13
- export const Basic: Story = {
12
+ export const Basic = {
14
13
  args: {
15
14
  title: 'Your account is overdrawn',
16
15
  subtitle: 'Add money within the next 30 days',
17
16
  action: { label: 'Take action', href: 'https://wise.com' },
18
17
  },
19
18
  };
19
+
20
+ export const Variants = storyConfig(
21
+ {
22
+ args: {
23
+ title: 'Your account is overdrawn',
24
+ subtitle: 'Add money within the next 30 days',
25
+ action: { label: 'Take action', href: 'https://wise.com' },
26
+ },
27
+ },
28
+ { variants: ['default', 'dark', 'rtl'] },
29
+ );
30
+
31
+ export const Mobile = storyConfig(
32
+ {
33
+ tags: ['!autodocs'],
34
+ args: {
35
+ title: 'Your account is overdrawn',
36
+ subtitle: 'Add money within the next 30 days',
37
+ action: { label: 'Take action', href: 'https://wise.com' },
38
+ },
39
+ },
40
+ { variants: ['default', 'dark', 'rtl', 'mobile'] },
41
+ );
@@ -1,13 +1,6 @@
1
- import { Alert as DangerIcon, AlertCircleFill } from '@transferwise/icons';
2
- import { useTheme } from '@wise/components-theming';
1
+ import Alert from '../alert';
3
2
  import { clsx } from 'clsx';
4
3
 
5
- import Avatar, { AvatarType } from '../avatar';
6
- import Body from '../body';
7
- import Button from '../button';
8
- import { ControlType, Priority, Size, Typography } from '../common';
9
- import Title from '../title';
10
-
11
4
  export type CriticalCommsBannerProps = {
12
5
  title: string;
13
6
  subtitle?: string;
@@ -19,50 +12,15 @@ export type CriticalCommsBannerProps = {
19
12
  };
20
13
 
21
14
  function CriticalCommsBanner({ title, subtitle, action, className }: CriticalCommsBannerProps) {
22
- const { isModern } = useTheme();
23
15
  return (
24
16
  <div className={clsx('critical-comms', className)}>
25
- <div className="critical-comms-body">
26
- <Avatar
27
- size={Size.MEDIUM}
28
- type={AvatarType.ICON}
29
- className={clsx(isModern ? 'm-r-2' : 'm-r-1')}
30
- backgroundColor={
31
- isModern ? 'var(--color-sentiment-negative)' : 'var(--color-background-negative)'
32
- }
33
- >
34
- {isModern ? <AlertCircleFill /> : <DangerIcon size={24} />}
35
- </Avatar>
36
- <div className="critical-comms-content d-flex align-items-center flex-grow-1">
37
- <div className={clsx('flex-grow-1', { 'p-x-2': !isModern })}>
38
- <Title
39
- type={isModern ? Typography.TITLE_BODY : Typography.TITLE_GROUP}
40
- className="critical-comms--title"
41
- >
42
- {title}
43
- </Title>
44
- <Body className="critical-comms--subtitle">{subtitle}</Body>
45
- </div>
46
- {action ? (
47
- <div className="critical-comms--cta">
48
- <Button
49
- block={isModern}
50
- size={Size.SMALL}
51
- type={ControlType.NEGATIVE}
52
- priority={isModern ? Priority.SECONDARY : Priority.PRIMARY}
53
- className="cta-btn"
54
- onClick={() => {
55
- if (action) {
56
- window.location.href = action.href;
57
- }
58
- }}
59
- >
60
- {action.label}
61
- </Button>
62
- </div>
63
- ) : null}
64
- </div>
65
- </div>
17
+ <Alert
18
+ title={title}
19
+ message={subtitle}
20
+ action={{ target: action?.href, text: action?.label }}
21
+ className={className}
22
+ type="warning"
23
+ />
66
24
  </div>
67
25
  );
68
26
  }
@@ -10,7 +10,10 @@ export type Props = {
10
10
  'data-testid'?: string;
11
11
  } & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick'> &
12
12
  Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled'> &
13
- Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'role' | 'children' | 'aria-label'>;
13
+ Pick<
14
+ HTMLAttributes<HTMLDivElement>,
15
+ 'className' | 'role' | 'children' | 'aria-label' | 'tabIndex'
16
+ >;
14
17
 
15
18
  const IconButton = forwardRef(function IconButton(
16
19
  {