cozy-ui 70.2.3 → 70.2.4
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [70.2.4](https://github.com/cozy/cozy-ui/compare/v70.2.3...v70.2.4) (2022-07-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **BottomSheet:** Backdrop click behavior ([7fdb297](https://github.com/cozy/cozy-ui/commit/7fdb297))
|
|
7
|
+
|
|
1
8
|
## [70.2.3](https://github.com/cozy/cozy-ui/compare/v70.2.2...v70.2.3) (2022-07-26)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -2,10 +2,14 @@ import React, { Fragment } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import Backdrop from '../Backdrop'
|
|
4
4
|
|
|
5
|
-
const BackdropOrFragment = ({ showBackdrop, children }) => {
|
|
5
|
+
const BackdropOrFragment = ({ showBackdrop, onClick, children }) => {
|
|
6
6
|
const Comp = showBackdrop ? Backdrop : Fragment
|
|
7
7
|
const props = showBackdrop
|
|
8
|
-
? {
|
|
8
|
+
? {
|
|
9
|
+
style: { zIndex: 'var(--zIndex-overlay)' },
|
|
10
|
+
open: showBackdrop,
|
|
11
|
+
onClick
|
|
12
|
+
}
|
|
9
13
|
: undefined
|
|
10
14
|
|
|
11
15
|
return <Comp {...props}>{children}</Comp>
|
|
@@ -8,7 +8,6 @@ import { getFlagshipMetadata } from 'cozy-device-helper'
|
|
|
8
8
|
|
|
9
9
|
import Stack from '../Stack'
|
|
10
10
|
import Paper from '../Paper'
|
|
11
|
-
import ClickAwayListener from '../ClickAwayListener'
|
|
12
11
|
import BackdropOrFragment from './BackdropOrFragment'
|
|
13
12
|
import {
|
|
14
13
|
computeMaxHeight,
|
|
@@ -53,7 +52,8 @@ const createStyles = ({ squared, hasToolbarProps }) => ({
|
|
|
53
52
|
position: 'fixed',
|
|
54
53
|
bottom: 0,
|
|
55
54
|
left: 0,
|
|
56
|
-
backgroundColor: 'var(--paperBackgroundColor)'
|
|
55
|
+
backgroundColor: 'var(--paperBackgroundColor)',
|
|
56
|
+
zIndex: 'var(--zIndex-overlay)'
|
|
57
57
|
},
|
|
58
58
|
flagshipImmersive: {
|
|
59
59
|
backgroundColor: 'var(--paperBackgroundColor)',
|
|
@@ -205,66 +205,62 @@ const BottomSheet = ({
|
|
|
205
205
|
{getFlagshipMetadata().immersive && (
|
|
206
206
|
<span style={styles.flagshipImmersive} />
|
|
207
207
|
)}
|
|
208
|
-
<BackdropOrFragment
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
208
|
+
<BackdropOrFragment
|
|
209
|
+
showBackdrop={showBackdrop}
|
|
210
|
+
onClick={() =>
|
|
211
|
+
minimizeAndClose({
|
|
212
|
+
backdrop,
|
|
213
|
+
setCurrentIndex,
|
|
214
|
+
setIsTopPosition,
|
|
215
|
+
setIsBottomPosition,
|
|
216
|
+
handleClose
|
|
217
|
+
})
|
|
218
|
+
}
|
|
219
|
+
/>
|
|
220
|
+
<MuiBottomSheet
|
|
221
|
+
peekHeights={peekHeights}
|
|
222
|
+
defaultHeight={initPos}
|
|
223
|
+
backdrop={false}
|
|
224
|
+
fullHeight={hasToolbarProps ? false : true}
|
|
225
|
+
currentIndex={currentIndex}
|
|
226
|
+
onIndexChange={handleOnIndexChange}
|
|
227
|
+
styles={{ root: styles.root }}
|
|
228
|
+
threshold={0}
|
|
229
|
+
// springConfig doc : https://docs.pmnd.rs/react-spring/common/configs
|
|
230
|
+
springConfig={{
|
|
231
|
+
tension: defaultBottomSheetSpringConfig.tension,
|
|
232
|
+
friction: defaultBottomSheetSpringConfig.friction,
|
|
233
|
+
clamp: defaultBottomSheetSpringConfig.clamp
|
|
234
|
+
}}
|
|
235
|
+
disabledClosing={!onClose}
|
|
236
|
+
hidden={isHidden}
|
|
237
|
+
snapPointSeekerMode="next"
|
|
238
|
+
>
|
|
239
|
+
<div ref={innerContentRef}>
|
|
240
|
+
<Paper
|
|
241
|
+
data-testid="bottomSheet-header"
|
|
242
|
+
className="u-w-100 u-h-2-half u-pos-relative u-flex u-flex-items-center u-flex-justify-center"
|
|
243
|
+
ref={headerRef}
|
|
244
|
+
elevation={0}
|
|
245
|
+
square
|
|
246
|
+
>
|
|
247
|
+
<div style={styles.indicator} />
|
|
248
|
+
</Paper>
|
|
249
|
+
<Stack
|
|
250
|
+
style={styles.stack}
|
|
251
|
+
className="u-flex u-flex-column u-ov-hidden"
|
|
252
|
+
spacing="s"
|
|
238
253
|
>
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
</Paper>
|
|
250
|
-
<Stack
|
|
251
|
-
style={styles.stack}
|
|
252
|
-
className="u-flex u-flex-column u-ov-hidden"
|
|
253
|
-
spacing="s"
|
|
254
|
-
>
|
|
255
|
-
{overriddenChildren}
|
|
256
|
-
</Stack>
|
|
257
|
-
</div>
|
|
258
|
-
<div style={{ height: backdrop ? 0 : bottomSpacerHeight }} />
|
|
259
|
-
</span>
|
|
260
|
-
</ClickAwayListener>
|
|
261
|
-
</MuiBottomSheet>
|
|
262
|
-
{!isBottomPosition && (
|
|
263
|
-
<Fade in timeout={ANIMATION_DURATION}>
|
|
264
|
-
<div style={styles.bounceSafer} />
|
|
265
|
-
</Fade>
|
|
266
|
-
)}
|
|
267
|
-
</BackdropOrFragment>
|
|
254
|
+
{overriddenChildren}
|
|
255
|
+
</Stack>
|
|
256
|
+
</div>
|
|
257
|
+
<div style={{ height: backdrop ? 0 : bottomSpacerHeight }} />
|
|
258
|
+
</MuiBottomSheet>
|
|
259
|
+
{!isBottomPosition && (
|
|
260
|
+
<Fade in timeout={ANIMATION_DURATION}>
|
|
261
|
+
<div style={styles.bounceSafer} />
|
|
262
|
+
</Fade>
|
|
263
|
+
)}
|
|
268
264
|
</>
|
|
269
265
|
)
|
|
270
266
|
}
|
|
@@ -3,13 +3,15 @@ import Backdrop from "cozy-ui/transpiled/react/Backdrop";
|
|
|
3
3
|
|
|
4
4
|
var BackdropOrFragment = function BackdropOrFragment(_ref) {
|
|
5
5
|
var showBackdrop = _ref.showBackdrop,
|
|
6
|
+
onClick = _ref.onClick,
|
|
6
7
|
children = _ref.children;
|
|
7
8
|
var Comp = showBackdrop ? Backdrop : Fragment;
|
|
8
9
|
var props = showBackdrop ? {
|
|
9
10
|
style: {
|
|
10
11
|
zIndex: 'var(--zIndex-overlay)'
|
|
11
12
|
},
|
|
12
|
-
open: showBackdrop
|
|
13
|
+
open: showBackdrop,
|
|
14
|
+
onClick: onClick
|
|
13
15
|
} : undefined;
|
|
14
16
|
return /*#__PURE__*/React.createElement(Comp, props, children);
|
|
15
17
|
};
|
|
@@ -14,7 +14,6 @@ import Fade from '@material-ui/core/Fade';
|
|
|
14
14
|
import { getFlagshipMetadata } from 'cozy-device-helper';
|
|
15
15
|
import Stack from "cozy-ui/transpiled/react/Stack";
|
|
16
16
|
import Paper from "cozy-ui/transpiled/react/Paper";
|
|
17
|
-
import ClickAwayListener from "cozy-ui/transpiled/react/ClickAwayListener";
|
|
18
17
|
import BackdropOrFragment from "cozy-ui/transpiled/react/BottomSheet/BackdropOrFragment";
|
|
19
18
|
import { computeMaxHeight, computeMediumHeight, computeMinHeight, makeOverridenChildren, setTopPosition, setBottomPosition, minimizeAndClose } from "cozy-ui/transpiled/react/BottomSheet/helpers";
|
|
20
19
|
import { ANIMATION_DURATION } from "cozy-ui/transpiled/react/BottomSheet/constants";
|
|
@@ -50,7 +49,8 @@ var createStyles = function createStyles(_ref) {
|
|
|
50
49
|
position: 'fixed',
|
|
51
50
|
bottom: 0,
|
|
52
51
|
left: 0,
|
|
53
|
-
backgroundColor: 'var(--paperBackgroundColor)'
|
|
52
|
+
backgroundColor: 'var(--paperBackgroundColor)',
|
|
53
|
+
zIndex: 'var(--zIndex-overlay)'
|
|
54
54
|
},
|
|
55
55
|
flagshipImmersive: {
|
|
56
56
|
backgroundColor: 'var(--paperBackgroundColor)',
|
|
@@ -210,8 +210,17 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
210
210
|
return /*#__PURE__*/React.createElement(React.Fragment, null, getFlagshipMetadata().immersive && /*#__PURE__*/React.createElement("span", {
|
|
211
211
|
style: styles.flagshipImmersive
|
|
212
212
|
}), /*#__PURE__*/React.createElement(BackdropOrFragment, {
|
|
213
|
-
showBackdrop: showBackdrop
|
|
214
|
-
|
|
213
|
+
showBackdrop: showBackdrop,
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
return minimizeAndClose({
|
|
216
|
+
backdrop: backdrop,
|
|
217
|
+
setCurrentIndex: setCurrentIndex,
|
|
218
|
+
setIsTopPosition: setIsTopPosition,
|
|
219
|
+
setIsBottomPosition: setIsBottomPosition,
|
|
220
|
+
handleClose: handleClose
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}), /*#__PURE__*/React.createElement(MuiBottomSheet, {
|
|
215
224
|
peekHeights: peekHeights,
|
|
216
225
|
defaultHeight: initPos,
|
|
217
226
|
backdrop: false,
|
|
@@ -231,17 +240,7 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
231
240
|
disabledClosing: !onClose,
|
|
232
241
|
hidden: isHidden,
|
|
233
242
|
snapPointSeekerMode: "next"
|
|
234
|
-
}, /*#__PURE__*/React.createElement(
|
|
235
|
-
onClickAway: function onClickAway() {
|
|
236
|
-
return minimizeAndClose({
|
|
237
|
-
backdrop: backdrop,
|
|
238
|
-
setCurrentIndex: setCurrentIndex,
|
|
239
|
-
setIsTopPosition: setIsTopPosition,
|
|
240
|
-
setIsBottomPosition: setIsBottomPosition,
|
|
241
|
-
handleClose: handleClose
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
245
244
|
ref: innerContentRef
|
|
246
245
|
}, /*#__PURE__*/React.createElement(Paper, {
|
|
247
246
|
"data-testid": "bottomSheet-header",
|
|
@@ -259,12 +258,12 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
259
258
|
style: {
|
|
260
259
|
height: backdrop ? 0 : bottomSpacerHeight
|
|
261
260
|
}
|
|
262
|
-
}))
|
|
261
|
+
})), !isBottomPosition && /*#__PURE__*/React.createElement(Fade, {
|
|
263
262
|
in: true,
|
|
264
263
|
timeout: ANIMATION_DURATION
|
|
265
264
|
}, /*#__PURE__*/React.createElement("div", {
|
|
266
265
|
style: styles.bounceSafer
|
|
267
|
-
})))
|
|
266
|
+
})));
|
|
268
267
|
};
|
|
269
268
|
|
|
270
269
|
BottomSheet.defaultProps = {
|