@transferwise/components 0.0.0-experimental-5a23a43 → 0.0.0-experimental-eac6eda

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 (63) hide show
  1. package/build/i18n/ja.json +1 -1
  2. package/build/i18n/ja.json.js +1 -1
  3. package/build/i18n/ja.json.mjs +1 -1
  4. package/build/index.js +1 -0
  5. package/build/index.js.map +1 -1
  6. package/build/index.mjs +1 -1
  7. package/build/main.css +196 -0
  8. package/build/styles/listItem/ListItem.css +196 -0
  9. package/build/styles/main.css +196 -0
  10. package/build/test-utils/assets/apple-pay-logo.svg +84 -0
  11. package/build/types/index.d.ts +2 -0
  12. package/build/types/index.d.ts.map +1 -1
  13. package/build/types/listItem/ListItem.d.ts +44 -0
  14. package/build/types/listItem/ListItem.d.ts.map +1 -0
  15. package/build/types/listItem/ListItemAdditionalInfo.d.ts +9 -0
  16. package/build/types/listItem/ListItemAdditionalInfo.d.ts.map +1 -0
  17. package/build/types/listItem/ListItemButton.d.ts +6 -0
  18. package/build/types/listItem/ListItemButton.d.ts.map +1 -0
  19. package/build/types/listItem/ListItemCheckbox.d.ts +4 -0
  20. package/build/types/listItem/ListItemCheckbox.d.ts.map +1 -0
  21. package/build/types/listItem/ListItemIconButton.d.ts +9 -0
  22. package/build/types/listItem/ListItemIconButton.d.ts.map +1 -0
  23. package/build/types/listItem/ListItemMedia.d.ts +19 -0
  24. package/build/types/listItem/ListItemMedia.d.ts.map +1 -0
  25. package/build/types/listItem/ListItemNavigation.d.ts +4 -0
  26. package/build/types/listItem/ListItemNavigation.d.ts.map +1 -0
  27. package/build/types/listItem/ListItemSwitch.d.ts +3 -0
  28. package/build/types/listItem/ListItemSwitch.d.ts.map +1 -0
  29. package/build/types/listItem/index.d.ts +6 -0
  30. package/build/types/listItem/index.d.ts.map +1 -0
  31. package/build/types/listItem/prompt/Prompt.d.ts +12 -0
  32. package/build/types/listItem/prompt/Prompt.d.ts.map +1 -0
  33. package/build/types/listItem/useListItemControl.d.ts +12 -0
  34. package/build/types/listItem/useListItemControl.d.ts.map +1 -0
  35. package/build/types/test-utils/fake-data.d.ts +2 -0
  36. package/build/types/test-utils/fake-data.d.ts.map +1 -1
  37. package/package.json +3 -3
  38. package/src/i18n/ja.json +1 -1
  39. package/src/index.ts +2 -0
  40. package/src/legacylistItem/LegacyListItem.story.tsx +5 -5
  41. package/src/legacylistItem/LegacyListItem.tests.story.tsx +6 -6
  42. package/src/listItem/ListItem.css +196 -0
  43. package/src/listItem/ListItem.less +192 -0
  44. package/src/listItem/ListItem.spec.tsx +35 -0
  45. package/src/listItem/ListItem.story.tsx +332 -0
  46. package/src/listItem/ListItem.tsx +213 -0
  47. package/src/listItem/ListItemAdditionalInfo.tsx +31 -0
  48. package/src/listItem/ListItemButton.spec.tsx +90 -0
  49. package/src/listItem/ListItemButton.tsx +24 -0
  50. package/src/listItem/ListItemCheckbox.tsx +14 -0
  51. package/src/listItem/ListItemIconButton.tsx +16 -0
  52. package/src/listItem/ListItemMedia.tsx +52 -0
  53. package/src/listItem/ListItemNavigation.tsx +11 -0
  54. package/src/listItem/ListItemSwitch.tsx +8 -0
  55. package/src/listItem/index.ts +10 -0
  56. package/src/listItem/prompt/Prompt.spec.tsx +77 -0
  57. package/src/listItem/prompt/Prompt.story.tsx +170 -0
  58. package/src/listItem/prompt/Prompt.tsx +44 -0
  59. package/src/listItem/useListItemControl.tsx +16 -0
  60. package/src/main.css +196 -0
  61. package/src/main.less +1 -0
  62. package/src/test-utils/assets/apple-pay-logo.svg +84 -0
  63. package/src/test-utils/fake-data.ts +5 -0
@@ -0,0 +1,196 @@
1
+ .wds-list-item {
2
+ padding: 16px;
3
+ padding: var(--size-16);
4
+ border-radius: 16px;
5
+ border-radius: var(--radius-medium);
6
+ background-color: #ffffff;
7
+ background-color: var(--color-background-screen);
8
+ gap: 16px;
9
+ gap: var(--size-16);
10
+ }
11
+ .wds-list-item-interactive {
12
+ cursor: pointer;
13
+ }
14
+ .wds-list-item-interactive:hover {
15
+ background-color: var(--color-background-screen-hover);
16
+ }
17
+ .wds-list-item-interactive:hover .wds-list-item-control .wds-Button {
18
+ background-color: var(--Button-background-hover);
19
+ color: var(--Button-color-hover);
20
+ transition: none;
21
+ }
22
+ .wds-list-item-interactive:active {
23
+ background-color: var(--color-background-screen-active);
24
+ }
25
+ .wds-list-item-interactive .wds-list-item-control .wds-Button {
26
+ transition: none;
27
+ }
28
+ .wds-list-item-media-image {
29
+ width: var(--item-media-image-size);
30
+ height: var(--item-media-image-size);
31
+ }
32
+ .wds-list-item-body {
33
+ width: 100%;
34
+ }
35
+ .wds-list-item-title {
36
+ color: #37517e;
37
+ color: var(--color-content-primary);
38
+ }
39
+ .wds-list-item-additional-info {
40
+ color: #768e9c;
41
+ color: var(--color-content-tertiary);
42
+ }
43
+ .wds-list-item-value {
44
+ flex: 0 0 auto;
45
+ }
46
+ .wds-list-item-control {
47
+ flex: 0 0 auto;
48
+ }
49
+ .wds-list-item-spotlight-active {
50
+ background-color: rgba(134,167,189,0.10196);
51
+ background-color: var(--color-background-neutral);
52
+ }
53
+ .wds-list-item-spotlight-active:not(.disabled):not(:disabled):hover {
54
+ background-color: var(--color-background-neutral-hover);
55
+ }
56
+ .wds-list-item-spotlight-active:not(.disabled):not(:disabled):active {
57
+ background-color: var(--color-background-neutral-active);
58
+ }
59
+ .wds-list-item-spotlight-inactive {
60
+ background-color: rgba(134, 167, 189, 0.025);
61
+ border: 1px dashed rgba(0,0,0,0.10196);
62
+ border: 1px dashed var(--color-border-neutral);
63
+ }
64
+ @supports (color: color-mix(in lch, red, blue)) {
65
+ .wds-list-item-spotlight-inactive {
66
+ background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
67
+ }
68
+ }
69
+ .wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):hover {
70
+ background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
71
+ }
72
+ .wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):active {
73
+ background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
74
+ }
75
+ .wds-list-item-prompt {
76
+ display: inline-flex;
77
+ padding-top: calc(8px / 2);
78
+ padding-top: calc(var(--padding-x-small) / 2);
79
+ padding-bottom: calc(8px / 2);
80
+ padding-bottom: calc(var(--padding-x-small) / 2);
81
+ padding-left: calc(8px - 1px);
82
+ padding-left: calc(var(--padding-x-small) - 1px);
83
+ padding-right: 8px;
84
+ padding-right: var(--padding-x-small);
85
+ border-radius: 10px;
86
+ border-radius: var(--radius-small);
87
+ word-break: break-word;
88
+ word-wrap: break-word;
89
+ }
90
+ .wds-list-item-prompt .np-prompt-icon {
91
+ padding-right: calc(12px / 2);
92
+ padding-right: calc(var(--size-12) / 2);
93
+ padding-top: calc(4px - 1px);
94
+ padding-top: calc(var(--size-4) - 1px);
95
+ padding-bottom: calc(4px - 1px);
96
+ padding-bottom: calc(var(--size-4) - 1px);
97
+ }
98
+ .wds-list-item-prompt .np-prompt-icon .tw-icon-tags,
99
+ .wds-list-item-prompt .np-prompt-icon .tw-icon-confetti {
100
+ color: var(--color-sentiment-positive-primary);
101
+ }
102
+ .wds-list-item-prompt a {
103
+ text-underline-offset: calc(4px / 2);
104
+ text-underline-offset: calc(var(--size-4) / 2);
105
+ }
106
+ .wds-list-item-prompt.np-prompt-interactive {
107
+ -webkit-text-decoration: none;
108
+ text-decoration: none;
109
+ cursor: pointer;
110
+ border: none;
111
+ }
112
+ .wds-list-item-prompt.negative {
113
+ background-color: var(--color-sentiment-negative-secondary);
114
+ color: var(--color-sentiment-negative-primary);
115
+ }
116
+ .wds-list-item-prompt.negative a {
117
+ color: var(--color-sentiment-negative-primary);
118
+ }
119
+ .wds-list-item-prompt.negative a:hover {
120
+ color: var(--color-sentiment-negative-primary-hover);
121
+ }
122
+ .wds-list-item-prompt.negative a:active {
123
+ color: var(--color-sentiment-negative-primary-active);
124
+ }
125
+ .np-prompt-interactive.wds-list-item-prompt.negative:hover {
126
+ background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
127
+ }
128
+ .np-prompt-interactive.wds-list-item-prompt.negative:active {
129
+ background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
130
+ }
131
+ .wds-list-item-prompt.positive,
132
+ .wds-list-item-prompt.discount,
133
+ .wds-list-item-prompt.savings {
134
+ background-color: var(--color-sentiment-positive-secondary);
135
+ color: var(--color-sentiment-positive-primary);
136
+ }
137
+ .wds-list-item-prompt.positive a,
138
+ .wds-list-item-prompt.discount a,
139
+ .wds-list-item-prompt.savings a {
140
+ color: var(--color-sentiment-positive-primary);
141
+ }
142
+ .wds-list-item-prompt.positive a:hover,
143
+ .wds-list-item-prompt.discount a:hover,
144
+ .wds-list-item-prompt.savings a:hover {
145
+ color: var(--color-sentiment-positive-primary-hover);
146
+ }
147
+ .wds-list-item-prompt.positive a:active,
148
+ .wds-list-item-prompt.discount a:active,
149
+ .wds-list-item-prompt.savings a:active {
150
+ color: var(--color-sentiment-positive-primary-active);
151
+ }
152
+ .np-prompt-interactive.wds-list-item-prompt.positive:hover,
153
+ .np-prompt-interactive.wds-list-item-prompt.discount:hover,
154
+ .np-prompt-interactive.wds-list-item-prompt.savings:hover {
155
+ background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
156
+ }
157
+ .np-prompt-interactive.wds-list-item-prompt.positive:active,
158
+ .np-prompt-interactive.wds-list-item-prompt.discount:active,
159
+ .np-prompt-interactive.wds-list-item-prompt.savings:active {
160
+ background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
161
+ }
162
+ .wds-list-item-prompt.neutral {
163
+ background-color: rgba(134,167,189,0.10196);
164
+ background-color: var(--color-background-neutral);
165
+ color: #37517e;
166
+ color: var(--color-content-primary);
167
+ }
168
+ .wds-list-item-prompt.neutral a {
169
+ color: #37517e;
170
+ color: var(--color-content-primary);
171
+ }
172
+ .np-prompt-interactive.wds-list-item-prompt.neutral:hover {
173
+ background-color: var(--color-background-neutral-hover);
174
+ }
175
+ .np-prompt-interactive.wds-list-item-prompt.neutral:active {
176
+ background-color: var(--color-background-neutral-active);
177
+ }
178
+ .wds-list-item-prompt.warning {
179
+ background-color: var(--color-sentiment-warning-secondary);
180
+ color: var(--color-sentiment-warning-content);
181
+ }
182
+ .wds-list-item-prompt.warning a {
183
+ color: var(--color-sentiment-warning-content);
184
+ }
185
+ .wds-list-item-prompt.warning a:hover {
186
+ color: var(--color-sentiment-warning-content-hover);
187
+ }
188
+ .wds-list-item-prompt.warning a:active {
189
+ color: var(--color-sentiment-warning-content-active);
190
+ }
191
+ .np-prompt-interactive.wds-list-item-prompt.warning:hover {
192
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
193
+ }
194
+ .np-prompt-interactive.wds-list-item-prompt.warning:active {
195
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
196
+ }
@@ -0,0 +1,192 @@
1
+ .wds-list-item {
2
+ padding: var(--size-16);
3
+ border-radius: var(--radius-medium);
4
+ background-color: var(--color-background-screen);
5
+ gap: var(--size-16);
6
+
7
+ &-interactive {
8
+ cursor: pointer;
9
+ &:hover {
10
+ background-color: var(--color-background-screen-hover);
11
+ .wds-list-item-control {
12
+ .wds-Button {
13
+ background-color: var(--Button-background-hover);
14
+ color: var(--Button-color-hover);
15
+ transition: none;
16
+ }
17
+ }
18
+ }
19
+ &:active {
20
+ background-color: var(--color-background-screen-active);
21
+ }
22
+ .wds-list-item-control {
23
+ .wds-Button {
24
+ transition: none;
25
+ }
26
+ }
27
+ }
28
+
29
+ &-media {
30
+
31
+ &-image {
32
+ width: var(--item-media-image-size);
33
+ height: var(--item-media-image-size);
34
+ }
35
+ }
36
+
37
+ &-body {
38
+ width: 100%;
39
+ }
40
+
41
+ &-title {
42
+ color: var(--color-content-primary);
43
+ }
44
+
45
+ &-additional-info {
46
+ color: var(--color-content-tertiary);
47
+ }
48
+
49
+ &-value {
50
+ flex: 0 0 auto;
51
+ }
52
+
53
+ &-control {
54
+ flex: 0 0 auto;
55
+ }
56
+
57
+ &-spotlight {
58
+ &-active {
59
+ background-color: var(--color-background-neutral);
60
+ &:not(.disabled, :disabled):hover {
61
+ background-color: var(--color-background-neutral-hover);
62
+ }
63
+ &:not(.disabled, :disabled):active {
64
+ background-color: var(--color-background-neutral-active);
65
+ }
66
+ }
67
+
68
+ &-inactive {
69
+ background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
70
+ border: 1px dashed var(--color-border-neutral);
71
+ &:not(.disabled, :disabled):hover {
72
+ background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
73
+ }
74
+ &:not(.disabled, :disabled):active {
75
+ background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
76
+ }
77
+ }
78
+ }
79
+
80
+ &-prompt {
81
+ display: inline-flex;
82
+ padding-top: calc(var(--padding-x-small) / 2);
83
+ padding-bottom: calc(var(--padding-x-small) / 2);
84
+ padding-left: calc(var(--padding-x-small) - 1px);
85
+ padding-right: var(--padding-x-small);
86
+ border-radius: var(--radius-small);
87
+ word-break: break-word;
88
+ overflow-wrap: break-word;
89
+
90
+ .np-prompt-icon {
91
+ padding-right: calc(var(--size-12) / 2);
92
+ padding-top: calc(var(--size-4) - 1px);
93
+ padding-bottom: calc(var(--size-4) - 1px);
94
+
95
+ .tw-icon-tags,
96
+ .tw-icon-confetti {
97
+ color: var(--color-sentiment-positive-primary);
98
+ }
99
+ }
100
+
101
+ a {
102
+ text-underline-offset: calc(var(--size-4) / 2);
103
+ }
104
+
105
+ &.np-prompt-interactive {
106
+ text-decoration: none;
107
+ cursor: pointer;
108
+ border: none;
109
+ }
110
+
111
+ &.negative {
112
+ background-color: var(--color-sentiment-negative-secondary);
113
+ color: var(--color-sentiment-negative-primary);
114
+ a {
115
+ color: var(--color-sentiment-negative-primary);
116
+ &:hover {
117
+ color: var(--color-sentiment-negative-primary-hover);
118
+ }
119
+ &:active {
120
+ color: var(--color-sentiment-negative-primary-active);
121
+ }
122
+ }
123
+ .np-prompt-interactive& {
124
+ &:hover {
125
+ background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
126
+ }
127
+ &:active {
128
+ background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
129
+ }
130
+ }
131
+ }
132
+ &.positive,
133
+ &.discount,
134
+ &.savings {
135
+ background-color: var(--color-sentiment-positive-secondary);
136
+ color: var(--color-sentiment-positive-primary);
137
+ a {
138
+ color: var(--color-sentiment-positive-primary);
139
+ &:hover {
140
+ color: var(--color-sentiment-positive-primary-hover);
141
+ }
142
+ &:active {
143
+ color: var(--color-sentiment-positive-primary-active);
144
+ }
145
+ }
146
+ .np-prompt-interactive& {
147
+ &:hover {
148
+ background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
149
+ }
150
+ &:active {
151
+ background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
152
+ }
153
+ }
154
+ }
155
+ &.neutral {
156
+ background-color: var(--color-background-neutral);
157
+ color: var(--color-content-primary);
158
+ a {
159
+ color: var(--color-content-primary);
160
+ }
161
+ .np-prompt-interactive& {
162
+ &:hover {
163
+ background-color: var(--color-background-neutral-hover);
164
+ }
165
+ &:active {
166
+ background-color: var(--color-background-neutral-active);
167
+ }
168
+ }
169
+ }
170
+ &.warning {
171
+ background-color: var(--color-sentiment-warning-secondary);
172
+ color: var(--color-sentiment-warning-content);
173
+ a {
174
+ color: var(--color-sentiment-warning-content);
175
+ &:hover {
176
+ color: var(--color-sentiment-warning-content-hover);
177
+ }
178
+ &:active {
179
+ color: var(--color-sentiment-warning-content-active);
180
+ }
181
+ }
182
+ .np-prompt-interactive& {
183
+ &:hover {
184
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
185
+ }
186
+ &:active {
187
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
@@ -0,0 +1,35 @@
1
+ import { render, screen } from '../test-utils';
2
+ import ListItem from './ListItem';
3
+
4
+ describe('ListItem', () => {
5
+ describe('spotlight', () => {
6
+ it('only fully interactive variant can have spotlight:active', () => {
7
+ render(<ListItem title="Test Title" spotlight="active" control={<ListItem.Navigation />} />);
8
+ const listItem = screen.getByRole('listitem');
9
+ expect(listItem).toHaveClass('wds-list-item-interactive');
10
+ expect(listItem).toHaveClass('wds-list-item-spotlight-active');
11
+ });
12
+
13
+ it('only fully interactive variant can have spotlight:inactive', () => {
14
+ render(
15
+ <ListItem
16
+ title="Test Title"
17
+ spotlight="inactive"
18
+ control={<ListItem.Switch onClick={() => {}} />}
19
+ />,
20
+ );
21
+ const listItem = screen.getByRole('listitem');
22
+ expect(listItem).toHaveClass('wds-list-item-interactive');
23
+ expect(listItem).toHaveClass('wds-list-item-spotlight-inactive');
24
+ });
25
+
26
+ it('non interactive variant can have spotlight', () => {
27
+ render(<ListItem title="Test Title" spotlight="inactive" />);
28
+ const listItem = screen.getByRole('listitem');
29
+ expect(listItem).toHaveClass('wds-list-item-non-interactive');
30
+ expect(listItem).not.toHaveClass('wds-list-item-interactive');
31
+ expect(listItem).not.toHaveClass('wds-list-item-spotlight-inactive');
32
+ expect(listItem).not.toHaveClass('wds-list-item-spotlight-active');
33
+ });
34
+ });
35
+ });