@transferwise/components 0.0.0-experimental-d11e9c5 → 0.0.0-experimental-76bb7cd

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 (124) hide show
  1. package/build/avatar/Avatar.js +0 -3
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +0 -3
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatarWrapper/AvatarWrapper.js +4 -10
  6. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  7. package/build/avatarWrapper/AvatarWrapper.mjs +4 -10
  8. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  9. package/build/badge/Badge.js +1 -3
  10. package/build/badge/Badge.js.map +1 -1
  11. package/build/badge/Badge.mjs +1 -3
  12. package/build/badge/Badge.mjs.map +1 -1
  13. package/build/button/Button.js.map +1 -1
  14. package/build/button/Button.mjs.map +1 -1
  15. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  16. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  17. package/build/common/circle/Circle.js +1 -17
  18. package/build/common/circle/Circle.js.map +1 -1
  19. package/build/common/circle/Circle.mjs +1 -17
  20. package/build/common/circle/Circle.mjs.map +1 -1
  21. package/build/index.js +121 -128
  22. package/build/index.js.map +1 -1
  23. package/build/index.mjs +29 -33
  24. package/build/index.mjs.map +1 -1
  25. package/build/main.css +5 -109
  26. package/build/styles/badge/Badge.css +5 -6
  27. package/build/styles/common/circle/Circle.css +0 -32
  28. package/build/styles/main.css +5 -109
  29. package/build/types/avatar/Avatar.d.ts +0 -3
  30. package/build/types/avatar/Avatar.d.ts.map +1 -1
  31. package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -3
  32. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  33. package/build/types/badge/Badge.d.ts +1 -5
  34. package/build/types/badge/Badge.d.ts.map +1 -1
  35. package/build/types/badge/index.d.ts +0 -2
  36. package/build/types/badge/index.d.ts.map +1 -1
  37. package/build/types/button/Button.d.ts +1 -1
  38. package/build/types/button/Button.d.ts.map +1 -1
  39. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  40. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  41. package/build/types/common/circle/Circle.d.ts +0 -2
  42. package/build/types/common/circle/Circle.d.ts.map +1 -1
  43. package/build/types/index.d.ts +1 -3
  44. package/build/types/index.d.ts.map +1 -1
  45. package/build/types/test-utils/index.d.ts +158 -0
  46. package/build/types/test-utils/index.d.ts.map +1 -0
  47. package/build/types/test-utils/jest.setup.d.ts +2 -0
  48. package/build/types/test-utils/jest.setup.d.ts.map +1 -0
  49. package/package.json +4 -3
  50. package/src/avatar/Avatar.tsx +0 -3
  51. package/src/avatarWrapper/AvatarWrapper.tsx +0 -3
  52. package/src/badge/Badge.css +5 -6
  53. package/src/badge/Badge.less +3 -4
  54. package/src/badge/Badge.tsx +1 -8
  55. package/src/badge/index.ts +0 -3
  56. package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
  57. package/src/button/Button.tsx +1 -1
  58. package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
  59. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  60. package/src/common/circle/Circle.css +0 -32
  61. package/src/common/circle/Circle.less +0 -35
  62. package/src/common/circle/Circle.tsx +1 -22
  63. package/src/decision/Decision.story.tsx +46 -10
  64. package/src/flowNavigation/FlowNavigation.story.tsx +48 -10
  65. package/src/index.ts +0 -4
  66. package/src/listItem/ListItem.story.tsx +43 -5
  67. package/src/main.css +5 -109
  68. package/src/main.less +0 -2
  69. package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
  70. package/src/navigationOption/NavigationOption.story.tsx +65 -14
  71. package/src/overlayHeader/OverlayHeader.story.tsx +10 -5
  72. package/src/radio/Radio.story.tsx +5 -5
  73. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  74. package/src/selectOption/SelectOption.story.tsx +30 -31
  75. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  76. package/src/ssr.spec.tsx +264 -0
  77. package/src/test-utils/{index.js → index.tsx} +11 -6
  78. package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
  79. package/src/tile/Tile.story.tsx +6 -2
  80. package/build/avatarView/AvatarView.js +0 -163
  81. package/build/avatarView/AvatarView.js.map +0 -1
  82. package/build/avatarView/AvatarView.mjs +0 -161
  83. package/build/avatarView/AvatarView.mjs.map +0 -1
  84. package/build/avatarView/NotificationDot.js +0 -59
  85. package/build/avatarView/NotificationDot.js.map +0 -1
  86. package/build/avatarView/NotificationDot.mjs +0 -57
  87. package/build/avatarView/NotificationDot.mjs.map +0 -1
  88. package/build/badge/BadgeAssets.js +0 -85
  89. package/build/badge/BadgeAssets.js.map +0 -1
  90. package/build/badge/BadgeAssets.mjs +0 -83
  91. package/build/badge/BadgeAssets.mjs.map +0 -1
  92. package/build/styles/avatarGroup/AvatarGroup.css +0 -29
  93. package/build/styles/avatarView/AvatarView.css +0 -42
  94. package/build/styles/avatarView/NotificationDot.css +0 -20
  95. package/build/types/avatarGroup/AvatarGroup.d.ts +0 -18
  96. package/build/types/avatarGroup/AvatarGroup.d.ts.map +0 -1
  97. package/build/types/avatarGroup/index.d.ts +0 -3
  98. package/build/types/avatarGroup/index.d.ts.map +0 -1
  99. package/build/types/avatarView/AvatarView.d.ts +0 -19
  100. package/build/types/avatarView/AvatarView.d.ts.map +0 -1
  101. package/build/types/avatarView/NotificationDot.d.ts +0 -8
  102. package/build/types/avatarView/NotificationDot.d.ts.map +0 -1
  103. package/build/types/avatarView/index.d.ts +0 -3
  104. package/build/types/avatarView/index.d.ts.map +0 -1
  105. package/build/types/badge/BadgeAssets.d.ts +0 -15
  106. package/build/types/badge/BadgeAssets.d.ts.map +0 -1
  107. package/src/avatarGroup/AvatarGroup.css +0 -29
  108. package/src/avatarGroup/AvatarGroup.less +0 -42
  109. package/src/avatarGroup/AvatarGroup.story.tsx +0 -284
  110. package/src/avatarGroup/AvatarGroup.tsx +0 -117
  111. package/src/avatarGroup/index.ts +0 -2
  112. package/src/avatarView/AvatarView.css +0 -42
  113. package/src/avatarView/AvatarView.less +0 -33
  114. package/src/avatarView/AvatarView.story.tsx +0 -425
  115. package/src/avatarView/AvatarView.tsx +0 -141
  116. package/src/avatarView/NotificationDot.css +0 -20
  117. package/src/avatarView/NotificationDot.less +0 -24
  118. package/src/avatarView/NotificationDot.tsx +0 -35
  119. package/src/avatarView/index.ts +0 -2
  120. package/src/badge/BadgeAssets.tsx +0 -65
  121. package/src/ssr.spec.js +0 -256
  122. /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
  123. /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
  124. /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
@@ -1,65 +0,0 @@
1
- import StatusIcon, { StatusIconProps } from '../statusIcon';
2
- import { Flag } from '@wise/art';
3
- import Circle, { CircleProps } from '../common/circle';
4
- import Image from '../image';
5
- import type { BadgeProps } from './Badge';
6
- import { Plus } from '@transferwise/icons';
7
- import { Size } from '../common';
8
-
9
- export type Props = {
10
- status?: StatusIconProps['sentiment'];
11
- flagCode?: string;
12
- imgSrc?: string;
13
- icon?: React.ReactNode;
14
- type?: 'action' | 'reference';
15
- size?: BadgeProps['size'];
16
- };
17
-
18
- /**
19
- * Common pre-built badge variants.
20
- */
21
- export default function BadgeAssets({
22
- status,
23
- flagCode,
24
- imgSrc,
25
- icon = null,
26
- type = 'action',
27
- size: sizeProp,
28
- }: Props) {
29
- // map to old size (sm, lg) to new ones (numeric)
30
- const size: CircleProps['size'] = sizeProp === Size.LARGE ? 24 : 16;
31
- if (status) {
32
- return <StatusIcon sentiment={status} size={size} />;
33
- }
34
- if (flagCode) {
35
- return (
36
- <Circle size={size} fixedSize enableBorder>
37
- <Flag code={flagCode} intrinsicSize={size} />
38
- </Circle>
39
- );
40
- }
41
- if (imgSrc) {
42
- return (
43
- <Circle size={size} fixedSize enableBorder>
44
- <Image src={imgSrc} alt="" />
45
- </Circle>
46
- );
47
- }
48
- if (['action', 'reference'].includes(type)) {
49
- return (
50
- <Circle
51
- size={size}
52
- fixedSize
53
- style={{
54
- backgroundColor:
55
- type === 'action'
56
- ? 'var(--color-interactive-accent)'
57
- : 'var(--color-background-neutral)',
58
- }}
59
- >
60
- {icon ?? <Plus />}
61
- </Circle>
62
- );
63
- }
64
- return null;
65
- }
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