@transferwise/components 0.0.0-experimental-d11e9c5 → 0.0.0-experimental-6a7bc4f
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.
- package/build/avatarView/AvatarView.js +31 -24
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +30 -23
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/badge/Badge.js +13 -3
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +12 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/badge/BadgeAssets.js +6 -31
- package/build/badge/BadgeAssets.js.map +1 -1
- package/build/badge/BadgeAssets.mjs +1 -26
- package/build/badge/BadgeAssets.mjs.map +1 -1
- package/build/index.js +112 -112
- package/build/index.mjs +24 -24
- package/build/types/avatarView/AvatarView.d.ts +11 -4
- package/build/types/avatarView/AvatarView.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +4 -3
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts +2 -3
- package/build/types/badge/BadgeAssets.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatarView/AvatarView.story.tsx +57 -0
- package/src/avatarView/AvatarView.tsx +44 -24
- package/src/badge/Badge.tsx +12 -5
- package/src/badge/BadgeAssets.tsx +3 -7
- package/src/decision/Decision.story.tsx +9 -9
package/build/index.js
CHANGED
|
@@ -19,30 +19,6 @@ var breakpoint = require('./common/propsValues/breakpoint.js');
|
|
|
19
19
|
require('react/jsx-runtime');
|
|
20
20
|
var Image = require('./image/Image.js');
|
|
21
21
|
require('@transferwise/icons');
|
|
22
|
-
var documentIosClick = require('./common/domHelpers/documentIosClick.js');
|
|
23
|
-
var theme = require('./common/theme.js');
|
|
24
|
-
var direction = require('./common/direction.js');
|
|
25
|
-
var control = require('./common/propsValues/control.js');
|
|
26
|
-
var size = require('./common/propsValues/size.js');
|
|
27
|
-
var typography = require('./common/propsValues/typography.js');
|
|
28
|
-
var width = require('./common/propsValues/width.js');
|
|
29
|
-
var type = require('./common/propsValues/type.js');
|
|
30
|
-
var dateMode = require('./common/propsValues/dateMode.js');
|
|
31
|
-
var monthFormat = require('./common/propsValues/monthFormat.js');
|
|
32
|
-
var position = require('./common/propsValues/position.js');
|
|
33
|
-
var layouts = require('./common/propsValues/layouts.js');
|
|
34
|
-
var status = require('./common/propsValues/status.js');
|
|
35
|
-
var sentiment = require('./common/propsValues/sentiment.js');
|
|
36
|
-
var profileType = require('./common/propsValues/profileType.js');
|
|
37
|
-
var variant = require('./common/propsValues/variant.js');
|
|
38
|
-
var scroll = require('./common/propsValues/scroll.js');
|
|
39
|
-
var markdownNodeType = require('./common/propsValues/markdownNodeType.js');
|
|
40
|
-
var fileType = require('./common/fileType.js');
|
|
41
|
-
var index = require('./common/locale/index.js');
|
|
42
|
-
var initials = require('./common/initials.js');
|
|
43
|
-
var colors = require('./common/colors.js');
|
|
44
|
-
require('react-intl');
|
|
45
|
-
require('./common/closeButton/CloseButton.messages.js');
|
|
46
22
|
var Body = require('./body/Body.js');
|
|
47
23
|
var Button = require('./button/Button.js');
|
|
48
24
|
var Carousel = require('./carousel/Carousel.js');
|
|
@@ -133,6 +109,30 @@ var useDirection = require('./common/hooks/useDirection/useDirection.js');
|
|
|
133
109
|
var useLayout = require('./common/hooks/useLayout/useLayout.js');
|
|
134
110
|
var useScreenSize = require('./common/hooks/useScreenSize.js');
|
|
135
111
|
var useSnackbar = require('./snackbar/useSnackbar.js');
|
|
112
|
+
var documentIosClick = require('./common/domHelpers/documentIosClick.js');
|
|
113
|
+
var theme = require('./common/theme.js');
|
|
114
|
+
var direction = require('./common/direction.js');
|
|
115
|
+
var control = require('./common/propsValues/control.js');
|
|
116
|
+
var size = require('./common/propsValues/size.js');
|
|
117
|
+
var typography = require('./common/propsValues/typography.js');
|
|
118
|
+
var width = require('./common/propsValues/width.js');
|
|
119
|
+
var type = require('./common/propsValues/type.js');
|
|
120
|
+
var dateMode = require('./common/propsValues/dateMode.js');
|
|
121
|
+
var monthFormat = require('./common/propsValues/monthFormat.js');
|
|
122
|
+
var position = require('./common/propsValues/position.js');
|
|
123
|
+
var layouts = require('./common/propsValues/layouts.js');
|
|
124
|
+
var status = require('./common/propsValues/status.js');
|
|
125
|
+
var sentiment = require('./common/propsValues/sentiment.js');
|
|
126
|
+
var profileType = require('./common/propsValues/profileType.js');
|
|
127
|
+
var variant = require('./common/propsValues/variant.js');
|
|
128
|
+
var scroll = require('./common/propsValues/scroll.js');
|
|
129
|
+
var markdownNodeType = require('./common/propsValues/markdownNodeType.js');
|
|
130
|
+
var fileType = require('./common/fileType.js');
|
|
131
|
+
var index = require('./common/locale/index.js');
|
|
132
|
+
var initials = require('./common/initials.js');
|
|
133
|
+
var colors = require('./common/colors.js');
|
|
134
|
+
require('react-intl');
|
|
135
|
+
require('./common/closeButton/CloseButton.messages.js');
|
|
136
136
|
var index$1 = require('./i18n/index.js');
|
|
137
137
|
var withId = require('./withId/withId.js');
|
|
138
138
|
|
|
@@ -161,94 +161,6 @@ Object.defineProperty(exports, "Breakpoint", {
|
|
|
161
161
|
get: function () { return breakpoint.Breakpoint; }
|
|
162
162
|
});
|
|
163
163
|
exports.Image = Image.default;
|
|
164
|
-
exports.isBrowser = documentIosClick.isBrowser;
|
|
165
|
-
exports.isServerSide = documentIosClick.isServerSide;
|
|
166
|
-
Object.defineProperty(exports, "Theme", {
|
|
167
|
-
enumerable: true,
|
|
168
|
-
get: function () { return theme.Theme; }
|
|
169
|
-
});
|
|
170
|
-
Object.defineProperty(exports, "Direction", {
|
|
171
|
-
enumerable: true,
|
|
172
|
-
get: function () { return direction.Direction; }
|
|
173
|
-
});
|
|
174
|
-
Object.defineProperty(exports, "ControlType", {
|
|
175
|
-
enumerable: true,
|
|
176
|
-
get: function () { return control.ControlType; }
|
|
177
|
-
});
|
|
178
|
-
Object.defineProperty(exports, "Priority", {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
get: function () { return control.Priority; }
|
|
181
|
-
});
|
|
182
|
-
Object.defineProperty(exports, "Size", {
|
|
183
|
-
enumerable: true,
|
|
184
|
-
get: function () { return size.Size; }
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(exports, "Typography", {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
get: function () { return typography.Typography; }
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(exports, "Width", {
|
|
191
|
-
enumerable: true,
|
|
192
|
-
get: function () { return width.Width; }
|
|
193
|
-
});
|
|
194
|
-
Object.defineProperty(exports, "Type", {
|
|
195
|
-
enumerable: true,
|
|
196
|
-
get: function () { return type.Type; }
|
|
197
|
-
});
|
|
198
|
-
Object.defineProperty(exports, "DateMode", {
|
|
199
|
-
enumerable: true,
|
|
200
|
-
get: function () { return dateMode.DateMode; }
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(exports, "MonthFormat", {
|
|
203
|
-
enumerable: true,
|
|
204
|
-
get: function () { return monthFormat.MonthFormat; }
|
|
205
|
-
});
|
|
206
|
-
Object.defineProperty(exports, "Position", {
|
|
207
|
-
enumerable: true,
|
|
208
|
-
get: function () { return position.Position; }
|
|
209
|
-
});
|
|
210
|
-
Object.defineProperty(exports, "Layout", {
|
|
211
|
-
enumerable: true,
|
|
212
|
-
get: function () { return layouts.Layout; }
|
|
213
|
-
});
|
|
214
|
-
Object.defineProperty(exports, "Status", {
|
|
215
|
-
enumerable: true,
|
|
216
|
-
get: function () { return status.Status; }
|
|
217
|
-
});
|
|
218
|
-
Object.defineProperty(exports, "Sentiment", {
|
|
219
|
-
enumerable: true,
|
|
220
|
-
get: function () { return sentiment.Sentiment; }
|
|
221
|
-
});
|
|
222
|
-
Object.defineProperty(exports, "ProfileType", {
|
|
223
|
-
enumerable: true,
|
|
224
|
-
get: function () { return profileType.ProfileType; }
|
|
225
|
-
});
|
|
226
|
-
Object.defineProperty(exports, "Variant", {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
get: function () { return variant.Variant; }
|
|
229
|
-
});
|
|
230
|
-
Object.defineProperty(exports, "Scroll", {
|
|
231
|
-
enumerable: true,
|
|
232
|
-
get: function () { return scroll.Scroll; }
|
|
233
|
-
});
|
|
234
|
-
Object.defineProperty(exports, "MarkdownNodeType", {
|
|
235
|
-
enumerable: true,
|
|
236
|
-
get: function () { return markdownNodeType.MarkdownNodeType; }
|
|
237
|
-
});
|
|
238
|
-
Object.defineProperty(exports, "FileType", {
|
|
239
|
-
enumerable: true,
|
|
240
|
-
get: function () { return fileType.FileType; }
|
|
241
|
-
});
|
|
242
|
-
exports.DEFAULT_LANG = index.DEFAULT_LANG;
|
|
243
|
-
exports.DEFAULT_LOCALE = index.DEFAULT_LOCALE;
|
|
244
|
-
exports.RTL_LANGUAGES = index.RTL_LANGUAGES;
|
|
245
|
-
exports.SUPPORTED_LANGUAGES = index.SUPPORTED_LANGUAGES;
|
|
246
|
-
exports.adjustLocale = index.adjustLocale;
|
|
247
|
-
exports.getCountryFromLocale = index.getCountryFromLocale;
|
|
248
|
-
exports.getDirectionFromLocale = index.getDirectionFromLocale;
|
|
249
|
-
exports.getLangFromLocale = index.getLangFromLocale;
|
|
250
|
-
exports.getInitials = initials.getInitials;
|
|
251
|
-
exports.getBrandColorFromSeed = colors.getBrandColorFromSeed;
|
|
252
164
|
exports.Body = Body;
|
|
253
165
|
exports.Button = Button;
|
|
254
166
|
exports.Carousel = Carousel;
|
|
@@ -360,6 +272,94 @@ exports.useDirection = useDirection.useDirection;
|
|
|
360
272
|
exports.useLayout = useLayout.useLayout;
|
|
361
273
|
exports.useScreenSize = useScreenSize.useScreenSize;
|
|
362
274
|
exports.useSnackbar = useSnackbar;
|
|
275
|
+
exports.isBrowser = documentIosClick.isBrowser;
|
|
276
|
+
exports.isServerSide = documentIosClick.isServerSide;
|
|
277
|
+
Object.defineProperty(exports, "Theme", {
|
|
278
|
+
enumerable: true,
|
|
279
|
+
get: function () { return theme.Theme; }
|
|
280
|
+
});
|
|
281
|
+
Object.defineProperty(exports, "Direction", {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: function () { return direction.Direction; }
|
|
284
|
+
});
|
|
285
|
+
Object.defineProperty(exports, "ControlType", {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function () { return control.ControlType; }
|
|
288
|
+
});
|
|
289
|
+
Object.defineProperty(exports, "Priority", {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
get: function () { return control.Priority; }
|
|
292
|
+
});
|
|
293
|
+
Object.defineProperty(exports, "Size", {
|
|
294
|
+
enumerable: true,
|
|
295
|
+
get: function () { return size.Size; }
|
|
296
|
+
});
|
|
297
|
+
Object.defineProperty(exports, "Typography", {
|
|
298
|
+
enumerable: true,
|
|
299
|
+
get: function () { return typography.Typography; }
|
|
300
|
+
});
|
|
301
|
+
Object.defineProperty(exports, "Width", {
|
|
302
|
+
enumerable: true,
|
|
303
|
+
get: function () { return width.Width; }
|
|
304
|
+
});
|
|
305
|
+
Object.defineProperty(exports, "Type", {
|
|
306
|
+
enumerable: true,
|
|
307
|
+
get: function () { return type.Type; }
|
|
308
|
+
});
|
|
309
|
+
Object.defineProperty(exports, "DateMode", {
|
|
310
|
+
enumerable: true,
|
|
311
|
+
get: function () { return dateMode.DateMode; }
|
|
312
|
+
});
|
|
313
|
+
Object.defineProperty(exports, "MonthFormat", {
|
|
314
|
+
enumerable: true,
|
|
315
|
+
get: function () { return monthFormat.MonthFormat; }
|
|
316
|
+
});
|
|
317
|
+
Object.defineProperty(exports, "Position", {
|
|
318
|
+
enumerable: true,
|
|
319
|
+
get: function () { return position.Position; }
|
|
320
|
+
});
|
|
321
|
+
Object.defineProperty(exports, "Layout", {
|
|
322
|
+
enumerable: true,
|
|
323
|
+
get: function () { return layouts.Layout; }
|
|
324
|
+
});
|
|
325
|
+
Object.defineProperty(exports, "Status", {
|
|
326
|
+
enumerable: true,
|
|
327
|
+
get: function () { return status.Status; }
|
|
328
|
+
});
|
|
329
|
+
Object.defineProperty(exports, "Sentiment", {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
get: function () { return sentiment.Sentiment; }
|
|
332
|
+
});
|
|
333
|
+
Object.defineProperty(exports, "ProfileType", {
|
|
334
|
+
enumerable: true,
|
|
335
|
+
get: function () { return profileType.ProfileType; }
|
|
336
|
+
});
|
|
337
|
+
Object.defineProperty(exports, "Variant", {
|
|
338
|
+
enumerable: true,
|
|
339
|
+
get: function () { return variant.Variant; }
|
|
340
|
+
});
|
|
341
|
+
Object.defineProperty(exports, "Scroll", {
|
|
342
|
+
enumerable: true,
|
|
343
|
+
get: function () { return scroll.Scroll; }
|
|
344
|
+
});
|
|
345
|
+
Object.defineProperty(exports, "MarkdownNodeType", {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
get: function () { return markdownNodeType.MarkdownNodeType; }
|
|
348
|
+
});
|
|
349
|
+
Object.defineProperty(exports, "FileType", {
|
|
350
|
+
enumerable: true,
|
|
351
|
+
get: function () { return fileType.FileType; }
|
|
352
|
+
});
|
|
353
|
+
exports.DEFAULT_LANG = index.DEFAULT_LANG;
|
|
354
|
+
exports.DEFAULT_LOCALE = index.DEFAULT_LOCALE;
|
|
355
|
+
exports.RTL_LANGUAGES = index.RTL_LANGUAGES;
|
|
356
|
+
exports.SUPPORTED_LANGUAGES = index.SUPPORTED_LANGUAGES;
|
|
357
|
+
exports.adjustLocale = index.adjustLocale;
|
|
358
|
+
exports.getCountryFromLocale = index.getCountryFromLocale;
|
|
359
|
+
exports.getDirectionFromLocale = index.getDirectionFromLocale;
|
|
360
|
+
exports.getLangFromLocale = index.getLangFromLocale;
|
|
361
|
+
exports.getInitials = initials.getInitials;
|
|
362
|
+
exports.getBrandColorFromSeed = colors.getBrandColorFromSeed;
|
|
363
363
|
exports.translations = index$1;
|
|
364
364
|
exports.withId = withId;
|
|
365
365
|
//# sourceMappingURL=index.js.map
|
package/build/index.mjs
CHANGED
|
@@ -17,30 +17,6 @@ export { Breakpoint } from './common/propsValues/breakpoint.mjs';
|
|
|
17
17
|
import 'react/jsx-runtime';
|
|
18
18
|
export { default as Image } from './image/Image.mjs';
|
|
19
19
|
import '@transferwise/icons';
|
|
20
|
-
export { isBrowser, isServerSide } from './common/domHelpers/documentIosClick.mjs';
|
|
21
|
-
export { Theme } from './common/theme.mjs';
|
|
22
|
-
export { Direction } from './common/direction.mjs';
|
|
23
|
-
export { ControlType, Priority } from './common/propsValues/control.mjs';
|
|
24
|
-
export { Size } from './common/propsValues/size.mjs';
|
|
25
|
-
export { Typography } from './common/propsValues/typography.mjs';
|
|
26
|
-
export { Width } from './common/propsValues/width.mjs';
|
|
27
|
-
export { Type } from './common/propsValues/type.mjs';
|
|
28
|
-
export { DateMode } from './common/propsValues/dateMode.mjs';
|
|
29
|
-
export { MonthFormat } from './common/propsValues/monthFormat.mjs';
|
|
30
|
-
export { Position } from './common/propsValues/position.mjs';
|
|
31
|
-
export { Layout } from './common/propsValues/layouts.mjs';
|
|
32
|
-
export { Status } from './common/propsValues/status.mjs';
|
|
33
|
-
export { Sentiment } from './common/propsValues/sentiment.mjs';
|
|
34
|
-
export { ProfileType } from './common/propsValues/profileType.mjs';
|
|
35
|
-
export { Variant } from './common/propsValues/variant.mjs';
|
|
36
|
-
export { Scroll } from './common/propsValues/scroll.mjs';
|
|
37
|
-
export { MarkdownNodeType } from './common/propsValues/markdownNodeType.mjs';
|
|
38
|
-
export { FileType } from './common/fileType.mjs';
|
|
39
|
-
export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale } from './common/locale/index.mjs';
|
|
40
|
-
export { getInitials } from './common/initials.mjs';
|
|
41
|
-
export { getBrandColorFromSeed } from './common/colors.mjs';
|
|
42
|
-
import 'react-intl';
|
|
43
|
-
import './common/closeButton/CloseButton.messages.mjs';
|
|
44
20
|
export { default as Body } from './body/Body.mjs';
|
|
45
21
|
export { default as Button } from './button/Button.mjs';
|
|
46
22
|
export { default as Carousel } from './carousel/Carousel.mjs';
|
|
@@ -131,6 +107,30 @@ export { useDirection } from './common/hooks/useDirection/useDirection.mjs';
|
|
|
131
107
|
export { useLayout } from './common/hooks/useLayout/useLayout.mjs';
|
|
132
108
|
export { useScreenSize } from './common/hooks/useScreenSize.mjs';
|
|
133
109
|
export { default as useSnackbar } from './snackbar/useSnackbar.mjs';
|
|
110
|
+
export { isBrowser, isServerSide } from './common/domHelpers/documentIosClick.mjs';
|
|
111
|
+
export { Theme } from './common/theme.mjs';
|
|
112
|
+
export { Direction } from './common/direction.mjs';
|
|
113
|
+
export { ControlType, Priority } from './common/propsValues/control.mjs';
|
|
114
|
+
export { Size } from './common/propsValues/size.mjs';
|
|
115
|
+
export { Typography } from './common/propsValues/typography.mjs';
|
|
116
|
+
export { Width } from './common/propsValues/width.mjs';
|
|
117
|
+
export { Type } from './common/propsValues/type.mjs';
|
|
118
|
+
export { DateMode } from './common/propsValues/dateMode.mjs';
|
|
119
|
+
export { MonthFormat } from './common/propsValues/monthFormat.mjs';
|
|
120
|
+
export { Position } from './common/propsValues/position.mjs';
|
|
121
|
+
export { Layout } from './common/propsValues/layouts.mjs';
|
|
122
|
+
export { Status } from './common/propsValues/status.mjs';
|
|
123
|
+
export { Sentiment } from './common/propsValues/sentiment.mjs';
|
|
124
|
+
export { ProfileType } from './common/propsValues/profileType.mjs';
|
|
125
|
+
export { Variant } from './common/propsValues/variant.mjs';
|
|
126
|
+
export { Scroll } from './common/propsValues/scroll.mjs';
|
|
127
|
+
export { MarkdownNodeType } from './common/propsValues/markdownNodeType.mjs';
|
|
128
|
+
export { FileType } from './common/fileType.mjs';
|
|
129
|
+
export { DEFAULT_LANG, DEFAULT_LOCALE, RTL_LANGUAGES, SUPPORTED_LANGUAGES, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale } from './common/locale/index.mjs';
|
|
130
|
+
export { getInitials } from './common/initials.mjs';
|
|
131
|
+
export { getBrandColorFromSeed } from './common/colors.mjs';
|
|
132
|
+
import 'react-intl';
|
|
133
|
+
import './common/closeButton/CloseButton.messages.mjs';
|
|
134
134
|
export { default as translations } from './i18n/index.mjs';
|
|
135
135
|
export { default as withId } from './withId/withId.mjs';
|
|
136
136
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { BadgeAssetsProps } from '../badge';
|
|
1
|
+
import { BadgeProps, BadgeAssetsProps } from '../badge';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { ProfileTypeBusiness, ProfileTypePersonal } from '../common';
|
|
4
|
+
export type AvatarViewBadgeProps = BadgeAssetsProps & Pick<BadgeProps, 'aria-label'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Custom badge content
|
|
7
|
+
*/
|
|
8
|
+
asset?: React.ReactNode;
|
|
9
|
+
};
|
|
3
10
|
export type Props = {
|
|
4
11
|
imgSrc?: string | null;
|
|
5
12
|
/**
|
|
6
13
|
* Entity name (person (profile or recipient) or business name), it will be boilded down to 1 or 2 chars (initials)
|
|
7
14
|
*/
|
|
8
15
|
name?: string | null;
|
|
9
|
-
type?:
|
|
16
|
+
type?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
10
17
|
size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
11
18
|
notification?: boolean;
|
|
12
|
-
badge?:
|
|
19
|
+
badge?: AvatarViewBadgeProps;
|
|
13
20
|
interactive?: boolean;
|
|
14
21
|
selected?: boolean;
|
|
15
22
|
style?: Pick<React.CSSProperties, 'border' | 'backgroundColor' | 'color'>;
|
|
16
|
-
} & Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-
|
|
23
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'>;
|
|
17
24
|
declare function AvatarView({ children, size, selected, notification, badge, interactive, className, style, imgSrc, type, name, ...restProps }: Props): import("react").JSX.Element;
|
|
18
25
|
export default AvatarView;
|
|
19
26
|
//# sourceMappingURL=AvatarView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarView.d.ts","sourceRoot":"","sources":["../../../src/avatarView/AvatarView.tsx"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"AvatarView.d.ts","sourceRoot":"","sources":["../../../src/avatarView/AvatarView.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAe,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5E,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEpE,OAAO,EAA4B,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAM/F,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GACjD,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,CAAC;AAEJ,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC;CAC3E,GAAG,IAAI,CACN,cAAc,CAAC,cAAc,CAAC,EAC9B,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,GAAG,aAAa,CACrF,CAAC;AAEF,iBAAS,UAAU,CAAC,EAClB,QAAoB,EACpB,IAAS,EACT,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,WAAmB,EACnB,SAAS,EACT,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,GAAG,SAAS,EACb,EAAE,KAAK,+BA6BP;AAgFD,eAAe,UAAU,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SizeSmall, SizeMedium, SizeLarge, ThemeDark, ThemeLight, CommonProps } from '../common';
|
|
3
|
+
import { BadgeAssetsProps } from '.';
|
|
3
4
|
/**
|
|
4
|
-
* @deprecated Use `
|
|
5
|
+
* @deprecated Use `16` or `24` instead.
|
|
5
6
|
*/
|
|
6
|
-
type DeprecatedSizes = SizeMedium;
|
|
7
|
+
type DeprecatedSizes = SizeSmall | SizeMedium | SizeLarge;
|
|
7
8
|
export type BadgeProps = {
|
|
8
9
|
badge: ReactNode;
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
/**
|
|
11
12
|
* `md` is deprecated, it will fallback to `sm` instead.
|
|
12
13
|
*/
|
|
13
|
-
size?:
|
|
14
|
+
size?: DeprecatedSizes | BadgeAssetsProps['size'];
|
|
14
15
|
border?: ThemeDark | ThemeLight;
|
|
15
16
|
'aria-label'?: string;
|
|
16
17
|
style?: React.CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAGL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAGL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAC;AAErC;;GAEG;AACH,KAAK,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,GAAG,WAAW,CAAC;AAWhB;;GAEG;AACH,QAAA,MAAM,KAAK,4FAQR,UAAU,gCAiBZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { StatusIconProps } from '../statusIcon';
|
|
2
|
-
import type { BadgeProps } from './Badge';
|
|
3
2
|
export type Props = {
|
|
4
3
|
status?: StatusIconProps['sentiment'];
|
|
5
4
|
flagCode?: string;
|
|
6
5
|
imgSrc?: string;
|
|
7
6
|
icon?: React.ReactNode;
|
|
8
7
|
type?: 'action' | 'reference';
|
|
9
|
-
size?:
|
|
8
|
+
size?: 16 | 24;
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* Common pre-built badge variants.
|
|
13
12
|
*/
|
|
14
|
-
export default function BadgeAssets({ status, flagCode, imgSrc, icon, type, size
|
|
13
|
+
export default function BadgeAssets({ status, flagCode, imgSrc, icon, type, size, }: Props): import("react").JSX.Element | null;
|
|
15
14
|
//# sourceMappingURL=BadgeAssets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeAssets.d.ts","sourceRoot":"","sources":["../../../src/badge/BadgeAssets.tsx"],"names":[],"mappings":"AAAA,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"BadgeAssets.d.ts","sourceRoot":"","sources":["../../../src/badge/BadgeAssets.tsx"],"names":[],"mappings":"AAAA,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAM5D,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAW,EACX,IAAe,EACf,IAAI,GACL,EAAE,KAAK,sCAmCP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-6a7bc4f",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"rollup-preserve-directives": "^1.1.1",
|
|
93
93
|
"storybook": "^8.2.2",
|
|
94
94
|
"@transferwise/less-config": "3.1.0",
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
95
|
+
"@wise/components-theming": "1.6.1",
|
|
96
|
+
"@transferwise/neptune-css": "14.20.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3.13.1",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Freeze,
|
|
8
8
|
Graph,
|
|
9
9
|
Money,
|
|
10
|
+
Leaf,
|
|
10
11
|
Plane,
|
|
11
12
|
PlusCircle,
|
|
12
13
|
QrCode,
|
|
@@ -97,6 +98,40 @@ export const Notification: Story = {
|
|
|
97
98
|
),
|
|
98
99
|
};
|
|
99
100
|
|
|
101
|
+
export const Test: Story = {
|
|
102
|
+
// tags: ['autodocs'],
|
|
103
|
+
render: () => (
|
|
104
|
+
<div>
|
|
105
|
+
<AvatarView
|
|
106
|
+
imgSrc="../avatar-square-dude.webp"
|
|
107
|
+
size={72}
|
|
108
|
+
badge={{
|
|
109
|
+
flagCode: 'EU',
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
{/* <AvatarView
|
|
113
|
+
imgSrc="../avatar-square-dude.webp"
|
|
114
|
+
size={72}
|
|
115
|
+
badge={{
|
|
116
|
+
asset: (
|
|
117
|
+
<div
|
|
118
|
+
className="d-flex align-items-center justify-content-center"
|
|
119
|
+
style={{
|
|
120
|
+
backgroundColor: 'var(--color-bright-pink)',
|
|
121
|
+
color: 'var(--color-interactive-primary)',
|
|
122
|
+
width: '100%',
|
|
123
|
+
height: '100%',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<Leaf />
|
|
127
|
+
</div>
|
|
128
|
+
),
|
|
129
|
+
}}
|
|
130
|
+
/> */}
|
|
131
|
+
</div>
|
|
132
|
+
),
|
|
133
|
+
};
|
|
134
|
+
|
|
100
135
|
export const Badge: Story = {
|
|
101
136
|
tags: ['autodocs'],
|
|
102
137
|
render: () => {
|
|
@@ -211,6 +246,28 @@ export const Badge: Story = {
|
|
|
211
246
|
badge={{ icon: <Convert /> }}
|
|
212
247
|
/>
|
|
213
248
|
))}
|
|
249
|
+
{sizes.map((size) => (
|
|
250
|
+
<AvatarView
|
|
251
|
+
key={size}
|
|
252
|
+
size={size}
|
|
253
|
+
imgSrc="../avatar-square-dude.webp"
|
|
254
|
+
badge={{
|
|
255
|
+
asset: (
|
|
256
|
+
<div
|
|
257
|
+
className="d-flex align-items-center justify-content-center"
|
|
258
|
+
style={{
|
|
259
|
+
backgroundColor: 'var(--color-bright-pink)',
|
|
260
|
+
color: 'var(--color-interactive-primary)',
|
|
261
|
+
width: '100%',
|
|
262
|
+
height: '100%',
|
|
263
|
+
}}
|
|
264
|
+
>
|
|
265
|
+
<Leaf />
|
|
266
|
+
</div>
|
|
267
|
+
),
|
|
268
|
+
}}
|
|
269
|
+
/>
|
|
270
|
+
))}
|
|
214
271
|
</div>
|
|
215
272
|
);
|
|
216
273
|
},
|
|
@@ -4,28 +4,36 @@ import Circle from '../common/circle';
|
|
|
4
4
|
import Image from '../image';
|
|
5
5
|
import { HTMLAttributes, PropsWithChildren, useState } from 'react';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
|
-
import { getInitials,
|
|
7
|
+
import { getInitials, ProfileType, ProfileTypeBusiness, ProfileTypePersonal } from '../common';
|
|
8
8
|
import {
|
|
9
9
|
Briefcase as BusinessProfileIcon,
|
|
10
10
|
Profile as PersonalProfileIcon,
|
|
11
11
|
} from '@transferwise/icons';
|
|
12
12
|
|
|
13
|
+
export type AvatarViewBadgeProps = BadgeAssetsProps &
|
|
14
|
+
Pick<BadgeProps, 'aria-label'> & {
|
|
15
|
+
/**
|
|
16
|
+
* Custom badge content
|
|
17
|
+
*/
|
|
18
|
+
asset?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
13
21
|
export type Props = {
|
|
14
22
|
imgSrc?: string | null;
|
|
15
23
|
/**
|
|
16
24
|
* Entity name (person (profile or recipient) or business name), it will be boilded down to 1 or 2 chars (initials)
|
|
17
25
|
*/
|
|
18
26
|
name?: string | null;
|
|
19
|
-
type?:
|
|
27
|
+
type?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
20
28
|
size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
21
29
|
notification?: boolean;
|
|
22
|
-
badge?:
|
|
30
|
+
badge?: AvatarViewBadgeProps;
|
|
23
31
|
interactive?: boolean;
|
|
24
32
|
selected?: boolean;
|
|
25
33
|
style?: Pick<React.CSSProperties, 'border' | 'backgroundColor' | 'color'>;
|
|
26
34
|
} & Pick<
|
|
27
35
|
HTMLAttributes<HTMLDivElement>,
|
|
28
|
-
'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-
|
|
36
|
+
'className' | 'children' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'
|
|
29
37
|
>;
|
|
30
38
|
|
|
31
39
|
function AvatarView({
|
|
@@ -65,7 +73,7 @@ function AvatarView({
|
|
|
65
73
|
...style,
|
|
66
74
|
}}
|
|
67
75
|
>
|
|
68
|
-
{children === undefined ? <
|
|
76
|
+
{children === undefined ? <AvatarViewContent {...{ imgSrc, type, name }} /> : children}
|
|
69
77
|
</Circle>
|
|
70
78
|
</Badges>
|
|
71
79
|
</Circle>
|
|
@@ -74,14 +82,14 @@ function AvatarView({
|
|
|
74
82
|
|
|
75
83
|
/** Size of badge depends on size of avatar */
|
|
76
84
|
const MAP_BADGE_ASSET_SIZE = {
|
|
77
|
-
16:
|
|
78
|
-
24:
|
|
79
|
-
32:
|
|
80
|
-
40:
|
|
81
|
-
48:
|
|
82
|
-
56:
|
|
83
|
-
72:
|
|
84
|
-
}
|
|
85
|
+
16: 16,
|
|
86
|
+
24: 16,
|
|
87
|
+
32: 16,
|
|
88
|
+
40: 16,
|
|
89
|
+
48: 16,
|
|
90
|
+
56: 24,
|
|
91
|
+
72: 24,
|
|
92
|
+
} satisfies Record<number, BadgeAssetsProps['size']>;
|
|
85
93
|
|
|
86
94
|
/** Certain sizes of AvatarView has a custom offset of Badge */
|
|
87
95
|
const MAP_BADGE_POSITION = {
|
|
@@ -89,7 +97,7 @@ const MAP_BADGE_POSITION = {
|
|
|
89
97
|
32: -4,
|
|
90
98
|
};
|
|
91
99
|
|
|
92
|
-
type BadgesProps =
|
|
100
|
+
type BadgesProps = AvatarViewBadgeProps &
|
|
93
101
|
PropsWithChildren<{
|
|
94
102
|
avatar: Pick<Props, 'selected' | 'size' | 'notification'>;
|
|
95
103
|
}>;
|
|
@@ -97,15 +105,30 @@ type BadgesProps = BadgeAssetsProps &
|
|
|
97
105
|
/**
|
|
98
106
|
* Adds build-in badges to AvatarView
|
|
99
107
|
*/
|
|
100
|
-
function Badges({
|
|
108
|
+
function Badges({
|
|
109
|
+
children,
|
|
110
|
+
avatar,
|
|
111
|
+
'aria-label': ariaLabel,
|
|
112
|
+
asset: customBadge,
|
|
113
|
+
...badgeAssets
|
|
114
|
+
}: BadgesProps) {
|
|
101
115
|
const { size = 48, selected, notification } = avatar;
|
|
102
|
-
const
|
|
103
|
-
if ((
|
|
104
|
-
const badgeSize:
|
|
116
|
+
const anyBadge = Object.values({ customBadge, ...badgeAssets }).filter(Boolean).length > 0;
|
|
117
|
+
if ((anyBadge || selected) && size > 16) {
|
|
118
|
+
const badgeSize: BadgeAssetsProps['size'] = MAP_BADGE_ASSET_SIZE[size];
|
|
105
119
|
return (
|
|
106
120
|
<Badge
|
|
121
|
+
aria-label={ariaLabel}
|
|
107
122
|
size={badgeSize}
|
|
108
|
-
badge={
|
|
123
|
+
badge={
|
|
124
|
+
customBadge ? (
|
|
125
|
+
<Circle fixedSize size={badgeSize}>
|
|
126
|
+
{customBadge}
|
|
127
|
+
</Circle>
|
|
128
|
+
) : (
|
|
129
|
+
<BadgeAssets {...(selected ? { status: 'positive' } : badgeAssets)} size={badgeSize} />
|
|
130
|
+
)
|
|
131
|
+
}
|
|
109
132
|
style={{
|
|
110
133
|
// @ts-expect-error CSS custom props allowed
|
|
111
134
|
'--badge-content-position': `${MAP_BADGE_POSITION[size] ?? 0}px`,
|
|
@@ -121,16 +144,13 @@ function Badges({ children, avatar, ...badge }: BadgesProps) {
|
|
|
121
144
|
return children;
|
|
122
145
|
}
|
|
123
146
|
|
|
124
|
-
|
|
125
|
-
* Common logic for entities (personal & business profiles or recipients)
|
|
126
|
-
*/
|
|
127
|
-
function Profile({ imgSrc, name, type }: Pick<Props, 'imgSrc' | 'name' | 'type'>) {
|
|
147
|
+
function AvatarViewContent({ imgSrc, name, type }: Pick<Props, 'imgSrc' | 'name' | 'type'>) {
|
|
128
148
|
const [tryLoadImage, setTryLoadImage] = useState(true);
|
|
129
149
|
if (imgSrc && tryLoadImage) {
|
|
130
150
|
return <Image src={imgSrc} alt="" onError={() => setTryLoadImage(false)} />;
|
|
131
151
|
}
|
|
132
152
|
if (type) {
|
|
133
|
-
return type
|
|
153
|
+
return type === ProfileType.BUSINESS ? <BusinessProfileIcon /> : <PersonalProfileIcon />;
|
|
134
154
|
}
|
|
135
155
|
if (name) {
|
|
136
156
|
return getInitials(name);
|