@transferwise/components 0.0.0-experimental-dd50468 → 0.0.0-experimental-e77309f
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/alert/Alert.js +52 -49
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +53 -50
- package/build/alert/Alert.mjs.map +1 -1
- package/build/i18n/en.json +0 -2
- package/build/i18n/en.json.js +0 -2
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -2
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +0 -214
- package/build/styles/main.css +0 -214
- package/build/types/alert/Alert.d.ts +3 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.spec.tsx +20 -0
- package/src/alert/Alert.story.tsx +50 -2
- package/src/alert/Alert.tsx +57 -50
- package/src/i18n/en.json +0 -2
- package/src/main.css +0 -214
- package/src/main.less +0 -1
- package/build/styles/table/Table.css +0 -214
- package/build/types/table/Table.d.ts +0 -23
- package/build/types/table/Table.d.ts.map +0 -1
- package/build/types/table/Table.messages.d.ts +0 -12
- package/build/types/table/Table.messages.d.ts.map +0 -1
- package/build/types/table/TableCell.d.ts +0 -37
- package/build/types/table/TableCell.d.ts.map +0 -1
- package/build/types/table/TableHeader.d.ts +0 -12
- package/build/types/table/TableHeader.d.ts.map +0 -1
- package/build/types/table/TableRow.d.ts +0 -17
- package/build/types/table/TableRow.d.ts.map +0 -1
- package/build/types/table/TableStatusText.d.ts +0 -9
- package/build/types/table/TableStatusText.d.ts.map +0 -1
- package/build/types/table/index.d.ts +0 -6
- package/build/types/table/index.d.ts.map +0 -1
- package/src/table/Table.css +0 -214
- package/src/table/Table.less +0 -253
- package/src/table/Table.messages.ts +0 -12
- package/src/table/Table.spec.tsx +0 -80
- package/src/table/Table.story.tsx +0 -352
- package/src/table/Table.tsx +0 -121
- package/src/table/TableCell.spec.tsx +0 -161
- package/src/table/TableCell.tsx +0 -143
- package/src/table/TableHeader.spec.tsx +0 -58
- package/src/table/TableHeader.tsx +0 -50
- package/src/table/TableRow.spec.tsx +0 -69
- package/src/table/TableRow.tsx +0 -62
- package/src/table/TableStatusText.spec.tsx +0 -42
- package/src/table/TableStatusText.tsx +0 -35
- package/src/table/index.ts +0 -11
package/build/styles/main.css
CHANGED
|
@@ -5025,220 +5025,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5025
5025
|
padding: 0 var(--size-24);
|
|
5026
5026
|
}
|
|
5027
5027
|
}
|
|
5028
|
-
.np-table {
|
|
5029
|
-
width: 100%;
|
|
5030
|
-
background-color: transparent;
|
|
5031
|
-
}
|
|
5032
|
-
.np-table-container {
|
|
5033
|
-
padding: 8px;
|
|
5034
|
-
padding: var(--size-8);
|
|
5035
|
-
background-color: rgba(134,167,189,0.10196);
|
|
5036
|
-
background-color: var(--color-background-neutral);
|
|
5037
|
-
border-radius: 16px;
|
|
5038
|
-
border-radius: var(--radius-medium);
|
|
5039
|
-
}
|
|
5040
|
-
.np-table-container--loading .np-table-header {
|
|
5041
|
-
min-width: calc(160px * 2);
|
|
5042
|
-
}
|
|
5043
|
-
.np-table-container--center {
|
|
5044
|
-
margin-right: auto;
|
|
5045
|
-
margin-left: auto;
|
|
5046
|
-
}
|
|
5047
|
-
.np-table-container--full-width {
|
|
5048
|
-
width: 100%;
|
|
5049
|
-
}
|
|
5050
|
-
.np-table-inner-container {
|
|
5051
|
-
background-image: linear-gradient(to right, #ffffff, #ffffff), linear-gradient(to right, #ffffff, #ffffff), linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
|
|
5052
|
-
background-image: linear-gradient(to right, var(--color-background-screen), var(--color-background-screen)), linear-gradient(to right, var(--color-background-screen), var(--color-background-screen)), linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
|
|
5053
|
-
background-position: left center, right center, left center, right center;
|
|
5054
|
-
background-repeat: no-repeat;
|
|
5055
|
-
background-color: #ffffff;
|
|
5056
|
-
background-color: var(--color-background-screen);
|
|
5057
|
-
background-size: 10px 100%, 10px 100%, 10px 100%, 10px 100%;
|
|
5058
|
-
background-attachment: local, local, scroll, scroll;
|
|
5059
|
-
overflow-x: auto;
|
|
5060
|
-
border-radius: 10px;
|
|
5061
|
-
}
|
|
5062
|
-
.np-table-row:last-child .np-table-cell:first-child {
|
|
5063
|
-
border-bottom-left-radius: 10px;
|
|
5064
|
-
}
|
|
5065
|
-
.np-table-row:last-child .np-table-cell:last-child {
|
|
5066
|
-
border-bottom-right-radius: 10px;
|
|
5067
|
-
}
|
|
5068
|
-
.np-table-row--clickable:hover .np-table-cell {
|
|
5069
|
-
background-color: var(--color-background-screen-hover);
|
|
5070
|
-
cursor: pointer;
|
|
5071
|
-
}
|
|
5072
|
-
.np-table-row--separator .np-table-cell {
|
|
5073
|
-
padding: 0;
|
|
5074
|
-
}
|
|
5075
|
-
.np-table-header,
|
|
5076
|
-
.np-table-cell {
|
|
5077
|
-
padding: 0;
|
|
5078
|
-
}
|
|
5079
|
-
.np-table-header:first-child,
|
|
5080
|
-
.np-table-cell:first-child {
|
|
5081
|
-
padding-left: 16px;
|
|
5082
|
-
padding-left: var(--size-16);
|
|
5083
|
-
}
|
|
5084
|
-
.np-table-header:first-child .np-table-header-content,
|
|
5085
|
-
.np-table-cell:first-child .np-table-header-content,
|
|
5086
|
-
.np-table-header:first-child .np-table-cell-content,
|
|
5087
|
-
.np-table-cell:first-child .np-table-cell-content {
|
|
5088
|
-
padding-left: 0;
|
|
5089
|
-
}
|
|
5090
|
-
.np-table-header:last-child,
|
|
5091
|
-
.np-table-cell:last-child {
|
|
5092
|
-
padding-right: 16px;
|
|
5093
|
-
padding-right: var(--size-16);
|
|
5094
|
-
}
|
|
5095
|
-
.np-table-header:last-child .np-table-header-content,
|
|
5096
|
-
.np-table-cell:last-child .np-table-header-content,
|
|
5097
|
-
.np-table-header:last-child .np-table-cell-content,
|
|
5098
|
-
.np-table-cell:last-child .np-table-cell-content {
|
|
5099
|
-
padding-right: 0;
|
|
5100
|
-
}
|
|
5101
|
-
.np-table-header .np-text-body-large-bold,
|
|
5102
|
-
.np-table-cell .np-text-body-large-bold {
|
|
5103
|
-
font-size: 0.875rem;
|
|
5104
|
-
font-size: var(--font-size-14);
|
|
5105
|
-
}
|
|
5106
|
-
.np-table-header.np-table-header--right,
|
|
5107
|
-
.np-table-cell.np-table-cell--right {
|
|
5108
|
-
padding-right: calc(8px + 12px);
|
|
5109
|
-
padding-right: calc(var(--size-8) + var(--size-12));
|
|
5110
|
-
}
|
|
5111
|
-
.np-table-header.np-table-header--right > .np-text-body-default,
|
|
5112
|
-
.np-table-cell.np-table-cell--right > .np-text-body-default {
|
|
5113
|
-
text-align: right;
|
|
5114
|
-
}
|
|
5115
|
-
.np-table-header.np-table-header--right .np-table-header-content,
|
|
5116
|
-
.np-table-cell.np-table-cell--right .np-table-content {
|
|
5117
|
-
justify-content: end;
|
|
5118
|
-
}
|
|
5119
|
-
.np-table-header-content,
|
|
5120
|
-
.np-table-content {
|
|
5121
|
-
display: flex;
|
|
5122
|
-
align-items: center;
|
|
5123
|
-
justify-content: start;
|
|
5124
|
-
}
|
|
5125
|
-
.np-table-header {
|
|
5126
|
-
min-width: 160px;
|
|
5127
|
-
padding-right: 8px;
|
|
5128
|
-
padding-right: var(--size-8);
|
|
5129
|
-
padding-bottom: 8px;
|
|
5130
|
-
padding-bottom: var(--size-8);
|
|
5131
|
-
padding-left: 8px;
|
|
5132
|
-
padding-left: var(--size-8);
|
|
5133
|
-
background-color: rgba(134,167,189,0.10196);
|
|
5134
|
-
background-color: var(--color-background-neutral);
|
|
5135
|
-
color: #37517e;
|
|
5136
|
-
color: var(--color-content-primary);
|
|
5137
|
-
}
|
|
5138
|
-
.np-table-header-content {
|
|
5139
|
-
padding-top: 5px;
|
|
5140
|
-
padding-bottom: 5px;
|
|
5141
|
-
white-space: nowrap;
|
|
5142
|
-
}
|
|
5143
|
-
.np-table-header--has-error {
|
|
5144
|
-
color: var(--color-sentiment-negative);
|
|
5145
|
-
}
|
|
5146
|
-
.np-table-cell {
|
|
5147
|
-
padding: 16px 8px;
|
|
5148
|
-
padding: var(--size-16) var(--size-8);
|
|
5149
|
-
}
|
|
5150
|
-
.np-table-cell--primary {
|
|
5151
|
-
min-width: 200px;
|
|
5152
|
-
}
|
|
5153
|
-
.np-table-cell--currency .np-text-body-default {
|
|
5154
|
-
white-space: nowrap;
|
|
5155
|
-
}
|
|
5156
|
-
.np-table-cell--status .status-circle {
|
|
5157
|
-
width: 24px;
|
|
5158
|
-
height: 24px;
|
|
5159
|
-
}
|
|
5160
|
-
.np-table-cell--status .status-circle .status-icon > svg {
|
|
5161
|
-
width: 21px;
|
|
5162
|
-
height: 21px;
|
|
5163
|
-
}
|
|
5164
|
-
.np-table-cell .tw-chevron {
|
|
5165
|
-
margin-left: 8px;
|
|
5166
|
-
margin-left: var(--size-8);
|
|
5167
|
-
}
|
|
5168
|
-
.np-table-cell-separator {
|
|
5169
|
-
margin-top: 4px;
|
|
5170
|
-
margin-top: var(--size-4);
|
|
5171
|
-
margin-bottom: 4px;
|
|
5172
|
-
margin-bottom: var(--size-4);
|
|
5173
|
-
height: 1px;
|
|
5174
|
-
padding: 0;
|
|
5175
|
-
background-color: rgba(134,167,189,0.10196);
|
|
5176
|
-
background-color: var(--color-background-neutral);
|
|
5177
|
-
}
|
|
5178
|
-
.np-table-cell .np-text-body-default {
|
|
5179
|
-
line-height: 1.375rem;
|
|
5180
|
-
line-height: var(--line-height-22);
|
|
5181
|
-
}
|
|
5182
|
-
.np-table-cell .np-text-body-large-bold {
|
|
5183
|
-
display: flex;
|
|
5184
|
-
align-items: center;
|
|
5185
|
-
color: #37517e;
|
|
5186
|
-
color: var(--color-content-primary);
|
|
5187
|
-
white-space: nowrap;
|
|
5188
|
-
}
|
|
5189
|
-
.np-table-cell .np-table-content--success {
|
|
5190
|
-
color: var(--color-sentiment-positive);
|
|
5191
|
-
}
|
|
5192
|
-
.np-table-cell .np-table-content--error {
|
|
5193
|
-
color: var(--color-sentiment-negative);
|
|
5194
|
-
}
|
|
5195
|
-
.np-table-cell .tw-loader {
|
|
5196
|
-
margin: 150px auto;
|
|
5197
|
-
}
|
|
5198
|
-
@media (max-width: 320px) {
|
|
5199
|
-
.np-table-cell .tw-loader {
|
|
5200
|
-
margin-top: 70px;
|
|
5201
|
-
margin-bottom: 70px;
|
|
5202
|
-
}
|
|
5203
|
-
}
|
|
5204
|
-
.np-table-content {
|
|
5205
|
-
gap: 12px;
|
|
5206
|
-
gap: var(--size-12);
|
|
5207
|
-
}
|
|
5208
|
-
.np-table-content--success,
|
|
5209
|
-
.np-table-content--error {
|
|
5210
|
-
gap: 4px;
|
|
5211
|
-
gap: var(--size-4);
|
|
5212
|
-
}
|
|
5213
|
-
.np-table-content--success .np-table-content-text,
|
|
5214
|
-
.np-table-content--error .np-table-content-text {
|
|
5215
|
-
line-height: 155%;
|
|
5216
|
-
}
|
|
5217
|
-
.np-table-content-media {
|
|
5218
|
-
flex-shrink: 0;
|
|
5219
|
-
}
|
|
5220
|
-
.np-table-content-body {
|
|
5221
|
-
display: flex;
|
|
5222
|
-
flex-direction: column;
|
|
5223
|
-
font-size: 0.75rem;
|
|
5224
|
-
font-size: var(--font-size-12);
|
|
5225
|
-
color: #768e9c;
|
|
5226
|
-
color: var(--color-content-tertiary);
|
|
5227
|
-
}
|
|
5228
|
-
.np-table-content--reversed {
|
|
5229
|
-
flex-direction: row-reverse;
|
|
5230
|
-
}
|
|
5231
|
-
.np-table-content--reversed .np-table-content-body {
|
|
5232
|
-
align-items: end;
|
|
5233
|
-
}
|
|
5234
|
-
.np-table-empty-data {
|
|
5235
|
-
display: flex;
|
|
5236
|
-
align-items: center;
|
|
5237
|
-
}
|
|
5238
|
-
.np-table-empty-data .status-circle {
|
|
5239
|
-
margin-right: 12px;
|
|
5240
|
-
margin-right: var(--size-12);
|
|
5241
|
-
}
|
|
5242
5028
|
.np-tile {
|
|
5243
5029
|
min-width: 120px;
|
|
5244
5030
|
border-radius: 10px;
|
|
@@ -33,6 +33,8 @@ export interface AlertProps {
|
|
|
33
33
|
/** The type dictates which icon and colour will be used */
|
|
34
34
|
type?: AlertType;
|
|
35
35
|
variant?: `${Variant}`;
|
|
36
|
+
/** Toggle to make it work with ARIA Live Region */
|
|
37
|
+
active?: boolean;
|
|
36
38
|
/** @deprecated Use `InlineAlert` instead. */
|
|
37
39
|
arrow?: `${AlertArrowPosition}`;
|
|
38
40
|
/** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */
|
|
@@ -42,6 +44,6 @@ export interface AlertProps {
|
|
|
42
44
|
/** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */
|
|
43
45
|
size?: `${Size}`;
|
|
44
46
|
}
|
|
45
|
-
export default function Alert({ arrow, action, children, className, dismissible, icon, onDismiss, message, size, title, type, variant, }: AlertProps): import("react").JSX.Element;
|
|
47
|
+
export default function Alert({ arrow, action, children, className, dismissible, icon, onDismiss, message, size, title, type, variant, active, }: AlertProps): import("react").JSX.Element;
|
|
46
48
|
export {};
|
|
47
49
|
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAc,OAAO,EAAE,MAAM,WAAW,CAAC;AASjE,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAA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AkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACvD,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACvB,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAChC,oHAAoH;IACpH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;CAClB;AAeD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,KAAK,EACL,IAAgB,EAChB,OAAmB,EACnB,MAAa,GACd,EAAE,UAAU,+BAyGZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-e77309f",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
"rollup": "^4.18.1",
|
|
92
92
|
"rollup-preserve-directives": "^1.1.1",
|
|
93
93
|
"storybook": "^8.2.2",
|
|
94
|
-
"@transferwise/
|
|
94
|
+
"@transferwise/neptune-css": "14.19.1",
|
|
95
95
|
"@wise/components-theming": "1.6.1",
|
|
96
|
-
"@transferwise/
|
|
96
|
+
"@transferwise/less-config": "3.1.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3.13.1",
|
package/src/alert/Alert.spec.tsx
CHANGED
|
@@ -467,4 +467,24 @@ describe('Alert', () => {
|
|
|
467
467
|
expect(screen.getByTestId('status-icon')).toBeInTheDocument();
|
|
468
468
|
});
|
|
469
469
|
});
|
|
470
|
+
|
|
471
|
+
describe('`active` prop', () => {
|
|
472
|
+
it('should render wrapper and alert if `active` is unset', () => {
|
|
473
|
+
render(<Alert message={message} />);
|
|
474
|
+
expect(screen.getByRole('status')).toBeInTheDocument();
|
|
475
|
+
expect(screen.getByText(message)).toBeInTheDocument();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should render wrapper and alert if `active={false}', () => {
|
|
479
|
+
render(<Alert message={message} active={false} />);
|
|
480
|
+
expect(screen.getByRole('status')).toBeInTheDocument();
|
|
481
|
+
expect(screen.queryByText(message)).not.toBeInTheDocument();
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
it('should render wrapper and alert if `active` is set', () => {
|
|
485
|
+
render(<Alert message={message} />);
|
|
486
|
+
expect(screen.getByRole('status')).toBeInTheDocument();
|
|
487
|
+
expect(screen.getByText(message)).toBeInTheDocument();
|
|
488
|
+
});
|
|
489
|
+
});
|
|
470
490
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { action } from '@storybook/addon-actions';
|
|
4
4
|
import { ClockBorderless } from '@transferwise/icons';
|
|
5
5
|
|
|
6
6
|
import { Sentiment } from '../common';
|
|
7
|
-
|
|
7
|
+
import { Button } from '..';
|
|
8
8
|
import Alert, { AlertArrowPosition } from './Alert';
|
|
9
9
|
|
|
10
10
|
export default {
|
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
title: 'Feedback/Alert',
|
|
13
13
|
args: {
|
|
14
14
|
type: Sentiment.POSITIVE,
|
|
15
|
+
active: true,
|
|
15
16
|
message:
|
|
16
17
|
'Payments sent to your bank details **today** might not arrive in time for the holidays.',
|
|
17
18
|
},
|
|
@@ -103,3 +104,50 @@ export const WithTitle: Story = {
|
|
|
103
104
|
onDismiss: () => {},
|
|
104
105
|
},
|
|
105
106
|
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* For ARIA live region to function correctly with screen readers,
|
|
110
|
+
* the container with an appropriate ARIA role (in the case of this
|
|
111
|
+
* component, it's `status` or `alert`) must be rendered first.
|
|
112
|
+
* Once present in the accessibility tree, its dynamic contents
|
|
113
|
+
* will be announced correctly.
|
|
114
|
+
*
|
|
115
|
+
* Because of that, using logical AND (&&) operator is discouraged
|
|
116
|
+
* and, instead, engineers should toggle the `active` prop which
|
|
117
|
+
* provides that logic internally.
|
|
118
|
+
*/
|
|
119
|
+
export const ConditionallyRendered: Story = {
|
|
120
|
+
render: function Render(args) {
|
|
121
|
+
const [isActive, setIsActive] = useState(false);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Button htmlType="button" onClick={() => setIsActive((value) => !value)}>
|
|
126
|
+
Trigger Alert
|
|
127
|
+
</Button>
|
|
128
|
+
|
|
129
|
+
<Alert {...args} active={isActive} className="m-t-5" />
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
parameters: {
|
|
134
|
+
docs: {
|
|
135
|
+
source: {
|
|
136
|
+
code: `
|
|
137
|
+
function Render (args) {
|
|
138
|
+
const [isActive, setIsActive] = useState(false);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<>
|
|
142
|
+
<Button htmlType="button" onClick={() => setIsActive(value => !value)}>
|
|
143
|
+
Trigger Alert
|
|
144
|
+
</Button>
|
|
145
|
+
|
|
146
|
+
<Alert {...args} active={isActive} className="m-t-5" />
|
|
147
|
+
</>
|
|
148
|
+
)
|
|
149
|
+
}`,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -52,6 +52,8 @@ export interface AlertProps {
|
|
|
52
52
|
/** The type dictates which icon and colour will be used */
|
|
53
53
|
type?: AlertType;
|
|
54
54
|
variant?: `${Variant}`;
|
|
55
|
+
/** Toggle to make it work with ARIA Live Region */
|
|
56
|
+
active?: boolean;
|
|
55
57
|
/** @deprecated Use `InlineAlert` instead. */
|
|
56
58
|
arrow?: `${AlertArrowPosition}`;
|
|
57
59
|
/** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */
|
|
@@ -88,6 +90,7 @@ export default function Alert({
|
|
|
88
90
|
title,
|
|
89
91
|
type = 'neutral',
|
|
90
92
|
variant = 'desktop',
|
|
93
|
+
active = true,
|
|
91
94
|
}: AlertProps) {
|
|
92
95
|
useEffect(() => {
|
|
93
96
|
if (arrow !== undefined) {
|
|
@@ -133,59 +136,63 @@ export default function Alert({
|
|
|
133
136
|
const closeButtonReference = useRef<HTMLButtonElement>(null);
|
|
134
137
|
|
|
135
138
|
return (
|
|
136
|
-
<div
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<div role={Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status'}>
|
|
175
|
-
{title && (
|
|
176
|
-
<Title className="m-b-1" type={Typography.TITLE_BODY}>
|
|
177
|
-
{title}
|
|
178
|
-
</Title>
|
|
139
|
+
<div role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}>
|
|
140
|
+
{active && (
|
|
141
|
+
<div
|
|
142
|
+
className={clsx(
|
|
143
|
+
'alert d-flex',
|
|
144
|
+
`alert-${resolvedType}`,
|
|
145
|
+
arrow != null && alertArrowClassNames(arrow),
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
data-testid="alert"
|
|
149
|
+
onTouchStart={() => setShouldFire(true)}
|
|
150
|
+
onTouchEnd={(event) => {
|
|
151
|
+
if (
|
|
152
|
+
shouldFire &&
|
|
153
|
+
action?.href &&
|
|
154
|
+
// Check if current event is triggered from closeButton
|
|
155
|
+
event.target instanceof Node &&
|
|
156
|
+
closeButtonReference.current &&
|
|
157
|
+
!closeButtonReference.current.contains(event.target)
|
|
158
|
+
) {
|
|
159
|
+
if (action.target === '_blank') {
|
|
160
|
+
window.top?.open(action.href);
|
|
161
|
+
} else {
|
|
162
|
+
window.top?.location.assign(action.href);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
setShouldFire(false);
|
|
166
|
+
}}
|
|
167
|
+
onTouchMove={() => setShouldFire(false)}
|
|
168
|
+
>
|
|
169
|
+
<div
|
|
170
|
+
className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}
|
|
171
|
+
data-testid={variant}
|
|
172
|
+
>
|
|
173
|
+
{icon ? (
|
|
174
|
+
<div className="alert__icon">{icon}</div>
|
|
175
|
+
) : (
|
|
176
|
+
<StatusIcon size={Size.LARGE} sentiment={resolvedType} />
|
|
179
177
|
)}
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
<div className="alert__message">
|
|
179
|
+
<div>
|
|
180
|
+
{title && (
|
|
181
|
+
<Title className="m-b-1" type={Typography.TITLE_BODY}>
|
|
182
|
+
{title}
|
|
183
|
+
</Title>
|
|
184
|
+
)}
|
|
185
|
+
<Body as="span" className="d-block" type={Typography.BODY_LARGE}>
|
|
186
|
+
{children || <InlineMarkdown>{message}</InlineMarkdown>}
|
|
187
|
+
</Body>
|
|
188
|
+
</div>
|
|
189
|
+
{action && <Action action={action} className="m-t-1" />}
|
|
190
|
+
</div>
|
|
183
191
|
</div>
|
|
184
|
-
{
|
|
192
|
+
{onDismiss && (
|
|
193
|
+
<CloseButton ref={closeButtonReference} className="m-l-2" onClick={onDismiss} />
|
|
194
|
+
)}
|
|
185
195
|
</div>
|
|
186
|
-
</div>
|
|
187
|
-
{onDismiss && (
|
|
188
|
-
<CloseButton ref={closeButtonReference} className="m-l-2" onClick={onDismiss} />
|
|
189
196
|
)}
|
|
190
197
|
</div>
|
|
191
198
|
);
|
package/src/i18n/en.json
CHANGED
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
"neptune.Summary.statusDone": "Item done",
|
|
31
31
|
"neptune.Summary.statusNotDone": "Item to do",
|
|
32
32
|
"neptune.Summary.statusPending": "Item pending",
|
|
33
|
-
"neptune.Table.emptyData": "No results found",
|
|
34
|
-
"neptune.Table.refreshPage": "Refresh page",
|
|
35
33
|
"neptune.Upload.csButtonText": "Upload another file?",
|
|
36
34
|
"neptune.Upload.csFailureText": "Upload failed. Please, try again",
|
|
37
35
|
"neptune.Upload.csSuccessText": "Upload complete!",
|