@transferwise/components 0.0.0-experimental-973eefd → 0.0.0-experimental-981ae6b
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/common/bottomSheet/BottomSheet.js +3 -0
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +4 -1
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/panel/Panel.js +3 -0
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +4 -1
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +21 -17
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +21 -17
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +6 -0
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +6 -0
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/drawer/Drawer.js +3 -0
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +4 -1
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/main.css +20 -28
- package/build/modal/Modal.js +3 -0
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +4 -1
- package/build/modal/Modal.mjs.map +1 -1
- package/build/provider/overlay/OverlayIdProvider.js +20 -0
- package/build/provider/overlay/OverlayIdProvider.js.map +1 -0
- package/build/provider/overlay/OverlayIdProvider.mjs +17 -0
- package/build/provider/overlay/OverlayIdProvider.mjs.map +1 -0
- package/build/styles/main.css +20 -28
- package/build/styles/uploadInput/uploadButton/UploadButton.css +0 -5
- package/build/styles/uploadInput/uploadItem/UploadItem.css +20 -23
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/provider/overlay/OverlayIdProvider.d.ts +7 -0
- package/build/types/provider/overlay/OverlayIdProvider.d.ts.map +1 -0
- package/build/types/uploadInput/uploadItem/{UploadItemLink.d.ts → UploadItemBody.d.ts} +2 -2
- package/build/types/uploadInput/uploadItem/UploadItemBody.d.ts.map +1 -0
- package/build/uploadInput/uploadItem/UploadItem.js +3 -3
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +3 -3
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemBody.js +27 -0
- package/build/uploadInput/uploadItem/UploadItemBody.js.map +1 -0
- package/build/uploadInput/uploadItem/{UploadItemLink.mjs → UploadItemBody.mjs} +4 -5
- package/build/uploadInput/uploadItem/UploadItemBody.mjs.map +1 -0
- package/package.json +4 -4
- package/src/common/bottomSheet/BottomSheet.tsx +12 -1
- package/src/common/panel/Panel.tsx +5 -0
- package/src/dateLookup/DateLookup.tsx +22 -19
- package/src/dateLookup/dateTrigger/DateTrigger.spec.js +1 -0
- package/src/dateLookup/dateTrigger/DateTrigger.tsx +7 -0
- package/src/drawer/Drawer.tsx +5 -1
- package/src/main.css +20 -28
- package/src/modal/Modal.tsx +5 -1
- package/src/provider/overlay/OverlayIdProvider.tsx +15 -0
- package/src/uploadInput/uploadButton/UploadButton.css +0 -5
- package/src/uploadInput/uploadButton/UploadButton.less +0 -6
- package/src/uploadInput/uploadItem/UploadItem.css +20 -23
- package/src/uploadInput/uploadItem/UploadItem.less +12 -16
- package/src/uploadInput/uploadItem/UploadItem.tsx +4 -4
- package/src/uploadInput/uploadItem/{UploadItemLink.tsx → UploadItemBody.tsx} +2 -6
- package/build/types/uploadInput/uploadItem/UploadItemLink.d.ts.map +0 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +0 -32
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +0 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +0 -1
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CSSProperties,
|
|
4
|
+
PropsWithChildren,
|
|
5
|
+
SyntheticEvent,
|
|
6
|
+
useContext,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
3
10
|
|
|
4
11
|
import Dimmer from '../../dimmer';
|
|
5
12
|
import Drawer from '../../drawer';
|
|
13
|
+
import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';
|
|
6
14
|
import SlidingPanel from '../../slidingPanel';
|
|
7
15
|
import { CloseButton } from '../closeButton';
|
|
8
16
|
import { CommonProps } from '../commonProps';
|
|
@@ -170,6 +178,8 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
170
178
|
|
|
171
179
|
const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
172
180
|
|
|
181
|
+
const overlayId = useContext(OverlayIdContext);
|
|
182
|
+
|
|
173
183
|
return is400Zoom ? (
|
|
174
184
|
<Drawer open={props.open} className={props.className} onClose={close}>
|
|
175
185
|
{props.children}
|
|
@@ -184,6 +194,7 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
184
194
|
>
|
|
185
195
|
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
|
|
186
196
|
<div
|
|
197
|
+
id={overlayId}
|
|
187
198
|
role="dialog"
|
|
188
199
|
aria-modal
|
|
189
200
|
onTouchStart={onSwipeStart}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
PropsWithChildren,
|
|
7
7
|
SyntheticEvent,
|
|
8
8
|
forwardRef,
|
|
9
|
+
useContext,
|
|
9
10
|
useEffect,
|
|
10
11
|
useState,
|
|
11
12
|
} from 'react';
|
|
@@ -13,6 +14,7 @@ import { usePopper } from 'react-popper';
|
|
|
13
14
|
|
|
14
15
|
import { Position, PositionBottom, PositionLeft, PositionRight, PositionTop } from '..';
|
|
15
16
|
import Dimmer from '../../dimmer';
|
|
17
|
+
import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';
|
|
16
18
|
|
|
17
19
|
const POPOVER_OFFSET = [0, 16];
|
|
18
20
|
|
|
@@ -108,9 +110,12 @@ const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(
|
|
|
108
110
|
...(anchorWidth ? { width: anchorRef.current?.clientWidth } : undefined),
|
|
109
111
|
};
|
|
110
112
|
|
|
113
|
+
const overlayId = useContext(OverlayIdContext);
|
|
114
|
+
|
|
111
115
|
return (
|
|
112
116
|
<Dimmer open={open} transparent fadeContentOnEnter fadeContentOnExit onClose={onClose}>
|
|
113
117
|
<div
|
|
118
|
+
id={overlayId}
|
|
114
119
|
{...rest}
|
|
115
120
|
ref={setPopperElement}
|
|
116
121
|
role="dialog"
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { isWithinRange, moveToWithinRange } from '../common/dateUtils';
|
|
14
14
|
import ResponsivePanel from '../common/responsivePanel';
|
|
15
15
|
import { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';
|
|
16
|
+
import { OverlayIdContext, OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';
|
|
16
17
|
import DateTrigger from './dateTrigger';
|
|
17
18
|
import DayCalendar from './dayCalendar';
|
|
18
19
|
import { getStartOfDay } from './getStartOfDay';
|
|
@@ -326,25 +327,27 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
326
327
|
className="input-group"
|
|
327
328
|
onKeyDown={this.handleKeyDown}
|
|
328
329
|
>
|
|
329
|
-
<
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
330
|
+
<OverlayIdProvider open={open}>
|
|
331
|
+
<DateTrigger
|
|
332
|
+
selectedDate={selectedDate}
|
|
333
|
+
size={size}
|
|
334
|
+
placeholder={placeholder}
|
|
335
|
+
label={label}
|
|
336
|
+
monthFormat={monthFormat}
|
|
337
|
+
disabled={disabled || false}
|
|
338
|
+
onClick={this.open}
|
|
339
|
+
onClear={!disabled && clearable && value ? this.handleClear : undefined}
|
|
340
|
+
/>
|
|
341
|
+
<ResponsivePanel
|
|
342
|
+
anchorRef={this.element}
|
|
343
|
+
open={open}
|
|
344
|
+
className="tw-date-lookup-menu"
|
|
345
|
+
position={Position.BOTTOM}
|
|
346
|
+
onClose={this.discard}
|
|
347
|
+
>
|
|
348
|
+
{this.getCalendar()}
|
|
349
|
+
</ResponsivePanel>
|
|
350
|
+
</OverlayIdProvider>
|
|
348
351
|
</div>
|
|
349
352
|
);
|
|
350
353
|
}
|
|
@@ -6,6 +6,8 @@ import { Size, Position, SizeSmall, SizeMedium, SizeLarge } from '../../common';
|
|
|
6
6
|
import { CloseButton } from '../../common/closeButton/CloseButton';
|
|
7
7
|
|
|
8
8
|
import messages from './DateTrigger.messages';
|
|
9
|
+
import { useContext } from 'react';
|
|
10
|
+
import { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';
|
|
9
11
|
|
|
10
12
|
interface DateTriggerProps {
|
|
11
13
|
selectedDate: Date | null;
|
|
@@ -30,9 +32,14 @@ const DateTrigger: React.FC<DateTriggerProps> = ({
|
|
|
30
32
|
}) => {
|
|
31
33
|
const { locale, formatMessage } = useIntl();
|
|
32
34
|
|
|
35
|
+
const overlayId = useContext(OverlayIdContext);
|
|
36
|
+
|
|
33
37
|
return (
|
|
34
38
|
<>
|
|
35
39
|
<button
|
|
40
|
+
aria-haspopup="dialog"
|
|
41
|
+
aria-expanded={overlayId != null}
|
|
42
|
+
aria-controls={overlayId}
|
|
36
43
|
className={`btn btn-${size} btn-input np-date-trigger`}
|
|
37
44
|
disabled={disabled}
|
|
38
45
|
type="button"
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { useId } from 'react';
|
|
2
|
+
import { useContext, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Position, Typography } from '../common';
|
|
5
5
|
import { CloseButton } from '../common/closeButton';
|
|
6
6
|
import { useLayout } from '../common/hooks';
|
|
7
7
|
import Dimmer from '../dimmer';
|
|
8
|
+
import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';
|
|
8
9
|
import SlidingPanel from '../slidingPanel';
|
|
9
10
|
import Title from '../title';
|
|
10
11
|
import { logActionRequiredIf } from '../utilities';
|
|
@@ -42,10 +43,13 @@ export default function Drawer({
|
|
|
42
43
|
const { isMobile } = useLayout();
|
|
43
44
|
const titleId = useId();
|
|
44
45
|
|
|
46
|
+
const overlayId = useContext(OverlayIdContext);
|
|
47
|
+
|
|
45
48
|
return (
|
|
46
49
|
<Dimmer open={open} onClose={onClose}>
|
|
47
50
|
<SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>
|
|
48
51
|
<div
|
|
52
|
+
id={overlayId}
|
|
49
53
|
role="dialog"
|
|
50
54
|
aria-modal
|
|
51
55
|
aria-labelledby={headerTitle ? titleId : undefined}
|
package/src/main.css
CHANGED
|
@@ -5472,11 +5472,6 @@ 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
|
-
}
|
|
5480
5475
|
.np-upload-input.form-control {
|
|
5481
5476
|
height: auto;
|
|
5482
5477
|
padding: 0;
|
|
@@ -5568,9 +5563,9 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5568
5563
|
border: 1px solid var(--color-interactive-secondary);
|
|
5569
5564
|
position: relative;
|
|
5570
5565
|
}
|
|
5571
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
5572
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
5573
|
-
.np-upload-item.np-upload-
|
|
5566
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
|
|
5567
|
+
.np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before,
|
|
5568
|
+
.np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
|
|
5574
5569
|
display: block;
|
|
5575
5570
|
position: absolute;
|
|
5576
5571
|
height: 1px;
|
|
@@ -5582,27 +5577,27 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5582
5577
|
width: calc(100% - 2 * 16px);
|
|
5583
5578
|
width: calc(100% - 2 * var(--size-16));
|
|
5584
5579
|
}
|
|
5585
|
-
.np-upload-item:first-child ~ div:not(.np-upload-
|
|
5586
|
-
.np-upload-item:not(:first-child).np-upload-
|
|
5580
|
+
.np-upload-item:first-child ~ div:not(.np-upload-item__link):before,
|
|
5581
|
+
.np-upload-item:not(:first-child).np-upload-item__link .np-upload-item--link:before {
|
|
5587
5582
|
top: 0;
|
|
5588
5583
|
}
|
|
5589
|
-
.np-upload-item.np-upload-
|
|
5584
|
+
.np-upload-item.np-upload-item__link:hover .np-upload-item--link:after {
|
|
5590
5585
|
bottom: -1px;
|
|
5591
5586
|
}
|
|
5592
5587
|
.np-upload-item:first-child ~ div {
|
|
5593
5588
|
border-top: 1px;
|
|
5594
5589
|
}
|
|
5595
|
-
.np-upload-item:not(:first-child) .np-upload-
|
|
5590
|
+
.np-upload-item:not(:first-child) .np-upload-item--link:hover {
|
|
5596
5591
|
border-top-color: rgba(0,0,0,0.10196);
|
|
5597
5592
|
border-top-color: var(--color-border-neutral);
|
|
5598
5593
|
}
|
|
5599
5594
|
.np-upload-item:not(:last-child) {
|
|
5600
5595
|
border-bottom: 0;
|
|
5601
5596
|
}
|
|
5602
|
-
.np-upload-item.np-upload-
|
|
5603
|
-
.np-upload-item.np-upload-
|
|
5604
|
-
.np-upload-item.np-upload-
|
|
5605
|
-
.np-upload-item.np-upload-
|
|
5597
|
+
.np-upload-item.np-upload-item__link:hover + .np-upload-item:before,
|
|
5598
|
+
.np-upload-item.np-upload-item__link:hover + .np-upload-button-container:before,
|
|
5599
|
+
.np-upload-item.np-upload-item__link:hover + .np-upload-item .np-upload-item--link:before,
|
|
5600
|
+
.np-upload-item.np-upload-item__link:hover + .np-upload-button-container .np-upload-item--link:before {
|
|
5606
5601
|
display: none;
|
|
5607
5602
|
}
|
|
5608
5603
|
.np-upload-button-container:hover:before,
|
|
@@ -5617,41 +5612,38 @@ label.np-upload-button:not(.disabled):active {
|
|
|
5617
5612
|
outline-offset: -3px;
|
|
5618
5613
|
}
|
|
5619
5614
|
.np-upload-item--single-file:focus-visible,
|
|
5620
|
-
.np-upload-
|
|
5615
|
+
.np-upload-item--link:focus-visible,
|
|
5621
5616
|
.np-upload-button-container:has(:focus-visible) {
|
|
5622
5617
|
outline-width: 3px;
|
|
5623
5618
|
}
|
|
5624
|
-
.np-upload-
|
|
5619
|
+
.np-upload-item__link a {
|
|
5625
5620
|
flex: 1;
|
|
5626
5621
|
-webkit-text-decoration: none;
|
|
5627
5622
|
text-decoration: none;
|
|
5628
5623
|
border-top: 1px solid transparent;
|
|
5629
5624
|
border-radius: inherit;
|
|
5630
5625
|
}
|
|
5631
|
-
.np-upload-
|
|
5626
|
+
.np-upload-item__link a:focus-visible {
|
|
5632
5627
|
outline-offset: -2px;
|
|
5633
5628
|
}
|
|
5634
|
-
.np-upload-
|
|
5629
|
+
.np-upload-item__link a:hover:before {
|
|
5635
5630
|
display: none !important;
|
|
5636
5631
|
}
|
|
5637
|
-
.np-upload-
|
|
5632
|
+
.np-upload-item__link a:hover:after {
|
|
5638
5633
|
left: 0 !important;
|
|
5639
5634
|
width: 100% !important;
|
|
5640
5635
|
}
|
|
5641
|
-
.np-upload-
|
|
5642
|
-
.np-upload-
|
|
5636
|
+
.np-upload-item__link a:hover,
|
|
5637
|
+
.np-upload-item__link a:active {
|
|
5643
5638
|
-webkit-text-decoration: none;
|
|
5644
5639
|
text-decoration: none;
|
|
5645
5640
|
}
|
|
5646
|
-
.np-upload-
|
|
5647
|
-
.np-upload-
|
|
5641
|
+
.np-upload-item__link a:hover .np-upload-button,
|
|
5642
|
+
.np-upload-item__link a:active .np-upload-button {
|
|
5648
5643
|
background-color: rgba(134,167,189,0.10196);
|
|
5649
5644
|
background-color: var(--color-background-neutral);
|
|
5650
5645
|
border-radius: inherit;
|
|
5651
5646
|
}
|
|
5652
|
-
.np-upload-item--link:first-of-type a {
|
|
5653
|
-
border-top: 0;
|
|
5654
|
-
}
|
|
5655
5647
|
.np-upload-item__body {
|
|
5656
5648
|
display: flex;
|
|
5657
5649
|
align-items: center;
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { ReactNode, useId, useRef } from 'react';
|
|
2
|
+
import { ReactNode, useContext, useId, useRef } from 'react';
|
|
3
3
|
import { CSSTransition } from 'react-transition-group';
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -21,6 +21,7 @@ import { CloseButton } from '../common/closeButton';
|
|
|
21
21
|
import { useLayout } from '../common/hooks';
|
|
22
22
|
import Dimmer from '../dimmer';
|
|
23
23
|
import Drawer from '../drawer';
|
|
24
|
+
import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider';
|
|
24
25
|
import Title from '../title/Title';
|
|
25
26
|
|
|
26
27
|
const TRANSITION_DURATION_IN_MILLISECONDS = 150;
|
|
@@ -61,6 +62,8 @@ const Modal = ({
|
|
|
61
62
|
const contentReference = useRef<HTMLDivElement>(null);
|
|
62
63
|
const titleId = useId();
|
|
63
64
|
|
|
65
|
+
const overlayId = useContext(OverlayIdContext);
|
|
66
|
+
|
|
64
67
|
return !isMedium ? (
|
|
65
68
|
<Drawer
|
|
66
69
|
open={open}
|
|
@@ -100,6 +103,7 @@ const Modal = ({
|
|
|
100
103
|
{...otherProps}
|
|
101
104
|
>
|
|
102
105
|
<div
|
|
106
|
+
id={overlayId}
|
|
103
107
|
role="dialog"
|
|
104
108
|
aria-modal
|
|
105
109
|
aria-labelledby={titleId}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useId } from 'react';
|
|
2
|
+
|
|
3
|
+
export const OverlayIdContext = createContext<string | undefined>(undefined);
|
|
4
|
+
|
|
5
|
+
export type OverlayIdProviderProps = {
|
|
6
|
+
open: boolean;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const OverlayIdProvider = ({ open, children }: OverlayIdProviderProps) => {
|
|
11
|
+
const id = useId();
|
|
12
|
+
return (
|
|
13
|
+
<OverlayIdContext.Provider value={open ? id : undefined}>{children}</OverlayIdContext.Provider>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -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,41 +52,38 @@
|
|
|
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
|
-
}
|
|
90
87
|
.np-upload-item__body {
|
|
91
88
|
display: flex;
|
|
92
89
|
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,10 +103,6 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
&:first-of-type a {
|
|
108
|
-
border-top: 0;
|
|
109
|
-
}
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
.np-upload-item__body {
|
|
@@ -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 { UploadItemBody } from './UploadItemBody';
|
|
13
13
|
|
|
14
14
|
export type UploadItemProps = JSX.IntrinsicAttributes & {
|
|
15
15
|
file: UploadedFile;
|
|
@@ -127,11 +127,11 @@ const UploadItem = ({
|
|
|
127
127
|
|
|
128
128
|
return (
|
|
129
129
|
<div
|
|
130
|
-
className={classNames('np-upload-item', { 'np-upload-
|
|
130
|
+
className={classNames('np-upload-item', { 'np-upload-item__link': isSucceeded })}
|
|
131
131
|
data-testid={TEST_IDS.uploadItem}
|
|
132
132
|
>
|
|
133
133
|
<div className="np-upload-item__body">
|
|
134
|
-
<
|
|
134
|
+
<UploadItemBody
|
|
135
135
|
url={isSucceeded ? url : undefined}
|
|
136
136
|
singleFileUpload={singleFileUpload}
|
|
137
137
|
onDownload={onDownloadFile}
|
|
@@ -145,7 +145,7 @@ const UploadItem = ({
|
|
|
145
145
|
</div>
|
|
146
146
|
</div>
|
|
147
147
|
</div>
|
|
148
|
-
</
|
|
148
|
+
</UploadItemBody>
|
|
149
149
|
{canDelete && (
|
|
150
150
|
<button
|
|
151
151
|
aria-label={formatMessage(MESSAGES.removeFile, { filename })}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren, MouseEvent } from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
2
|
|
|
4
3
|
type UploadItemLinkProps = PropsWithChildren<{
|
|
5
4
|
url?: string;
|
|
@@ -7,7 +6,7 @@ type UploadItemLinkProps = PropsWithChildren<{
|
|
|
7
6
|
singleFileUpload: boolean;
|
|
8
7
|
}>;
|
|
9
8
|
|
|
10
|
-
export const
|
|
9
|
+
export const UploadItemBody = ({
|
|
11
10
|
children,
|
|
12
11
|
url,
|
|
13
12
|
onDownload,
|
|
@@ -22,10 +21,7 @@ export const UploadItemLink = ({
|
|
|
22
21
|
href={url}
|
|
23
22
|
target="_blank"
|
|
24
23
|
rel="noopener noreferrer"
|
|
25
|
-
className={
|
|
26
|
-
'np-upload-item__link',
|
|
27
|
-
singleFileUpload ? 'np-upload-item--single-file' : '',
|
|
28
|
-
)}
|
|
24
|
+
className={singleFileUpload ? 'np-upload-item--single-file' : 'np-upload-item--link'}
|
|
29
25
|
onClick={onDownload}
|
|
30
26
|
>
|
|
31
27
|
{children}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemLink.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGtD,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,gCAmBrB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var classNames = require('classnames');
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
9
|
-
|
|
10
|
-
const UploadItemLink = ({
|
|
11
|
-
children,
|
|
12
|
-
url,
|
|
13
|
-
onDownload,
|
|
14
|
-
singleFileUpload
|
|
15
|
-
}) => {
|
|
16
|
-
if (!url) {
|
|
17
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
22
|
-
href: url,
|
|
23
|
-
target: "_blank",
|
|
24
|
-
rel: "noopener noreferrer",
|
|
25
|
-
className: classNames__default.default('np-upload-item__link', singleFileUpload ? 'np-upload-item--single-file' : ''),
|
|
26
|
-
onClick: onDownload,
|
|
27
|
-
children: children
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
exports.UploadItemLink = UploadItemLink;
|
|
32
|
-
//# sourceMappingURL=UploadItemLink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemLink.js","sources":["../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\nimport classnames from 'classnames';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemLink = ({\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={classnames(\n 'np-upload-item__link',\n singleFileUpload ? 'np-upload-item--single-file' : '',\n )}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemLink","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","classnames","onClick"],"mappings":";;;;;;;;;AASO,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;IACzBC,SAAS,EAAEC,2BAAU,CACnB,sBAAsB,EACtBN,gBAAgB,GAAG,6BAA6B,GAAG,EAAE,CACrD;AACFO,IAAAA,OAAO,EAAER,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItemLink.mjs","sources":["../../../src/uploadInput/uploadItem/UploadItemLink.tsx"],"sourcesContent":["import { PropsWithChildren, MouseEvent } from 'react';\nimport classnames from 'classnames';\n\ntype UploadItemLinkProps = PropsWithChildren<{\n url?: string;\n onDownload?: (event: MouseEvent) => void;\n singleFileUpload: boolean;\n}>;\n\nexport const UploadItemLink = ({\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={classnames(\n 'np-upload-item__link',\n singleFileUpload ? 'np-upload-item--single-file' : '',\n )}\n onClick={onDownload}\n >\n {children}\n </a>\n );\n};\n"],"names":["UploadItemLink","children","url","onDownload","singleFileUpload","_jsx","href","target","rel","className","classnames","onClick"],"mappings":";;;AASO,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;IACzBC,SAAS,EAAEC,UAAU,CACnB,sBAAsB,EACtBN,gBAAgB,GAAG,6BAA6B,GAAG,EAAE,CACrD;AACFO,IAAAA,OAAO,EAAER,UAAW;AAAAF,IAAAA,QAAA,EAEnBA,QAAAA;AAAQ,GACR,CAAC,CAAA;AAER;;;;"}
|