@transferwise/components 46.67.1 → 46.68.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.
- package/build/button/Button.js +22 -6
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +22 -6
- package/build/button/Button.mjs.map +1 -1
- package/build/main.css +212 -210
- package/build/styles/button/Button.css +3 -0
- package/build/styles/main.css +212 -210
- package/build/styles/uploadInput/UploadInput.css +13 -81
- package/build/styles/uploadInput/uploadButton/UploadButton.css +77 -31
- package/build/styles/uploadInput/uploadItem/UploadItem.css +130 -109
- package/build/typeahead/Typeahead.js +23 -10
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +23 -11
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +6 -3
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +6 -3
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.js +9 -6
- package/build/typeahead/typeaheadOption/TypeaheadOption.js.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs +9 -6
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts +1 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts +2 -0
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts +2 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +5 -0
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/uploadInput/UploadInput.js +30 -20
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +30 -20
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +25 -32
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +25 -32
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +32 -38
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +33 -39
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +2 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs +2 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
- package/package.json +3 -3
- package/src/button/Button.css +3 -0
- package/src/button/Button.less +6 -0
- package/src/button/Button.spec.js +81 -45
- package/src/button/Button.story.tsx +54 -20
- package/src/button/Button.tsx +32 -7
- package/src/button/__snapshots__/Button.spec.js.snap +56 -12
- package/src/main.css +212 -210
- package/src/typeahead/Typeahead.spec.js +14 -0
- package/src/typeahead/Typeahead.story.tsx +12 -9
- package/src/typeahead/Typeahead.tsx +34 -16
- package/src/typeahead/typeaheadInput/TypeaheadInput.spec.js +6 -0
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +10 -1
- package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +8 -0
- package/src/typeahead/typeaheadOption/TypeaheadOption.tsx +9 -6
- package/src/uploadInput/UploadInput.css +13 -81
- package/src/uploadInput/UploadInput.less +18 -80
- package/src/uploadInput/UploadInput.tests.story.tsx +5 -5
- package/src/uploadInput/UploadInput.tsx +43 -32
- package/src/uploadInput/uploadButton/UploadButton.css +77 -31
- package/src/uploadInput/uploadButton/UploadButton.less +77 -35
- package/src/uploadInput/uploadButton/UploadButton.tsx +37 -26
- package/src/uploadInput/uploadItem/UploadItem.css +130 -109
- package/src/uploadInput/uploadItem/UploadItem.less +130 -118
- package/src/uploadInput/uploadItem/UploadItem.tsx +26 -28
- package/src/uploadInput/uploadItem/UploadItemLink.tsx +3 -3
|
@@ -20,10 +20,12 @@ export type TypeaheadInputProps<T> = {
|
|
|
20
20
|
onFocus: () => void;
|
|
21
21
|
onPaste: React.ClipboardEventHandler<HTMLInputElement>;
|
|
22
22
|
renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;
|
|
23
|
+
ariaActivedescendant?: string;
|
|
23
24
|
} & Pick<TypeaheadProps<T>, 'id' | 'name' | 'autoFocus' | 'multiple' | 'placeholder' | 'maxHeight'>;
|
|
24
25
|
|
|
25
26
|
type TypeaheadInputState = {
|
|
26
27
|
inputWidth: number;
|
|
28
|
+
keyboardFocusedOptionIndex: number | null;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export default class TypeaheadInput<T> extends Component<
|
|
@@ -37,6 +39,7 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
37
39
|
super(props);
|
|
38
40
|
this.state = {
|
|
39
41
|
inputWidth: DEFAULT_INPUT_MIN_WIDTH,
|
|
42
|
+
keyboardFocusedOptionIndex: null,
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -76,6 +79,7 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
76
79
|
onFocus,
|
|
77
80
|
onPaste,
|
|
78
81
|
autoComplete,
|
|
82
|
+
ariaActivedescendant, // Declare the ariaActivedescendant variable
|
|
79
83
|
} = this.props;
|
|
80
84
|
const { inputWidth } = this.state;
|
|
81
85
|
|
|
@@ -86,12 +90,17 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
86
90
|
className={clsx(multiple && 'typeahead__input')}
|
|
87
91
|
name={name}
|
|
88
92
|
id={`input-${typeaheadId}`}
|
|
93
|
+
aria-activedescendant={
|
|
94
|
+
ariaActivedescendant
|
|
95
|
+
? `menu-${typeaheadId} ${ariaActivedescendant}`
|
|
96
|
+
: `menu-${typeaheadId}`
|
|
97
|
+
}
|
|
89
98
|
autoFocus={autoFocus}
|
|
90
99
|
placeholder={hasPlaceholder ? placeholder : ''}
|
|
91
100
|
aria-autocomplete="list"
|
|
92
101
|
aria-expanded={dropdownOpen}
|
|
93
102
|
aria-haspopup="listbox"
|
|
94
|
-
aria-controls={`menu-${typeaheadId}`}
|
|
103
|
+
aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}
|
|
95
104
|
autoComplete={autoComplete}
|
|
96
105
|
role="combobox"
|
|
97
106
|
value={value}
|
|
@@ -51,6 +51,14 @@ describe('Typeahead Option', () => {
|
|
|
51
51
|
expect(component.is('.tw-dropdown-item--focused')).toBe(true);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
it('expect aria-selected to be true', () => {
|
|
55
|
+
component.setProps({
|
|
56
|
+
selected: true,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(component.prop('aria-selected')).toBe('true');
|
|
60
|
+
});
|
|
61
|
+
|
|
54
62
|
it('calls onClick when clicked', () => {
|
|
55
63
|
const onClick = jest.fn();
|
|
56
64
|
component.setProps({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
2
1
|
import { clsx } from 'clsx';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { TypeaheadOption } from '../Typeahead';
|
|
5
5
|
import highlight from '../util/highlight';
|
|
@@ -9,21 +9,24 @@ export type TypeaheadOptionProps<T> = {
|
|
|
9
9
|
selected?: boolean;
|
|
10
10
|
onClick?: React.MouseEventHandler;
|
|
11
11
|
query?: string;
|
|
12
|
+
id?: string;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
const Option = <
|
|
15
|
-
const { option, selected = false, onClick = () => {}, query = '' } = props;
|
|
15
|
+
const Option = forwardRef<HTMLLIElement, TypeaheadOptionProps<any>>((props, ref) => {
|
|
16
|
+
const { option, selected = false, onClick = () => {}, query = '', id } = props;
|
|
16
17
|
const { label, note, secondary } = option;
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<li
|
|
21
|
+
ref={ref}
|
|
20
22
|
role="option"
|
|
21
|
-
aria-selected=
|
|
23
|
+
aria-selected={selected ? 'true' : 'false'}
|
|
24
|
+
id={`option-${id}`}
|
|
22
25
|
className={clsx('typeahead__option tw-dropdown-item clickable', {
|
|
23
26
|
'tw-dropdown-item--focused': selected,
|
|
24
27
|
})}
|
|
25
28
|
>
|
|
26
|
-
<a className="dropdown-item" href="#" tabIndex={
|
|
29
|
+
<a className="dropdown-item" href="#" tabIndex={0} onClick={onClick}>
|
|
27
30
|
<span>{highlight(label, query)}</span>
|
|
28
31
|
{note && <span className="np-text-body-default m-l-1">{note}</span>}
|
|
29
32
|
{secondary && (
|
|
@@ -32,6 +35,6 @@ const Option = <T,>(props: TypeaheadOptionProps<T>) => {
|
|
|
32
35
|
</a>
|
|
33
36
|
</li>
|
|
34
37
|
);
|
|
35
|
-
};
|
|
38
|
+
});
|
|
36
39
|
|
|
37
40
|
export default Option;
|
|
@@ -1,86 +1,18 @@
|
|
|
1
|
-
.np-upload-input
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.np-upload-input {
|
|
2
|
+
--outerBorder: 1px solid var(--color-interactive-secondary);
|
|
3
|
+
border-radius: 10px;
|
|
4
|
+
border-radius: var(--radius-small);
|
|
5
5
|
}
|
|
6
|
-
.np-upload-input
|
|
7
|
-
|
|
8
|
-
.np-upload-input > div:first-child .np-upload-item--link {
|
|
9
|
-
border-top-left-radius: 10px;
|
|
10
|
-
border-top-left-radius: var(--radius-small);
|
|
11
|
-
border-top-right-radius: 10px;
|
|
12
|
-
border-top-right-radius: var(--radius-small);
|
|
6
|
+
.np-upload-input .np-upload-input__section {
|
|
7
|
+
margin: 0;
|
|
13
8
|
}
|
|
14
|
-
.np-upload-input
|
|
15
|
-
border-
|
|
16
|
-
border-
|
|
17
|
-
border-bottom
|
|
18
|
-
border-bottom-right-radius: var(--radius-small);
|
|
9
|
+
.np-upload-input .np-upload-input__section:only-child .np-upload-input__item {
|
|
10
|
+
border-radius: 10px;
|
|
11
|
+
border-radius: var(--radius-small);
|
|
12
|
+
border-bottom: var(--outerBorder);
|
|
19
13
|
}
|
|
20
|
-
.np-
|
|
21
|
-
cursor: inherit;
|
|
22
|
-
}
|
|
23
|
-
.np-theme-personal .np-upload-input .np-upload-icon {
|
|
24
|
-
color: var(--color-interactive-primary);
|
|
25
|
-
}
|
|
26
|
-
.np-theme-personal .np-upload-input .media-body {
|
|
27
|
-
padding-right: 32px;
|
|
28
|
-
padding-right: var(--size-32);
|
|
29
|
-
color: var(--color-content-link);
|
|
30
|
-
white-space: break-spaces;
|
|
31
|
-
}
|
|
32
|
-
@media (max-width: 320px) {
|
|
33
|
-
.np-theme-personal .np-upload-input .media-body {
|
|
34
|
-
padding-right: 64px;
|
|
35
|
-
padding-right: var(--size-64);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
.np-theme-personal .np-upload-input .media-body .np-text-body-large-bold {
|
|
39
|
-
-webkit-text-decoration: underline;
|
|
40
|
-
text-decoration: underline;
|
|
41
|
-
text-underline-offset: 0.3em;
|
|
42
|
-
}
|
|
43
|
-
.np-theme-personal .np-upload-input .media-body .np-text-body-default,
|
|
44
|
-
.np-theme-personal .np-upload-input .media-body .np-upload-description,
|
|
45
|
-
.np-theme-personal .np-upload-input .media-body .text-positive {
|
|
46
|
-
color: #5d7079 !important;
|
|
47
|
-
color: var(--color-content-secondary) !important;
|
|
48
|
-
}
|
|
49
|
-
.np-theme-personal .np-upload-input .media-body .text-negative {
|
|
50
|
-
color: var(--color-sentiment-negative) !important;
|
|
51
|
-
}
|
|
52
|
-
.np-theme-personal .np-upload-input-errors {
|
|
53
|
-
list-style: none;
|
|
54
|
-
padding-left: 0;
|
|
55
|
-
}
|
|
56
|
-
.np-theme-personal .np-upload-input-errors li {
|
|
57
|
-
position: relative;
|
|
58
|
-
padding-left: 16px;
|
|
59
|
-
padding-left: var(--size-16);
|
|
60
|
-
}
|
|
61
|
-
@media (max-width: 320px) {
|
|
62
|
-
.np-theme-personal .np-upload-input-errors li {
|
|
63
|
-
padding-left: 32px;
|
|
64
|
-
padding-left: var(--size-32);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
.np-theme-personal .np-upload-input-errors li:before {
|
|
68
|
-
content: '•';
|
|
69
|
-
position: absolute;
|
|
70
|
-
display: block;
|
|
14
|
+
.np-upload-input .np-upload-input__section:has(.np-upload-input__item:last-child.is-interactive:hover):not(:has(.np-upload-input__item-button:hover)) + .np-upload-input__section--uploader .np-upload-input__upload-button::before {
|
|
71
15
|
left: 0;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
width: 24px;
|
|
75
|
-
width: var(--size-x-small);
|
|
76
|
-
height: 24px;
|
|
77
|
-
height: var(--size-x-small);
|
|
78
|
-
}
|
|
79
|
-
@media (max-width: 320px) {
|
|
80
|
-
.np-theme-personal .np-upload-input .status-circle {
|
|
81
|
-
width: 48px;
|
|
82
|
-
width: var(--size-large);
|
|
83
|
-
height: 48px;
|
|
84
|
-
height: var(--size-large);
|
|
85
|
-
}
|
|
16
|
+
width: 100%;
|
|
17
|
+
top: 0;
|
|
86
18
|
}
|
|
@@ -3,90 +3,28 @@
|
|
|
3
3
|
@import (reference) './uploadItem/UploadItem.less';
|
|
4
4
|
|
|
5
5
|
.np-upload-input {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
padding: initial;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
& > div {
|
|
12
|
-
&:first-child,
|
|
13
|
-
&:first-child .np-upload-item--single-file,
|
|
14
|
-
&:first-child .np-upload-item--link {
|
|
15
|
-
border-top-left-radius: var(--radius-small);
|
|
16
|
-
border-top-right-radius: var(--radius-small);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&:last-child {
|
|
20
|
-
border-bottom-left-radius: var(--radius-small);
|
|
21
|
-
border-bottom-right-radius: var(--radius-small);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.np-theme-personal {
|
|
27
|
-
.np-upload-input {
|
|
28
|
-
&.disabled .btn {
|
|
29
|
-
cursor: inherit;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.np-upload-icon {
|
|
33
|
-
color: var(--color-interactive-primary);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.media-body {
|
|
37
|
-
padding-right: var(--size-32);
|
|
38
|
-
color: var(--color-content-link);
|
|
39
|
-
white-space: break-spaces;
|
|
40
|
-
|
|
41
|
-
@media (--screen-400-zoom) {
|
|
42
|
-
padding-right: var(--size-64);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.np-text-body-large-bold {
|
|
46
|
-
text-decoration: underline;
|
|
47
|
-
.link-underline();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.np-text-body-default,
|
|
51
|
-
.np-upload-description,
|
|
52
|
-
.text-positive {
|
|
53
|
-
color: var(--color-content-secondary) !important;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.text-negative {
|
|
57
|
-
color: var(--color-sentiment-negative) !important;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&-errors {
|
|
62
|
-
list-style: none;
|
|
63
|
-
padding-left: 0;
|
|
6
|
+
--outerBorder: 1px solid var(--color-interactive-secondary);
|
|
7
|
+
border-radius: var(--radius-small);
|
|
64
8
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
padding-left: var(--size-16);
|
|
9
|
+
.np-upload-input__section {
|
|
10
|
+
margin: 0;
|
|
68
11
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
content: '•';
|
|
75
|
-
position: absolute;
|
|
76
|
-
display: block;
|
|
77
|
-
left: 0;
|
|
78
|
-
}
|
|
12
|
+
// only 1 file allowed and already uploaded (no UploadButton shown)
|
|
13
|
+
&:only-child {
|
|
14
|
+
.np-upload-input__item {
|
|
15
|
+
border-radius: var(--radius-small);
|
|
16
|
+
border-bottom: var(--outerBorder);
|
|
79
17
|
}
|
|
80
18
|
}
|
|
81
19
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
20
|
+
// if the last item in the file list is interactive (not an error)
|
|
21
|
+
// and the user is hovering over it, then we need to adjust the
|
|
22
|
+
// bottom separator, which happens to be in .np-upload-input__section--uploader
|
|
23
|
+
&:has(.np-upload-input__item:last-child.is-interactive:hover):not(:has(.np-upload-input__item-button:hover))
|
|
24
|
+
+ .np-upload-input__section--uploader .np-upload-input__upload-button::before {
|
|
25
|
+
left: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
top: 0;
|
|
90
28
|
}
|
|
91
29
|
}
|
|
92
|
-
}
|
|
30
|
+
}
|
|
@@ -25,23 +25,23 @@ const files = [
|
|
|
25
25
|
filename: 'purchase-receipt-1.pdf',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
id:
|
|
29
|
-
filename: 'purchase-receipt-
|
|
28
|
+
id: 3,
|
|
29
|
+
filename: 'purchase-receipt-2.pdf',
|
|
30
30
|
url: 'https://wise.com/public-resources/assets/logos/wise/brand_logo_inverse.svg',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
id:
|
|
33
|
+
id: 4,
|
|
34
34
|
filename: 'receipt failed.png',
|
|
35
35
|
status: Status.FAILED,
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
id:
|
|
38
|
+
id: 5,
|
|
39
39
|
filename: 'receipt failed With error string.png',
|
|
40
40
|
status: Status.FAILED,
|
|
41
41
|
error: 'Something went wrong',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
id:
|
|
44
|
+
id: 6,
|
|
45
45
|
filename: 'receipt failed With error object.png',
|
|
46
46
|
status: Status.FAILED,
|
|
47
47
|
error: { message: 'Something went wrong' },
|
|
@@ -345,39 +345,50 @@ const UploadInput = ({
|
|
|
345
345
|
className={clsx('np-upload-input', className, { disabled })}
|
|
346
346
|
{...inputAttributes}
|
|
347
347
|
>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
348
|
+
<div
|
|
349
|
+
className="np-upload-input__section"
|
|
350
|
+
aria-live="polite"
|
|
351
|
+
aria-relevant="all"
|
|
352
|
+
role="region"
|
|
353
|
+
>
|
|
354
|
+
{uploadedFiles.map((file, index) => (
|
|
355
|
+
<UploadItem
|
|
356
|
+
key={file.id}
|
|
357
|
+
ref={(el: UploadItemRef | null) => {
|
|
358
|
+
itemRefs.current[index] = el;
|
|
359
|
+
}}
|
|
360
|
+
file={file}
|
|
361
|
+
singleFileUpload={!multiple}
|
|
362
|
+
canDelete={
|
|
363
|
+
(!!onDeleteFile || file.status === Status.FAILED) &&
|
|
364
|
+
(!file.status || !PROGRESS_STATUSES.has(file.status))
|
|
365
|
+
}
|
|
366
|
+
onDelete={
|
|
367
|
+
file.status === Status.FAILED
|
|
368
|
+
? () => removeFile(file)
|
|
369
|
+
: () => setMarkedFileForDelete(file)
|
|
370
|
+
}
|
|
371
|
+
onDownload={onDownload}
|
|
372
|
+
/>
|
|
373
|
+
))}
|
|
374
|
+
</div>
|
|
368
375
|
{(multiple || (!multiple && !uploadedFiles.length)) && (
|
|
369
|
-
<
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
376
|
+
<div className="np-upload-input__section np-upload-input__section--uploader">
|
|
377
|
+
<UploadButton
|
|
378
|
+
ref={uploadInputRef}
|
|
379
|
+
id={id}
|
|
380
|
+
uploadButtonTitle={uploadButtonTitle}
|
|
381
|
+
disabled={areMaximumFilesUploadedAlready() || disabled}
|
|
382
|
+
multiple={multiple}
|
|
383
|
+
fileTypes={fileTypes}
|
|
384
|
+
sizeLimit={sizeLimit}
|
|
385
|
+
description={description}
|
|
386
|
+
maxFiles={maxFiles}
|
|
387
|
+
withEntries={Boolean(uploadedFiles.length)}
|
|
388
|
+
onChange={addFiles}
|
|
389
|
+
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
381
392
|
)}
|
|
382
393
|
</div>
|
|
383
394
|
<Modal
|
|
@@ -1,44 +1,90 @@
|
|
|
1
|
-
.np-upload-button
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.np-upload-input__upload-button {
|
|
2
|
+
position: relative;
|
|
3
|
+
padding: 16px;
|
|
4
|
+
padding: var(--size-16);
|
|
5
5
|
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
margin: 0;
|
|
8
|
+
border-bottom-left-radius: 10px;
|
|
9
|
+
border-bottom-left-radius: var(--radius-small);
|
|
10
|
+
border-bottom-right-radius: 10px;
|
|
11
|
+
border-bottom-right-radius: var(--radius-small);
|
|
12
|
+
border: var(--outerBorder);
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
.np-upload-input__upload-button .np-upload-input__title {
|
|
16
|
+
color: var(--color-content-link);
|
|
17
|
+
-webkit-text-decoration: underline;
|
|
18
|
+
text-decoration: underline;
|
|
19
|
+
text-underline-offset: 0.3em;
|
|
20
|
+
}
|
|
21
|
+
.np-upload-input__upload-button .np-upload-input__title + .np-upload-input__text {
|
|
22
|
+
margin-top: 4px;
|
|
23
|
+
margin-top: var(--size-4);
|
|
6
24
|
}
|
|
7
|
-
.np-upload-button
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
.np-upload-input__upload-button .np-upload-input__icon {
|
|
26
|
+
padding-right: 16px;
|
|
27
|
+
padding-right: var(--size-16);
|
|
28
|
+
color: var(--color-interactive-primary);
|
|
10
29
|
}
|
|
11
|
-
.np-upload-button
|
|
12
|
-
|
|
30
|
+
.np-upload-input__upload-button.is-dropping .np-upload-input__icon,
|
|
31
|
+
.np-upload-input__upload-button.is-dropping .np-upload-input__item-content {
|
|
32
|
+
display: none;
|
|
13
33
|
}
|
|
14
|
-
.np-upload-button-
|
|
34
|
+
.np-upload-input__upload-button:focus-within,
|
|
35
|
+
.np-upload-input__upload-button:focus-visible {
|
|
36
|
+
outline: var(--ring-outline-color) solid 3px;
|
|
37
|
+
outline-offset: -3px;
|
|
38
|
+
}
|
|
39
|
+
.np-upload-input__upload-button-input {
|
|
40
|
+
position: absolute;
|
|
15
41
|
opacity: 0;
|
|
16
42
|
z-index: -1;
|
|
17
|
-
position: absolute;
|
|
18
43
|
}
|
|
19
|
-
.np-upload-button-
|
|
20
|
-
|
|
44
|
+
.np-upload-input__upload-button-input:focus {
|
|
45
|
+
outline: none;
|
|
21
46
|
}
|
|
22
|
-
.np-upload-button {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
padding:
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
.np-upload-input__upload-button .np-upload-input__drop-file-overlay {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex: 1;
|
|
50
|
+
padding: 13px 0 !important;
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
transition: transform 0.3s ease;
|
|
53
|
+
position: relative;
|
|
28
54
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
background-color: var(--color-background-screen-hover);
|
|
55
|
+
.np-upload-input__upload-button--with-entries {
|
|
56
|
+
border-top-width: 0;
|
|
32
57
|
}
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
.np-upload-input__upload-button--with-entries:before {
|
|
59
|
+
display: block;
|
|
60
|
+
position: absolute;
|
|
61
|
+
height: 1px;
|
|
62
|
+
background-color: rgba(0,0,0,0.10196);
|
|
63
|
+
background-color: var(--color-border-neutral);
|
|
64
|
+
content: " ";
|
|
65
|
+
left: 16px;
|
|
66
|
+
left: var(--size-16);
|
|
67
|
+
width: calc(100% - 2 * 16px);
|
|
68
|
+
width: calc(100% - 2 * var(--size-16));
|
|
69
|
+
top: 0;
|
|
70
|
+
}
|
|
71
|
+
.np-upload-input__upload-button--without-entries {
|
|
72
|
+
border-top: var(--outerBorder);
|
|
73
|
+
border-radius: 10px;
|
|
74
|
+
border-radius: var(--radius-small);
|
|
36
75
|
}
|
|
37
|
-
.np-upload-button
|
|
38
|
-
|
|
76
|
+
.np-upload-input__upload-button--enabled.is-dropping,
|
|
77
|
+
.np-upload-input__upload-button--enabled:hover,
|
|
78
|
+
.np-upload-input__upload-button--enabled:active {
|
|
79
|
+
background: rgba(134,167,189,0.10196);
|
|
80
|
+
background: var(--color-background-neutral);
|
|
81
|
+
}
|
|
82
|
+
.np-upload-input__upload-button--enabled.is-dropping:before,
|
|
83
|
+
.np-upload-input__upload-button--enabled:hover:before,
|
|
84
|
+
.np-upload-input__upload-button--enabled:active:before {
|
|
85
|
+
width: 100%;
|
|
86
|
+
left: 0;
|
|
39
87
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
padding-left: 0;
|
|
43
|
-
}
|
|
88
|
+
.np-upload-input__upload-button--disabled {
|
|
89
|
+
cursor: inherit;
|
|
44
90
|
}
|
|
@@ -1,55 +1,97 @@
|
|
|
1
|
-
.np-upload-button
|
|
2
|
-
|
|
1
|
+
.np-upload-input__upload-button {
|
|
2
|
+
position: relative;
|
|
3
|
+
padding: var(--size-16);
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin: 0;
|
|
7
|
+
border-bottom-left-radius: var(--radius-small);
|
|
8
|
+
border-bottom-right-radius: var(--radius-small);
|
|
9
|
+
border: var(--outerBorder);
|
|
10
|
+
cursor: pointer;
|
|
3
11
|
|
|
4
|
-
.
|
|
5
|
-
|
|
12
|
+
.np-upload-input__title {
|
|
13
|
+
color: var(--color-content-link);
|
|
14
|
+
text-decoration: underline;
|
|
15
|
+
text-underline-offset: 0.3em;
|
|
16
|
+
|
|
17
|
+
& + .np-upload-input__text {
|
|
18
|
+
margin-top: var(--size-4);
|
|
19
|
+
}
|
|
6
20
|
}
|
|
7
21
|
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
.np-upload-input__icon {
|
|
23
|
+
padding-right: var(--size-16);
|
|
24
|
+
color: var(--color-interactive-primary);
|
|
25
|
+
}
|
|
10
26
|
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
&.is-dropping {
|
|
28
|
+
.np-upload-input__icon,
|
|
29
|
+
.np-upload-input__item-content {
|
|
30
|
+
display: none;
|
|
13
31
|
}
|
|
14
32
|
}
|
|
15
33
|
|
|
16
|
-
|
|
34
|
+
&:focus-within,
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
outline: var(--ring-outline-color) solid 3px;
|
|
37
|
+
outline-offset: -3px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-input {
|
|
41
|
+
position: absolute;
|
|
17
42
|
opacity: 0;
|
|
18
43
|
z-index: -1;
|
|
19
|
-
|
|
44
|
+
|
|
45
|
+
&:focus {
|
|
46
|
+
outline: none;
|
|
47
|
+
}
|
|
20
48
|
}
|
|
21
49
|
|
|
22
|
-
.np-upload-
|
|
23
|
-
|
|
50
|
+
.np-upload-input__drop-file-overlay {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex: 1;
|
|
53
|
+
padding: 13px 0 !important;
|
|
54
|
+
background-color: transparent;
|
|
55
|
+
transition: transform 0.3s ease;
|
|
56
|
+
position: relative;
|
|
24
57
|
}
|
|
25
58
|
}
|
|
26
59
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
border-top:
|
|
30
|
-
padding: var(--padding-small);
|
|
31
|
-
border-radius: 0;
|
|
32
|
-
|
|
33
|
-
label& {
|
|
34
|
-
&:not(.disabled) {
|
|
35
|
-
&:hover,
|
|
36
|
-
&:active {
|
|
37
|
-
background-color: var(--color-background-screen-hover);
|
|
38
|
-
|
|
39
|
-
.disabled & {
|
|
40
|
-
background-color: transparent;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
60
|
+
// at least 1 file uploaded or 1 error visible
|
|
61
|
+
.np-upload-input__upload-button--with-entries {
|
|
62
|
+
border-top-width: 0;
|
|
45
63
|
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
&:before {
|
|
65
|
+
display: block;
|
|
66
|
+
position: absolute;
|
|
67
|
+
height: 1px;
|
|
68
|
+
background-color: var(--color-border-neutral);
|
|
69
|
+
content: " ";
|
|
70
|
+
left: var(--size-16);
|
|
71
|
+
width: calc(100% - 2 * var(--size-16));
|
|
72
|
+
top: 0;
|
|
48
73
|
}
|
|
49
74
|
}
|
|
50
75
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
// no files uploaded (only button shown)
|
|
77
|
+
.np-upload-input__upload-button--without-entries {
|
|
78
|
+
border-top: var(--outerBorder);
|
|
79
|
+
border-radius: var(--radius-small);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.np-upload-input__upload-button--enabled {
|
|
83
|
+
&.is-dropping,
|
|
84
|
+
&:hover,
|
|
85
|
+
&:active {
|
|
86
|
+
background: var(--color-background-neutral);
|
|
87
|
+
|
|
88
|
+
&:before {
|
|
89
|
+
width: 100%;
|
|
90
|
+
left: 0;
|
|
91
|
+
}
|
|
54
92
|
}
|
|
55
93
|
}
|
|
94
|
+
|
|
95
|
+
.np-upload-input__upload-button--disabled {
|
|
96
|
+
cursor: inherit;
|
|
97
|
+
}
|