cozy-ui 125.0.0 → 126.0.0
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 +25 -0
- package/package.json +1 -1
- package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +12 -10
- package/react/QualificationIcon/Readme.md +14 -0
- package/react/{QualificationIconStack → QualificationIcon}/index.jsx +7 -34
- package/react/QualificationModal/helpers.js +6 -6
- package/react/helpers/breakpoints.js +10 -2
- package/react/index.js +1 -1
- package/react/providers/Breakpoints/Readme.md +2 -0
- package/react/providers/Breakpoints/index.jsx +23 -9
- package/react/providers/Breakpoints/useIframeConnection.jsx +31 -0
- package/react/providers/Breakpoints/useIframeToSendWidth.jsx +33 -0
- package/react/providers/Breakpoints/useParentBreakpoints.jsx +36 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +12 -10
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +12 -10
- package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +12 -10
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +12 -10
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +14 -8
- package/transpiled/react/{QualificationIconStack → QualificationIcon}/index.d.ts +3 -3
- package/transpiled/react/{QualificationIconStack → QualificationIcon}/index.js +14 -38
- package/transpiled/react/QualificationModal/helpers.js +8 -7
- package/transpiled/react/helpers/breakpoints.d.ts +2 -1
- package/transpiled/react/helpers/breakpoints.js +9 -2
- package/transpiled/react/index.d.ts +1 -1
- package/transpiled/react/index.js +1 -1
- package/transpiled/react/providers/Breakpoints/index.d.ts +12 -1
- package/transpiled/react/providers/Breakpoints/index.js +31 -10
- package/transpiled/react/providers/Breakpoints/useIframeConnection.d.ts +5 -0
- package/transpiled/react/providers/Breakpoints/useIframeConnection.js +35 -0
- package/transpiled/react/providers/Breakpoints/useIframeToSendWidth.d.ts +3 -0
- package/transpiled/react/providers/Breakpoints/useIframeToSendWidth.js +32 -0
- package/transpiled/react/providers/Breakpoints/useParentBreakpoints.d.ts +5 -0
- package/transpiled/react/providers/Breakpoints/useParentBreakpoints.js +34 -0
- package/react/QualificationIconStack/Readme.md +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
# [126.0.0](https://github.com/cozy/cozy-ui/compare/v125.1.0...v126.0.0) (2025-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add new QualificationIcon and use it in QualificationModal ([65cadc4](https://github.com/cozy/cozy-ui/commit/65cadc4))
|
|
7
|
+
* Remove QualificationIconStack component ([d520f80](https://github.com/cozy/cozy-ui/commit/d520f80))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* You must replace `QualificationIconStack` by `QualificationIcon`
|
|
13
|
+
|
|
14
|
+
# [125.1.0](https://github.com/cozy/cozy-ui/compare/v125.0.0...v125.1.0) (2025-06-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **Dialog:** Width wasn't correct for small screens ([0951f70](https://github.com/cozy/cozy-ui/commit/0951f70))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **BreakpointsProvider:** Add `parentBasedIframe` prop ([4a49946](https://github.com/cozy/cozy-ui/commit/4a49946))
|
|
25
|
+
|
|
1
26
|
# [125.0.0](https://github.com/cozy/cozy-ui/compare/v124.2.0...v125.0.0) (2025-06-05)
|
|
2
27
|
|
|
3
28
|
|
package/package.json
CHANGED
|
@@ -586,8 +586,8 @@ export const makeLightNormalOverrides = theme => ({
|
|
|
586
586
|
},
|
|
587
587
|
MuiDialog: {
|
|
588
588
|
paper: {
|
|
589
|
+
width: '100%',
|
|
589
590
|
'&.small': {
|
|
590
|
-
width: '480px',
|
|
591
591
|
maxWidth: '480px',
|
|
592
592
|
[theme.breakpoints.down('md')]: {
|
|
593
593
|
margin: '16px',
|
|
@@ -602,19 +602,12 @@ export const makeLightNormalOverrides = theme => ({
|
|
|
602
602
|
}
|
|
603
603
|
},
|
|
604
604
|
'&.medium': {
|
|
605
|
-
|
|
606
|
-
width: '544px',
|
|
607
|
-
maxWidth: '544px'
|
|
608
|
-
}
|
|
605
|
+
maxWidth: '544px'
|
|
609
606
|
},
|
|
610
607
|
'&.large': {
|
|
611
|
-
|
|
612
|
-
width: '800px',
|
|
613
|
-
maxWidth: '800px'
|
|
614
|
-
}
|
|
608
|
+
maxWidth: '800px'
|
|
615
609
|
},
|
|
616
610
|
'&.full': {
|
|
617
|
-
width: '100%',
|
|
618
611
|
maxWidth: '100%'
|
|
619
612
|
}
|
|
620
613
|
},
|
|
@@ -624,6 +617,15 @@ export const makeLightNormalOverrides = theme => ({
|
|
|
624
617
|
}
|
|
625
618
|
},
|
|
626
619
|
paperFullScreen: {
|
|
620
|
+
'&.small': {
|
|
621
|
+
maxWidth: '100%'
|
|
622
|
+
},
|
|
623
|
+
'&.medium': {
|
|
624
|
+
maxWidth: '100%'
|
|
625
|
+
},
|
|
626
|
+
'&.large': {
|
|
627
|
+
maxWidth: '100%'
|
|
628
|
+
},
|
|
627
629
|
'& .cozyDialogActions': {
|
|
628
630
|
paddingBottom: `calc(env(safe-area-inset-bottom) + ${getFlagshipCssVar(
|
|
629
631
|
'bottom'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
```jsx
|
|
2
|
+
import QualificationIcon from 'cozy-ui/transpiled/react/QualificationIcon'
|
|
3
|
+
|
|
4
|
+
;
|
|
5
|
+
|
|
6
|
+
<>
|
|
7
|
+
<QualificationIcon className="u-mr-1" />
|
|
8
|
+
<QualificationIcon className="u-mr-1" qualification="isp_invoice" />
|
|
9
|
+
<QualificationIcon className="u-mr-1" qualification="phone_invoice" />
|
|
10
|
+
<QualificationIcon className="u-mr-1" qualification="family_record_book" />
|
|
11
|
+
<QualificationIcon className="u-mr-1" theme="identity" />
|
|
12
|
+
<QualificationIcon theme="transport" />
|
|
13
|
+
</>
|
|
14
|
+
```
|
|
@@ -4,7 +4,6 @@ import React from 'react'
|
|
|
4
4
|
import { getIconByLabel } from 'cozy-client/dist/models/document/qualification'
|
|
5
5
|
|
|
6
6
|
import Icon from '../Icon'
|
|
7
|
-
import IconStack from '../IconStack'
|
|
8
7
|
import BankIcon from '../Icons/Bank'
|
|
9
8
|
import BankCheckIcon from '../Icons/BankCheck'
|
|
10
9
|
import BenefitIcon from '../Icons/Benefit'
|
|
@@ -16,8 +15,6 @@ import DotsIcon from '../Icons/Dots'
|
|
|
16
15
|
import EmailIcon from '../Icons/Email'
|
|
17
16
|
import EuroIcon from '../Icons/Euro'
|
|
18
17
|
import ExchangeIcon from '../Icons/Exchange'
|
|
19
|
-
import FileDuotoneIcon from '../Icons/FileDuotone'
|
|
20
|
-
import FileTypeNoteIcon from '../Icons/FileTypeNote'
|
|
21
18
|
import FitnessIcon from '../Icons/Fitness'
|
|
22
19
|
import GlobeIcon from '../Icons/Globe'
|
|
23
20
|
import GouvIcon from '../Icons/Gouv'
|
|
@@ -27,6 +24,7 @@ import ImageIcon from '../Icons/Image'
|
|
|
27
24
|
import JusticeIcon from '../Icons/Justice'
|
|
28
25
|
import LaudryIcon from '../Icons/Laudry'
|
|
29
26
|
import LightningIcon from '../Icons/Lightning'
|
|
27
|
+
import NoteIcon from '../Icons/Note'
|
|
30
28
|
import PeopleIcon from '../Icons/People'
|
|
31
29
|
import PlaneIcon from '../Icons/Plane'
|
|
32
30
|
import RemboursementIcon from '../Icons/Remboursement'
|
|
@@ -39,20 +37,6 @@ import TelephoneIcon from '../Icons/Telephone'
|
|
|
39
37
|
import WaterIcon from '../Icons/Water'
|
|
40
38
|
import WorkIcon from '../Icons/Work'
|
|
41
39
|
|
|
42
|
-
// this is a copy of FileDuotone without the flap and with a white background
|
|
43
|
-
function FileDuotoneWhite(props) {
|
|
44
|
-
return (
|
|
45
|
-
<svg viewBox="0 0 26 32" {...props}>
|
|
46
|
-
<g fillRule="evenodd">
|
|
47
|
-
<path
|
|
48
|
-
d="M0 2.002C0 .896.89 0 1.997 0H19l7 7v22.996A2 2 0 0124.003 32H1.997A1.995 1.995 0 010 29.998C.048 16 0 16 0 2.002z"
|
|
49
|
-
fill="#ffffff"
|
|
50
|
-
/>
|
|
51
|
-
</g>
|
|
52
|
-
</svg>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
40
|
const IconByLabel = {
|
|
57
41
|
'bank-check': BankCheckIcon,
|
|
58
42
|
bank: BankIcon,
|
|
@@ -65,7 +49,7 @@ const IconByLabel = {
|
|
|
65
49
|
email: EmailIcon,
|
|
66
50
|
euro: EuroIcon,
|
|
67
51
|
exchange: ExchangeIcon,
|
|
68
|
-
'file-type-note':
|
|
52
|
+
'file-type-note': NoteIcon,
|
|
69
53
|
fitness: FitnessIcon,
|
|
70
54
|
globe: GlobeIcon,
|
|
71
55
|
gouv: GouvIcon,
|
|
@@ -101,32 +85,21 @@ const themeIconByLabel = {
|
|
|
101
85
|
others: 'dots'
|
|
102
86
|
}
|
|
103
87
|
|
|
104
|
-
const
|
|
105
|
-
const
|
|
88
|
+
const QualificationIcon = ({ theme, qualification, ...props }) => {
|
|
89
|
+
const _Icon = qualification
|
|
106
90
|
? IconByLabel[getIconByLabel(qualification)]
|
|
107
91
|
: theme
|
|
108
92
|
? IconByLabel[themeIconByLabel[theme]]
|
|
109
93
|
: null
|
|
110
94
|
|
|
111
|
-
return
|
|
112
|
-
<IconStack
|
|
113
|
-
{...props}
|
|
114
|
-
backgroundIcon={
|
|
115
|
-
<>
|
|
116
|
-
<Icon className="u-pos-absolute" icon={FileDuotoneWhite} size={32} />
|
|
117
|
-
<Icon icon={FileDuotoneIcon} color="#E049BF" size={32} />
|
|
118
|
-
</>
|
|
119
|
-
}
|
|
120
|
-
foregroundIcon={<Icon icon={ForegroundIcon} color="#E049BF" size={16} />}
|
|
121
|
-
/>
|
|
122
|
-
)
|
|
95
|
+
return <Icon icon={_Icon} color="#E049BF" size={16} {...props} />
|
|
123
96
|
}
|
|
124
97
|
|
|
125
|
-
|
|
98
|
+
QualificationIcon.propTypes = {
|
|
126
99
|
/** The name of the qualification (isp\_invoice, family\_record\_book, etc.) */
|
|
127
100
|
qualification: PropTypes.string,
|
|
128
101
|
/** The name of the qualification theme (indentity, family, etc.) */
|
|
129
102
|
theme: PropTypes.string
|
|
130
103
|
}
|
|
131
104
|
|
|
132
|
-
export default
|
|
105
|
+
export default QualificationIcon
|
|
@@ -5,8 +5,8 @@ import { isQualificationNote } from 'cozy-client/dist/models/document/documentTy
|
|
|
5
5
|
import { getBoundT } from 'cozy-client/dist/models/document/locales'
|
|
6
6
|
|
|
7
7
|
import Icon from '../Icon'
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import NoteIcon from '../Icons/Note'
|
|
9
|
+
import QualificationIcon from '../QualificationIcon'
|
|
10
10
|
|
|
11
11
|
export const makeOptions = lang => {
|
|
12
12
|
const qualifT = getBoundT(lang)
|
|
@@ -16,20 +16,20 @@ export const makeOptions = lang => {
|
|
|
16
16
|
{
|
|
17
17
|
id: 'none',
|
|
18
18
|
title: qualifT('Scan.themes.none'),
|
|
19
|
-
icon: <
|
|
19
|
+
icon: <QualificationIcon />
|
|
20
20
|
},
|
|
21
21
|
...themesList.map(theme => ({
|
|
22
22
|
id: theme.id,
|
|
23
23
|
title: qualifT(`Scan.themes.${theme.label}`),
|
|
24
|
-
icon: <
|
|
24
|
+
icon: <QualificationIcon theme={theme.label} />,
|
|
25
25
|
children: theme.items.map(item => ({
|
|
26
26
|
id: item.label,
|
|
27
27
|
item,
|
|
28
28
|
title: qualifT(`Scan.items.${item.label}`),
|
|
29
29
|
icon: isQualificationNote(item) ? (
|
|
30
|
-
<Icon icon={
|
|
30
|
+
<Icon icon={NoteIcon} color="#E049BF" size={16} />
|
|
31
31
|
) : (
|
|
32
|
-
<
|
|
32
|
+
<QualificationIcon qualification={item.label} />
|
|
33
33
|
)
|
|
34
34
|
}))
|
|
35
35
|
}))
|
|
@@ -16,12 +16,20 @@ const breakpoints = {
|
|
|
16
16
|
isMobile: [0, small]
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const getBreakpointsStatus = breakpoints => {
|
|
20
|
-
const width = window.innerWidth
|
|
19
|
+
export const getBreakpointsStatus = (breakpoints, innerWidth) => {
|
|
20
|
+
const width = innerWidth || window.innerWidth
|
|
21
21
|
return mapValues(
|
|
22
22
|
breakpoints,
|
|
23
23
|
([min, max]) => width >= min && (max === undefined || width <= max)
|
|
24
24
|
)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export const isInsideIframe = () => {
|
|
28
|
+
try {
|
|
29
|
+
return window.self !== window.top
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
export default breakpoints
|
package/react/index.js
CHANGED
|
@@ -125,7 +125,7 @@ export { default as Thumbnail } from './Thumbnail'
|
|
|
125
125
|
export { default as ButtonBase } from './ButtonBase'
|
|
126
126
|
export { default as QualificationGrid } from './QualificationGrid'
|
|
127
127
|
export { default as QualificationItem } from './QualificationItem'
|
|
128
|
-
export { default as
|
|
128
|
+
export { default as QualificationIcon } from './QualificationIcon'
|
|
129
129
|
export { default as QualificationModal } from './QualificationModal'
|
|
130
130
|
export { default as Timeline } from './Timeline'
|
|
131
131
|
export { default as TimelineConnector } from './TimelineConnector'
|
|
@@ -15,6 +15,8 @@ completely change the content, the layout, or prune away complete
|
|
|
15
15
|
subtrees (useful on mobile where space is at a premium). Here for
|
|
16
16
|
example, the square contents changes on desktop or mobile.
|
|
17
17
|
|
|
18
|
+
By default, using `useBreakpoints` inside an iframe will refere to the iframe inner width. If you use `parentBasedIframe=true` on the provider wrapping the iframe, the breakpoints returned inside the iframe will refere to the parent window inner width instead.
|
|
19
|
+
|
|
18
20
|
```jsx
|
|
19
21
|
import useBreakpoints, { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
20
22
|
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import throttle from 'lodash/throttle'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
import React, { createContext, useContext, useState, useEffect } from 'react'
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
} from '
|
|
7
|
-
|
|
8
|
-
const getBreakpointsStatus = () => _getBreakpointsStatus(breakpointDefs)
|
|
5
|
+
import { useIframeConnection } from './useIframeConnection'
|
|
6
|
+
import { useIframeToSendWidth } from './useIframeToSendWidth'
|
|
7
|
+
import { useParentBreakpoints } from './useParentBreakpoints'
|
|
8
|
+
import breakpointDefs, { getBreakpointsStatus } from '../../helpers/breakpoints'
|
|
9
9
|
|
|
10
10
|
const BreakpointsCtx = createContext(null)
|
|
11
11
|
|
|
12
|
-
export const BreakpointsProvider = ({ children }) => {
|
|
13
|
-
const [breakpoints, setBreakpoints] = useState(
|
|
12
|
+
export const BreakpointsProvider = ({ parentBasedIframe, children }) => {
|
|
13
|
+
const [breakpoints, setBreakpoints] = useState(
|
|
14
|
+
getBreakpointsStatus(breakpointDefs)
|
|
15
|
+
)
|
|
16
|
+
const { hasIframe } = useIframeConnection({ parentBasedIframe })
|
|
17
|
+
useIframeToSendWidth({ hasIframe })
|
|
18
|
+
const { parentBreakpoints } = useParentBreakpoints({ parentBasedIframe })
|
|
14
19
|
|
|
15
20
|
useEffect(() => {
|
|
16
21
|
const handleResize = throttle(() => {
|
|
17
|
-
setBreakpoints(getBreakpointsStatus())
|
|
22
|
+
setBreakpoints(getBreakpointsStatus(breakpointDefs))
|
|
18
23
|
}, 100)
|
|
19
24
|
|
|
20
25
|
window.addEventListener('resize', handleResize)
|
|
@@ -25,12 +30,21 @@ export const BreakpointsProvider = ({ children }) => {
|
|
|
25
30
|
}, [])
|
|
26
31
|
|
|
27
32
|
return (
|
|
28
|
-
<BreakpointsCtx.Provider value={breakpoints}>
|
|
33
|
+
<BreakpointsCtx.Provider value={parentBreakpoints || breakpoints}>
|
|
29
34
|
{children}
|
|
30
35
|
</BreakpointsCtx.Provider>
|
|
31
36
|
)
|
|
32
37
|
}
|
|
33
38
|
|
|
39
|
+
BreakpointsProvider.defaultProps = {
|
|
40
|
+
parentBasedIframe: false
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
BreakpointsProvider.propTypes = {
|
|
44
|
+
/** Iframes breakpoints are based on parent window inner width instead of iframe inner width */
|
|
45
|
+
parentBasedIframe: PropTypes.bool
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
export const useBreakpoints = () => {
|
|
35
49
|
const v = useContext(BreakpointsCtx)
|
|
36
50
|
if (v === null) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { isInsideIframe } from '../../helpers/breakpoints'
|
|
4
|
+
|
|
5
|
+
export const useIframeConnection = ({ parentBasedIframe }) => {
|
|
6
|
+
const [hasIframe, setHasIframe] = useState(false)
|
|
7
|
+
|
|
8
|
+
const isIframe = parentBasedIframe && isInsideIframe()
|
|
9
|
+
|
|
10
|
+
// parent window receives from iframe to give breakpoints
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const handleMessage = ev => {
|
|
13
|
+
if (ev.data === 'UI-breakpoints-needParentBreakpoints') {
|
|
14
|
+
setHasIframe(true)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window.addEventListener('message', handleMessage)
|
|
19
|
+
|
|
20
|
+
return () => window.removeEventListener('message', handleMessage)
|
|
21
|
+
}, [])
|
|
22
|
+
|
|
23
|
+
// iframe send to parent window ask for its breakpoints
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (isIframe) {
|
|
26
|
+
window.parent.postMessage('UI-breakpoints-needParentBreakpoints', '*')
|
|
27
|
+
}
|
|
28
|
+
}, [isIframe])
|
|
29
|
+
|
|
30
|
+
return { hasIframe }
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import throttle from 'lodash/throttle'
|
|
2
|
+
import { useEffect } from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* To send window innerWidth to first iframe
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
const sendWidthToIframe = () =>
|
|
9
|
+
window.frames[1].postMessage(`UI-breakpoints-value:${window.innerWidth}`, '*')
|
|
10
|
+
|
|
11
|
+
export const useIframeToSendWidth = ({ hasIframe }) => {
|
|
12
|
+
// parent window send its innerWidth
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (hasIframe) {
|
|
15
|
+
sendWidthToIframe()
|
|
16
|
+
}
|
|
17
|
+
}, [hasIframe])
|
|
18
|
+
|
|
19
|
+
// parent window send its innerWidth on resize
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const handleResize = throttle(() => {
|
|
22
|
+
if (hasIframe) {
|
|
23
|
+
sendWidthToIframe()
|
|
24
|
+
}
|
|
25
|
+
}, 100)
|
|
26
|
+
|
|
27
|
+
window.addEventListener('resize', handleResize)
|
|
28
|
+
|
|
29
|
+
return () => {
|
|
30
|
+
window.removeEventListener('resize', handleResize)
|
|
31
|
+
}
|
|
32
|
+
}, [hasIframe])
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
import breakpointDefs, {
|
|
4
|
+
getBreakpointsStatus,
|
|
5
|
+
isInsideIframe
|
|
6
|
+
} from '../../helpers/breakpoints'
|
|
7
|
+
|
|
8
|
+
export const useParentBreakpoints = ({ parentBasedIframe }) => {
|
|
9
|
+
const [parentBreakpoints, setParentBreakpoints] = useState()
|
|
10
|
+
|
|
11
|
+
const isIframe = parentBasedIframe && isInsideIframe()
|
|
12
|
+
|
|
13
|
+
// iframe receives breakpoints from parent window
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handleMessage = ev => {
|
|
16
|
+
if (!isIframe) return
|
|
17
|
+
|
|
18
|
+
if (
|
|
19
|
+
typeof ev.data === 'string' &&
|
|
20
|
+
ev.data.includes?.('UI-breakpoints-value:')
|
|
21
|
+
) {
|
|
22
|
+
const parentInnerWidth = ev.data.split(':')[1]
|
|
23
|
+
|
|
24
|
+
setParentBreakpoints(
|
|
25
|
+
getBreakpointsStatus(breakpointDefs, parentInnerWidth)
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
window.addEventListener('message', handleMessage)
|
|
31
|
+
|
|
32
|
+
return () => window.removeEventListener('message', handleMessage)
|
|
33
|
+
}, [isIframe])
|
|
34
|
+
|
|
35
|
+
return { parentBreakpoints }
|
|
36
|
+
}
|
|
@@ -656,6 +656,7 @@ export function makeDarkInvertedOverrides(theme: any): {
|
|
|
656
656
|
};
|
|
657
657
|
MuiDialog: {
|
|
658
658
|
paper: {
|
|
659
|
+
width: string;
|
|
659
660
|
'&.small': {
|
|
660
661
|
[x: number]: {
|
|
661
662
|
margin: string;
|
|
@@ -668,23 +669,15 @@ export function makeDarkInvertedOverrides(theme: any): {
|
|
|
668
669
|
marginRight: string;
|
|
669
670
|
};
|
|
670
671
|
};
|
|
671
|
-
width: string;
|
|
672
672
|
maxWidth: string;
|
|
673
673
|
};
|
|
674
674
|
'&.medium': {
|
|
675
|
-
|
|
676
|
-
width: string;
|
|
677
|
-
maxWidth: string;
|
|
678
|
-
};
|
|
675
|
+
maxWidth: string;
|
|
679
676
|
};
|
|
680
677
|
'&.large': {
|
|
681
|
-
|
|
682
|
-
width: string;
|
|
683
|
-
maxWidth: string;
|
|
684
|
-
};
|
|
678
|
+
maxWidth: string;
|
|
685
679
|
};
|
|
686
680
|
'&.full': {
|
|
687
|
-
width: string;
|
|
688
681
|
maxWidth: string;
|
|
689
682
|
};
|
|
690
683
|
};
|
|
@@ -694,6 +687,15 @@ export function makeDarkInvertedOverrides(theme: any): {
|
|
|
694
687
|
};
|
|
695
688
|
};
|
|
696
689
|
paperFullScreen: {
|
|
690
|
+
'&.small': {
|
|
691
|
+
maxWidth: string;
|
|
692
|
+
};
|
|
693
|
+
'&.medium': {
|
|
694
|
+
maxWidth: string;
|
|
695
|
+
};
|
|
696
|
+
'&.large': {
|
|
697
|
+
maxWidth: string;
|
|
698
|
+
};
|
|
697
699
|
'& .cozyDialogActions': {
|
|
698
700
|
paddingBottom: string;
|
|
699
701
|
};
|
|
@@ -656,6 +656,7 @@ export function makeDarkNormalOverrides(theme: any): {
|
|
|
656
656
|
};
|
|
657
657
|
MuiDialog: {
|
|
658
658
|
paper: {
|
|
659
|
+
width: string;
|
|
659
660
|
'&.small': {
|
|
660
661
|
[x: number]: {
|
|
661
662
|
margin: string;
|
|
@@ -668,23 +669,15 @@ export function makeDarkNormalOverrides(theme: any): {
|
|
|
668
669
|
marginRight: string;
|
|
669
670
|
};
|
|
670
671
|
};
|
|
671
|
-
width: string;
|
|
672
672
|
maxWidth: string;
|
|
673
673
|
};
|
|
674
674
|
'&.medium': {
|
|
675
|
-
|
|
676
|
-
width: string;
|
|
677
|
-
maxWidth: string;
|
|
678
|
-
};
|
|
675
|
+
maxWidth: string;
|
|
679
676
|
};
|
|
680
677
|
'&.large': {
|
|
681
|
-
|
|
682
|
-
width: string;
|
|
683
|
-
maxWidth: string;
|
|
684
|
-
};
|
|
678
|
+
maxWidth: string;
|
|
685
679
|
};
|
|
686
680
|
'&.full': {
|
|
687
|
-
width: string;
|
|
688
681
|
maxWidth: string;
|
|
689
682
|
};
|
|
690
683
|
};
|
|
@@ -694,6 +687,15 @@ export function makeDarkNormalOverrides(theme: any): {
|
|
|
694
687
|
};
|
|
695
688
|
};
|
|
696
689
|
paperFullScreen: {
|
|
690
|
+
'&.small': {
|
|
691
|
+
maxWidth: string;
|
|
692
|
+
};
|
|
693
|
+
'&.medium': {
|
|
694
|
+
maxWidth: string;
|
|
695
|
+
};
|
|
696
|
+
'&.large': {
|
|
697
|
+
maxWidth: string;
|
|
698
|
+
};
|
|
697
699
|
'& .cozyDialogActions': {
|
|
698
700
|
paddingBottom: string;
|
|
699
701
|
};
|
|
@@ -656,6 +656,7 @@ export function makeLightInvertedOverrides(theme: any): {
|
|
|
656
656
|
};
|
|
657
657
|
MuiDialog: {
|
|
658
658
|
paper: {
|
|
659
|
+
width: string;
|
|
659
660
|
'&.small': {
|
|
660
661
|
[x: number]: {
|
|
661
662
|
margin: string;
|
|
@@ -668,23 +669,15 @@ export function makeLightInvertedOverrides(theme: any): {
|
|
|
668
669
|
marginRight: string;
|
|
669
670
|
};
|
|
670
671
|
};
|
|
671
|
-
width: string;
|
|
672
672
|
maxWidth: string;
|
|
673
673
|
};
|
|
674
674
|
'&.medium': {
|
|
675
|
-
|
|
676
|
-
width: string;
|
|
677
|
-
maxWidth: string;
|
|
678
|
-
};
|
|
675
|
+
maxWidth: string;
|
|
679
676
|
};
|
|
680
677
|
'&.large': {
|
|
681
|
-
|
|
682
|
-
width: string;
|
|
683
|
-
maxWidth: string;
|
|
684
|
-
};
|
|
678
|
+
maxWidth: string;
|
|
685
679
|
};
|
|
686
680
|
'&.full': {
|
|
687
|
-
width: string;
|
|
688
681
|
maxWidth: string;
|
|
689
682
|
};
|
|
690
683
|
};
|
|
@@ -694,6 +687,15 @@ export function makeLightInvertedOverrides(theme: any): {
|
|
|
694
687
|
};
|
|
695
688
|
};
|
|
696
689
|
paperFullScreen: {
|
|
690
|
+
'&.small': {
|
|
691
|
+
maxWidth: string;
|
|
692
|
+
};
|
|
693
|
+
'&.medium': {
|
|
694
|
+
maxWidth: string;
|
|
695
|
+
};
|
|
696
|
+
'&.large': {
|
|
697
|
+
maxWidth: string;
|
|
698
|
+
};
|
|
697
699
|
'& .cozyDialogActions': {
|
|
698
700
|
paddingBottom: string;
|
|
699
701
|
};
|
|
@@ -656,6 +656,7 @@ export function makeLightNormalOverrides(theme: any): {
|
|
|
656
656
|
};
|
|
657
657
|
MuiDialog: {
|
|
658
658
|
paper: {
|
|
659
|
+
width: string;
|
|
659
660
|
'&.small': {
|
|
660
661
|
[x: number]: {
|
|
661
662
|
margin: string;
|
|
@@ -668,23 +669,15 @@ export function makeLightNormalOverrides(theme: any): {
|
|
|
668
669
|
marginRight: string;
|
|
669
670
|
};
|
|
670
671
|
};
|
|
671
|
-
width: string;
|
|
672
672
|
maxWidth: string;
|
|
673
673
|
};
|
|
674
674
|
'&.medium': {
|
|
675
|
-
|
|
676
|
-
width: string;
|
|
677
|
-
maxWidth: string;
|
|
678
|
-
};
|
|
675
|
+
maxWidth: string;
|
|
679
676
|
};
|
|
680
677
|
'&.large': {
|
|
681
|
-
|
|
682
|
-
width: string;
|
|
683
|
-
maxWidth: string;
|
|
684
|
-
};
|
|
678
|
+
maxWidth: string;
|
|
685
679
|
};
|
|
686
680
|
'&.full': {
|
|
687
|
-
width: string;
|
|
688
681
|
maxWidth: string;
|
|
689
682
|
};
|
|
690
683
|
};
|
|
@@ -694,6 +687,15 @@ export function makeLightNormalOverrides(theme: any): {
|
|
|
694
687
|
};
|
|
695
688
|
};
|
|
696
689
|
paperFullScreen: {
|
|
690
|
+
'&.small': {
|
|
691
|
+
maxWidth: string;
|
|
692
|
+
};
|
|
693
|
+
'&.medium': {
|
|
694
|
+
maxWidth: string;
|
|
695
|
+
};
|
|
696
|
+
'&.large': {
|
|
697
|
+
maxWidth: string;
|
|
698
|
+
};
|
|
697
699
|
'& .cozyDialogActions': {
|
|
698
700
|
paddingBottom: string;
|
|
699
701
|
};
|
|
@@ -561,8 +561,8 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
561
561
|
},
|
|
562
562
|
MuiDialog: {
|
|
563
563
|
paper: {
|
|
564
|
+
width: '100%',
|
|
564
565
|
'&.small': _defineProperty({
|
|
565
|
-
width: '480px',
|
|
566
566
|
maxWidth: '480px'
|
|
567
567
|
}, theme.breakpoints.down('md'), {
|
|
568
568
|
margin: '16px',
|
|
@@ -575,16 +575,13 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
575
575
|
marginRight: '-8px'
|
|
576
576
|
}
|
|
577
577
|
}),
|
|
578
|
-
'&.medium':
|
|
579
|
-
width: '544px',
|
|
578
|
+
'&.medium': {
|
|
580
579
|
maxWidth: '544px'
|
|
581
|
-
}
|
|
582
|
-
'&.large':
|
|
583
|
-
width: '800px',
|
|
580
|
+
},
|
|
581
|
+
'&.large': {
|
|
584
582
|
maxWidth: '800px'
|
|
585
|
-
}
|
|
583
|
+
},
|
|
586
584
|
'&.full': {
|
|
587
|
-
width: '100%',
|
|
588
585
|
maxWidth: '100%'
|
|
589
586
|
}
|
|
590
587
|
},
|
|
@@ -594,6 +591,15 @@ export var makeLightNormalOverrides = function makeLightNormalOverrides(theme) {
|
|
|
594
591
|
}
|
|
595
592
|
},
|
|
596
593
|
paperFullScreen: {
|
|
594
|
+
'&.small': {
|
|
595
|
+
maxWidth: '100%'
|
|
596
|
+
},
|
|
597
|
+
'&.medium': {
|
|
598
|
+
maxWidth: '100%'
|
|
599
|
+
},
|
|
600
|
+
'&.large': {
|
|
601
|
+
maxWidth: '100%'
|
|
602
|
+
},
|
|
597
603
|
'& .cozyDialogActions': {
|
|
598
604
|
paddingBottom: "calc(env(safe-area-inset-bottom) + ".concat(getFlagshipCssVar('bottom'), ")")
|
|
599
605
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export default
|
|
2
|
-
declare function
|
|
1
|
+
export default QualificationIcon;
|
|
2
|
+
declare function QualificationIcon({ theme, qualification, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
theme: any;
|
|
5
5
|
qualification: any;
|
|
6
6
|
}): JSX.Element;
|
|
7
|
-
declare namespace
|
|
7
|
+
declare namespace QualificationIcon {
|
|
8
8
|
namespace propTypes {
|
|
9
9
|
const qualification: PropTypes.Requireable<string>;
|
|
10
10
|
const theme: PropTypes.Requireable<string>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["theme", "qualification"];
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getIconByLabel } from 'cozy-client/dist/models/document/qualification';
|
|
7
7
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
8
|
-
import IconStack from "cozy-ui/transpiled/react/IconStack";
|
|
9
8
|
import BankIcon from "cozy-ui/transpiled/react/Icons/Bank";
|
|
10
9
|
import BankCheckIcon from "cozy-ui/transpiled/react/Icons/BankCheck";
|
|
11
10
|
import BenefitIcon from "cozy-ui/transpiled/react/Icons/Benefit";
|
|
@@ -17,8 +16,6 @@ import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots";
|
|
|
17
16
|
import EmailIcon from "cozy-ui/transpiled/react/Icons/Email";
|
|
18
17
|
import EuroIcon from "cozy-ui/transpiled/react/Icons/Euro";
|
|
19
18
|
import ExchangeIcon from "cozy-ui/transpiled/react/Icons/Exchange";
|
|
20
|
-
import FileDuotoneIcon from "cozy-ui/transpiled/react/Icons/FileDuotone";
|
|
21
|
-
import FileTypeNoteIcon from "cozy-ui/transpiled/react/Icons/FileTypeNote";
|
|
22
19
|
import FitnessIcon from "cozy-ui/transpiled/react/Icons/Fitness";
|
|
23
20
|
import GlobeIcon from "cozy-ui/transpiled/react/Icons/Globe";
|
|
24
21
|
import GouvIcon from "cozy-ui/transpiled/react/Icons/Gouv";
|
|
@@ -28,6 +25,7 @@ import ImageIcon from "cozy-ui/transpiled/react/Icons/Image";
|
|
|
28
25
|
import JusticeIcon from "cozy-ui/transpiled/react/Icons/Justice";
|
|
29
26
|
import LaudryIcon from "cozy-ui/transpiled/react/Icons/Laudry";
|
|
30
27
|
import LightningIcon from "cozy-ui/transpiled/react/Icons/Lightning";
|
|
28
|
+
import NoteIcon from "cozy-ui/transpiled/react/Icons/Note";
|
|
31
29
|
import PeopleIcon from "cozy-ui/transpiled/react/Icons/People";
|
|
32
30
|
import PlaneIcon from "cozy-ui/transpiled/react/Icons/Plane";
|
|
33
31
|
import RemboursementIcon from "cozy-ui/transpiled/react/Icons/Remboursement";
|
|
@@ -38,19 +36,7 @@ import TeamIcon from "cozy-ui/transpiled/react/Icons/Team";
|
|
|
38
36
|
import TelecomIcon from "cozy-ui/transpiled/react/Icons/Telecom";
|
|
39
37
|
import TelephoneIcon from "cozy-ui/transpiled/react/Icons/Telephone";
|
|
40
38
|
import WaterIcon from "cozy-ui/transpiled/react/Icons/Water";
|
|
41
|
-
import WorkIcon from "cozy-ui/transpiled/react/Icons/Work";
|
|
42
|
-
|
|
43
|
-
function FileDuotoneWhite(props) {
|
|
44
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
45
|
-
viewBox: "0 0 26 32"
|
|
46
|
-
}, props), /*#__PURE__*/React.createElement("g", {
|
|
47
|
-
fillRule: "evenodd"
|
|
48
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
49
|
-
d: "M0 2.002C0 .896.89 0 1.997 0H19l7 7v22.996A2 2 0 0124.003 32H1.997A1.995 1.995 0 010 29.998C.048 16 0 16 0 2.002z",
|
|
50
|
-
fill: "#ffffff"
|
|
51
|
-
})));
|
|
52
|
-
}
|
|
53
|
-
|
|
39
|
+
import WorkIcon from "cozy-ui/transpiled/react/Icons/Work";
|
|
54
40
|
var IconByLabel = {
|
|
55
41
|
'bank-check': BankCheckIcon,
|
|
56
42
|
bank: BankIcon,
|
|
@@ -63,7 +49,7 @@ var IconByLabel = {
|
|
|
63
49
|
email: EmailIcon,
|
|
64
50
|
euro: EuroIcon,
|
|
65
51
|
exchange: ExchangeIcon,
|
|
66
|
-
'file-type-note':
|
|
52
|
+
'file-type-note': NoteIcon,
|
|
67
53
|
fitness: FitnessIcon,
|
|
68
54
|
globe: GlobeIcon,
|
|
69
55
|
gouv: GouvIcon,
|
|
@@ -98,35 +84,25 @@ var themeIconByLabel = {
|
|
|
98
84
|
others: 'dots'
|
|
99
85
|
};
|
|
100
86
|
|
|
101
|
-
var
|
|
87
|
+
var QualificationIcon = function QualificationIcon(_ref) {
|
|
102
88
|
var theme = _ref.theme,
|
|
103
89
|
qualification = _ref.qualification,
|
|
104
90
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
105
91
|
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
icon: FileDuotoneIcon,
|
|
114
|
-
color: "#E049BF",
|
|
115
|
-
size: 32
|
|
116
|
-
})),
|
|
117
|
-
foregroundIcon: /*#__PURE__*/React.createElement(Icon, {
|
|
118
|
-
icon: ForegroundIcon,
|
|
119
|
-
color: "#E049BF",
|
|
120
|
-
size: 16
|
|
121
|
-
})
|
|
122
|
-
}));
|
|
92
|
+
var _Icon = qualification ? IconByLabel[getIconByLabel(qualification)] : theme ? IconByLabel[themeIconByLabel[theme]] : null;
|
|
93
|
+
|
|
94
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({
|
|
95
|
+
icon: _Icon,
|
|
96
|
+
color: "#E049BF",
|
|
97
|
+
size: 16
|
|
98
|
+
}, props));
|
|
123
99
|
};
|
|
124
100
|
|
|
125
|
-
|
|
101
|
+
QualificationIcon.propTypes = {
|
|
126
102
|
/** The name of the qualification (isp\_invoice, family\_record\_book, etc.) */
|
|
127
103
|
qualification: PropTypes.string,
|
|
128
104
|
|
|
129
105
|
/** The name of the qualification theme (indentity, family, etc.) */
|
|
130
106
|
theme: PropTypes.string
|
|
131
107
|
};
|
|
132
|
-
export default
|
|
108
|
+
export default QualificationIcon;
|
|
@@ -4,20 +4,20 @@ import { themesList } from 'cozy-client/dist/models/document/documentTypeData';
|
|
|
4
4
|
import { isQualificationNote } from 'cozy-client/dist/models/document/documentTypeDataHelpers';
|
|
5
5
|
import { getBoundT } from 'cozy-client/dist/models/document/locales';
|
|
6
6
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import NoteIcon from "cozy-ui/transpiled/react/Icons/Note";
|
|
8
|
+
import QualificationIcon from "cozy-ui/transpiled/react/QualificationIcon";
|
|
9
9
|
export var makeOptions = function makeOptions(lang) {
|
|
10
10
|
var qualifT = getBoundT(lang);
|
|
11
11
|
return {
|
|
12
12
|
children: [{
|
|
13
13
|
id: 'none',
|
|
14
14
|
title: qualifT('Scan.themes.none'),
|
|
15
|
-
icon: /*#__PURE__*/React.createElement(
|
|
15
|
+
icon: /*#__PURE__*/React.createElement(QualificationIcon, null)
|
|
16
16
|
}].concat(_toConsumableArray(themesList.map(function (theme) {
|
|
17
17
|
return {
|
|
18
18
|
id: theme.id,
|
|
19
19
|
title: qualifT("Scan.themes.".concat(theme.label)),
|
|
20
|
-
icon: /*#__PURE__*/React.createElement(
|
|
20
|
+
icon: /*#__PURE__*/React.createElement(QualificationIcon, {
|
|
21
21
|
theme: theme.label
|
|
22
22
|
}),
|
|
23
23
|
children: theme.items.map(function (item) {
|
|
@@ -26,9 +26,10 @@ export var makeOptions = function makeOptions(lang) {
|
|
|
26
26
|
item: item,
|
|
27
27
|
title: qualifT("Scan.items.".concat(item.label)),
|
|
28
28
|
icon: isQualificationNote(item) ? /*#__PURE__*/React.createElement(Icon, {
|
|
29
|
-
icon:
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
icon: NoteIcon,
|
|
30
|
+
color: "#E049BF",
|
|
31
|
+
size: 16
|
|
32
|
+
}) : /*#__PURE__*/React.createElement(QualificationIcon, {
|
|
32
33
|
qualification: item.label
|
|
33
34
|
})
|
|
34
35
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export function getBreakpointsStatus(breakpoints: any): {
|
|
1
|
+
export function getBreakpointsStatus(breakpoints: any, innerWidth: any): {
|
|
2
2
|
[x: string]: boolean;
|
|
3
3
|
};
|
|
4
|
+
export function isInsideIframe(): boolean;
|
|
4
5
|
export default breakpoints;
|
|
5
6
|
declare namespace breakpoints {
|
|
6
7
|
const isExtraLarge: number[];
|
|
@@ -14,8 +14,8 @@ var breakpoints = {
|
|
|
14
14
|
isTablet: [small + 1, medium],
|
|
15
15
|
isMobile: [0, small]
|
|
16
16
|
};
|
|
17
|
-
export var getBreakpointsStatus = function getBreakpointsStatus(breakpoints) {
|
|
18
|
-
var width = window.innerWidth;
|
|
17
|
+
export var getBreakpointsStatus = function getBreakpointsStatus(breakpoints, innerWidth) {
|
|
18
|
+
var width = innerWidth || window.innerWidth;
|
|
19
19
|
return mapValues(breakpoints, function (_ref) {
|
|
20
20
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
21
21
|
min = _ref2[0],
|
|
@@ -24,4 +24,11 @@ export var getBreakpointsStatus = function getBreakpointsStatus(breakpoints) {
|
|
|
24
24
|
return width >= min && (max === undefined || width <= max);
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
+
export var isInsideIframe = function isInsideIframe() {
|
|
28
|
+
try {
|
|
29
|
+
return window.self !== window.top;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
27
34
|
export default breakpoints;
|
|
@@ -84,7 +84,7 @@ export { default as Thumbnail } from "./Thumbnail";
|
|
|
84
84
|
export { default as ButtonBase } from "./ButtonBase";
|
|
85
85
|
export { default as QualificationGrid } from "./QualificationGrid";
|
|
86
86
|
export { default as QualificationItem } from "./QualificationItem";
|
|
87
|
-
export { default as
|
|
87
|
+
export { default as QualificationIcon } from "./QualificationIcon";
|
|
88
88
|
export { default as QualificationModal } from "./QualificationModal";
|
|
89
89
|
export { default as Timeline } from "./Timeline";
|
|
90
90
|
export { default as TimelineConnector } from "./TimelineConnector";
|
|
@@ -98,7 +98,7 @@ export { default as Thumbnail } from './Thumbnail';
|
|
|
98
98
|
export { default as ButtonBase } from './ButtonBase';
|
|
99
99
|
export { default as QualificationGrid } from './QualificationGrid';
|
|
100
100
|
export { default as QualificationItem } from './QualificationItem';
|
|
101
|
-
export { default as
|
|
101
|
+
export { default as QualificationIcon } from './QualificationIcon';
|
|
102
102
|
export { default as QualificationModal } from './QualificationModal';
|
|
103
103
|
export { default as Timeline } from './Timeline';
|
|
104
104
|
export { default as TimelineConnector } from './TimelineConnector';
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
export function BreakpointsProvider({ children }: {
|
|
1
|
+
export function BreakpointsProvider({ parentBasedIframe, children }: {
|
|
2
|
+
parentBasedIframe: any;
|
|
2
3
|
children: any;
|
|
3
4
|
}): JSX.Element;
|
|
5
|
+
export namespace BreakpointsProvider {
|
|
6
|
+
namespace defaultProps {
|
|
7
|
+
const parentBasedIframe: boolean;
|
|
8
|
+
}
|
|
9
|
+
namespace propTypes {
|
|
10
|
+
const parentBasedIframe_1: PropTypes.Requireable<boolean>;
|
|
11
|
+
export { parentBasedIframe_1 as parentBasedIframe };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
4
14
|
export function useBreakpoints(): never;
|
|
5
15
|
export default useBreakpoints;
|
|
16
|
+
import PropTypes from "prop-types";
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import React, { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
5
|
+
import { useIframeConnection } from "cozy-ui/transpiled/react/providers/Breakpoints/useIframeConnection";
|
|
6
|
+
import { useIframeToSendWidth } from "cozy-ui/transpiled/react/providers/Breakpoints/useIframeToSendWidth";
|
|
7
|
+
import { useParentBreakpoints } from "cozy-ui/transpiled/react/providers/Breakpoints/useParentBreakpoints";
|
|
8
|
+
import breakpointDefs, { getBreakpointsStatus } from "cozy-ui/transpiled/react/helpers/breakpoints";
|
|
10
9
|
var BreakpointsCtx = /*#__PURE__*/createContext(null);
|
|
11
10
|
export var BreakpointsProvider = function BreakpointsProvider(_ref) {
|
|
12
|
-
var
|
|
11
|
+
var parentBasedIframe = _ref.parentBasedIframe,
|
|
12
|
+
children = _ref.children;
|
|
13
13
|
|
|
14
|
-
var _useState = useState(getBreakpointsStatus()),
|
|
14
|
+
var _useState = useState(getBreakpointsStatus(breakpointDefs)),
|
|
15
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
16
|
breakpoints = _useState2[0],
|
|
17
17
|
setBreakpoints = _useState2[1];
|
|
18
18
|
|
|
19
|
+
var _useIframeConnection = useIframeConnection({
|
|
20
|
+
parentBasedIframe: parentBasedIframe
|
|
21
|
+
}),
|
|
22
|
+
hasIframe = _useIframeConnection.hasIframe;
|
|
23
|
+
|
|
24
|
+
useIframeToSendWidth({
|
|
25
|
+
hasIframe: hasIframe
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
var _useParentBreakpoints = useParentBreakpoints({
|
|
29
|
+
parentBasedIframe: parentBasedIframe
|
|
30
|
+
}),
|
|
31
|
+
parentBreakpoints = _useParentBreakpoints.parentBreakpoints;
|
|
32
|
+
|
|
19
33
|
useEffect(function () {
|
|
20
34
|
var handleResize = throttle(function () {
|
|
21
|
-
setBreakpoints(getBreakpointsStatus());
|
|
35
|
+
setBreakpoints(getBreakpointsStatus(breakpointDefs));
|
|
22
36
|
}, 100);
|
|
23
37
|
window.addEventListener('resize', handleResize);
|
|
24
38
|
return function () {
|
|
@@ -26,9 +40,16 @@ export var BreakpointsProvider = function BreakpointsProvider(_ref) {
|
|
|
26
40
|
};
|
|
27
41
|
}, []);
|
|
28
42
|
return /*#__PURE__*/React.createElement(BreakpointsCtx.Provider, {
|
|
29
|
-
value: breakpoints
|
|
43
|
+
value: parentBreakpoints || breakpoints
|
|
30
44
|
}, children);
|
|
31
45
|
};
|
|
46
|
+
BreakpointsProvider.defaultProps = {
|
|
47
|
+
parentBasedIframe: false
|
|
48
|
+
};
|
|
49
|
+
BreakpointsProvider.propTypes = {
|
|
50
|
+
/** Iframes breakpoints are based on parent window inner width instead of iframe inner width */
|
|
51
|
+
parentBasedIframe: PropTypes.bool
|
|
52
|
+
};
|
|
32
53
|
export var useBreakpoints = function useBreakpoints() {
|
|
33
54
|
var v = useContext(BreakpointsCtx);
|
|
34
55
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { isInsideIframe } from "cozy-ui/transpiled/react/helpers/breakpoints";
|
|
4
|
+
export var useIframeConnection = function useIframeConnection(_ref) {
|
|
5
|
+
var parentBasedIframe = _ref.parentBasedIframe;
|
|
6
|
+
|
|
7
|
+
var _useState = useState(false),
|
|
8
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9
|
+
hasIframe = _useState2[0],
|
|
10
|
+
setHasIframe = _useState2[1];
|
|
11
|
+
|
|
12
|
+
var isIframe = parentBasedIframe && isInsideIframe(); // parent window receives from iframe to give breakpoints
|
|
13
|
+
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
var handleMessage = function handleMessage(ev) {
|
|
16
|
+
if (ev.data === 'UI-breakpoints-needParentBreakpoints') {
|
|
17
|
+
setHasIframe(true);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
window.addEventListener('message', handleMessage);
|
|
22
|
+
return function () {
|
|
23
|
+
return window.removeEventListener('message', handleMessage);
|
|
24
|
+
};
|
|
25
|
+
}, []); // iframe send to parent window ask for its breakpoints
|
|
26
|
+
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (isIframe) {
|
|
29
|
+
window.parent.postMessage('UI-breakpoints-needParentBreakpoints', '*');
|
|
30
|
+
}
|
|
31
|
+
}, [isIframe]);
|
|
32
|
+
return {
|
|
33
|
+
hasIframe: hasIframe
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import throttle from 'lodash/throttle';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* To send window innerWidth to first iframe
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var sendWidthToIframe = function sendWidthToIframe() {
|
|
9
|
+
return window.frames[1].postMessage("UI-breakpoints-value:".concat(window.innerWidth), '*');
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export var useIframeToSendWidth = function useIframeToSendWidth(_ref) {
|
|
13
|
+
var hasIframe = _ref.hasIframe;
|
|
14
|
+
// parent window send its innerWidth
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
if (hasIframe) {
|
|
17
|
+
sendWidthToIframe();
|
|
18
|
+
}
|
|
19
|
+
}, [hasIframe]); // parent window send its innerWidth on resize
|
|
20
|
+
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
var handleResize = throttle(function () {
|
|
23
|
+
if (hasIframe) {
|
|
24
|
+
sendWidthToIframe();
|
|
25
|
+
}
|
|
26
|
+
}, 100);
|
|
27
|
+
window.addEventListener('resize', handleResize);
|
|
28
|
+
return function () {
|
|
29
|
+
window.removeEventListener('resize', handleResize);
|
|
30
|
+
};
|
|
31
|
+
}, [hasIframe]);
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import breakpointDefs, { getBreakpointsStatus, isInsideIframe } from "cozy-ui/transpiled/react/helpers/breakpoints";
|
|
4
|
+
export var useParentBreakpoints = function useParentBreakpoints(_ref) {
|
|
5
|
+
var parentBasedIframe = _ref.parentBasedIframe;
|
|
6
|
+
|
|
7
|
+
var _useState = useState(),
|
|
8
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9
|
+
parentBreakpoints = _useState2[0],
|
|
10
|
+
setParentBreakpoints = _useState2[1];
|
|
11
|
+
|
|
12
|
+
var isIframe = parentBasedIframe && isInsideIframe(); // iframe receives breakpoints from parent window
|
|
13
|
+
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
var handleMessage = function handleMessage(ev) {
|
|
16
|
+
var _ev$data$includes, _ev$data;
|
|
17
|
+
|
|
18
|
+
if (!isIframe) return;
|
|
19
|
+
|
|
20
|
+
if (typeof ev.data === 'string' && (_ev$data$includes = (_ev$data = ev.data).includes) !== null && _ev$data$includes !== void 0 && _ev$data$includes.call(_ev$data, 'UI-breakpoints-value:')) {
|
|
21
|
+
var parentInnerWidth = ev.data.split(':')[1];
|
|
22
|
+
setParentBreakpoints(getBreakpointsStatus(breakpointDefs, parentInnerWidth));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
window.addEventListener('message', handleMessage);
|
|
27
|
+
return function () {
|
|
28
|
+
return window.removeEventListener('message', handleMessage);
|
|
29
|
+
};
|
|
30
|
+
}, [isIframe]);
|
|
31
|
+
return {
|
|
32
|
+
parentBreakpoints: parentBreakpoints
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
```jsx
|
|
2
|
-
import QualificationIconStack from 'cozy-ui/transpiled/react/QualificationIconStack'
|
|
3
|
-
|
|
4
|
-
;
|
|
5
|
-
|
|
6
|
-
<>
|
|
7
|
-
<QualificationIconStack className="u-mr-1" />
|
|
8
|
-
<QualificationIconStack className="u-mr-1" qualification="isp_invoice" />
|
|
9
|
-
<QualificationIconStack className="u-mr-1" qualification="phone_invoice" />
|
|
10
|
-
<QualificationIconStack className="u-mr-1" qualification="family_record_book" />
|
|
11
|
-
<QualificationIconStack className="u-mr-1" theme="identity" />
|
|
12
|
-
<QualificationIconStack theme="transport" />
|
|
13
|
-
</>
|
|
14
|
-
```
|