@transferwise/components 0.0.0-experimental-d4fb387 → 0.0.0-experimental-93ed47e
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 +29 -17
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +26 -14
- package/build/alert/Alert.mjs.map +1 -1
- package/build/common/action/Action.js +3 -2
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +3 -2
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/propsValues/sentiment.js +1 -0
- package/build/common/propsValues/sentiment.js.map +1 -1
- package/build/common/propsValues/sentiment.mjs +1 -0
- package/build/common/propsValues/sentiment.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +13 -74
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +14 -75
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +11 -72
- package/build/statusIcon/StatusIcon.js +5 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.messages.js +3 -0
- package/build/statusIcon/StatusIcon.messages.js.map +1 -1
- package/build/statusIcon/StatusIcon.messages.mjs +3 -0
- package/build/statusIcon/StatusIcon.messages.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +5 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/criticalBanner/CriticalCommsBanner.css +7 -72
- package/build/styles/main.css +11 -72
- package/build/styles/statusIcon/StatusIcon.css +4 -0
- package/build/types/alert/Alert.d.ts +2 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/common/action/Action.d.ts +3 -1
- package/build/types/common/action/Action.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +1 -0
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +3 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.messages.d.ts +5 -0
- package/build/types/statusIcon/StatusIcon.messages.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.less +4 -0
- package/src/alert/Alert.story.tsx +36 -0
- package/src/alert/Alert.tsx +26 -8
- package/src/button/Button.story.tsx +7 -2
- package/src/button/LegacyButton.story.tsx +4 -1
- package/src/common/action/Action.tsx +8 -2
- package/src/common/propsValues/sentiment.ts +1 -0
- package/src/criticalBanner/CriticalCommsBanner.css +7 -72
- package/src/criticalBanner/CriticalCommsBanner.less +12 -73
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +2 -0
- package/src/criticalBanner/CriticalCommsBanner.tsx +18 -51
- package/src/i18n/en.json +1 -0
- package/src/main.css +11 -72
- package/src/statusIcon/StatusIcon.css +4 -0
- package/src/statusIcon/StatusIcon.less +4 -0
- package/src/statusIcon/StatusIcon.messages.ts +6 -0
- package/src/statusIcon/StatusIcon.tsx +8 -1
|
@@ -1,87 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTheme } from '@wise/components-theming';
|
|
1
|
+
import Alert from '../alert/Alert.mjs';
|
|
3
2
|
import { clsx } from 'clsx';
|
|
4
|
-
import {
|
|
5
|
-
import Avatar from '../avatar/Avatar.mjs';
|
|
6
|
-
import Body from '../body/Body.mjs';
|
|
7
|
-
import Button from '../button/Button.resolver.mjs';
|
|
8
|
-
import '../common/theme.mjs';
|
|
9
|
-
import '../common/direction.mjs';
|
|
10
|
-
import { ControlType, Priority } from '../common/propsValues/control.mjs';
|
|
11
|
-
import '../common/propsValues/breakpoint.mjs';
|
|
12
|
-
import { Size } from '../common/propsValues/size.mjs';
|
|
13
|
-
import { Typography } from '../common/propsValues/typography.mjs';
|
|
14
|
-
import '../common/propsValues/width.mjs';
|
|
15
|
-
import '../common/propsValues/type.mjs';
|
|
16
|
-
import '../common/propsValues/dateMode.mjs';
|
|
17
|
-
import '../common/propsValues/monthFormat.mjs';
|
|
18
|
-
import '../common/propsValues/position.mjs';
|
|
19
|
-
import '../common/propsValues/layouts.mjs';
|
|
20
|
-
import '../common/propsValues/status.mjs';
|
|
21
|
-
import '../common/propsValues/sentiment.mjs';
|
|
22
|
-
import '../common/propsValues/profileType.mjs';
|
|
23
|
-
import '../common/propsValues/variant.mjs';
|
|
24
|
-
import '../common/propsValues/scroll.mjs';
|
|
25
|
-
import '../common/propsValues/markdownNodeType.mjs';
|
|
26
|
-
import '../common/fileType.mjs';
|
|
27
|
-
import 'react';
|
|
28
|
-
import 'react-intl';
|
|
29
|
-
import '../common/closeButton/CloseButton.messages.mjs';
|
|
30
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
31
|
-
import Title from '../title/Title.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
32
4
|
|
|
33
5
|
function CriticalCommsBanner({
|
|
34
6
|
title,
|
|
35
7
|
subtitle,
|
|
36
8
|
action,
|
|
37
|
-
className
|
|
9
|
+
className,
|
|
10
|
+
variant
|
|
38
11
|
}) {
|
|
39
|
-
const {
|
|
40
|
-
isModern
|
|
41
|
-
} = useTheme();
|
|
42
12
|
return /*#__PURE__*/jsx("div", {
|
|
43
13
|
className: clsx('critical-comms', className),
|
|
44
|
-
children: /*#__PURE__*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
55
|
-
className: "critical-comms-content d-flex align-items-center flex-grow-1",
|
|
56
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
57
|
-
className: clsx('flex-grow-1', {
|
|
58
|
-
'p-x-2': !isModern
|
|
59
|
-
}),
|
|
60
|
-
children: [/*#__PURE__*/jsx(Title, {
|
|
61
|
-
type: isModern ? Typography.TITLE_BODY : Typography.TITLE_GROUP,
|
|
62
|
-
className: "critical-comms--title",
|
|
63
|
-
children: title
|
|
64
|
-
}), /*#__PURE__*/jsx(Body, {
|
|
65
|
-
className: "critical-comms--subtitle",
|
|
66
|
-
children: subtitle
|
|
67
|
-
})]
|
|
68
|
-
}), action ? /*#__PURE__*/jsx("div", {
|
|
69
|
-
className: "critical-comms--cta",
|
|
70
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
71
|
-
block: isModern,
|
|
72
|
-
size: Size.SMALL,
|
|
73
|
-
type: ControlType.NEGATIVE,
|
|
74
|
-
priority: isModern ? Priority.SECONDARY : Priority.PRIMARY,
|
|
75
|
-
className: "cta-btn",
|
|
76
|
-
onClick: () => {
|
|
77
|
-
if (action) {
|
|
78
|
-
window.location.href = action.href;
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
children: action.label
|
|
82
|
-
})
|
|
83
|
-
}) : null]
|
|
84
|
-
})]
|
|
14
|
+
children: /*#__PURE__*/jsx(Alert, {
|
|
15
|
+
title: title,
|
|
16
|
+
message: subtitle,
|
|
17
|
+
action: {
|
|
18
|
+
target: action?.href,
|
|
19
|
+
text: action?.label
|
|
20
|
+
},
|
|
21
|
+
className: className,
|
|
22
|
+
type: "critical",
|
|
23
|
+
variant: variant
|
|
85
24
|
})
|
|
86
25
|
});
|
|
87
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CriticalCommsBanner.mjs","sources":["../../src/criticalBanner/CriticalCommsBanner.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CriticalCommsBanner.mjs","sources":["../../src/criticalBanner/CriticalCommsBanner.tsx"],"sourcesContent":["import Alert from '../alert';\nimport { clsx } from 'clsx';\nimport { Variant } from '../common';\n\nexport type CriticalCommsBannerProps = {\n title: string;\n subtitle?: string;\n action?: {\n label: string;\n href: string;\n };\n className?: string;\n variant?: Variant;\n};\n\nfunction CriticalCommsBanner({\n title,\n subtitle,\n action,\n className,\n variant,\n}: CriticalCommsBannerProps) {\n return (\n <div className={clsx('critical-comms', className)}>\n <Alert\n title={title}\n message={subtitle}\n action={{ target: action?.href, text: action?.label }}\n className={className}\n type=\"critical\"\n variant={variant}\n />\n </div>\n );\n}\n\nexport default CriticalCommsBanner;\n"],"names":["CriticalCommsBanner","title","subtitle","action","className","variant","_jsx","clsx","children","Alert","message","target","href","text","label","type"],"mappings":";;;;AAeA,SAASA,mBAAmBA,CAAC;EAC3BC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACNC,SAAS;AACTC,EAAAA,OAAAA;AACyB,CAAA,EAAA;AACzB,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;AAAKF,IAAAA,SAAS,EAAEG,IAAI,CAAC,gBAAgB,EAAEH,SAAS,CAAE;IAAAI,QAAA,eAChDF,GAAA,CAACG,KAAK,EAAA;AACJR,MAAAA,KAAK,EAAEA,KAAM;AACbS,MAAAA,OAAO,EAAER,QAAS;AAClBC,MAAAA,MAAM,EAAE;QAAEQ,MAAM,EAAER,MAAM,EAAES,IAAI;QAAEC,IAAI,EAAEV,MAAM,EAAEW,KAAAA;OAAQ;AACtDV,MAAAA,SAAS,EAAEA,SAAU;AACrBW,MAAAA,IAAI,EAAC,UAAU;AACfV,MAAAA,OAAO,EAAEA,OAAAA;KAEb,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
package/build/i18n/en.json
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "No results found",
|
|
28
28
|
"neptune.SelectOption.action.label": "Choose",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Change chosen option",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.critical": "Critical:",
|
|
30
31
|
"neptune.StatusIcon.iconLabel.error": "Error:",
|
|
31
32
|
"neptune.StatusIcon.iconLabel.information": "Information:",
|
|
32
33
|
"neptune.StatusIcon.iconLabel.pending": "Pending:",
|
package/build/i18n/en.json.js
CHANGED
|
@@ -29,6 +29,7 @@ var en = {
|
|
|
29
29
|
"neptune.SelectInput.noResultsFound": "No results found",
|
|
30
30
|
"neptune.SelectOption.action.label": "Choose",
|
|
31
31
|
"neptune.SelectOption.selected.action.label": "Change chosen option",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.critical": "Critical:",
|
|
32
33
|
"neptune.StatusIcon.iconLabel.error": "Error:",
|
|
33
34
|
"neptune.StatusIcon.iconLabel.information": "Information:",
|
|
34
35
|
"neptune.StatusIcon.iconLabel.pending": "Pending:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/en.json.mjs
CHANGED
|
@@ -27,6 +27,7 @@ var en = {
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "No results found",
|
|
28
28
|
"neptune.SelectOption.action.label": "Choose",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Change chosen option",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.critical": "Critical:",
|
|
30
31
|
"neptune.StatusIcon.iconLabel.error": "Error:",
|
|
31
32
|
"neptune.StatusIcon.iconLabel.information": "Information:",
|
|
32
33
|
"neptune.StatusIcon.iconLabel.pending": "Pending:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/main.css
CHANGED
|
@@ -1,78 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
44
|
-
}
|
|
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;
|
|
1
|
+
.np-theme-personal .critical-comms .alert-critical {
|
|
2
|
+
color: var(--color-contrast-overlay);
|
|
3
|
+
background-color: var(--color-sentiment-negative) !important;
|
|
54
4
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding-left: var(--critical-comms-subtitle-color-padding-left);
|
|
58
|
-
padding-top: var(--critical-comms-vertical-spacing);
|
|
59
|
-
min-width: 100%;
|
|
60
|
-
}
|
|
5
|
+
.np-theme-personal .critical-comms .alert-critical .np-text-title-body {
|
|
6
|
+
color: var(--color-contrast-overlay);
|
|
61
7
|
}
|
|
62
|
-
|
|
8
|
+
.np-theme-personal .critical-comms .action__desktop {
|
|
63
9
|
display: flex;
|
|
64
|
-
|
|
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;
|
|
75
|
-
}
|
|
10
|
+
align-items: center;
|
|
76
11
|
}
|
|
77
12
|
.tw-date-lookup-calendar > tbody > tr > td.weekend button {
|
|
78
13
|
font-size: 0.875rem;
|
|
@@ -4477,6 +4412,10 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4477
4412
|
.status-circle.error {
|
|
4478
4413
|
background-color: var(--color-sentiment-negative);
|
|
4479
4414
|
}
|
|
4415
|
+
.status-circle.critical {
|
|
4416
|
+
background-color: #ffffff;
|
|
4417
|
+
background-color: var(--color-background-screen);
|
|
4418
|
+
}
|
|
4480
4419
|
.status-circle.neutral {
|
|
4481
4420
|
background-color: #5d7079;
|
|
4482
4421
|
background-color: var(--color-content-secondary);
|
|
@@ -53,6 +53,10 @@ const StatusIcon = ({
|
|
|
53
53
|
Icon: icons.Alert,
|
|
54
54
|
defaultIconLabel: intl.formatMessage(StatusIcon_messages.warningLabel)
|
|
55
55
|
},
|
|
56
|
+
[sentiment.Sentiment.CRITICAL]: {
|
|
57
|
+
Icon: icons.Alert,
|
|
58
|
+
defaultIconLabel: intl.formatMessage(StatusIcon_messages.criticalLabel)
|
|
59
|
+
},
|
|
56
60
|
[sentiment.Sentiment.PENDING]: {
|
|
57
61
|
Icon: icons.ClockBorderless,
|
|
58
62
|
defaultIconLabel: intl.formatMessage(StatusIcon_messages.pendingLabel)
|
|
@@ -79,7 +83,7 @@ const StatusIcon = ({
|
|
|
79
83
|
Icon,
|
|
80
84
|
defaultIconLabel
|
|
81
85
|
} = iconMetaBySentiment[sentiment$1];
|
|
82
|
-
const iconColor = sentiment$1 === 'warning' || sentiment$1 === 'pending' ? 'dark' : 'light';
|
|
86
|
+
const iconColor = sentiment$1 === 'warning' || sentiment$1 === 'pending' || sentiment$1 === 'critical' ? 'dark' : 'light';
|
|
83
87
|
const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
|
|
84
88
|
const size = mapLegacySize[sizeProp] ?? sizeProp;
|
|
85
89
|
return /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nimport messages from './StatusIcon.messages';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n /**\n * Override for the sentiment's-derived, default, accessible\n * name announced by the screen readers. <br />\n * Using `null` will render the icon purely presentational.\n * */\n iconLabel?: string | null;\n};\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {\n const intl = useIntl();\n\n const iconMetaBySentiment: Record<\n `${Sentiment}`,\n {\n Icon: React.ElementType;\n defaultIconLabel: string;\n }\n > = {\n [Sentiment.NEGATIVE]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.POSITIVE]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n [Sentiment.WARNING]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.warningLabel),\n },\n [Sentiment.PENDING]: {\n Icon: ClockBorderless,\n defaultIconLabel: intl.formatMessage(messages.pendingLabel),\n },\n [Sentiment.NEUTRAL]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n // deprecated\n [Sentiment.ERROR]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.INFO]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n [Sentiment.SUCCESS]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n };\n const { Icon, defaultIconLabel } = iconMetaBySentiment[sentiment];\n\n const iconColor
|
|
1
|
+
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nimport messages from './StatusIcon.messages';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n /**\n * Override for the sentiment's-derived, default, accessible\n * name announced by the screen readers. <br />\n * Using `null` will render the icon purely presentational.\n * */\n iconLabel?: string | null;\n};\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {\n const intl = useIntl();\n\n const iconMetaBySentiment: Record<\n `${Sentiment}`,\n {\n Icon: React.ElementType;\n defaultIconLabel: string;\n }\n > = {\n [Sentiment.NEGATIVE]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.POSITIVE]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n [Sentiment.WARNING]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.warningLabel),\n },\n [Sentiment.CRITICAL]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.criticalLabel),\n },\n [Sentiment.PENDING]: {\n Icon: ClockBorderless,\n defaultIconLabel: intl.formatMessage(messages.pendingLabel),\n },\n [Sentiment.NEUTRAL]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n // deprecated\n [Sentiment.ERROR]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.INFO]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n [Sentiment.SUCCESS]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n };\n const { Icon, defaultIconLabel } = iconMetaBySentiment[sentiment];\n\n const iconColor =\n sentiment === 'warning' || sentiment === 'pending' || sentiment === 'critical'\n ? 'dark'\n : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = mapLegacySize[sizeProp] ?? sizeProp;\n return (\n <Circle\n as=\"span\"\n size={isTinyViewport && size < 40 ? 32 : size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', sentiment)}\n >\n <Icon\n className={clsx('status-icon', iconColor)}\n title={iconLabel === null ? undefined : iconLabel || defaultIconLabel}\n />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","iconLabel","intl","useIntl","iconMetaBySentiment","Sentiment","NEGATIVE","Icon","Cross","defaultIconLabel","formatMessage","messages","errorLabel","POSITIVE","Check","successLabel","WARNING","Alert","warningLabel","CRITICAL","criticalLabel","PENDING","ClockBorderless","pendingLabel","NEUTRAL","Info","informationLabel","ERROR","INFO","SUCCESS","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children","title","undefined"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.messages.js","sources":["../../src/statusIcon/StatusIcon.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n errorLabel: {\n id: 'neptune.StatusIcon.iconLabel.error',\n defaultMessage: 'Error:',\n description:\n 'Visually hidden label read by screen readers, describing the Error icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n successLabel: {\n id: 'neptune.StatusIcon.iconLabel.success',\n defaultMessage: 'Success:',\n description:\n 'Visually hidden label read by screen readers, describing the Success icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n warningLabel: {\n id: 'neptune.StatusIcon.iconLabel.warning',\n defaultMessage: 'Warning:',\n description:\n 'Visually hidden label read by screen readers, describing the Warning icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n pendingLabel: {\n id: 'neptune.StatusIcon.iconLabel.pending',\n defaultMessage: 'Pending:',\n description:\n 'Visually hidden label read by screen readers, describing the Pending icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n informationLabel: {\n id: 'neptune.StatusIcon.iconLabel.information',\n defaultMessage: 'Information:',\n description:\n 'Visually hidden label read by screen readers, describing the Information icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n});\n"],"names":["defineMessages","errorLabel","id","successLabel","warningLabel","pendingLabel","informationLabel"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA,oCAAA;GAIH;AACDC,EAAAA,YAAY,EAAE;IACZD,EAAE,EAAA,sCAAA;GAIH;AACDE,EAAAA,YAAY,EAAE;IACZF,EAAE,EAAA,sCAAA;GAIH;AACDG,EAAAA,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"StatusIcon.messages.js","sources":["../../src/statusIcon/StatusIcon.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n errorLabel: {\n id: 'neptune.StatusIcon.iconLabel.error',\n defaultMessage: 'Error:',\n description:\n 'Visually hidden label read by screen readers, describing the Error icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n successLabel: {\n id: 'neptune.StatusIcon.iconLabel.success',\n defaultMessage: 'Success:',\n description:\n 'Visually hidden label read by screen readers, describing the Success icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n warningLabel: {\n id: 'neptune.StatusIcon.iconLabel.warning',\n defaultMessage: 'Warning:',\n description:\n 'Visually hidden label read by screen readers, describing the Warning icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n criticalLabel: {\n id: 'neptune.StatusIcon.iconLabel.critical',\n defaultMessage: 'Critical:',\n description:\n 'Visually hidden label read by screen readers, describing the Critical icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n pendingLabel: {\n id: 'neptune.StatusIcon.iconLabel.pending',\n defaultMessage: 'Pending:',\n description:\n 'Visually hidden label read by screen readers, describing the Pending icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n informationLabel: {\n id: 'neptune.StatusIcon.iconLabel.information',\n defaultMessage: 'Information:',\n description:\n 'Visually hidden label read by screen readers, describing the Information icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n});\n"],"names":["defineMessages","errorLabel","id","successLabel","warningLabel","criticalLabel","pendingLabel","informationLabel"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA,oCAAA;GAIH;AACDC,EAAAA,YAAY,EAAE;IACZD,EAAE,EAAA,sCAAA;GAIH;AACDE,EAAAA,YAAY,EAAE;IACZF,EAAE,EAAA,sCAAA;GAIH;AACDG,EAAAA,aAAa,EAAE;IACbH,EAAE,EAAA,uCAAA;GAIH;AACDI,EAAAA,YAAY,EAAE;IACZJ,EAAE,EAAA,sCAAA;GAIH;AACDK,EAAAA,gBAAgB,EAAE;IAChBL,EAAE,EAAA,0CAAA;AAIH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.messages.mjs","sources":["../../src/statusIcon/StatusIcon.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n errorLabel: {\n id: 'neptune.StatusIcon.iconLabel.error',\n defaultMessage: 'Error:',\n description:\n 'Visually hidden label read by screen readers, describing the Error icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n successLabel: {\n id: 'neptune.StatusIcon.iconLabel.success',\n defaultMessage: 'Success:',\n description:\n 'Visually hidden label read by screen readers, describing the Success icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n warningLabel: {\n id: 'neptune.StatusIcon.iconLabel.warning',\n defaultMessage: 'Warning:',\n description:\n 'Visually hidden label read by screen readers, describing the Warning icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n pendingLabel: {\n id: 'neptune.StatusIcon.iconLabel.pending',\n defaultMessage: 'Pending:',\n description:\n 'Visually hidden label read by screen readers, describing the Pending icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n informationLabel: {\n id: 'neptune.StatusIcon.iconLabel.information',\n defaultMessage: 'Information:',\n description:\n 'Visually hidden label read by screen readers, describing the Information icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n});\n"],"names":["defineMessages","errorLabel","id","successLabel","warningLabel","pendingLabel","informationLabel"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA,oCAAA;GAIH;AACDC,EAAAA,YAAY,EAAE;IACZD,EAAE,EAAA,sCAAA;GAIH;AACDE,EAAAA,YAAY,EAAE;IACZF,EAAE,EAAA,sCAAA;GAIH;AACDG,EAAAA,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"StatusIcon.messages.mjs","sources":["../../src/statusIcon/StatusIcon.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n errorLabel: {\n id: 'neptune.StatusIcon.iconLabel.error',\n defaultMessage: 'Error:',\n description:\n 'Visually hidden label read by screen readers, describing the Error icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n successLabel: {\n id: 'neptune.StatusIcon.iconLabel.success',\n defaultMessage: 'Success:',\n description:\n 'Visually hidden label read by screen readers, describing the Success icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n warningLabel: {\n id: 'neptune.StatusIcon.iconLabel.warning',\n defaultMessage: 'Warning:',\n description:\n 'Visually hidden label read by screen readers, describing the Warning icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n criticalLabel: {\n id: 'neptune.StatusIcon.iconLabel.critical',\n defaultMessage: 'Critical:',\n description:\n 'Visually hidden label read by screen readers, describing the Critical icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n pendingLabel: {\n id: 'neptune.StatusIcon.iconLabel.pending',\n defaultMessage: 'Pending:',\n description:\n 'Visually hidden label read by screen readers, describing the Pending icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n informationLabel: {\n id: 'neptune.StatusIcon.iconLabel.information',\n defaultMessage: 'Information:',\n description:\n 'Visually hidden label read by screen readers, describing the Information icon – normally a prefix to remaining visible content, e.g. validation result.',\n },\n});\n"],"names":["defineMessages","errorLabel","id","successLabel","warningLabel","criticalLabel","pendingLabel","informationLabel"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,UAAU,EAAE;IACVC,EAAE,EAAA,oCAAA;GAIH;AACDC,EAAAA,YAAY,EAAE;IACZD,EAAE,EAAA,sCAAA;GAIH;AACDE,EAAAA,YAAY,EAAE;IACZF,EAAE,EAAA,sCAAA;GAIH;AACDG,EAAAA,aAAa,EAAE;IACbH,EAAE,EAAA,uCAAA;GAIH;AACDI,EAAAA,YAAY,EAAE;IACZJ,EAAE,EAAA,sCAAA;GAIH;AACDK,EAAAA,gBAAgB,EAAE;IAChBL,EAAE,EAAA,0CAAA;AAIH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -51,6 +51,10 @@ const StatusIcon = ({
|
|
|
51
51
|
Icon: Alert,
|
|
52
52
|
defaultIconLabel: intl.formatMessage(messages.warningLabel)
|
|
53
53
|
},
|
|
54
|
+
[Sentiment.CRITICAL]: {
|
|
55
|
+
Icon: Alert,
|
|
56
|
+
defaultIconLabel: intl.formatMessage(messages.criticalLabel)
|
|
57
|
+
},
|
|
54
58
|
[Sentiment.PENDING]: {
|
|
55
59
|
Icon: ClockBorderless,
|
|
56
60
|
defaultIconLabel: intl.formatMessage(messages.pendingLabel)
|
|
@@ -77,7 +81,7 @@ const StatusIcon = ({
|
|
|
77
81
|
Icon,
|
|
78
82
|
defaultIconLabel
|
|
79
83
|
} = iconMetaBySentiment[sentiment];
|
|
80
|
-
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
84
|
+
const iconColor = sentiment === 'warning' || sentiment === 'pending' || sentiment === 'critical' ? 'dark' : 'light';
|
|
81
85
|
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
82
86
|
const size = mapLegacySize[sizeProp] ?? sizeProp;
|
|
83
87
|
return /*#__PURE__*/jsx(Circle, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nimport messages from './StatusIcon.messages';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n /**\n * Override for the sentiment's-derived, default, accessible\n * name announced by the screen readers. <br />\n * Using `null` will render the icon purely presentational.\n * */\n iconLabel?: string | null;\n};\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {\n const intl = useIntl();\n\n const iconMetaBySentiment: Record<\n `${Sentiment}`,\n {\n Icon: React.ElementType;\n defaultIconLabel: string;\n }\n > = {\n [Sentiment.NEGATIVE]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.POSITIVE]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n [Sentiment.WARNING]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.warningLabel),\n },\n [Sentiment.PENDING]: {\n Icon: ClockBorderless,\n defaultIconLabel: intl.formatMessage(messages.pendingLabel),\n },\n [Sentiment.NEUTRAL]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n // deprecated\n [Sentiment.ERROR]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.INFO]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n [Sentiment.SUCCESS]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n };\n const { Icon, defaultIconLabel } = iconMetaBySentiment[sentiment];\n\n const iconColor
|
|
1
|
+
{"version":3,"file":"StatusIcon.mjs","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nimport messages from './StatusIcon.messages';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n /**\n * Override for the sentiment's-derived, default, accessible\n * name announced by the screen readers. <br />\n * Using `null` will render the icon purely presentational.\n * */\n iconLabel?: string | null;\n};\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {\n const intl = useIntl();\n\n const iconMetaBySentiment: Record<\n `${Sentiment}`,\n {\n Icon: React.ElementType;\n defaultIconLabel: string;\n }\n > = {\n [Sentiment.NEGATIVE]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.POSITIVE]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n [Sentiment.WARNING]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.warningLabel),\n },\n [Sentiment.CRITICAL]: {\n Icon: Alert,\n defaultIconLabel: intl.formatMessage(messages.criticalLabel),\n },\n [Sentiment.PENDING]: {\n Icon: ClockBorderless,\n defaultIconLabel: intl.formatMessage(messages.pendingLabel),\n },\n [Sentiment.NEUTRAL]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n // deprecated\n [Sentiment.ERROR]: {\n Icon: Cross,\n defaultIconLabel: intl.formatMessage(messages.errorLabel),\n },\n [Sentiment.INFO]: {\n Icon: Info,\n defaultIconLabel: intl.formatMessage(messages.informationLabel),\n },\n [Sentiment.SUCCESS]: {\n Icon: Check,\n defaultIconLabel: intl.formatMessage(messages.successLabel),\n },\n };\n const { Icon, defaultIconLabel } = iconMetaBySentiment[sentiment];\n\n const iconColor =\n sentiment === 'warning' || sentiment === 'pending' || sentiment === 'critical'\n ? 'dark'\n : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size = mapLegacySize[sizeProp] ?? sizeProp;\n return (\n <Circle\n as=\"span\"\n size={isTinyViewport && size < 40 ? 32 : size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', sentiment)}\n >\n <Icon\n className={clsx('status-icon', iconColor)}\n title={iconLabel === null ? undefined : iconLabel || defaultIconLabel}\n />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","iconLabel","intl","useIntl","iconMetaBySentiment","Sentiment","NEGATIVE","Icon","Cross","defaultIconLabel","formatMessage","messages","errorLabel","POSITIVE","Check","successLabel","WARNING","Alert","warningLabel","CRITICAL","criticalLabel","PENDING","ClockBorderless","pendingLabel","NEUTRAL","Info","informationLabel","ERROR","INFO","SUCCESS","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children","title","undefined"],"mappings":"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"}
|
|
@@ -1,76 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
1
|
+
.np-theme-personal .critical-comms .alert-critical {
|
|
2
|
+
color: var(--color-contrast-overlay);
|
|
3
|
+
background-color: var(--color-sentiment-negative) !important;
|
|
39
4
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
display: inline;
|
|
43
|
-
display: initial;
|
|
44
|
-
}
|
|
5
|
+
.np-theme-personal .critical-comms .alert-critical .np-text-title-body {
|
|
6
|
+
color: var(--color-contrast-overlay);
|
|
45
7
|
}
|
|
46
|
-
|
|
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 {
|
|
8
|
+
.np-theme-personal .critical-comms .action__desktop {
|
|
63
9
|
display: flex;
|
|
64
|
-
|
|
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;
|
|
75
|
-
}
|
|
10
|
+
align-items: center;
|
|
76
11
|
}
|
package/build/styles/main.css
CHANGED
|
@@ -1,78 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
44
|
-
}
|
|
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;
|
|
1
|
+
.np-theme-personal .critical-comms .alert-critical {
|
|
2
|
+
color: var(--color-contrast-overlay);
|
|
3
|
+
background-color: var(--color-sentiment-negative) !important;
|
|
54
4
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding-left: var(--critical-comms-subtitle-color-padding-left);
|
|
58
|
-
padding-top: var(--critical-comms-vertical-spacing);
|
|
59
|
-
min-width: 100%;
|
|
60
|
-
}
|
|
5
|
+
.np-theme-personal .critical-comms .alert-critical .np-text-title-body {
|
|
6
|
+
color: var(--color-contrast-overlay);
|
|
61
7
|
}
|
|
62
|
-
|
|
8
|
+
.np-theme-personal .critical-comms .action__desktop {
|
|
63
9
|
display: flex;
|
|
64
|
-
|
|
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;
|
|
75
|
-
}
|
|
10
|
+
align-items: center;
|
|
76
11
|
}
|
|
77
12
|
.tw-date-lookup-calendar > tbody > tr > td.weekend button {
|
|
78
13
|
font-size: 0.875rem;
|
|
@@ -4477,6 +4412,10 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4477
4412
|
.status-circle.error {
|
|
4478
4413
|
background-color: var(--color-sentiment-negative);
|
|
4479
4414
|
}
|
|
4415
|
+
.status-circle.critical {
|
|
4416
|
+
background-color: #ffffff;
|
|
4417
|
+
background-color: var(--color-background-screen);
|
|
4418
|
+
}
|
|
4480
4419
|
.status-circle.neutral {
|
|
4481
4420
|
background-color: #5d7079;
|
|
4482
4421
|
background-color: var(--color-content-secondary);
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
.status-circle.error {
|
|
18
18
|
background-color: var(--color-sentiment-negative);
|
|
19
19
|
}
|
|
20
|
+
.status-circle.critical {
|
|
21
|
+
background-color: #ffffff;
|
|
22
|
+
background-color: var(--color-background-screen);
|
|
23
|
+
}
|
|
20
24
|
.status-circle.neutral {
|
|
21
25
|
background-color: #5d7079;
|
|
22
26
|
background-color: var(--color-content-secondary);
|
|
@@ -8,7 +8,7 @@ export type AlertAction = {
|
|
|
8
8
|
};
|
|
9
9
|
/** @deprecated Use `"top" | "bottom"` instead. */
|
|
10
10
|
type AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;
|
|
11
|
-
type AlertTypeResolved = `${Sentiment.POSITIVE | Sentiment.NEUTRAL | Sentiment.WARNING | Sentiment.NEGATIVE}`;
|
|
11
|
+
type AlertTypeResolved = `${Sentiment.POSITIVE | Sentiment.NEUTRAL | Sentiment.WARNING | Sentiment.NEGATIVE | Sentiment.CRITICAL}`;
|
|
12
12
|
export type AlertType = AlertTypeResolved | AlertTypeDeprecated;
|
|
13
13
|
export declare enum AlertArrowPosition {
|
|
14
14
|
TOP_LEFT = "up-left",
|
|
@@ -37,6 +37,7 @@ export interface AlertProps {
|
|
|
37
37
|
onDismiss?: React.MouseEventHandler<HTMLButtonElement>;
|
|
38
38
|
/** The type dictates which icon and colour will be used */
|
|
39
39
|
type?: AlertType;
|
|
40
|
+
/** @deprecated They both look behave the same. */
|
|
40
41
|
variant?: `${Variant}`;
|
|
41
42
|
/** @deprecated Use `InlineAlert` instead. */
|
|
42
43
|
arrow?: `${AlertArrowPosition}`;
|