@transferwise/components 46.87.2 → 46.88.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/avatarLayout/AvatarLayout.js +9 -2
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +9 -2
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button.js +92 -79
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +93 -80
- package/build/button/Button.mjs.map +1 -1
- package/build/button/Button.resolver.js +74 -0
- package/build/button/Button.resolver.js.map +1 -0
- package/build/button/Button.resolver.mjs +72 -0
- package/build/button/Button.resolver.mjs.map +1 -0
- package/build/button/LegacyButton.js +114 -0
- package/build/button/LegacyButton.js.map +1 -0
- package/build/button/LegacyButton.mjs +112 -0
- package/build/button/LegacyButton.mjs.map +1 -0
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +2 -2
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/header/Header.js +2 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/link/Link.js +8 -3
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +8 -3
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +247 -0
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +2 -4
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +2 -4
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +3 -5
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +3 -5
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -1
- package/build/select/Select.js +2 -2
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +11 -0
- package/build/styles/button/Button.css +228 -15
- package/build/styles/button/Button.vars.css +46 -0
- package/build/styles/button/LegacyButton.css +23 -0
- package/build/styles/main.css +247 -0
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +2 -23
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.resolver.d.ts +35 -0
- package/build/types/button/Button.resolver.d.ts.map +1 -0
- package/build/types/button/Button.types.d.ts +70 -0
- package/build/types/button/Button.types.d.ts.map +1 -0
- package/build/types/button/LegacyButton.d.ts +44 -0
- package/build/types/button/LegacyButton.d.ts.map +1 -0
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts +6 -2
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +1 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +2 -2
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +2 -2
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +3 -3
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.tests.story.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.css +11 -0
- package/src/avatarLayout/AvatarLayout.less +18 -1
- package/src/avatarLayout/AvatarLayout.tsx +10 -2
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
- package/src/badge/Badge.story.tsx +1 -1
- package/src/button/Button.accessibility.docs.mdx +103 -0
- package/src/button/Button.css +228 -15
- package/src/button/Button.less +242 -14
- package/src/button/Button.resolver.tsx +73 -0
- package/src/button/Button.spec.tsx +329 -213
- package/src/button/Button.story.tsx +782 -134
- package/src/button/Button.tests.story.tsx +27 -0
- package/src/button/Button.tsx +103 -132
- package/src/button/Button.types.ts +92 -0
- package/src/button/Button.vars.css +46 -0
- package/src/button/Button.vars.less +59 -0
- package/src/button/LegacyButton.css +23 -0
- package/src/button/LegacyButton.less +24 -0
- package/src/button/LegacyButton.spec.tsx +147 -0
- package/src/button/LegacyButton.story.tsx +228 -0
- package/src/button/LegacyButton.tsx +177 -0
- package/src/button/index.ts +2 -3
- package/src/card/Card.story.tsx +6 -1
- package/src/circularButton/CircularButton.tsx +1 -0
- package/src/field/Field.story.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +1 -2
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/label/Label.story.tsx +1 -1
- package/src/link/Link.tsx +15 -6
- package/src/main.css +247 -0
- package/src/main.less +1 -0
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +2 -8
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +7 -2
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -3
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +4 -12
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +16 -13
- package/src/select/Select.story.tsx +4 -1
- package/src/test-utils/Parameters.d.ts +9 -1
- package/src/test-utils/story-config.ts +10 -1
- package/src/button/__snapshots__/Button.spec.tsx.snap +0 -309
package/src/button/Button.css
CHANGED
|
@@ -1,23 +1,236 @@
|
|
|
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-border-radius: var(--radius-full);
|
|
7
|
+
--Button-label-gap: var(--size-4);
|
|
8
|
+
--Button-large-padding: var(--size-12) var(--size-16);
|
|
9
|
+
--Button-medium-padding: var(--size-8) var(--size-12);
|
|
10
|
+
--Button-small-padding: var(--size-5) var(--size-12);
|
|
11
|
+
--Button-avatar-border-color: var(--color-border-neutral);
|
|
12
|
+
--Button-transition-duration: 150ms;
|
|
13
|
+
--Button-transition-easing: ease-in-out;
|
|
14
|
+
--Button-secondary-background: var(--color-interactive-neutral);
|
|
15
|
+
--Button-secondary-background-hover: var(--color-interactive-neutral-hover);
|
|
16
|
+
--Button-secondary-background-active: var(--color-interactive-neutral-active);
|
|
17
|
+
--Button-secondary-color: var(--color-interactive-primary);
|
|
18
|
+
--Button-secondary-neutral-background: var(--color-background-neutral);
|
|
19
|
+
--Button-secondary-neutral-background-hover: var(--color-background-neutral-hover);
|
|
20
|
+
--Button-secondary-neutral-background-active: var(--color-background-neutral-active);
|
|
21
|
+
--Button-secondary-neutral-color: var(--color-content-primary);
|
|
22
|
+
--Button-tertiary-background: transparent;
|
|
23
|
+
--Button-tertiary-background-hover: var(--color-background-screen-hover);
|
|
24
|
+
--Button-tertiary-background-active: var(--color-background-screen-active);
|
|
25
|
+
--Button-tertiary-color: var(--color-interactive-primary);
|
|
26
|
+
--Button-primary-negative-background: var(--color-sentiment-negative-primary);
|
|
27
|
+
--Button-primary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
28
|
+
--Button-primary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
29
|
+
--Button-primary-negative-color: var(--color-contrast-overlay);
|
|
30
|
+
--Button-secondary-negative-background: var(--color-sentiment-negative-secondary);
|
|
31
|
+
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-secondary-hover);
|
|
32
|
+
--Button-secondary-negative-background-active: var(--color-sentiment-negative-secondary-active);
|
|
33
|
+
--Button-secondary-negative-color: var(--color-sentiment-negative-primary);
|
|
34
|
+
}
|
|
35
|
+
.np-theme-personal--bright-green .wds-Button {
|
|
36
|
+
--Button-primary-negative-color: var(--color-white);
|
|
37
|
+
--Button-secondary-color: var(--color-interactive-control);
|
|
38
|
+
--Button-secondary-negative-color: var(--color-white);
|
|
39
|
+
}
|
|
40
|
+
.np-theme-personal--forest-green .wds-Button {
|
|
41
|
+
--Button-secondary-background: var(--color-interactive-neutral);
|
|
42
|
+
--Button-secondary-negative-background: var(--color-sentiment-negative-primary);
|
|
43
|
+
--Button-secondary-negative-background-hover: var(--color-sentiment-negative-primary-hover);
|
|
44
|
+
--Button-secondary-negative-background-active: var(--color-sentiment-negative-primary-active);
|
|
45
|
+
--Button-secondary-negative-color: var(--color-contrast-overlay);
|
|
46
|
+
}
|
|
47
|
+
/* Button Styles */
|
|
48
|
+
.wds-Button {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
flex: none;
|
|
51
|
+
width: auto;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
vertical-align: middle;
|
|
55
|
+
text-align: center;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
word-wrap: break-word;
|
|
58
|
+
-webkit-appearance: none;
|
|
59
|
+
-moz-appearance: none;
|
|
60
|
+
appearance: none;
|
|
61
|
+
background-color: var(--Button-background);
|
|
62
|
+
border: none;
|
|
63
|
+
border-radius: var(--Button-border-radius);
|
|
64
|
+
color: var(--Button-color);
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: color, background-color var(--Button-transition-duration) var(--Button-transition-easing);
|
|
67
|
+
}
|
|
68
|
+
.wds-Button,
|
|
69
|
+
.wds-Button:hover,
|
|
70
|
+
.wds-Button:active,
|
|
71
|
+
.wds-Button:focus {
|
|
72
|
+
-webkit-text-decoration: none;
|
|
73
|
+
text-decoration: none;
|
|
74
|
+
color: var(--Button-color);
|
|
75
|
+
}
|
|
76
|
+
.wds-Button:hover {
|
|
77
|
+
background-color: var(--Button-background-hover);
|
|
78
|
+
}
|
|
79
|
+
.wds-Button:active {
|
|
80
|
+
background-color: var(--Button-background-active);
|
|
81
|
+
}
|
|
82
|
+
.wds-Button.wds-Button--disabled,
|
|
83
|
+
.wds-Button:disabled {
|
|
84
|
+
filter: none;
|
|
85
|
+
mix-blend-mode: luminosity;
|
|
86
|
+
opacity: 0.45;
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
}
|
|
89
|
+
.wds-Button.wds-Button--disabled,
|
|
90
|
+
.wds-Button:disabled,
|
|
91
|
+
.wds-Button.wds-Button--disabled:hover,
|
|
92
|
+
.wds-Button:disabled:hover,
|
|
93
|
+
.wds-Button.wds-Button--disabled:active,
|
|
94
|
+
.wds-Button:disabled:active {
|
|
95
|
+
background-color: var(--Button-background);
|
|
96
|
+
}
|
|
97
|
+
.wds-Button--secondary {
|
|
98
|
+
--Button-background: var(--Button-secondary-background);
|
|
99
|
+
--Button-background-hover: var(--Button-secondary-background-hover);
|
|
100
|
+
--Button-background-active: var(--Button-secondary-background-active);
|
|
101
|
+
--Button-color: var(--Button-secondary-color);
|
|
102
|
+
}
|
|
103
|
+
.wds-Button--secondary-neutral {
|
|
104
|
+
--Button-background: var(--Button-secondary-neutral-background);
|
|
105
|
+
--Button-background-hover: var(--Button-secondary-neutral-background-hover);
|
|
106
|
+
--Button-background-active: var(--Button-secondary-neutral-background-active);
|
|
107
|
+
--Button-color: var(--Button-secondary-neutral-color);
|
|
108
|
+
}
|
|
109
|
+
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
110
|
+
color: var(--color-interactive-primary);
|
|
111
|
+
}
|
|
112
|
+
.wds-Button--tertiary {
|
|
113
|
+
--Button-background: var(--Button-tertiary-background);
|
|
114
|
+
--Button-background-hover: var(--Button-tertiary-background-hover);
|
|
115
|
+
--Button-background-active: var(--Button-tertiary-background-active);
|
|
116
|
+
--Button-color: var(--Button-tertiary-color);
|
|
117
|
+
}
|
|
118
|
+
.wds-Button--tertiary .wds-Button-labelText,
|
|
119
|
+
.wds-Button--tertiary:hover .wds-Button-labelText,
|
|
120
|
+
.wds-Button--tertiary:active .wds-Button-labelText,
|
|
121
|
+
.wds-Button--tertiary:focus .wds-Button-labelText {
|
|
122
|
+
-webkit-text-decoration: underline;
|
|
123
|
+
text-decoration: underline;
|
|
124
|
+
text-underline-offset: 3px;
|
|
125
|
+
text-decoration-thickness: 1px;
|
|
126
|
+
}
|
|
127
|
+
.wds-Button--negative.wds-Button--primary {
|
|
128
|
+
--Button-background: var(--Button-primary-negative-background);
|
|
129
|
+
--Button-background-hover: var(--Button-primary-negative-background-hover);
|
|
130
|
+
--Button-background-active: var(--Button-primary-negative-background-active);
|
|
131
|
+
--Button-color: var(--Button-primary-negative-color);
|
|
132
|
+
}
|
|
133
|
+
.wds-Button--negative.wds-Button--secondary {
|
|
134
|
+
--Button-background: var(--Button-secondary-negative-background);
|
|
135
|
+
--Button-background-hover: var(--Button-secondary-negative-background-hover);
|
|
136
|
+
--Button-background-active: var(--Button-secondary-negative-background-active);
|
|
137
|
+
--Button-color: var(--Button-secondary-negative-color);
|
|
138
|
+
}
|
|
139
|
+
.wds-Button--large {
|
|
140
|
+
padding: var(--Button-large-padding);
|
|
141
|
+
}
|
|
142
|
+
.wds-Button--medium {
|
|
143
|
+
padding: var(--Button-medium-padding);
|
|
144
|
+
}
|
|
145
|
+
.wds-Button--medium:has(.wds-Button-avatars) {
|
|
146
|
+
padding-inline-start: 8px;
|
|
147
|
+
padding-inline-start: var(--size-8);
|
|
148
|
+
}
|
|
149
|
+
.wds-Button--medium:has(.wds-Button-icon--end) {
|
|
150
|
+
padding-inline-end: 8px;
|
|
151
|
+
padding-inline-end: var(--size-8);
|
|
152
|
+
}
|
|
153
|
+
.wds-Button--medium .wds-Button-icon--start {
|
|
154
|
+
margin-inline-end: var(--Button-label-gap);
|
|
155
|
+
}
|
|
156
|
+
.wds-Button--small {
|
|
157
|
+
padding: var(--Button-small-padding);
|
|
158
|
+
}
|
|
159
|
+
.wds-Button--small:has(.wds-Button-icon--start) {
|
|
160
|
+
padding-inline-start: 8px;
|
|
161
|
+
padding-inline-start: var(--size-8);
|
|
162
|
+
}
|
|
163
|
+
.wds-Button--small:has(.wds-Button-icon--end) {
|
|
164
|
+
padding-inline-end: 8px;
|
|
165
|
+
padding-inline-end: var(--size-8);
|
|
166
|
+
}
|
|
167
|
+
.wds-Button--block {
|
|
168
|
+
width: 100%;
|
|
169
|
+
}
|
|
170
|
+
.wds-Button-avatars {
|
|
171
|
+
display: inline-flex;
|
|
172
|
+
}
|
|
173
|
+
.wds-Button-avatars .np-avatar-view .np-avatar-view-content {
|
|
174
|
+
color: var(--Button-color);
|
|
175
|
+
}
|
|
176
|
+
.wds-Button-icon {
|
|
177
|
+
display: inline-block;
|
|
178
|
+
}
|
|
179
|
+
.wds-Button-icon--md {
|
|
180
|
+
--Button-iconSize: calc(var(--size-10) + var(--size-8));
|
|
181
|
+
}
|
|
182
|
+
.wds-Button-icon--sm {
|
|
183
|
+
--Button-iconSize: var(--size-16);
|
|
184
|
+
}
|
|
185
|
+
.wds-Button-icon svg {
|
|
186
|
+
width: var(--Button-iconSize);
|
|
187
|
+
height: var(--Button-iconSize);
|
|
188
|
+
}
|
|
189
|
+
.wds-Button-content {
|
|
2
190
|
position: relative;
|
|
3
191
|
}
|
|
4
|
-
.
|
|
192
|
+
.wds-Button-content--loading .wds-Button-label,
|
|
193
|
+
.wds-Button-content--loading .wds-Button-media,
|
|
194
|
+
.wds-Button-content--loading .wds-Button-icon {
|
|
195
|
+
visibility: hidden;
|
|
196
|
+
opacity: 0;
|
|
197
|
+
}
|
|
198
|
+
.wds-Button-label {
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
align-items: center;
|
|
202
|
+
gap: var(--Button-label-gap);
|
|
203
|
+
position: relative;
|
|
204
|
+
}
|
|
205
|
+
.wds-Button-loader {
|
|
5
206
|
position: absolute;
|
|
6
|
-
|
|
7
|
-
|
|
207
|
+
width: 100%;
|
|
208
|
+
height: 100%;
|
|
209
|
+
}
|
|
210
|
+
.wds-Button-loader .process-circle {
|
|
211
|
+
stroke: var(--Button-color);
|
|
212
|
+
}
|
|
213
|
+
/* Avatar border transparency */
|
|
214
|
+
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
215
|
+
.wds-Button-avatars .np-circle {
|
|
216
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 20%, transparent);
|
|
8
217
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
218
|
+
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary.wds-Button--negative .wds-Button-avatars .np-circle,
|
|
219
|
+
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary .wds-Button-avatars .np-circle,
|
|
220
|
+
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--secondary-neutral .wds-Button-avatars .np-circle,
|
|
221
|
+
.np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--forest-green):not(.np-theme-personal--bright-green) .wds-Button--tertiary .wds-Button-avatars .np-circle {
|
|
222
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
14
223
|
}
|
|
15
|
-
.np-
|
|
16
|
-
|
|
224
|
+
.np-theme-personal--dark .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
225
|
+
.np-theme-personal--dark .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle,
|
|
226
|
+
.np-theme-personal--forest-green .wds-Button--primary .wds-Button-avatars .np-circle,
|
|
227
|
+
.np-theme-personal--forest-green .wds-Button--primary.wds-Button--negative .wds-Button-avatars .np-circle {
|
|
228
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
17
229
|
}
|
|
18
|
-
.np-
|
|
19
|
-
|
|
230
|
+
.np-theme-personal--bright-green .wds-Button--tertiary .wds-Button-avatars .np-circle,
|
|
231
|
+
.np-theme-personal--bright-green .wds-Button--secondary-neutral .wds-Button-avatars .np-circle {
|
|
232
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
20
233
|
}
|
|
21
|
-
.
|
|
22
|
-
|
|
234
|
+
[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 {
|
|
235
|
+
scale: -1 1;
|
|
23
236
|
}
|
package/src/button/Button.less
CHANGED
|
@@ -1,24 +1,252 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './Button.vars.less';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/* Button Styles */
|
|
4
|
+
.wds-Button {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex: none;
|
|
7
|
+
width: auto;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
text-align: center;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
word-wrap: break-word;
|
|
14
|
+
appearance: none;
|
|
15
|
+
background-color: var(--Button-background);
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: var(--Button-border-radius);
|
|
18
|
+
color: var(--Button-color);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transition: color, background-color var(--Button-transition-duration) var(--Button-transition-easing);
|
|
5
21
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
&,
|
|
23
|
+
&:hover,
|
|
24
|
+
&:active,
|
|
25
|
+
&:focus {
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
color: var(--Button-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: var(--Button-background-hover);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:active {
|
|
35
|
+
background-color: var(--Button-background-active);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.wds-Button--disabled,
|
|
39
|
+
&:disabled {
|
|
40
|
+
// The declarations below are necessary as design specs for
|
|
41
|
+
// the button's disabled state have changed. This is to be
|
|
42
|
+
// further investigated at a later stage.
|
|
43
|
+
// @see https://transferwise.atlassian.net/browse/DS-7386
|
|
44
|
+
filter: none;
|
|
45
|
+
mix-blend-mode: luminosity;
|
|
46
|
+
opacity: 0.45;
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
|
|
49
|
+
&,
|
|
50
|
+
&:hover,
|
|
51
|
+
&:active {
|
|
52
|
+
background-color: var(--Button-background);
|
|
53
|
+
}
|
|
9
54
|
}
|
|
10
55
|
|
|
11
|
-
|
|
12
|
-
|
|
56
|
+
// Priority modifiers
|
|
57
|
+
&--secondary {
|
|
58
|
+
--Button-background: var(--Button-secondary-background);
|
|
59
|
+
--Button-background-hover: var(--Button-secondary-background-hover);
|
|
60
|
+
--Button-background-active: var(--Button-secondary-background-active);
|
|
61
|
+
--Button-color: var(--Button-secondary-color);
|
|
13
62
|
}
|
|
14
63
|
|
|
15
|
-
|
|
16
|
-
|
|
64
|
+
&--secondary-neutral {
|
|
65
|
+
--Button-background: var(--Button-secondary-neutral-background);
|
|
66
|
+
--Button-background-hover: var(--Button-secondary-neutral-background-hover);
|
|
67
|
+
--Button-background-active: var(--Button-secondary-neutral-background-active);
|
|
68
|
+
--Button-color: var(--Button-secondary-neutral-color);
|
|
69
|
+
|
|
70
|
+
.wds-Button-icon--end {
|
|
71
|
+
color: var(--color-interactive-primary);
|
|
72
|
+
}
|
|
17
73
|
}
|
|
18
74
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
75
|
+
&--tertiary {
|
|
76
|
+
--Button-background: var(--Button-tertiary-background);
|
|
77
|
+
--Button-background-hover: var(--Button-tertiary-background-hover);
|
|
78
|
+
--Button-background-active: var(--Button-tertiary-background-active);
|
|
79
|
+
--Button-color: var(--Button-tertiary-color);
|
|
80
|
+
|
|
81
|
+
&,
|
|
82
|
+
&:hover,
|
|
83
|
+
&:active,
|
|
84
|
+
&:focus {
|
|
85
|
+
.wds-Button-labelText{
|
|
86
|
+
text-decoration: underline;
|
|
87
|
+
text-underline-offset: 3px;
|
|
88
|
+
text-decoration-thickness: 1px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Negative styles
|
|
94
|
+
&--negative {
|
|
95
|
+
&.wds-Button--primary {
|
|
96
|
+
--Button-background: var(--Button-primary-negative-background);
|
|
97
|
+
--Button-background-hover: var(--Button-primary-negative-background-hover);
|
|
98
|
+
--Button-background-active: var(--Button-primary-negative-background-active);
|
|
99
|
+
--Button-color: var(--Button-primary-negative-color);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.wds-Button--secondary {
|
|
103
|
+
--Button-background: var(--Button-secondary-negative-background);
|
|
104
|
+
--Button-background-hover: var(--Button-secondary-negative-background-hover);
|
|
105
|
+
--Button-background-active: var(--Button-secondary-negative-background-active);
|
|
106
|
+
--Button-color: var(--Button-secondary-negative-color);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Size modifiers
|
|
111
|
+
&--large {
|
|
112
|
+
padding: var(--Button-large-padding);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&--medium {
|
|
116
|
+
padding: var(--Button-medium-padding);
|
|
117
|
+
|
|
118
|
+
&:has(.wds-Button-avatars){
|
|
119
|
+
padding-inline-start: var(--size-8);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:has(.wds-Button-icon--end){
|
|
123
|
+
padding-inline-end: var(--size-8);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.wds-Button-icon--start{
|
|
127
|
+
margin-inline-end: var(--Button-label-gap);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&--small {
|
|
132
|
+
padding: var(--Button-small-padding);
|
|
133
|
+
|
|
134
|
+
&:has(.wds-Button-icon--start){
|
|
135
|
+
padding-inline-start: var(--size-8);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:has(.wds-Button-icon--end){
|
|
139
|
+
padding-inline-end: var(--size-8);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
// Width modifiers
|
|
146
|
+
&--block {
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&-avatars {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
|
|
153
|
+
.np-avatar-view .np-avatar-view-content {
|
|
154
|
+
color: var(--Button-color);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Icon styles
|
|
159
|
+
&-icon {
|
|
160
|
+
display: inline-block;
|
|
161
|
+
|
|
162
|
+
&--md{
|
|
163
|
+
--Button-iconSize: calc(var(--size-10) + var(--size-8));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&--sm{
|
|
167
|
+
--Button-iconSize: var(--size-16);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
svg {
|
|
171
|
+
width: var(--Button-iconSize);
|
|
172
|
+
height: var(--Button-iconSize);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&-content {
|
|
177
|
+
position: relative;
|
|
178
|
+
|
|
179
|
+
&--loading {
|
|
180
|
+
.wds-Button-label,
|
|
181
|
+
.wds-Button-media,
|
|
182
|
+
.wds-Button-icon {
|
|
183
|
+
visibility: hidden;
|
|
184
|
+
opacity: 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&-label {
|
|
190
|
+
display: flex;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: var(--Button-label-gap);
|
|
194
|
+
position: relative;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&-loader {
|
|
198
|
+
position: absolute;
|
|
199
|
+
width: 100%;
|
|
200
|
+
height: 100%;
|
|
201
|
+
|
|
202
|
+
.process-circle {
|
|
203
|
+
stroke: var(--Button-color);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Avatar border transparency */
|
|
209
|
+
/* dark buttons get 20% transparency, light buttons get 12% */
|
|
210
|
+
.wds-Button-avatars {
|
|
211
|
+
.np-circle {
|
|
212
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 20%, transparent);
|
|
213
|
+
|
|
214
|
+
.wds-Button--secondary.wds-Button--negative &,
|
|
215
|
+
.wds-Button--secondary &,
|
|
216
|
+
.wds-Button--secondary-neutral &,
|
|
217
|
+
.wds-Button--tertiary & {
|
|
218
|
+
.np-theme-personal:not(.np-theme-personal--dark, .np-theme-personal--forest-green, .np-theme-personal--bright-green) & {
|
|
219
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
.wds-Button--primary &,
|
|
223
|
+
.wds-Button--primary.wds-Button--negative & {
|
|
224
|
+
.np-theme-personal--dark &,
|
|
225
|
+
.np-theme-personal--forest-green & {
|
|
226
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
.wds-Button--tertiary &,
|
|
230
|
+
.wds-Button--secondary-neutral & {
|
|
231
|
+
.np-theme-personal--bright-green & {
|
|
232
|
+
--circle-border-color: color-mix(in srgb, var(--Button-color) 12%, transparent);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
:dir(rtl) {
|
|
240
|
+
.wds-Button {
|
|
241
|
+
.tw-icon-chevron-right,
|
|
242
|
+
.tw-icon-arrow-right,
|
|
243
|
+
.tw-icon-chevron-left,
|
|
244
|
+
.tw-icon-arrow-left,
|
|
245
|
+
.tw-icon-arrow-diagonal-down,
|
|
246
|
+
.tw-icon-arrow-diagonal-up,
|
|
247
|
+
.tw-icon-list,
|
|
248
|
+
.tw-icon-activity {
|
|
249
|
+
scale: -1 1;
|
|
250
|
+
}
|
|
23
251
|
}
|
|
24
252
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import LegacyButton, { LegacyButtonProps } from './LegacyButton';
|
|
3
|
+
import { ButtonReferenceType, ButtonProps as NewButtonProps } from './Button.types';
|
|
4
|
+
import NewButton from './Button';
|
|
5
|
+
|
|
6
|
+
export type ButtonProps = LegacyButtonProps | NewButtonProps;
|
|
7
|
+
|
|
8
|
+
const mapProps = (props: LegacyButtonProps): NewButtonProps => {
|
|
9
|
+
const { priority, size, type, ...newProps } = props;
|
|
10
|
+
|
|
11
|
+
const priorityMapping: Record<string, Record<string, NewButtonProps['priority']>> = {
|
|
12
|
+
accent: {
|
|
13
|
+
primary: 'primary',
|
|
14
|
+
secondary: 'secondary-neutral',
|
|
15
|
+
tertiary: 'tertiary',
|
|
16
|
+
},
|
|
17
|
+
positive: {
|
|
18
|
+
primary: 'primary',
|
|
19
|
+
secondary: 'secondary-neutral',
|
|
20
|
+
tertiary: 'secondary-neutral',
|
|
21
|
+
},
|
|
22
|
+
negative: {
|
|
23
|
+
primary: 'primary',
|
|
24
|
+
secondary: 'secondary',
|
|
25
|
+
tertiary: 'secondary',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const mappedPriority =
|
|
30
|
+
type && priority ? priorityMapping[type]?.[priority] || priority : priority || undefined;
|
|
31
|
+
const mappedSentiment = type === 'negative' ? 'negative' : undefined;
|
|
32
|
+
|
|
33
|
+
const legacyButtonTypes: LegacyButtonProps['type'][] = [
|
|
34
|
+
'accent',
|
|
35
|
+
'negative',
|
|
36
|
+
'positive',
|
|
37
|
+
'primary',
|
|
38
|
+
'pay',
|
|
39
|
+
'secondary',
|
|
40
|
+
'danger',
|
|
41
|
+
'link',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const resolveSize = () => {
|
|
45
|
+
if (size) {
|
|
46
|
+
return { xs: 'sm', sm: 'sm', md: 'md', lg: 'lg' }[size] || size;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return size;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
...newProps,
|
|
54
|
+
size: resolveSize(),
|
|
55
|
+
priority: mappedPriority,
|
|
56
|
+
sentiment: mappedSentiment || ('sentiment' in props ? props.sentiment : null),
|
|
57
|
+
type: type && !legacyButtonTypes.includes(type) ? type : props.htmlType || null,
|
|
58
|
+
v2: true,
|
|
59
|
+
} as NewButtonProps;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const Button = forwardRef<ButtonReferenceType, ButtonProps>(({ v2 = false, ...props }, ref) => {
|
|
63
|
+
if (v2) {
|
|
64
|
+
const mappedProps = mapProps(props as LegacyButtonProps);
|
|
65
|
+
return <NewButton {...mappedProps} ref={ref} />;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return <LegacyButton {...(props as LegacyButtonProps)} ref={ref} />;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
Button.displayName = 'Button';
|
|
72
|
+
|
|
73
|
+
export default Button;
|