cozy-ui 70.2.1 → 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/.bundlemonrc +1 -2
- package/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/react/BottomSheet/BackdropOrFragment.jsx +6 -2
- package/react/BottomSheet/BottomSheet.jsx +61 -62
- package/react/BottomSheet/constants.js +1 -0
- package/react/BottomSheet/helpers.js +17 -0
- package/react/BottomSheet/helpers.spec.js +50 -1
- package/react/CozyDialogs/styles.styl +2 -2
- package/react/SquareAppIcon/Readme.md +13 -0
- package/react/SquareAppIcon/SquareAppIcon.spec.js +11 -0
- package/react/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +4 -4
- package/react/SquareAppIcon/index.jsx +2 -2
- package/transpiled/react/BottomSheet/BackdropOrFragment.js +3 -1
- package/transpiled/react/BottomSheet/BottomSheet.js +18 -18
- package/transpiled/react/BottomSheet/constants.js +1 -0
- package/transpiled/react/BottomSheet/helpers.js +15 -0
- package/transpiled/react/SquareAppIcon/index.js +2 -2
- package/transpiled/react/stylesheet.css +1 -1
package/.bundlemonrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
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
|
+
|
|
8
|
+
## [70.2.3](https://github.com/cozy/cozy-ui/compare/v70.2.2...v70.2.3) (2022-07-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **BottomSheet:** Remove bouncerSafer when clicking in backdrop ([93233dd](https://github.com/cozy/cozy-ui/commit/93233dd))
|
|
14
|
+
* **CozyDialogs:** Close and Back button z-index ([a943399](https://github.com/cozy/cozy-ui/commit/a943399))
|
|
15
|
+
|
|
16
|
+
## [70.2.2](https://github.com/cozy/cozy-ui/compare/v70.2.1...v70.2.2) (2022-07-26)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* Shortcut with IconContent ([a83c320](https://github.com/cozy/cozy-ui/commit/a83c320))
|
|
22
|
+
|
|
1
23
|
## [70.2.1](https://github.com/cozy/cozy-ui/compare/v70.2.0...v70.2.1) (2022-07-25)
|
|
2
24
|
|
|
3
25
|
|
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,
|
|
@@ -16,10 +15,10 @@ import {
|
|
|
16
15
|
computeMinHeight,
|
|
17
16
|
makeOverridenChildren,
|
|
18
17
|
setTopPosition,
|
|
19
|
-
setBottomPosition
|
|
18
|
+
setBottomPosition,
|
|
19
|
+
minimizeAndClose
|
|
20
20
|
} from './helpers'
|
|
21
|
-
|
|
22
|
-
const ANIMATION_DURATION = 250
|
|
21
|
+
import { ANIMATION_DURATION } from './constants'
|
|
23
22
|
|
|
24
23
|
const createStyles = ({ squared, hasToolbarProps }) => ({
|
|
25
24
|
root: {
|
|
@@ -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)',
|
|
@@ -125,13 +125,6 @@ const BottomSheet = ({
|
|
|
125
125
|
onClose && onClose()
|
|
126
126
|
}, [onClose])
|
|
127
127
|
|
|
128
|
-
const handleMinimizeAndClose = () => {
|
|
129
|
-
if (backdrop) {
|
|
130
|
-
setCurrentIndex(0)
|
|
131
|
-
setTimeout(handleClose, ANIMATION_DURATION)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
128
|
const handleOnIndexChange = snapIndex => {
|
|
136
129
|
const maxHeightSnapIndex = peekHeights.length - 1
|
|
137
130
|
|
|
@@ -212,56 +205,62 @@ const BottomSheet = ({
|
|
|
212
205
|
{getFlagshipMetadata().immersive && (
|
|
213
206
|
<span style={styles.flagshipImmersive} />
|
|
214
207
|
)}
|
|
215
|
-
<BackdropOrFragment
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
</
|
|
263
|
-
|
|
264
|
-
|
|
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"
|
|
253
|
+
>
|
|
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
|
+
)}
|
|
265
264
|
</>
|
|
266
265
|
)
|
|
267
266
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ANIMATION_DURATION = 250
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { getFlagshipMetadata } from 'cozy-device-helper'
|
|
3
3
|
|
|
4
|
+
import { ANIMATION_DURATION } from './constants'
|
|
5
|
+
|
|
4
6
|
export const computeMaxHeight = toolbarProps => {
|
|
5
7
|
const { ref, height } = toolbarProps
|
|
6
8
|
let computedToolbarHeight = 1
|
|
@@ -94,3 +96,18 @@ export const setBottomPosition = ({
|
|
|
94
96
|
setIsBottomPosition(false)
|
|
95
97
|
}
|
|
96
98
|
}
|
|
99
|
+
|
|
100
|
+
export const minimizeAndClose = ({
|
|
101
|
+
backdrop,
|
|
102
|
+
setCurrentIndex,
|
|
103
|
+
setIsTopPosition,
|
|
104
|
+
setIsBottomPosition,
|
|
105
|
+
handleClose
|
|
106
|
+
}) => {
|
|
107
|
+
if (backdrop) {
|
|
108
|
+
setCurrentIndex(0)
|
|
109
|
+
setIsTopPosition(false)
|
|
110
|
+
setIsBottomPosition(true)
|
|
111
|
+
setTimeout(handleClose, ANIMATION_DURATION)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
computeMediumHeight,
|
|
4
4
|
computeMinHeight,
|
|
5
5
|
setTopPosition,
|
|
6
|
-
setBottomPosition
|
|
6
|
+
setBottomPosition,
|
|
7
|
+
minimizeAndClose
|
|
7
8
|
} from './helpers'
|
|
8
9
|
|
|
9
10
|
jest.mock('cozy-device-helper', () => ({
|
|
@@ -233,3 +234,51 @@ describe('setBottomPosition', () => {
|
|
|
233
234
|
})
|
|
234
235
|
})
|
|
235
236
|
})
|
|
237
|
+
|
|
238
|
+
describe('minimizeAndClose', () => {
|
|
239
|
+
jest.useFakeTimers()
|
|
240
|
+
|
|
241
|
+
it('should not trigger function if no backdrop', () => {
|
|
242
|
+
const setCurrentIndex = jest.fn()
|
|
243
|
+
const setIsTopPosition = jest.fn()
|
|
244
|
+
const setIsBottomPosition = jest.fn()
|
|
245
|
+
const handleClose = jest.fn()
|
|
246
|
+
|
|
247
|
+
minimizeAndClose({
|
|
248
|
+
backdrop: false,
|
|
249
|
+
setCurrentIndex,
|
|
250
|
+
setIsTopPosition,
|
|
251
|
+
setIsBottomPosition,
|
|
252
|
+
handleClose
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
jest.runAllTimers()
|
|
256
|
+
|
|
257
|
+
expect(setCurrentIndex).not.toHaveBeenCalled()
|
|
258
|
+
expect(setIsTopPosition).not.toHaveBeenCalled()
|
|
259
|
+
expect(setIsBottomPosition).not.toHaveBeenCalled()
|
|
260
|
+
expect(handleClose).not.toHaveBeenCalled()
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
it('should trigger every function if backdrop is true', () => {
|
|
264
|
+
const setCurrentIndex = jest.fn()
|
|
265
|
+
const setIsTopPosition = jest.fn()
|
|
266
|
+
const setIsBottomPosition = jest.fn()
|
|
267
|
+
const handleClose = jest.fn()
|
|
268
|
+
|
|
269
|
+
minimizeAndClose({
|
|
270
|
+
backdrop: true,
|
|
271
|
+
setCurrentIndex,
|
|
272
|
+
setIsTopPosition,
|
|
273
|
+
setIsBottomPosition,
|
|
274
|
+
handleClose
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
jest.runAllTimers()
|
|
278
|
+
|
|
279
|
+
expect(setCurrentIndex).toHaveBeenCalledWith(0)
|
|
280
|
+
expect(setIsTopPosition).toHaveBeenCalledWith(false)
|
|
281
|
+
expect(setIsBottomPosition).toHaveBeenCalledWith(true)
|
|
282
|
+
expect(handleClose).toHaveBeenCalled()
|
|
283
|
+
})
|
|
284
|
+
})
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
position absolute
|
|
5
5
|
top 1.15rem
|
|
6
6
|
right 1.15rem
|
|
7
|
-
z-index
|
|
7
|
+
z-index 1
|
|
8
8
|
transform translateY(var(--flagship-top-height))
|
|
9
9
|
+small-screen()
|
|
10
10
|
top 0.25rem
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
position absolute
|
|
15
15
|
top 1.15rem
|
|
16
16
|
left 1.15rem
|
|
17
|
-
z-index
|
|
17
|
+
z-index 1
|
|
18
18
|
+small-screen()
|
|
19
19
|
top 0.25rem
|
|
20
20
|
left 0.25rem
|
|
@@ -35,6 +35,19 @@ const app = { name: "Test App", slug: "testapp", type: "app" }
|
|
|
35
35
|
<Grid item>
|
|
36
36
|
<SquareAppIcon name="Shortcut" variant="shortcut" />
|
|
37
37
|
</Grid>
|
|
38
|
+
<Grid item>
|
|
39
|
+
<SquareAppIcon name="Shortcut" variant="shortcut" IconContent={<img
|
|
40
|
+
src={`data:image/svg+xml;base64,${window.btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
41
|
+
<g fill="none" fill-rule="evenodd" transform="translate(0 2)">
|
|
42
|
+
<rect width="32" height="26" y="2" fill="#B2D3FF" rx="2"/>
|
|
43
|
+
<path fill="#197BFF" d="M0,0.990777969 C0,0.443586406 0.449948758,0 1.00684547,0 L12.9931545,0 C13.5492199,0 14.3125,0.3125 14.7107565,0.71075654 L15.2892435,1.28924346 C15.6817835,1.68178346 16.4446309,2 17.0008717,2 L30.0059397,2 C31.1072288,2 32,2.89470506 32,4 L32,4 L17.0008717,4 C16.4481055,4 15.6875,4.3125 15.2892435,4.71075654 L14.7107565,5.28924346 C14.3182165,5.68178346 13.5500512,6 12.9931545,6 L1.00684547,6 C0.450780073,6 0,5.54902482 0,5.00922203 L0,0.990777969 Z"/>
|
|
44
|
+
</g>
|
|
45
|
+
</svg>`)}`}
|
|
46
|
+
width={32}
|
|
47
|
+
height={32}
|
|
48
|
+
alt={"Shortcut"}
|
|
49
|
+
/>}/>
|
|
50
|
+
</Grid>
|
|
38
51
|
<Grid item>
|
|
39
52
|
<SquareAppIcon name="Custom Icon" IconContent={<Icon icon={CozyIcon} size="48" />} />
|
|
40
53
|
</Grid>
|
|
@@ -69,6 +69,17 @@ describe('SquareAppIcon component', () => {
|
|
|
69
69
|
expect(root.getByTestId('square-app-icon')).toMatchSnapshot()
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
+
it('should display icon-content an app with icon content in shortcut state', () => {
|
|
73
|
+
const { queryByTestId } = render(
|
|
74
|
+
<Wrapper
|
|
75
|
+
variant="shortcut"
|
|
76
|
+
name="shortcut"
|
|
77
|
+
IconContent={<Icon data-testid="icon-content" icon={CozyIcon} />}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
expect(queryByTestId('icon-content')).toBeTruthy()
|
|
81
|
+
})
|
|
82
|
+
|
|
72
83
|
it('should render correctly an app with custom content', () => {
|
|
73
84
|
const root = render(
|
|
74
85
|
<Wrapper name="custom icon" IconContent={<Icon icon={CozyIcon} />} />
|
|
@@ -358,14 +358,14 @@ exports[`SquareAppIcon component should render correctly an app in shortcut stat
|
|
|
358
358
|
|
|
359
359
|
exports[`SquareAppIcon component should render correctly an app with custom content 1`] = `
|
|
360
360
|
<div
|
|
361
|
-
class="makeStyles-tileWrapper-
|
|
361
|
+
class="makeStyles-tileWrapper-59"
|
|
362
362
|
data-testid="square-app-icon"
|
|
363
363
|
>
|
|
364
364
|
<span
|
|
365
365
|
class="MuiBadge-root"
|
|
366
366
|
>
|
|
367
367
|
<span
|
|
368
|
-
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-
|
|
368
|
+
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-57"
|
|
369
369
|
>
|
|
370
370
|
<div
|
|
371
371
|
class="styles__SquareAppIcon-icon-container___39MRl"
|
|
@@ -388,11 +388,11 @@ exports[`SquareAppIcon component should render correctly an app with custom cont
|
|
|
388
388
|
/>
|
|
389
389
|
</span>
|
|
390
390
|
<span
|
|
391
|
-
class="MuiBadge-badge Component-qualifier-
|
|
391
|
+
class="MuiBadge-badge Component-qualifier-60 MuiBadge-anchorOriginBottomRightRectangular MuiBadge-invisible"
|
|
392
392
|
/>
|
|
393
393
|
</span>
|
|
394
394
|
<h6
|
|
395
|
-
class="MuiTypography-root makeStyles-name-
|
|
395
|
+
class="MuiTypography-root makeStyles-name-55 u-spacellipsis MuiTypography-h6 MuiTypography-colorTextPrimary MuiTypography-alignCenter"
|
|
396
396
|
>
|
|
397
397
|
custom icon
|
|
398
398
|
</h6>
|
|
@@ -109,12 +109,12 @@ export const SquareAppIcon = ({
|
|
|
109
109
|
size="large"
|
|
110
110
|
overlap="rectangular"
|
|
111
111
|
style={
|
|
112
|
-
variant === 'shortcut'
|
|
112
|
+
variant === 'shortcut' && !IconContent
|
|
113
113
|
? { backgroundColor: nameToColor(name) }
|
|
114
114
|
: null
|
|
115
115
|
}
|
|
116
116
|
>
|
|
117
|
-
{variant === 'shortcut' ? (
|
|
117
|
+
{variant === 'shortcut' && !IconContent ? (
|
|
118
118
|
<Typography className={classes.letter} variant="h2" align="center">
|
|
119
119
|
{letter.toUpperCase()}
|
|
120
120
|
</Typography>
|
|
@@ -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,10 +14,9 @@ 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
|
-
import { computeMaxHeight, computeMediumHeight, computeMinHeight, makeOverridenChildren, setTopPosition, setBottomPosition } from "cozy-ui/transpiled/react/BottomSheet/helpers";
|
|
20
|
-
|
|
18
|
+
import { computeMaxHeight, computeMediumHeight, computeMinHeight, makeOverridenChildren, setTopPosition, setBottomPosition, minimizeAndClose } from "cozy-ui/transpiled/react/BottomSheet/helpers";
|
|
19
|
+
import { ANIMATION_DURATION } from "cozy-ui/transpiled/react/BottomSheet/constants";
|
|
21
20
|
|
|
22
21
|
var createStyles = function createStyles(_ref) {
|
|
23
22
|
var squared = _ref.squared,
|
|
@@ -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)',
|
|
@@ -148,13 +148,6 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
148
148
|
onClose && onClose();
|
|
149
149
|
}, [onClose]);
|
|
150
150
|
|
|
151
|
-
var handleMinimizeAndClose = function handleMinimizeAndClose() {
|
|
152
|
-
if (backdrop) {
|
|
153
|
-
setCurrentIndex(0);
|
|
154
|
-
setTimeout(handleClose, ANIMATION_DURATION);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
151
|
var handleOnIndexChange = function handleOnIndexChange(snapIndex) {
|
|
159
152
|
var maxHeightSnapIndex = peekHeights.length - 1;
|
|
160
153
|
setCurrentIndex(snapIndex);
|
|
@@ -217,8 +210,17 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
217
210
|
return /*#__PURE__*/React.createElement(React.Fragment, null, getFlagshipMetadata().immersive && /*#__PURE__*/React.createElement("span", {
|
|
218
211
|
style: styles.flagshipImmersive
|
|
219
212
|
}), /*#__PURE__*/React.createElement(BackdropOrFragment, {
|
|
220
|
-
showBackdrop: showBackdrop
|
|
221
|
-
|
|
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, {
|
|
222
224
|
peekHeights: peekHeights,
|
|
223
225
|
defaultHeight: initPos,
|
|
224
226
|
backdrop: false,
|
|
@@ -238,9 +240,7 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
238
240
|
disabledClosing: !onClose,
|
|
239
241
|
hidden: isHidden,
|
|
240
242
|
snapPointSeekerMode: "next"
|
|
241
|
-
}, /*#__PURE__*/React.createElement(
|
|
242
|
-
onClickAway: handleMinimizeAndClose
|
|
243
|
-
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
244
244
|
ref: innerContentRef
|
|
245
245
|
}, /*#__PURE__*/React.createElement(Paper, {
|
|
246
246
|
"data-testid": "bottomSheet-header",
|
|
@@ -258,12 +258,12 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
258
258
|
style: {
|
|
259
259
|
height: backdrop ? 0 : bottomSpacerHeight
|
|
260
260
|
}
|
|
261
|
-
}))
|
|
261
|
+
})), !isBottomPosition && /*#__PURE__*/React.createElement(Fade, {
|
|
262
262
|
in: true,
|
|
263
263
|
timeout: ANIMATION_DURATION
|
|
264
264
|
}, /*#__PURE__*/React.createElement("div", {
|
|
265
265
|
style: styles.bounceSafer
|
|
266
|
-
})))
|
|
266
|
+
})));
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
BottomSheet.defaultProps = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var ANIMATION_DURATION = 250;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getFlagshipMetadata } from 'cozy-device-helper';
|
|
3
|
+
import { ANIMATION_DURATION } from "cozy-ui/transpiled/react/BottomSheet/constants";
|
|
3
4
|
export var computeMaxHeight = function computeMaxHeight(toolbarProps) {
|
|
4
5
|
var ref = toolbarProps.ref,
|
|
5
6
|
height = toolbarProps.height;
|
|
@@ -82,4 +83,18 @@ export var setBottomPosition = function setBottomPosition(_ref4) {
|
|
|
82
83
|
if (snapIndex !== 0 && isBottomPosition) {
|
|
83
84
|
setIsBottomPosition(false);
|
|
84
85
|
}
|
|
86
|
+
};
|
|
87
|
+
export var minimizeAndClose = function minimizeAndClose(_ref5) {
|
|
88
|
+
var backdrop = _ref5.backdrop,
|
|
89
|
+
setCurrentIndex = _ref5.setCurrentIndex,
|
|
90
|
+
setIsTopPosition = _ref5.setIsTopPosition,
|
|
91
|
+
setIsBottomPosition = _ref5.setIsBottomPosition,
|
|
92
|
+
handleClose = _ref5.handleClose;
|
|
93
|
+
|
|
94
|
+
if (backdrop) {
|
|
95
|
+
setCurrentIndex(0);
|
|
96
|
+
setIsTopPosition(false);
|
|
97
|
+
setIsBottomPosition(true);
|
|
98
|
+
setTimeout(handleClose, ANIMATION_DURATION);
|
|
99
|
+
}
|
|
85
100
|
};
|
|
@@ -105,10 +105,10 @@ export var SquareAppIcon = function SquareAppIcon(_ref) {
|
|
|
105
105
|
withBorder: false,
|
|
106
106
|
size: "large",
|
|
107
107
|
overlap: "rectangular",
|
|
108
|
-
style: variant === 'shortcut' ? {
|
|
108
|
+
style: variant === 'shortcut' && !IconContent ? {
|
|
109
109
|
backgroundColor: nameToColor(name)
|
|
110
110
|
} : null
|
|
111
|
-
}, variant === 'shortcut' ? /*#__PURE__*/React.createElement(Typography, {
|
|
111
|
+
}, variant === 'shortcut' && !IconContent ? /*#__PURE__*/React.createElement(Typography, {
|
|
112
112
|
className: classes.letter,
|
|
113
113
|
variant: "h2",
|
|
114
114
|
align: "center"
|