@transferwise/components 0.0.0-experimental-75b7b1e → 0.0.0-experimental-c5ba52c
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 +3 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +3 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +16 -4
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +16 -4
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +2 -0
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +2 -0
- package/build/badge/Badge.mjs.map +1 -1
- package/build/main.css +28 -20
- package/build/styles/main.css +28 -20
- package/build/styles/uploadInput/uploadButton/UploadButton.css +5 -0
- package/build/styles/uploadInput/uploadItem/UploadItem.css +23 -20
- package/build/types/avatar/Avatar.d.ts +1 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +2 -1
- 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/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/{UploadItemBody.d.ts → UploadItemLink.d.ts} +2 -2
- package/build/types/uploadInput/uploadItem/UploadItemLink.d.ts.map +1 -0
- package/build/uploadInput/uploadItem/UploadItem.js +14 -11
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +15 -12
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +32 -0
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -0
- package/build/uploadInput/uploadItem/{UploadItemBody.mjs → UploadItemLink.mjs} +5 -4
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -0
- package/package.json +4 -4
- package/src/avatar/Avatar.spec.tsx +10 -0
- package/src/avatar/Avatar.tsx +3 -0
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +15 -4
- package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +26 -7
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +0 -64
- package/src/badge/Badge.spec.tsx +8 -0
- package/src/badge/Badge.tsx +3 -1
- package/src/main.css +28 -20
- package/src/uploadInput/uploadButton/UploadButton.css +5 -0
- package/src/uploadInput/uploadButton/UploadButton.less +6 -0
- package/src/uploadInput/uploadItem/UploadItem.css +23 -20
- package/src/uploadInput/uploadItem/UploadItem.less +16 -12
- package/src/uploadInput/uploadItem/UploadItem.tsx +12 -7
- package/src/uploadInput/uploadItem/{UploadItemBody.tsx → UploadItemLink.tsx} +6 -2
- package/build/types/uploadInput/uploadItem/UploadItemBody.d.ts.map +0 -1
- package/build/uploadInput/uploadItem/UploadItemBody.js +0 -27
- package/build/uploadInput/uploadItem/UploadItemBody.js.map +0 -1
- package/build/uploadInput/uploadItem/UploadItemBody.mjs.map +0 -1
|
@@ -8,21 +8,33 @@ import StatusIcon from '../statusIcon/StatusIcon';
|
|
|
8
8
|
|
|
9
9
|
interface OptionalBadgeProps extends Omit<BadgeProps, 'badge'> {
|
|
10
10
|
url?: string;
|
|
11
|
+
ariaLabel?: string;
|
|
11
12
|
altText?: string;
|
|
12
13
|
statusIcon?: Sentiment;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const OptionalBadge = ({
|
|
16
|
+
const OptionalBadge = ({
|
|
17
|
+
url,
|
|
18
|
+
altText,
|
|
19
|
+
statusIcon,
|
|
20
|
+
children,
|
|
21
|
+
ariaLabel,
|
|
22
|
+
...rest
|
|
23
|
+
}: OptionalBadgeProps) => {
|
|
16
24
|
if (url) {
|
|
17
25
|
return (
|
|
18
|
-
<Badge badge={<img src={url} alt={altText} />} {...rest}>
|
|
26
|
+
<Badge aria-label={ariaLabel} badge={<img src={url} alt={altText} />} {...rest}>
|
|
19
27
|
{children}
|
|
20
28
|
</Badge>
|
|
21
29
|
);
|
|
22
30
|
}
|
|
23
31
|
if (statusIcon) {
|
|
24
32
|
return (
|
|
25
|
-
<Badge
|
|
33
|
+
<Badge
|
|
34
|
+
aria-label={ariaLabel}
|
|
35
|
+
badge={<StatusIcon sentiment={statusIcon} size={Size.SMALL} />}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
26
38
|
{children}
|
|
27
39
|
</Badge>
|
|
28
40
|
);
|
|
@@ -32,6 +44,7 @@ const OptionalBadge = ({ url, altText, statusIcon, children, ...rest }: Optional
|
|
|
32
44
|
|
|
33
45
|
export type AvatarWrapperProps = {
|
|
34
46
|
url?: string;
|
|
47
|
+
'aria-label'?: string;
|
|
35
48
|
profileType?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
36
49
|
profileId?: string;
|
|
37
50
|
name?: string;
|
|
@@ -57,6 +70,7 @@ export type AvatarWrapperProps = {
|
|
|
57
70
|
|
|
58
71
|
const AvatarWrapper = ({
|
|
59
72
|
url,
|
|
73
|
+
'aria-label': ariaLabel,
|
|
60
74
|
profileType,
|
|
61
75
|
profileId,
|
|
62
76
|
badgeUrl,
|
|
@@ -73,18 +87,22 @@ const AvatarWrapper = ({
|
|
|
73
87
|
useEffect(() => setImageLoadError(false), [url]);
|
|
74
88
|
|
|
75
89
|
const getAvatarProps = () => {
|
|
90
|
+
let updatedAvatarProps = avatarProps;
|
|
91
|
+
if (!badgeUrl && !badgeStatusIcon && ariaLabel) {
|
|
92
|
+
updatedAvatarProps = { ...updatedAvatarProps, 'aria-label': ariaLabel };
|
|
93
|
+
}
|
|
76
94
|
if (url && !hasImageLoadError) {
|
|
77
95
|
return {
|
|
78
96
|
type: AvatarType.THUMBNAIL,
|
|
79
97
|
children: <img src={url} alt="" onError={() => setImageLoadError(true)} />,
|
|
80
|
-
...
|
|
98
|
+
...updatedAvatarProps,
|
|
81
99
|
};
|
|
82
100
|
}
|
|
83
101
|
if (profileType) {
|
|
84
102
|
return {
|
|
85
103
|
type: AvatarType.ICON,
|
|
86
104
|
children: isBusinessProfile ? <BriefcaseIcon size="24" /> : <ProfileIcon size="24" />,
|
|
87
|
-
...
|
|
105
|
+
...updatedAvatarProps,
|
|
88
106
|
};
|
|
89
107
|
}
|
|
90
108
|
if (name) {
|
|
@@ -92,19 +110,20 @@ const AvatarWrapper = ({
|
|
|
92
110
|
type: AvatarType.INITIALS,
|
|
93
111
|
children: <>{getInitials(name)}</>,
|
|
94
112
|
backgroundColorSeed: profileId?.toString(),
|
|
95
|
-
...
|
|
113
|
+
...updatedAvatarProps,
|
|
96
114
|
};
|
|
97
115
|
}
|
|
98
116
|
return {
|
|
99
117
|
type: AvatarType.ICON,
|
|
100
118
|
children: <ProfileIcon size="24" />,
|
|
101
|
-
...
|
|
119
|
+
...updatedAvatarProps,
|
|
102
120
|
};
|
|
103
121
|
};
|
|
104
122
|
|
|
105
123
|
return (
|
|
106
124
|
<OptionalBadge
|
|
107
125
|
url={badgeUrl}
|
|
126
|
+
ariaLabel={ariaLabel}
|
|
108
127
|
altText={badgeAltText}
|
|
109
128
|
statusIcon={badgeStatusIcon}
|
|
110
129
|
{...badgeProps}
|
|
@@ -73,70 +73,6 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
|
|
|
73
73
|
</div>
|
|
74
74
|
`;
|
|
75
75
|
|
|
76
|
-
exports[`FlowNavigationAvatar with a name AND profileType with a badge status icon passed renders the badge 1`] = `
|
|
77
|
-
<div
|
|
78
|
-
class="tw-badge tw-badge-border-light tw-badge-sm"
|
|
79
|
-
>
|
|
80
|
-
<div
|
|
81
|
-
class="tw-badge__children"
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
class="tw-avatar tw-avatar--48 tw-avatar--icon"
|
|
85
|
-
>
|
|
86
|
-
<div
|
|
87
|
-
class="tw-avatar__content"
|
|
88
|
-
>
|
|
89
|
-
<span
|
|
90
|
-
aria-hidden="true"
|
|
91
|
-
class="tw-icon tw-icon-person "
|
|
92
|
-
data-testid="person-icon"
|
|
93
|
-
role="presentation"
|
|
94
|
-
>
|
|
95
|
-
<svg
|
|
96
|
-
fill="currentColor"
|
|
97
|
-
focusable="false"
|
|
98
|
-
height="24"
|
|
99
|
-
viewBox="0 0 24 24"
|
|
100
|
-
width="24"
|
|
101
|
-
>
|
|
102
|
-
<path
|
|
103
|
-
d="M15.257 14.014A5.922 5.922 0 0 0 18 9c0-3.3-2.7-6-6-6S6 5.7 6 9c0 2.1 1.071 3.943 2.743 5.014-2.614 1.243-4.457 3.9-4.457 6.986H6c0-3.3 2.7-6 6-6s6 2.7 6 6h1.714c0-3.086-1.842-5.743-4.457-6.986ZM7.714 9A4.298 4.298 0 0 1 12 4.714 4.298 4.298 0 0 1 16.286 9 4.298 4.298 0 0 1 12 13.286 4.298 4.298 0 0 1 7.714 9Z"
|
|
104
|
-
/>
|
|
105
|
-
</svg>
|
|
106
|
-
</span>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<div
|
|
111
|
-
class="tw-badge__content"
|
|
112
|
-
>
|
|
113
|
-
<span
|
|
114
|
-
class="status-circle status-circle-sm positive"
|
|
115
|
-
data-testid="status-icon"
|
|
116
|
-
>
|
|
117
|
-
<span
|
|
118
|
-
aria-hidden="true"
|
|
119
|
-
class="tw-icon tw-icon-check status-icon light"
|
|
120
|
-
data-testid="check-icon"
|
|
121
|
-
role="presentation"
|
|
122
|
-
>
|
|
123
|
-
<svg
|
|
124
|
-
fill="currentColor"
|
|
125
|
-
focusable="false"
|
|
126
|
-
height="16"
|
|
127
|
-
viewBox="0 0 24 24"
|
|
128
|
-
width="16"
|
|
129
|
-
>
|
|
130
|
-
<path
|
|
131
|
-
d="M20.143 6.427 9.557 16.97 4.2 11.57 3 12.77l5.957 6a.846.846 0 0 0 .6.257.846.846 0 0 0 .6-.257L21.343 7.627l-1.2-1.2Z"
|
|
132
|
-
/>
|
|
133
|
-
</svg>
|
|
134
|
-
</span>
|
|
135
|
-
</span>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
`;
|
|
139
|
-
|
|
140
76
|
exports[`FlowNavigationAvatar with a name AND profileType with a badge url passed renders the badge 1`] = `
|
|
141
77
|
<div
|
|
142
78
|
class="tw-badge tw-badge-border-light tw-badge-lg"
|
package/src/badge/Badge.spec.tsx
CHANGED
|
@@ -33,4 +33,12 @@ describe('Badge', () => {
|
|
|
33
33
|
|
|
34
34
|
expect(screen.getByText(childText).parentElement).toHaveClass('tw-badge__children');
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
it('adds aria-label to badge if it is passed in', () => {
|
|
38
|
+
const ariaLabel = 'badge-aria-label';
|
|
39
|
+
|
|
40
|
+
renderBadge({ 'aria-label': ariaLabel });
|
|
41
|
+
|
|
42
|
+
expect(screen.getByLabelText(ariaLabel)).toBeInTheDocument();
|
|
43
|
+
});
|
|
36
44
|
});
|
package/src/badge/Badge.tsx
CHANGED
|
@@ -17,6 +17,7 @@ export type BadgeProps = {
|
|
|
17
17
|
children: ReactNode;
|
|
18
18
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
19
19
|
border?: ThemeDark | ThemeLight;
|
|
20
|
+
'aria-label'?: string;
|
|
20
21
|
} & CommonProps;
|
|
21
22
|
|
|
22
23
|
const Badge = ({
|
|
@@ -24,6 +25,7 @@ const Badge = ({
|
|
|
24
25
|
className = undefined,
|
|
25
26
|
size = Size.SMALL,
|
|
26
27
|
border = Theme.LIGHT,
|
|
28
|
+
'aria-label': ariaLabel,
|
|
27
29
|
children,
|
|
28
30
|
}: BadgeProps) => {
|
|
29
31
|
const classes: string = classNames(
|
|
@@ -36,7 +38,7 @@ const Badge = ({
|
|
|
36
38
|
);
|
|
37
39
|
|
|
38
40
|
return (
|
|
39
|
-
<div className={classes}>
|
|
41
|
+
<div aria-label={ariaLabel} className={classes}>
|
|
40
42
|
<div className="tw-badge__children">{children}</div>
|
|
41
43
|
<div className="tw-badge__content">{badge}</div>
|
|
42
44
|
</div>
|
package/src/main.css
CHANGED
|
@@ -5472,6 +5472,11 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5472
5472
|
.np-upload-button .media {
|
|
5473
5473
|
align-items: flex-start;
|
|
5474
5474
|
}
|
|
5475
|
+
@media (max-width: 320px) {
|
|
5476
|
+
.np-upload-icon {
|
|
5477
|
+
padding-left: 0;
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5475
5480
|
.np-upload-input.form-control {
|
|
5476
5481
|
height: auto;
|
|
5477
5482
|
padding: 0;
|
|
@@ -5563,9 +5568,9 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5563
5568
|
border: 1px solid var(--color-interactive-secondary);
|
|
5564
5569
|
position: relative;
|
|
5565
5570
|
}
|
|
5566
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
5567
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
5568
|
-
.np-upload-item.np-upload-
|
|
5571
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
5572
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
|
|
5573
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
5569
5574
|
display: block;
|
|
5570
5575
|
position: absolute;
|
|
5571
5576
|
height: 1px;
|
|
@@ -5577,27 +5582,27 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5577
5582
|
width: calc(100% - 2 * 16px);
|
|
5578
5583
|
width: calc(100% - 2 * var(--size-16));
|
|
5579
5584
|
}
|
|
5580
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
5581
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
5585
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
5586
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
|
|
5582
5587
|
top: 0;
|
|
5583
5588
|
}
|
|
5584
|
-
.np-upload-item.np-upload-
|
|
5589
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
5585
5590
|
bottom: -1px;
|
|
5586
5591
|
}
|
|
5587
5592
|
.np-upload-item:first-child ~ div {
|
|
5588
5593
|
border-top: 1px;
|
|
5589
5594
|
}
|
|
5590
|
-
.np-upload-item:not(:first-child) .np-upload-
|
|
5595
|
+
.np-upload-item:not(:first-child) .np-upload-item__link:hover {
|
|
5591
5596
|
border-top-color: rgba(0,0,0,0.10196);
|
|
5592
5597
|
border-top-color: var(--color-border-neutral);
|
|
5593
5598
|
}
|
|
5594
5599
|
.np-upload-item:not(:last-child) {
|
|
5595
5600
|
border-bottom: 0;
|
|
5596
5601
|
}
|
|
5597
|
-
.np-upload-item.np-upload-
|
|
5598
|
-
.np-upload-item.np-upload-
|
|
5599
|
-
.np-upload-item.np-upload-
|
|
5600
|
-
.np-upload-item.np-upload-
|
|
5602
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
|
|
5603
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
|
|
5604
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
|
|
5605
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
|
|
5601
5606
|
display: none;
|
|
5602
5607
|
}
|
|
5603
5608
|
.np-upload-button-container:hover:before,
|
|
@@ -5612,38 +5617,41 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5612
5617
|
outline-offset: -3px;
|
|
5613
5618
|
}
|
|
5614
5619
|
.np-upload-item--single-file:focus-visible,
|
|
5615
|
-
.np-upload-
|
|
5620
|
+
.np-upload-item__link:focus-visible,
|
|
5616
5621
|
.np-upload-button-container:has(:focus-visible) {
|
|
5617
5622
|
outline-width: 3px;
|
|
5618
5623
|
}
|
|
5619
|
-
.np-upload-
|
|
5624
|
+
.np-upload-item--link a {
|
|
5620
5625
|
flex: 1;
|
|
5621
5626
|
-webkit-text-decoration: none;
|
|
5622
5627
|
text-decoration: none;
|
|
5623
5628
|
border-top: 1px solid transparent;
|
|
5624
5629
|
border-radius: inherit;
|
|
5625
5630
|
}
|
|
5626
|
-
.np-upload-
|
|
5631
|
+
.np-upload-item--link a:focus-visible {
|
|
5627
5632
|
outline-offset: -2px;
|
|
5628
5633
|
}
|
|
5629
|
-
.np-upload-
|
|
5634
|
+
.np-upload-item--link a:hover:before {
|
|
5630
5635
|
display: none !important;
|
|
5631
5636
|
}
|
|
5632
|
-
.np-upload-
|
|
5637
|
+
.np-upload-item--link a:hover:after {
|
|
5633
5638
|
left: 0 !important;
|
|
5634
5639
|
width: 100% !important;
|
|
5635
5640
|
}
|
|
5636
|
-
.np-upload-
|
|
5637
|
-
.np-upload-
|
|
5641
|
+
.np-upload-item--link a:hover,
|
|
5642
|
+
.np-upload-item--link a:active {
|
|
5638
5643
|
-webkit-text-decoration: none;
|
|
5639
5644
|
text-decoration: none;
|
|
5640
5645
|
}
|
|
5641
|
-
.np-upload-
|
|
5642
|
-
.np-upload-
|
|
5646
|
+
.np-upload-item--link a:hover .np-upload-button,
|
|
5647
|
+
.np-upload-item--link a:active .np-upload-button {
|
|
5643
5648
|
background-color: rgba(134,167,189,0.10196);
|
|
5644
5649
|
background-color: var(--color-background-neutral);
|
|
5645
5650
|
border-radius: inherit;
|
|
5646
5651
|
}
|
|
5652
|
+
.np-upload-item--link:first-of-type a {
|
|
5653
|
+
border-top: 0;
|
|
5654
|
+
}
|
|
5647
5655
|
.np-upload-item__body {
|
|
5648
5656
|
display: flex;
|
|
5649
5657
|
align-items: center;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
border: 1px solid var(--color-interactive-secondary);
|
|
4
4
|
position: relative;
|
|
5
5
|
}
|
|
6
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
7
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
8
|
-
.np-upload-item.np-upload-
|
|
6
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
7
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before,
|
|
8
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
9
9
|
display: block;
|
|
10
10
|
position: absolute;
|
|
11
11
|
height: 1px;
|
|
@@ -17,27 +17,27 @@
|
|
|
17
17
|
width: calc(100% - 2 * 16px);
|
|
18
18
|
width: calc(100% - 2 * var(--size-16));
|
|
19
19
|
}
|
|
20
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
21
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
20
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item--link):before,
|
|
21
|
+
.np-upload-item:not(:first-child).np-upload-item--link .np-upload-item__link:before {
|
|
22
22
|
top: 0;
|
|
23
23
|
}
|
|
24
|
-
.np-upload-item.np-upload-
|
|
24
|
+
.np-upload-item.np-upload-item--link:hover .np-upload-item__link:after {
|
|
25
25
|
bottom: -1px;
|
|
26
26
|
}
|
|
27
27
|
.np-upload-item:first-child ~ div {
|
|
28
28
|
border-top: 1px;
|
|
29
29
|
}
|
|
30
|
-
.np-upload-item:not(:first-child) .np-upload-
|
|
30
|
+
.np-upload-item:not(:first-child) .np-upload-item__link:hover {
|
|
31
31
|
border-top-color: rgba(0,0,0,0.10196);
|
|
32
32
|
border-top-color: var(--color-border-neutral);
|
|
33
33
|
}
|
|
34
34
|
.np-upload-item:not(:last-child) {
|
|
35
35
|
border-bottom: 0;
|
|
36
36
|
}
|
|
37
|
-
.np-upload-item.np-upload-
|
|
38
|
-
.np-upload-item.np-upload-
|
|
39
|
-
.np-upload-item.np-upload-
|
|
40
|
-
.np-upload-item.np-upload-
|
|
37
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item:before,
|
|
38
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container:before,
|
|
39
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-item .np-upload-item__link:before,
|
|
40
|
+
.np-upload-item.np-upload-item--link:hover + .np-upload-button-container .np-upload-item__link:before {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
43
|
.np-upload-button-container:hover:before,
|
|
@@ -52,38 +52,41 @@
|
|
|
52
52
|
outline-offset: -3px;
|
|
53
53
|
}
|
|
54
54
|
.np-upload-item--single-file:focus-visible,
|
|
55
|
-
.np-upload-
|
|
55
|
+
.np-upload-item__link:focus-visible,
|
|
56
56
|
.np-upload-button-container:has(:focus-visible) {
|
|
57
57
|
outline-width: 3px;
|
|
58
58
|
}
|
|
59
|
-
.np-upload-
|
|
59
|
+
.np-upload-item--link a {
|
|
60
60
|
flex: 1;
|
|
61
61
|
-webkit-text-decoration: none;
|
|
62
62
|
text-decoration: none;
|
|
63
63
|
border-top: 1px solid transparent;
|
|
64
64
|
border-radius: inherit;
|
|
65
65
|
}
|
|
66
|
-
.np-upload-
|
|
66
|
+
.np-upload-item--link a:focus-visible {
|
|
67
67
|
outline-offset: -2px;
|
|
68
68
|
}
|
|
69
|
-
.np-upload-
|
|
69
|
+
.np-upload-item--link a:hover:before {
|
|
70
70
|
display: none !important;
|
|
71
71
|
}
|
|
72
|
-
.np-upload-
|
|
72
|
+
.np-upload-item--link a:hover:after {
|
|
73
73
|
left: 0 !important;
|
|
74
74
|
width: 100% !important;
|
|
75
75
|
}
|
|
76
|
-
.np-upload-
|
|
77
|
-
.np-upload-
|
|
76
|
+
.np-upload-item--link a:hover,
|
|
77
|
+
.np-upload-item--link a:active {
|
|
78
78
|
-webkit-text-decoration: none;
|
|
79
79
|
text-decoration: none;
|
|
80
80
|
}
|
|
81
|
-
.np-upload-
|
|
82
|
-
.np-upload-
|
|
81
|
+
.np-upload-item--link a:hover .np-upload-button,
|
|
82
|
+
.np-upload-item--link a:active .np-upload-button {
|
|
83
83
|
background-color: rgba(134,167,189,0.10196);
|
|
84
84
|
background-color: var(--color-background-neutral);
|
|
85
85
|
border-radius: inherit;
|
|
86
86
|
}
|
|
87
|
+
.np-upload-item--link:first-of-type a {
|
|
88
|
+
border-top: 0;
|
|
89
|
+
}
|
|
87
90
|
.np-upload-item__body {
|
|
88
91
|
display: flex;
|
|
89
92
|
align-items: center;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
border: 1px solid var(--color-interactive-secondary);
|
|
6
6
|
position: relative;
|
|
7
7
|
|
|
8
|
-
&:first-child ~ div:not(.np-upload-
|
|
9
|
-
&:not(:first-child).np-upload-
|
|
10
|
-
&.np-upload-
|
|
8
|
+
&:first-child ~ div:not(.np-upload-item--link):before,
|
|
9
|
+
&:not(:first-child).np-upload-item--link .np-upload-item__link:before,
|
|
10
|
+
&.np-upload-item--link:hover .np-upload-item__link:after {
|
|
11
11
|
display: block;
|
|
12
12
|
position: absolute;
|
|
13
13
|
height: 1px;
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
width: calc(100% - 2 * var(--size-16));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
&:first-child ~ div:not(.np-upload-
|
|
21
|
-
&:not(:first-child).np-upload-
|
|
20
|
+
&:first-child ~ div:not(.np-upload-item--link):before,
|
|
21
|
+
&:not(:first-child).np-upload-item--link .np-upload-item__link:before {
|
|
22
22
|
top: 0;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
&.np-upload-
|
|
25
|
+
&.np-upload-item--link:hover .np-upload-item__link:after {
|
|
26
26
|
bottom: -1px;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&:not(:first-child) {
|
|
36
|
-
.np-upload-
|
|
36
|
+
.np-upload-item__link:hover {
|
|
37
37
|
border-top-color: var(--color-border-neutral);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
&.np-upload-
|
|
47
|
-
&.np-upload-
|
|
46
|
+
&.np-upload-item--link:hover + .np-upload-item,
|
|
47
|
+
&.np-upload-item--link:hover + .np-upload-button-container {
|
|
48
48
|
&:before,
|
|
49
|
-
.np-upload-
|
|
49
|
+
.np-upload-item__link:before {
|
|
50
50
|
display: none;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.np-upload-item--single-file:focus-visible,
|
|
70
|
-
.np-upload-
|
|
70
|
+
.np-upload-item__link:focus-visible,
|
|
71
71
|
.np-upload-button-container:has(:focus-visible) {
|
|
72
72
|
outline-width: 3px;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.np-upload-
|
|
75
|
+
.np-upload-item--link {
|
|
76
76
|
a {
|
|
77
77
|
flex: 1;
|
|
78
78
|
text-decoration: none;
|
|
@@ -103,6 +103,10 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
&:first-of-type a {
|
|
108
|
+
border-top: 0;
|
|
109
|
+
}
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
.np-upload-item__body {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bin } from '@transferwise/icons';
|
|
1
|
+
import { Bin, CheckCircleFill, CrossCircleFill } from '@transferwise/icons';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ import StatusIcon from '../../statusIcon/StatusIcon';
|
|
|
9
9
|
import { UploadedFile, UploadError } from '../types';
|
|
10
10
|
|
|
11
11
|
import MESSAGES from './UploadItem.messages';
|
|
12
|
-
import {
|
|
12
|
+
import { UploadItemLink } from './UploadItemLink';
|
|
13
13
|
|
|
14
14
|
export type UploadItemProps = JSX.IntrinsicAttributes & {
|
|
15
15
|
file: UploadedFile;
|
|
@@ -46,9 +46,14 @@ const UploadItem = ({
|
|
|
46
46
|
|
|
47
47
|
const isSucceeded = [Status.SUCCEEDED, undefined].includes(status) && !!url;
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* We're temporarily reverting to the regular icon components,
|
|
51
|
+
* until the StatusIcon receives 24px sizing. Some misalignment
|
|
52
|
+
* to be expected.
|
|
53
|
+
*/
|
|
49
54
|
const getIcon = () => {
|
|
50
55
|
if (error || errors?.length || status === Status.FAILED) {
|
|
51
|
-
return <
|
|
56
|
+
return <CrossCircleFill size={24} className="emphasis--negative" />;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
let processIndicator: React.ReactNode;
|
|
@@ -61,7 +66,7 @@ const UploadItem = ({
|
|
|
61
66
|
case Status.SUCCEEDED:
|
|
62
67
|
case Status.DONE:
|
|
63
68
|
default:
|
|
64
|
-
processIndicator = <
|
|
69
|
+
processIndicator = <CheckCircleFill size={24} className="emphasis--positive" />;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
return processIndicator;
|
|
@@ -127,11 +132,11 @@ const UploadItem = ({
|
|
|
127
132
|
|
|
128
133
|
return (
|
|
129
134
|
<div
|
|
130
|
-
className={classNames('np-upload-item', { 'np-upload-
|
|
135
|
+
className={classNames('np-upload-item', { 'np-upload-item--link': isSucceeded })}
|
|
131
136
|
data-testid={TEST_IDS.uploadItem}
|
|
132
137
|
>
|
|
133
138
|
<div className="np-upload-item__body">
|
|
134
|
-
<
|
|
139
|
+
<UploadItemLink
|
|
135
140
|
url={isSucceeded ? url : undefined}
|
|
136
141
|
singleFileUpload={singleFileUpload}
|
|
137
142
|
onDownload={onDownloadFile}
|
|
@@ -145,7 +150,7 @@ const UploadItem = ({
|
|
|
145
150
|
</div>
|
|
146
151
|
</div>
|
|
147
152
|
</div>
|
|
148
|
-
</
|
|
153
|
+
</UploadItemLink>
|
|
149
154
|
{canDelete && (
|
|
150
155
|
<button
|
|
151
156
|
aria-label={formatMessage(MESSAGES.removeFile, { filename })}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren, MouseEvent } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
2
3
|
|
|
3
4
|
type UploadItemLinkProps = PropsWithChildren<{
|
|
4
5
|
url?: string;
|
|
@@ -6,7 +7,7 @@ type UploadItemLinkProps = PropsWithChildren<{
|
|
|
6
7
|
singleFileUpload: boolean;
|
|
7
8
|
}>;
|
|
8
9
|
|
|
9
|
-
export const
|
|
10
|
+
export const UploadItemLink = ({
|
|
10
11
|
children,
|
|
11
12
|
url,
|
|
12
13
|
onDownload,
|
|
@@ -21,7 +22,10 @@ export const UploadItemBody = ({
|
|
|
21
22
|
href={url}
|
|
22
23
|
target="_blank"
|
|
23
24
|
rel="noopener noreferrer"
|
|
24
|
-
className={
|
|
25
|
+
className={classnames(
|
|
26
|
+
'np-upload-item__link',
|
|
27
|
+
singleFileUpload ? 'np-upload-item--single-file' : '',
|
|
28
|
+
)}
|
|
25
29
|
onClick={onDownload}
|
|
26
30
|
>
|
|
27
31
|
{children}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemBody.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEtD,KAAK,mBAAmB,GAAG,iBAAiB,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC,CAAC;AAEH,eAAO,MAAM,cAAc,qDAKxB,mBAAmB,gCAgBrB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
|
|
5
|
-
const UploadItemBody = ({
|
|
6
|
-
children,
|
|
7
|
-
url,
|
|
8
|
-
onDownload,
|
|
9
|
-
singleFileUpload
|
|
10
|
-
}) => {
|
|
11
|
-
if (!url) {
|
|
12
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
13
|
-
children: children
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
17
|
-
href: url,
|
|
18
|
-
target: "_blank",
|
|
19
|
-
rel: "noopener noreferrer",
|
|
20
|
-
className: singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link',
|
|
21
|
-
onClick: onDownload,
|
|
22
|
-
children: children
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.UploadItemBody = UploadItemBody;
|
|
27
|
-
//# sourceMappingURL=UploadItemBody.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemBody.js","sources":["../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemBody = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemBody","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","onClick"],"mappings":";;;;AAQO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,cAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,cAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;AACzBC,IAAAA,SAAS,EAAEL,gBAAgB,GAAG,6BAA6B,GAAG,sBAAuB;AACrFM,IAAAA,OAAO,EAAEP,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemBody.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItemBody.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemBody = ({\n children,\n url,\n onDownload,\n singleFileUpload,\n}: UploadItemLinkProps) => {\n if (!url) {\n return <div>{children}</div>;\n }\n\n return (\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemBody","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","onClick"],"mappings":";;AAQO,MAAMA,cAAc,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,GAAG;EACHC,UAAU;AACVC,EAAAA,gBAAAA;AAAgB,CACI,KAAI;EACxB,IAAI,CAACF,GAAG,EAAE;AACR,IAAA,oBAAOG,GAAA,CAAA,KAAA,EAAA;AAAAJ,MAAAA,QAAA,EAAMA,QAAAA;AAAQ,KAAM,CAAC,CAAA;AAC9B,GAAA;AAEA,EAAA,oBACEI,GAAA,CAAA,GAAA,EAAA;AACEC,IAAAA,IAAI,EAAEJ,GAAI;AACVK,IAAAA,MAAM,EAAC,QAAQ;AACfC,IAAAA,GAAG,EAAC,qBAAqB;AACzBC,IAAAA,SAAS,EAAEL,gBAAgB,GAAG,6BAA6B,GAAG,sBAAuB;AACrFM,IAAAA,OAAO,EAAEP,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
|