@transferwise/components 46.40.0 → 46.41.1

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.
Files changed (37) hide show
  1. package/build/index.js +68 -74
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +69 -75
  4. package/build/index.mjs.map +1 -1
  5. package/build/main.css +69 -14
  6. package/build/styles/main.css +69 -14
  7. package/build/styles/statusIcon/StatusIcon.css +4 -2
  8. package/build/styles/uploadInput/UploadInput.css +18 -1
  9. package/build/styles/uploadInput/uploadButton/UploadButton.css +4 -0
  10. package/build/styles/uploadInput/uploadItem/UploadItem.css +43 -11
  11. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  12. package/build/types/field/Field.d.ts +6 -1
  13. package/build/types/field/Field.d.ts.map +1 -1
  14. package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
  15. package/package.json +4 -4
  16. package/src/dateInput/DateInput.spec.tsx +220 -0
  17. package/src/dateInput/DateInput.story.tsx +3 -76
  18. package/src/dateInput/DateInput.tests.story.tsx +238 -0
  19. package/src/dateInput/DateInput.tsx +50 -53
  20. package/src/field/Field.story.tsx +17 -36
  21. package/src/field/Field.tests.story.tsx +33 -0
  22. package/src/field/Field.tsx +23 -13
  23. package/src/inlineAlert/InlineAlert.story.tsx +13 -5
  24. package/src/inlineAlert/InlineAlert.tsx +13 -6
  25. package/src/main.css +69 -14
  26. package/src/statusIcon/StatusIcon.css +4 -2
  27. package/src/statusIcon/StatusIcon.less +4 -2
  28. package/src/statusIcon/StatusIcon.tsx +1 -1
  29. package/src/uploadInput/UploadInput.css +18 -1
  30. package/src/uploadInput/UploadInput.less +17 -1
  31. package/src/uploadInput/UploadInput.tests.story.tsx +13 -2
  32. package/src/uploadInput/uploadButton/UploadButton.css +4 -0
  33. package/src/uploadInput/uploadButton/UploadButton.less +5 -0
  34. package/src/uploadInput/uploadItem/UploadItem.css +43 -11
  35. package/src/uploadInput/uploadItem/UploadItem.less +61 -17
  36. package/src/dateInput/DateInput.rtl.spec.tsx +0 -17
  37. package/src/dateInput/DateInput.spec.js +0 -477
@@ -50,8 +50,25 @@
50
50
  color: var(--color-sentiment-negative) !important;
51
51
  }
52
52
  .np-theme-personal .np-upload-input-errors {
53
+ list-style: none;
53
54
  padding-left: 0;
54
- list-style-position: inside;
55
+ }
56
+ .np-theme-personal .np-upload-input-errors li {
57
+ position: relative;
58
+ padding-left: 16px;
59
+ padding-left: var(--size-16);
60
+ }
61
+ @media (max-width: 320px) {
62
+ .np-theme-personal .np-upload-input-errors li {
63
+ padding-left: 32px;
64
+ padding-left: var(--size-32);
65
+ }
66
+ }
67
+ .np-theme-personal .np-upload-input-errors li:before {
68
+ content: '•';
69
+ position: absolute;
70
+ display: block;
71
+ left: 0;
55
72
  }
56
73
  .np-theme-personal .np-upload-input .status-circle {
57
74
  width: 24px;
@@ -59,8 +59,24 @@
59
59
  }
60
60
 
61
61
  &-errors {
62
+ list-style: none;
62
63
  padding-left: 0;
63
- list-style-position: inside;
64
+
65
+ li {
66
+ position: relative;
67
+ padding-left: var(--size-16);
68
+
69
+ @media (--screen-400-zoom) {
70
+ padding-left: var(--size-32);
71
+ }
72
+
73
+ &:before {
74
+ content: '•';
75
+ position: absolute;
76
+ display: block;
77
+ left: 0;
78
+ }
79
+ }
64
80
  }
65
81
 
66
82
  .status-circle {
@@ -125,13 +125,24 @@ WithFileErrors.args = {
125
125
  id: 5,
126
126
  filename: 'Error with multiple `string` errors passed in `array`.png',
127
127
  status: Status.FAILED,
128
- errors: ['Error 1', 'Error 2', 'Error 3'],
128
+ errors: [
129
+ 'Error 1',
130
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
131
+ 'Error 3',
132
+ ],
129
133
  },
130
134
  {
131
135
  id: 6,
132
136
  filename: 'Error with multiple `obj` errors passed in `array`.png',
133
137
  status: Status.FAILED,
134
- errors: [{ message: 'Error 1' }, { message: 'Error 2' }, { message: 'Error 3' }],
138
+ errors: [
139
+ { message: 'Error 1' },
140
+ {
141
+ message:
142
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
143
+ },
144
+ { message: 'Error 3' },
145
+ ],
135
146
  },
136
147
  ],
137
148
  multiple: true,
@@ -8,6 +8,9 @@
8
8
  border-color: #c9cbce !important;
9
9
  border-color: var(--color-interactive-secondary) !important;
10
10
  }
11
+ .np-upload-button-container.droppable-dropping:before {
12
+ z-index: 2;
13
+ }
11
14
  .np-upload-button-container input[type="file"] {
12
15
  opacity: 0;
13
16
  z-index: -1;
@@ -18,6 +21,7 @@
18
21
  }
19
22
  .np-upload-button {
20
23
  width: 100%;
24
+ border-top: 1px solid transparent;
21
25
  padding: 16px;
22
26
  padding: var(--padding-small);
23
27
  border-radius: 0;
@@ -7,6 +7,10 @@
7
7
 
8
8
  &.droppable-dropping {
9
9
  border-color: var(--color-interactive-secondary) !important;
10
+
11
+ &:before {
12
+ z-index: 2;
13
+ }
10
14
  }
11
15
 
12
16
  input[type="file"] {
@@ -22,6 +26,7 @@
22
26
 
23
27
  .np-upload-button {
24
28
  width: 100%;
29
+ border-top: 1px solid transparent;
25
30
  padding: var(--padding-small);
26
31
  border-radius: 0;
27
32
 
@@ -1,30 +1,49 @@
1
1
  .np-upload-item {
2
2
  border: 1px solid #c9cbce;
3
3
  border: 1px solid var(--color-interactive-secondary);
4
+ position: relative;
4
5
  }
5
- .np-upload-item:first-child ~ div:before {
6
+ .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
7
+ .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
8
+ .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
6
9
  display: block;
7
- position: relative;
10
+ position: absolute;
8
11
  height: 1px;
9
12
  background-color: rgba(0,0,0,0.10196);
10
13
  background-color: var(--color-border-neutral);
11
14
  content: " ";
12
- margin: 0 16px;
13
- margin: 0 var(--size-16);
15
+ left: 16px;
16
+ left: var(--size-16);
17
+ width: calc(100% - 2 * 16px);
18
+ width: calc(100% - 2 * var(--size-16));
19
+ }
20
+ .np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
21
+ .np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
22
+ top: 0;
23
+ }
24
+ .np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
25
+ bottom: -1px;
14
26
  }
15
27
  .np-upload-item:first-child ~ div {
16
- border-top: 0;
28
+ border-top: 1px;
29
+ }
30
+ .np-upload-item:not(:first-child) .np-upload-item--link:hover {
31
+ border-top-color: rgba(0,0,0,0.10196);
32
+ border-top-color: var(--color-border-neutral);
17
33
  }
18
34
  .np-upload-item:not(:last-child) {
19
35
  border-bottom: 0;
20
36
  }
21
- .np-upload-item.np-upload-item__link:hover:before,
22
- .np-upload-button-container:hover:before {
23
- margin: 0 !important;
37
+ .np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
38
+ .np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
39
+ .np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
40
+ .np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
41
+ display: none;
24
42
  }
25
- .np-upload-item.np-upload-item__link:hover + div:before,
26
- .np-upload-button-container:hover + div:before {
27
- margin: 0 !important;
43
+ .np-upload-button-container:hover:before,
44
+ .np-upload-button-container.droppable-dropping:before {
45
+ left: 0 !important;
46
+ width: 100% !important;
28
47
  }
29
48
  .np-upload-button-container:has(:focus-visible) {
30
49
  outline: var(--ring-outline-color) solid var(--ring-outline-width);
@@ -41,17 +60,29 @@
41
60
  flex: 1;
42
61
  -webkit-text-decoration: none;
43
62
  text-decoration: none;
63
+ border-top: 1px solid transparent;
44
64
  border-radius: inherit;
45
65
  }
46
66
  .np-upload-item__link a:focus-visible {
47
67
  outline-offset: -2px;
48
68
  }
69
+ .np-upload-item__link a:hover:before {
70
+ display: none !important;
71
+ }
72
+ .np-upload-item__link a:hover:after {
73
+ left: 0 !important;
74
+ width: 100% !important;
75
+ }
49
76
  .np-upload-item__link a:hover,
50
77
  .np-upload-item__link a:active {
51
78
  -webkit-text-decoration: none;
52
79
  text-decoration: none;
80
+ }
81
+ .np-upload-item__link a:hover .np-upload-button,
82
+ .np-upload-item__link a:active .np-upload-button {
53
83
  background-color: rgba(134,167,189,0.10196);
54
84
  background-color: var(--color-background-neutral);
85
+ border-radius: inherit;
55
86
  }
56
87
  .np-upload-item__body {
57
88
  display: flex;
@@ -76,6 +107,7 @@
76
107
  outline-offset: 0 !important;
77
108
  background-color: rgba(134,167,189,0.10196);
78
109
  background-color: var(--color-background-neutral);
110
+ border: none;
79
111
  color: var(--color-interactive-primary);
80
112
  right: 16px;
81
113
  right: var(--size-16);
@@ -1,42 +1,69 @@
1
1
  @import (reference) "../../../node_modules/@transferwise/neptune-css/src/less/ring.less";
2
2
 
3
+ // Be aware of touching styles related to :before/:after pseudo-elements in this file, delimiters between items build by using them
3
4
  .np-upload-item {
4
5
  border: 1px solid var(--color-interactive-secondary);
6
+ position: relative;
5
7
 
6
- &:first-child ~ div:before {
8
+ &:first-child ~ div:not(.np-upload-item__link):before,
9
+ &:not(:first-child).np-upload-item__link .np-upload-item--link:before,
10
+ &.np-upload-item__link:hover .np-upload-item--link:after {
7
11
  display: block;
8
- position: relative;
12
+ position: absolute;
9
13
  height: 1px;
10
14
  background-color: var(--color-border-neutral);
11
15
  content: " ";
12
- margin: 0 var(--size-16);
16
+ left: var(--size-16);
17
+ width: calc(100% - 2 * var(--size-16));
18
+ }
19
+
20
+ &:first-child ~ div:not(.np-upload-item__link):before,
21
+ &:not(:first-child).np-upload-item__link .np-upload-item--link:before {
22
+ top: 0;
23
+ }
24
+
25
+ &.np-upload-item__link:hover .np-upload-item--link:after {
26
+ bottom: -1px;
13
27
  }
14
28
 
15
29
  &:first-child {
16
30
  & ~ div {
17
- border-top: 0;
31
+ border-top: 1px;
32
+ }
33
+ }
34
+
35
+ &:not(:first-child) {
36
+ .np-upload-item--link:hover {
37
+ border-top-color: var(--color-border-neutral);
18
38
  }
19
39
  }
20
40
 
21
41
  &:not(:last-child) {
22
42
  border-bottom: 0;
23
43
  }
24
- }
25
44
 
26
- .np-upload-item.np-upload-item__link:hover,
27
- .np-upload-button-container:hover {
28
- &:before {
29
- margin: 0 !important;
30
- }
31
- & + div:before {
32
- margin: 0 !important;
45
+
46
+ &.np-upload-item__link:hover + .np-upload-item,
47
+ &.np-upload-item__link:hover + .np-upload-button-container {
48
+ &:before,
49
+ .np-upload-item--link:before {
50
+ display: none;
51
+ }
33
52
  }
34
53
  }
35
54
 
36
- .np-upload-button-container:has(:focus-visible) {
37
- .ring();
38
- border-color: transparent;
39
- outline-offset: -3px;
55
+ .np-upload-button-container {
56
+ &:hover:before,
57
+ &.droppable-dropping:before {
58
+ left: 0 !important;
59
+ width: 100% !important;
60
+ }
61
+
62
+ &:has(:focus-visible) {
63
+ .ring();
64
+ border-color: transparent;
65
+ outline-offset: -3px;
66
+ }
40
67
  }
41
68
 
42
69
  .np-upload-item--single-file:focus-visible,
@@ -49,15 +76,31 @@
49
76
  a {
50
77
  flex: 1;
51
78
  text-decoration: none;
79
+ border-top: 1px solid transparent;
52
80
  border-radius: inherit;
81
+
53
82
  &:focus-visible {
54
83
  outline-offset: -2px;
55
84
  }
56
85
 
86
+ &:hover {
87
+ &:before {
88
+ display: none !important;
89
+ }
90
+
91
+ &:after {
92
+ left: 0 !important;
93
+ width: 100% !important;
94
+ }
95
+ }
96
+
57
97
  &:hover,
58
98
  &:active {
59
99
  text-decoration: none;
60
- background-color: var(--color-background-neutral);
100
+ .np-upload-button {
101
+ background-color: var(--color-background-neutral);
102
+ border-radius: inherit;
103
+ }
61
104
  }
62
105
  }
63
106
  }
@@ -84,6 +127,7 @@
84
127
  border-radius: 50% !important;
85
128
  outline-offset: 0 !important;
86
129
  background-color: var(--color-background-neutral);
130
+ border: none;
87
131
  color: var(--color-interactive-primary);
88
132
  right: var(--size-16);
89
133
  top: var(--size-16);
@@ -1,17 +0,0 @@
1
- import { Field } from '../field/Field';
2
- import { mockMatchMedia, mockResizeObserver, render, screen } from '../test-utils';
3
- import DateInput from './DateInput';
4
-
5
- mockMatchMedia();
6
- mockResizeObserver();
7
-
8
- describe('DateInput', () => {
9
- it('supports `Field` for labeling', () => {
10
- render(
11
- <Field label="Date of birth">
12
- <DateInput onChange={() => {}} />
13
- </Field>,
14
- );
15
- expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Date of birth/);
16
- });
17
- });