@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.js
CHANGED
|
@@ -14,11 +14,11 @@ var reactTransitionGroup = require('react-transition-group');
|
|
|
14
14
|
var reactDom = require('react-dom');
|
|
15
15
|
var focus = require('@react-aria/focus');
|
|
16
16
|
var mergeRefs = require('react-merge-refs');
|
|
17
|
-
var shim = require('use-sync-external-store/shim');
|
|
18
17
|
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
19
18
|
var reactPopper = require('react-popper');
|
|
20
19
|
var react$1 = require('@headlessui/react');
|
|
21
20
|
var mergeProps = require('merge-props');
|
|
21
|
+
var shim = require('use-sync-external-store/shim');
|
|
22
22
|
var react = require('@floating-ui/react');
|
|
23
23
|
var overlays = require('@react-aria/overlays');
|
|
24
24
|
var art = require('@wise/art');
|
|
@@ -192,7 +192,6 @@ exports.Priority = void 0;
|
|
|
192
192
|
|
|
193
193
|
exports.Breakpoint = void 0;
|
|
194
194
|
(function (Breakpoint) {
|
|
195
|
-
Breakpoint[Breakpoint["ZOOM_400"] = 385] = "ZOOM_400";
|
|
196
195
|
Breakpoint[Breakpoint["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
197
196
|
Breakpoint[Breakpoint["SMALL"] = 576] = "SMALL";
|
|
198
197
|
Breakpoint[Breakpoint["MEDIUM"] = 768] = "MEDIUM";
|
|
@@ -1741,6 +1740,58 @@ const DimmerContentWrapper = ({
|
|
|
1741
1740
|
};
|
|
1742
1741
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1743
1742
|
|
|
1743
|
+
const EXIT_ANIMATION = 350;
|
|
1744
|
+
const SlidingPanel = /*#__PURE__*/React.forwardRef(({
|
|
1745
|
+
children,
|
|
1746
|
+
className,
|
|
1747
|
+
open,
|
|
1748
|
+
position,
|
|
1749
|
+
showSlidingPanelBorder,
|
|
1750
|
+
slidingPanelPositionFixed,
|
|
1751
|
+
...rest
|
|
1752
|
+
}, reference) => {
|
|
1753
|
+
/** @type {RefObject<HTMLDivElement>} */
|
|
1754
|
+
const localReference = React.useRef(null);
|
|
1755
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
|
|
1756
|
+
...rest,
|
|
1757
|
+
nodeRef: localReference,
|
|
1758
|
+
in: open
|
|
1759
|
+
// Wait for animation to finish before unmount.
|
|
1760
|
+
,
|
|
1761
|
+
timeout: {
|
|
1762
|
+
enter: 0,
|
|
1763
|
+
exit: EXIT_ANIMATION
|
|
1764
|
+
},
|
|
1765
|
+
classNames: classNames__default.default(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1766
|
+
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1767
|
+
}, 'sliding-panel'),
|
|
1768
|
+
appear: true,
|
|
1769
|
+
unmountOnExit: true,
|
|
1770
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1771
|
+
ref: mergeRefs__default.default([reference, localReference]),
|
|
1772
|
+
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1773
|
+
children: children
|
|
1774
|
+
})
|
|
1775
|
+
});
|
|
1776
|
+
});
|
|
1777
|
+
SlidingPanel.propTypes = {
|
|
1778
|
+
children: PropTypes__default.default.node,
|
|
1779
|
+
className: PropTypes__default.default.string,
|
|
1780
|
+
open: PropTypes__default.default.bool,
|
|
1781
|
+
position: PropTypes__default.default.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1782
|
+
showSlidingPanelBorder: PropTypes__default.default.bool,
|
|
1783
|
+
slidingPanelPositionFixed: PropTypes__default.default.bool
|
|
1784
|
+
};
|
|
1785
|
+
SlidingPanel.defaultProps = {
|
|
1786
|
+
children: null,
|
|
1787
|
+
className: undefined,
|
|
1788
|
+
open: false,
|
|
1789
|
+
position: 'left',
|
|
1790
|
+
showSlidingPanelBorder: false,
|
|
1791
|
+
slidingPanelPositionFixed: false
|
|
1792
|
+
};
|
|
1793
|
+
var SlidingPanel$1 = SlidingPanel;
|
|
1794
|
+
|
|
1744
1795
|
const THROTTLE_MS = 100;
|
|
1745
1796
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1746
1797
|
const useClientWidth = ({
|
|
@@ -1911,137 +1962,6 @@ const useLayout = () => {
|
|
|
1911
1962
|
};
|
|
1912
1963
|
};
|
|
1913
1964
|
|
|
1914
|
-
const EXIT_ANIMATION = 350;
|
|
1915
|
-
const SlidingPanel = /*#__PURE__*/React.forwardRef(({
|
|
1916
|
-
children,
|
|
1917
|
-
className,
|
|
1918
|
-
open,
|
|
1919
|
-
position,
|
|
1920
|
-
showSlidingPanelBorder,
|
|
1921
|
-
slidingPanelPositionFixed,
|
|
1922
|
-
...rest
|
|
1923
|
-
}, reference) => {
|
|
1924
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1925
|
-
const localReference = React.useRef(null);
|
|
1926
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactTransitionGroup.CSSTransition, {
|
|
1927
|
-
...rest,
|
|
1928
|
-
nodeRef: localReference,
|
|
1929
|
-
in: open
|
|
1930
|
-
// Wait for animation to finish before unmount.
|
|
1931
|
-
,
|
|
1932
|
-
timeout: {
|
|
1933
|
-
enter: 0,
|
|
1934
|
-
exit: EXIT_ANIMATION
|
|
1935
|
-
},
|
|
1936
|
-
classNames: classNames__default.default(`sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, {
|
|
1937
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1938
|
-
}, 'sliding-panel'),
|
|
1939
|
-
appear: true,
|
|
1940
|
-
unmountOnExit: true,
|
|
1941
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1942
|
-
ref: mergeRefs__default.default([reference, localReference]),
|
|
1943
|
-
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1944
|
-
children: children
|
|
1945
|
-
})
|
|
1946
|
-
});
|
|
1947
|
-
});
|
|
1948
|
-
SlidingPanel.propTypes = {
|
|
1949
|
-
children: PropTypes__default.default.node,
|
|
1950
|
-
className: PropTypes__default.default.string,
|
|
1951
|
-
open: PropTypes__default.default.bool,
|
|
1952
|
-
position: PropTypes__default.default.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1953
|
-
showSlidingPanelBorder: PropTypes__default.default.bool,
|
|
1954
|
-
slidingPanelPositionFixed: PropTypes__default.default.bool
|
|
1955
|
-
};
|
|
1956
|
-
SlidingPanel.defaultProps = {
|
|
1957
|
-
children: null,
|
|
1958
|
-
className: undefined,
|
|
1959
|
-
open: false,
|
|
1960
|
-
position: 'left',
|
|
1961
|
-
showSlidingPanelBorder: false,
|
|
1962
|
-
slidingPanelPositionFixed: false
|
|
1963
|
-
};
|
|
1964
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1965
|
-
|
|
1966
|
-
const Drawer = ({
|
|
1967
|
-
children,
|
|
1968
|
-
className,
|
|
1969
|
-
footerContent,
|
|
1970
|
-
headerTitle,
|
|
1971
|
-
onClose,
|
|
1972
|
-
open,
|
|
1973
|
-
position
|
|
1974
|
-
}) => {
|
|
1975
|
-
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
1976
|
-
const {
|
|
1977
|
-
isMobile
|
|
1978
|
-
} = useLayout();
|
|
1979
|
-
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
1980
|
-
open: open,
|
|
1981
|
-
onClose: onClose,
|
|
1982
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel$1, {
|
|
1983
|
-
open: open,
|
|
1984
|
-
position: isMobile ? exports.Position.BOTTOM : position,
|
|
1985
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1986
|
-
className: classNames__default.default('np-drawer', className),
|
|
1987
|
-
role: "dialog",
|
|
1988
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1989
|
-
className: classNames__default.default('np-drawer-header', {
|
|
1990
|
-
'np-drawer-header--withborder': headerTitle
|
|
1991
|
-
}),
|
|
1992
|
-
children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
1993
|
-
type: exports.Typography.TITLE_BODY,
|
|
1994
|
-
children: headerTitle
|
|
1995
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
1996
|
-
onClick: onClose
|
|
1997
|
-
})]
|
|
1998
|
-
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1999
|
-
className: classNames__default.default('np-drawer-content'),
|
|
2000
|
-
children: children
|
|
2001
|
-
}), footerContent && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2002
|
-
className: classNames__default.default('np-drawer-footer'),
|
|
2003
|
-
children: footerContent
|
|
2004
|
-
})]
|
|
2005
|
-
})
|
|
2006
|
-
})
|
|
2007
|
-
});
|
|
2008
|
-
};
|
|
2009
|
-
Drawer.propTypes = {
|
|
2010
|
-
/** The content to appear in the drawer body. */
|
|
2011
|
-
children: PropTypes__default.default.node,
|
|
2012
|
-
className: PropTypes__default.default.string,
|
|
2013
|
-
/** The content to appear in the drawer footer. */
|
|
2014
|
-
footerContent: PropTypes__default.default.node,
|
|
2015
|
-
/** The content to appear in the drawer header. */
|
|
2016
|
-
headerTitle: PropTypes__default.default.node,
|
|
2017
|
-
/** The action to perform on close click. */
|
|
2018
|
-
onClose: PropTypes__default.default.func,
|
|
2019
|
-
/** The status of Drawer either open or not. */
|
|
2020
|
-
open: PropTypes__default.default.bool,
|
|
2021
|
-
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
2022
|
-
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom'])
|
|
2023
|
-
};
|
|
2024
|
-
Drawer.defaultProps = {
|
|
2025
|
-
children: null,
|
|
2026
|
-
className: undefined,
|
|
2027
|
-
footerContent: null,
|
|
2028
|
-
headerTitle: null,
|
|
2029
|
-
onClose: null,
|
|
2030
|
-
open: false,
|
|
2031
|
-
position: exports.Position.RIGHT
|
|
2032
|
-
};
|
|
2033
|
-
var Drawer$1 = Drawer;
|
|
2034
|
-
|
|
2035
|
-
function useMedia(query) {
|
|
2036
|
-
return shim.useSyncExternalStore(onStoreChange => {
|
|
2037
|
-
const mediaQueryList = window.matchMedia(query);
|
|
2038
|
-
mediaQueryList.addEventListener('change', onStoreChange);
|
|
2039
|
-
return () => {
|
|
2040
|
-
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
2041
|
-
};
|
|
2042
|
-
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
1965
|
const INITIAL_Y_POSITION = 0;
|
|
2046
1966
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
2047
1967
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2169,13 +2089,7 @@ const BottomSheet$1 = props => {
|
|
|
2169
2089
|
maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
|
|
2170
2090
|
};
|
|
2171
2091
|
}
|
|
2172
|
-
|
|
2173
|
-
return is400Zoom ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
2174
|
-
open: props.open,
|
|
2175
|
-
className: props.className,
|
|
2176
|
-
onClose: close,
|
|
2177
|
-
children: props.children
|
|
2178
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
2092
|
+
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
2179
2093
|
open: props.open,
|
|
2180
2094
|
fadeContentOnEnter: true,
|
|
2181
2095
|
fadeContentOnExit: true,
|
|
@@ -2347,7 +2261,7 @@ const typeClassMap$1 = {
|
|
|
2347
2261
|
[exports.ControlType.POSITIVE]: 'btn-positive',
|
|
2348
2262
|
[exports.ControlType.NEGATIVE]: 'btn-negative'
|
|
2349
2263
|
};
|
|
2350
|
-
const priorityClassMap = {
|
|
2264
|
+
const priorityClassMap$1 = {
|
|
2351
2265
|
[exports.Priority.PRIMARY]: 'btn-priority-1',
|
|
2352
2266
|
[exports.Priority.SECONDARY]: 'btn-priority-2',
|
|
2353
2267
|
[exports.Priority.TERTIARY]: 'btn-priority-3'
|
|
@@ -2429,7 +2343,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
2429
2343
|
typeClassMap$1[newType],
|
|
2430
2344
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
2431
2345
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2432
|
-
priorityClassMap[newPriority], className);
|
|
2346
|
+
priorityClassMap$1[newPriority], className);
|
|
2433
2347
|
function processIndicatorSize() {
|
|
2434
2348
|
return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';
|
|
2435
2349
|
}
|
|
@@ -2693,6 +2607,10 @@ const CheckboxOption = /*#__PURE__*/React.forwardRef(({
|
|
|
2693
2607
|
});
|
|
2694
2608
|
});
|
|
2695
2609
|
|
|
2610
|
+
const priorityClassMap = {
|
|
2611
|
+
[exports.Priority.PRIMARY]: 'np-chip--priority-1',
|
|
2612
|
+
[exports.Priority.SECONDARY]: 'np-chip--priority-2'
|
|
2613
|
+
};
|
|
2696
2614
|
const Chip = ({
|
|
2697
2615
|
label,
|
|
2698
2616
|
value,
|
|
@@ -2703,7 +2621,8 @@ const Chip = ({
|
|
|
2703
2621
|
'aria-label': ariaLabel,
|
|
2704
2622
|
'aria-checked': ariaChecked,
|
|
2705
2623
|
role,
|
|
2706
|
-
closeButton
|
|
2624
|
+
closeButton,
|
|
2625
|
+
priority = exports.Priority.PRIMARY
|
|
2707
2626
|
}) => {
|
|
2708
2627
|
const isActionable = onClick || onKeyPress;
|
|
2709
2628
|
const defaultRole = isActionable ? 'button' : undefined;
|
|
@@ -2724,7 +2643,7 @@ const Chip = ({
|
|
|
2724
2643
|
tabIndex: tabIndex,
|
|
2725
2644
|
"aria-label": ariaLabel,
|
|
2726
2645
|
"aria-checked": ariaChecked,
|
|
2727
|
-
className: classNames__default.default('np-chip', 'd-flex', 'align-items-center', 'justify-content-between', onRemove ? 'np-chip--removable' : '', className),
|
|
2646
|
+
className: classNames__default.default('np-chip', 'd-flex', 'align-items-center', 'justify-content-between', onRemove ? 'np-chip--removable' : '', priorityClassMap[priority], className),
|
|
2728
2647
|
...(isActionable && {
|
|
2729
2648
|
onClick,
|
|
2730
2649
|
onKeyPress
|
|
@@ -2760,7 +2679,8 @@ const Chips = ({
|
|
|
2760
2679
|
selected,
|
|
2761
2680
|
'aria-label': ariaLabel,
|
|
2762
2681
|
className,
|
|
2763
|
-
multiple
|
|
2682
|
+
multiple,
|
|
2683
|
+
priority
|
|
2764
2684
|
}) => {
|
|
2765
2685
|
const intl = reactIntl.useIntl();
|
|
2766
2686
|
const isSelected = value => Array.isArray(selected) ? selected.includes(value) : selected === value;
|
|
@@ -2788,6 +2708,7 @@ const Chips = ({
|
|
|
2788
2708
|
'np-chip--selected': chipSelected,
|
|
2789
2709
|
'p-r-1': multiple && chipSelected
|
|
2790
2710
|
}),
|
|
2711
|
+
priority: priority,
|
|
2791
2712
|
...(multiple && chipSelected ? {
|
|
2792
2713
|
onRemove: () => handleOnChange(chip.value, chipSelected),
|
|
2793
2714
|
'aria-label': chip.label
|
|
@@ -2811,7 +2732,7 @@ const CircularButton = ({
|
|
|
2811
2732
|
type,
|
|
2812
2733
|
...rest
|
|
2813
2734
|
}) => {
|
|
2814
|
-
const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
|
|
2735
|
+
const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap$1[priority]);
|
|
2815
2736
|
const iconElement = icon.props.size !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
|
|
2816
2737
|
size: 24
|
|
2817
2738
|
}) : icon;
|
|
@@ -3531,11 +3452,8 @@ const DateHeader = ({
|
|
|
3531
3452
|
dateMode
|
|
3532
3453
|
}) => {
|
|
3533
3454
|
const intl = reactIntl.useIntl();
|
|
3534
|
-
const {
|
|
3535
|
-
isMobile
|
|
3536
|
-
} = useLayout();
|
|
3537
3455
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3538
|
-
className:
|
|
3456
|
+
className: "text-xs-center p-t-1 p-b-2 clearfix",
|
|
3539
3457
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3540
3458
|
className: "pull-left-single-direction",
|
|
3541
3459
|
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
@@ -4131,8 +4049,7 @@ class DateLookup extends React.PureComponent {
|
|
|
4131
4049
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
4132
4050
|
viewYear: (props.value || new Date()).getFullYear(),
|
|
4133
4051
|
open: false,
|
|
4134
|
-
mode: MODE.DAY
|
|
4135
|
-
isMobile: false
|
|
4052
|
+
mode: MODE.DAY
|
|
4136
4053
|
};
|
|
4137
4054
|
}
|
|
4138
4055
|
static getDerivedStateFromProps(props, state) {
|
|
@@ -4167,10 +4084,6 @@ class DateLookup extends React.PureComponent {
|
|
|
4167
4084
|
if (+this.props.value !== +previousProps.value && this.state.open) {
|
|
4168
4085
|
this.focusOn('.active');
|
|
4169
4086
|
}
|
|
4170
|
-
this.mediaQuery = window.matchMedia(`(max-width: ${exports.Breakpoint.SMALL}px)`);
|
|
4171
|
-
this.setState({
|
|
4172
|
-
isMobile: this.mediaQuery.matches
|
|
4173
|
-
});
|
|
4174
4087
|
}
|
|
4175
4088
|
componentWillUnmount() {
|
|
4176
4089
|
// Prevents memory leak by cleaning state.
|
|
@@ -4303,17 +4216,14 @@ class DateLookup extends React.PureComponent {
|
|
|
4303
4216
|
max,
|
|
4304
4217
|
viewMonth,
|
|
4305
4218
|
viewYear,
|
|
4306
|
-
mode
|
|
4307
|
-
isMobile
|
|
4219
|
+
mode
|
|
4308
4220
|
} = this.state;
|
|
4309
4221
|
const {
|
|
4310
4222
|
placeholder,
|
|
4311
4223
|
monthFormat
|
|
4312
4224
|
} = this.props;
|
|
4313
4225
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4314
|
-
className:
|
|
4315
|
-
'p-a-1': !isMobile
|
|
4316
|
-
}),
|
|
4226
|
+
className: "p-a-1",
|
|
4317
4227
|
children: [mode === MODE.DAY && /*#__PURE__*/jsxRuntime.jsx(DayCalendar$1, {
|
|
4318
4228
|
selectedDate,
|
|
4319
4229
|
min,
|
|
@@ -4821,6 +4731,75 @@ function Display({
|
|
|
4821
4731
|
});
|
|
4822
4732
|
}
|
|
4823
4733
|
|
|
4734
|
+
const Drawer = ({
|
|
4735
|
+
children,
|
|
4736
|
+
className,
|
|
4737
|
+
footerContent,
|
|
4738
|
+
headerTitle,
|
|
4739
|
+
onClose,
|
|
4740
|
+
open,
|
|
4741
|
+
position
|
|
4742
|
+
}) => {
|
|
4743
|
+
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
4744
|
+
const {
|
|
4745
|
+
isMobile
|
|
4746
|
+
} = useLayout();
|
|
4747
|
+
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
4748
|
+
open: open,
|
|
4749
|
+
onClose: onClose,
|
|
4750
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel$1, {
|
|
4751
|
+
open: open,
|
|
4752
|
+
position: isMobile ? exports.Position.BOTTOM : position,
|
|
4753
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4754
|
+
className: classNames__default.default('np-drawer', className),
|
|
4755
|
+
role: "dialog",
|
|
4756
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4757
|
+
className: classNames__default.default('np-drawer-header', {
|
|
4758
|
+
'np-drawer-header--withborder': headerTitle
|
|
4759
|
+
}),
|
|
4760
|
+
children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
4761
|
+
type: exports.Typography.TITLE_BODY,
|
|
4762
|
+
children: headerTitle
|
|
4763
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
4764
|
+
onClick: onClose
|
|
4765
|
+
})]
|
|
4766
|
+
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4767
|
+
className: classNames__default.default('np-drawer-content'),
|
|
4768
|
+
children: children
|
|
4769
|
+
}), footerContent && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4770
|
+
className: classNames__default.default('np-drawer-footer'),
|
|
4771
|
+
children: footerContent
|
|
4772
|
+
})]
|
|
4773
|
+
})
|
|
4774
|
+
})
|
|
4775
|
+
});
|
|
4776
|
+
};
|
|
4777
|
+
Drawer.propTypes = {
|
|
4778
|
+
/** The content to appear in the drawer body. */
|
|
4779
|
+
children: PropTypes__default.default.node,
|
|
4780
|
+
className: PropTypes__default.default.string,
|
|
4781
|
+
/** The content to appear in the drawer footer. */
|
|
4782
|
+
footerContent: PropTypes__default.default.node,
|
|
4783
|
+
/** The content to appear in the drawer header. */
|
|
4784
|
+
headerTitle: PropTypes__default.default.node,
|
|
4785
|
+
/** The action to perform on close click. */
|
|
4786
|
+
onClose: PropTypes__default.default.func,
|
|
4787
|
+
/** The status of Drawer either open or not. */
|
|
4788
|
+
open: PropTypes__default.default.bool,
|
|
4789
|
+
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
4790
|
+
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom'])
|
|
4791
|
+
};
|
|
4792
|
+
Drawer.defaultProps = {
|
|
4793
|
+
children: null,
|
|
4794
|
+
className: undefined,
|
|
4795
|
+
footerContent: null,
|
|
4796
|
+
headerTitle: null,
|
|
4797
|
+
onClose: null,
|
|
4798
|
+
open: false,
|
|
4799
|
+
position: exports.Position.RIGHT
|
|
4800
|
+
};
|
|
4801
|
+
var Drawer$1 = Drawer;
|
|
4802
|
+
|
|
4824
4803
|
const DropFade = ({
|
|
4825
4804
|
children,
|
|
4826
4805
|
show
|
|
@@ -5953,14 +5932,13 @@ const Modal = ({
|
|
|
5953
5932
|
}) => {
|
|
5954
5933
|
const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
|
|
5955
5934
|
const {
|
|
5956
|
-
isMobile
|
|
5957
|
-
isMedium: isTablet
|
|
5935
|
+
isMobile
|
|
5958
5936
|
} = useLayout();
|
|
5959
5937
|
// These should be replaced with props in breaking change.
|
|
5960
5938
|
const isCompact = checkSpecialClasses('compact');
|
|
5961
5939
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5962
5940
|
const contentReference = React.useRef(null);
|
|
5963
|
-
return isMobile
|
|
5941
|
+
return isMobile ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5964
5942
|
open: open,
|
|
5965
5943
|
headerTitle: title,
|
|
5966
5944
|
footerContent: footer,
|
|
@@ -6383,6 +6361,16 @@ const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
|
6383
6361
|
});
|
|
6384
6362
|
});
|
|
6385
6363
|
|
|
6364
|
+
function useMedia(query) {
|
|
6365
|
+
return shim.useSyncExternalStore(onStoreChange => {
|
|
6366
|
+
const mediaQueryList = window.matchMedia(query);
|
|
6367
|
+
mediaQueryList.addEventListener('change', onStoreChange);
|
|
6368
|
+
return () => {
|
|
6369
|
+
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
6370
|
+
};
|
|
6371
|
+
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
6372
|
+
}
|
|
6373
|
+
|
|
6386
6374
|
function useScreenSize(size) {
|
|
6387
6375
|
return useMedia(`(min-width: ${size}px)`);
|
|
6388
6376
|
}
|