@transferwise/components 0.0.0-experimental-d2bc8ee → 0.0.0-experimental-c3d7358
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/common/closeButton/CloseButton.messages.js +2 -2
- package/build/common/closeButton/CloseButton.messages.js.map +1 -1
- package/build/common/closeButton/CloseButton.messages.mjs +2 -2
- package/build/common/closeButton/CloseButton.messages.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +2 -2
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/drawer/Drawer.js +18 -9
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +18 -9
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/main.css +649 -510
- package/build/mocks.js +7 -0
- package/build/mocks.js.map +1 -1
- package/build/mocks.mjs +7 -1
- package/build/mocks.mjs.map +1 -1
- package/build/modal/Modal.js +20 -21
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +20 -21
- package/build/modal/Modal.mjs.map +1 -1
- package/build/select/Select.js +2 -1
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +2 -1
- package/build/select/Select.mjs.map +1 -1
- package/build/sentimentSurface/classMap.js +22 -0
- package/build/sentimentSurface/classMap.js.map +1 -0
- package/build/sentimentSurface/classMap.mjs +18 -0
- package/build/sentimentSurface/classMap.mjs.map +1 -0
- package/build/statusIcon/StatusIcon.js +4 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/accordion/Accordion.css +6 -2
- package/build/styles/actionButton/ActionButton.css +4 -12
- package/build/styles/avatar/Avatar.css +10 -13
- package/build/styles/avatarView/AvatarView.css +3 -5
- package/build/styles/avatarView/Dot.css +1 -2
- package/build/styles/button/Button.css +0 -1
- package/build/styles/card/Card.css +2 -2
- package/build/styles/carousel/Carousel.css +2 -5
- package/build/styles/checkboxButton/CheckboxButton.css +1 -0
- package/build/styles/chips/Chip.css +12 -31
- package/build/styles/circularButton/CircularButton.css +0 -6
- package/build/styles/common/Option/Option.css +2 -2
- package/build/styles/common/RadioButton/RadioButton.css +1 -1
- package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
- package/build/styles/common/card/Card.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +2 -7
- package/build/styles/criticalBanner/CriticalCommsBanner.css +0 -4
- package/build/styles/dateLookup/DateLookup.css +3 -5
- package/build/styles/definitionList/DefinitionList.css +1 -1
- package/build/styles/divider/Divider.css +1 -1
- package/build/styles/drawer/Drawer.css +11 -58
- package/build/styles/emphasis/Emphasis.css +5 -4
- package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -2
- package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +0 -1
- package/build/styles/expressiveMoneyInput/chevron/Chevron.css +0 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -2
- package/build/styles/header/Header.css +2 -2
- package/build/styles/iconButton/IconButton.css +4 -27
- package/build/styles/inputs/Input.css +5 -5
- package/build/styles/inputs/InputGroup.css +2 -3
- package/build/styles/inputs/SelectInput.css +13 -14
- package/build/styles/inputs/TextArea.css +5 -5
- package/build/styles/instructionsList/InstructionsList.css +0 -2
- package/build/styles/listItem/ListItem.css +8 -22
- package/build/styles/logo/Logo.css +0 -2
- package/build/styles/main.css +649 -510
- package/build/styles/modal/Modal.css +6 -68
- package/build/styles/moneyInput/MoneyInput.css +2 -2
- package/build/styles/navigationOption/NavigationOption.css +3 -1
- package/build/styles/nudge/Nudge.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -2
- package/build/styles/popover/Popover.css +2 -2
- package/build/styles/progress/Progress.css +3 -3
- package/build/styles/progressBar/ProgressBar.css +2 -2
- package/build/styles/promoCard/PromoCard.css +3 -3
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +3 -39
- package/build/styles/segmentedControl/SegmentedControl.css +2 -6
- package/build/styles/select/Select.css +41 -25
- package/build/styles/sentimentSurface/SentimentSurface.css +424 -0
- package/build/styles/slidingPanel/SlidingPanel.css +4 -4
- package/build/styles/snackbar/Snackbar.css +4 -4
- package/build/styles/statusIcon/StatusIcon.css +4 -44
- package/build/styles/stepper/Stepper.css +4 -4
- package/build/styles/summary/Summary.css +2 -5
- package/build/styles/switch/Switch.css +2 -3
- package/build/styles/table/Table.css +5 -13
- package/build/styles/tabs/Tabs.css +9 -10
- package/build/styles/tile/Tile.css +5 -8
- package/build/styles/typeahead/Typeahead.css +1 -2
- package/build/styles/typeahead/typeaheadOption/TypeaheadOption.css +4 -1
- package/build/styles/upload/Upload.css +1 -1
- package/build/styles/uploadInput/uploadButton/UploadButton.css +2 -4
- package/build/styles/uploadInput/uploadItem/UploadItem.css +4 -8
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/mocks.d.ts +1 -0
- package/build/types/mocks.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/select/Select.d.ts +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts +30 -0
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -0
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts +80 -0
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -0
- package/build/types/sentimentSurface/classMap.d.ts +5 -0
- package/build/types/sentimentSurface/classMap.d.ts.map +1 -0
- package/build/types/sentimentSurface/index.d.ts +3 -0
- package/build/types/sentimentSurface/index.d.ts.map +1 -0
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/test-utils/window-mock.d.ts +1 -0
- package/build/types/test-utils/window-mock.d.ts.map +1 -1
- package/package.json +5 -10
- package/src/accordion/Accordion.css +6 -2
- package/src/accordion/Accordion.less +7 -0
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/actionButton/ActionButton.css +4 -12
- package/src/avatar/Avatar.css +10 -13
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -0
- package/src/avatarView/AvatarView.css +3 -5
- package/src/avatarView/AvatarView.story.tsx +1 -0
- package/src/avatarView/Dot.css +1 -2
- package/src/button/Button.css +0 -1
- package/src/card/Card.css +2 -2
- package/src/carousel/Carousel.css +2 -5
- package/src/checkboxButton/CheckboxButton.css +1 -0
- package/src/chips/Chip.css +12 -31
- package/src/circularButton/CircularButton.css +0 -6
- package/src/common/Option/Option.css +2 -2
- package/src/common/RadioButton/RadioButton.css +1 -1
- package/src/common/bottomSheet/BottomSheet.css +1 -1
- package/src/common/card/Card.css +1 -1
- package/src/common/closeButton/CloseButton.css +2 -7
- package/src/criticalBanner/CriticalCommsBanner.css +0 -4
- package/src/dateLookup/DateLookup.css +3 -5
- package/src/definitionList/DefinitionList.css +1 -1
- package/src/display/Display.story.tsx +1 -0
- package/src/divider/Divider.css +1 -1
- package/src/drawer/Drawer.css +11 -58
- package/src/drawer/Drawer.less +14 -70
- package/src/drawer/Drawer.story.tsx +158 -100
- package/src/drawer/Drawer.tsx +26 -7
- package/src/emphasis/Emphasis.css +5 -4
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +0 -2
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.spec.tsx +229 -0
- package/src/expressiveMoneyInput/amountInput/AmountInput.css +0 -1
- package/src/expressiveMoneyInput/amountInput/AmountInput.spec.tsx +282 -0
- package/src/expressiveMoneyInput/chevron/Chevron.css +0 -1
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.spec.tsx +160 -0
- package/src/flowNavigation/FlowNavigation.css +1 -2
- package/src/header/Header.css +2 -2
- package/src/iconButton/IconButton.css +4 -27
- package/src/iconButton/IconButton.story.tsx +1 -0
- package/src/inputs/Input.css +5 -5
- package/src/inputs/InputGroup.css +2 -3
- package/src/inputs/SelectInput.css +13 -14
- package/src/inputs/SelectInput.spec.tsx +7 -1
- package/src/inputs/TextArea.css +5 -5
- package/src/instructionsList/InstructionsList.css +0 -2
- package/src/listItem/ListItem.css +8 -22
- package/src/logo/Logo.css +0 -2
- package/src/main.css +649 -510
- package/src/main.less +2 -0
- package/src/mocks.ts +7 -0
- package/src/modal/Modal.css +6 -68
- package/src/modal/Modal.less +6 -76
- package/src/modal/Modal.tsx +23 -23
- package/src/moneyInput/MoneyInput.css +2 -2
- package/src/moneyInput/MoneyInput.spec.tsx +9 -1
- package/src/navigationOption/NavigationOption.css +3 -1
- package/src/nudge/Nudge.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -2
- package/src/popover/Popover.css +2 -2
- package/src/progress/Progress.css +3 -3
- package/src/progressBar/ProgressBar.css +2 -2
- package/src/promoCard/PromoCard.css +3 -3
- package/src/prompt/InlinePrompt/InlinePrompt.css +3 -39
- package/src/provider/theme/ThemeProvider.story.tsx +78 -11
- package/src/segmentedControl/SegmentedControl.css +2 -6
- package/src/select/Select.css +41 -25
- package/src/select/Select.less +25 -0
- package/src/select/Select.tsx +6 -1
- package/src/sentimentSurface/SentimentSurface.css +424 -0
- package/src/sentimentSurface/SentimentSurface.less +296 -0
- package/src/sentimentSurface/SentimentSurface.spec.tsx +140 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +210 -0
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +95 -0
- package/src/sentimentSurface/SentimentSurface.tsx +72 -0
- package/src/sentimentSurface/SentimentSurface.types.ts +104 -0
- package/src/sentimentSurface/classMap.ts +20 -0
- package/src/sentimentSurface/index.ts +8 -0
- package/src/slidingPanel/SlidingPanel.css +4 -4
- package/src/snackbar/Snackbar.css +4 -4
- package/src/snackbar/Snackbar.less +4 -2
- package/src/statusIcon/StatusIcon.css +4 -44
- package/src/statusIcon/StatusIcon.less +2 -40
- package/src/statusIcon/StatusIcon.tsx +10 -1
- package/src/stepper/Stepper.css +4 -4
- package/src/summary/Summary.css +2 -5
- package/src/switch/Switch.css +2 -3
- package/src/table/Table.css +5 -13
- package/src/tabs/Tabs.css +9 -10
- package/src/test-utils/jest.setup.ts +0 -5
- package/src/test-utils/window-mock.ts +5 -0
- package/src/tile/Tile.css +5 -8
- package/src/typeahead/Typeahead.css +1 -2
- package/src/typeahead/typeaheadOption/TypeaheadOption.css +4 -1
- package/src/typeahead/typeaheadOption/TypeaheadOption.less +6 -0
- package/src/upload/Upload.css +1 -1
- package/src/uploadInput/uploadButton/UploadButton.css +2 -4
- package/src/uploadInput/uploadItem/UploadItem.css +4 -8
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
.wds-sentiment-surface {
|
|
2
|
+
background-color: var(--color-sentiment-background-surface);
|
|
3
|
+
color: var(--color-sentiment-content-primary);
|
|
4
|
+
|
|
5
|
+
&-negative {
|
|
6
|
+
.np-theme-personal &,
|
|
7
|
+
.np-theme-personal--bright-green & {
|
|
8
|
+
&-base {
|
|
9
|
+
.sentiment-surface-tokens(
|
|
10
|
+
#CB272F, #B8232B, #A72027,
|
|
11
|
+
#CB272F, #B8232B, #A72027,
|
|
12
|
+
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
13
|
+
#F5D3D4, #F0BDBE, #ECACAD,
|
|
14
|
+
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
15
|
+
#FBEAEA, #F9E1E1, #F8D8D8
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
&-elevated {
|
|
19
|
+
.sentiment-surface-tokens(
|
|
20
|
+
#FFFFFF, #F5CCCC, #F1B7B7,
|
|
21
|
+
#FBEAEA, #F5CCCC, #F1B7B7,
|
|
22
|
+
#CB272F, #B8232B, #A72027,
|
|
23
|
+
#9B141B, #831116, #6D0E13,
|
|
24
|
+
#CB272F, #B8232B, #A72027,
|
|
25
|
+
#90000D, #B8232B, #A72027
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.np-theme-personal--dark &,
|
|
31
|
+
.np-theme-personal--forest-green & {
|
|
32
|
+
&-base {
|
|
33
|
+
.sentiment-surface-tokens(
|
|
34
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
35
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
36
|
+
#410B0D, #641115, #761418,
|
|
37
|
+
#601013, #7A1519, #90181D,
|
|
38
|
+
#410B0D, #641115, #761418,
|
|
39
|
+
#410B0D, #641115, #761418
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
&-elevated {
|
|
43
|
+
.sentiment-surface-tokens(
|
|
44
|
+
#410B0D, #641115, #761418,
|
|
45
|
+
#410B0D, #641115, #761418,
|
|
46
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
47
|
+
#D9898D, #D68084, #D06C71,
|
|
48
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
49
|
+
#FFA8AD, #FFBDC0, #FFD1D3
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-warning {
|
|
56
|
+
.np-theme-personal &,
|
|
57
|
+
.np-theme-personal--bright-green & {
|
|
58
|
+
&-base {
|
|
59
|
+
.sentiment-surface-tokens(
|
|
60
|
+
#4A3B1C, #302612, #2C2311, // content-primary (default, hover, active)
|
|
61
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-primary
|
|
62
|
+
#FFF7D7, #FFF0B2, #FFE98F, // interactive-secondary
|
|
63
|
+
#FFEC9E, #FFE187, #FFD55F, // interactive-secondary-neutral
|
|
64
|
+
#4A3B1C, #302612, #2C2311, // interactive-control
|
|
65
|
+
#FFF7D7, #FFF0B2, #FFE98F // background-surface
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
&-elevated {
|
|
69
|
+
.sentiment-surface-tokens(
|
|
70
|
+
#4A3B1C, #302612, #2C2311, // content-primary
|
|
71
|
+
#4A3B1C, #302612, #2C2311, // interactive-primary
|
|
72
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-secondary
|
|
73
|
+
#FFEC9E, #FFEDB8, #FFF2CC, // interactive-secondary-neutral
|
|
74
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-control
|
|
75
|
+
#FFD11A, #FFBF0F, #FFBB00 // background-surface
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.np-theme-personal--dark &,
|
|
81
|
+
.np-theme-personal--forest-green & {
|
|
82
|
+
&-base {
|
|
83
|
+
.sentiment-surface-tokens(
|
|
84
|
+
#FADC65, #F9D648, #F8CD20, // content-primary
|
|
85
|
+
#FADC65, #F9D648, #F8CD20, // interactive-primary
|
|
86
|
+
#3A3523, #504930, #665D3D, // interactive-secondary
|
|
87
|
+
#4D462A, #5D532F, #685D33, // interactive-secondary-neutral
|
|
88
|
+
#3A3523, #504930, #665D3D, // interactive-control
|
|
89
|
+
#3A3523, #504930, #665D3D // background-surface
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
&-elevated {
|
|
93
|
+
.sentiment-surface-tokens(
|
|
94
|
+
#3A3523, #504930, #665D3D, // content-primary
|
|
95
|
+
#3A3523, #504930, #665D3D, // interactive-primary
|
|
96
|
+
#FADC65, #F9D648, #F8CD20, // interactive-secondary
|
|
97
|
+
#E3C85D, #DFC044, #D9B526, // interactive-secondary-neutral
|
|
98
|
+
#FADC65, #F9D648, #F8CD20, // interactive-control
|
|
99
|
+
#FADC65, #F9D648, #F8CD20 // background-surface
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
&-success {
|
|
105
|
+
.np-theme-personal &,
|
|
106
|
+
.np-theme-personal--bright-green & {
|
|
107
|
+
&-base {
|
|
108
|
+
.sentiment-surface-tokens(
|
|
109
|
+
#054D28, #043A1E, #022614, // content-primary (default, hover, active)
|
|
110
|
+
#054D28, #043A1E, #022614, // interactive-primary
|
|
111
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-secondary
|
|
112
|
+
#BCD9B8, #AACFA5, #94C38E, // interactive-secondary-neutral
|
|
113
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-control
|
|
114
|
+
#E2F6D5, #D3F2C0, #C5EDAB // background-surface
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
&-elevated {
|
|
118
|
+
.sentiment-surface-tokens(
|
|
119
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // content-primary
|
|
120
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-primary
|
|
121
|
+
#054D28, #043A1E, #022614, // interactive-secondary
|
|
122
|
+
#256A43, #2A794C, #329057, // interactive-secondary-neutral
|
|
123
|
+
#054D28, #043A1E, #022614, // interactive-control
|
|
124
|
+
#054D28, #043A1E, #022614 // background-surface
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.np-theme-personal--dark &,
|
|
130
|
+
.np-theme-personal--forest-green & {
|
|
131
|
+
&-base {
|
|
132
|
+
.sentiment-surface-tokens(
|
|
133
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // content-primary
|
|
134
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-primary
|
|
135
|
+
#252C20, #323B2B, #3E4A36, // interactive-secondary
|
|
136
|
+
#37422F, #46533B, #546548, // interactive-secondary-neutral
|
|
137
|
+
#252C20, #323B2B, #3E4A36, // interactive-control
|
|
138
|
+
#252C20, #323B2B, #3E4A36 // background-surface
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
&-elevated {
|
|
142
|
+
.sentiment-surface-tokens(
|
|
143
|
+
#252C20, #323B2B, #3E4A36, // content-primary
|
|
144
|
+
#252C20, #323B2B, #3E4A36, // interactive-primary
|
|
145
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-secondary
|
|
146
|
+
#A8CF91, #94C478, #83BB63, // interactive-secondary-neutral
|
|
147
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-control
|
|
148
|
+
#BAE5A0, #C8EAB3, #D6F0C7 // background-surface
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
&-neutral {
|
|
154
|
+
.np-theme-personal &,
|
|
155
|
+
.np-theme-personal--bright-green & {
|
|
156
|
+
&-base {
|
|
157
|
+
.sentiment-surface-tokens(
|
|
158
|
+
#454745, #353635, #232423, // content-primary (default, hover, active)
|
|
159
|
+
#454745, #353635, #232423, // interactive-primary
|
|
160
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
161
|
+
#E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
|
|
162
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
163
|
+
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
&-elevated {
|
|
167
|
+
.sentiment-surface-tokens(
|
|
168
|
+
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
169
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
170
|
+
#454745, #353635, #232423, // interactive-secondary
|
|
171
|
+
#5A5C5A, #6D6F6D, #727472, // interactive-secondary-neutral
|
|
172
|
+
#454745, #353635, #232423, // interactive-control
|
|
173
|
+
#454745, #353635, #232423 // background-surface
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.np-theme-personal--dark &,
|
|
179
|
+
.np-theme-personal--forest-green & {
|
|
180
|
+
&-base {
|
|
181
|
+
.sentiment-surface-tokens(
|
|
182
|
+
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
183
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
184
|
+
#2A2C29, #414441, #595B58, // interactive-secondary
|
|
185
|
+
#424441, #4C4E4B, #565955, // interactive-secondary-neutral
|
|
186
|
+
#2A2C29, #414441, #595B58, // interactive-control
|
|
187
|
+
#2A2C29, #414441, #595B58 // background-surface
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
&-elevated {
|
|
191
|
+
.sentiment-surface-tokens(
|
|
192
|
+
#2A2C29, #414441, #595B58, // content-primary
|
|
193
|
+
#2A2C29, #414441, #595B58, // interactive-primary
|
|
194
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
195
|
+
#E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
|
|
196
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
197
|
+
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
&-proposition {
|
|
203
|
+
.np-theme-personal &,
|
|
204
|
+
.np-theme-personal--bright-green & {
|
|
205
|
+
&-base {
|
|
206
|
+
.sentiment-surface-tokens(
|
|
207
|
+
#0E0F0C, #0A2826, #074140, // content-primary (default, hover, active)
|
|
208
|
+
#054D4D, #043A3A, #022626, // interactive-primary
|
|
209
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
210
|
+
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
211
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
212
|
+
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
&-elevated {
|
|
216
|
+
.sentiment-surface-tokens(
|
|
217
|
+
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
218
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
219
|
+
#054D4D, #043A3A, #022626, // interactive-secondary
|
|
220
|
+
#1F6161, #247070, #298080, // interactive-secondary-neutral
|
|
221
|
+
#054D4D, #043A3A, #022626, // interactive-control
|
|
222
|
+
#054D4D, #043A3A, #022626 // background-surface
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.np-theme-personal--dark &,
|
|
228
|
+
.np-theme-personal--forest-green & {
|
|
229
|
+
&-base {
|
|
230
|
+
.sentiment-surface-tokens(
|
|
231
|
+
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
232
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
233
|
+
#0B312F, #124F4C, #176460, // interactive-secondary
|
|
234
|
+
#174E4D, #1D6261, #237675, // interactive-secondary-neutral
|
|
235
|
+
#0B312F, #124F4C, #176460, // interactive-control
|
|
236
|
+
#0B312F, #124F4C, #176460 // background-surface
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
&-elevated {
|
|
240
|
+
.sentiment-surface-tokens(
|
|
241
|
+
#0E0F0C, #0A2826, #074140, // content-primary
|
|
242
|
+
#0B312F, #104744, #16605C, // interactive-primary
|
|
243
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
244
|
+
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
245
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
246
|
+
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.sentiment-surface-tokens(
|
|
254
|
+
@content-primary,
|
|
255
|
+
@content-primary-hover,
|
|
256
|
+
@content-primary-active,
|
|
257
|
+
@interactive-primary,
|
|
258
|
+
@interactive-primary-hover,
|
|
259
|
+
@interactive-primary-active,
|
|
260
|
+
@interactive-secondary,
|
|
261
|
+
@interactive-secondary-hover,
|
|
262
|
+
@interactive-secondary-active,
|
|
263
|
+
@interactive-secondary-neutral,
|
|
264
|
+
@interactive-secondary-neutral-hover,
|
|
265
|
+
@interactive-secondary-neutral-active,
|
|
266
|
+
@interactive-control,
|
|
267
|
+
@interactive-control-hover,
|
|
268
|
+
@interactive-control-active,
|
|
269
|
+
@background-surface,
|
|
270
|
+
@background-surface-hover,
|
|
271
|
+
@background-surface-active
|
|
272
|
+
) {
|
|
273
|
+
--color-sentiment-content-primary: @content-primary;
|
|
274
|
+
--color-sentiment-content-primary-hover: @content-primary-hover;
|
|
275
|
+
--color-sentiment-content-primary-active: @content-primary-active;
|
|
276
|
+
|
|
277
|
+
--color-sentiment-interactive-primary: @interactive-primary;
|
|
278
|
+
--color-sentiment-interactive-primary-hover: @interactive-primary-hover;
|
|
279
|
+
--color-sentiment-interactive-primary-active: @interactive-primary-active;
|
|
280
|
+
|
|
281
|
+
--color-sentiment-interactive-secondary: @interactive-secondary;
|
|
282
|
+
--color-sentiment-interactive-secondary-hover: @interactive-secondary-hover;
|
|
283
|
+
--color-sentiment-interactive-secondary-active: @interactive-secondary-active;
|
|
284
|
+
|
|
285
|
+
--color-sentiment-interactive-secondary-neutral: @interactive-secondary-neutral;
|
|
286
|
+
--color-sentiment-interactive-secondary-neutral-hover: @interactive-secondary-neutral-hover;
|
|
287
|
+
--color-sentiment-interactive-secondary-neutral-active: @interactive-secondary-neutral-active;
|
|
288
|
+
|
|
289
|
+
--color-sentiment-interactive-control: @interactive-control;
|
|
290
|
+
--color-sentiment-interactive-control-hover: @interactive-control-hover;
|
|
291
|
+
--color-sentiment-interactive-control-active: @interactive-control-active;
|
|
292
|
+
|
|
293
|
+
--color-sentiment-background-surface: @background-surface;
|
|
294
|
+
--color-sentiment-background-surface-hover: @background-surface-hover;
|
|
295
|
+
--color-sentiment-background-surface-active: @background-surface-active;
|
|
296
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { render, screen } from '../test-utils';
|
|
2
|
+
import SentimentSurface from './SentimentSurface';
|
|
3
|
+
import { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
4
|
+
|
|
5
|
+
describe('SentimentSurface', () => {
|
|
6
|
+
const testContent = 'Test content';
|
|
7
|
+
|
|
8
|
+
describe('rendering', () => {
|
|
9
|
+
it('renders with children', () => {
|
|
10
|
+
render(<SentimentSurface sentiment="neutral">{testContent}</SentimentSurface>);
|
|
11
|
+
expect(screen.getByText(testContent)).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders as div by default', () => {
|
|
15
|
+
render(
|
|
16
|
+
<SentimentSurface sentiment="neutral" testId="surface">
|
|
17
|
+
{testContent}
|
|
18
|
+
</SentimentSurface>,
|
|
19
|
+
);
|
|
20
|
+
expect(screen.getByTestId('surface').tagName).toBe('DIV');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders as custom element when as prop is provided', () => {
|
|
24
|
+
render(
|
|
25
|
+
<SentimentSurface sentiment="neutral" as="section" testId="surface">
|
|
26
|
+
{testContent}
|
|
27
|
+
</SentimentSurface>,
|
|
28
|
+
);
|
|
29
|
+
expect(screen.getByTestId('surface').tagName).toBe('SECTION');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('sentiment variants', () => {
|
|
34
|
+
const sentiments: Sentiment[] = ['negative', 'warning', 'neutral', 'success', 'proposition'];
|
|
35
|
+
|
|
36
|
+
sentiments.forEach((sentiment) => {
|
|
37
|
+
it(`renders ${sentiment} sentiment with correct class`, () => {
|
|
38
|
+
render(
|
|
39
|
+
<SentimentSurface sentiment={sentiment} testId="surface">
|
|
40
|
+
{testContent}
|
|
41
|
+
</SentimentSurface>,
|
|
42
|
+
);
|
|
43
|
+
const element = screen.getByTestId('surface');
|
|
44
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
45
|
+
expect(element).toHaveClass(`wds-sentiment-surface-${sentiment}-base`);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('emphasis variants', () => {
|
|
51
|
+
const emphasisLevels: Emphasis[] = ['base', 'elevated'];
|
|
52
|
+
|
|
53
|
+
emphasisLevels.forEach((emphasis) => {
|
|
54
|
+
it(`renders ${emphasis} emphasis with correct class`, () => {
|
|
55
|
+
render(
|
|
56
|
+
<SentimentSurface sentiment="neutral" emphasis={emphasis} testId="surface">
|
|
57
|
+
{testContent}
|
|
58
|
+
</SentimentSurface>,
|
|
59
|
+
);
|
|
60
|
+
const element = screen.getByTestId('surface');
|
|
61
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
62
|
+
expect(element).toHaveClass(`wds-sentiment-surface-neutral-${emphasis}`);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('defaults to base emphasis when not provided', () => {
|
|
67
|
+
render(
|
|
68
|
+
<SentimentSurface sentiment="neutral" testId="surface">
|
|
69
|
+
{testContent}
|
|
70
|
+
</SentimentSurface>,
|
|
71
|
+
);
|
|
72
|
+
const element = screen.getByTestId('surface');
|
|
73
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
74
|
+
expect(element).toHaveClass('wds-sentiment-surface-neutral-base');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('custom props', () => {
|
|
79
|
+
it('applies custom className', () => {
|
|
80
|
+
const customClass = 'custom-class';
|
|
81
|
+
render(
|
|
82
|
+
<SentimentSurface sentiment="neutral" className={customClass} testId="surface">
|
|
83
|
+
{testContent}
|
|
84
|
+
</SentimentSurface>,
|
|
85
|
+
);
|
|
86
|
+
expect(screen.getByTestId('surface')).toHaveClass(customClass);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('applies custom id', () => {
|
|
90
|
+
const customId = 'custom-id';
|
|
91
|
+
render(
|
|
92
|
+
<SentimentSurface sentiment="neutral" id={customId}>
|
|
93
|
+
{testContent}
|
|
94
|
+
</SentimentSurface>,
|
|
95
|
+
);
|
|
96
|
+
expect(screen.getByText(testContent)).toHaveAttribute('id', customId);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('applies testId via data-testid', () => {
|
|
100
|
+
const testId = 'test-surface';
|
|
101
|
+
render(
|
|
102
|
+
<SentimentSurface sentiment="neutral" testId={testId}>
|
|
103
|
+
{testContent}
|
|
104
|
+
</SentimentSurface>,
|
|
105
|
+
);
|
|
106
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('applies custom style', () => {
|
|
110
|
+
const customStyle = { padding: '20px' };
|
|
111
|
+
render(
|
|
112
|
+
<SentimentSurface sentiment="neutral" style={customStyle} testId="surface">
|
|
113
|
+
{testContent}
|
|
114
|
+
</SentimentSurface>,
|
|
115
|
+
);
|
|
116
|
+
expect(screen.getByTestId('surface')).toHaveStyle(customStyle);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('HTML attributes', () => {
|
|
121
|
+
it('supports aria-label attribute', () => {
|
|
122
|
+
const ariaLabel = 'Surface label';
|
|
123
|
+
render(
|
|
124
|
+
<SentimentSurface sentiment="neutral" aria-label={ariaLabel} testId="surface">
|
|
125
|
+
{testContent}
|
|
126
|
+
</SentimentSurface>,
|
|
127
|
+
);
|
|
128
|
+
expect(screen.getByTestId('surface')).toHaveAttribute('aria-label', ariaLabel);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('supports role attribute', () => {
|
|
132
|
+
render(
|
|
133
|
+
<SentimentSurface sentiment="neutral" role="region" testId="surface">
|
|
134
|
+
{testContent}
|
|
135
|
+
</SentimentSurface>,
|
|
136
|
+
);
|
|
137
|
+
expect(screen.getByTestId('surface')).toHaveAttribute('role', 'region');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import SentimentSurface from './SentimentSurface';
|
|
3
|
+
import { storyConfig } from '../test-utils';
|
|
4
|
+
import type { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
5
|
+
|
|
6
|
+
const withContainer = (Story: () => JSX.Element) => (
|
|
7
|
+
<div style={{ display: 'flex', justifyContent: 'center', padding: '2rem' }}>
|
|
8
|
+
<Story />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const withComponentGrid = (Story: () => JSX.Element) => (
|
|
13
|
+
<div
|
|
14
|
+
style={{
|
|
15
|
+
width: '100%',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
gap: '1rem',
|
|
19
|
+
maxWidth: '800px',
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* SentimentSurface is a polymorphic container component that applies contextual background colours
|
|
28
|
+
* and text styling based on sentiment types.
|
|
29
|
+
*/
|
|
30
|
+
const meta: Meta<typeof SentimentSurface> = {
|
|
31
|
+
component: SentimentSurface,
|
|
32
|
+
title: 'Content/SentimentSurface',
|
|
33
|
+
argTypes: {
|
|
34
|
+
sentiment: {
|
|
35
|
+
control: 'select',
|
|
36
|
+
options: ['negative', 'warning', 'neutral', 'success', 'proposition'],
|
|
37
|
+
description: 'The sentiment type that determines the colour scheme',
|
|
38
|
+
},
|
|
39
|
+
emphasis: {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: ['base', 'elevated'],
|
|
42
|
+
description: 'The emphasis level affecting background and text contrast',
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: { summary: 'base' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
as: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
description: 'The underlying HTML element to render',
|
|
50
|
+
table: {
|
|
51
|
+
defaultValue: { summary: 'div' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
children: {
|
|
55
|
+
control: 'text',
|
|
56
|
+
description: 'Content to render inside the surface',
|
|
57
|
+
},
|
|
58
|
+
className: {
|
|
59
|
+
control: 'text',
|
|
60
|
+
description: 'Additional CSS classes',
|
|
61
|
+
},
|
|
62
|
+
id: {
|
|
63
|
+
control: 'text',
|
|
64
|
+
description: 'Unique identifier for the component',
|
|
65
|
+
},
|
|
66
|
+
testId: {
|
|
67
|
+
control: 'text',
|
|
68
|
+
description: 'Test ID for React Testing Library',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
args: {
|
|
72
|
+
sentiment: 'neutral',
|
|
73
|
+
emphasis: 'base',
|
|
74
|
+
children: 'This is a sentiment surface',
|
|
75
|
+
style: { padding: '24px', borderRadius: '16px' },
|
|
76
|
+
},
|
|
77
|
+
decorators: [withContainer],
|
|
78
|
+
parameters: {
|
|
79
|
+
docs: {
|
|
80
|
+
toc: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default meta;
|
|
86
|
+
|
|
87
|
+
type Story = StoryObj<typeof SentimentSurface>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The Playground story allows you to experiment with all the props of the SentimentSurface component.
|
|
91
|
+
* Use the controls below to customise the sentiment type, emphasis level, and content.
|
|
92
|
+
*/
|
|
93
|
+
export const Playground: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
sentiment: 'negative',
|
|
96
|
+
emphasis: 'base',
|
|
97
|
+
children: 'Customise the sentiment and emphasis using the controls below',
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* There are five different sentiment types that communicate different types of information or states.
|
|
103
|
+
*/
|
|
104
|
+
export const Sentiments: Story = {
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<>
|
|
107
|
+
<SentimentSurface {...args} sentiment="negative">
|
|
108
|
+
Negative: Your payment has failed
|
|
109
|
+
</SentimentSurface>
|
|
110
|
+
<SentimentSurface {...args} sentiment="warning">
|
|
111
|
+
Warning: Action required on your account
|
|
112
|
+
</SentimentSurface>
|
|
113
|
+
<SentimentSurface {...args} sentiment="neutral">
|
|
114
|
+
Neutral: Your account is up to date
|
|
115
|
+
</SentimentSurface>
|
|
116
|
+
<SentimentSurface {...args} sentiment="success">
|
|
117
|
+
Success: Your payment was successful
|
|
118
|
+
</SentimentSurface>
|
|
119
|
+
<SentimentSurface {...args} sentiment="proposition">
|
|
120
|
+
Proposition: Try our new feature
|
|
121
|
+
</SentimentSurface>
|
|
122
|
+
</>
|
|
123
|
+
),
|
|
124
|
+
parameters: {
|
|
125
|
+
controls: { disable: true },
|
|
126
|
+
},
|
|
127
|
+
decorators: [withComponentGrid],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Each sentiment type has two emphasis levels – base and elevated – to provide different levels of visual prominence.
|
|
132
|
+
*/
|
|
133
|
+
export const EmphasisLevels: Story = {
|
|
134
|
+
render: (args) => (
|
|
135
|
+
<>
|
|
136
|
+
<SentimentSurface {...args} sentiment="negative" emphasis="base">
|
|
137
|
+
Negative - Base emphasis
|
|
138
|
+
</SentimentSurface>
|
|
139
|
+
<SentimentSurface {...args} sentiment="negative" emphasis="elevated">
|
|
140
|
+
Negative - Elevated emphasis
|
|
141
|
+
</SentimentSurface>
|
|
142
|
+
<SentimentSurface {...args} sentiment="success" emphasis="base">
|
|
143
|
+
Success - Base emphasis
|
|
144
|
+
</SentimentSurface>
|
|
145
|
+
<SentimentSurface {...args} sentiment="success" emphasis="elevated">
|
|
146
|
+
Success - Elevated emphasis
|
|
147
|
+
</SentimentSurface>
|
|
148
|
+
</>
|
|
149
|
+
),
|
|
150
|
+
parameters: {
|
|
151
|
+
controls: { disable: true },
|
|
152
|
+
},
|
|
153
|
+
decorators: [withComponentGrid],
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The component can be rendered as any HTML element using the `as` prop.
|
|
158
|
+
*/
|
|
159
|
+
export const PolymorphicRendering: Story = {
|
|
160
|
+
render: (args) => (
|
|
161
|
+
<>
|
|
162
|
+
<SentimentSurface {...args} sentiment="negative">
|
|
163
|
+
Rendered as div (default)
|
|
164
|
+
</SentimentSurface>
|
|
165
|
+
<SentimentSurface {...args} sentiment="negative" as="section">
|
|
166
|
+
Rendered as section
|
|
167
|
+
</SentimentSurface>
|
|
168
|
+
<SentimentSurface {...args} sentiment="negative" as="article">
|
|
169
|
+
Rendered as article
|
|
170
|
+
</SentimentSurface>
|
|
171
|
+
</>
|
|
172
|
+
),
|
|
173
|
+
parameters: {
|
|
174
|
+
controls: { disable: true },
|
|
175
|
+
},
|
|
176
|
+
decorators: [withComponentGrid],
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const sentiments: Sentiment[] = ['negative', 'warning', 'neutral', 'success', 'proposition'];
|
|
180
|
+
const emphasisLevels: Emphasis[] = ['base', 'elevated'];
|
|
181
|
+
|
|
182
|
+
export const AllVariants = storyConfig(
|
|
183
|
+
{
|
|
184
|
+
tags: ['!autodocs'],
|
|
185
|
+
parameters: {
|
|
186
|
+
padding: '0',
|
|
187
|
+
controls: { disable: true },
|
|
188
|
+
},
|
|
189
|
+
render: () => (
|
|
190
|
+
<div
|
|
191
|
+
className="sentiment-surface-variants"
|
|
192
|
+
style={{ display: 'flex', flexDirection: 'column', gap: '16px', maxWidth: '800px' }}
|
|
193
|
+
>
|
|
194
|
+
{sentiments.map((sentiment) =>
|
|
195
|
+
emphasisLevels.map((emphasis) => (
|
|
196
|
+
<SentimentSurface
|
|
197
|
+
key={`${sentiment}-${emphasis}`}
|
|
198
|
+
sentiment={sentiment}
|
|
199
|
+
emphasis={emphasis}
|
|
200
|
+
style={{ padding: '24px', borderRadius: '16px' }}
|
|
201
|
+
>
|
|
202
|
+
{sentiment} - {emphasis} emphasis
|
|
203
|
+
</SentimentSurface>
|
|
204
|
+
)),
|
|
205
|
+
)}
|
|
206
|
+
</div>
|
|
207
|
+
),
|
|
208
|
+
},
|
|
209
|
+
{ variants: ['default', 'dark', 'bright-green', 'forest-green'] },
|
|
210
|
+
);
|