@transferwise/components 0.0.0-experimental-911678d → 0.0.0-experimental-628946b
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 +166 -142
- package/build/index.esm.js.map +1 -1
- package/build/index.js +166 -142
- 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/inputs/SelectInput.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/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/propsValues/breakpoint.d.ts +1 -0
- 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/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +11 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/test-utils/window-mock.d.ts +2 -0
- package/build/types/test-utils/window-mock.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/actionButton/ActionButton.css +1 -1
- package/src/actionButton/ActionButton.less +5 -1
- package/src/chips/Chip.css +1 -1
- package/src/chips/Chip.less +8 -0
- package/src/circularButton/CircularButton.css +1 -1
- package/src/circularButton/CircularButton.less +9 -3
- package/src/common/Option/Option.css +1 -1
- package/src/common/Option/Option.less +6 -0
- package/src/common/bottomSheet/BottomSheet.css +1 -1
- package/src/common/bottomSheet/BottomSheet.less +1 -1
- package/src/common/bottomSheet/BottomSheet.spec.tsx +4 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +4 -0
- package/src/common/bottomSheet/BottomSheet.tsx +10 -1
- package/src/common/closeButton/CloseButton.css +1 -1
- package/src/common/closeButton/CloseButton.less +12 -0
- package/src/common/hooks/useMedia.spec.ts +3 -17
- package/src/common/propsValues/breakpoint.ts +1 -0
- package/src/dateLookup/DateLookup.css +1 -1
- package/src/dateLookup/DateLookup.js +7 -3
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -0
- package/src/dateLookup/DateLookup.less +6 -0
- package/src/dateLookup/DateLookup.story.js +6 -1
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +3 -1
- package/src/dateLookup/DateLookup.view.spec.js +4 -0
- package/src/dateLookup/dateHeader/DateHeader.js +4 -2
- package/src/drawer/Drawer.css +1 -1
- package/src/drawer/Drawer.less +6 -0
- package/src/drawer/Drawer.story.js +42 -2
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +4 -0
- package/src/inputs/SelectInput.tsx +14 -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 +3 -1
- package/src/select/Select.spec.js +6 -9
- package/src/statusIcon/StatusIcon.css +1 -1
- package/src/statusIcon/StatusIcon.less +10 -0
- package/src/summary/Summary.css +1 -1
- package/src/summary/Summary.less +1 -1
- package/src/test-utils/index.js +1 -0
- package/src/test-utils/story-config.ts +21 -7
- package/src/test-utils/window-mock.ts +19 -0
- package/src/typeahead/Typeahead.css +1 -1
- package/src/typeahead/Typeahead.less +5 -6
- package/src/uploadInput/UploadInput.css +1 -1
- package/src/uploadInput/UploadInput.less +5 -1
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');
|
|
17
18
|
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
18
19
|
var reactPopper = require('react-popper');
|
|
19
20
|
var react$1 = require('@headlessui/react');
|
|
20
21
|
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,6 +192,7 @@ exports.Priority = void 0;
|
|
|
192
192
|
|
|
193
193
|
exports.Breakpoint = void 0;
|
|
194
194
|
(function (Breakpoint) {
|
|
195
|
+
Breakpoint[Breakpoint["ZOOM_400"] = 385] = "ZOOM_400";
|
|
195
196
|
Breakpoint[Breakpoint["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
196
197
|
Breakpoint[Breakpoint["SMALL"] = 576] = "SMALL";
|
|
197
198
|
Breakpoint[Breakpoint["MEDIUM"] = 768] = "MEDIUM";
|
|
@@ -1740,58 +1741,6 @@ const DimmerContentWrapper = ({
|
|
|
1740
1741
|
};
|
|
1741
1742
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1742
1743
|
|
|
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
|
-
|
|
1795
1744
|
const THROTTLE_MS = 100;
|
|
1796
1745
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1797
1746
|
const useClientWidth = ({
|
|
@@ -1962,6 +1911,137 @@ const useLayout = () => {
|
|
|
1962
1911
|
};
|
|
1963
1912
|
};
|
|
1964
1913
|
|
|
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
|
+
|
|
1965
2045
|
const INITIAL_Y_POSITION = 0;
|
|
1966
2046
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
1967
2047
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2089,7 +2169,13 @@ const BottomSheet$1 = props => {
|
|
|
2089
2169
|
maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
|
|
2090
2170
|
};
|
|
2091
2171
|
}
|
|
2092
|
-
|
|
2172
|
+
const is400Zoom = useMedia(`(max-width: ${exports.Breakpoint.ZOOM_400}px)`);
|
|
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, {
|
|
2093
2179
|
open: props.open,
|
|
2094
2180
|
fadeContentOnEnter: true,
|
|
2095
2181
|
fadeContentOnExit: true,
|
|
@@ -3445,8 +3531,11 @@ const DateHeader = ({
|
|
|
3445
3531
|
dateMode
|
|
3446
3532
|
}) => {
|
|
3447
3533
|
const intl = reactIntl.useIntl();
|
|
3534
|
+
const {
|
|
3535
|
+
isMobile
|
|
3536
|
+
} = useLayout();
|
|
3448
3537
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3449
|
-
className:
|
|
3538
|
+
className: classNames__default.default('text-xs-center', !isMobile && ['clearfix', 'p-y-1']),
|
|
3450
3539
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3451
3540
|
className: "pull-left-single-direction",
|
|
3452
3541
|
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
@@ -4042,7 +4131,8 @@ class DateLookup extends React.PureComponent {
|
|
|
4042
4131
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
4043
4132
|
viewYear: (props.value || new Date()).getFullYear(),
|
|
4044
4133
|
open: false,
|
|
4045
|
-
mode: MODE.DAY
|
|
4134
|
+
mode: MODE.DAY,
|
|
4135
|
+
isMobile: false
|
|
4046
4136
|
};
|
|
4047
4137
|
}
|
|
4048
4138
|
static getDerivedStateFromProps(props, state) {
|
|
@@ -4077,6 +4167,10 @@ class DateLookup extends React.PureComponent {
|
|
|
4077
4167
|
if (+this.props.value !== +previousProps.value && this.state.open) {
|
|
4078
4168
|
this.focusOn('.active');
|
|
4079
4169
|
}
|
|
4170
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${exports.Breakpoint.SMALL}px)`);
|
|
4171
|
+
this.setState({
|
|
4172
|
+
isMobile: this.mediaQuery.matches
|
|
4173
|
+
});
|
|
4080
4174
|
}
|
|
4081
4175
|
componentWillUnmount() {
|
|
4082
4176
|
// Prevents memory leak by cleaning state.
|
|
@@ -4209,14 +4303,17 @@ class DateLookup extends React.PureComponent {
|
|
|
4209
4303
|
max,
|
|
4210
4304
|
viewMonth,
|
|
4211
4305
|
viewYear,
|
|
4212
|
-
mode
|
|
4306
|
+
mode,
|
|
4307
|
+
isMobile
|
|
4213
4308
|
} = this.state;
|
|
4214
4309
|
const {
|
|
4215
4310
|
placeholder,
|
|
4216
4311
|
monthFormat
|
|
4217
4312
|
} = this.props;
|
|
4218
4313
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4219
|
-
className:
|
|
4314
|
+
className: classNames__default.default({
|
|
4315
|
+
'p-a-1': !isMobile
|
|
4316
|
+
}),
|
|
4220
4317
|
children: [mode === MODE.DAY && /*#__PURE__*/jsxRuntime.jsx(DayCalendar$1, {
|
|
4221
4318
|
selectedDate,
|
|
4222
4319
|
min,
|
|
@@ -4724,75 +4821,6 @@ function Display({
|
|
|
4724
4821
|
});
|
|
4725
4822
|
}
|
|
4726
4823
|
|
|
4727
|
-
const Drawer = ({
|
|
4728
|
-
children,
|
|
4729
|
-
className,
|
|
4730
|
-
footerContent,
|
|
4731
|
-
headerTitle,
|
|
4732
|
-
onClose,
|
|
4733
|
-
open,
|
|
4734
|
-
position
|
|
4735
|
-
}) => {
|
|
4736
|
-
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
4737
|
-
const {
|
|
4738
|
-
isMobile
|
|
4739
|
-
} = useLayout();
|
|
4740
|
-
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
4741
|
-
open: open,
|
|
4742
|
-
onClose: onClose,
|
|
4743
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel$1, {
|
|
4744
|
-
open: open,
|
|
4745
|
-
position: isMobile ? exports.Position.BOTTOM : position,
|
|
4746
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4747
|
-
className: classNames__default.default('np-drawer', className),
|
|
4748
|
-
role: "dialog",
|
|
4749
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4750
|
-
className: classNames__default.default('np-drawer-header', {
|
|
4751
|
-
'np-drawer-header--withborder': headerTitle
|
|
4752
|
-
}),
|
|
4753
|
-
children: [headerTitle && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
4754
|
-
type: exports.Typography.TITLE_BODY,
|
|
4755
|
-
children: headerTitle
|
|
4756
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
4757
|
-
onClick: onClose
|
|
4758
|
-
})]
|
|
4759
|
-
}), children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4760
|
-
className: classNames__default.default('np-drawer-content'),
|
|
4761
|
-
children: children
|
|
4762
|
-
}), footerContent && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4763
|
-
className: classNames__default.default('np-drawer-footer'),
|
|
4764
|
-
children: footerContent
|
|
4765
|
-
})]
|
|
4766
|
-
})
|
|
4767
|
-
})
|
|
4768
|
-
});
|
|
4769
|
-
};
|
|
4770
|
-
Drawer.propTypes = {
|
|
4771
|
-
/** The content to appear in the drawer body. */
|
|
4772
|
-
children: PropTypes__default.default.node,
|
|
4773
|
-
className: PropTypes__default.default.string,
|
|
4774
|
-
/** The content to appear in the drawer footer. */
|
|
4775
|
-
footerContent: PropTypes__default.default.node,
|
|
4776
|
-
/** The content to appear in the drawer header. */
|
|
4777
|
-
headerTitle: PropTypes__default.default.node,
|
|
4778
|
-
/** The action to perform on close click. */
|
|
4779
|
-
onClose: PropTypes__default.default.func,
|
|
4780
|
-
/** The status of Drawer either open or not. */
|
|
4781
|
-
open: PropTypes__default.default.bool,
|
|
4782
|
-
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
4783
|
-
position: PropTypes__default.default.oneOf(['left', 'right', 'bottom'])
|
|
4784
|
-
};
|
|
4785
|
-
Drawer.defaultProps = {
|
|
4786
|
-
children: null,
|
|
4787
|
-
className: undefined,
|
|
4788
|
-
footerContent: null,
|
|
4789
|
-
headerTitle: null,
|
|
4790
|
-
onClose: null,
|
|
4791
|
-
open: false,
|
|
4792
|
-
position: exports.Position.RIGHT
|
|
4793
|
-
};
|
|
4794
|
-
var Drawer$1 = Drawer;
|
|
4795
|
-
|
|
4796
4824
|
const DropFade = ({
|
|
4797
4825
|
children,
|
|
4798
4826
|
show
|
|
@@ -5925,13 +5953,14 @@ const Modal = ({
|
|
|
5925
5953
|
}) => {
|
|
5926
5954
|
const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
|
|
5927
5955
|
const {
|
|
5928
|
-
isMobile
|
|
5956
|
+
isMobile,
|
|
5957
|
+
isMedium: isTablet
|
|
5929
5958
|
} = useLayout();
|
|
5930
5959
|
// These should be replaced with props in breaking change.
|
|
5931
5960
|
const isCompact = checkSpecialClasses('compact');
|
|
5932
5961
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5933
5962
|
const contentReference = React.useRef(null);
|
|
5934
|
-
return isMobile ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5963
|
+
return isMobile || isTablet ? /*#__PURE__*/jsxRuntime.jsx(Drawer$1, {
|
|
5935
5964
|
open: open,
|
|
5936
5965
|
headerTitle: title,
|
|
5937
5966
|
footerContent: footer,
|
|
@@ -6354,16 +6383,6 @@ const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
|
6354
6383
|
});
|
|
6355
6384
|
});
|
|
6356
6385
|
|
|
6357
|
-
function useMedia(query) {
|
|
6358
|
-
return shim.useSyncExternalStore(onStoreChange => {
|
|
6359
|
-
const mediaQueryList = window.matchMedia(query);
|
|
6360
|
-
mediaQueryList.addEventListener('change', onStoreChange);
|
|
6361
|
-
return () => {
|
|
6362
|
-
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
6363
|
-
};
|
|
6364
|
-
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
6365
|
-
}
|
|
6366
|
-
|
|
6367
6386
|
function useScreenSize(size) {
|
|
6368
6387
|
return useMedia(`(min-width: ${size}px)`);
|
|
6369
6388
|
}
|
|
@@ -7009,6 +7028,11 @@ function SelectInputOption({
|
|
|
7009
7028
|
disabled,
|
|
7010
7029
|
children
|
|
7011
7030
|
}) {
|
|
7031
|
+
const parentHasValue = React.useContext(SelectInputHasValueContext);
|
|
7032
|
+
// Avoid flash during exit transition
|
|
7033
|
+
const {
|
|
7034
|
+
current: cachedParentHasValue
|
|
7035
|
+
} = React.useRef(parentHasValue);
|
|
7012
7036
|
return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
|
|
7013
7037
|
as: "div",
|
|
7014
7038
|
value: value,
|
|
@@ -7024,10 +7048,10 @@ function SelectInputOption({
|
|
|
7024
7048
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7025
7049
|
className: "np-select-input-option",
|
|
7026
7050
|
children: children
|
|
7027
|
-
}),
|
|
7051
|
+
}), cachedParentHasValue ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
|
|
7028
7052
|
size: 24,
|
|
7029
|
-
className: classNames__default.default('np-select-input-option-check')
|
|
7030
|
-
})]
|
|
7053
|
+
className: classNames__default.default('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
|
|
7054
|
+
}) : null]
|
|
7031
7055
|
})
|
|
7032
7056
|
});
|
|
7033
7057
|
}
|