@transferwise/components 0.0.0-experimental-e5e0684 → 0.0.0-experimental-37d8e2c
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/avatar/Avatar.js +4 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +4 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatar/colors/colors.js +1 -1
- package/build/avatar/colors/colors.js.map +1 -1
- package/build/avatar/colors/colors.mjs +1 -1
- package/build/avatar/colors/colors.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +207 -0
- package/build/avatarView/AvatarView.js.map +1 -0
- package/build/avatarView/AvatarView.mjs +205 -0
- package/build/avatarView/AvatarView.mjs.map +1 -0
- package/build/avatarWrapper/AvatarWrapper.js +6 -9
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +5 -8
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +6 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +6 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +4 -7
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +4 -7
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +24 -1
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +24 -1
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/common/initials.js +12 -0
- package/build/common/initials.js.map +1 -0
- package/build/common/initials.mjs +10 -0
- package/build/common/initials.mjs.map +1 -0
- package/build/common/notificationDot/NotificationDot.js +16 -0
- package/build/common/notificationDot/NotificationDot.js.map +1 -0
- package/build/common/notificationDot/NotificationDot.mjs +14 -0
- package/build/common/notificationDot/NotificationDot.mjs.map +1 -0
- package/build/display/Display.js +1 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +1 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +3 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +82 -41
- package/build/statusIcon/StatusIcon.js +4 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatarGroup/AvatarGroup.css +28 -0
- package/build/styles/avatarView/AvatarView.css +22 -0
- package/build/styles/badge/Badge.css +5 -5
- package/build/styles/circularButton/CircularButton.css +0 -24
- package/build/styles/common/circle/Circle.css +17 -0
- package/build/styles/common/notificationDot/NotificationDot.css +10 -0
- package/build/styles/main.css +82 -41
- package/build/styles/statusIcon/StatusIcon.css +0 -12
- package/build/typeahead/util/highlight.js +14 -2
- package/build/typeahead/util/highlight.js.map +1 -1
- package/build/typeahead/util/highlight.mjs +15 -3
- package/build/typeahead/util/highlight.mjs.map +1 -1
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/colors/colors.d.ts +1 -1
- package/build/types/avatar/colors/colors.d.ts.map +1 -1
- package/build/types/avatarGroup/AvatarGroup.d.ts +19 -0
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/build/types/avatarGroup/index.d.ts +3 -0
- package/build/types/avatarGroup/index.d.ts.map +1 -0
- package/build/types/avatarView/AvatarView.d.ts +25 -0
- package/build/types/avatarView/AvatarView.d.ts.map +1 -0
- package/build/types/avatarView/index.d.ts +3 -0
- package/build/types/avatarView/index.d.ts.map +1 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -0
- package/build/types/common/initials.d.ts +2 -0
- package/build/types/common/initials.d.ts.map +1 -0
- package/build/types/common/notificationDot/NotificationDot.d.ts +8 -0
- package/build/types/common/notificationDot/NotificationDot.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/typeahead/util/highlight.d.ts +1 -1
- package/build/types/typeahead/util/highlight.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +0 -9
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +1 -3
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItemLink.d.ts.map +1 -1
- package/build/uploadInput/UploadInput.js +51 -57
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +51 -57
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +3 -8
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +3 -8
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +0 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs +0 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.tsx +4 -1
- package/src/avatar/colors/colors.ts +4 -4
- package/src/avatarGroup/AvatarGroup.css +28 -0
- package/src/avatarGroup/AvatarGroup.less +32 -0
- package/src/avatarGroup/AvatarGroup.story.tsx +249 -0
- package/src/avatarGroup/AvatarGroup.tsx +78 -0
- package/src/avatarGroup/index.ts +2 -0
- package/src/avatarView/AvatarView.css +22 -0
- package/src/avatarView/AvatarView.less +24 -0
- package/src/avatarView/AvatarView.story.tsx +425 -0
- package/src/avatarView/AvatarView.tsx +217 -0
- package/src/avatarView/index.ts +2 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +12 -16
- package/src/badge/Badge.css +5 -5
- package/src/badge/Badge.less +3 -3
- package/src/badge/Badge.tsx +10 -1
- package/src/circularButton/CircularButton.css +0 -24
- package/src/circularButton/CircularButton.less +15 -15
- package/src/circularButton/CircularButton.tsx +4 -5
- package/src/common/circle/Circle.css +17 -0
- package/src/common/circle/Circle.less +22 -0
- package/src/common/circle/Circle.tsx +33 -2
- package/src/common/index.js +1 -0
- package/src/common/initials.ts +13 -0
- package/src/common/notificationDot/NotificationDot.css +10 -0
- package/src/common/notificationDot/NotificationDot.less +7 -0
- package/src/common/notificationDot/NotificationDot.tsx +10 -0
- package/src/display/Display.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/main.css +82 -41
- package/src/main.less +3 -0
- package/src/statusIcon/StatusIcon.css +0 -12
- package/src/statusIcon/StatusIcon.less +6 -6
- package/src/statusIcon/StatusIcon.story.tsx +32 -28
- package/src/statusIcon/StatusIcon.tsx +18 -4
- package/src/test-utils/avatar-img.webp +0 -0
- package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +7 -5
- package/src/typeahead/util/highlight.tsx +7 -2
- package/src/uploadInput/UploadInput.spec.tsx +6 -150
- package/src/uploadInput/UploadInput.tsx +60 -81
- package/src/uploadInput/uploadItem/UploadItem.tsx +6 -12
- package/src/uploadInput/uploadItem/UploadItemLink.tsx +1 -9
|
@@ -4,8 +4,9 @@ import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
|
|
6
6
|
import Body from '../../body';
|
|
7
|
-
import { Size, Status, Typography } from '../../common';
|
|
7
|
+
import { Size, Status, Typography, Sentiment } from '../../common';
|
|
8
8
|
import ProcessIndicator from '../../processIndicator/ProcessIndicator';
|
|
9
|
+
import StatusIcon from '../../statusIcon/StatusIcon';
|
|
9
10
|
import { UploadedFile, UploadError } from '../types';
|
|
10
11
|
|
|
11
12
|
import MESSAGES from './UploadItem.messages';
|
|
@@ -37,8 +38,6 @@ interface UploadItemRef {
|
|
|
37
38
|
export enum TEST_IDS {
|
|
38
39
|
uploadItem = 'uploadItem',
|
|
39
40
|
mediaBody = 'mediaBody',
|
|
40
|
-
link = 'link',
|
|
41
|
-
action = 'action',
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
const UploadItem = forwardRef<UploadItemRef, UploadItemProps>(
|
|
@@ -47,7 +46,6 @@ const UploadItem = forwardRef<UploadItemRef, UploadItemProps>(
|
|
|
47
46
|
const { status, filename, error, errors, url } = file;
|
|
48
47
|
const linkRef = useRef<HTMLAnchorElement>(null);
|
|
49
48
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
50
|
-
const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;
|
|
51
49
|
|
|
52
50
|
useImperativeHandle<UploadItemRef, UploadItemRef>(ref, () => ({
|
|
53
51
|
focus: (): void => {
|
|
@@ -59,6 +57,8 @@ const UploadItem = forwardRef<UploadItemRef, UploadItemProps>(
|
|
|
59
57
|
},
|
|
60
58
|
}));
|
|
61
59
|
|
|
60
|
+
const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;
|
|
61
|
+
|
|
62
62
|
/**
|
|
63
63
|
* We're temporarily reverting to the regular icon components,
|
|
64
64
|
* until the StatusIcon receives 24px sizing. Some misalignment
|
|
@@ -152,20 +152,16 @@ const UploadItem = forwardRef<UploadItemRef, UploadItemProps>(
|
|
|
152
152
|
return (
|
|
153
153
|
<div
|
|
154
154
|
className={clsx('np-upload-input__item', { 'is-interactive': isSucceeded && url })}
|
|
155
|
-
data-testid={
|
|
155
|
+
data-testid={TEST_IDS.uploadItem}
|
|
156
156
|
>
|
|
157
157
|
<UploadItemLink
|
|
158
158
|
ref={linkRef}
|
|
159
159
|
url={isSucceeded ? url : undefined}
|
|
160
160
|
singleFileUpload={singleFileUpload}
|
|
161
|
-
data-testid={`${file.id}-${TEST_IDS.link}`}
|
|
162
161
|
onDownload={onDownloadFile}
|
|
163
162
|
>
|
|
164
163
|
<span className="np-upload-input__icon">{getIcon()}</span>
|
|
165
|
-
<div
|
|
166
|
-
className="np-upload-input__item-content"
|
|
167
|
-
data-testid={`${file.id}-${TEST_IDS.mediaBody}`}
|
|
168
|
-
>
|
|
164
|
+
<div className="np-upload-input__item-content" data-testid={TEST_IDS.mediaBody}>
|
|
169
165
|
<Body type={Typography.BODY_LARGE} className="np-upload-input__title text-word-break">
|
|
170
166
|
{getTitle()}
|
|
171
167
|
</Body>
|
|
@@ -179,8 +175,6 @@ const UploadItem = forwardRef<UploadItemRef, UploadItemProps>(
|
|
|
179
175
|
aria-label={formatMessage(MESSAGES.removeFile, { filename })}
|
|
180
176
|
className="np-upload-input__item-button"
|
|
181
177
|
type="button"
|
|
182
|
-
tabIndex={0}
|
|
183
|
-
data-testid={`${file.id}-${TEST_IDS.action}`}
|
|
184
178
|
onClick={() => onDelete()}
|
|
185
179
|
>
|
|
186
180
|
<Bin size={16} />
|
|
@@ -10,14 +10,7 @@ type UploadItemLinkProps = PropsWithChildren<{
|
|
|
10
10
|
export const UploadItemLink = forwardRef<HTMLAnchorElement | HTMLDivElement, UploadItemLinkProps>(
|
|
11
11
|
({ children, url, onDownload, singleFileUpload }, ref) => {
|
|
12
12
|
if (!url) {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
ref={ref as React.RefObject<HTMLDivElement>}
|
|
16
|
-
className={clsx('np-upload-input__item-container')}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
13
|
+
return <div ref={ref as React.RefObject<HTMLDivElement>} className={clsx('np-upload-input__item-container')}>{children}</div>;
|
|
21
14
|
}
|
|
22
15
|
|
|
23
16
|
return (
|
|
@@ -30,7 +23,6 @@ export const UploadItemLink = forwardRef<HTMLAnchorElement | HTMLDivElement, Upl
|
|
|
30
23
|
'np-upload-input__item-link',
|
|
31
24
|
singleFileUpload ? 'np-upload-input__item-link--single-file' : '',
|
|
32
25
|
)}
|
|
33
|
-
tabIndex={0}
|
|
34
26
|
onClick={onDownload}
|
|
35
27
|
>
|
|
36
28
|
{children}
|