cozy-ui 135.2.0 → 135.3.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 +13 -0
- package/assets/icons/ui/cross-circle.svg +1 -1
- package/package.json +1 -1
- package/react/ActionsBar/Readme.md +61 -11
- package/react/ActionsBar/ResponsiveAction.jsx +3 -5
- package/react/ActionsBar/index.jsx +98 -71
- package/react/AppBar/index.js +66 -1
- package/react/Icons/CrossCircle.jsx +1 -4
- package/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.js +16 -1
- package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +6 -0
- package/transpiled/react/ActionsBar/ResponsiveAction.js +3 -2
- package/transpiled/react/ActionsBar/index.js +37 -24
- package/transpiled/react/AppBar/index.d.ts +3 -2
- package/transpiled/react/AppBar/index.js +53 -1
- package/transpiled/react/Icon/icons-sprite.d.ts +1 -1
- package/transpiled/react/Icon/icons-sprite.js +1 -1
- package/transpiled/react/Icons/CrossCircle.js +1 -2
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +6 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +12 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.js +13 -1
- package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +6 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +6 -0
- package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [135.3.0](https://github.com/cozy/cozy-ui/compare/v135.2.0...v135.3.0) (2026-01-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Remove fill attribute from cross-circle icon ([b949f88](https://github.com/cozy/cozy-ui/commit/b949f88))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Allow to customize icon in ActionsBar ([20788b7](https://github.com/cozy/cozy-ui/commit/20788b7))
|
|
12
|
+
* Allow to set color in ActionsBar and AppBar ([33721f0](https://github.com/cozy/cozy-ui/commit/33721f0))
|
|
13
|
+
|
|
1
14
|
# [135.2.0](https://github.com/cozy/cozy-ui/compare/v135.1.0...v135.2.0) (2026-01-14)
|
|
2
15
|
|
|
3
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M5.12 12 8 9.12 10.88 12 12 10.88 9.12 8 12 5.12 10.88 4 8 6.88 5.12 4 4 5.12 6.88 8 4 10.88 5.12 12ZM8 16a7.79 7.79 0 0 1-3.12-.63 8.079 8.079 0 0 1-2.54-1.71 8.08 8.08 0 0 1-1.71-2.54A7.79 7.79 0 0 1 0 8c0-1.107.21-2.147.63-3.12.42-.973.99-1.82 1.71-2.54A8.079 8.079 0 0 1 4.88.63 7.79 7.79 0 0 1 8 0a7.79 7.79 0 0 1 3.12.63c.973.42 1.82.99 2.54 1.71s1.29 1.567 1.71 2.54c.42.973.63 2.013.63 3.12a7.79 7.79 0 0 1-.63 3.12 8.08 8.08 0 0 1-1.71 2.54 8.08 8.08 0 0 1-2.54 1.71A7.79 7.79 0 0 1 8 16Z"
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M5.12 12 8 9.12 10.88 12 12 10.88 9.12 8 12 5.12 10.88 4 8 6.88 5.12 4 4 5.12 6.88 8 4 10.88 5.12 12ZM8 16a7.79 7.79 0 0 1-3.12-.63 8.079 8.079 0 0 1-2.54-1.71 8.08 8.08 0 0 1-1.71-2.54A7.79 7.79 0 0 1 0 8c0-1.107.21-2.147.63-3.12.42-.973.99-1.82 1.71-2.54A8.079 8.079 0 0 1 4.88.63 7.79 7.79 0 0 1 8 0a7.79 7.79 0 0 1 3.12.63c.973.42 1.82.99 2.54 1.71s1.29 1.567 1.71 2.54c.42.973.63 2.013.63 3.12a7.79 7.79 0 0 1-.63 3.12 8.08 8.08 0 0 1-1.71 2.54 8.08 8.08 0 0 1-2.54 1.71A7.79 7.79 0 0 1 8 16Z"/></svg>
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
Use same actions as `<ActionsMenu />`.
|
|
2
2
|
|
|
3
|
+
### Demo
|
|
4
|
+
|
|
5
|
+
This demo showcases all ActionsBar features:
|
|
6
|
+
|
|
7
|
+
* **Selection management**: Add/remove selected documents
|
|
8
|
+
* **Color customization**: The `color` prop allows customizing the background color (supports `default`, `inherit`, `primary`, `secondary`, `transparent`, `error`, `warning`, `info`, `success`)
|
|
9
|
+
* **Icon customization**: The `IconComponent` prop allows replacing the entire icon component displayed next to the selection count on desktop. It receives no props and should render a complete React component (defaults to `<Icon icon={CheckCircleIcon} />`)
|
|
10
|
+
|
|
3
11
|
```jsx
|
|
4
12
|
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
|
|
5
13
|
import Buttons from 'cozy-ui/transpiled/react/Buttons'
|
|
6
|
-
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash'
|
|
7
|
-
import RenameIcon from 'cozy-ui/transpiled/react/Icons/Rename'
|
|
8
|
-
import ShareIcon from 'cozy-ui/transpiled/react/Icons/Share'
|
|
9
14
|
import ActionsBar from 'cozy-ui/transpiled/react/ActionsBar'
|
|
15
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
16
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
10
17
|
import { makeActions, modify, emailTo, download, smsTo, call } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
_id: 1,
|
|
14
|
-
type: 'file'
|
|
15
|
-
}
|
|
18
|
+
import StarIcon from 'cozy-ui/transpiled/react/Icons/Star'
|
|
19
|
+
import FlagIcon from 'cozy-ui/transpiled/react/Icons/FlagOutlined'
|
|
16
20
|
|
|
17
21
|
const doc = {
|
|
18
22
|
_id: 'id01',
|
|
@@ -21,7 +25,11 @@ const doc = {
|
|
|
21
25
|
email: [{ address: 'johndoe@cozy.cc' }],
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
initialState = {
|
|
28
|
+
initialState = {
|
|
29
|
+
selected: isTesting() ? [doc, doc] : [],
|
|
30
|
+
color: 'default',
|
|
31
|
+
icon: 'default'
|
|
32
|
+
}
|
|
25
33
|
|
|
26
34
|
const addSelected = () => setState(previousState => {
|
|
27
35
|
const arr = previousState.selected
|
|
@@ -37,16 +45,58 @@ const removeSelected = () => setState(previousState => {
|
|
|
37
45
|
|
|
38
46
|
const actions = makeActions([ modify, call, download, smsTo, emailTo ])
|
|
39
47
|
|
|
48
|
+
const colors = ['default', 'inherit', 'primary', 'secondary', 'error', 'warning', 'info', 'success']
|
|
49
|
+
|
|
50
|
+
const StarIconComponent = () => <Icon className="u-mr-1" icon={StarIcon} />
|
|
51
|
+
const FlagIconComponent = () => <Icon className="u-mr-1" icon={FlagIcon} />
|
|
52
|
+
|
|
53
|
+
const icons = {
|
|
54
|
+
default: undefined,
|
|
55
|
+
star: StarIconComponent,
|
|
56
|
+
flag: FlagIconComponent
|
|
57
|
+
}
|
|
58
|
+
|
|
40
59
|
;
|
|
41
60
|
|
|
42
61
|
<DemoProvider>
|
|
43
|
-
<
|
|
44
|
-
|
|
62
|
+
<div className="u-mb-1">
|
|
63
|
+
<Typography variant="subtitle1" className="u-mb-half">Selection</Typography>
|
|
64
|
+
<Buttons label="Add a selected document" className="u-mr-1" onClick={addSelected} />
|
|
65
|
+
<Buttons label="Remove a selected document" onClick={removeSelected} />
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div className="u-mb-1">
|
|
69
|
+
<Typography variant="subtitle1" className="u-mb-half">Color</Typography>
|
|
70
|
+
{colors.map(color => (
|
|
71
|
+
<Buttons
|
|
72
|
+
key={color}
|
|
73
|
+
label={color}
|
|
74
|
+
className="u-mr-half u-mb-half"
|
|
75
|
+
variant={state.color === color ? 'primary' : 'secondary'}
|
|
76
|
+
onClick={() => setState({ color })}
|
|
77
|
+
/>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div className="u-mb-1">
|
|
82
|
+
<Typography variant="subtitle1" className="u-mb-half">Icon (desktop only)</Typography>
|
|
83
|
+
{Object.keys(icons).map(iconName => (
|
|
84
|
+
<Buttons
|
|
85
|
+
key={iconName}
|
|
86
|
+
label={iconName}
|
|
87
|
+
className="u-mr-half"
|
|
88
|
+
variant={state.icon === iconName ? 'primary' : 'secondary'}
|
|
89
|
+
onClick={() => setState({ icon: iconName })}
|
|
90
|
+
/>
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
45
93
|
|
|
46
94
|
{state.selected.length > 0 && (
|
|
47
95
|
<ActionsBar
|
|
48
96
|
actions={actions}
|
|
49
97
|
docs={state.selected}
|
|
98
|
+
color={state.color}
|
|
99
|
+
IconComponent={icons[state.icon]}
|
|
50
100
|
onClose={() => setState({selected: []})}
|
|
51
101
|
/>
|
|
52
102
|
)}
|
|
@@ -42,14 +42,12 @@ const ResponsiveAction = forwardRef(({ action, disabled, onClick }, ref) => {
|
|
|
42
42
|
<Button
|
|
43
43
|
ref={ref}
|
|
44
44
|
classes={styles}
|
|
45
|
-
variant="
|
|
45
|
+
variant="text"
|
|
46
|
+
color="inherit"
|
|
46
47
|
startIcon={<Icon icon={action.icon} />}
|
|
47
48
|
label={
|
|
48
49
|
isMobile ? (
|
|
49
|
-
<Typography
|
|
50
|
-
variant="caption"
|
|
51
|
-
color={disabled ? 'inherit' : 'textPrimary'}
|
|
52
|
-
>
|
|
50
|
+
<Typography variant="caption" color="inherit">
|
|
53
51
|
{action.label}
|
|
54
52
|
</Typography>
|
|
55
53
|
) : (
|
|
@@ -19,7 +19,6 @@ import DotsIcon from '../Icons/Dots'
|
|
|
19
19
|
import Toolbar from '../Toolbar'
|
|
20
20
|
import Typography from '../Typography'
|
|
21
21
|
import useBreakpoints from '../providers/Breakpoints'
|
|
22
|
-
import CozyTheme, { useCozyTheme } from '../providers/CozyTheme'
|
|
23
22
|
import { makeStyles } from '../styles'
|
|
24
23
|
|
|
25
24
|
const useStyles = makeStyles({
|
|
@@ -70,17 +69,20 @@ const useStyles = makeStyles({
|
|
|
70
69
|
})
|
|
71
70
|
})
|
|
72
71
|
|
|
73
|
-
const
|
|
72
|
+
const DefaultIcon = () => <Icon className="u-mr-1" icon={CheckCircleIcon} />
|
|
73
|
+
|
|
74
|
+
const SelectedCount = ({ docs, onClose, IconComponent }) => {
|
|
74
75
|
const { isMobile } = useBreakpoints()
|
|
75
76
|
const { t } = useI18n()
|
|
77
|
+
const SelectedIcon = IconComponent || DefaultIcon
|
|
76
78
|
|
|
77
79
|
if (isMobile)
|
|
78
80
|
return (
|
|
79
81
|
<Box
|
|
80
82
|
className="u-flex u-flex-items-center u-h-100 u-pr-1"
|
|
81
83
|
borderRadius="15px 0 0 0"
|
|
82
|
-
bgcolor="
|
|
83
|
-
color="primary
|
|
84
|
+
bgcolor="background.paper"
|
|
85
|
+
color="text.primary"
|
|
84
86
|
>
|
|
85
87
|
<IconButton color="inherit" onClick={onClose}>
|
|
86
88
|
<Icon icon={CrossCircleIcon} />
|
|
@@ -91,12 +93,8 @@ const SelectedCount = ({ docs, onClose }) => {
|
|
|
91
93
|
|
|
92
94
|
return (
|
|
93
95
|
<div className="u-flex u-flex-items-center u-h-100 u-ph-1">
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
icon={CheckCircleIcon}
|
|
97
|
-
color="var(--iconTextColor)"
|
|
98
|
-
/>
|
|
99
|
-
<Typography variant="body1" component="span">
|
|
96
|
+
<SelectedIcon />
|
|
97
|
+
<Typography variant="body1" component="span" color="inherit">
|
|
100
98
|
{t('selected_light', docs.length)}
|
|
101
99
|
</Typography>
|
|
102
100
|
</div>
|
|
@@ -108,10 +106,11 @@ const ActionsBar = ({
|
|
|
108
106
|
docs,
|
|
109
107
|
autoClose,
|
|
110
108
|
maxDesktopActions,
|
|
111
|
-
onClose
|
|
109
|
+
onClose,
|
|
110
|
+
color,
|
|
111
|
+
IconComponent
|
|
112
112
|
}) => {
|
|
113
113
|
const { isMobile } = useBreakpoints()
|
|
114
|
-
const { type } = useCozyTheme()
|
|
115
114
|
const anchorRef = useRef()
|
|
116
115
|
const [showMenu, setShowMenu] = useState(false)
|
|
117
116
|
const styles = useStyles({ isMobile })
|
|
@@ -138,65 +137,75 @@ const ActionsBar = ({
|
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
return (
|
|
141
|
-
<
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<Icon icon={DotsIcon} />
|
|
176
|
-
</IconButton>
|
|
177
|
-
)}
|
|
178
|
-
<ActionsMenu
|
|
179
|
-
ref={anchorRef}
|
|
180
|
-
open={showMenu}
|
|
140
|
+
<AppBar className={styles.appBar} position="fixed" color={color}>
|
|
141
|
+
<Toolbar
|
|
142
|
+
className={styles.toolbar}
|
|
143
|
+
variant={isMobile ? 'regular' : 'dense'}
|
|
144
|
+
disableGutters
|
|
145
|
+
>
|
|
146
|
+
{showDesktopCloseButton && (
|
|
147
|
+
<IconButton
|
|
148
|
+
className={styles.desktopCloseButton}
|
|
149
|
+
onClick={onClose}
|
|
150
|
+
color="inherit"
|
|
151
|
+
>
|
|
152
|
+
<Icon icon={CrossIcon} />
|
|
153
|
+
</IconButton>
|
|
154
|
+
)}
|
|
155
|
+
<SelectedCount
|
|
156
|
+
docs={docs}
|
|
157
|
+
onClose={onClose}
|
|
158
|
+
IconComponent={IconComponent}
|
|
159
|
+
/>
|
|
160
|
+
<div className={styles.actionsContainer}>
|
|
161
|
+
{/* actions displayed in the bar itself */}
|
|
162
|
+
<ActionsItems
|
|
163
|
+
docs={docs}
|
|
164
|
+
component={ResponsiveAction}
|
|
165
|
+
actions={barActions}
|
|
166
|
+
onClick={handleClick}
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
{/* actions displayed in ActionsMenu */}
|
|
170
|
+
{menuActions.length > 0 && (
|
|
171
|
+
<>
|
|
172
|
+
{isMobile ? (
|
|
173
|
+
<ActionsItems
|
|
181
174
|
docs={docs}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
horizontal: 'left'
|
|
186
|
-
}}
|
|
187
|
-
componentsProps={{
|
|
188
|
-
actionsItems: {
|
|
189
|
-
onClick: handleClick
|
|
190
|
-
}
|
|
191
|
-
}}
|
|
192
|
-
onClose={() => setShowMenu(false)}
|
|
175
|
+
component={ResponsiveAction}
|
|
176
|
+
actions={otherAction}
|
|
177
|
+
onClick={() => setShowMenu(true)}
|
|
193
178
|
/>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
179
|
+
) : (
|
|
180
|
+
<IconButton
|
|
181
|
+
color="inherit"
|
|
182
|
+
ref={anchorRef}
|
|
183
|
+
onClick={() => setShowMenu(true)}
|
|
184
|
+
>
|
|
185
|
+
<Icon icon={DotsIcon} />
|
|
186
|
+
</IconButton>
|
|
187
|
+
)}
|
|
188
|
+
<ActionsMenu
|
|
189
|
+
ref={anchorRef}
|
|
190
|
+
open={showMenu}
|
|
191
|
+
docs={docs}
|
|
192
|
+
actions={menuActions}
|
|
193
|
+
anchorOrigin={{
|
|
194
|
+
vertical: 'bottom',
|
|
195
|
+
horizontal: 'left'
|
|
196
|
+
}}
|
|
197
|
+
componentsProps={{
|
|
198
|
+
actionsItems: {
|
|
199
|
+
onClick: handleClick
|
|
200
|
+
}
|
|
201
|
+
}}
|
|
202
|
+
onClose={() => setShowMenu(false)}
|
|
203
|
+
/>
|
|
204
|
+
</>
|
|
205
|
+
)}
|
|
206
|
+
</div>
|
|
207
|
+
</Toolbar>
|
|
208
|
+
</AppBar>
|
|
200
209
|
)
|
|
201
210
|
}
|
|
202
211
|
|
|
@@ -207,12 +216,30 @@ ActionsBar.propTypes = {
|
|
|
207
216
|
* Only works on desktop since maximum number is forced in mobile
|
|
208
217
|
*/
|
|
209
218
|
maxDesktopActions: PropTypes.number,
|
|
210
|
-
autoClose: PropTypes.bool
|
|
219
|
+
autoClose: PropTypes.bool,
|
|
220
|
+
color: PropTypes.oneOf([
|
|
221
|
+
'default',
|
|
222
|
+
'inherit',
|
|
223
|
+
'primary',
|
|
224
|
+
'secondary',
|
|
225
|
+
'transparent',
|
|
226
|
+
'error',
|
|
227
|
+
'warning',
|
|
228
|
+
'info',
|
|
229
|
+
'success'
|
|
230
|
+
]),
|
|
231
|
+
/**
|
|
232
|
+
* Custom React component to replace the default Icon with CheckCircleIcon
|
|
233
|
+
* displayed next to the selection count on desktop.
|
|
234
|
+
* The component will be rendered as-is, giving full control over the icon styling.
|
|
235
|
+
*/
|
|
236
|
+
IconComponent: PropTypes.elementType
|
|
211
237
|
}
|
|
212
238
|
|
|
213
239
|
ActionsBar.defaultProps = {
|
|
214
240
|
maxDesktopActions: 5,
|
|
215
|
-
autoClose: true
|
|
241
|
+
autoClose: true,
|
|
242
|
+
color: 'default'
|
|
216
243
|
}
|
|
217
244
|
|
|
218
245
|
export default withActionsLocales(ActionsBar)
|
package/react/AppBar/index.js
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
1
|
import MuiAppBar from '@material-ui/core/AppBar'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import React from 'react'
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
import { makeStyles } from '../styles'
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles(theme => ({
|
|
8
|
+
colorError: {
|
|
9
|
+
backgroundColor: theme.palette.error.main,
|
|
10
|
+
color: theme.palette.error.contrastText
|
|
11
|
+
},
|
|
12
|
+
colorWarning: {
|
|
13
|
+
backgroundColor: theme.palette.warning.main,
|
|
14
|
+
color: theme.palette.warning.contrastText
|
|
15
|
+
},
|
|
16
|
+
colorInfo: {
|
|
17
|
+
backgroundColor: theme.palette.info.main,
|
|
18
|
+
color: theme.palette.info.contrastText
|
|
19
|
+
},
|
|
20
|
+
colorSuccess: {
|
|
21
|
+
backgroundColor: theme.palette.success.main,
|
|
22
|
+
color: theme.palette.success.contrastText
|
|
23
|
+
}
|
|
24
|
+
}))
|
|
25
|
+
|
|
26
|
+
const CUSTOM_COLOR_CLASSES = {
|
|
27
|
+
error: 'colorError',
|
|
28
|
+
warning: 'colorWarning',
|
|
29
|
+
info: 'colorInfo',
|
|
30
|
+
success: 'colorSuccess'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const AppBar = React.forwardRef(({ color, className, ...props }, ref) => {
|
|
34
|
+
const styles = useStyles()
|
|
35
|
+
const appBarColor = CUSTOM_COLOR_CLASSES[color] ? 'default' : color
|
|
36
|
+
const customColorClass = CUSTOM_COLOR_CLASSES[color]
|
|
37
|
+
? styles[CUSTOM_COLOR_CLASSES[color]]
|
|
38
|
+
: undefined
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<MuiAppBar
|
|
42
|
+
{...props}
|
|
43
|
+
ref={ref}
|
|
44
|
+
color={appBarColor}
|
|
45
|
+
className={`${className || ''} ${customColorClass || ''}`}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
AppBar.propTypes = {
|
|
51
|
+
color: PropTypes.oneOf([
|
|
52
|
+
'default',
|
|
53
|
+
'inherit',
|
|
54
|
+
'primary',
|
|
55
|
+
'secondary',
|
|
56
|
+
'transparent',
|
|
57
|
+
'error',
|
|
58
|
+
'warning',
|
|
59
|
+
'info',
|
|
60
|
+
'success'
|
|
61
|
+
])
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
AppBar.defaultProps = {
|
|
65
|
+
color: 'default'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default AppBar
|
|
@@ -4,10 +4,7 @@ import React from 'react'
|
|
|
4
4
|
function SvgCrossCircle(props) {
|
|
5
5
|
return (
|
|
6
6
|
<svg viewBox="0 0 16 16" {...props}>
|
|
7
|
-
<path
|
|
8
|
-
d="M5.12 12L8 9.12 10.88 12 12 10.88 9.12 8 12 5.12 10.88 4 8 6.88 5.12 4 4 5.12 6.88 8 4 10.88 5.12 12zM8 16a7.79 7.79 0 01-3.12-.63 8.079 8.079 0 01-2.54-1.71 8.08 8.08 0 01-1.71-2.54A7.79 7.79 0 010 8c0-1.107.21-2.147.63-3.12.42-.973.99-1.82 1.71-2.54A8.079 8.079 0 014.88.63 7.79 7.79 0 018 0a7.79 7.79 0 013.12.63c.973.42 1.82.99 2.54 1.71s1.29 1.567 1.71 2.54c.42.973.63 2.013.63 3.12a7.79 7.79 0 01-.63 3.12 8.08 8.08 0 01-1.71 2.54 8.08 8.08 0 01-2.54 1.71A7.79 7.79 0 018 16z"
|
|
9
|
-
fill="#5F6368"
|
|
10
|
-
/>
|
|
7
|
+
<path d="M5.12 12L8 9.12 10.88 12 12 10.88 9.12 8 12 5.12 10.88 4 8 6.88 5.12 4 4 5.12 6.88 8 4 10.88 5.12 12zM8 16a7.79 7.79 0 01-3.12-.63 8.079 8.079 0 01-2.54-1.71 8.08 8.08 0 01-1.71-2.54A7.79 7.79 0 010 8c0-1.107.21-2.147.63-3.12.42-.973.99-1.82 1.71-2.54A8.079 8.079 0 014.88.63 7.79 7.79 0 018 0a7.79 7.79 0 013.12.63c.973.42 1.82.99 2.54 1.71s1.29 1.567 1.71 2.54c.42.973.63 2.013.63 3.12a7.79 7.79 0 01-.63 3.12 8.08 8.08 0 01-1.71 2.54 8.08 8.08 0 01-2.54 1.71A7.79 7.79 0 018 16z" />
|
|
11
8
|
</svg>
|
|
12
9
|
)
|
|
13
10
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import merge from 'lodash/merge'
|
|
2
|
+
|
|
1
3
|
import { makeLightNormalOverrides } from './makeLightNormalOverrides'
|
|
2
4
|
|
|
3
5
|
export const makeDarkNormalOverrides = theme => {
|
|
4
|
-
|
|
6
|
+
const makeOverridesForDarkTheme = theme => ({
|
|
7
|
+
MuiAppBar: {
|
|
8
|
+
colorDefault: {
|
|
9
|
+
backgroundColor: theme.palette.primary.main
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const DarkNormalOverrides = merge(
|
|
15
|
+
makeLightNormalOverrides(theme),
|
|
16
|
+
makeOverridesForDarkTheme(theme)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return DarkNormalOverrides
|
|
5
20
|
}
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
} from '../helpers'
|
|
10
10
|
|
|
11
11
|
export const makeLightNormalOverrides = theme => ({
|
|
12
|
+
MuiAppBar: {
|
|
13
|
+
colorDefault: {
|
|
14
|
+
backgroundColor: theme.palette.grey.A400,
|
|
15
|
+
color: theme.palette.primary.contrastText
|
|
16
|
+
}
|
|
17
|
+
},
|
|
12
18
|
MuiSelect: {
|
|
13
19
|
iconOutlined: {
|
|
14
20
|
top: 'auto',
|
|
@@ -46,13 +46,14 @@ var ResponsiveAction = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
46
46
|
return /*#__PURE__*/React.createElement(Button, {
|
|
47
47
|
ref: ref,
|
|
48
48
|
classes: styles,
|
|
49
|
-
variant: "
|
|
49
|
+
variant: "text",
|
|
50
|
+
color: "inherit",
|
|
50
51
|
startIcon: /*#__PURE__*/React.createElement(Icon, {
|
|
51
52
|
icon: action.icon
|
|
52
53
|
}),
|
|
53
54
|
label: isMobile ? /*#__PURE__*/React.createElement(Typography, {
|
|
54
55
|
variant: "caption",
|
|
55
|
-
color:
|
|
56
|
+
color: "inherit"
|
|
56
57
|
}, action.label) : action.label,
|
|
57
58
|
disabled: disabled,
|
|
58
59
|
onClick: onClick
|
|
@@ -19,7 +19,6 @@ import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots";
|
|
|
19
19
|
import Toolbar from "cozy-ui/transpiled/react/Toolbar";
|
|
20
20
|
import Typography from "cozy-ui/transpiled/react/Typography";
|
|
21
21
|
import useBreakpoints from "cozy-ui/transpiled/react/providers/Breakpoints";
|
|
22
|
-
import CozyTheme, { useCozyTheme } from "cozy-ui/transpiled/react/providers/CozyTheme";
|
|
23
22
|
import { makeStyles } from "cozy-ui/transpiled/react/styles";
|
|
24
23
|
var useStyles = makeStyles({
|
|
25
24
|
appBar: function appBar(_ref) {
|
|
@@ -78,9 +77,17 @@ var useStyles = makeStyles({
|
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
|
|
80
|
+
var DefaultIcon = function DefaultIcon() {
|
|
81
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
82
|
+
className: "u-mr-1",
|
|
83
|
+
icon: CheckCircleIcon
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
81
87
|
var SelectedCount = function SelectedCount(_ref4) {
|
|
82
88
|
var docs = _ref4.docs,
|
|
83
|
-
onClose = _ref4.onClose
|
|
89
|
+
onClose = _ref4.onClose,
|
|
90
|
+
IconComponent = _ref4.IconComponent;
|
|
84
91
|
|
|
85
92
|
var _useBreakpoints = useBreakpoints(),
|
|
86
93
|
isMobile = _useBreakpoints.isMobile;
|
|
@@ -88,11 +95,12 @@ var SelectedCount = function SelectedCount(_ref4) {
|
|
|
88
95
|
var _useI18n = useI18n(),
|
|
89
96
|
t = _useI18n.t;
|
|
90
97
|
|
|
98
|
+
var SelectedIcon = IconComponent || DefaultIcon;
|
|
91
99
|
if (isMobile) return /*#__PURE__*/React.createElement(Box, {
|
|
92
100
|
className: "u-flex u-flex-items-center u-h-100 u-pr-1",
|
|
93
101
|
borderRadius: "15px 0 0 0",
|
|
94
|
-
bgcolor: "
|
|
95
|
-
color: "primary
|
|
102
|
+
bgcolor: "background.paper",
|
|
103
|
+
color: "text.primary"
|
|
96
104
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
97
105
|
color: "inherit",
|
|
98
106
|
onClick: onClose
|
|
@@ -101,13 +109,10 @@ var SelectedCount = function SelectedCount(_ref4) {
|
|
|
101
109
|
})), docs.length);
|
|
102
110
|
return /*#__PURE__*/React.createElement("div", {
|
|
103
111
|
className: "u-flex u-flex-items-center u-h-100 u-ph-1"
|
|
104
|
-
}, /*#__PURE__*/React.createElement(
|
|
105
|
-
className: "u-mr-1",
|
|
106
|
-
icon: CheckCircleIcon,
|
|
107
|
-
color: "var(--iconTextColor)"
|
|
108
|
-
}), /*#__PURE__*/React.createElement(Typography, {
|
|
112
|
+
}, /*#__PURE__*/React.createElement(SelectedIcon, null), /*#__PURE__*/React.createElement(Typography, {
|
|
109
113
|
variant: "body1",
|
|
110
|
-
component: "span"
|
|
114
|
+
component: "span",
|
|
115
|
+
color: "inherit"
|
|
111
116
|
}, t('selected_light', docs.length)));
|
|
112
117
|
};
|
|
113
118
|
|
|
@@ -116,14 +121,13 @@ var ActionsBar = function ActionsBar(_ref5) {
|
|
|
116
121
|
docs = _ref5.docs,
|
|
117
122
|
autoClose = _ref5.autoClose,
|
|
118
123
|
maxDesktopActions = _ref5.maxDesktopActions,
|
|
119
|
-
onClose = _ref5.onClose
|
|
124
|
+
onClose = _ref5.onClose,
|
|
125
|
+
color = _ref5.color,
|
|
126
|
+
IconComponent = _ref5.IconComponent;
|
|
120
127
|
|
|
121
128
|
var _useBreakpoints2 = useBreakpoints(),
|
|
122
129
|
isMobile = _useBreakpoints2.isMobile;
|
|
123
130
|
|
|
124
|
-
var _useCozyTheme = useCozyTheme(),
|
|
125
|
-
type = _useCozyTheme.type;
|
|
126
|
-
|
|
127
131
|
var anchorRef = useRef();
|
|
128
132
|
|
|
129
133
|
var _useState = useState(false),
|
|
@@ -149,25 +153,24 @@ var ActionsBar = function ActionsBar(_ref5) {
|
|
|
149
153
|
autoClose && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
150
154
|
};
|
|
151
155
|
|
|
152
|
-
return /*#__PURE__*/React.createElement(
|
|
153
|
-
type: type,
|
|
154
|
-
variant: "inverted"
|
|
155
|
-
}, /*#__PURE__*/React.createElement(AppBar, {
|
|
156
|
+
return /*#__PURE__*/React.createElement(AppBar, {
|
|
156
157
|
className: styles.appBar,
|
|
157
158
|
position: "fixed",
|
|
158
|
-
color:
|
|
159
|
+
color: color
|
|
159
160
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
160
161
|
className: styles.toolbar,
|
|
161
162
|
variant: isMobile ? 'regular' : 'dense',
|
|
162
163
|
disableGutters: true
|
|
163
164
|
}, showDesktopCloseButton && /*#__PURE__*/React.createElement(IconButton, {
|
|
164
165
|
className: styles.desktopCloseButton,
|
|
165
|
-
onClick: onClose
|
|
166
|
+
onClick: onClose,
|
|
167
|
+
color: "inherit"
|
|
166
168
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
167
169
|
icon: CrossIcon
|
|
168
170
|
})), /*#__PURE__*/React.createElement(SelectedCount, {
|
|
169
171
|
docs: docs,
|
|
170
|
-
onClose: onClose
|
|
172
|
+
onClose: onClose,
|
|
173
|
+
IconComponent: IconComponent
|
|
171
174
|
}), /*#__PURE__*/React.createElement("div", {
|
|
172
175
|
className: styles.actionsContainer
|
|
173
176
|
}, /*#__PURE__*/React.createElement(ActionsItems, {
|
|
@@ -183,6 +186,7 @@ var ActionsBar = function ActionsBar(_ref5) {
|
|
|
183
186
|
return setShowMenu(true);
|
|
184
187
|
}
|
|
185
188
|
}) : /*#__PURE__*/React.createElement(IconButton, {
|
|
189
|
+
color: "inherit",
|
|
186
190
|
ref: anchorRef,
|
|
187
191
|
onClick: function onClick() {
|
|
188
192
|
return setShowMenu(true);
|
|
@@ -206,7 +210,7 @@ var ActionsBar = function ActionsBar(_ref5) {
|
|
|
206
210
|
onClose: function onClose() {
|
|
207
211
|
return setShowMenu(false);
|
|
208
212
|
}
|
|
209
|
-
})))))
|
|
213
|
+
})))));
|
|
210
214
|
};
|
|
211
215
|
|
|
212
216
|
ActionsBar.propTypes = {
|
|
@@ -216,10 +220,19 @@ ActionsBar.propTypes = {
|
|
|
216
220
|
* Only works on desktop since maximum number is forced in mobile
|
|
217
221
|
*/
|
|
218
222
|
maxDesktopActions: PropTypes.number,
|
|
219
|
-
autoClose: PropTypes.bool
|
|
223
|
+
autoClose: PropTypes.bool,
|
|
224
|
+
color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'warning', 'info', 'success']),
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Custom React component to replace the default Icon with CheckCircleIcon
|
|
228
|
+
* displayed next to the selection count on desktop.
|
|
229
|
+
* The component will be rendered as-is, giving full control over the icon styling.
|
|
230
|
+
*/
|
|
231
|
+
IconComponent: PropTypes.elementType
|
|
220
232
|
};
|
|
221
233
|
ActionsBar.defaultProps = {
|
|
222
234
|
maxDesktopActions: 5,
|
|
223
|
-
autoClose: true
|
|
235
|
+
autoClose: true,
|
|
236
|
+
color: 'default'
|
|
224
237
|
};
|
|
225
238
|
export default withActionsLocales(ActionsBar);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export default
|
|
2
|
-
|
|
1
|
+
export default AppBar;
|
|
2
|
+
declare const AppBar: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
+
import React from "react";
|