@transferwise/components 0.0.0-experimental-3b1799b → 0.0.0-experimental-c6db9e8
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/README.md +3 -5
- package/build/index.esm.js +3 -5
- package/build/index.esm.js.map +1 -1
- package/build/index.js +3 -5
- package/build/index.js.map +1 -1
- package/build/main.css +4 -11
- package/build/styles/main.css +4 -11
- package/build/styles/select/Select.css +4 -9
- package/build/types/select/option/Option.d.ts.map +1 -1
- package/package.json +5 -11
- package/src/main.css +4 -11
- package/src/select/Select.css +4 -9
- package/src/select/Select.less +1 -8
- package/src/select/option/Option.spec.js +3 -21
- package/src/select/option/Option.tsx +2 -7
package/build/main.css
CHANGED
|
@@ -4532,8 +4532,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
.np-select .tw-icon,
|
|
4534
4534
|
.np-dropdown-menu .tw-icon,
|
|
4535
|
-
.np-select
|
|
4536
|
-
.np-dropdown-menu
|
|
4535
|
+
.np-select img,
|
|
4536
|
+
.np-dropdown-menu img {
|
|
4537
4537
|
margin-right: 8px;
|
|
4538
4538
|
margin-right: var(--size-8);
|
|
4539
4539
|
display: inline-block;
|
|
@@ -4541,17 +4541,13 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4541
4541
|
}
|
|
4542
4542
|
[dir="rtl"] .np-select .tw-icon,
|
|
4543
4543
|
[dir="rtl"] .np-dropdown-menu .tw-icon,
|
|
4544
|
-
[dir="rtl"] .np-select
|
|
4545
|
-
[dir="rtl"] .np-dropdown-menu
|
|
4544
|
+
[dir="rtl"] .np-select img,
|
|
4545
|
+
[dir="rtl"] .np-dropdown-menu img {
|
|
4546
4546
|
margin-left: 8px;
|
|
4547
4547
|
margin-left: var(--size-8);
|
|
4548
4548
|
margin-right: 0;
|
|
4549
4549
|
margin-right: initial;
|
|
4550
4550
|
}
|
|
4551
|
-
.np-select .currency-flag,
|
|
4552
|
-
.np-dropdown-menu .currency-flag {
|
|
4553
|
-
margin-top: 3px;
|
|
4554
|
-
}
|
|
4555
4551
|
.np-select .np-text-body-default,
|
|
4556
4552
|
.np-dropdown-menu .np-text-body-default {
|
|
4557
4553
|
color: #5d7079;
|
|
@@ -4565,9 +4561,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4565
4561
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4566
4562
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4567
4563
|
}
|
|
4568
|
-
.np-theme-personal .currency-flag {
|
|
4569
|
-
margin-top: 0;
|
|
4570
|
-
}
|
|
4571
4564
|
.np-theme-personal .np-select .np-dropdown-toggle {
|
|
4572
4565
|
background-color: transparent;
|
|
4573
4566
|
background-color: initial;
|
package/build/styles/main.css
CHANGED
|
@@ -4532,8 +4532,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
.np-select .tw-icon,
|
|
4534
4534
|
.np-dropdown-menu .tw-icon,
|
|
4535
|
-
.np-select
|
|
4536
|
-
.np-dropdown-menu
|
|
4535
|
+
.np-select img,
|
|
4536
|
+
.np-dropdown-menu img {
|
|
4537
4537
|
margin-right: 8px;
|
|
4538
4538
|
margin-right: var(--size-8);
|
|
4539
4539
|
display: inline-block;
|
|
@@ -4541,17 +4541,13 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4541
4541
|
}
|
|
4542
4542
|
[dir="rtl"] .np-select .tw-icon,
|
|
4543
4543
|
[dir="rtl"] .np-dropdown-menu .tw-icon,
|
|
4544
|
-
[dir="rtl"] .np-select
|
|
4545
|
-
[dir="rtl"] .np-dropdown-menu
|
|
4544
|
+
[dir="rtl"] .np-select img,
|
|
4545
|
+
[dir="rtl"] .np-dropdown-menu img {
|
|
4546
4546
|
margin-left: 8px;
|
|
4547
4547
|
margin-left: var(--size-8);
|
|
4548
4548
|
margin-right: 0;
|
|
4549
4549
|
margin-right: initial;
|
|
4550
4550
|
}
|
|
4551
|
-
.np-select .currency-flag,
|
|
4552
|
-
.np-dropdown-menu .currency-flag {
|
|
4553
|
-
margin-top: 3px;
|
|
4554
|
-
}
|
|
4555
4551
|
.np-select .np-text-body-default,
|
|
4556
4552
|
.np-dropdown-menu .np-text-body-default {
|
|
4557
4553
|
color: #5d7079;
|
|
@@ -4565,9 +4561,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4565
4561
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4566
4562
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4567
4563
|
}
|
|
4568
|
-
.np-theme-personal .currency-flag {
|
|
4569
|
-
margin-top: 0;
|
|
4570
|
-
}
|
|
4571
4564
|
.np-theme-personal .np-select .np-dropdown-toggle {
|
|
4572
4565
|
background-color: transparent;
|
|
4573
4566
|
background-color: initial;
|
|
@@ -228,23 +228,20 @@
|
|
|
228
228
|
white-space: nowrap;
|
|
229
229
|
}.np-select .tw-icon,
|
|
230
230
|
.np-dropdown-menu .tw-icon,
|
|
231
|
-
.np-select
|
|
232
|
-
.np-dropdown-menu
|
|
231
|
+
.np-select img,
|
|
232
|
+
.np-dropdown-menu img {
|
|
233
233
|
margin-right: 8px;
|
|
234
234
|
margin-right: var(--size-8);
|
|
235
235
|
display: inline-block;
|
|
236
236
|
vertical-align: middle;
|
|
237
237
|
}[dir="rtl"] .np-select .tw-icon,
|
|
238
238
|
[dir="rtl"] .np-dropdown-menu .tw-icon,
|
|
239
|
-
[dir="rtl"] .np-select
|
|
240
|
-
[dir="rtl"] .np-dropdown-menu
|
|
239
|
+
[dir="rtl"] .np-select img,
|
|
240
|
+
[dir="rtl"] .np-dropdown-menu img {
|
|
241
241
|
margin-left: 8px;
|
|
242
242
|
margin-left: var(--size-8);
|
|
243
243
|
margin-right: 0;
|
|
244
244
|
margin-right: initial;
|
|
245
|
-
}.np-select .currency-flag,
|
|
246
|
-
.np-dropdown-menu .currency-flag {
|
|
247
|
-
margin-top: 3px;
|
|
248
245
|
}.np-select .np-text-body-default,
|
|
249
246
|
.np-dropdown-menu .np-text-body-default {
|
|
250
247
|
color: #5d7079;
|
|
@@ -255,8 +252,6 @@
|
|
|
255
252
|
}.np-theme-personal {
|
|
256
253
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
257
254
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
258
|
-
}.np-theme-personal .currency-flag {
|
|
259
|
-
margin-top: 0;
|
|
260
255
|
}.np-theme-personal .np-select .np-dropdown-toggle {
|
|
261
256
|
background-color: transparent;
|
|
262
257
|
background-color: initial;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../src/select/option/Option.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8B,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9D,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,MAAM,CAAC,CAAC,EAAE,EACjB,KAAK,EACL,QAAa,EACb,IAAS,EACT,SAAc,EACd,IAAI,EACJ,UAAe,EACf,QAAgB,GACjB,EAAE,KAAK,CAAC,CAAC,CAAC,+
|
|
1
|
+
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../src/select/option/Option.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8B,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9D,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,MAAM,CAAC,CAAC,EAAE,EACjB,KAAK,EACL,QAAa,EACb,IAAS,EACT,SAAc,EACd,IAAI,EACJ,UAAe,EACf,QAAgB,GACjB,EAAE,KAAK,CAAC,CAAC,CAAC,+BAqDV;AAED,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-c6db9e8",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@testing-library/react-hooks": "^8.0.0",
|
|
54
54
|
"@testing-library/user-event": "^13.2.1",
|
|
55
55
|
"@transferwise/icons": "^3.7.0",
|
|
56
|
-
"@transferwise/neptune-tokens": "^8.8.
|
|
56
|
+
"@transferwise/neptune-tokens": "^8.8.1",
|
|
57
57
|
"@tsconfig/recommended": "^1.0.2",
|
|
58
58
|
"@types/babel__core": "^7.20.1",
|
|
59
59
|
"@types/jest": "^26.0.20",
|
|
@@ -78,24 +78,18 @@
|
|
|
78
78
|
"rollup": "^3.28.1",
|
|
79
79
|
"storybook": "^7.4.5",
|
|
80
80
|
"@transferwise/less-config": "3.1.0",
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
81
|
+
"@wise/components-theming": "0.8.4",
|
|
82
|
+
"@transferwise/neptune-css": "0.0.0-experimental-c6db9e8"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@transferwise/icons": "^3.7.0",
|
|
86
|
-
"@transferwise/neptune-css": "0.0.0-experimental-
|
|
86
|
+
"@transferwise/neptune-css": "0.0.0-experimental-c6db9e8",
|
|
87
87
|
"@wise/art": "^2.7.0",
|
|
88
88
|
"@wise/components-theming": "^0.8.4",
|
|
89
|
-
"currency-flags": "^4.0.2",
|
|
90
89
|
"react": ">=16.14",
|
|
91
90
|
"react-dom": ">=16.14",
|
|
92
91
|
"react-intl": "^5.10.0 || ^6"
|
|
93
92
|
},
|
|
94
|
-
"peerDependenciesMeta": {
|
|
95
|
-
"currency-flags": {
|
|
96
|
-
"optional": true
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
93
|
"dependencies": {
|
|
100
94
|
"@babel/runtime": "^7.22.15",
|
|
101
95
|
"@floating-ui/react": "^0.25.4",
|
package/src/main.css
CHANGED
|
@@ -4532,8 +4532,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
.np-select .tw-icon,
|
|
4534
4534
|
.np-dropdown-menu .tw-icon,
|
|
4535
|
-
.np-select
|
|
4536
|
-
.np-dropdown-menu
|
|
4535
|
+
.np-select img,
|
|
4536
|
+
.np-dropdown-menu img {
|
|
4537
4537
|
margin-right: 8px;
|
|
4538
4538
|
margin-right: var(--size-8);
|
|
4539
4539
|
display: inline-block;
|
|
@@ -4541,17 +4541,13 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4541
4541
|
}
|
|
4542
4542
|
[dir="rtl"] .np-select .tw-icon,
|
|
4543
4543
|
[dir="rtl"] .np-dropdown-menu .tw-icon,
|
|
4544
|
-
[dir="rtl"] .np-select
|
|
4545
|
-
[dir="rtl"] .np-dropdown-menu
|
|
4544
|
+
[dir="rtl"] .np-select img,
|
|
4545
|
+
[dir="rtl"] .np-dropdown-menu img {
|
|
4546
4546
|
margin-left: 8px;
|
|
4547
4547
|
margin-left: var(--size-8);
|
|
4548
4548
|
margin-right: 0;
|
|
4549
4549
|
margin-right: initial;
|
|
4550
4550
|
}
|
|
4551
|
-
.np-select .currency-flag,
|
|
4552
|
-
.np-dropdown-menu .currency-flag {
|
|
4553
|
-
margin-top: 3px;
|
|
4554
|
-
}
|
|
4555
4551
|
.np-select .np-text-body-default,
|
|
4556
4552
|
.np-dropdown-menu .np-text-body-default {
|
|
4557
4553
|
color: #5d7079;
|
|
@@ -4565,9 +4561,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4565
4561
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4566
4562
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
4567
4563
|
}
|
|
4568
|
-
.np-theme-personal .currency-flag {
|
|
4569
|
-
margin-top: 0;
|
|
4570
|
-
}
|
|
4571
4564
|
.np-theme-personal .np-select .np-dropdown-toggle {
|
|
4572
4565
|
background-color: transparent;
|
|
4573
4566
|
background-color: initial;
|
package/src/select/Select.css
CHANGED
|
@@ -228,23 +228,20 @@
|
|
|
228
228
|
white-space: nowrap;
|
|
229
229
|
}.np-select .tw-icon,
|
|
230
230
|
.np-dropdown-menu .tw-icon,
|
|
231
|
-
.np-select
|
|
232
|
-
.np-dropdown-menu
|
|
231
|
+
.np-select img,
|
|
232
|
+
.np-dropdown-menu img {
|
|
233
233
|
margin-right: 8px;
|
|
234
234
|
margin-right: var(--size-8);
|
|
235
235
|
display: inline-block;
|
|
236
236
|
vertical-align: middle;
|
|
237
237
|
}[dir="rtl"] .np-select .tw-icon,
|
|
238
238
|
[dir="rtl"] .np-dropdown-menu .tw-icon,
|
|
239
|
-
[dir="rtl"] .np-select
|
|
240
|
-
[dir="rtl"] .np-dropdown-menu
|
|
239
|
+
[dir="rtl"] .np-select img,
|
|
240
|
+
[dir="rtl"] .np-dropdown-menu img {
|
|
241
241
|
margin-left: 8px;
|
|
242
242
|
margin-left: var(--size-8);
|
|
243
243
|
margin-right: 0;
|
|
244
244
|
margin-right: initial;
|
|
245
|
-
}.np-select .currency-flag,
|
|
246
|
-
.np-dropdown-menu .currency-flag {
|
|
247
|
-
margin-top: 3px;
|
|
248
245
|
}.np-select .np-text-body-default,
|
|
249
246
|
.np-dropdown-menu .np-text-body-default {
|
|
250
247
|
color: #5d7079;
|
|
@@ -255,8 +252,6 @@
|
|
|
255
252
|
}.np-theme-personal {
|
|
256
253
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
257
254
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
258
|
-
}.np-theme-personal .currency-flag {
|
|
259
|
-
margin-top: 0;
|
|
260
255
|
}.np-theme-personal .np-select .np-dropdown-toggle {
|
|
261
256
|
background-color: transparent;
|
|
262
257
|
background-color: initial;
|
package/src/select/Select.less
CHANGED
|
@@ -250,17 +250,13 @@
|
|
|
250
250
|
.np-select,
|
|
251
251
|
.np-dropdown-menu {
|
|
252
252
|
.tw-icon,
|
|
253
|
-
|
|
253
|
+
img {
|
|
254
254
|
.margin(right, var(--size-8));
|
|
255
255
|
|
|
256
256
|
display: inline-block;
|
|
257
257
|
vertical-align: middle;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
.currency-flag {
|
|
261
|
-
margin-top: 3px;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
260
|
.np-text-body-default {
|
|
265
261
|
color: var(--color-content-secondary);
|
|
266
262
|
}
|
|
@@ -271,9 +267,6 @@
|
|
|
271
267
|
}
|
|
272
268
|
|
|
273
269
|
.np-theme-personal {
|
|
274
|
-
.currency-flag {
|
|
275
|
-
margin-top: 0;
|
|
276
|
-
}
|
|
277
270
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
278
271
|
.np-select .np-dropdown-toggle {
|
|
279
272
|
background-color: unset;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Person as ProfileIcon } from '@transferwise/icons';
|
|
2
|
+
import { Flag } from '@wise/art';
|
|
2
3
|
import { shallow } from 'enzyme';
|
|
3
4
|
|
|
4
5
|
import Body from '../../body';
|
|
@@ -31,31 +32,12 @@ describe('option', () => {
|
|
|
31
32
|
|
|
32
33
|
it('renders the given currency flag for a given currency', () => {
|
|
33
34
|
component.setProps({ currency: 'hustle' });
|
|
34
|
-
expect(component.find(
|
|
35
|
+
expect(component.find(Flag)).toHaveLength(1);
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
it('overrides currency flag with icon', () => {
|
|
38
39
|
component.setProps({ currency: 'hustle', icon: <ProfileIcon /> });
|
|
39
40
|
expect(component.find(ProfileIcon)).toHaveLength(1);
|
|
40
|
-
expect(component.find(
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('show currency flags on mobile if it is selected', () => {
|
|
44
|
-
const flagHiddenOnMobile = () => component.find('i.currency-flag').hasClass('hidden-xs');
|
|
45
|
-
component.setProps({ currency: 'hustle' });
|
|
46
|
-
expect(flagHiddenOnMobile()).toBe(false);
|
|
47
|
-
component.setProps({ selected: true });
|
|
48
|
-
expect(flagHiddenOnMobile()).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('can override class names', () => {
|
|
52
|
-
component.setProps({
|
|
53
|
-
currency: 'hustle',
|
|
54
|
-
classNames: {
|
|
55
|
-
'currency-flag-hustle': 'currency-flag-hustle-xyz',
|
|
56
|
-
'currency-flag': 'currency-flag-xyz',
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
expect(component.find('i.currency-flag-xyz.currency-flag-hustle-xyz')).toHaveLength(1);
|
|
41
|
+
expect(component.find(Flag)).toHaveLength(0);
|
|
60
42
|
});
|
|
61
43
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { Flag } from '@wise/art';
|
|
2
2
|
import { useTheme } from '@wise/components-theming';
|
|
3
3
|
import { cloneElement, ReactElement, ReactNode } from 'react';
|
|
4
4
|
|
|
@@ -26,18 +26,13 @@ function Option<T>({
|
|
|
26
26
|
selected = false,
|
|
27
27
|
}: Props<T>) {
|
|
28
28
|
const { isModern } = useTheme();
|
|
29
|
-
const style = (classes: Array<string>): string =>
|
|
30
|
-
classes.map((className) => classNames[className] || className).join(' ');
|
|
31
|
-
const currencyClassNames = currency
|
|
32
|
-
? style(['currency-flag', `currency-flag-${currency.toLowerCase()}`])
|
|
33
|
-
: undefined;
|
|
34
29
|
|
|
35
30
|
const iconElement = icon
|
|
36
31
|
? cloneElement(icon as ReactElement, {
|
|
37
32
|
size: 24,
|
|
38
33
|
className: 'tw-icon',
|
|
39
34
|
})
|
|
40
|
-
: currency && <
|
|
35
|
+
: currency && <Flag code={currency.toLowerCase()} intrinsicSize={24} />;
|
|
41
36
|
|
|
42
37
|
const titleAndNoteElement = (
|
|
43
38
|
<Body as="span" type={Typography.BODY_LARGE} className={selected ? 'text-ellipsis' : undefined}>
|