cozy-ui 119.1.0 → 120.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 +19 -0
- package/package.json +8 -2
- package/react/ActionsMenu/Readme.md +19 -0
- package/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides.js +54 -0
- package/react/Switch/Readme.md +47 -20
- package/react/Switch/index.jsx +20 -1
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkInvertedOverrides.d.ts +54 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeDarkNormalOverrides.d.ts +54 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightInvertedOverrides.d.ts +54 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides.d.ts +54 -0
- package/transpiled/react/MuiCozyTheme/overrides/twake/makeLightNormalOverrides.js +54 -0
- package/transpiled/react/Switch/index.js +25 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [120.0.0](https://github.com/cozy/cozy-ui/compare/v119.2.0...v120.0.0) (2025-03-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Set pdf-lib as a peerDep ([15604af](https://github.com/cozy/cozy-ui/commit/15604af))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* If you use print action, please add pdf-lib as a dep in your app because it is now a peerDep in cozy-ui. `yarn add pdf-lib@1.17.1`
|
|
12
|
+
|
|
13
|
+
# [119.2.0](https://github.com/cozy/cozy-ui/compare/v119.1.0...v119.2.0) (2025-03-12)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **Switch:** Adjust style component ([4e89011](https://github.com/cozy/cozy-ui/commit/4e89011))
|
|
19
|
+
|
|
1
20
|
# [119.1.0](https://github.com/cozy/cozy-ui/compare/v119.0.3...v119.1.0) (2025-03-12)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "120.0.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"mini-css-extract-plugin": "0.6.0",
|
|
127
127
|
"nodemon": "1.19.4",
|
|
128
128
|
"npm-run-all": "4.1.5",
|
|
129
|
+
"pdf-lib": "1.17.1",
|
|
129
130
|
"postcss-cli": "6.1.3",
|
|
130
131
|
"postcss-loader": "2.1.6",
|
|
131
132
|
"prettier": "2.6.0",
|
|
@@ -172,7 +173,6 @@
|
|
|
172
173
|
"mui-bottom-sheet": "https://github.com/cozy/mui-bottom-sheet.git#v1.0.9",
|
|
173
174
|
"node-polyglot": "^2.5.0",
|
|
174
175
|
"normalize.css": "^8.0.0",
|
|
175
|
-
"pdf-lib": "1.17.1",
|
|
176
176
|
"react-chartjs-2": "4.1.0",
|
|
177
177
|
"react-markdown": "^4.0.8",
|
|
178
178
|
"react-popper": "^2.2.3",
|
|
@@ -186,9 +186,15 @@
|
|
|
186
186
|
"cozy-device-helper": "^2.0.0",
|
|
187
187
|
"cozy-flags": ">=2.10.1",
|
|
188
188
|
"cozy-intent": ">=2.29.1",
|
|
189
|
+
"pdf-lib": "1.17.1",
|
|
189
190
|
"react": "^16.8.6",
|
|
190
191
|
"react-dom": "^16.8.6"
|
|
191
192
|
},
|
|
193
|
+
"peerDependenciesMeta": {
|
|
194
|
+
"pdf-lib": {
|
|
195
|
+
"optional": true
|
|
196
|
+
}
|
|
197
|
+
},
|
|
192
198
|
"eslintConfig": {
|
|
193
199
|
"extends": [
|
|
194
200
|
"eslint-config-cozy-app"
|
|
@@ -4,6 +4,25 @@ You can pass a reference to a custom DOM element through the `ref` prop to attac
|
|
|
4
4
|
|
|
5
5
|
A header `ActionsMenuMobileHeader` can be used to provide context on the menu actions. Since on desktop, we display a popper and not a `BottomSheet`, context for the user is not lost, so the header would be redundant. This is why it is not rendered unless we are on mobile.
|
|
6
6
|
|
|
7
|
+
## Available actions
|
|
8
|
+
|
|
9
|
+
cozy-ui exposes a list of ready-to-use action :
|
|
10
|
+
- makeActions
|
|
11
|
+
- divider
|
|
12
|
+
- modify
|
|
13
|
+
- smsTo
|
|
14
|
+
- call
|
|
15
|
+
- emailTo
|
|
16
|
+
- print (requires to add `pdf-lib` in the app)
|
|
17
|
+
- download
|
|
18
|
+
- addToFavorites
|
|
19
|
+
- removeFromFavorites
|
|
20
|
+
- viewInContacts
|
|
21
|
+
- viewInDrive
|
|
22
|
+
- copyToClipboard
|
|
23
|
+
- editAttribute
|
|
24
|
+
- others
|
|
25
|
+
|
|
7
26
|
### How to create and use actions
|
|
8
27
|
|
|
9
28
|
An action is a simple function that returns an object with specific keys:
|
|
@@ -10,6 +10,60 @@ export const makeLightNormalTwakeOverrides = theme => {
|
|
|
10
10
|
padding: 8
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
MuiSwitch: {
|
|
14
|
+
root: {
|
|
15
|
+
width: 50,
|
|
16
|
+
height: 40,
|
|
17
|
+
padding: '6px 1px'
|
|
18
|
+
},
|
|
19
|
+
switchBase: {
|
|
20
|
+
padding: 5,
|
|
21
|
+
top: 5,
|
|
22
|
+
color: theme.palette.text.icon,
|
|
23
|
+
'& .cozySwitchThumb': {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
width: 20,
|
|
28
|
+
height: 20,
|
|
29
|
+
borderRadius: '50%',
|
|
30
|
+
boxShadow: theme.shadows[1],
|
|
31
|
+
backgroundColor: theme.palette.common.white
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
track: {
|
|
35
|
+
width: 44,
|
|
36
|
+
height: '100%',
|
|
37
|
+
borderRadius: 100
|
|
38
|
+
},
|
|
39
|
+
thumb: {
|
|
40
|
+
width: 20,
|
|
41
|
+
height: 20
|
|
42
|
+
},
|
|
43
|
+
colorPrimary: {
|
|
44
|
+
'&$disabled + $track': {
|
|
45
|
+
opacity: 1,
|
|
46
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
colorSecondary: {
|
|
50
|
+
'&$checked': {
|
|
51
|
+
color: theme.palette.success.main
|
|
52
|
+
},
|
|
53
|
+
'&$disabled + $track': {
|
|
54
|
+
opacity: 1,
|
|
55
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
disabled: {
|
|
59
|
+
'&$checked + $track': {
|
|
60
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
61
|
+
},
|
|
62
|
+
'& .cozySwitchThumb': {
|
|
63
|
+
backgroundColor: theme.palette.background.default
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
13
67
|
MuiButton: {
|
|
14
68
|
root: {
|
|
15
69
|
borderRadius: 100,
|
package/react/Switch/Readme.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Used to present a binary choice to the user.
|
|
2
2
|
|
|
3
|
-
Uses [Material UI's Switch](https://material-ui.com/components/switches/).
|
|
4
|
-
|
|
5
3
|
```jsx
|
|
6
4
|
import { useState, useCallback } from 'react'
|
|
7
|
-
import { Media, Img } from 'cozy-ui/transpiled/react/deprecated/Media'
|
|
8
5
|
import Switch from 'cozy-ui/transpiled/react/Switch'
|
|
9
6
|
import Typography from "cozy-ui/transpiled/react/Typography"
|
|
10
7
|
import Stack from "cozy-ui/transpiled/react/Stack"
|
|
11
|
-
import Box from '
|
|
8
|
+
import Box from 'cozy-ui/transpiled/react/Box'
|
|
9
|
+
import CheckIcon from 'cozy-ui/transpiled/react/Icons/Check'
|
|
10
|
+
import FormControlLabel from 'cozy-ui/transpiled/react/FormControlLabel'
|
|
12
11
|
|
|
13
12
|
initialState = {
|
|
14
13
|
switch0: true,
|
|
@@ -22,26 +21,54 @@ const StateSwitch = ({ id, color }) => {
|
|
|
22
21
|
return <Switch
|
|
23
22
|
color={color}
|
|
24
23
|
checked={checked}
|
|
24
|
+
{...(isTwakeTheme() && { icon: CheckIcon })}
|
|
25
25
|
onChange={handleClick}
|
|
26
26
|
/>
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const Switches = () => {
|
|
30
|
-
return <Stack spacing='xs'>
|
|
31
|
-
{['primary', 'secondary', 'default'].map((color, i) => {
|
|
32
|
-
return (
|
|
33
|
-
<Box display='flex' alignItems='center' key={i}>
|
|
34
|
-
<Typography variant='body1' display="inline">
|
|
35
|
-
{ color }
|
|
36
|
-
</Typography>
|
|
37
|
-
<StateSwitch id={i} color={color} />
|
|
38
|
-
</Box>
|
|
39
|
-
)
|
|
40
|
-
})}
|
|
41
|
-
</Stack>
|
|
42
|
-
}
|
|
43
|
-
|
|
44
29
|
;
|
|
45
30
|
|
|
46
|
-
<
|
|
31
|
+
<Stack spacing='xs'>
|
|
32
|
+
{['primary', 'secondary', 'default'].map((color, i) => {
|
|
33
|
+
return (
|
|
34
|
+
<Box display='flex' alignItems='center' key={i}>
|
|
35
|
+
<Typography variant='body1' display="inline">{ color }</Typography>
|
|
36
|
+
<StateSwitch id={i} color={color} />
|
|
37
|
+
</Box>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
<FormControlLabel control={<Switch color="primary" />} label="With label" />
|
|
41
|
+
<FormControlLabel control={<Switch color="primary" checked />} label="With label" />
|
|
42
|
+
<br />
|
|
43
|
+
<FormControlLabel control={<Switch color="primary" disabled />} label="Primary, disabled with label" />
|
|
44
|
+
<FormControlLabel control={<Switch color="primary" checked disabled />} label="Primary, checked - disabled with label" />
|
|
45
|
+
<br />
|
|
46
|
+
<FormControlLabel
|
|
47
|
+
label="Primary, disabled with label"
|
|
48
|
+
control={
|
|
49
|
+
<Switch
|
|
50
|
+
color="primary"
|
|
51
|
+
{...(isTwakeTheme() && { icon: CheckIcon })}
|
|
52
|
+
disabled
|
|
53
|
+
/>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
<FormControlLabel
|
|
57
|
+
label="Primary, checked - disabled with label"
|
|
58
|
+
control={
|
|
59
|
+
<Switch
|
|
60
|
+
color="primary"
|
|
61
|
+
{...(isTwakeTheme() && { icon: CheckIcon })}
|
|
62
|
+
checked
|
|
63
|
+
disabled
|
|
64
|
+
/>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
<br />
|
|
68
|
+
<FormControlLabel control={<Switch color="secondary" disabled />} label="Secondary, checked with label" />
|
|
69
|
+
<FormControlLabel control={<Switch color="secondary" checked disabled />} label="Secondary, checked - disabled with label" />
|
|
70
|
+
<br />
|
|
71
|
+
<FormControlLabel control={<Switch disabled />} label="Default, checked with label" />
|
|
72
|
+
<FormControlLabel control={<Switch checked disabled />} label="Default, checked - disabled with label" />
|
|
73
|
+
</Stack>
|
|
47
74
|
```
|
package/react/Switch/index.jsx
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import MuiSwitch from '@material-ui/core/Switch'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import Icon from '../Icon'
|
|
5
|
+
import { isTwakeTheme } from '../helpers/isTwakeTheme'
|
|
6
|
+
|
|
7
|
+
const Switch = ({ icon, ...props }) => {
|
|
8
|
+
const _icon = (
|
|
9
|
+
<span className="cozySwitchThumb">
|
|
10
|
+
{!!icon && <Icon icon={icon} size={14} />}
|
|
11
|
+
</span>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<MuiSwitch
|
|
16
|
+
{...props}
|
|
17
|
+
{...(isTwakeTheme() && { icon: _icon, checkedIcon: _icon })}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
2
21
|
|
|
3
22
|
export default Switch
|
|
@@ -1417,6 +1417,60 @@ export function makeDarkInvertedTwakeOverrides(theme: any): {
|
|
|
1417
1417
|
padding: number;
|
|
1418
1418
|
};
|
|
1419
1419
|
};
|
|
1420
|
+
MuiSwitch: {
|
|
1421
|
+
root: {
|
|
1422
|
+
width: number;
|
|
1423
|
+
height: number;
|
|
1424
|
+
padding: string;
|
|
1425
|
+
};
|
|
1426
|
+
switchBase: {
|
|
1427
|
+
padding: number;
|
|
1428
|
+
top: number;
|
|
1429
|
+
color: any;
|
|
1430
|
+
'& .cozySwitchThumb': {
|
|
1431
|
+
display: string;
|
|
1432
|
+
alignItems: string;
|
|
1433
|
+
justifyContent: string;
|
|
1434
|
+
width: number;
|
|
1435
|
+
height: number;
|
|
1436
|
+
borderRadius: string;
|
|
1437
|
+
boxShadow: any;
|
|
1438
|
+
backgroundColor: any;
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
track: {
|
|
1442
|
+
width: number;
|
|
1443
|
+
height: string;
|
|
1444
|
+
borderRadius: number;
|
|
1445
|
+
};
|
|
1446
|
+
thumb: {
|
|
1447
|
+
width: number;
|
|
1448
|
+
height: number;
|
|
1449
|
+
};
|
|
1450
|
+
colorPrimary: {
|
|
1451
|
+
'&$disabled + $track': {
|
|
1452
|
+
opacity: number;
|
|
1453
|
+
backgroundColor: any;
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
colorSecondary: {
|
|
1457
|
+
'&$checked': {
|
|
1458
|
+
color: any;
|
|
1459
|
+
};
|
|
1460
|
+
'&$disabled + $track': {
|
|
1461
|
+
opacity: number;
|
|
1462
|
+
backgroundColor: any;
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
disabled: {
|
|
1466
|
+
'&$checked + $track': {
|
|
1467
|
+
backgroundColor: any;
|
|
1468
|
+
};
|
|
1469
|
+
'& .cozySwitchThumb': {
|
|
1470
|
+
backgroundColor: any;
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1420
1474
|
MuiButton: {
|
|
1421
1475
|
root: {
|
|
1422
1476
|
borderRadius: number;
|
|
@@ -1417,6 +1417,60 @@ export function makeDarkNormalTwakeOverrides(theme: any): {
|
|
|
1417
1417
|
padding: number;
|
|
1418
1418
|
};
|
|
1419
1419
|
};
|
|
1420
|
+
MuiSwitch: {
|
|
1421
|
+
root: {
|
|
1422
|
+
width: number;
|
|
1423
|
+
height: number;
|
|
1424
|
+
padding: string;
|
|
1425
|
+
};
|
|
1426
|
+
switchBase: {
|
|
1427
|
+
padding: number;
|
|
1428
|
+
top: number;
|
|
1429
|
+
color: any;
|
|
1430
|
+
'& .cozySwitchThumb': {
|
|
1431
|
+
display: string;
|
|
1432
|
+
alignItems: string;
|
|
1433
|
+
justifyContent: string;
|
|
1434
|
+
width: number;
|
|
1435
|
+
height: number;
|
|
1436
|
+
borderRadius: string;
|
|
1437
|
+
boxShadow: any;
|
|
1438
|
+
backgroundColor: any;
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
track: {
|
|
1442
|
+
width: number;
|
|
1443
|
+
height: string;
|
|
1444
|
+
borderRadius: number;
|
|
1445
|
+
};
|
|
1446
|
+
thumb: {
|
|
1447
|
+
width: number;
|
|
1448
|
+
height: number;
|
|
1449
|
+
};
|
|
1450
|
+
colorPrimary: {
|
|
1451
|
+
'&$disabled + $track': {
|
|
1452
|
+
opacity: number;
|
|
1453
|
+
backgroundColor: any;
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
colorSecondary: {
|
|
1457
|
+
'&$checked': {
|
|
1458
|
+
color: any;
|
|
1459
|
+
};
|
|
1460
|
+
'&$disabled + $track': {
|
|
1461
|
+
opacity: number;
|
|
1462
|
+
backgroundColor: any;
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
disabled: {
|
|
1466
|
+
'&$checked + $track': {
|
|
1467
|
+
backgroundColor: any;
|
|
1468
|
+
};
|
|
1469
|
+
'& .cozySwitchThumb': {
|
|
1470
|
+
backgroundColor: any;
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1420
1474
|
MuiButton: {
|
|
1421
1475
|
root: {
|
|
1422
1476
|
borderRadius: number;
|
|
@@ -1417,6 +1417,60 @@ export function makeLightInvertedTwakeOverrides(theme: any): {
|
|
|
1417
1417
|
padding: number;
|
|
1418
1418
|
};
|
|
1419
1419
|
};
|
|
1420
|
+
MuiSwitch: {
|
|
1421
|
+
root: {
|
|
1422
|
+
width: number;
|
|
1423
|
+
height: number;
|
|
1424
|
+
padding: string;
|
|
1425
|
+
};
|
|
1426
|
+
switchBase: {
|
|
1427
|
+
padding: number;
|
|
1428
|
+
top: number;
|
|
1429
|
+
color: any;
|
|
1430
|
+
'& .cozySwitchThumb': {
|
|
1431
|
+
display: string;
|
|
1432
|
+
alignItems: string;
|
|
1433
|
+
justifyContent: string;
|
|
1434
|
+
width: number;
|
|
1435
|
+
height: number;
|
|
1436
|
+
borderRadius: string;
|
|
1437
|
+
boxShadow: any;
|
|
1438
|
+
backgroundColor: any;
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
track: {
|
|
1442
|
+
width: number;
|
|
1443
|
+
height: string;
|
|
1444
|
+
borderRadius: number;
|
|
1445
|
+
};
|
|
1446
|
+
thumb: {
|
|
1447
|
+
width: number;
|
|
1448
|
+
height: number;
|
|
1449
|
+
};
|
|
1450
|
+
colorPrimary: {
|
|
1451
|
+
'&$disabled + $track': {
|
|
1452
|
+
opacity: number;
|
|
1453
|
+
backgroundColor: any;
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
colorSecondary: {
|
|
1457
|
+
'&$checked': {
|
|
1458
|
+
color: any;
|
|
1459
|
+
};
|
|
1460
|
+
'&$disabled + $track': {
|
|
1461
|
+
opacity: number;
|
|
1462
|
+
backgroundColor: any;
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
disabled: {
|
|
1466
|
+
'&$checked + $track': {
|
|
1467
|
+
backgroundColor: any;
|
|
1468
|
+
};
|
|
1469
|
+
'& .cozySwitchThumb': {
|
|
1470
|
+
backgroundColor: any;
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1420
1474
|
MuiButton: {
|
|
1421
1475
|
root: {
|
|
1422
1476
|
borderRadius: number;
|
|
@@ -1417,6 +1417,60 @@ export function makeLightNormalTwakeOverrides(theme: any): {
|
|
|
1417
1417
|
padding: number;
|
|
1418
1418
|
};
|
|
1419
1419
|
};
|
|
1420
|
+
MuiSwitch: {
|
|
1421
|
+
root: {
|
|
1422
|
+
width: number;
|
|
1423
|
+
height: number;
|
|
1424
|
+
padding: string;
|
|
1425
|
+
};
|
|
1426
|
+
switchBase: {
|
|
1427
|
+
padding: number;
|
|
1428
|
+
top: number;
|
|
1429
|
+
color: any;
|
|
1430
|
+
'& .cozySwitchThumb': {
|
|
1431
|
+
display: string;
|
|
1432
|
+
alignItems: string;
|
|
1433
|
+
justifyContent: string;
|
|
1434
|
+
width: number;
|
|
1435
|
+
height: number;
|
|
1436
|
+
borderRadius: string;
|
|
1437
|
+
boxShadow: any;
|
|
1438
|
+
backgroundColor: any;
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
track: {
|
|
1442
|
+
width: number;
|
|
1443
|
+
height: string;
|
|
1444
|
+
borderRadius: number;
|
|
1445
|
+
};
|
|
1446
|
+
thumb: {
|
|
1447
|
+
width: number;
|
|
1448
|
+
height: number;
|
|
1449
|
+
};
|
|
1450
|
+
colorPrimary: {
|
|
1451
|
+
'&$disabled + $track': {
|
|
1452
|
+
opacity: number;
|
|
1453
|
+
backgroundColor: any;
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
colorSecondary: {
|
|
1457
|
+
'&$checked': {
|
|
1458
|
+
color: any;
|
|
1459
|
+
};
|
|
1460
|
+
'&$disabled + $track': {
|
|
1461
|
+
opacity: number;
|
|
1462
|
+
backgroundColor: any;
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
disabled: {
|
|
1466
|
+
'&$checked + $track': {
|
|
1467
|
+
backgroundColor: any;
|
|
1468
|
+
};
|
|
1469
|
+
'& .cozySwitchThumb': {
|
|
1470
|
+
backgroundColor: any;
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1420
1474
|
MuiButton: {
|
|
1421
1475
|
root: {
|
|
1422
1476
|
borderRadius: number;
|
|
@@ -9,6 +9,60 @@ export var makeLightNormalTwakeOverrides = function makeLightNormalTwakeOverride
|
|
|
9
9
|
padding: 8
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
MuiSwitch: {
|
|
13
|
+
root: {
|
|
14
|
+
width: 50,
|
|
15
|
+
height: 40,
|
|
16
|
+
padding: '6px 1px'
|
|
17
|
+
},
|
|
18
|
+
switchBase: {
|
|
19
|
+
padding: 5,
|
|
20
|
+
top: 5,
|
|
21
|
+
color: theme.palette.text.icon,
|
|
22
|
+
'& .cozySwitchThumb': {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
width: 20,
|
|
27
|
+
height: 20,
|
|
28
|
+
borderRadius: '50%',
|
|
29
|
+
boxShadow: theme.shadows[1],
|
|
30
|
+
backgroundColor: theme.palette.common.white
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
track: {
|
|
34
|
+
width: 44,
|
|
35
|
+
height: '100%',
|
|
36
|
+
borderRadius: 100
|
|
37
|
+
},
|
|
38
|
+
thumb: {
|
|
39
|
+
width: 20,
|
|
40
|
+
height: 20
|
|
41
|
+
},
|
|
42
|
+
colorPrimary: {
|
|
43
|
+
'&$disabled + $track': {
|
|
44
|
+
opacity: 1,
|
|
45
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
colorSecondary: {
|
|
49
|
+
'&$checked': {
|
|
50
|
+
color: theme.palette.success.main
|
|
51
|
+
},
|
|
52
|
+
'&$disabled + $track': {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
disabled: {
|
|
58
|
+
'&$checked + $track': {
|
|
59
|
+
backgroundColor: theme.palette.action.disabledBackground
|
|
60
|
+
},
|
|
61
|
+
'& .cozySwitchThumb': {
|
|
62
|
+
backgroundColor: theme.palette.background.default
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
12
66
|
MuiButton: {
|
|
13
67
|
root: {
|
|
14
68
|
borderRadius: 100,
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["icon"];
|
|
4
|
+
import MuiSwitch from '@material-ui/core/Switch';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
7
|
+
import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
|
|
8
|
+
|
|
9
|
+
var Switch = function Switch(_ref) {
|
|
10
|
+
var icon = _ref.icon,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
var _icon = /*#__PURE__*/React.createElement("span", {
|
|
14
|
+
className: "cozySwitchThumb"
|
|
15
|
+
}, !!icon && /*#__PURE__*/React.createElement(Icon, {
|
|
16
|
+
icon: icon,
|
|
17
|
+
size: 14
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(MuiSwitch, _extends({}, props, isTwakeTheme() && {
|
|
21
|
+
icon: _icon,
|
|
22
|
+
checkedIcon: _icon
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
|
|
2
26
|
export default Switch;
|