cozy-ui 60.9.1 → 60.12.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 +36 -0
- package/package.json +3 -3
- package/react/BarContextProvider/index.jsx +21 -8
- package/react/BarContextProvider/index.spec.jsx +126 -20
- package/react/BottomSheet/BottomSheet.jsx +17 -9
- package/react/BottomSheet/README.md +2 -2
- package/react/FilePicker/FilePickerBodyItem.jsx +1 -2
- package/react/FilePicker/FilePickerBodyItem.spec.jsx +3 -2
- package/react/MuiCozyTheme/makeOverrides.js +8 -8
- package/react/NestedSelect/NestedSelect.jsx +3 -6
- package/transpiled/react/BarContextProvider/index.js +17 -8
- package/transpiled/react/BottomSheet/BottomSheet.js +19 -16
- package/transpiled/react/FilePicker/FilePickerBodyItem.js +1 -2
- package/transpiled/react/MuiCozyTheme/makeOverrides.js +8 -8
- package/transpiled/react/NestedSelect/NestedSelect.js +7 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
# [60.12.0](https://github.com/cozy/cozy-ui/compare/v60.11.0...v60.12.0) (2022-02-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Use new Radio button for FilePicker and NestedSelect ([a602dca](https://github.com/cozy/cozy-ui/commit/a602dca))
|
|
7
|
+
|
|
8
|
+
# [60.11.0](https://github.com/cozy/cozy-ui/compare/v60.10.1...v60.11.0) (2022-02-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* BottomSheet settings accept `mediumHeight` new prop ([0e2b254](https://github.com/cozy/cozy-ui/commit/0e2b254))
|
|
14
|
+
|
|
15
|
+
## [60.10.1](https://github.com/cozy/cozy-ui/compare/v60.10.0...v60.10.1) (2022-02-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Radios and Checkbox css to use correct primary/secondary colors ([a81e5e3](https://github.com/cozy/cozy-ui/commit/a81e5e3))
|
|
21
|
+
|
|
22
|
+
# [60.10.0](https://github.com/cozy/cozy-ui/compare/v60.9.1...v60.10.0) (2022-01-31)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* Update cozy-intent and device helper ([87d612c](https://github.com/cozy/cozy-ui/commit/87d612c))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* Inject webviewService into BarContext ([b6c269f](https://github.com/cozy/cozy-ui/commit/b6c269f))
|
|
33
|
+
* Update BarContext testing ([15803f4](https://github.com/cozy/cozy-ui/commit/15803f4))
|
|
34
|
+
* Upgrade cozy-intent to latest ([8653ad1](https://github.com/cozy/cozy-ui/commit/8653ad1))
|
|
35
|
+
|
|
1
36
|
## [60.9.1](https://github.com/cozy/cozy-ui/compare/v60.9.0...v60.9.1) (2022-01-27)
|
|
2
37
|
|
|
3
38
|
|
|
@@ -162,6 +197,7 @@
|
|
|
162
197
|
|
|
163
198
|
* cozy-intent@1.1.2 or later is now required
|
|
164
199
|
otherwise, AppLinker will crash
|
|
200
|
+
* Wrap your App in the WebviewIntentProvider (via import { WebviewIntentProvider } from 'cozy-intent)
|
|
165
201
|
|
|
166
202
|
## [58.5.1](https://github.com/cozy/cozy-ui/compare/v58.5.0...v58.5.1) (2022-01-07)
|
|
167
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "60.
|
|
3
|
+
"version": "60.12.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"commitlint-config-cozy": "0.6.0",
|
|
90
90
|
"copyfiles": "2.1.1",
|
|
91
91
|
"cozy-client": "^27.5.1",
|
|
92
|
-
"cozy-device-helper": "^1.16.
|
|
92
|
+
"cozy-device-helper": "^1.16.1",
|
|
93
93
|
"cozy-doctypes": "^1.69.0",
|
|
94
94
|
"cozy-harvest-lib": "^6.7.3",
|
|
95
|
-
"cozy-intent": "^1.
|
|
95
|
+
"cozy-intent": "^1.6.0",
|
|
96
96
|
"cozy-sharing": "^3.10.0",
|
|
97
97
|
"css-loader": "0.28.11",
|
|
98
98
|
"cssnano": "4.1.11",
|
|
@@ -6,16 +6,29 @@ import { CozyProvider } from 'cozy-client'
|
|
|
6
6
|
import { Provider } from 'react-redux'
|
|
7
7
|
import { WebviewIntentProvider } from 'cozy-intent'
|
|
8
8
|
|
|
9
|
-
const BarContextProvider =
|
|
10
|
-
|
|
9
|
+
const BarContextProvider = ({
|
|
10
|
+
children,
|
|
11
|
+
store,
|
|
12
|
+
client,
|
|
13
|
+
f,
|
|
14
|
+
t,
|
|
15
|
+
lang,
|
|
16
|
+
webviewService
|
|
17
|
+
}) => {
|
|
18
|
+
if (!children) return null
|
|
19
|
+
|
|
11
20
|
return (
|
|
12
|
-
<Provider store={
|
|
13
|
-
<CozyProvider client={
|
|
14
|
-
<I18nContext.Provider
|
|
15
|
-
value={{ f: props.f, t: props.t, lang: props.lang }}
|
|
16
|
-
>
|
|
21
|
+
<Provider store={store}>
|
|
22
|
+
<CozyProvider client={client}>
|
|
23
|
+
<I18nContext.Provider value={{ f, t, lang }}>
|
|
17
24
|
<BreakpointsProvider>
|
|
18
|
-
|
|
25
|
+
{webviewService ? (
|
|
26
|
+
<WebviewIntentProvider webviewService={webviewService}>
|
|
27
|
+
{children}
|
|
28
|
+
</WebviewIntentProvider>
|
|
29
|
+
) : (
|
|
30
|
+
children
|
|
31
|
+
)}
|
|
19
32
|
</BreakpointsProvider>
|
|
20
33
|
</I18nContext.Provider>
|
|
21
34
|
</CozyProvider>
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { Provider, useStore } from 'react-redux'
|
|
3
|
+
import configureStore from 'redux-mock-store'
|
|
4
|
+
import { render } from '@testing-library/react'
|
|
2
5
|
|
|
6
|
+
import { useWebviewIntent } from 'cozy-intent'
|
|
3
7
|
import CozyClient, {
|
|
4
8
|
createMockClient,
|
|
5
9
|
CozyProvider,
|
|
6
10
|
useClient
|
|
7
11
|
} from 'cozy-client'
|
|
8
|
-
import configureStore from 'redux-mock-store'
|
|
9
|
-
import { Provider, useStore } from 'react-redux'
|
|
10
|
-
import { isFlagshipApp } from 'cozy-device-helper'
|
|
11
12
|
|
|
12
13
|
import BarContextProvider from '.'
|
|
13
14
|
import I18n, { useI18n, translate } from '../I18n'
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}))
|
|
18
|
-
|
|
16
|
+
const mockWebviewService = { foo: 'bar' }
|
|
17
|
+
const mockVoidWebviewService = 'No context'
|
|
19
18
|
const locales = { helloworld: 'Hello World !' }
|
|
20
19
|
const localesBar = { a: 'b' }
|
|
21
20
|
|
|
@@ -29,6 +28,20 @@ const DumbHelloWorld = translate()(({ t, f, lang }) => (
|
|
|
29
28
|
</div>
|
|
30
29
|
))
|
|
31
30
|
|
|
31
|
+
const IntentComponent = () => {
|
|
32
|
+
let webviewIntent
|
|
33
|
+
let render
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
webviewIntent = useWebviewIntent()
|
|
37
|
+
render = webviewIntent.foo
|
|
38
|
+
} catch {
|
|
39
|
+
render = mockVoidWebviewService
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return <main>{render}</main>
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
const MockedBar = props => {
|
|
33
46
|
const client = new CozyClient({})
|
|
34
47
|
return (
|
|
@@ -40,53 +53,146 @@ const MockedBar = props => {
|
|
|
40
53
|
)
|
|
41
54
|
}
|
|
42
55
|
|
|
43
|
-
const App = () => {
|
|
56
|
+
const App = ({ children, webviewService }) => {
|
|
44
57
|
const { t, f, lang } = useI18n()
|
|
45
58
|
const client = useClient()
|
|
46
59
|
const store = useStore()
|
|
60
|
+
|
|
47
61
|
return (
|
|
48
62
|
<MockedBar>
|
|
49
|
-
<BarContextProvider
|
|
50
|
-
|
|
63
|
+
<BarContextProvider
|
|
64
|
+
t={t}
|
|
65
|
+
f={f}
|
|
66
|
+
lang={lang}
|
|
67
|
+
client={client}
|
|
68
|
+
store={store}
|
|
69
|
+
webviewService={webviewService}
|
|
70
|
+
>
|
|
71
|
+
{children}
|
|
51
72
|
</BarContextProvider>
|
|
52
73
|
</MockedBar>
|
|
53
74
|
)
|
|
54
75
|
}
|
|
55
76
|
|
|
56
77
|
describe('BarContextProvider', () => {
|
|
78
|
+
afterAll(() => {
|
|
79
|
+
window.cozy = undefined
|
|
80
|
+
})
|
|
81
|
+
|
|
57
82
|
it('should provide the right (aka app not the one from the bar) t/f/store/client to the DumbHelloWorld', () => {
|
|
58
83
|
const client = createMockClient({})
|
|
59
84
|
const mockStore = configureStore()
|
|
60
85
|
const store = mockStore(x => x)
|
|
61
|
-
|
|
86
|
+
|
|
87
|
+
const { queryByText } = render(
|
|
88
|
+
<Provider store={store}>
|
|
89
|
+
<CozyProvider client={client}>
|
|
90
|
+
<I18n lang="en" dictRequire={() => locales}>
|
|
91
|
+
<App>
|
|
92
|
+
<DumbHelloWorld />
|
|
93
|
+
</App>
|
|
94
|
+
</I18n>
|
|
95
|
+
</CozyProvider>
|
|
96
|
+
</Provider>
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
expect(queryByText('<div>Hello World !<br>6 Jan<br>en</div>')).toBeDefined()
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('should render nothing when no children is provided', () => {
|
|
103
|
+
const { container } = render(<BarContextProvider />)
|
|
104
|
+
expect(container.firstChild).toBeNull()
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('should work without a cozy-intent context', () => {
|
|
108
|
+
// Set App Amirale context
|
|
109
|
+
window.cozy.isFlagshipApp = true
|
|
110
|
+
|
|
111
|
+
const client = createMockClient({})
|
|
112
|
+
const mockStore = configureStore()
|
|
113
|
+
const store = mockStore(x => x)
|
|
114
|
+
|
|
115
|
+
const { queryByText } = render(
|
|
62
116
|
<Provider store={store}>
|
|
63
117
|
<CozyProvider client={client}>
|
|
64
118
|
<I18n lang="en" dictRequire={() => locales}>
|
|
65
|
-
<App
|
|
119
|
+
<App>
|
|
120
|
+
<IntentComponent />
|
|
121
|
+
</App>
|
|
66
122
|
</I18n>
|
|
67
123
|
</CozyProvider>
|
|
68
124
|
</Provider>
|
|
69
125
|
)
|
|
70
|
-
|
|
126
|
+
|
|
127
|
+
expect(queryByText(mockVoidWebviewService)).toBeInTheDocument()
|
|
71
128
|
})
|
|
72
129
|
|
|
73
|
-
it('should try to provide a cozy-intent context',
|
|
130
|
+
it('should not try to provide a cozy-intent context if one is provided', () => {
|
|
131
|
+
// Set App Amirale context
|
|
132
|
+
window.cozy.isFlagshipApp = true
|
|
133
|
+
|
|
74
134
|
const client = createMockClient({})
|
|
75
135
|
const mockStore = configureStore()
|
|
76
136
|
const store = mockStore(x => x)
|
|
77
|
-
|
|
137
|
+
|
|
138
|
+
const { queryByText } = render(
|
|
139
|
+
<Provider store={store}>
|
|
140
|
+
<CozyProvider client={client}>
|
|
141
|
+
<I18n lang="en" dictRequire={() => locales}>
|
|
142
|
+
<App webviewService={mockWebviewService}>
|
|
143
|
+
<IntentComponent />
|
|
144
|
+
</App>
|
|
145
|
+
</I18n>
|
|
146
|
+
</CozyProvider>
|
|
147
|
+
</Provider>
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
expect(queryByText(mockWebviewService.foo)).toBeInTheDocument()
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('should work without a cozy-intent context', () => {
|
|
154
|
+
// Set Web context
|
|
155
|
+
window.cozy.isFlagshipApp = false
|
|
156
|
+
|
|
157
|
+
const client = createMockClient({})
|
|
158
|
+
const mockStore = configureStore()
|
|
159
|
+
const store = mockStore(x => x)
|
|
160
|
+
|
|
161
|
+
const { queryByText } = render(
|
|
162
|
+
<Provider store={store}>
|
|
163
|
+
<CozyProvider client={client}>
|
|
164
|
+
<I18n lang="en" dictRequire={() => locales}>
|
|
165
|
+
<App>
|
|
166
|
+
<IntentComponent />
|
|
167
|
+
</App>
|
|
168
|
+
</I18n>
|
|
169
|
+
</CozyProvider>
|
|
170
|
+
</Provider>
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
expect(queryByText(mockVoidWebviewService)).toBeInTheDocument()
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
it('should not try to provide a cozy-intent context if one is provided', () => {
|
|
177
|
+
// Set Web context
|
|
178
|
+
window.cozy.isFlagshipApp = false
|
|
179
|
+
|
|
180
|
+
const client = createMockClient({})
|
|
181
|
+
const mockStore = configureStore()
|
|
182
|
+
const store = mockStore(x => x)
|
|
183
|
+
|
|
184
|
+
const { queryByText } = render(
|
|
78
185
|
<Provider store={store}>
|
|
79
186
|
<CozyProvider client={client}>
|
|
80
187
|
<I18n lang="en" dictRequire={() => locales}>
|
|
81
|
-
<App
|
|
188
|
+
<App webviewService={mockWebviewService}>
|
|
189
|
+
<IntentComponent />
|
|
190
|
+
</App>
|
|
82
191
|
</I18n>
|
|
83
192
|
</CozyProvider>
|
|
84
193
|
</Provider>
|
|
85
194
|
)
|
|
86
195
|
|
|
87
|
-
|
|
88
|
-
// This is an easy way to test that the provider is working, albeit brittle
|
|
89
|
-
// A full test would need to mock cozy-intent, post-me and react-native
|
|
90
|
-
expect(isFlagshipApp).toHaveBeenCalled()
|
|
196
|
+
expect(queryByText(mockWebviewService.foo)).not.toBeInTheDocument()
|
|
91
197
|
})
|
|
92
198
|
})
|
|
@@ -37,7 +37,8 @@ export const defaultBottomSheetSpringConfig = {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const defaultSettings = {
|
|
40
|
-
mediumHeightRatio: 0.33
|
|
40
|
+
mediumHeightRatio: 0.33,
|
|
41
|
+
mediumHeight: null
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
const computeMaxHeight = toolbarProps => {
|
|
@@ -54,17 +55,22 @@ const computeMaxHeight = toolbarProps => {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
const BottomSheet = ({ toolbarProps, settings, children }) => {
|
|
58
|
+
const { mediumHeightRatio, mediumHeight } = useMemo(
|
|
59
|
+
() => ({
|
|
60
|
+
...defaultSettings,
|
|
61
|
+
...settings
|
|
62
|
+
}),
|
|
63
|
+
[settings]
|
|
64
|
+
)
|
|
65
|
+
|
|
57
66
|
const innerContentRef = useRef()
|
|
58
67
|
const headerRef = useRef()
|
|
59
68
|
const headerContentRef = useRef()
|
|
60
69
|
const [isTopPosition, setIsTopPosition] = useState(false)
|
|
61
70
|
const [peekHeights, setPeekHeights] = useState(null)
|
|
62
|
-
const [initPos, setInitPos] = useState(null)
|
|
63
71
|
const [bottomSpacerHeight, setBottomSpacerHeight] = useState(0)
|
|
72
|
+
const [initPos, setInitPos] = useState(mediumHeight)
|
|
64
73
|
|
|
65
|
-
const { mediumHeightRatio } = useMemo(() => settings || defaultSettings, [
|
|
66
|
-
settings
|
|
67
|
-
])
|
|
68
74
|
const styles = useMemo(() => makeStyles({ isTopPosition }), [isTopPosition])
|
|
69
75
|
|
|
70
76
|
// hack to prevent pull-down-to-refresh behavior when dragging down the bottom sheet.
|
|
@@ -79,7 +85,8 @@ const BottomSheet = ({ toolbarProps, settings, children }) => {
|
|
|
79
85
|
useEffect(() => {
|
|
80
86
|
const headerContent = headerContentRef.current
|
|
81
87
|
const maxHeight = computeMaxHeight(toolbarProps)
|
|
82
|
-
const
|
|
88
|
+
const computedMediumHeight =
|
|
89
|
+
mediumHeight || Math.round(maxHeight * mediumHeightRatio)
|
|
83
90
|
|
|
84
91
|
const actionButtonsHeight = headerContent
|
|
85
92
|
? parseFloat(getComputedStyle(headerContent).getPropertyValue('height'))
|
|
@@ -98,14 +105,15 @@ const BottomSheet = ({ toolbarProps, settings, children }) => {
|
|
|
98
105
|
// without stopping at the content height
|
|
99
106
|
const bottomSpacerHeight = maxHeight - innerContentRef.current.offsetHeight
|
|
100
107
|
|
|
101
|
-
setPeekHeights([minHeight,
|
|
102
|
-
setInitPos(
|
|
108
|
+
setPeekHeights([minHeight, computedMediumHeight, maxHeight])
|
|
109
|
+
setInitPos(computedMediumHeight)
|
|
103
110
|
setBottomSpacerHeight(bottomSpacerHeight)
|
|
104
111
|
}, [
|
|
105
112
|
innerContentRef,
|
|
106
113
|
headerContentRef.current,
|
|
107
114
|
toolbarProps,
|
|
108
|
-
mediumHeightRatio
|
|
115
|
+
mediumHeightRatio,
|
|
116
|
+
mediumHeight
|
|
109
117
|
])
|
|
110
118
|
|
|
111
119
|
const handleOnIndexChange = snapIndex => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Displays content coming up from the bottom of the screen. The pane can be swiped to the top of the screen.
|
|
1
|
+
Displays content coming up from the bottom of the screen. The pane can be swiped to the top of the screen. [API documentation is here](https://github.com/cozy/mui-bottom-sheet#props-options)
|
|
2
2
|
|
|
3
3
|
```jsx
|
|
4
4
|
import BottomSheet, { BottomSheetItem, BottomSheetHeader } from 'cozy-ui/transpiled/react/BottomSheet'
|
|
@@ -8,7 +8,7 @@ import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
|
8
8
|
initialState = { isBottomSheetDisplayed: isTesting() }
|
|
9
9
|
const showBottomSheet = () => setState({ isBottomSheetDisplayed: true })
|
|
10
10
|
|
|
11
|
-
const settings =
|
|
11
|
+
const settings = isTesting() ? { mediumHeight: 450 } : undefined
|
|
12
12
|
// -->
|
|
13
13
|
|
|
14
14
|
;
|
|
@@ -14,7 +14,7 @@ import Icon from '../Icon'
|
|
|
14
14
|
import FileTypeText from '../Icons/FileTypeText'
|
|
15
15
|
import FileTypeFolder from '../Icons/FileTypeFolder'
|
|
16
16
|
import Checkbox from '../Checkbox'
|
|
17
|
-
import Radio from '../
|
|
17
|
+
import Radio from '../Radios'
|
|
18
18
|
import { useI18n } from '../I18n'
|
|
19
19
|
|
|
20
20
|
import styles from './styles.styl'
|
|
@@ -93,7 +93,6 @@ const FilePickerBodyItem = ({
|
|
|
93
93
|
>
|
|
94
94
|
<Input
|
|
95
95
|
data-testid={multiple ? 'checkbox-btn' : 'radio-btn'}
|
|
96
|
-
gutter={false}
|
|
97
96
|
onChange={() => {
|
|
98
97
|
// handled by onClick on the container
|
|
99
98
|
}}
|
|
@@ -119,13 +119,14 @@ describe('FilePickerBodyItem components:', () => {
|
|
|
119
119
|
})
|
|
120
120
|
const radioBtn = getByTestId('radio-btn')
|
|
121
121
|
|
|
122
|
-
expect(radioBtn.getAttribute('disabled')).toBe(
|
|
122
|
+
expect(radioBtn.getAttribute('disabled')).toBe(null)
|
|
123
123
|
})
|
|
124
|
+
|
|
124
125
|
it('should disable and not display the Radio button if it is a Folder and is not accepted', () => {
|
|
125
126
|
const { getByTestId } = setup({ file: mockFolder01 })
|
|
126
127
|
const radioBtn = getByTestId('radio-btn')
|
|
127
128
|
|
|
128
|
-
expect(radioBtn.getAttribute('disabled')).toBe(
|
|
129
|
+
expect(radioBtn.getAttribute('disabled')).toBe(null)
|
|
129
130
|
})
|
|
130
131
|
})
|
|
131
132
|
})
|
|
@@ -633,28 +633,28 @@ const makeOverrides = theme => ({
|
|
|
633
633
|
MuiRadio: {
|
|
634
634
|
root: {
|
|
635
635
|
padding: '12px',
|
|
636
|
-
'
|
|
636
|
+
'&$disabled svg': {
|
|
637
637
|
borderRadius: '50%',
|
|
638
638
|
backgroundColor: theme.palette.background.default,
|
|
639
639
|
fill: theme.palette.border.disabled
|
|
640
640
|
},
|
|
641
|
-
'&:not(
|
|
641
|
+
'&:not($checked) svg': {
|
|
642
642
|
fill: theme.palette.border.main
|
|
643
643
|
}
|
|
644
644
|
},
|
|
645
645
|
colorPrimary: {
|
|
646
|
-
'
|
|
646
|
+
'&$checked svg': {
|
|
647
647
|
fill: theme.palette.primary.main
|
|
648
648
|
},
|
|
649
|
-
'
|
|
649
|
+
'&$disabled&$checked svg': {
|
|
650
650
|
fill: theme.palette.text.disabled
|
|
651
651
|
}
|
|
652
652
|
},
|
|
653
653
|
colorSecondary: {
|
|
654
|
-
'
|
|
654
|
+
'&$checked svg': {
|
|
655
655
|
fill: theme.palette.error.main
|
|
656
656
|
},
|
|
657
|
-
'
|
|
657
|
+
'&$disabled&$checked svg': {
|
|
658
658
|
fill: theme.palette.text.disabled
|
|
659
659
|
}
|
|
660
660
|
}
|
|
@@ -710,12 +710,12 @@ const makeInvertedOverrides = invertedTheme => {
|
|
|
710
710
|
},
|
|
711
711
|
MuiCheckbox: {
|
|
712
712
|
colorPrimary: {
|
|
713
|
-
'
|
|
713
|
+
'&$checked:not($disabled)': {
|
|
714
714
|
color: invertedTheme.palette.success.main
|
|
715
715
|
}
|
|
716
716
|
},
|
|
717
717
|
colorSecondary: {
|
|
718
|
-
'
|
|
718
|
+
'&$checked:not($disabled)': {
|
|
719
719
|
color: invertedTheme.palette.error.main
|
|
720
720
|
}
|
|
721
721
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import { withStyles } from '@material-ui/core'
|
|
4
|
-
import Icon from '../Icon'
|
|
5
|
-
import UIRadio from '../Radio'
|
|
6
4
|
import omit from 'lodash/omit'
|
|
5
|
+
|
|
6
|
+
import Icon from '../Icon'
|
|
7
|
+
import Radio from '../Radios'
|
|
7
8
|
import ListItem from '../MuiCozyTheme/ListItem'
|
|
8
9
|
import ListItemText from '../ListItemText'
|
|
9
10
|
import Divider from '../MuiCozyTheme/Divider'
|
|
@@ -247,10 +248,6 @@ NestedSelect.propTypes = {
|
|
|
247
248
|
|
|
248
249
|
export default NestedSelect
|
|
249
250
|
|
|
250
|
-
export const Radio = ({ ...props }) => (
|
|
251
|
-
<UIRadio label="" gutter={false} {...props} />
|
|
252
|
-
)
|
|
253
|
-
|
|
254
251
|
const NestedSelectListItemText = withStyles({
|
|
255
252
|
root: {
|
|
256
253
|
padding: '0rem 0.5rem'
|
|
@@ -5,19 +5,28 @@ import { CozyProvider } from 'cozy-client';
|
|
|
5
5
|
import { Provider } from 'react-redux';
|
|
6
6
|
import { WebviewIntentProvider } from 'cozy-intent';
|
|
7
7
|
|
|
8
|
-
var BarContextProvider = function BarContextProvider(
|
|
9
|
-
|
|
8
|
+
var BarContextProvider = function BarContextProvider(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
store = _ref.store,
|
|
11
|
+
client = _ref.client,
|
|
12
|
+
f = _ref.f,
|
|
13
|
+
t = _ref.t,
|
|
14
|
+
lang = _ref.lang,
|
|
15
|
+
webviewService = _ref.webviewService;
|
|
16
|
+
if (!children) return null;
|
|
10
17
|
return React.createElement(Provider, {
|
|
11
|
-
store:
|
|
18
|
+
store: store
|
|
12
19
|
}, React.createElement(CozyProvider, {
|
|
13
|
-
client:
|
|
20
|
+
client: client
|
|
14
21
|
}, React.createElement(I18nContext.Provider, {
|
|
15
22
|
value: {
|
|
16
|
-
f:
|
|
17
|
-
t:
|
|
18
|
-
lang:
|
|
23
|
+
f: f,
|
|
24
|
+
t: t,
|
|
25
|
+
lang: lang
|
|
19
26
|
}
|
|
20
|
-
}, React.createElement(BreakpointsProvider, null, React.createElement(WebviewIntentProvider,
|
|
27
|
+
}, React.createElement(BreakpointsProvider, null, webviewService ? React.createElement(WebviewIntentProvider, {
|
|
28
|
+
webviewService: webviewService
|
|
29
|
+
}, children) : children))));
|
|
21
30
|
};
|
|
22
31
|
|
|
23
32
|
export default BarContextProvider;
|
|
@@ -39,7 +39,8 @@ export var defaultBottomSheetSpringConfig = {
|
|
|
39
39
|
clamp: true
|
|
40
40
|
};
|
|
41
41
|
var defaultSettings = {
|
|
42
|
-
mediumHeightRatio: 0.33
|
|
42
|
+
mediumHeightRatio: 0.33,
|
|
43
|
+
mediumHeight: null
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
var computeMaxHeight = function computeMaxHeight(toolbarProps) {
|
|
@@ -60,6 +61,13 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
60
61
|
var toolbarProps = _ref2.toolbarProps,
|
|
61
62
|
settings = _ref2.settings,
|
|
62
63
|
children = _ref2.children;
|
|
64
|
+
|
|
65
|
+
var _useMemo = useMemo(function () {
|
|
66
|
+
return _objectSpread({}, defaultSettings, settings);
|
|
67
|
+
}, [settings]),
|
|
68
|
+
mediumHeightRatio = _useMemo.mediumHeightRatio,
|
|
69
|
+
mediumHeight = _useMemo.mediumHeight;
|
|
70
|
+
|
|
63
71
|
var innerContentRef = useRef();
|
|
64
72
|
var headerRef = useRef();
|
|
65
73
|
var headerContentRef = useRef();
|
|
@@ -74,20 +82,15 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
74
82
|
peekHeights = _useState4[0],
|
|
75
83
|
setPeekHeights = _useState4[1];
|
|
76
84
|
|
|
77
|
-
var _useState5 = useState(
|
|
85
|
+
var _useState5 = useState(0),
|
|
78
86
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
bottomSpacerHeight = _useState6[0],
|
|
88
|
+
setBottomSpacerHeight = _useState6[1];
|
|
81
89
|
|
|
82
|
-
var _useState7 = useState(
|
|
90
|
+
var _useState7 = useState(mediumHeight),
|
|
83
91
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var _useMemo = useMemo(function () {
|
|
88
|
-
return settings || defaultSettings;
|
|
89
|
-
}, [settings]),
|
|
90
|
-
mediumHeightRatio = _useMemo.mediumHeightRatio;
|
|
92
|
+
initPos = _useState8[0],
|
|
93
|
+
setInitPos = _useState8[1];
|
|
91
94
|
|
|
92
95
|
var styles = useMemo(function () {
|
|
93
96
|
return makeStyles({
|
|
@@ -105,17 +108,17 @@ var BottomSheet = function BottomSheet(_ref2) {
|
|
|
105
108
|
useEffect(function () {
|
|
106
109
|
var headerContent = headerContentRef.current;
|
|
107
110
|
var maxHeight = computeMaxHeight(toolbarProps);
|
|
108
|
-
var
|
|
111
|
+
var computedMediumHeight = mediumHeight || Math.round(maxHeight * mediumHeightRatio);
|
|
109
112
|
var actionButtonsHeight = headerContent ? parseFloat(getComputedStyle(headerContent).getPropertyValue('height')) : 0;
|
|
110
113
|
var actionButtonsBottomMargin = headerContent ? parseFloat(getComputedStyle(headerContent).getPropertyValue('padding-bottom')) : 0;
|
|
111
114
|
var minHeight = headerRef.current.offsetHeight + actionButtonsHeight + actionButtonsBottomMargin; // Used so that the bottomSheet can be opened to the top,
|
|
112
115
|
// without stopping at the content height
|
|
113
116
|
|
|
114
117
|
var bottomSpacerHeight = maxHeight - innerContentRef.current.offsetHeight;
|
|
115
|
-
setPeekHeights([minHeight,
|
|
116
|
-
setInitPos(
|
|
118
|
+
setPeekHeights([minHeight, computedMediumHeight, maxHeight]);
|
|
119
|
+
setInitPos(computedMediumHeight);
|
|
117
120
|
setBottomSpacerHeight(bottomSpacerHeight);
|
|
118
|
-
}, [innerContentRef, headerContentRef.current, toolbarProps, mediumHeightRatio]);
|
|
121
|
+
}, [innerContentRef, headerContentRef.current, toolbarProps, mediumHeightRatio, mediumHeight]);
|
|
119
122
|
|
|
120
123
|
var handleOnIndexChange = function handleOnIndexChange(snapIndex) {
|
|
121
124
|
var maxHeightSnapIndex = peekHeights.length - 1;
|
|
@@ -12,7 +12,7 @@ import Icon from "cozy-ui/transpiled/react/Icon";
|
|
|
12
12
|
import FileTypeText from "cozy-ui/transpiled/react/Icons/FileTypeText";
|
|
13
13
|
import FileTypeFolder from "cozy-ui/transpiled/react/Icons/FileTypeFolder";
|
|
14
14
|
import Checkbox from "cozy-ui/transpiled/react/Checkbox";
|
|
15
|
-
import Radio from "cozy-ui/transpiled/react/
|
|
15
|
+
import Radio from "cozy-ui/transpiled/react/Radios";
|
|
16
16
|
import { useI18n } from "cozy-ui/transpiled/react/I18n";
|
|
17
17
|
var styles = {
|
|
18
18
|
"filePickerBreadcrumb-previousPath": "styles__filePickerBreadcrumb-previousPath___3LKJH",
|
|
@@ -81,7 +81,6 @@ var FilePickerBodyItem = function FilePickerBodyItem(_ref) {
|
|
|
81
81
|
onClick: hasChoice ? handleChoiceClick(file) : undefined
|
|
82
82
|
}, React.createElement(Input, {
|
|
83
83
|
"data-testid": multiple ? 'checkbox-btn' : 'radio-btn',
|
|
84
|
-
gutter: false,
|
|
85
84
|
onChange: function onChange() {// handled by onClick on the container
|
|
86
85
|
},
|
|
87
86
|
checked: filesIdsSelected.includes(file._id),
|
|
@@ -595,28 +595,28 @@ var makeOverrides = function makeOverrides(theme) {
|
|
|
595
595
|
MuiRadio: {
|
|
596
596
|
root: {
|
|
597
597
|
padding: '12px',
|
|
598
|
-
'
|
|
598
|
+
'&$disabled svg': {
|
|
599
599
|
borderRadius: '50%',
|
|
600
600
|
backgroundColor: theme.palette.background.default,
|
|
601
601
|
fill: theme.palette.border.disabled
|
|
602
602
|
},
|
|
603
|
-
'&:not(
|
|
603
|
+
'&:not($checked) svg': {
|
|
604
604
|
fill: theme.palette.border.main
|
|
605
605
|
}
|
|
606
606
|
},
|
|
607
607
|
colorPrimary: {
|
|
608
|
-
'
|
|
608
|
+
'&$checked svg': {
|
|
609
609
|
fill: theme.palette.primary.main
|
|
610
610
|
},
|
|
611
|
-
'
|
|
611
|
+
'&$disabled&$checked svg': {
|
|
612
612
|
fill: theme.palette.text.disabled
|
|
613
613
|
}
|
|
614
614
|
},
|
|
615
615
|
colorSecondary: {
|
|
616
|
-
'
|
|
616
|
+
'&$checked svg': {
|
|
617
617
|
fill: theme.palette.error.main
|
|
618
618
|
},
|
|
619
|
-
'
|
|
619
|
+
'&$disabled&$checked svg': {
|
|
620
620
|
fill: theme.palette.text.disabled
|
|
621
621
|
}
|
|
622
622
|
}
|
|
@@ -672,12 +672,12 @@ var makeInvertedOverrides = function makeInvertedOverrides(invertedTheme) {
|
|
|
672
672
|
},
|
|
673
673
|
MuiCheckbox: {
|
|
674
674
|
colorPrimary: {
|
|
675
|
-
'
|
|
675
|
+
'&$checked:not($disabled)': {
|
|
676
676
|
color: invertedTheme.palette.success.main
|
|
677
677
|
}
|
|
678
678
|
},
|
|
679
679
|
colorSecondary: {
|
|
680
|
-
'
|
|
680
|
+
'&$checked:not($disabled)': {
|
|
681
681
|
color: invertedTheme.palette.error.main
|
|
682
682
|
}
|
|
683
683
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _toArray from "@babel/runtime/helpers/toArray";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
@@ -11,9 +10,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
11
10
|
import React, { Component } from 'react';
|
|
12
11
|
import PropTypes from 'prop-types';
|
|
13
12
|
import { withStyles } from '@material-ui/core';
|
|
14
|
-
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
15
|
-
import UIRadio from "cozy-ui/transpiled/react/Radio";
|
|
16
13
|
import omit from 'lodash/omit';
|
|
14
|
+
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
15
|
+
import Radio from "cozy-ui/transpiled/react/Radios";
|
|
17
16
|
import ListItem from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem";
|
|
18
17
|
import ListItemText from "cozy-ui/transpiled/react/ListItemText";
|
|
19
18
|
import Divider from "cozy-ui/transpiled/react/MuiCozyTheme/Divider";
|
|
@@ -267,14 +266,6 @@ NestedSelect.propTypes = {
|
|
|
267
266
|
})
|
|
268
267
|
};
|
|
269
268
|
export default NestedSelect;
|
|
270
|
-
export var Radio = function Radio(_ref) {
|
|
271
|
-
var props = _extends({}, _ref);
|
|
272
|
-
|
|
273
|
-
return React.createElement(UIRadio, _extends({
|
|
274
|
-
label: "",
|
|
275
|
-
gutter: false
|
|
276
|
-
}, props));
|
|
277
|
-
};
|
|
278
269
|
var NestedSelectListItemText = withStyles({
|
|
279
270
|
root: {
|
|
280
271
|
padding: '0rem 0.5rem'
|
|
@@ -292,11 +283,11 @@ var primaryTypographyProps = {
|
|
|
292
283
|
className: 'u-ellipsis',
|
|
293
284
|
variant: 'body1'
|
|
294
285
|
};
|
|
295
|
-
export var ItemRow = function ItemRow(
|
|
296
|
-
var item =
|
|
297
|
-
_onClick =
|
|
298
|
-
isSelected =
|
|
299
|
-
radioPosition =
|
|
286
|
+
export var ItemRow = function ItemRow(_ref) {
|
|
287
|
+
var item = _ref.item,
|
|
288
|
+
_onClick = _ref.onClick,
|
|
289
|
+
isSelected = _ref.isSelected,
|
|
290
|
+
radioPosition = _ref.radioPosition;
|
|
300
291
|
|
|
301
292
|
var _useBreakpoints = useBreakpoints(),
|
|
302
293
|
isMobile = _useBreakpoints.isMobile;
|