@transferwise/components 46.79.1 → 46.81.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.
Files changed (123) hide show
  1. package/build/avatar/Avatar.js +3 -0
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +3 -0
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatarView/AvatarView.js +175 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +173 -0
  8. package/build/avatarView/AvatarView.mjs.map +1 -0
  9. package/build/avatarView/NotificationDot.js +59 -0
  10. package/build/avatarView/NotificationDot.js.map +1 -0
  11. package/build/avatarView/NotificationDot.mjs +57 -0
  12. package/build/avatarView/NotificationDot.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +10 -4
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +10 -4
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +16 -4
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +15 -3
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +60 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +58 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/button/Button.js.map +1 -1
  26. package/build/button/Button.mjs.map +1 -1
  27. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  28. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  29. package/build/common/circle/Circle.js +19 -1
  30. package/build/common/circle/Circle.js.map +1 -1
  31. package/build/common/circle/Circle.mjs +19 -1
  32. package/build/common/circle/Circle.mjs.map +1 -1
  33. package/build/i18n/th.json +5 -0
  34. package/build/i18n/th.json.js +5 -0
  35. package/build/i18n/th.json.js.map +1 -1
  36. package/build/i18n/th.json.mjs +5 -0
  37. package/build/i18n/th.json.mjs.map +1 -1
  38. package/build/i18n/zh-HK.json +5 -0
  39. package/build/i18n/zh-HK.json.js +5 -0
  40. package/build/i18n/zh-HK.json.js.map +1 -1
  41. package/build/i18n/zh-HK.json.mjs +5 -0
  42. package/build/i18n/zh-HK.json.mjs.map +1 -1
  43. package/build/index.js +18 -13
  44. package/build/index.js.map +1 -1
  45. package/build/index.mjs +10 -7
  46. package/build/index.mjs.map +1 -1
  47. package/build/main.css +74 -5
  48. package/build/styles/avatarView/AvatarView.css +36 -0
  49. package/build/styles/avatarView/NotificationDot.css +20 -0
  50. package/build/styles/badge/Badge.css +6 -5
  51. package/build/styles/common/circle/Circle.css +32 -0
  52. package/build/styles/main.css +74 -5
  53. package/build/types/avatar/Avatar.d.ts +3 -0
  54. package/build/types/avatar/Avatar.d.ts.map +1 -1
  55. package/build/types/avatarView/AvatarView.d.ts +26 -0
  56. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  57. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  58. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  59. package/build/types/avatarView/index.d.ts +3 -0
  60. package/build/types/avatarView/index.d.ts.map +1 -0
  61. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  62. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  63. package/build/types/badge/Badge.d.ts +9 -4
  64. package/build/types/badge/Badge.d.ts.map +1 -1
  65. package/build/types/badge/BadgeAssets.d.ts +14 -0
  66. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  67. package/build/types/badge/index.d.ts +2 -0
  68. package/build/types/badge/index.d.ts.map +1 -1
  69. package/build/types/button/Button.d.ts +1 -1
  70. package/build/types/button/Button.d.ts.map +1 -1
  71. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  72. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  73. package/build/types/common/circle/Circle.d.ts +2 -0
  74. package/build/types/common/circle/Circle.d.ts.map +1 -1
  75. package/build/types/index.d.ts +3 -1
  76. package/build/types/index.d.ts.map +1 -1
  77. package/build/types/test-utils/index.d.ts +158 -0
  78. package/build/types/test-utils/index.d.ts.map +1 -0
  79. package/build/types/test-utils/jest.setup.d.ts +2 -0
  80. package/build/types/test-utils/jest.setup.d.ts.map +1 -0
  81. package/package.json +2 -1
  82. package/src/avatar/Avatar.tsx +3 -0
  83. package/src/avatarView/AvatarView.css +36 -0
  84. package/src/avatarView/AvatarView.less +27 -0
  85. package/src/avatarView/AvatarView.story.tsx +467 -0
  86. package/src/avatarView/AvatarView.tsx +171 -0
  87. package/src/avatarView/NotificationDot.css +20 -0
  88. package/src/avatarView/NotificationDot.less +24 -0
  89. package/src/avatarView/NotificationDot.tsx +35 -0
  90. package/src/avatarView/index.ts +2 -0
  91. package/src/avatarWrapper/AvatarWrapper.story.tsx +19 -0
  92. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  93. package/src/badge/Badge.css +6 -5
  94. package/src/badge/Badge.less +4 -3
  95. package/src/badge/Badge.tsx +20 -6
  96. package/src/badge/BadgeAssets.tsx +61 -0
  97. package/src/badge/index.ts +3 -0
  98. package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
  99. package/src/button/Button.tsx +1 -1
  100. package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
  101. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  102. package/src/circularButton/CircularButton.spec.tsx +0 -36
  103. package/src/common/circle/Circle.css +32 -0
  104. package/src/common/circle/Circle.less +35 -0
  105. package/src/common/circle/Circle.tsx +24 -1
  106. package/src/flowNavigation/FlowNavigation.story.tsx +19 -52
  107. package/src/i18n/th.json +5 -0
  108. package/src/i18n/zh-HK.json +5 -0
  109. package/src/index.ts +3 -0
  110. package/src/listItem/ListItem.story.tsx +5 -47
  111. package/src/main.css +74 -5
  112. package/src/main.less +1 -0
  113. package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
  114. package/src/overlayHeader/OverlayHeader.story.tsx +6 -14
  115. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  116. package/src/ssr.spec.tsx +264 -0
  117. package/src/test-utils/{index.js → index.tsx} +11 -6
  118. package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
  119. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +0 -381
  120. package/src/ssr.spec.js +0 -256
  121. /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
  122. /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
  123. /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
@@ -1,381 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`CircularButton defaults renders a button of type accent and priority primary 1`] = `
4
- <div>
5
- <label
6
- class="np-circular-btn primary accent"
7
- >
8
- <input
9
- aria-label="Add money"
10
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
11
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
12
- type="button"
13
- />
14
- <span
15
- class="tw-icon tw-icon-plus "
16
- data-testid="plus-icon"
17
- >
18
- <svg
19
- aria-hidden="true"
20
- fill="currentColor"
21
- focusable="false"
22
- height="24"
23
- role="none"
24
- viewBox="0 0 24 24"
25
- width="24"
26
- >
27
- <path
28
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
29
- />
30
- </svg>
31
- </span>
32
- <span
33
- class="np-text-body-default-bold np-circular-btn__label"
34
- >
35
- Add money
36
- </span>
37
- </label>
38
- </div>
39
- `;
40
-
41
- exports[`CircularButton priorities renders primary buttons 1`] = `
42
- <div>
43
- <label
44
- class="np-circular-btn primary accent"
45
- >
46
- <input
47
- aria-label="Add money"
48
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
49
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
50
- type="button"
51
- />
52
- <span
53
- class="tw-icon tw-icon-plus "
54
- data-testid="plus-icon"
55
- >
56
- <svg
57
- aria-hidden="true"
58
- fill="currentColor"
59
- focusable="false"
60
- height="24"
61
- role="none"
62
- viewBox="0 0 24 24"
63
- width="24"
64
- >
65
- <path
66
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
67
- />
68
- </svg>
69
- </span>
70
- <span
71
- class="np-text-body-default-bold np-circular-btn__label"
72
- >
73
- Add money
74
- </span>
75
- </label>
76
- </div>
77
- `;
78
-
79
- exports[`CircularButton priorities renders primary buttons 2`] = `
80
- <div>
81
- <label
82
- class="np-circular-btn primary positive"
83
- >
84
- <input
85
- aria-label="Add money"
86
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-1"
87
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
88
- type="button"
89
- />
90
- <span
91
- class="tw-icon tw-icon-plus "
92
- data-testid="plus-icon"
93
- >
94
- <svg
95
- aria-hidden="true"
96
- fill="currentColor"
97
- focusable="false"
98
- height="24"
99
- role="none"
100
- viewBox="0 0 24 24"
101
- width="24"
102
- >
103
- <path
104
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
105
- />
106
- </svg>
107
- </span>
108
- <span
109
- class="np-text-body-default-bold np-circular-btn__label"
110
- >
111
- Add money
112
- </span>
113
- </label>
114
- </div>
115
- `;
116
-
117
- exports[`CircularButton priorities renders primary buttons 3`] = `
118
- <div>
119
- <label
120
- class="np-circular-btn primary negative"
121
- >
122
- <input
123
- aria-label="Add money"
124
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-1"
125
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
126
- type="button"
127
- />
128
- <span
129
- class="tw-icon tw-icon-plus "
130
- data-testid="plus-icon"
131
- >
132
- <svg
133
- aria-hidden="true"
134
- fill="currentColor"
135
- focusable="false"
136
- height="24"
137
- role="none"
138
- viewBox="0 0 24 24"
139
- width="24"
140
- >
141
- <path
142
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
143
- />
144
- </svg>
145
- </span>
146
- <span
147
- class="np-text-body-default-bold np-circular-btn__label"
148
- >
149
- Add money
150
- </span>
151
- </label>
152
- </div>
153
- `;
154
-
155
- exports[`CircularButton priorities renders secondary buttons 1`] = `
156
- <div>
157
- <label
158
- class="np-circular-btn secondary accent"
159
- >
160
- <input
161
- aria-label="Add money"
162
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-2"
163
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
164
- type="button"
165
- />
166
- <span
167
- class="tw-icon tw-icon-plus "
168
- data-testid="plus-icon"
169
- >
170
- <svg
171
- aria-hidden="true"
172
- fill="currentColor"
173
- focusable="false"
174
- height="24"
175
- role="none"
176
- viewBox="0 0 24 24"
177
- width="24"
178
- >
179
- <path
180
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
181
- />
182
- </svg>
183
- </span>
184
- <span
185
- class="np-text-body-default-bold np-circular-btn__label"
186
- >
187
- Add money
188
- </span>
189
- </label>
190
- </div>
191
- `;
192
-
193
- exports[`CircularButton priorities renders secondary buttons 2`] = `
194
- <div>
195
- <label
196
- class="np-circular-btn secondary positive"
197
- >
198
- <input
199
- aria-label="Add money"
200
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-2"
201
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
202
- type="button"
203
- />
204
- <span
205
- class="tw-icon tw-icon-plus "
206
- data-testid="plus-icon"
207
- >
208
- <svg
209
- aria-hidden="true"
210
- fill="currentColor"
211
- focusable="false"
212
- height="24"
213
- role="none"
214
- viewBox="0 0 24 24"
215
- width="24"
216
- >
217
- <path
218
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
219
- />
220
- </svg>
221
- </span>
222
- <span
223
- class="np-text-body-default-bold np-circular-btn__label"
224
- >
225
- Add money
226
- </span>
227
- </label>
228
- </div>
229
- `;
230
-
231
- exports[`CircularButton priorities renders secondary buttons 3`] = `
232
- <div>
233
- <label
234
- class="np-circular-btn secondary negative"
235
- >
236
- <input
237
- aria-label="Add money"
238
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-2"
239
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
240
- type="button"
241
- />
242
- <span
243
- class="tw-icon tw-icon-plus "
244
- data-testid="plus-icon"
245
- >
246
- <svg
247
- aria-hidden="true"
248
- fill="currentColor"
249
- focusable="false"
250
- height="24"
251
- role="none"
252
- viewBox="0 0 24 24"
253
- width="24"
254
- >
255
- <path
256
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
257
- />
258
- </svg>
259
- </span>
260
- <span
261
- class="np-text-body-default-bold np-circular-btn__label"
262
- >
263
- Add money
264
- </span>
265
- </label>
266
- </div>
267
- `;
268
-
269
- exports[`CircularButton types renders accent buttons 1`] = `
270
- <div>
271
- <label
272
- class="np-circular-btn primary accent"
273
- >
274
- <input
275
- aria-label="Add money"
276
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-accent btn-priority-1"
277
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
278
- type="button"
279
- />
280
- <span
281
- class="tw-icon tw-icon-plus "
282
- data-testid="plus-icon"
283
- >
284
- <svg
285
- aria-hidden="true"
286
- fill="currentColor"
287
- focusable="false"
288
- height="24"
289
- role="none"
290
- viewBox="0 0 24 24"
291
- width="24"
292
- >
293
- <path
294
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
295
- />
296
- </svg>
297
- </span>
298
- <span
299
- class="np-text-body-default-bold np-circular-btn__label"
300
- >
301
- Add money
302
- </span>
303
- </label>
304
- </div>
305
- `;
306
-
307
- exports[`CircularButton types renders negative buttons 1`] = `
308
- <div>
309
- <label
310
- class="np-circular-btn primary negative"
311
- >
312
- <input
313
- aria-label="Add money"
314
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-negative btn-priority-1"
315
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
316
- type="button"
317
- />
318
- <span
319
- class="tw-icon tw-icon-plus "
320
- data-testid="plus-icon"
321
- >
322
- <svg
323
- aria-hidden="true"
324
- fill="currentColor"
325
- focusable="false"
326
- height="24"
327
- role="none"
328
- viewBox="0 0 24 24"
329
- width="24"
330
- >
331
- <path
332
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
333
- />
334
- </svg>
335
- </span>
336
- <span
337
- class="np-text-body-default-bold np-circular-btn__label"
338
- >
339
- Add money
340
- </span>
341
- </label>
342
- </div>
343
- `;
344
-
345
- exports[`CircularButton types renders positive buttons 1`] = `
346
- <div>
347
- <label
348
- class="np-circular-btn primary positive"
349
- >
350
- <input
351
- aria-label="Add money"
352
- class="np-circle d-flex align-items-center justify-content-center btn np-btn m-b-1 btn-positive btn-priority-1"
353
- style="--circle-size: var(--size-56); --circle-icon-size: 28px;"
354
- type="button"
355
- />
356
- <span
357
- class="tw-icon tw-icon-plus "
358
- data-testid="plus-icon"
359
- >
360
- <svg
361
- aria-hidden="true"
362
- fill="currentColor"
363
- focusable="false"
364
- height="24"
365
- role="none"
366
- viewBox="0 0 24 24"
367
- width="24"
368
- >
369
- <path
370
- d="M22.286 11.143h-9.429V1.715h-1.714v9.428H1.714v1.715h9.429v9.428h1.714v-9.428h9.429v-1.715Z"
371
- />
372
- </svg>
373
- </span>
374
- <span
375
- class="np-text-body-default-bold np-circular-btn__label"
376
- >
377
- Add money
378
- </span>
379
- </label>
380
- </div>
381
- `;
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
- });
File without changes