@transferwise/components 46.44.0 → 46.44.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.
@@ -1 +1 @@
1
- {"version":3,"file":"InlineAlert.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/InlineAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAQ,MAAM,WAAW,CAAC;AAG5C,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,IAAgB,EAChB,SAAS,EACT,QAAQ,GACT,EAAE,gBAAgB,+BAiBlB"}
1
+ {"version":3,"file":"InlineAlert.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/InlineAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAQ,MAAM,WAAW,CAAC;AAG5C,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAUD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,IAAgB,EAChB,SAAS,EACT,QAAQ,GACT,EAAE,gBAAgB,+BAelB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.44.0",
3
+ "version": "46.44.1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,8 +93,8 @@
93
93
  "rollup": "^4.17.2",
94
94
  "storybook": "^8.1.10",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@transferwise/neptune-css": "14.12.0",
97
- "@wise/components-theming": "1.3.0"
96
+ "@wise/components-theming": "1.3.0",
97
+ "@transferwise/neptune-css": "14.12.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",
@@ -28,6 +28,7 @@ describe('InlineAlert', () => {
28
28
  const component = screen.getByRole('alert');
29
29
 
30
30
  expect(component).toHaveClass('alert-info');
31
+ expect(screen.queryByTestId('status-icon')).not.toBeInTheDocument();
31
32
  });
32
33
 
33
34
  it('renders neutral', () => {
@@ -35,6 +36,7 @@ describe('InlineAlert', () => {
35
36
  const component = screen.getByRole('alert');
36
37
 
37
38
  expect(component).toHaveClass('alert-neutral');
39
+ expect(screen.queryByTestId('status-icon')).not.toBeInTheDocument();
38
40
  });
39
41
 
40
42
  it('renders success', () => {
@@ -42,6 +44,7 @@ describe('InlineAlert', () => {
42
44
  const component = screen.getByRole('alert');
43
45
 
44
46
  expect(component).toHaveClass('alert-success');
47
+ expect(screen.getByTestId('status-icon')).toBeInTheDocument();
45
48
  });
46
49
 
47
50
  it('renders positive', () => {
@@ -49,6 +52,7 @@ describe('InlineAlert', () => {
49
52
  const component = screen.getByRole('alert');
50
53
 
51
54
  expect(component).toHaveClass('alert-positive');
55
+ expect(screen.getByTestId('status-icon')).toBeInTheDocument();
52
56
  });
53
57
 
54
58
  it('renders error as danger', () => {
@@ -56,6 +60,7 @@ describe('InlineAlert', () => {
56
60
  const component = screen.getByRole('alert');
57
61
 
58
62
  expect(component).toHaveClass('alert-danger');
63
+ expect(screen.getByTestId('status-icon')).toBeInTheDocument();
59
64
  });
60
65
 
61
66
  it('renders negative as danger', () => {
@@ -63,6 +68,7 @@ describe('InlineAlert', () => {
63
68
  const component = screen.getByRole('alert');
64
69
 
65
70
  expect(component).toHaveClass('alert-danger');
71
+ expect(screen.getByTestId('status-icon')).toBeInTheDocument();
66
72
  });
67
73
 
68
74
  it('renders warning', () => {
@@ -70,6 +76,7 @@ describe('InlineAlert', () => {
70
76
  const component = screen.getByRole('alert');
71
77
 
72
78
  expect(component).toHaveClass('alert-warning');
79
+ expect(screen.getByTestId('status-icon')).toBeInTheDocument();
73
80
  });
74
81
  });
75
82
  });
@@ -11,6 +11,14 @@ export interface InlineAlertProps {
11
11
  children: ReactNode;
12
12
  }
13
13
 
14
+ const iconTypes = new Set<NonNullable<InlineAlertProps['type']>>([
15
+ Sentiment.NEGATIVE,
16
+ Sentiment.ERROR,
17
+ Sentiment.POSITIVE,
18
+ Sentiment.SUCCESS,
19
+ Sentiment.WARNING,
20
+ ]);
21
+
14
22
  export default function InlineAlert({
15
23
  id,
16
24
  type = 'neutral',
@@ -27,9 +35,7 @@ export default function InlineAlert({
27
35
  className,
28
36
  )}
29
37
  >
30
- {type !== Sentiment.NEUTRAL && type !== Sentiment.PENDING && (
31
- <StatusIcon sentiment={type} size={Size.SMALL} />
32
- )}
38
+ {iconTypes.has(type) && <StatusIcon sentiment={type} size={Size.SMALL} />}
33
39
  <div className="np-text-body-default">{children}</div>
34
40
  </div>
35
41
  );