@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.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';
|
|
16
17
|
import { isUndefined, isKey, isNumber, isEmpty, isNull, isArray } from '@transferwise/neptune-validation';
|
|
17
18
|
import { usePopper } from 'react-popper';
|
|
18
19
|
import { Transition, Listbox } from '@headlessui/react';
|
|
19
20
|
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,6 +158,7 @@ var Priority;
|
|
|
158
158
|
|
|
159
159
|
var Breakpoint;
|
|
160
160
|
(function (Breakpoint) {
|
|
161
|
+
Breakpoint[Breakpoint["ZOOM_400"] = 385] = "ZOOM_400";
|
|
161
162
|
Breakpoint[Breakpoint["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
162
163
|
Breakpoint[Breakpoint["SMALL"] = 576] = "SMALL";
|
|
163
164
|
Breakpoint[Breakpoint["MEDIUM"] = 768] = "MEDIUM";
|
|
@@ -1706,58 +1707,6 @@ const DimmerContentWrapper = ({
|
|
|
1706
1707
|
};
|
|
1707
1708
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1708
1709
|
|
|
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
|
-
|
|
1761
1710
|
const THROTTLE_MS = 100;
|
|
1762
1711
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1763
1712
|
const useClientWidth = ({
|
|
@@ -1928,6 +1877,137 @@ const useLayout = () => {
|
|
|
1928
1877
|
};
|
|
1929
1878
|
};
|
|
1930
1879
|
|
|
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
|
+
|
|
1931
2011
|
const INITIAL_Y_POSITION = 0;
|
|
1932
2012
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
1933
2013
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -2055,7 +2135,13 @@ const BottomSheet$1 = props => {
|
|
|
2055
2135
|
maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`
|
|
2056
2136
|
};
|
|
2057
2137
|
}
|
|
2058
|
-
|
|
2138
|
+
const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
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, {
|
|
2059
2145
|
open: props.open,
|
|
2060
2146
|
fadeContentOnEnter: true,
|
|
2061
2147
|
fadeContentOnExit: true,
|
|
@@ -3411,8 +3497,11 @@ const DateHeader = ({
|
|
|
3411
3497
|
dateMode
|
|
3412
3498
|
}) => {
|
|
3413
3499
|
const intl = useIntl();
|
|
3500
|
+
const {
|
|
3501
|
+
isMobile
|
|
3502
|
+
} = useLayout();
|
|
3414
3503
|
return /*#__PURE__*/jsxs("div", {
|
|
3415
|
-
className:
|
|
3504
|
+
className: classNames('text-xs-center', !isMobile && ['clearfix', 'p-y-1']),
|
|
3416
3505
|
children: [/*#__PURE__*/jsx("div", {
|
|
3417
3506
|
className: "pull-left-single-direction",
|
|
3418
3507
|
children: /*#__PURE__*/jsx("button", {
|
|
@@ -4008,7 +4097,8 @@ class DateLookup extends PureComponent {
|
|
|
4008
4097
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
4009
4098
|
viewYear: (props.value || new Date()).getFullYear(),
|
|
4010
4099
|
open: false,
|
|
4011
|
-
mode: MODE.DAY
|
|
4100
|
+
mode: MODE.DAY,
|
|
4101
|
+
isMobile: false
|
|
4012
4102
|
};
|
|
4013
4103
|
}
|
|
4014
4104
|
static getDerivedStateFromProps(props, state) {
|
|
@@ -4043,6 +4133,10 @@ class DateLookup extends PureComponent {
|
|
|
4043
4133
|
if (+this.props.value !== +previousProps.value && this.state.open) {
|
|
4044
4134
|
this.focusOn('.active');
|
|
4045
4135
|
}
|
|
4136
|
+
this.mediaQuery = window.matchMedia(`(max-width: ${Breakpoint.SMALL}px)`);
|
|
4137
|
+
this.setState({
|
|
4138
|
+
isMobile: this.mediaQuery.matches
|
|
4139
|
+
});
|
|
4046
4140
|
}
|
|
4047
4141
|
componentWillUnmount() {
|
|
4048
4142
|
// Prevents memory leak by cleaning state.
|
|
@@ -4175,14 +4269,17 @@ class DateLookup extends PureComponent {
|
|
|
4175
4269
|
max,
|
|
4176
4270
|
viewMonth,
|
|
4177
4271
|
viewYear,
|
|
4178
|
-
mode
|
|
4272
|
+
mode,
|
|
4273
|
+
isMobile
|
|
4179
4274
|
} = this.state;
|
|
4180
4275
|
const {
|
|
4181
4276
|
placeholder,
|
|
4182
4277
|
monthFormat
|
|
4183
4278
|
} = this.props;
|
|
4184
4279
|
return /*#__PURE__*/jsxs("div", {
|
|
4185
|
-
className:
|
|
4280
|
+
className: classNames({
|
|
4281
|
+
'p-a-1': !isMobile
|
|
4282
|
+
}),
|
|
4186
4283
|
children: [mode === MODE.DAY && /*#__PURE__*/jsx(DayCalendar$1, {
|
|
4187
4284
|
selectedDate,
|
|
4188
4285
|
min,
|
|
@@ -4690,75 +4787,6 @@ function Display({
|
|
|
4690
4787
|
});
|
|
4691
4788
|
}
|
|
4692
4789
|
|
|
4693
|
-
const Drawer = ({
|
|
4694
|
-
children,
|
|
4695
|
-
className,
|
|
4696
|
-
footerContent,
|
|
4697
|
-
headerTitle,
|
|
4698
|
-
onClose,
|
|
4699
|
-
open,
|
|
4700
|
-
position
|
|
4701
|
-
}) => {
|
|
4702
|
-
logActionRequiredIf('Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.', !onClose);
|
|
4703
|
-
const {
|
|
4704
|
-
isMobile
|
|
4705
|
-
} = useLayout();
|
|
4706
|
-
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
4707
|
-
open: open,
|
|
4708
|
-
onClose: onClose,
|
|
4709
|
-
children: /*#__PURE__*/jsx(SlidingPanel$1, {
|
|
4710
|
-
open: open,
|
|
4711
|
-
position: isMobile ? Position.BOTTOM : position,
|
|
4712
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
4713
|
-
className: classNames('np-drawer', className),
|
|
4714
|
-
role: "dialog",
|
|
4715
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
4716
|
-
className: classNames('np-drawer-header', {
|
|
4717
|
-
'np-drawer-header--withborder': headerTitle
|
|
4718
|
-
}),
|
|
4719
|
-
children: [headerTitle && /*#__PURE__*/jsx(Title, {
|
|
4720
|
-
type: Typography.TITLE_BODY,
|
|
4721
|
-
children: headerTitle
|
|
4722
|
-
}), /*#__PURE__*/jsx(CloseButton, {
|
|
4723
|
-
onClick: onClose
|
|
4724
|
-
})]
|
|
4725
|
-
}), children && /*#__PURE__*/jsx("div", {
|
|
4726
|
-
className: classNames('np-drawer-content'),
|
|
4727
|
-
children: children
|
|
4728
|
-
}), footerContent && /*#__PURE__*/jsx("div", {
|
|
4729
|
-
className: classNames('np-drawer-footer'),
|
|
4730
|
-
children: footerContent
|
|
4731
|
-
})]
|
|
4732
|
-
})
|
|
4733
|
-
})
|
|
4734
|
-
});
|
|
4735
|
-
};
|
|
4736
|
-
Drawer.propTypes = {
|
|
4737
|
-
/** The content to appear in the drawer body. */
|
|
4738
|
-
children: PropTypes.node,
|
|
4739
|
-
className: PropTypes.string,
|
|
4740
|
-
/** The content to appear in the drawer footer. */
|
|
4741
|
-
footerContent: PropTypes.node,
|
|
4742
|
-
/** The content to appear in the drawer header. */
|
|
4743
|
-
headerTitle: PropTypes.node,
|
|
4744
|
-
/** The action to perform on close click. */
|
|
4745
|
-
onClose: PropTypes.func,
|
|
4746
|
-
/** The status of Drawer either open or not. */
|
|
4747
|
-
open: PropTypes.bool,
|
|
4748
|
-
/** The placement of Drawer on the screen either left or right. On mobile it will default to bottom. */
|
|
4749
|
-
position: PropTypes.oneOf(['left', 'right', 'bottom'])
|
|
4750
|
-
};
|
|
4751
|
-
Drawer.defaultProps = {
|
|
4752
|
-
children: null,
|
|
4753
|
-
className: undefined,
|
|
4754
|
-
footerContent: null,
|
|
4755
|
-
headerTitle: null,
|
|
4756
|
-
onClose: null,
|
|
4757
|
-
open: false,
|
|
4758
|
-
position: Position.RIGHT
|
|
4759
|
-
};
|
|
4760
|
-
var Drawer$1 = Drawer;
|
|
4761
|
-
|
|
4762
4790
|
const DropFade = ({
|
|
4763
4791
|
children,
|
|
4764
4792
|
show
|
|
@@ -5891,13 +5919,14 @@ const Modal = ({
|
|
|
5891
5919
|
}) => {
|
|
5892
5920
|
const checkSpecialClasses = classToCheck => className?.split(' ').includes(classToCheck);
|
|
5893
5921
|
const {
|
|
5894
|
-
isMobile
|
|
5922
|
+
isMobile,
|
|
5923
|
+
isMedium: isTablet
|
|
5895
5924
|
} = useLayout();
|
|
5896
5925
|
// These should be replaced with props in breaking change.
|
|
5897
5926
|
const isCompact = checkSpecialClasses('compact');
|
|
5898
5927
|
const noDivider = checkSpecialClasses('no-divider');
|
|
5899
5928
|
const contentReference = useRef(null);
|
|
5900
|
-
return isMobile ? /*#__PURE__*/jsx(Drawer$1, {
|
|
5929
|
+
return isMobile || isTablet ? /*#__PURE__*/jsx(Drawer$1, {
|
|
5901
5930
|
open: open,
|
|
5902
5931
|
headerTitle: title,
|
|
5903
5932
|
footerContent: footer,
|
|
@@ -6320,16 +6349,6 @@ const SearchInput = /*#__PURE__*/forwardRef(function SearchInput({
|
|
|
6320
6349
|
});
|
|
6321
6350
|
});
|
|
6322
6351
|
|
|
6323
|
-
function useMedia(query) {
|
|
6324
|
-
return useSyncExternalStore(onStoreChange => {
|
|
6325
|
-
const mediaQueryList = window.matchMedia(query);
|
|
6326
|
-
mediaQueryList.addEventListener('change', onStoreChange);
|
|
6327
|
-
return () => {
|
|
6328
|
-
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
6329
|
-
};
|
|
6330
|
-
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
6352
|
function useScreenSize(size) {
|
|
6334
6353
|
return useMedia(`(min-width: ${size}px)`);
|
|
6335
6354
|
}
|
|
@@ -6975,6 +6994,11 @@ function SelectInputOption({
|
|
|
6975
6994
|
disabled,
|
|
6976
6995
|
children
|
|
6977
6996
|
}) {
|
|
6997
|
+
const parentHasValue = useContext(SelectInputHasValueContext);
|
|
6998
|
+
// Avoid flash during exit transition
|
|
6999
|
+
const {
|
|
7000
|
+
current: cachedParentHasValue
|
|
7001
|
+
} = useRef(parentHasValue);
|
|
6978
7002
|
return /*#__PURE__*/jsx(Listbox.Option, {
|
|
6979
7003
|
as: "div",
|
|
6980
7004
|
value: value,
|
|
@@ -6990,10 +7014,10 @@ function SelectInputOption({
|
|
|
6990
7014
|
children: [/*#__PURE__*/jsx("div", {
|
|
6991
7015
|
className: "np-select-input-option",
|
|
6992
7016
|
children: children
|
|
6993
|
-
}),
|
|
7017
|
+
}), cachedParentHasValue ? /*#__PURE__*/jsx(Check, {
|
|
6994
7018
|
size: 24,
|
|
6995
|
-
className: classNames('np-select-input-option-check')
|
|
6996
|
-
})]
|
|
7019
|
+
className: classNames('np-select-input-option-check', !selected && 'np-select-input-option-check--not-selected')
|
|
7020
|
+
}) : null]
|
|
6997
7021
|
})
|
|
6998
7022
|
});
|
|
6999
7023
|
}
|