@transferwise/components 0.0.0-experimental-8ef2fe2 → 0.0.0-experimental-1ffdc56
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 +33 -17
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +30 -14
- package/build/alert/Alert.mjs.map +1 -1
- package/build/common/action/Action.js +26 -15
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +26 -15
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/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 +10 -73
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +11 -74
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/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 +14 -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/button/Button.css +3 -0
- package/build/styles/criticalBanner/CriticalCommsBanner.css +7 -72
- package/build/styles/main.css +14 -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 +4 -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.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.story.tsx +36 -0
- package/src/alert/Alert.tsx +37 -8
- package/src/button/Button.css +3 -0
- package/src/button/Button.less +6 -2
- package/src/button/Button.vars.less +0 -2
- package/src/common/action/Action.tsx +39 -21
- 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 +13 -9
- package/src/criticalBanner/CriticalCommsBanner.tsx +8 -50
- package/src/i18n/en.json +1 -0
- package/src/main.css +14 -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,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;
|
|
@@ -939,6 +874,9 @@ div.critical-comms .critical-comms-body {
|
|
|
939
874
|
.np-theme-personal--bright-green .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
940
875
|
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
941
876
|
}
|
|
877
|
+
.critical-comms .wds-Button {
|
|
878
|
+
--Button-background: var(--color-contrast-overlay);
|
|
879
|
+
}
|
|
942
880
|
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right,[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-down,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-up,[dir="rtl"] .wds-Button .tw-icon-list,[dir="rtl"] .wds-Button .tw-icon-activity {
|
|
943
881
|
scale: -1 1;
|
|
944
882
|
}
|
|
@@ -4477,6 +4415,10 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4477
4415
|
.status-circle.error {
|
|
4478
4416
|
background-color: var(--color-sentiment-negative);
|
|
4479
4417
|
}
|
|
4418
|
+
.status-circle.critical {
|
|
4419
|
+
background-color: #ffffff;
|
|
4420
|
+
background-color: var(--color-background-screen);
|
|
4421
|
+
}
|
|
4480
4422
|
.status-circle.neutral {
|
|
4481
4423
|
background-color: #5d7079;
|
|
4482
4424
|
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 and behave the same. */
|
|
40
41
|
variant?: `${Variant}`;
|
|
41
42
|
/** @deprecated Use `InlineAlert` instead. */
|
|
42
43
|
arrow?: `${AlertArrowPosition}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,SAAS,EACT,IAAI,EAEJ,OAAO,EAER,MAAM,WAAW,CAAC;AASnB,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,IAAI,CAAC;CACtB,CAAC;AAEF,kDAAkD;AAClD,KAAK,mBAAmB,GAAG,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;AACrF,KAAK,iBAAiB,GAAG,GACrB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,QAAQ,EAAE,CAAC;AACzB,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,GAAG,cAAc;IACjB,SAAS,aAAa;IACtB,WAAW,cAAc;IACzB,MAAM,gBAAgB;IACtB,YAAY,eAAe;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,yIAAyI;IACzI,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;SAGK;IACL,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;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,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,MAAM,EACN,SAAS,EACT,IAAI,EACJ,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAgB,EAChB,OAAmB,EACnB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,EAAE,UAAU,+
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/alert/Alert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,SAAS,EACT,IAAI,EAEJ,OAAO,EAER,MAAM,WAAW,CAAC;AASnB,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,IAAI,CAAC;CACtB,CAAC;AAEF,kDAAkD;AAClD,KAAK,mBAAmB,GAAG,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;AACrF,KAAK,iBAAiB,GAAG,GACrB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,OAAO,GACjB,SAAS,CAAC,QAAQ,GAClB,SAAS,CAAC,QAAQ,EAAE,CAAC;AACzB,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEhE,oBAAY,kBAAkB;IAC5B,QAAQ,YAAY;IACpB,GAAG,cAAc;IACjB,SAAS,aAAa;IACtB,WAAW,cAAc;IACzB,MAAM,gBAAgB;IACtB,YAAY,eAAe;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,yIAAyI;IACzI,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;SAGK;IACL,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;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,sDAAsD;IACtD,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACvB,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,MAAM,EACN,SAAS,EACT,IAAI,EACJ,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAgB,EAChB,OAAmB,EACnB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,EAAE,UAAU,+BA6IZ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonPriority, ButtonSentiment } from '../../button/Button.types';
|
|
1
2
|
export type ActionOptions = {
|
|
2
3
|
'aria-label'?: string;
|
|
3
4
|
href?: string;
|
|
@@ -7,9 +8,11 @@ export type ActionOptions = {
|
|
|
7
8
|
};
|
|
8
9
|
type Props = {
|
|
9
10
|
variant?: 'button' | 'action-button';
|
|
11
|
+
sentiment?: ButtonSentiment;
|
|
10
12
|
action: ActionOptions;
|
|
11
13
|
className?: string;
|
|
14
|
+
priority?: ButtonPriority;
|
|
12
15
|
};
|
|
13
|
-
export declare function Action({ action, className, variant }: Props): import("react").JSX.Element;
|
|
16
|
+
export declare function Action({ action, className, variant, priority, sentiment, }: Props): import("react").JSX.Element;
|
|
14
17
|
export {};
|
|
15
18
|
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/common/action/Action.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/common/action/Action.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5E,MAAM,MAAM,aAAa,GAAG;IAC1B,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,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,QAAQ,GAAG,eAAe,CAAC;IACrC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,SAAS,EACT,OAAkB,EAClB,QAA6B,EAC7B,SAAqB,GACtB,EAAE,KAAK,+BA4CP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/sentiment.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"sentiment.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/sentiment.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IAErB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,OAAO,YAAY;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CriticalCommsBanner.d.ts","sourceRoot":"","sources":["../../../src/criticalBanner/CriticalCommsBanner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CriticalCommsBanner.d.ts","sourceRoot":"","sources":["../../../src/criticalBanner/CriticalCommsBanner.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,iBAAS,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,wBAAwB,+BAY5F;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAC;AAM1F;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACtD;;;;SAIK;IACL,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAQF,QAAA,MAAM,UAAU,6CAA+D,eAAe,
|
|
1
|
+
{"version":3,"file":"StatusIcon.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAC;AAM1F;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACtD;;;;SAIK;IACL,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAQF,QAAA,MAAM,UAAU,6CAA+D,eAAe,gCAqE7F,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.messages.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StatusIcon.messages.d.ts","sourceRoot":"","sources":["../../../src/statusIcon/StatusIcon.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAqCG"}
|
|
@@ -37,6 +37,7 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
|
|
|
37
37
|
"neptune.SelectInput.noResultsFound": string;
|
|
38
38
|
"neptune.SelectOption.action.label": string;
|
|
39
39
|
"neptune.SelectOption.selected.action.label": string;
|
|
40
|
+
"neptune.StatusIcon.iconLabel.critical": string;
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": string;
|
|
41
42
|
"neptune.StatusIcon.iconLabel.information": string;
|
|
42
43
|
"neptune.StatusIcon.iconLabel.pending": string;
|
|
@@ -117,6 +118,7 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
|
|
|
117
118
|
"neptune.SelectInput.noResultsFound": string;
|
|
118
119
|
"neptune.SelectOption.action.label": string;
|
|
119
120
|
"neptune.SelectOption.selected.action.label": string;
|
|
121
|
+
"neptune.StatusIcon.iconLabel.critical": string;
|
|
120
122
|
"neptune.StatusIcon.iconLabel.error": string;
|
|
121
123
|
"neptune.StatusIcon.iconLabel.information": string;
|
|
122
124
|
"neptune.StatusIcon.iconLabel.pending": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
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-1ffdc56",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"rollup-preserve-directives": "^1.1.1",
|
|
93
93
|
"storybook": "^8.2.2",
|
|
94
94
|
"@transferwise/less-config": "3.1.0",
|
|
95
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
95
|
+
"@transferwise/neptune-css": "0.0.0-experimental-1ffdc56",
|
|
96
96
|
"@wise/components-theming": "1.6.1"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3.13.1",
|
|
100
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
100
|
+
"@transferwise/neptune-css": "0.0.0-experimental-1ffdc56",
|
|
101
101
|
"@wise/art": "^2.16",
|
|
102
102
|
"@wise/components-theming": "^1.0.0",
|
|
103
103
|
"react": ">=18",
|
|
@@ -96,11 +96,47 @@ export const WithCustomIcon: Story = {
|
|
|
96
96
|
},
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
export const WithShortTitle: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
type: Sentiment.NEUTRAL,
|
|
102
|
+
title: 'We’re reviewing your information.',
|
|
103
|
+
message:
|
|
104
|
+
'Payments sent to your bank details **today** might not arrive in time for the holidays.',
|
|
105
|
+
onDismiss: () => {},
|
|
106
|
+
action: {
|
|
107
|
+
onClick: action('alert action clicked'),
|
|
108
|
+
// href: '/',
|
|
109
|
+
text: 'Open',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
99
113
|
export const WithTitle: Story = {
|
|
100
114
|
args: {
|
|
101
115
|
type: Sentiment.NEUTRAL,
|
|
102
116
|
title: 'We’re reviewing your information.',
|
|
117
|
+
message:
|
|
118
|
+
'Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays.',
|
|
103
119
|
onDismiss: () => {},
|
|
120
|
+
action: {
|
|
121
|
+
onClick: action('alert action clicked'),
|
|
122
|
+
// href: '/',
|
|
123
|
+
text: 'Open',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const WithTitleLink: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
type: Sentiment.NEUTRAL,
|
|
131
|
+
title: 'We’re reviewing your information.',
|
|
132
|
+
message:
|
|
133
|
+
'Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays. Payments sent to your bank details **today** might not arrive in time for the holidays.',
|
|
134
|
+
onDismiss: () => {},
|
|
135
|
+
action: {
|
|
136
|
+
// onClick: action('alert action clicked'),
|
|
137
|
+
href: '/',
|
|
138
|
+
text: 'Open',
|
|
139
|
+
},
|
|
104
140
|
},
|
|
105
141
|
};
|
|
106
142
|
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -32,7 +32,8 @@ type AlertTypeResolved = `${
|
|
|
32
32
|
| Sentiment.POSITIVE
|
|
33
33
|
| Sentiment.NEUTRAL
|
|
34
34
|
| Sentiment.WARNING
|
|
35
|
-
| Sentiment.NEGATIVE
|
|
35
|
+
| Sentiment.NEGATIVE
|
|
36
|
+
| Sentiment.CRITICAL}`;
|
|
36
37
|
export type AlertType = AlertTypeResolved | AlertTypeDeprecated;
|
|
37
38
|
|
|
38
39
|
export enum AlertArrowPosition {
|
|
@@ -63,6 +64,7 @@ export interface AlertProps {
|
|
|
63
64
|
onDismiss?: React.MouseEventHandler<HTMLButtonElement>;
|
|
64
65
|
/** The type dictates which icon and colour will be used */
|
|
65
66
|
type?: AlertType;
|
|
67
|
+
/** @deprecated They both look and behave the same. */
|
|
66
68
|
variant?: `${Variant}`;
|
|
67
69
|
/** @deprecated Use `InlineAlert` instead. */
|
|
68
70
|
arrow?: `${AlertArrowPosition}`;
|
|
@@ -152,9 +154,20 @@ export default function Alert({
|
|
|
152
154
|
|
|
153
155
|
const closeButtonReference = useRef<HTMLButtonElement>(null);
|
|
154
156
|
|
|
157
|
+
const showButtonBelow = () => {
|
|
158
|
+
if (variant === 'desktop' && resolvedType === 'critical') {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
|
+
|
|
155
164
|
return (
|
|
156
165
|
<div
|
|
157
|
-
role={
|
|
166
|
+
role={
|
|
167
|
+
resolvedType === Sentiment.NEGATIVE || resolvedType === Sentiment.CRITICAL
|
|
168
|
+
? 'alert'
|
|
169
|
+
: 'status'
|
|
170
|
+
}
|
|
158
171
|
className="wds-alert__liveRegion"
|
|
159
172
|
>
|
|
160
173
|
<div
|
|
@@ -186,15 +199,13 @@ export default function Alert({
|
|
|
186
199
|
}}
|
|
187
200
|
onTouchMove={() => setShouldFire(false)}
|
|
188
201
|
>
|
|
202
|
+
<div className="alert__icon">
|
|
203
|
+
{icon || <StatusIcon size={48} sentiment={resolvedType} iconLabel={statusIconLabel} />}
|
|
204
|
+
</div>
|
|
189
205
|
<div
|
|
190
206
|
className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}
|
|
191
207
|
data-testid={variant}
|
|
192
208
|
>
|
|
193
|
-
{icon ? (
|
|
194
|
-
<div className="alert__icon">{icon}</div>
|
|
195
|
-
) : (
|
|
196
|
-
<StatusIcon size={Size.LARGE} sentiment={resolvedType} iconLabel={statusIconLabel} />
|
|
197
|
-
)}
|
|
198
209
|
<div className="alert__message">
|
|
199
210
|
<div>
|
|
200
211
|
{title && (
|
|
@@ -206,9 +217,27 @@ export default function Alert({
|
|
|
206
217
|
{children || <InlineMarkdown>{message}</InlineMarkdown>}
|
|
207
218
|
</Body>
|
|
208
219
|
</div>
|
|
209
|
-
{action &&
|
|
220
|
+
{action && showButtonBelow() && (
|
|
221
|
+
<Action
|
|
222
|
+
action={action}
|
|
223
|
+
variant="action-button"
|
|
224
|
+
className="m-t-2"
|
|
225
|
+
sentiment={type === 'critical' ? 'negative' : 'default'}
|
|
226
|
+
priority={type === 'critical' ? 'secondary' : 'tertiary'}
|
|
227
|
+
/>
|
|
228
|
+
)}
|
|
210
229
|
</div>
|
|
211
230
|
</div>
|
|
231
|
+
{action && !showButtonBelow() && (
|
|
232
|
+
<div className="action__desktop">
|
|
233
|
+
<Action
|
|
234
|
+
action={action}
|
|
235
|
+
variant="action-button"
|
|
236
|
+
sentiment={type === 'critical' ? 'negative' : 'default'}
|
|
237
|
+
priority={type === 'critical' ? 'secondary' : 'tertiary'}
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
)}
|
|
212
241
|
{onDismiss && (
|
|
213
242
|
<CloseButton ref={closeButtonReference} className="m-l-2" onClick={onDismiss} />
|
|
214
243
|
)}
|
package/src/button/Button.css
CHANGED
|
@@ -220,6 +220,9 @@
|
|
|
220
220
|
.np-theme-personal--bright-green .wds-Button--minimal .wds-Button-avatars .np-circle {
|
|
221
221
|
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
222
222
|
}
|
|
223
|
+
.critical-comms .wds-Button {
|
|
224
|
+
--Button-background: var(--color-contrast-overlay);
|
|
225
|
+
}
|
|
223
226
|
[dir="rtl"] .wds-Button .tw-icon-chevron-right,[dir="rtl"] .wds-Button .tw-icon-arrow-right,[dir="rtl"] .wds-Button .tw-icon-chevron-left,[dir="rtl"] .wds-Button .tw-icon-arrow-left,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-down,[dir="rtl"] .wds-Button .tw-icon-arrow-diagonal-up,[dir="rtl"] .wds-Button .tw-icon-list,[dir="rtl"] .wds-Button .tw-icon-activity {
|
|
224
227
|
scale: -1 1;
|
|
225
228
|
}
|
package/src/button/Button.less
CHANGED
|
@@ -137,8 +137,6 @@
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
140
|
// Width modifiers
|
|
143
141
|
&--block {
|
|
144
142
|
width: 100%;
|
|
@@ -219,6 +217,12 @@
|
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
219
|
|
|
220
|
+
.critical-comms {
|
|
221
|
+
.wds-Button {
|
|
222
|
+
--Button-background: var(--color-contrast-overlay);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
222
226
|
:dir(rtl) {
|
|
223
227
|
.wds-Button {
|
|
224
228
|
.tw-icon-chevron-right,
|
|
@@ -39,14 +39,12 @@
|
|
|
39
39
|
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
40
40
|
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
.np-theme-personal--bright-green & {
|
|
44
43
|
--Button-primary-negative-color: var(--color-white);
|
|
45
44
|
--Button-secondary-color: var(--color-interactive-control);
|
|
46
45
|
--Button-secondary-negative-color: var(--color-white);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
|
|
50
48
|
.np-theme-personal--forest-green & {
|
|
51
49
|
--Button-secondary-background: var(--color-interactive-neutral);
|
|
52
50
|
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
@@ -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;
|
|
@@ -14,11 +15,19 @@ export type ActionOptions = {
|
|
|
14
15
|
|
|
15
16
|
type Props = {
|
|
16
17
|
variant?: 'button' | 'action-button';
|
|
18
|
+
sentiment?: ButtonSentiment;
|
|
17
19
|
action: ActionOptions;
|
|
18
20
|
className?: string;
|
|
21
|
+
priority?: ButtonPriority;
|
|
19
22
|
};
|
|
20
23
|
|
|
21
|
-
export function Action({
|
|
24
|
+
export function Action({
|
|
25
|
+
action,
|
|
26
|
+
className,
|
|
27
|
+
variant = 'button',
|
|
28
|
+
priority = Priority.SECONDARY,
|
|
29
|
+
sentiment = 'default',
|
|
30
|
+
}: Props) {
|
|
22
31
|
if ('href' in action) {
|
|
23
32
|
return (
|
|
24
33
|
<Link
|
|
@@ -34,23 +43,32 @@ export function Action({ action, className, variant = 'button' }: Props) {
|
|
|
34
43
|
);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
switch (variant) {
|
|
47
|
+
case 'action-button':
|
|
48
|
+
return (
|
|
49
|
+
<Button
|
|
50
|
+
v2
|
|
51
|
+
size="sm"
|
|
52
|
+
sentiment={sentiment}
|
|
53
|
+
aria-label={action['aria-label']}
|
|
54
|
+
priority={priority}
|
|
55
|
+
className={clsx(className)}
|
|
56
|
+
onClick={action.onClick}
|
|
57
|
+
>
|
|
58
|
+
{action.text}
|
|
59
|
+
</Button>
|
|
60
|
+
);
|
|
61
|
+
case 'button':
|
|
62
|
+
default:
|
|
63
|
+
return (
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
aria-label={action['aria-label']}
|
|
67
|
+
className={clsx('btn-unstyled np-text-link-large', className)}
|
|
68
|
+
onClick={action.onClick}
|
|
69
|
+
>
|
|
70
|
+
{action.text}
|
|
71
|
+
</button>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
56
74
|
}
|