cozy-ui 82.11.0 → 82.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/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16
1
+ 16.13.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [82.12.0](https://github.com/cozy/cozy-ui/compare/v82.11.0...v82.12.0) (2023-04-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update Fab component ([cd4f0a6](https://github.com/cozy/cozy-ui/commit/cd4f0a6))
7
+
1
8
  # [82.11.0](https://github.com/cozy/cozy-ui/compare/v82.10.0...v82.11.0) (2023-04-05)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "82.11.0",
3
+ "version": "82.12.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,18 +1,79 @@
1
1
  See [Material UI documentation](https://material-ui.com/components/floating-action-button/) to learn more about Floating Action Button (Fab).
2
2
 
3
+ ### Default
4
+
5
+ ```jsx
6
+ import Fab from 'cozy-ui/transpiled/react/Fab'
7
+ import Icon from 'cozy-ui/transpiled/react/Icon'
8
+ import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
9
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
10
+ import Stack from 'cozy-ui/transpiled/react/Stack'
11
+ import Variants from 'cozy-ui/docs/components/Variants'
12
+
13
+ const props = [{ color: 'primary' }, { color: 'secondary' }, { color: 'inherit', default: true }]
14
+ const initialVariants = [{ small: false, medium: false, large: true }]
15
+
16
+ ;
17
+ <Variants initialVariants={initialVariants} radio screenshotAllVariants>
18
+ {variant => (
19
+ <Grid container>
20
+ {props.map(prop =>
21
+ <Grid item xs={12} sm={4} className="u-mb-1" key={Object.values(prop)[0]}>
22
+ <Stack spacing="s">
23
+ <div className="u-mb-half u-mt-1">{prop.color} {prop.default && '(default)'}</div>
24
+ <Fab aria-label="add" {...prop} size={Object.keys(variant).find(key => variant[key])}>
25
+ <Icon icon={PlusIcon} />
26
+ </Fab>
27
+ </Stack>
28
+ </Grid>
29
+ )}
30
+ {props.map(prop =>
31
+ <Grid item xs={12} sm={4} className="u-mb-1" key={Object.values(prop)[0]}>
32
+ <Stack spacing="s">
33
+ <Fab aria-label="add" {...prop} variant="extended" size={Object.keys(variant).find(key => variant[key])}>
34
+ <Icon icon={PlusIcon} className='u-mr-half' />
35
+ Extended
36
+ </Fab>
37
+ </Stack>
38
+ </Grid>
39
+ )}
40
+ </Grid>
41
+ )}
42
+ </Variants>
43
+ ```
44
+
45
+ ### Disabled colors
46
+
3
47
  ```jsx
4
48
  import Fab from 'cozy-ui/transpiled/react/Fab'
5
49
  import Icon from 'cozy-ui/transpiled/react/Icon'
6
50
  import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
7
- import RenameIcon from 'cozy-ui/transpiled/react/Icons/Rename'
51
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
52
+ import Stack from 'cozy-ui/transpiled/react/Stack'
53
+
54
+ const props = [{ color: 'primary' }, { color: 'secondary' }, { color: 'inherit', default: true }]
8
55
 
9
56
  ;
10
- <>
11
- <Fab color="primary" aria-label="add">
12
- <Icon icon={PlusIcon} />
13
- </Fab>
14
- <Fab color="secondary" aria-label="edit">
15
- <Icon icon={RenameIcon} />
16
- </Fab>
17
- </>
57
+ <Grid container>
58
+ {props.map(prop =>
59
+ <Grid item xs={12} sm={4} className="u-mb-1" key={Object.values(prop)[0]}>
60
+ <Stack spacing="s">
61
+ <div className="u-mb-half u-mt-1">{prop.color} {prop.default && '(default)'}</div>
62
+ <Fab aria-label="add" {...prop} disabled>
63
+ <Icon icon={PlusIcon} />
64
+ </Fab>
65
+ </Stack>
66
+ </Grid>
67
+ )}
68
+ {props.map(prop =>
69
+ <Grid item xs={12} sm={4} className="u-mb-1" key={Object.values(prop)[0]}>
70
+ <Stack spacing="s">
71
+ <Fab aria-label="add" {...prop} disabled variant="extended">
72
+ <Icon icon={PlusIcon} className='u-mr-half' />
73
+ Extended
74
+ </Fab>
75
+ </Stack>
76
+ </Grid>
77
+ )}
78
+ </Grid>
18
79
  ```
@@ -966,6 +966,36 @@ const makeOverrides = theme => ({
966
966
  padding: '4px 12px',
967
967
  backgroundColor: theme.palette.grey[600]
968
968
  }
969
+ },
970
+ MuiFab: {
971
+ root: {
972
+ color: theme.palette.text.primary,
973
+ backgroundColor: theme.palette.background.paper,
974
+ '&:hover': {
975
+ backgroundColor: theme.palette.action.hover,
976
+ '@media (hover: none)': {
977
+ backgroundColor: theme.palette.background.paper
978
+ }
979
+ }
980
+ },
981
+ extended: {
982
+ borderRadius: 56 / 2,
983
+ height: 56,
984
+ minWidth: 56,
985
+ padding: '0 20px',
986
+ '&$sizeSmall': {
987
+ borderRadius: 40 / 2,
988
+ height: 40,
989
+ minWidth: 40,
990
+ padding: '0 12px'
991
+ },
992
+ '&$sizeMedium': {
993
+ borderRadius: 48 / 2,
994
+ height: 48,
995
+ minWidth: 48,
996
+ padding: '0 16px'
997
+ }
998
+ }
969
999
  }
970
1000
  })
971
1001
 
@@ -884,6 +884,36 @@ var makeOverrides = function makeOverrides(theme) {
884
884
  padding: '4px 12px',
885
885
  backgroundColor: theme.palette.grey[600]
886
886
  }
887
+ },
888
+ MuiFab: {
889
+ root: {
890
+ color: theme.palette.text.primary,
891
+ backgroundColor: theme.palette.background.paper,
892
+ '&:hover': {
893
+ backgroundColor: theme.palette.action.hover,
894
+ '@media (hover: none)': {
895
+ backgroundColor: theme.palette.background.paper
896
+ }
897
+ }
898
+ },
899
+ extended: {
900
+ borderRadius: 56 / 2,
901
+ height: 56,
902
+ minWidth: 56,
903
+ padding: '0 20px',
904
+ '&$sizeSmall': {
905
+ borderRadius: 40 / 2,
906
+ height: 40,
907
+ minWidth: 40,
908
+ padding: '0 12px'
909
+ },
910
+ '&$sizeMedium': {
911
+ borderRadius: 48 / 2,
912
+ height: 48,
913
+ minWidth: 48,
914
+ padding: '0 16px'
915
+ }
916
+ }
887
917
  }
888
918
  };
889
919
  };