@transferwise/components 0.0.0-experimental-029bd71 → 0.0.0-experimental-bb32303

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 (66) hide show
  1. package/build/button/Button.js.map +1 -1
  2. package/build/button/Button.mjs.map +1 -1
  3. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  4. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  5. package/build/i18n/en.json +0 -5
  6. package/build/i18n/en.json.js +0 -5
  7. package/build/i18n/en.json.js.map +1 -1
  8. package/build/i18n/en.json.mjs +0 -5
  9. package/build/i18n/en.json.mjs.map +1 -1
  10. package/build/main.css +0 -300
  11. package/build/styles/main.css +0 -300
  12. package/build/types/button/Button.d.ts +1 -1
  13. package/build/types/button/Button.d.ts.map +1 -1
  14. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  15. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  16. package/build/types/test-utils/index.d.ts +158 -0
  17. package/build/types/test-utils/index.d.ts.map +1 -0
  18. package/build/types/test-utils/jest.setup.d.ts +2 -0
  19. package/build/types/test-utils/jest.setup.d.ts.map +1 -0
  20. package/package.json +5 -4
  21. package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
  22. package/src/button/Button.tsx +1 -1
  23. package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
  24. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  25. package/src/i18n/en.json +0 -5
  26. package/src/main.css +0 -300
  27. package/src/main.less +0 -1
  28. package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
  29. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  30. package/src/ssr.spec.tsx +264 -0
  31. package/src/test-utils/{index.js → index.tsx} +11 -6
  32. package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
  33. package/build/styles/table/Table.css +0 -300
  34. package/build/types/table/Table.d.ts +0 -23
  35. package/build/types/table/Table.d.ts.map +0 -1
  36. package/build/types/table/Table.messages.d.ts +0 -24
  37. package/build/types/table/Table.messages.d.ts.map +0 -1
  38. package/build/types/table/TableCell.d.ts +0 -44
  39. package/build/types/table/TableCell.d.ts.map +0 -1
  40. package/build/types/table/TableHeader.d.ts +0 -13
  41. package/build/types/table/TableHeader.d.ts.map +0 -1
  42. package/build/types/table/TableRow.d.ts +0 -17
  43. package/build/types/table/TableRow.d.ts.map +0 -1
  44. package/build/types/table/TableStatusText.d.ts +0 -9
  45. package/build/types/table/TableStatusText.d.ts.map +0 -1
  46. package/build/types/table/index.d.ts +0 -6
  47. package/build/types/table/index.d.ts.map +0 -1
  48. package/src/ssr.spec.js +0 -256
  49. package/src/table/Table.css +0 -300
  50. package/src/table/Table.less +0 -361
  51. package/src/table/Table.messages.ts +0 -24
  52. package/src/table/Table.spec.tsx +0 -88
  53. package/src/table/Table.story.tsx +0 -359
  54. package/src/table/Table.tsx +0 -166
  55. package/src/table/TableCell.spec.tsx +0 -304
  56. package/src/table/TableCell.tsx +0 -170
  57. package/src/table/TableHeader.spec.tsx +0 -55
  58. package/src/table/TableHeader.tsx +0 -75
  59. package/src/table/TableRow.spec.tsx +0 -117
  60. package/src/table/TableRow.tsx +0 -70
  61. package/src/table/TableStatusText.spec.tsx +0 -53
  62. package/src/table/TableStatusText.tsx +0 -36
  63. package/src/table/index.ts +0 -11
  64. /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
  65. /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
  66. /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
package/src/ssr.spec.js DELETED
@@ -1,256 +0,0 @@
1
- /**
2
- * @jest-environment node
3
- */
4
- import { renderToString } from 'react-dom/server';
5
-
6
- import en from './i18n/en.json';
7
-
8
- import * as exposedLibraryItems from '.';
9
-
10
- const excluded = new Set([
11
- // hooks
12
- 'useSnackbar',
13
- 'useDirection',
14
- 'useLayout',
15
- 'useScreenSize',
16
-
17
- // specific components
18
- 'Provider',
19
- 'BottomSheet',
20
- 'DropFade',
21
- 'SelectInputTriggerButton',
22
- 'Panel',
23
- 'ResponsivePanel',
24
-
25
- // enums
26
- 'Size',
27
- 'Width',
28
- 'Sentiment',
29
- 'Variant',
30
- 'Priority',
31
- 'ControlType',
32
- 'Type',
33
- 'Theme',
34
- 'DateMode',
35
- 'MonthFormat',
36
- 'Position',
37
- 'Scroll',
38
- 'ProfileType',
39
- 'Breakpoint',
40
- 'Layout',
41
- 'Status',
42
- 'MarkdownNodeType',
43
- 'AvatarType',
44
- 'InfoPresentation',
45
- 'UploadStep',
46
- 'DecisionPresentation',
47
- 'DecisionType',
48
- 'AlertArrowPosition',
49
- 'LogoType',
50
- 'FileType',
51
- 'Direction',
52
- 'Typography',
53
-
54
- // types
55
- 'SearchInputProps',
56
- 'SelectInputItem',
57
- 'SelectInputOptionContentProps',
58
- 'SelectInputProps',
59
- 'UploadedFile',
60
- 'UploadError',
61
- 'UploadResponse',
62
- 'LayoutDirection',
63
-
64
- // utils
65
- 'SUPPORTED_LANGUAGES',
66
- 'RTL_LANGUAGES',
67
- 'DEFAULT_LANG',
68
- 'DEFAULT_LOCALE',
69
- 'adjustLocale',
70
- 'getLangFromLocale',
71
- 'getCountryFromLocale',
72
- 'getDirectionFromLocale',
73
- 'isServerSide',
74
- 'isBrowser',
75
-
76
- // other
77
- 'translations',
78
- ]);
79
-
80
- function isNotExcluded(item) {
81
- return !excluded.has(item);
82
- }
83
-
84
- describe('Server side rendering', () => {
85
- it('can render components', () => {
86
- const componentNames = Object.keys(exposedLibraryItems).filter(isNotExcluded);
87
- expect(componentNames.length).toBeGreaterThan(0);
88
-
89
- // stick all possible properties we might need to render all components in here
90
- const allProps = {
91
- currencies: [],
92
- steps: [],
93
- stepper: {
94
- steps: [],
95
- },
96
- items: [],
97
- children: 'yo',
98
- id: '1',
99
- text: 'test',
100
- timeout: 0,
101
- timestamp: 1,
102
- title: 'trolo',
103
- name: 'lolo',
104
- label: 'hello',
105
- content: 'world',
106
- currency: 'XYZ',
107
- amount: 0,
108
- options: [],
109
- model: {},
110
- fields: {},
111
- media: <h1>Hello</h1>,
112
- onClick: jest.fn(),
113
- onChange: jest.fn(),
114
- status: 'processing',
115
- size: 'sm',
116
- body: 'body',
117
- onClose: jest.fn(),
118
- onDismiss: jest.fn(),
119
- onRemove: jest.fn(),
120
- radios: [
121
- {
122
- id: 'id-test-0',
123
- label: 'Radio1',
124
- },
125
- {
126
- id: 'id-test-0',
127
- label: 'Radio1',
128
- },
129
- ],
130
- position: 'left',
131
- open: true,
132
- tabs: [],
133
- direction: {
134
- xs: 'column',
135
- sm: 'row',
136
- md: 'column',
137
- lg: 'row',
138
- },
139
- alt: '',
140
- src: '',
141
- details: 'yo',
142
- icon: <svg />,
143
- badge: <svg />,
144
- link: 'link',
145
- href: '#',
146
- description: 'description',
147
- 'aria-label': 'a label',
148
- logo: <svg />,
149
- chips: [
150
- {
151
- value: 1,
152
- label: 'One',
153
- },
154
- {
155
- value: 2,
156
- label: 'Two',
157
- },
158
- ],
159
- segments: [
160
- {
161
- id: '1',
162
- value: 'accounting',
163
- label: 'Accounting',
164
- },
165
- {
166
- id: '2',
167
- value: 'payroll',
168
- label: 'Payroll',
169
- },
170
- {
171
- id: '3',
172
- value: 'reporting',
173
- label: 'Reporting',
174
- },
175
- ],
176
- };
177
-
178
- // Override props in case of name collision.
179
- const overrideProps = {
180
- Alert: { children: undefined, message: 'Fluffy kittens', size: undefined },
181
- Card: { isExpanded: true },
182
- CheckboxButton: { children: undefined, onChange: jest.fn() },
183
- Typeahead: { size: 'md' },
184
- InputWithDisplayFormat: { displayPattern: '**-**' },
185
- TextareaWithDisplayFormat: { displayPattern: '**-**' },
186
- Sticky: { position: 'top' },
187
- MoneyInput: { selectedCurrency: { currency: 'EUR' } },
188
- Tabs: { selected: 1, onTabSelect: jest.fn() },
189
- Markdown: { children: '# Markdown string' },
190
- SnackbarConsumer: {
191
- children: jest.fn(),
192
- },
193
- SnackbarContext: {
194
- children: jest.fn(),
195
- },
196
- Popover: {
197
- children: <div />,
198
- },
199
- Progress: {
200
- progress: { value: 50, max: 100 },
201
- },
202
- ProgressBar: {
203
- progress: { value: 50, max: 100 },
204
- },
205
- Field: {
206
- model: 'a model',
207
- type: 'text',
208
- children: <input />,
209
- },
210
- Input: {
211
- children: undefined,
212
- },
213
- SearchInput: {
214
- children: undefined,
215
- },
216
- TextArea: {
217
- children: undefined,
218
- },
219
- Summary: {
220
- status: 'done',
221
- content: undefined,
222
- },
223
- Tile: {
224
- media: <img alt="img" />,
225
- },
226
- Modal: { position: 'top' },
227
- ActionOption: { action: 'hello' },
228
- DateLookup: { value: new Date() },
229
- Link: { size: 16 },
230
- Tooltip: { children: <>yo</> },
231
- SelectOption: { placeholder: { media: <img alt="img" /> } },
232
- };
233
-
234
- const { Provider } = exposedLibraryItems;
235
- componentNames.forEach((componentName) => {
236
- const Component = exposedLibraryItems[componentName];
237
- const newProps = { ...allProps };
238
-
239
- Object.keys(overrideProps[componentName] || {}).forEach((propertyToOverrideKey) => {
240
- newProps[propertyToOverrideKey] = overrideProps[componentName][propertyToOverrideKey];
241
- });
242
-
243
- const view = renderToString(
244
- <Provider i18n={{ locale: 'en-GB', messages: en }}>
245
- {componentName.endsWith('Context') ? (
246
- <Component.Provider {...newProps} />
247
- ) : (
248
- <Component {...newProps} />
249
- )}
250
- </Provider>,
251
- );
252
-
253
- expect(view).toStrictEqual(expect.any(String));
254
- });
255
- });
256
- });
@@ -1,300 +0,0 @@
1
- .np-table {
2
- width: 100%;
3
- background-color: transparent;
4
- }
5
- .np-table-outer-container {
6
- border-radius: 16px;
7
- border-radius: var(--radius-medium);
8
- }
9
- .np-table-outer-container:focus {
10
- outline: none;
11
- }
12
- .np-table-outer-container:focus-visible {
13
- outline: var(--ring-outline-color) solid var(--ring-outline-width);
14
- outline-offset: var(--ring-outline-offset);
15
- }
16
- .np-table-outer-container:focus-visible {
17
- outline-offset: 0;
18
- }
19
- .np-table-outer-container--center {
20
- margin-right: auto;
21
- margin-left: auto;
22
- }
23
- @media (max-width: 767px) {
24
- .np-table-outer-container--center {
25
- width: 100%;
26
- }
27
- }
28
- .np-table-outer-container--full-width {
29
- width: 100%;
30
- }
31
- .np-table-container {
32
- padding: 8px;
33
- padding: var(--size-8);
34
- background-color: rgba(134,167,189,0.10196);
35
- background-color: var(--color-background-neutral);
36
- border-radius: inherit;
37
- }
38
- .np-table-container--loading .np-table-inner-container {
39
- background-image: none;
40
- }
41
- .np-table-inner-container {
42
- background-image: linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0));
43
- background-position: left center, right center, left center, right center;
44
- background-repeat: no-repeat;
45
- background-color: var(--color-contrast-overlay);
46
- background-size: 15px 100%, 15px 100%, 15px 100%, 15px 100%;
47
- background-attachment: local, local, scroll, scroll;
48
- overflow-x: auto;
49
- border-radius: 10px;
50
- }
51
- .np-theme-personal--dark .np-table-inner-container {
52
- background-image: linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, #000000, rgba(0, 0, 0, 0)), linear-gradient(to left, #000000, rgba(0, 0, 0, 0));
53
- }
54
- .np-table-row:last-child .np-table-cell:first-child {
55
- border-bottom-left-radius: 10px;
56
- }
57
- .np-table-row:last-child .np-table-cell:last-child {
58
- border-bottom-right-radius: 10px;
59
- }
60
- .np-table-row:focus {
61
- outline: none;
62
- }
63
- .np-table-row:focus-visible {
64
- outline: var(--ring-outline-color) solid var(--ring-outline-width);
65
- outline-offset: var(--ring-outline-offset);
66
- }
67
- .np-table-row:focus-visible {
68
- outline-offset: -2px;
69
- border-radius: 6px;
70
- }
71
- .np-table-row--clickable .np-table-cell {
72
- position: relative;
73
- }
74
- .np-table-row--clickable .np-table-cell:before {
75
- display: none;
76
- content: "";
77
- position: absolute;
78
- height: 100%;
79
- width: 100%;
80
- top: 0;
81
- left: 0;
82
- background-color: var(--color-background-screen-hover);
83
- }
84
- .np-table-row--clickable .np-table-cell:first-child:before,
85
- .np-table-row--clickable .np-table-cell:last-child:before {
86
- width: calc(100% - 8px);
87
- width: calc(100% - var(--size-8));
88
- }
89
- .np-table-row--clickable .np-table-cell:first-child:before {
90
- left: 8px;
91
- left: var(--size-8);
92
- border-top-left-radius: 6px;
93
- border-bottom-left-radius: 6px;
94
- }
95
- .np-table-row--clickable .np-table-cell:last-child:before {
96
- border-top-right-radius: 6px;
97
- border-bottom-right-radius: 6px;
98
- }
99
- .np-table-row--clickable:hover .np-table-cell:before {
100
- display: block;
101
- }
102
- .np-table-row--clickable:hover:focus-visible .np-table-cell:first-child:before,
103
- .np-table-row--clickable:hover:focus-visible .np-table-cell:last-child:before {
104
- width: 100%;
105
- }
106
- .np-table-row--clickable:hover:focus-visible .np-table-cell:first-child:before {
107
- left: 0;
108
- }
109
- .np-table-row--cosmetic .np-table-cell {
110
- height: 8px;
111
- height: var(--size-8);
112
- padding: 0;
113
- }
114
- .np-table-header,
115
- .np-table-cell {
116
- padding: 0;
117
- }
118
- .np-table-header:first-child,
119
- .np-table-cell:first-child {
120
- padding-left: 16px;
121
- padding-left: var(--size-16);
122
- }
123
- .np-table-header:first-child .np-table-header-content,
124
- .np-table-cell:first-child .np-table-header-content,
125
- .np-table-header:first-child .np-table-cell-content,
126
- .np-table-cell:first-child .np-table-cell-content {
127
- padding-left: 0;
128
- }
129
- .np-table-header:last-child,
130
- .np-table-cell:last-child {
131
- padding-right: 16px;
132
- padding-right: var(--size-16);
133
- }
134
- .np-table-header:last-child .np-table-header-content,
135
- .np-table-cell:last-child .np-table-header-content,
136
- .np-table-header:last-child .np-table-cell-content,
137
- .np-table-cell:last-child .np-table-cell-content {
138
- padding-right: 0;
139
- }
140
- .np-table-header .np-table-text-secondary,
141
- .np-table-cell .np-table-text-secondary {
142
- color: #768e9c;
143
- color: var(--color-content-tertiary);
144
- font-size: 0.75rem;
145
- font-size: var(--font-size-12);
146
- font-style: normal;
147
- font-weight: 400;
148
- font-weight: var(--font-weight-regular);
149
- line-height: 1.125rem;
150
- line-height: var(--line-height-18);
151
- }
152
- .np-table-header.np-table-header--right > .np-text-body-default,
153
- .np-table-cell.np-table-cell--right > .np-text-body-default {
154
- text-align: right;
155
- }
156
- .np-table-header.np-table-header--right + .np-table-header:not(.np-table-header--right),
157
- .np-table-cell.np-table-cell--right + .np-table-cell:not(.np-table-cell--right) {
158
- padding-left: calc(8px + 12px);
159
- padding-left: calc(var(--size-8) + var(--size-12));
160
- }
161
- .np-table-header.np-table-header--right .np-table-header-content,
162
- .np-table-cell.np-table-cell--right .np-table-content {
163
- justify-content: end;
164
- }
165
- .np-table-header-content,
166
- .np-table-content {
167
- display: flex;
168
- align-items: center;
169
- justify-content: start;
170
- }
171
- .np-table-header {
172
- min-width: 160px;
173
- padding-right: 8px;
174
- padding-right: var(--size-8);
175
- padding-bottom: 8px;
176
- padding-bottom: var(--size-8);
177
- padding-left: 8px;
178
- padding-left: var(--size-8);
179
- background-color: rgba(134,167,189,0.10196);
180
- background-color: var(--color-background-neutral);
181
- color: var(--color-interactive-primary);
182
- }
183
- .np-table-header-content {
184
- padding-top: 5px;
185
- padding-bottom: 5px;
186
- white-space: nowrap;
187
- line-height: 1.375rem;
188
- line-height: var(--line-height-22);
189
- letter-spacing: 0.0125em;
190
- letter-spacing: var(--letter-spacing-sm);
191
- }
192
- .np-table-header--error {
193
- color: var(--color-sentiment-negative);
194
- }
195
- .np-table-header--action {
196
- min-width: 0;
197
- padding: 0;
198
- }
199
- .np-table-cell {
200
- padding: 16px 8px;
201
- padding: var(--size-16) var(--size-8);
202
- position: relative;
203
- }
204
- .np-table-cell--cosmetic {
205
- padding: 0;
206
- }
207
- .np-table-cell--primary {
208
- min-width: 200px;
209
- }
210
- .np-table-cell--currency .np-text-body-default {
211
- white-space: nowrap;
212
- }
213
- .np-table-cell--status .status-circle {
214
- width: 24px;
215
- height: 24px;
216
- }
217
- .np-table-cell--status .status-circle .status-icon > svg {
218
- width: 21px;
219
- height: 21px;
220
- }
221
- .np-table-cell .tw-chevron {
222
- margin-left: 8px;
223
- margin-left: var(--size-8);
224
- }
225
- .np-table-cell-separator {
226
- margin-top: 4px;
227
- margin-top: var(--size-4);
228
- margin-bottom: 4px;
229
- margin-bottom: var(--size-4);
230
- height: 1px;
231
- background-color: rgba(134,167,189,0.10196);
232
- background-color: var(--color-background-neutral);
233
- padding: 0;
234
- }
235
- .np-table-cell .np-text-body-default {
236
- line-height: 1.375rem;
237
- line-height: var(--line-height-22);
238
- letter-spacing: 0.01em;
239
- letter-spacing: var(--letter-spacing-xs);
240
- }
241
- .np-table-cell .np-text-body-default-bold {
242
- display: flex;
243
- align-items: center;
244
- color: #37517e;
245
- color: var(--color-content-primary);
246
- white-space: nowrap;
247
- }
248
- .np-table-cell .np-table-content--success {
249
- color: var(--color-sentiment-positive);
250
- }
251
- .np-table-cell .np-table-content--error {
252
- color: var(--color-sentiment-negative);
253
- }
254
- .np-table-cell .tw-loader {
255
- margin: 150px auto;
256
- }
257
- @media (max-width: 320px) {
258
- .np-table-cell .tw-loader {
259
- margin-top: 70px;
260
- margin-bottom: 70px;
261
- }
262
- }
263
- .np-table-content {
264
- gap: 12px;
265
- gap: var(--size-12);
266
- }
267
- .np-table-content--success,
268
- .np-table-content--error {
269
- gap: 4px;
270
- gap: var(--size-4);
271
- }
272
- .np-table-content--success .np-table-content-text,
273
- .np-table-content--error .np-table-content-text {
274
- line-height: 155%;
275
- }
276
- .np-table-content-media {
277
- flex-shrink: 0;
278
- }
279
- .np-table-content-body {
280
- display: flex;
281
- flex-direction: column;
282
- font-size: 0.75rem;
283
- font-size: var(--font-size-12);
284
- color: #768e9c;
285
- color: var(--color-content-tertiary);
286
- }
287
- .np-table-content--reversed {
288
- flex-direction: row-reverse;
289
- }
290
- .np-table-content--reversed .np-table-content-body {
291
- align-items: end;
292
- }
293
- .np-table-empty-data {
294
- display: flex;
295
- align-items: center;
296
- }
297
- .np-table-empty-data .status-circle {
298
- margin-right: 12px;
299
- margin-right: var(--size-12);
300
- }