@transferwise/components 0.0.0-experimental-63cdd4d → 0.0.0-experimental-0f1fe62
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/index.esm.js +152 -164
- package/build/index.esm.js.map +1 -1
- package/build/index.js +152 -164
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/actionButton/ActionButton.css +1 -1
- package/build/styles/chips/Chip.css +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -1
- package/build/styles/common/Option/Option.css +1 -1
- package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/drawer/Drawer.css +1 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/styles/statusIcon/StatusIcon.css +1 -1
- package/build/styles/summary/Summary.css +1 -1
- package/build/styles/typeahead/Typeahead.css +1 -1
- package/build/styles/uploadInput/UploadInput.css +1 -1
- package/build/types/chips/Chip.d.ts +3 -2
- package/build/types/chips/Chip.d.ts.map +1 -1
- package/build/types/chips/Chips.d.ts +4 -2
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/propsValues/breakpoint.d.ts +0 -1
- package/build/types/common/propsValues/breakpoint.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +1 -11
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionButton/ActionButton.css +1 -1
- package/src/actionButton/ActionButton.less +1 -5
- package/src/chips/Chip.css +1 -1
- package/src/chips/Chip.less +42 -32
- package/src/chips/Chip.tsx +15 -1
- package/src/chips/Chips.tsx +5 -1
- package/src/chips/__snapshots__/Chips.spec.tsx.snap +8 -8
- package/src/circularButton/CircularButton.css +1 -1
- package/src/circularButton/CircularButton.less +3 -9
- package/src/common/Option/Option.css +1 -1
- package/src/common/Option/Option.less +0 -6
- package/src/common/bottomSheet/BottomSheet.css +1 -1
- package/src/common/bottomSheet/BottomSheet.less +1 -1
- package/src/common/bottomSheet/BottomSheet.spec.tsx +1 -4
- package/src/common/bottomSheet/BottomSheet.story.tsx +0 -4
- package/src/common/bottomSheet/BottomSheet.tsx +1 -10
- package/src/common/closeButton/CloseButton.css +1 -1
- package/src/common/closeButton/CloseButton.less +0 -12
- package/src/common/hooks/useMedia.spec.ts +17 -3
- package/src/common/propsValues/breakpoint.ts +0 -1
- package/src/dateLookup/DateLookup.css +1 -1
- package/src/dateLookup/DateLookup.js +3 -7
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +0 -3
- package/src/dateLookup/DateLookup.less +0 -6
- package/src/dateLookup/DateLookup.story.js +1 -6
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +1 -3
- package/src/dateLookup/DateLookup.view.spec.js +0 -4
- package/src/dateLookup/dateHeader/DateHeader.js +2 -4
- package/src/drawer/Drawer.css +1 -1
- package/src/drawer/Drawer.less +0 -6
- package/src/drawer/Drawer.story.js +2 -42
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/main.css +1 -1
- package/src/modal/Modal.tsx +2 -2
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/popover/Popover.spec.js +1 -3
- package/src/select/Select.spec.js +9 -6
- package/src/statusIcon/StatusIcon.css +1 -1
- package/src/statusIcon/StatusIcon.less +0 -10
- package/src/summary/Summary.css +1 -1
- package/src/summary/Summary.less +1 -1
- package/src/test-utils/index.js +0 -1
- package/src/test-utils/story-config.ts +7 -21
- package/src/typeahead/Typeahead.css +1 -1
- package/src/typeahead/Typeahead.less +6 -5
- package/src/uploadInput/UploadInput.css +1 -1
- package/src/uploadInput/UploadInput.less +1 -5
- package/build/types/test-utils/window-mock.d.ts +0 -2
- package/build/types/test-utils/window-mock.d.ts.map +0 -1
- package/src/test-utils/window-mock.ts +0 -19
package/build/index.esm.js
CHANGED
|
@@ -13,11 +13,11 @@ import { CSSTransition } from 'react-transition-group';
|
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
14
14
|
import { FocusScope } from '@react-aria/focus';
|
|
15
15
|
import mergeRefs from 'react-merge-refs';
|
|
16
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
17
16
|
import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
|
|
18
17
|
import { usePopper } from 'react-popper';
|
|
19
18
|
import { Transition, Listbox } from '@headlessui/react';
|
|
20
19
|
import mergeProps from 'merge-props';
|
|
20
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
21
21
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, offset, flip, shift, size, autoUpdate } from '@floating-ui/react';
|
|
22
22
|
import { usePreventScroll } from '@react-aria/overlays';
|
|
23
23
|
import { Illustration } from '@wise/art';
|
|
@@ -158,7 +158,6 @@ var Priority;
|
|
|
158
158
|
|
|
159
159
|
var Breakpoint;
|
|
160
160
|
(function (Breakpoint) {
|
|
161
|
-
Breakpoint[Breakpoint["ZOOM_400"] = 385] = "ZOOM_400";
|
|
162
161
|
Breakpoint[Breakpoint["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
163
162
|
Breakpoint[Breakpoint["SMALL"] = 576] = "SMALL";
|
|
164
163
|
Breakpoint[Breakpoint["MEDIUM"] = 768] = "MEDIUM";
|
|
@@ -1707,6 +1706,58 @@ const DimmerContentWrapper = ({
|
|
|
1707
1706
|
};
|
|
1708
1707
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1709
1708
|
|
|
1709
|
+
const EXIT_ANIMATION = 350;
|
|
1710
|
+
const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
1711
|
+
children,
|
|
1712
|
+
className,
|
|
1713
|
+
open,
|
|
1714
|
+
position,
|
|
1715
|
+
showSlidingPanelBorder,
|
|
1716
|
+
slidingPanelPositionFixed,
|
|
1717
|
+
...rest
|
|
1718
|
+
}, reference) => {
|
|
1719
|
+
/** @type {RefObject<HTMLDivElement>} */
|
|
1720
|
+
const localReference = useRef(null);
|
|
1721
|
+
return /*#__PURE__*/jsx(CSSTransition, {
|
|
1722
|
+
...rest,
|
|
1723
|
+
nodeRef: localReference,
|
|
1724
|
+
in: open
|
|
1725
|
+
// Wait for animation to finish before unmount.
|
|
1726
|
+
,
|
|
1727
|
+
timeout: {
|
|
1728
|
+
enter: 0,
|
|
1729
|
+
exit: EXIT_ANIMATION
|
|
1730
|
+
},
|
|
1731
|
+
classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1732
|
+
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1733
|
+
}, 'sliding-panel'),
|
|
1734
|
+
appear: true,
|
|
1735
|
+
unmountOnExit: true,
|
|
1736
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1737
|
+
ref: mergeRefs([reference, localReference]),
|
|
1738
|
+
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1739
|
+
children: children
|
|
1740
|
+
})
|
|
1741
|
+
});
|
|
1742
|
+
});
|
|
1743
|
+
SlidingPanel.propTypes = {
|
|
1744
|
+
children: PropTypes.node,
|
|
1745
|
+
className: PropTypes.string,
|
|
1746
|
+
open: PropTypes.bool,
|
|
1747
|
+
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1748
|
+
showSlidingPanelBorder: PropTypes.bool,
|
|
1749
|
+
slidingPanelPositionFixed: PropTypes.bool
|
|
1750
|
+
};
|
|
1751
|
+
SlidingPanel.defaultProps = {
|
|
1752
|
+
children: null,
|
|
1753
|
+
className: undefined,
|
|
1754
|
+
open: false,
|
|
1755
|
+
position: 'left',
|
|
1756
|
+
showSlidingPanelBorder: false,
|
|
1757
|
+
slidingPanelPositionFixed: false
|
|
1758
|
+
};
|
|
1759
|
+
var SlidingPanel$1 = SlidingPanel;
|
|
1760
|
+
|
|
1710
1761
|
const THROTTLE_MS = 100;
|
|
1711
1762
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1712
1763
|
const useClientWidth = ({
|
|
@@ -1877,137 +1928,6 @@ const useLayout = () => {
|
|
|
1877
1928
|
};
|
|
1878
1929
|
};
|
|
1879
1930
|
|
|
1880
|
-
const EXIT_ANIMATION = 350;
|
|
1881
|
-
const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
1882
|
-
children,
|
|
1883
|
-
className,
|
|
1884
|
-
open,
|
|
1885
|
-
position,
|
|
1886
|
-
showSlidingPanelBorder,
|
|
1887
|
-
slidingPanelPositionFixed,
|
|
1888
|
-
...rest
|
|
1889
|
-
}, reference) => {
|
|
1890
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1891
|
-
const localReference = useRef(null);
|
|
1892
|
-
return /*#__PURE__*/jsx(CSSTransition, {
|
|
1893
|
-
...rest,
|
|
1894
|
-
nodeRef: localReference,
|
|
1895
|
-
in: open
|
|
1896
|
-
// Wait for animation to finish before unmount.
|
|
1897
|
-
,
|
|
1898
|
-
timeout: {
|
|
1899
|
-
enter: 0,
|
|
1900
|
-
exit: EXIT_ANIMATION
|
|
1901
|
-
},
|
|
1902
|
-
classNames: classNames(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1903
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1904
|
-
}, 'sliding-panel'),
|
|
1905
|
-
appear: true,
|
|
1906
|
-
unmountOnExit: true,
|
|
1907
|
-
children: /*#__PURE__*/jsx("div", {
|
|
1908
|
-
ref: mergeRefs([reference, localReference]),
|
|
1909
|
-
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1910
|
-
children: children
|
|
1911
|
-
})
|
|
1912
|
-
});
|
|
1913
|
-
});
|
|
1914
|
-
SlidingPanel.propTypes = {
|
|
1915
|
-
children: PropTypes.node,
|
|
1916
|
-
className: PropTypes.string,
|
|
1917
|
-
open: PropTypes.bool,
|
|
1918
|
-
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1919
|
-
showSlidingPanelBorder: PropTypes.bool,
|
|
1920
|
-
slidingPanelPositionFixed: PropTypes.bool
|
|
1921
|
-
};
|
|
1922
|
-
SlidingPanel.defaultProps = {
|
|
1923
|
-
children: null,
|
|
1924
|
-
className: undefined,
|
|
1925
|
-
open: false,
|
|
1926
|
-
position: 'left',
|
|
1927
|
-
showSlidingPanelBorder: false,
|
|
1928
|
-
slidingPanelPositionFixed: false
|
|
1929
|
-
};
|
|
1930
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1931
|
-
|
|
1932
|
-
const Drawer = ({
|
|
1933
|
-
children,
|
|
1934
|
-
className,
|
|
1935
|
-
footerContent,
|
|
1936
|
-
headerTitle,
|
|
1937
|
-
onClose,
|
|
1938
|
-
open,
|
|
1939
|
-
position
|
|
1940
|
-
}) => {
|
|
1941
|
-
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
1942
|
-
const {
|
|
1943
|
-
isMobile
|
|
1944
|
-
} = useLayout();
|
|
1945
|
-
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
1946
|
-
open: open,
|
|
1947
|
-
onClose: onClose,
|
|
1948
|
-
children: /*#__PURE__*/jsx(SlidingPanel$1, {
|
|
1949
|
-
open: open,
|
|
1950
|
-
position: isMobile ? Position.BOTTOM : position,
|
|
1951
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
1952
|
-
className: classNames('np-drawer', className),
|
|
1953
|
-
role: "dialog",
|
|
1954
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
1955
|
-
className: classNames('np-drawer-header', {
|
|
1956
|
-
'np-drawer-header--withborder': headerTitle
|
|
1957
|
-
}),
|
|
1958
|
-
children: [headerTitle && /*#__PURE__*/jsx(Title, {
|
|
1959
|
-
type: Typography.TITLE_BODY,
|
|
1960
|
-
children: headerTitle
|
|
1961
|
-
}), /*#__PURE__*/jsx(CloseButton, {
|
|
1962
|
-
onClick: onClose
|
|
1963
|
-
})]
|
|
1964
|
-
}), children && /*#__PURE__*/jsx("div", {
|
|
1965
|
-
className: classNames('np-drawer-content'),
|
|
1966
|
-
children: children
|
|
1967
|
-
}), footerContent && /*#__PURE__*/jsx("div", {
|
|
1968
|
-
className: classNames('np-drawer-footer'),
|
|
1969
|
-
children: footerContent
|
|
1970
|
-
})]
|
|
1971
|
-
})
|
|
1972
|
-
})
|
|
1973
|
-
});
|
|
1974
|
-
};
|
|
1975
|
-
Drawer.propTypes = {
|
|
1976
|
-
/** The content to appear in the drawer body. */
|
|
1977
|
-
children: PropTypes.node,
|
|
1978
|
-
className: PropTypes.string,
|
|
1979
|
-
/** The content to appear in the drawer footer. */
|
|
1980
|
-
footerContent: PropTypes.node,
|
|
1981
|
-
/** The content to appear in the drawer header. */
|
|
1982
|
-
headerTitle: PropTypes.node,
|
|
1983
|
-
/** The action to perform on close click. */
|
|
1984
|
-
onClose: PropTypes.func,
|
|
1985
|
-
/** The status of Drawer either open or not. */
|
|
1986
|
-
open: PropTypes.bool,
|
|
1987
|
-
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
1988
|
-
position: PropTypes.oneOf(['left', 'right', 'bottom'])
|
|
1989
|
-
};
|
|
1990
|
-
Drawer.defaultProps = {
|
|
1991
|
-
children: null,
|
|
1992
|
-
className: undefined,
|
|
1993
|
-
footerContent: null,
|
|
1994
|
-
headerTitle: null,
|
|
1995
|
-
onClose: null,
|
|
1996
|
-
open: false,
|
|
1997
|
-
position: Position.RIGHT
|
|
1998
|
-
};
|
|
1999
|
-
var Drawer$1 = Drawer;
|
|
2000
|
-
|
|
2001
|
-
function useMedia(query) {
|
|
2002
|
-
return useSyncExternalStore(onStoreChange => {
|
|
2003
|
-
const mediaQueryList = window.matchMedia(query);
|
|
2004
|
-
mediaQueryList.addEventListener('change', onStoreChange);
|
|
2005
|
-
return () => {
|
|
2006
|
-
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
2007
|
-
};
|
|
2008
|
-
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
1931
|
const INITIAL_Y_POSITION = 0;
|
|
2012
1932
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
2013
1933
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2135,13 +2055,7 @@ const BottomSheet$1 = props => {
|
|
|
2135
2055
|
maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
|
|
2136
2056
|
};
|
|
2137
2057
|
}
|
|
2138
|
-
|
|
2139
|
-
return is400Zoom ? /*#__PURE__*/jsx(Drawer$1, {
|
|
2140
|
-
open: props.open,
|
|
2141
|
-
className: props.className,
|
|
2142
|
-
onClose: close,
|
|
2143
|
-
children: props.children
|
|
2144
|
-
}) : /*#__PURE__*/jsx(Dimmer$1, {
|
|
2058
|
+
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
2145
2059
|
open: props.open,
|
|
2146
2060
|
fadeContentOnEnter: true,
|
|
2147
2061
|
fadeContentOnExit: true,
|
|
@@ -2313,7 +2227,7 @@ const typeClassMap$1 = {
|
|
|
2313
2227
|
[ControlType.POSITIVE]: 'btn-positive',
|
|
2314
2228
|
[ControlType.NEGATIVE]: 'btn-negative'
|
|
2315
2229
|
};
|
|
2316
|
-
const priorityClassMap = {
|
|
2230
|
+
const priorityClassMap$1 = {
|
|
2317
2231
|
[Priority.PRIMARY]: 'btn-priority-1',
|
|
2318
2232
|
[Priority.SECONDARY]: 'btn-priority-2',
|
|
2319
2233
|
[Priority.TERTIARY]: 'btn-priority-3'
|
|
@@ -2395,7 +2309,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
2395
2309
|
typeClassMap$1[newType],
|
|
2396
2310
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2397
2311
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2398
|
-
priorityClassMap[newPriority], className);
|
|
2312
|
+
priorityClassMap$1[newPriority], className);
|
|
2399
2313
|
function processIndicatorSize() {
|
|
2400
2314
|
return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';
|
|
2401
2315
|
}
|
|
@@ -2659,6 +2573,10 @@ const CheckboxOption = /*#__PURE__*/forwardRef(({
|
|
|
2659
2573
|
});
|
|
2660
2574
|
});
|
|
2661
2575
|
|
|
2576
|
+
const priorityClassMap = {
|
|
2577
|
+
[Priority.PRIMARY]: 'np-chip--priority-1',
|
|
2578
|
+
[Priority.SECONDARY]: 'np-chip--priority-2'
|
|
2579
|
+
};
|
|
2662
2580
|
const Chip = ({
|
|
2663
2581
|
label,
|
|
2664
2582
|
value,
|
|
@@ -2669,7 +2587,8 @@ const Chip = ({
|
|
|
2669
2587
|
'aria-label': ariaLabel,
|
|
2670
2588
|
'aria-checked': ariaChecked,
|
|
2671
2589
|
role,
|
|
2672
|
-
closeButton
|
|
2590
|
+
closeButton,
|
|
2591
|
+
priority = Priority.PRIMARY
|
|
2673
2592
|
}) => {
|
|
2674
2593
|
const isActionable = onClick || onKeyPress;
|
|
2675
2594
|
const defaultRole = isActionable ? 'button' : undefined;
|
|
@@ -2690,7 +2609,7 @@ const Chip = ({
|
|
|
2690
2609
|
tabIndex: tabIndex,
|
|
2691
2610
|
"aria-label": ariaLabel,
|
|
2692
2611
|
"aria-checked": ariaChecked,
|
|
2693
|
-
className: classNames('np-chip', 'd-flex', 'align-items-center', 'justify-content-between', onRemove ? 'np-chip--removable' : '', className),
|
|
2612
|
+
className: classNames('np-chip', 'd-flex', 'align-items-center', 'justify-content-between', onRemove ? 'np-chip--removable' : '', priorityClassMap[priority], className),
|
|
2694
2613
|
...(isActionable && {
|
|
2695
2614
|
onClick,
|
|
2696
2615
|
onKeyPress
|
|
@@ -2726,7 +2645,8 @@ const Chips = ({
|
|
|
2726
2645
|
selected,
|
|
2727
2646
|
'aria-label': ariaLabel,
|
|
2728
2647
|
className,
|
|
2729
|
-
multiple
|
|
2648
|
+
multiple,
|
|
2649
|
+
priority
|
|
2730
2650
|
}) => {
|
|
2731
2651
|
const intl = useIntl();
|
|
2732
2652
|
const isSelected = value => Array.isArray(selected) ? selected.includes(value) : selected === value;
|
|
@@ -2754,6 +2674,7 @@ const Chips = ({
|
|
|
2754
2674
|
'np-chip--selected': chipSelected,
|
|
2755
2675
|
'p-r-1': multiple && chipSelected
|
|
2756
2676
|
}),
|
|
2677
|
+
priority: priority,
|
|
2757
2678
|
...(multiple && chipSelected ? {
|
|
2758
2679
|
onRemove: () => handleOnChange(chip.value, chipSelected),
|
|
2759
2680
|
'aria-label': chip.label
|
|
@@ -2777,7 +2698,7 @@ const CircularButton = ({
|
|
|
2777
2698
|
type,
|
|
2778
2699
|
...rest
|
|
2779
2700
|
}) => {
|
|
2780
|
-
const classes = classNames('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
|
|
2701
|
+
const classes = classNames('btn np-btn', typeClassMap$1[type], priorityClassMap$1[priority]);
|
|
2781
2702
|
const iconElement = icon.props.size !== 24 ? /*#__PURE__*/cloneElement(icon, {
|
|
2782
2703
|
size: 24
|
|
2783
2704
|
}) : icon;
|
|
@@ -3497,11 +3418,8 @@ const DateHeader = ({
|
|
|
3497
3418
|
dateMode
|
|
3498
3419
|
}) => {
|
|
3499
3420
|
const intl = useIntl();
|
|
3500
|
-
const {
|
|
3501
|
-
isMobile
|
|
3502
|
-
} = useLayout();
|
|
3503
3421
|
return /*#__PURE__*/jsxs("div", {
|
|
3504
|
-
className:
|
|
3422
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3505
3423
|
children: [/*#__PURE__*/jsx("div", {
|
|
3506
3424
|
className: "pull-left-single-direction",
|
|
3507
3425
|
children: /*#__PURE__*/jsx("button", {
|
|
@@ -4097,8 +4015,7 @@ class DateLookup extends PureComponent {
|
|
|
4097
4015
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
4098
4016
|
viewYear: (props.value || new Date()).getFullYear(),
|
|
4099
4017
|
open: false,
|
|
4100
|
-
mode: MODE.DAY
|
|
4101
|
-
isMobile: false
|
|
4018
|
+
mode: MODE.DAY
|
|
4102
4019
|
};
|
|
4103
4020
|
}
|
|
4104
4021
|
static getDerivedStateFromProps(props, state) {
|
|
@@ -4133,10 +4050,6 @@ class DateLookup extends PureComponent {
|
|
|
4133
4050
|
if (+this.props.value !== +previousProps.value && this.state.open) {
|
|
4134
4051
|
this.focusOn('.active');
|
|
4135
4052
|
}
|
|
4136
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);
|
|
4137
|
-
this.setState({
|
|
4138
|
-
isMobile: this.mediaQuery.matches
|
|
4139
|
-
});
|
|
4140
4053
|
}
|
|
4141
4054
|
componentWillUnmount() {
|
|
4142
4055
|
// Prevents memory leak by cleaning state.
|
|
@@ -4269,17 +4182,14 @@ class DateLookup extends PureComponent {
|
|
|
4269
4182
|
max,
|
|
4270
4183
|
viewMonth,
|
|
4271
4184
|
viewYear,
|
|
4272
|
-
mode
|
|
4273
|
-
isMobile
|
|
4185
|
+
mode
|
|
4274
4186
|
} = this.state;
|
|
4275
4187
|
const {
|
|
4276
4188
|
placeholder,
|
|
4277
4189
|
monthFormat
|
|
4278
4190
|
} = this.props;
|
|
4279
4191
|
return /*#__PURE__*/jsxs("div", {
|
|
4280
|
-
className:
|
|
4281
|
-
'p-a-1': !isMobile
|
|
4282
|
-
}),
|
|
4192
|
+
className: "p-a-1",
|
|
4283
4193
|
children: [mode === MODE.DAY && /*#__PURE__*/jsx(DayCalendar$1, {
|
|
4284
4194
|
selectedDate,
|
|
4285
4195
|
min,
|
|
@@ -4787,6 +4697,75 @@ function Display({
|
|
|
4787
4697
|
});
|
|
4788
4698
|
}
|
|
4789
4699
|
|
|
4700
|
+
const Drawer = ({
|
|
4701
|
+
children,
|
|
4702
|
+
className,
|
|
4703
|
+
footerContent,
|
|
4704
|
+
headerTitle,
|
|
4705
|
+
onClose,
|
|
4706
|
+
open,
|
|
4707
|
+
position
|
|
4708
|
+
}) => {
|
|
4709
|
+
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
4710
|
+
const {
|
|
4711
|
+
isMobile
|
|
4712
|
+
} = useLayout();
|
|
4713
|
+
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
4714
|
+
open: open,
|
|
4715
|
+
onClose: onClose,
|
|
4716
|
+
children: /*#__PURE__*/jsx(SlidingPanel$1, {
|
|
4717
|
+
open: open,
|
|
4718
|
+
position: isMobile ? Position.BOTTOM : position,
|
|
4719
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
4720
|
+
className: classNames('np-drawer', className),
|
|
4721
|
+
role: "dialog",
|
|
4722
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
4723
|
+
className: classNames('np-drawer-header', {
|
|
4724
|
+
'np-drawer-header--withborder': headerTitle
|
|
4725
|
+
}),
|
|
4726
|
+
children: [headerTitle && /*#__PURE__*/jsx(Title, {
|
|
4727
|
+
type: Typography.TITLE_BODY,
|
|
4728
|
+
children: headerTitle
|
|
4729
|
+
}), /*#__PURE__*/jsx(CloseButton, {
|
|
4730
|
+
onClick: onClose
|
|
4731
|
+
})]
|
|
4732
|
+
}), children && /*#__PURE__*/jsx("div", {
|
|
4733
|
+
className: classNames('np-drawer-content'),
|
|
4734
|
+
children: children
|
|
4735
|
+
}), footerContent && /*#__PURE__*/jsx("div", {
|
|
4736
|
+
className: classNames('np-drawer-footer'),
|
|
4737
|
+
children: footerContent
|
|
4738
|
+
})]
|
|
4739
|
+
})
|
|
4740
|
+
})
|
|
4741
|
+
});
|
|
4742
|
+
};
|
|
4743
|
+
Drawer.propTypes = {
|
|
4744
|
+
/** The content to appear in the drawer body. */
|
|
4745
|
+
children: PropTypes.node,
|
|
4746
|
+
className: PropTypes.string,
|
|
4747
|
+
/** The content to appear in the drawer footer. */
|
|
4748
|
+
footerContent: PropTypes.node,
|
|
4749
|
+
/** The content to appear in the drawer header. */
|
|
4750
|
+
headerTitle: PropTypes.node,
|
|
4751
|
+
/** The action to perform on close click. */
|
|
4752
|
+
onClose: PropTypes.func,
|
|
4753
|
+
/** The status of Drawer either open or not. */
|
|
4754
|
+
open: PropTypes.bool,
|
|
4755
|
+
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
4756
|
+
position: PropTypes.oneOf(['left', 'right', 'bottom'])
|
|
4757
|
+
};
|
|
4758
|
+
Drawer.defaultProps = {
|
|
4759
|
+
children: null,
|
|
4760
|
+
className: undefined,
|
|
4761
|
+
footerContent: null,
|
|
4762
|
+
headerTitle: null,
|
|
4763
|
+
onClose: null,
|
|
4764
|
+
open: false,
|
|
4765
|
+
position: Position.RIGHT
|
|
4766
|
+
};
|
|
4767
|
+
var Drawer$1 = Drawer;
|
|
4768
|
+
|
|
4790
4769
|
const DropFade = ({
|
|
4791
4770
|
children,
|
|
4792
4771
|
show
|
|
@@ -5919,14 +5898,13 @@ const Modal = ({
|
|
|
5919
5898
|
}) => {
|
|
5920
5899
|
const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
|
|
5921
5900
|
const {
|
|
5922
|
-
isMobile
|
|
5923
|
-
isMedium: isTablet
|
|
5901
|
+
isMobile
|
|
5924
5902
|
} = useLayout();
|
|
5925
5903
|
// These should be replaced with props in breaking change.
|
|
5926
5904
|
const isCompact = checkSpecialClasses('compact');
|
|
5927
5905
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5928
5906
|
const contentReference = useRef(null);
|
|
5929
|
-
return isMobile
|
|
5907
|
+
return isMobile ? /*#__PURE__*/jsx(Drawer$1, {
|
|
5930
5908
|
open: open,
|
|
5931
5909
|
headerTitle: title,
|
|
5932
5910
|
footerContent: footer,
|
|
@@ -6349,6 +6327,16 @@ const SearchInput = /*#__PURE__*/forwardRef(function SearchInput({
|
|
|
6349
6327
|
});
|
|
6350
6328
|
});
|
|
6351
6329
|
|
|
6330
|
+
function useMedia(query) {
|
|
6331
|
+
return useSyncExternalStore(onStoreChange => {
|
|
6332
|
+
const mediaQueryList = window.matchMedia(query);
|
|
6333
|
+
mediaQueryList.addEventListener('change', onStoreChange);
|
|
6334
|
+
return () => {
|
|
6335
|
+
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
6336
|
+
};
|
|
6337
|
+
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
6338
|
+
}
|
|
6339
|
+
|
|
6352
6340
|
function useScreenSize(size) {
|
|
6353
6341
|
return useMedia(`(min-width: ${size}px)`);
|
|
6354
6342
|
}
|