cozy-ui 82.10.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 +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/react/Fab/Readme.md +70 -9
- package/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.js +4 -15
- package/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.spec.js +41 -1
- package/react/MuiCozyTheme/makeOverrides.js +30 -0
- package/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.js +3 -3
- package/transpiled/react/MuiCozyTheme/makeOverrides.js +30 -0
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
16
|
|
1
|
+
16.13.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
8
|
+
# [82.11.0](https://github.com/cozy/cozy-ui/compare/v82.10.0...v82.11.0) (2023-04-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **ExpandedAttributes:** Add some translated attributes as expanded ([866bb00](https://github.com/cozy/cozy-ui/commit/866bb00))
|
|
14
|
+
|
|
1
15
|
# [82.10.0](https://github.com/cozy/cozy-ui/compare/v82.9.0...v82.10.0) (2023-04-04)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "82.
|
|
3
|
+
"version": "82.12.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"intersection-observer"
|
|
68
68
|
],
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@argos-ci/cli": "
|
|
70
|
+
"@argos-ci/cli": "0.4.4",
|
|
71
71
|
"@babel/cli": "7.17.6",
|
|
72
72
|
"@babel/core": "7.17.8",
|
|
73
73
|
"@babel/helper-builder-react-jsx": "7.16.7",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"postcss-loader": "2.1.6",
|
|
129
129
|
"pretty": "2.0.0",
|
|
130
130
|
"prop-types": "15.7.2",
|
|
131
|
-
"puppeteer": "
|
|
131
|
+
"puppeteer": "18.2.0",
|
|
132
132
|
"react": "16.12.0",
|
|
133
133
|
"react-dom": "16.12.0",
|
|
134
134
|
"react-hot-loader": "^4.3.11",
|
package/react/Fab/Readme.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
```
|
|
@@ -4,34 +4,23 @@ import { formatDate } from '../../../Viewer/helpers'
|
|
|
4
4
|
|
|
5
5
|
export const normalizeExpandedAttribute = attr =>
|
|
6
6
|
attr
|
|
7
|
-
.
|
|
8
|
-
.replace(':', '.')
|
|
7
|
+
.replaceAll(':', '.')
|
|
9
8
|
.replace('flexsearchProps.', '')
|
|
9
|
+
.replace('translated.', '')
|
|
10
10
|
|
|
11
11
|
// attributes not considered as expanded attributes
|
|
12
12
|
export const notExpandedAttributes = {
|
|
13
|
-
'io.cozy.contacts': [
|
|
14
|
-
'fullname',
|
|
15
|
-
'civility',
|
|
16
|
-
'note',
|
|
17
|
-
'flexsearchProps:translated:phone',
|
|
18
|
-
'flexsearchProps:translated:email',
|
|
19
|
-
'flexsearchProps:translated:birthday',
|
|
20
|
-
'flexsearchProps:translated:address'
|
|
21
|
-
],
|
|
13
|
+
'io.cozy.contacts': ['fullname', 'civility', 'note'],
|
|
22
14
|
'io.cozy.files': [
|
|
23
15
|
'name',
|
|
24
16
|
'flexsearchProps:translated:qualificationLabel',
|
|
25
|
-
'flexsearchProps:translated:refTaxIncome',
|
|
26
|
-
'flexsearchProps:translated:contractType',
|
|
27
17
|
'flexsearchProps:translated:driverLicense',
|
|
28
18
|
'flexsearchProps:translated:paymentProofFamilyAllowance',
|
|
29
19
|
'flexsearchProps:translated:vehicleRegistration',
|
|
30
20
|
'flexsearchProps:translated:nationalIdCard',
|
|
31
21
|
'flexsearchProps:translated:bankDetails',
|
|
32
22
|
'flexsearchProps:translated:passport',
|
|
33
|
-
'flexsearchProps:translated:residencePermit'
|
|
34
|
-
'flexsearchProps:translated:expirationDate'
|
|
23
|
+
'flexsearchProps:translated:residencePermit'
|
|
35
24
|
]
|
|
36
25
|
}
|
|
37
26
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
formatAttrValue,
|
|
3
|
+
makeAttrKey,
|
|
4
|
+
normalizeExpandedAttribute
|
|
5
|
+
} from './helpers'
|
|
2
6
|
|
|
3
7
|
const f = () => 'someMockedDate'
|
|
4
8
|
const lang = 'en'
|
|
@@ -133,3 +137,39 @@ describe('makeAttrKey', () => {
|
|
|
133
137
|
expect(res).toBe('civility')
|
|
134
138
|
})
|
|
135
139
|
})
|
|
140
|
+
|
|
141
|
+
describe('normalizeExpandedAttribute', () => {
|
|
142
|
+
it('sould remove flexsearchProps and translated words', () => {
|
|
143
|
+
const res = normalizeExpandedAttribute(
|
|
144
|
+
'flexsearchProps:translated:qualificationLabel'
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
expect(res).toBe('qualificationLabel')
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('should keep metadata.x intact', () => {
|
|
151
|
+
const res = normalizeExpandedAttribute(
|
|
152
|
+
'flexsearchProps:translated:metadata.contractType'
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
expect(res).toBe('metadata.contractType')
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it('should keep email[1] intact', () => {
|
|
159
|
+
const res = normalizeExpandedAttribute('flexsearchProps:email[1].address')
|
|
160
|
+
|
|
161
|
+
expect(res).toBe('email[1].address')
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
it('should replace : by .', () => {
|
|
165
|
+
const res = normalizeExpandedAttribute('metadata:number')
|
|
166
|
+
|
|
167
|
+
expect(res).toBe('metadata.number')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('should do nothing for simple word', () => {
|
|
171
|
+
const res = normalizeExpandedAttribute('fullname')
|
|
172
|
+
|
|
173
|
+
expect(res).toBe('fullname')
|
|
174
|
+
})
|
|
175
|
+
})
|
|
@@ -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
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import { formatDate } from "cozy-ui/transpiled/react/Viewer/helpers";
|
|
3
3
|
export var normalizeExpandedAttribute = function normalizeExpandedAttribute(attr) {
|
|
4
|
-
return attr.
|
|
4
|
+
return attr.replaceAll(':', '.').replace('flexsearchProps.', '').replace('translated.', '');
|
|
5
5
|
}; // attributes not considered as expanded attributes
|
|
6
6
|
|
|
7
7
|
export var notExpandedAttributes = {
|
|
8
|
-
'io.cozy.contacts': ['fullname', 'civility', 'note'
|
|
9
|
-
'io.cozy.files': ['name', 'flexsearchProps:translated:qualificationLabel', 'flexsearchProps:translated:
|
|
8
|
+
'io.cozy.contacts': ['fullname', 'civility', 'note'],
|
|
9
|
+
'io.cozy.files': ['name', 'flexsearchProps:translated:qualificationLabel', 'flexsearchProps:translated:driverLicense', 'flexsearchProps:translated:paymentProofFamilyAllowance', 'flexsearchProps:translated:vehicleRegistration', 'flexsearchProps:translated:nationalIdCard', 'flexsearchProps:translated:bankDetails', 'flexsearchProps:translated:passport', 'flexsearchProps:translated:residencePermit']
|
|
10
10
|
}; // attributes that we want to display if no attribute of the document is related to the search
|
|
11
11
|
|
|
12
12
|
export var defaultExpandedAttributes = {
|
|
@@ -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
|
};
|