@transferwise/components 46.116.1 → 46.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +60 -131
- package/build/prompt/InlinePrompt/InlinePrompt.js +14 -8
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +15 -9
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/sentimentSurface/SentimentSurface.js +6 -5
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +6 -5
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/button/Button.css +17 -17
- package/build/styles/button/Button.vars.css +16 -16
- package/build/styles/iconButton/IconButton.css +8 -8
- package/build/styles/link/Link.css +1 -0
- package/build/styles/main.css +60 -131
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/build/styles/sentimentSurface/SentimentSurface.css +8 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +19 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts +5 -4
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts +4 -16
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +24 -0
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/button/Button.css +17 -17
- package/src/button/Button.less +1 -1
- package/src/button/Button.story.tsx +75 -110
- package/src/button/Button.tests.story.tsx +189 -0
- package/src/button/Button.vars.css +16 -16
- package/src/button/Button.vars.less +58 -18
- package/src/iconButton/IconButton.css +8 -8
- package/src/iconButton/IconButton.less +35 -4
- package/src/iconButton/IconButton.story.tsx +72 -3
- package/src/link/Link.css +1 -0
- package/src/link/Link.less +1 -0
- package/src/link/Link.story.tsx +28 -0
- package/src/main.css +60 -131
- package/src/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/src/prompt/InlinePrompt/InlinePrompt.less +31 -119
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +87 -29
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +223 -31
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +42 -11
- package/src/sentimentSurface/SentimentSurface.css +8 -1
- package/src/sentimentSurface/SentimentSurface.docs.mdx +32 -495
- package/src/sentimentSurface/SentimentSurface.less +121 -114
- package/src/sentimentSurface/SentimentSurface.spec.tsx +31 -11
- package/src/sentimentSurface/SentimentSurface.story.tsx +323 -108
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +90 -40
- package/src/sentimentSurface/SentimentSurface.tsx +16 -9
- package/src/sentimentSurface/SentimentSurface.types.ts +5 -20
- package/src/test-utils/story-config.ts +0 -1
- package/build/sentimentSurface/classMap.js +0 -17
- package/build/sentimentSurface/classMap.js.map +0 -1
- package/build/sentimentSurface/classMap.mjs +0 -14
- package/build/sentimentSurface/classMap.mjs.map +0 -1
- package/build/types/sentimentSurface/classMap.d.ts +0 -4
- package/build/types/sentimentSurface/classMap.d.ts.map +0 -1
- package/src/sentimentSurface/classMap.ts +0 -15
package/build/main.css
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
.wds-sentiment-surface {
|
|
2
|
+
--ring-outline-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
3
|
+
}
|
|
4
|
+
.wds-sentiment-surface--hasBaseStyles {
|
|
5
|
+
background-color: var(--color-sentiment-background-surface);
|
|
6
|
+
color: var(--color-sentiment-content-primary);
|
|
7
|
+
}
|
|
1
8
|
.np-theme-personal .wds-sentiment-surface-negative-base,
|
|
2
9
|
.np-theme-personal--bright-green .wds-sentiment-surface-negative-base {
|
|
3
10
|
--color-sentiment-content-primary: #CB272F;
|
|
@@ -32,7 +39,7 @@
|
|
|
32
39
|
--color-sentiment-interactive-secondary-active: #A72027;
|
|
33
40
|
--color-sentiment-interactive-secondary-neutral: #9B141B;
|
|
34
41
|
--color-sentiment-interactive-secondary-neutral-hover: #831116;
|
|
35
|
-
--color-sentiment-interactive-secondary-neutral-active: #
|
|
42
|
+
--color-sentiment-interactive-secondary-neutral-active: #6D0e13;
|
|
36
43
|
--color-sentiment-interactive-control: #CB272F;
|
|
37
44
|
--color-sentiment-interactive-control-hover: #B8232B;
|
|
38
45
|
--color-sentiment-interactive-control-active: #A72027;
|
|
@@ -874,18 +881,35 @@
|
|
|
874
881
|
position: relative;
|
|
875
882
|
z-index: 1;
|
|
876
883
|
}
|
|
884
|
+
.wds-inline-prompt:has(a):hover,
|
|
885
|
+
.wds-inline-prompt:has(button):hover {
|
|
886
|
+
background-color: var(--color-sentiment-background-surface-hover);
|
|
887
|
+
}
|
|
888
|
+
.wds-inline-prompt:has(a):active,
|
|
889
|
+
.wds-inline-prompt:has(button):active {
|
|
890
|
+
background-color: var(--color-sentiment-background-surface-active);
|
|
891
|
+
}
|
|
877
892
|
.wds-inline-prompt--muted {
|
|
878
893
|
opacity: 0.93;
|
|
879
894
|
filter: grayscale(1);
|
|
880
895
|
}
|
|
881
896
|
.wds-inline-prompt a,
|
|
882
897
|
.wds-inline-prompt button {
|
|
898
|
+
color: var(--color-sentiment-content-primary);
|
|
883
899
|
text-underline-offset: calc(4px / 2);
|
|
884
900
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
885
901
|
}
|
|
902
|
+
.wds-inline-prompt a:hover,
|
|
903
|
+
.wds-inline-prompt button:hover {
|
|
904
|
+
color: var(--color-sentiment-content-primary-hover);
|
|
905
|
+
}
|
|
906
|
+
.wds-inline-prompt a:active,
|
|
907
|
+
.wds-inline-prompt button:active {
|
|
908
|
+
color: var(--color-sentiment-content-primary-active);
|
|
909
|
+
}
|
|
886
910
|
.wds-inline-prompt a:first-of-type:before,
|
|
887
911
|
.wds-inline-prompt button:first-of-type:before {
|
|
888
|
-
content:
|
|
912
|
+
content: "";
|
|
889
913
|
position: absolute;
|
|
890
914
|
inset: 0;
|
|
891
915
|
}
|
|
@@ -899,112 +923,16 @@
|
|
|
899
923
|
}
|
|
900
924
|
.wds-inline-prompt__media-wrapper .tw-icon-tags,
|
|
901
925
|
.wds-inline-prompt__media-wrapper .tw-icon-confetti {
|
|
902
|
-
color: var(--color-sentiment-
|
|
903
|
-
}
|
|
904
|
-
.wds-inline-prompt--negative {
|
|
905
|
-
background-color: var(--color-sentiment-negative-secondary);
|
|
906
|
-
color: var(--color-sentiment-negative-primary);
|
|
907
|
-
}
|
|
908
|
-
.wds-inline-prompt--negative a,
|
|
909
|
-
.wds-inline-prompt--negative button {
|
|
910
|
-
color: var(--color-sentiment-negative-primary);
|
|
911
|
-
}
|
|
912
|
-
.wds-inline-prompt--negative a:hover,
|
|
913
|
-
.wds-inline-prompt--negative button:hover {
|
|
914
|
-
color: var(--color-sentiment-negative-primary-hover);
|
|
915
|
-
}
|
|
916
|
-
.wds-inline-prompt--negative a:active,
|
|
917
|
-
.wds-inline-prompt--negative button:active {
|
|
918
|
-
color: var(--color-sentiment-negative-primary-active);
|
|
919
|
-
}
|
|
920
|
-
.wds-inline-prompt.wds-inline-prompt--negative:has(a, button):hover {
|
|
921
|
-
background-color: var(--color-sentiment-negative-secondary-hover);
|
|
922
|
-
}
|
|
923
|
-
.wds-inline-prompt.wds-inline-prompt--negative:has(a, button):active {
|
|
924
|
-
background-color: var(--color-sentiment-negative-secondary-active);
|
|
925
|
-
}
|
|
926
|
-
.wds-inline-prompt--positive {
|
|
927
|
-
background-color: var(--color-sentiment-positive-secondary);
|
|
928
|
-
color: var(--color-sentiment-positive-primary);
|
|
929
|
-
}
|
|
930
|
-
.wds-inline-prompt--positive a,
|
|
931
|
-
.wds-inline-prompt--positive button {
|
|
932
|
-
color: var(--color-sentiment-positive-primary);
|
|
933
|
-
}
|
|
934
|
-
.wds-inline-prompt--positive a:hover,
|
|
935
|
-
.wds-inline-prompt--positive button:hover {
|
|
936
|
-
color: var(--color-sentiment-positive-primary-hover);
|
|
926
|
+
color: var(--color-sentiment-content-primary);
|
|
937
927
|
}
|
|
938
|
-
.wds-inline-prompt
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
background-color: var(--color-sentiment-positive-secondary-hover);
|
|
944
|
-
}
|
|
945
|
-
.wds-inline-prompt.wds-inline-prompt--positive:has(a, button):active {
|
|
946
|
-
background-color: var(--color-sentiment-positive-secondary-active);
|
|
947
|
-
}
|
|
948
|
-
.wds-inline-prompt--proposition {
|
|
949
|
-
background-color: #D2F9F7;
|
|
950
|
-
color: var(--color-interactive-primary);
|
|
951
|
-
}
|
|
952
|
-
.wds-inline-prompt--proposition a,
|
|
953
|
-
.wds-inline-prompt--proposition button {
|
|
954
|
-
color: var(--color-interactive-primary);
|
|
955
|
-
}
|
|
956
|
-
.wds-inline-prompt--proposition a:hover,
|
|
957
|
-
.wds-inline-prompt--proposition button:hover {
|
|
958
|
-
color: var(--color-interactive-primary-hover);
|
|
959
|
-
}
|
|
960
|
-
.wds-inline-prompt--proposition a:active,
|
|
961
|
-
.wds-inline-prompt--proposition button:active {
|
|
962
|
-
color: var(--color-interactive-primary-active);
|
|
963
|
-
}
|
|
964
|
-
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
|
|
965
|
-
background-color: #B2F4F3;
|
|
966
|
-
}
|
|
967
|
-
.wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
|
|
968
|
-
background-color: #91F0EE;
|
|
969
|
-
}
|
|
970
|
-
.wds-inline-prompt--neutral {
|
|
971
|
-
background-color: rgba(134,167,189,0.10196);
|
|
972
|
-
background-color: var(--color-background-neutral);
|
|
973
|
-
color: #37517e;
|
|
974
|
-
color: var(--color-content-primary);
|
|
975
|
-
}
|
|
976
|
-
.wds-inline-prompt--neutral a,
|
|
977
|
-
.wds-inline-prompt--neutral button {
|
|
978
|
-
color: #37517e;
|
|
979
|
-
color: var(--color-content-primary);
|
|
980
|
-
}
|
|
981
|
-
.wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):hover {
|
|
982
|
-
background-color: var(--color-background-neutral-hover);
|
|
983
|
-
}
|
|
984
|
-
.wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):active {
|
|
985
|
-
background-color: var(--color-background-neutral-active);
|
|
986
|
-
}
|
|
987
|
-
.wds-inline-prompt--warning {
|
|
988
|
-
background-color: var(--color-sentiment-warning-secondary);
|
|
989
|
-
color: var(--color-sentiment-warning-content);
|
|
990
|
-
}
|
|
991
|
-
.wds-inline-prompt--warning a,
|
|
992
|
-
.wds-inline-prompt--warning button {
|
|
993
|
-
color: var(--color-sentiment-warning-content);
|
|
994
|
-
}
|
|
995
|
-
.wds-inline-prompt--warning a:hover,
|
|
996
|
-
.wds-inline-prompt--warning button:hover {
|
|
997
|
-
color: var(--color-sentiment-warning-content-hover);
|
|
998
|
-
}
|
|
999
|
-
.wds-inline-prompt--warning a:active,
|
|
1000
|
-
.wds-inline-prompt--warning button:active {
|
|
1001
|
-
color: var(--color-sentiment-warning-content-active);
|
|
1002
|
-
}
|
|
1003
|
-
.wds-inline-prompt.wds-inline-prompt--warning:has(a, button):hover {
|
|
1004
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 92%, var(--color-sentiment-warning-primary));
|
|
928
|
+
.wds-inline-prompt .wds-inline-prompt-process-indicator {
|
|
929
|
+
width: 16px;
|
|
930
|
+
width: var(--size-16);
|
|
931
|
+
height: 16px;
|
|
932
|
+
height: var(--size-16);
|
|
1005
933
|
}
|
|
1006
|
-
.wds-inline-prompt.wds-inline-prompt
|
|
1007
|
-
|
|
934
|
+
.wds-inline-prompt .wds-inline-prompt-process-indicator .process-circle {
|
|
935
|
+
stroke: currentColor;
|
|
1008
936
|
}
|
|
1009
937
|
.np-dot {
|
|
1010
938
|
--np-dot-size: 14px;
|
|
@@ -1107,17 +1035,17 @@
|
|
|
1107
1035
|
background-color: var(--color-background-neutral-active);
|
|
1108
1036
|
}
|
|
1109
1037
|
.np-icon-button-primary-default {
|
|
1110
|
-
color: var(--color-interactive-control);
|
|
1038
|
+
color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
|
|
1111
1039
|
background-color: #00a2dd;
|
|
1112
|
-
background-color: var(--color-interactive-accent);
|
|
1040
|
+
background-color: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
|
|
1113
1041
|
}
|
|
1114
1042
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
1115
1043
|
background-color: #008fc9;
|
|
1116
|
-
background-color: var(--color-interactive-accent-hover);
|
|
1044
|
+
background-color: var(--color-sentiment-interactive-primary-hover, var(--color-interactive-accent-hover));
|
|
1117
1045
|
}
|
|
1118
1046
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
1119
1047
|
background-color: #0081ba;
|
|
1120
|
-
background-color: var(--color-interactive-accent-active);
|
|
1048
|
+
background-color: var(--color-sentiment-interactive-primary-active, var(--color-interactive-accent-active));
|
|
1121
1049
|
}
|
|
1122
1050
|
.np-icon-button-primary-negative {
|
|
1123
1051
|
color: var(--color-contrast-overlay);
|
|
@@ -1145,14 +1073,14 @@
|
|
|
1145
1073
|
background-color: var(--color-background-screen-active);
|
|
1146
1074
|
}
|
|
1147
1075
|
.np-icon-button-secondary-default {
|
|
1148
|
-
color: var(--color-interactive-primary);
|
|
1149
|
-
background-color: var(--color-interactive-neutral);
|
|
1076
|
+
color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
|
|
1077
|
+
background-color: var(--color-sentiment-interactive-secondary-neutral, var(--color-interactive-neutral));
|
|
1150
1078
|
}
|
|
1151
1079
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
1152
|
-
background-color: var(--color-interactive-neutral-hover);
|
|
1080
|
+
background-color: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-interactive-neutral-hover));
|
|
1153
1081
|
}
|
|
1154
1082
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
1155
|
-
background-color: var(--color-interactive-neutral-active);
|
|
1083
|
+
background-color: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-interactive-neutral-active));
|
|
1156
1084
|
}
|
|
1157
1085
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
1158
1086
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
@@ -1266,12 +1194,12 @@
|
|
|
1266
1194
|
pointer-events: auto;
|
|
1267
1195
|
}
|
|
1268
1196
|
.wds-Button {
|
|
1269
|
-
--Button-background: var(--color-interactive-accent);
|
|
1270
|
-
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
1271
|
-
--Button-background-active: var(--color-interactive-accent-active);
|
|
1272
|
-
--Button-color: var(--color-interactive-control);
|
|
1273
|
-
--Button-color-hover: var(--color-interactive-control-hover);
|
|
1274
|
-
--Button-color-active: var(--color-interactive-control-active);
|
|
1197
|
+
--Button-background: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
|
|
1198
|
+
--Button-background-hover: var(--color-sentiment-interactive-primary-hover, var(--color-interactive-accent-hover));
|
|
1199
|
+
--Button-background-active: var(--color-sentiment-interactive-primary-active, var(--color-interactive-accent-active));
|
|
1200
|
+
--Button-color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
|
|
1201
|
+
--Button-color-hover: var(--color-sentiment-interactive-control-hover, var(--color-interactive-control-hover));
|
|
1202
|
+
--Button-color-active: var(--color-sentiment-interactive-control-active, var(--color-interactive-control-active));
|
|
1275
1203
|
--Button-border-radius: var(--radius-full);
|
|
1276
1204
|
--Button-label-gap: var(--size-4);
|
|
1277
1205
|
--Button-large-padding: var(--size-12) var(--size-16);
|
|
@@ -1280,16 +1208,16 @@
|
|
|
1280
1208
|
--Button-avatar-border-color: var(--color-border-neutral);
|
|
1281
1209
|
--Button-transition-duration: 150ms;
|
|
1282
1210
|
--Button-transition-easing: ease-in-out;
|
|
1283
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
1284
|
-
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
1285
|
-
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
1286
|
-
--Button-secondary-color: var(--color-interactive-primary);
|
|
1287
|
-
--Button-secondary-color-hover: var(--color-interactive-primary-hover);
|
|
1288
|
-
--Button-secondary-color-active: var(--color-interactive-primary-active);
|
|
1289
|
-
--Button-secondary-neutral-background: var(--color-background-neutral);
|
|
1290
|
-
--Button-secondary-neutral-background-hover: var(--color-background-neutral-hover);
|
|
1291
|
-
--Button-secondary-neutral-background-active: var(--color-background-neutral-active);
|
|
1292
|
-
--Button-secondary-neutral-color: var(--color-content-primary);
|
|
1211
|
+
--Button-secondary-background: var(--color-sentiment-interactive-secondary-neutral, var(--color-interactive-neutral));
|
|
1212
|
+
--Button-secondary-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-interactive-neutral-hover));
|
|
1213
|
+
--Button-secondary-background-active: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-interactive-neutral-active));
|
|
1214
|
+
--Button-secondary-color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
|
|
1215
|
+
--Button-secondary-color-hover: var(--color-sentiment-content-primary-hover, var(--color-interactive-primary-hover));
|
|
1216
|
+
--Button-secondary-color-active: var(--color-sentiment-content-primary-active, var(--color-interactive-primary-active));
|
|
1217
|
+
--Button-secondary-neutral-background: var(--color-sentiment-interactive-secondary-neutral, var(--color-background-neutral));
|
|
1218
|
+
--Button-secondary-neutral-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-background-neutral-hover));
|
|
1219
|
+
--Button-secondary-neutral-background-active: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-background-neutral-active));
|
|
1220
|
+
--Button-secondary-neutral-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
1293
1221
|
--Button-tertiary-background: transparent;
|
|
1294
1222
|
--Button-tertiary-background-hover: var(--color-background-screen-hover);
|
|
1295
1223
|
--Button-tertiary-background-active: var(--color-background-screen-active);
|
|
@@ -1380,7 +1308,7 @@
|
|
|
1380
1308
|
--Button-color-active: var(--Button-secondary-neutral-color);
|
|
1381
1309
|
}
|
|
1382
1310
|
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
1383
|
-
color: var(--
|
|
1311
|
+
color: var(--Button-secondary-color);
|
|
1384
1312
|
}
|
|
1385
1313
|
.wds-Button--tertiary {
|
|
1386
1314
|
--Button-background: var(--Button-tertiary-background);
|
|
@@ -4321,6 +4249,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
4321
4249
|
a,
|
|
4322
4250
|
button.np-link {
|
|
4323
4251
|
border-radius: 2px;
|
|
4252
|
+
color: var(--color-sentiment-content-primary, var(--color-content-link));
|
|
4324
4253
|
}
|
|
4325
4254
|
.np-link .tw-icon {
|
|
4326
4255
|
display: flex;
|
|
@@ -28,6 +28,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
28
28
|
var ProcessIndicator = require('../../processIndicator/ProcessIndicator.js');
|
|
29
29
|
var StatusIcon = require('../../statusIcon/StatusIcon.js');
|
|
30
30
|
var Body = require('../../body/Body.js');
|
|
31
|
+
var SentimentSurface = require('../../sentimentSurface/SentimentSurface.js');
|
|
31
32
|
|
|
32
33
|
const InlinePrompt = ({
|
|
33
34
|
sentiment: sentiment$1 = sentiment.Sentiment.POSITIVE,
|
|
@@ -36,15 +37,11 @@ const InlinePrompt = ({
|
|
|
36
37
|
className,
|
|
37
38
|
children,
|
|
38
39
|
media = null,
|
|
40
|
+
'data-testid': dataTestId,
|
|
39
41
|
...rest
|
|
40
42
|
}) => {
|
|
43
|
+
const surfaceSentiment = sentiment$1 === sentiment.Sentiment.POSITIVE ? 'success' : sentiment$1;
|
|
41
44
|
const renderMedia = () => {
|
|
42
|
-
if (media && ['proposition', 'positive'].includes(sentiment$1)) {
|
|
43
|
-
return media;
|
|
44
|
-
}
|
|
45
|
-
if (sentiment$1 === 'proposition') {
|
|
46
|
-
return /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {});
|
|
47
|
-
}
|
|
48
45
|
if (muted) {
|
|
49
46
|
return /*#__PURE__*/jsxRuntime.jsx(icons.BackslashCircle, {
|
|
50
47
|
size: 16,
|
|
@@ -54,15 +51,24 @@ const InlinePrompt = ({
|
|
|
54
51
|
if (loading) {
|
|
55
52
|
return /*#__PURE__*/jsxRuntime.jsx(ProcessIndicator.default, {
|
|
56
53
|
"data-testid": "InlinePrompt_ProcessIndicator",
|
|
57
|
-
size: "xxs"
|
|
54
|
+
size: "xxs",
|
|
55
|
+
className: "wds-inline-prompt-process-indicator"
|
|
58
56
|
});
|
|
59
57
|
}
|
|
58
|
+
if (sentiment$1 === 'positive' && media) {
|
|
59
|
+
return media;
|
|
60
|
+
}
|
|
61
|
+
if (sentiment$1 === 'proposition') {
|
|
62
|
+
return media || /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {});
|
|
63
|
+
}
|
|
60
64
|
return /*#__PURE__*/jsxRuntime.jsx(StatusIcon.default, {
|
|
61
65
|
size: 16,
|
|
62
66
|
sentiment: sentiment$1
|
|
63
67
|
});
|
|
64
68
|
};
|
|
65
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
69
|
+
return /*#__PURE__*/jsxRuntime.jsxs(SentimentSurface.default, {
|
|
70
|
+
sentiment: surfaceSentiment,
|
|
71
|
+
"data-testid": dataTestId,
|
|
66
72
|
className: clsx.clsx('wds-inline-prompt', `wds-inline-prompt--${sentiment$1}`, {
|
|
67
73
|
'wds-inline-prompt--muted': muted,
|
|
68
74
|
'wds-inline-prompt--loading': loading
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n *
|
|
1
|
+
{"version":3,"file":"InlinePrompt.js","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","GiftBox","StatusIcon","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;AACZ,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,gBAAgB,GAAGV,WAAS,KAAKC,mBAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,WAAS;EAEjF,MAAMW,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIR,KAAK,EAAE;MACT,oBAAOS,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBACEQ,cAAA,CAACG,wBAAgB,EAAA;AACf,QAAA,aAAA,EAAY,+BAA+B;AAC3CD,QAAAA,IAAI,EAAC,KAAK;AACVT,QAAAA,SAAS,EAAC;AAAqC,OAAA,CAC/C;AAEN,IAAA;AAEA,IAAA,IAAIL,WAAS,KAAK,UAAU,IAAIO,KAAK,EAAE;AACrC,MAAA,OAAOA,KAAK;AACd,IAAA;IAEA,IAAIP,WAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,OAAOO,KAAK,iBAAIK,cAAA,CAACI,aAAO,KAAG;AAC7B,IAAA;IAEA,oBAAOJ,cAAA,CAACK,kBAAU,EAAA;AAACH,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEkB,eAAA,CAACC,wBAAgB,EAAA;AACfnB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEe,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBpB,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERM,cAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAC,cAAA,CAACS,YAAI,EAAA;AAAAf,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -17,7 +17,7 @@ import '../../common/propsValues/variant.mjs';
|
|
|
17
17
|
import '../../common/propsValues/scroll.mjs';
|
|
18
18
|
import '../../common/propsValues/markdownNodeType.mjs';
|
|
19
19
|
import '../../common/fileType.mjs';
|
|
20
|
-
import {
|
|
20
|
+
import { BackslashCircle, GiftBox } from '@transferwise/icons';
|
|
21
21
|
import { clsx } from 'clsx';
|
|
22
22
|
import 'react';
|
|
23
23
|
import 'react-intl';
|
|
@@ -26,6 +26,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
26
26
|
import ProcessIndicator from '../../processIndicator/ProcessIndicator.mjs';
|
|
27
27
|
import StatusIcon from '../../statusIcon/StatusIcon.mjs';
|
|
28
28
|
import Body from '../../body/Body.mjs';
|
|
29
|
+
import SentimentSurface from '../../sentimentSurface/SentimentSurface.mjs';
|
|
29
30
|
|
|
30
31
|
const InlinePrompt = ({
|
|
31
32
|
sentiment = Sentiment.POSITIVE,
|
|
@@ -34,15 +35,11 @@ const InlinePrompt = ({
|
|
|
34
35
|
className,
|
|
35
36
|
children,
|
|
36
37
|
media = null,
|
|
38
|
+
'data-testid': dataTestId,
|
|
37
39
|
...rest
|
|
38
40
|
}) => {
|
|
41
|
+
const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;
|
|
39
42
|
const renderMedia = () => {
|
|
40
|
-
if (media && ['proposition', 'positive'].includes(sentiment)) {
|
|
41
|
-
return media;
|
|
42
|
-
}
|
|
43
|
-
if (sentiment === 'proposition') {
|
|
44
|
-
return /*#__PURE__*/jsx(GiftBox, {});
|
|
45
|
-
}
|
|
46
43
|
if (muted) {
|
|
47
44
|
return /*#__PURE__*/jsx(BackslashCircle, {
|
|
48
45
|
size: 16,
|
|
@@ -52,15 +49,24 @@ const InlinePrompt = ({
|
|
|
52
49
|
if (loading) {
|
|
53
50
|
return /*#__PURE__*/jsx(ProcessIndicator, {
|
|
54
51
|
"data-testid": "InlinePrompt_ProcessIndicator",
|
|
55
|
-
size: "xxs"
|
|
52
|
+
size: "xxs",
|
|
53
|
+
className: "wds-inline-prompt-process-indicator"
|
|
56
54
|
});
|
|
57
55
|
}
|
|
56
|
+
if (sentiment === 'positive' && media) {
|
|
57
|
+
return media;
|
|
58
|
+
}
|
|
59
|
+
if (sentiment === 'proposition') {
|
|
60
|
+
return media || /*#__PURE__*/jsx(GiftBox, {});
|
|
61
|
+
}
|
|
58
62
|
return /*#__PURE__*/jsx(StatusIcon, {
|
|
59
63
|
size: 16,
|
|
60
64
|
sentiment: sentiment
|
|
61
65
|
});
|
|
62
66
|
};
|
|
63
|
-
return /*#__PURE__*/jsxs(
|
|
67
|
+
return /*#__PURE__*/jsxs(SentimentSurface, {
|
|
68
|
+
sentiment: surfaceSentiment,
|
|
69
|
+
"data-testid": dataTestId,
|
|
64
70
|
className: clsx('wds-inline-prompt', `wds-inline-prompt--${sentiment}`, {
|
|
65
71
|
'wds-inline-prompt--muted': muted,
|
|
66
72
|
'wds-inline-prompt--loading': loading
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\n\nexport type InlinePromptProps = {\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n loading?: boolean;\n /**\n *
|
|
1
|
+
{"version":3,"file":"InlinePrompt.mjs","sources":["../../../src/prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../common';\nimport { BackslashCircle, GiftBox } from '@transferwise/icons';\nimport ProcessIndicator from '../../processIndicator';\nimport StatusIcon from '../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../body';\nimport SentimentSurface from '../../sentimentSurface';\n\nexport type InlinePromptProps = {\n /**\n * The sentiment determines the colour scheme\n */\n sentiment?:\n | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`\n | 'proposition';\n /**\n * Replaces the icon with a spinner while waiting for the short-lived action to finish.\n * @default false\n */\n loading?: boolean;\n /**\n * While prompts cannot be fully (visually and functionally) disabled, this prop should be enabled\n * they are associated with actually disabled component (e.g. a disabled list item or input).\n * @default false\n */\n muted?: boolean;\n /**\n * Icon override for `proposition` and `positive` sentiments. Unsupported for remaining ones.\n */\n media?: React.ReactNode;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\n/**\n * Inline prompts appear alongside a specific component on the screen. They help the user stay\n * informed, fix something, or get more out of what they're doing.\n */\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n media = null,\n 'data-testid': dataTestId,\n ...rest\n}: InlinePromptProps) => {\n const surfaceSentiment = sentiment === Sentiment.POSITIVE ? 'success' : sentiment;\n\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return (\n <ProcessIndicator\n data-testid=\"InlinePrompt_ProcessIndicator\"\n size=\"xxs\"\n className=\"wds-inline-prompt-process-indicator\"\n />\n );\n }\n\n if (sentiment === 'positive' && media) {\n return media;\n }\n\n if (sentiment === 'proposition') {\n return media || <GiftBox />;\n }\n\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <SentimentSurface\n sentiment={surfaceSentiment}\n data-testid={dataTestId}\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </SentimentSurface>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","media","dataTestId","rest","surfaceSentiment","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","GiftBox","StatusIcon","_jsxs","SentimentSurface","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;AACRC,EAAAA,KAAK,GAAG,IAAI;AACZ,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,gBAAgB,GAAGV,SAAS,KAAKC,SAAS,CAACC,QAAQ,GAAG,SAAS,GAAGF,SAAS;EAEjF,MAAMW,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIR,KAAK,EAAE;MACT,oBAAOS,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIV,OAAO,EAAE;MACX,oBACEQ,GAAA,CAACG,gBAAgB,EAAA;AACf,QAAA,aAAA,EAAY,+BAA+B;AAC3CD,QAAAA,IAAI,EAAC,KAAK;AACVT,QAAAA,SAAS,EAAC;AAAqC,OAAA,CAC/C;AAEN,IAAA;AAEA,IAAA,IAAIL,SAAS,KAAK,UAAU,IAAIO,KAAK,EAAE;AACrC,MAAA,OAAOA,KAAK;AACd,IAAA;IAEA,IAAIP,SAAS,KAAK,aAAa,EAAE;AAC/B,MAAA,OAAOO,KAAK,iBAAIK,GAAA,CAACI,OAAO,KAAG;AAC7B,IAAA;IAEA,oBAAOJ,GAAA,CAACK,UAAU,EAAA;AAACH,MAAAA,IAAI,EAAE,EAAG;AAACd,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;EAED,oBACEkB,IAAA,CAACC,gBAAgB,EAAA;AACfnB,IAAAA,SAAS,EAAEU,gBAAiB;AAC5B,IAAA,aAAA,EAAaF,UAAW;IACxBH,SAAS,EAAEe,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBpB,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEI,IAAI;AAAAH,IAAAA,QAAA,gBAERM,GAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEK,WAAW;AAAE,KAAM,CACtE,eAAAC,GAAA,CAACS,IAAI,EAAA;AAAAf,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAkB,CAAC;AAEvB;;;;"}
|
|
@@ -4,26 +4,27 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
|
-
var classMap = require('./classMap.js');
|
|
8
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
8
|
|
|
10
9
|
const SentimentSurface = /*#__PURE__*/React.forwardRef(function SentimentSurface({
|
|
11
10
|
as,
|
|
12
11
|
sentiment,
|
|
13
12
|
emphasis = 'base',
|
|
14
|
-
|
|
13
|
+
hasBaseStyles = true,
|
|
15
14
|
style,
|
|
15
|
+
className,
|
|
16
16
|
children,
|
|
17
17
|
id,
|
|
18
|
-
|
|
18
|
+
'data-testid': dataTestId,
|
|
19
19
|
...props
|
|
20
20
|
}, ref) {
|
|
21
21
|
const Element = as ?? 'div';
|
|
22
|
-
const
|
|
22
|
+
const BASE_CLASS = 'wds-sentiment-surface';
|
|
23
|
+
const classNames = clsx.clsx(BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
23
24
|
const sentimentProps = {
|
|
24
25
|
ref,
|
|
25
26
|
id,
|
|
26
|
-
'data-testid':
|
|
27
|
+
'data-testid': dataTestId,
|
|
27
28
|
className: classNames,
|
|
28
29
|
style,
|
|
29
30
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentSurface.js","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\
|
|
1
|
+
{"version":3,"file":"SentimentSurface.js","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const classNames = clsx(\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;;;;;AAoCA,MAAMA,gBAAgB,gBAA8BC,gBAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAMC,UAAU,GAAGC,SAAI,CACrBF,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,IAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMU,cAAc,GAAG;IACrBL,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEQ,UAAU;IACrBT,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAO,IAAAA,cAAA,CAACL,OAAO,EAAA;AAAA,MAAA,GAAKI,cAAc;AAAAT,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACmB,WAAW,GAAG,kBAAkB;;;;"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { getSentimentSurfaceClassName } from './classMap.mjs';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const SentimentSurface = /*#__PURE__*/forwardRef(function SentimentSurface({
|
|
7
6
|
as,
|
|
8
7
|
sentiment,
|
|
9
8
|
emphasis = 'base',
|
|
10
|
-
|
|
9
|
+
hasBaseStyles = true,
|
|
11
10
|
style,
|
|
11
|
+
className,
|
|
12
12
|
children,
|
|
13
13
|
id,
|
|
14
|
-
|
|
14
|
+
'data-testid': dataTestId,
|
|
15
15
|
...props
|
|
16
16
|
}, ref) {
|
|
17
17
|
const Element = as ?? 'div';
|
|
18
|
-
const
|
|
18
|
+
const BASE_CLASS = 'wds-sentiment-surface';
|
|
19
|
+
const classNames = clsx(BASE_CLASS, `${BASE_CLASS}-${sentiment}-${emphasis}`, hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`, className);
|
|
19
20
|
const sentimentProps = {
|
|
20
21
|
ref,
|
|
21
22
|
id,
|
|
22
|
-
'data-testid':
|
|
23
|
+
'data-testid': dataTestId,
|
|
23
24
|
className: classNames,
|
|
24
25
|
style,
|
|
25
26
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentSurface.mjs","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\
|
|
1
|
+
{"version":3,"file":"SentimentSurface.mjs","sources":["../../src/sentimentSurface/SentimentSurface.tsx"],"sourcesContent":["import { forwardRef, ElementType, ForwardedRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport {\n SentimentSurfaceComponentProps,\n SentimentSurfaceComponent,\n} from './SentimentSurface.types';\n\n/**\n * SentimentSurface is a polymorphic container component that exposes and, optionally, applies\n * contextual colour tokens as CSS custom properties, based on sentiment types (`negative`,\n * `warning`, `neutral`, `success`, `proposition`).\n *\n * @param {ElementType} [as='div'] - Optional prop to override the HTML element rendered.\n * @param {Sentiment} sentiment - Required prop to set the sentiment type (negative, warning, neutral, success, proposition).\n * @param {Emphasis} [emphasis='base'] - Optional prop to specify the emphasis level (base or elevated).\n * @param {boolean} [hasBaseStyles=true] - If true, sets the `background-color` and `color` on the container. Otherwise, only exposes the tokens as CSS custom properties without rendering.\n * @param {ReactNode} [children] - Content to render inside the surface.\n * @param {string} [className] - Additional CSS classes to apply.\n * @param {CSSProperties} [style] - Inline styles to apply.\n * @param {string} [id] - Unique identifier for the component.\n * @param {string} [data-testid] - A unique string that appears as data attribute `data-testid` in the rendered code.\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage with negative sentiment\n * <SentimentSurface sentiment=\"negative\">\n * Your payment has failed\n * </SentimentSurface>\n * ```\n *\n * @see {@link SentimentSurface} for further information.\n * @see {@link https://storybook.wise.design/?path=/docs/sentiment-surface--docs|Storybook Wise Design}\n */\n// @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\nconst SentimentSurface: SentimentSurfaceComponent = forwardRef(function SentimentSurface<\n T extends ElementType = 'div',\n>(\n {\n as,\n sentiment,\n emphasis = 'base',\n hasBaseStyles = true,\n style,\n className,\n children,\n id,\n 'data-testid': dataTestId,\n ...props\n }: SentimentSurfaceComponentProps<T>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const Element = as ?? 'div';\n const BASE_CLASS = 'wds-sentiment-surface';\n const classNames = clsx(\n BASE_CLASS,\n `${BASE_CLASS}-${sentiment}-${emphasis}`,\n hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,\n className,\n );\n const sentimentProps = {\n ref,\n id,\n 'data-testid': dataTestId,\n className: classNames,\n style,\n ...props,\n };\n\n return (\n // @ts-expect-error - Generic forwardRef limitation. See: https://fettblog.eu/typescript-react-generic-forward-refs/\n <Element {...sentimentProps}>{children}</Element>\n );\n});\n\nSentimentSurface.displayName = 'SentimentSurface';\n\nexport default SentimentSurface;\n"],"names":["SentimentSurface","forwardRef","as","sentiment","emphasis","hasBaseStyles","style","className","children","id","dataTestId","props","ref","Element","BASE_CLASS","classNames","clsx","sentimentProps","_jsx","displayName"],"mappings":";;;;AAoCA,MAAMA,gBAAgB,gBAA8BC,UAAU,CAAC,SAASD,gBAAgBA,CAGtF;EACEE,EAAE;EACFC,SAAS;AACTC,EAAAA,QAAQ,GAAG,MAAM;AACjBC,EAAAA,aAAa,GAAG,IAAI;EACpBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,EAAE;AACF,EAAA,aAAa,EAAEC,UAAU;EACzB,GAAGC;AAAK,CAC0B,EACpCC,GAA8B,EAAA;AAE9B,EAAA,MAAMC,OAAO,GAAGX,EAAE,IAAI,KAAK;EAC3B,MAAMY,UAAU,GAAG,uBAAuB;EAC1C,MAAMC,UAAU,GAAGC,IAAI,CACrBF,UAAU,EACV,CAAA,EAAGA,UAAU,CAAA,CAAA,EAAIX,SAAS,IAAIC,QAAQ,CAAA,CAAE,EACxCC,aAAa,IAAI,GAAGS,UAAU,CAAA,eAAA,CAAiB,EAC/CP,SAAS,CACV;AACD,EAAA,MAAMU,cAAc,GAAG;IACrBL,GAAG;IACHH,EAAE;AACF,IAAA,aAAa,EAAEC,UAAU;AACzBH,IAAAA,SAAS,EAAEQ,UAAU;IACrBT,KAAK;IACL,GAAGK;GACJ;AAED,EAAA;AAAA;AACE;AACAO,IAAAA,GAAA,CAACL,OAAO,EAAA;AAAA,MAAA,GAAKI,cAAc;AAAAT,MAAAA,QAAA,EAAGA;KAAkB;AAAC;AAErD,CAAC;AAEDR,gBAAgB,CAACmB,WAAW,GAAG,kBAAkB;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
.wds-Button {
|
|
2
|
-
--Button-background: var(--color-interactive-accent);
|
|
3
|
-
--Button-background-hover: var(--color-interactive-accent-hover);
|
|
4
|
-
--Button-background-active: var(--color-interactive-accent-active);
|
|
5
|
-
--Button-color: var(--color-interactive-control);
|
|
6
|
-
--Button-color-hover: var(--color-interactive-control-hover);
|
|
7
|
-
--Button-color-active: var(--color-interactive-control-active);
|
|
2
|
+
--Button-background: var(--color-sentiment-interactive-primary, var(--color-interactive-accent));
|
|
3
|
+
--Button-background-hover: var(--color-sentiment-interactive-primary-hover, var(--color-interactive-accent-hover));
|
|
4
|
+
--Button-background-active: var(--color-sentiment-interactive-primary-active, var(--color-interactive-accent-active));
|
|
5
|
+
--Button-color: var(--color-sentiment-interactive-control, var(--color-interactive-control));
|
|
6
|
+
--Button-color-hover: var(--color-sentiment-interactive-control-hover, var(--color-interactive-control-hover));
|
|
7
|
+
--Button-color-active: var(--color-sentiment-interactive-control-active, var(--color-interactive-control-active));
|
|
8
8
|
--Button-border-radius: var(--radius-full);
|
|
9
9
|
--Button-label-gap: var(--size-4);
|
|
10
10
|
--Button-large-padding: var(--size-12) var(--size-16);
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
--Button-avatar-border-color: var(--color-border-neutral);
|
|
14
14
|
--Button-transition-duration: 150ms;
|
|
15
15
|
--Button-transition-easing: ease-in-out;
|
|
16
|
-
--Button-secondary-background: var(--color-interactive-neutral);
|
|
17
|
-
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
18
|
-
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
19
|
-
--Button-secondary-color: var(--color-interactive-primary);
|
|
20
|
-
--Button-secondary-color-hover: var(--color-interactive-primary-hover);
|
|
21
|
-
--Button-secondary-color-active: var(--color-interactive-primary-active);
|
|
22
|
-
--Button-secondary-neutral-background: var(--color-background-neutral);
|
|
23
|
-
--Button-secondary-neutral-background-hover: var(--color-background-neutral-hover);
|
|
24
|
-
--Button-secondary-neutral-background-active: var(--color-background-neutral-active);
|
|
25
|
-
--Button-secondary-neutral-color: var(--color-content-primary);
|
|
16
|
+
--Button-secondary-background: var(--color-sentiment-interactive-secondary-neutral, var(--color-interactive-neutral));
|
|
17
|
+
--Button-secondary-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-interactive-neutral-hover));
|
|
18
|
+
--Button-secondary-background-active: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-interactive-neutral-active));
|
|
19
|
+
--Button-secondary-color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
|
|
20
|
+
--Button-secondary-color-hover: var(--color-sentiment-content-primary-hover, var(--color-interactive-primary-hover));
|
|
21
|
+
--Button-secondary-color-active: var(--color-sentiment-content-primary-active, var(--color-interactive-primary-active));
|
|
22
|
+
--Button-secondary-neutral-background: var(--color-sentiment-interactive-secondary-neutral, var(--color-background-neutral));
|
|
23
|
+
--Button-secondary-neutral-background-hover: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-background-neutral-hover));
|
|
24
|
+
--Button-secondary-neutral-background-active: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-background-neutral-active));
|
|
25
|
+
--Button-secondary-neutral-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
26
26
|
--Button-tertiary-background: transparent;
|
|
27
27
|
--Button-tertiary-background-hover: var(--color-background-screen-hover);
|
|
28
28
|
--Button-tertiary-background-active: var(--color-background-screen-active);
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
--Button-color-active: var(--Button-secondary-neutral-color);
|
|
114
114
|
}
|
|
115
115
|
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
116
|
-
color: var(--
|
|
116
|
+
color: var(--Button-secondary-color);
|
|
117
117
|
}
|
|
118
118
|
.wds-Button--tertiary {
|
|
119
119
|
--Button-background: var(--Button-tertiary-background);
|