cozy-ui 83.3.0 → 83.4.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/package.json +1 -1
  3. package/react/ContactsList/ContactRow.jsx +2 -0
  4. package/react/ContactsList/ContactsList.jsx +10 -1
  5. package/react/ContactsList/Readme.md +20 -15
  6. package/react/ContactsList/__snapshots__/ContactRow.spec.js.snap +3 -1
  7. package/react/ContactsList/styles.styl +4 -0
  8. package/react/FilePicker/FilePickerBodyItem.jsx +3 -6
  9. package/react/MuiCozyTheme/List/Readme.md +156 -161
  10. package/react/MuiCozyTheme/ListItem/Readme.md +99 -0
  11. package/react/MuiCozyTheme/ListItem/index.js +105 -1
  12. package/react/MuiCozyTheme/ListItemIcon/index.js +2 -0
  13. package/react/MuiCozyTheme/ListSubheader/Readme.md +36 -0
  14. package/react/MuiCozyTheme/ListSubheader/index.js +42 -1
  15. package/react/MuiCozyTheme/makeOverrides.js +38 -60
  16. package/react/NestedSelect/ItemRow.jsx +5 -16
  17. package/react/__snapshots__/examples.spec.jsx.snap +260 -260
  18. package/react/utils/react.js +24 -0
  19. package/transpiled/react/ContactsList/ContactRow.js +5 -0
  20. package/transpiled/react/ContactsList/ContactsList.js +8 -1
  21. package/transpiled/react/FilePicker/FilePickerBodyItem.js +3 -8
  22. package/transpiled/react/MuiCozyTheme/ListItem/index.js +108 -1
  23. package/transpiled/react/MuiCozyTheme/ListItemIcon/index.js +1 -0
  24. package/transpiled/react/MuiCozyTheme/ListSubheader/index.js +42 -1
  25. package/transpiled/react/MuiCozyTheme/makeOverrides.js +50 -71
  26. package/transpiled/react/NestedSelect/ItemRow.js +4 -10
  27. package/transpiled/react/stylesheet.css +1 -1
  28. package/transpiled/react/utils/react.js +17 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # [83.4.0](https://github.com/cozy/cozy-ui/compare/v83.3.0...v83.4.0) (2023-04-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * **ContactsList:** Adjust style after modification on ListItem ([6049a7b](https://github.com/cozy/cozy-ui/commit/6049a7b))
7
+ * **FilePicker:** Adjust style after ListItem modifications ([fa3b646](https://github.com/cozy/cozy-ui/commit/fa3b646))
8
+ * **List:** Update List, ListItem, ListItemText, ListSubheader, ListItemIcon ([3e64e8e](https://github.com/cozy/cozy-ui/commit/3e64e8e))
9
+ * **NestedSelect:** Adjust style after ListItem modifications ([b951426](https://github.com/cozy/cozy-ui/commit/b951426))
10
+
1
11
  # [83.3.0](https://github.com/cozy/cozy-ui/compare/v83.2.0...v83.3.0) (2023-04-21)
2
12
 
3
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "83.3.0",
3
+ "version": "83.4.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -18,12 +18,14 @@ const ContactRow = ({ className, contact, onClick, divider, ...rest }) => {
18
18
  const phone = getPrimaryPhone(contact) || undefined
19
19
  const email = getPrimaryEmail(contact) || undefined
20
20
  const cozyUrl = getPrimaryCozy(contact) || undefined
21
+ const { isDesktop } = useBreakpoints()
21
22
 
22
23
  return (
23
24
  <ListItem
24
25
  data-testid="contact-listItem"
25
26
  className={cx({ 'u-c-pointer': onClick }, className)}
26
27
  divider={divider}
28
+ gutters={isDesktop ? 'double' : 'default'}
27
29
  onClick={() => onClick(contact)}
28
30
  {...rest}
29
31
  >
@@ -6,16 +6,25 @@ import List from '../MuiCozyTheme/List'
6
6
  import ListSubheader from '../MuiCozyTheme/ListSubheader'
7
7
  import { sortContacts, categorizeContacts, sortHeaders } from './helpers'
8
8
  import ContactRow from './ContactRow'
9
+ import useBreakpoints from '../hooks/useBreakpoints'
9
10
 
10
11
  const ContactsList = ({ contacts, onItemClick, ...rest }) => {
11
12
  const sortedContacts = sortContacts(contacts)
12
13
  const categorizedContacts = categorizeContacts(sortedContacts)
13
14
  const sortedHeaders = sortHeaders(categorizedContacts)
15
+ const { isDesktop } = useBreakpoints()
14
16
 
15
17
  return (
16
18
  <Table {...rest}>
17
19
  {sortedHeaders.map(header => (
18
- <List key={header} subheader={<ListSubheader>{header}</ListSubheader>}>
20
+ <List
21
+ key={header}
22
+ subheader={
23
+ <ListSubheader gutters={isDesktop ? 'double' : 'default'}>
24
+ {header}
25
+ </ListSubheader>
26
+ }
27
+ >
19
28
  {categorizedContacts[header].map((contact, index) => (
20
29
  <ContactRow
21
30
  key={contact._id}
@@ -1,9 +1,11 @@
1
1
  ### Raw list
2
2
 
3
3
  ```jsx
4
- import ContactsList from 'cozy-ui/transpiled/react/ContactsList';
5
- import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints';
6
- import contacts from './_mockContacts.json';
4
+ import ContactsList from 'cozy-ui/transpiled/react/ContactsList'
5
+ import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
6
+ import contacts from './_mockContacts.json'
7
+
8
+ ;
7
9
 
8
10
  <BreakpointsProvider>
9
11
  <div style={{ height: 500, overflowY: 'scroll' }}>
@@ -15,18 +17,21 @@ import contacts from './_mockContacts.json';
15
17
  ### Clickable items
16
18
 
17
19
  ```jsx
18
- import ContactsList from 'cozy-ui/transpiled/react/ContactsList';
19
- import contacts from './_mockContacts.json';
20
- import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints';
21
-
22
- initialState = { contact: null };
23
-
24
- <BreakpointsProvider><p>
25
- {state.contact ? (
26
- `Clicked on contact ${state.contact._id}`
27
- ) : (
28
- 'No contact clicked'
29
- )}
20
+ import ContactsList from 'cozy-ui/transpiled/react/ContactsList'
21
+ import contacts from './_mockContacts.json'
22
+ import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
23
+
24
+ initialState = { contact: null }
25
+
26
+ ;
27
+
28
+ <BreakpointsProvider>
29
+ <p>
30
+ {state.contact ? (
31
+ `Clicked on contact ${state.contact._id}`
32
+ ) : (
33
+ 'No contact clicked'
34
+ )}
30
35
  </p>
31
36
  <div style={{ height: 500, overflowY: 'scroll' }}>
32
37
  <ContactsList
@@ -2,10 +2,12 @@
2
2
 
3
3
  exports[`ContactRow should match the contact snapshot 1`] = `
4
4
  <li
5
- className="MuiListItem-root MuiListItem-gutters"
5
+ className="MuiListItem-root medium MuiListItem-gutters makeStyles-gutters-1 makeStyles-gutters-11"
6
6
  data-testid="contact-listItem"
7
7
  disabled={false}
8
+ gutters="double"
8
9
  onClick={[Function]}
10
+ size="medium"
9
11
  >
10
12
  <div
11
13
  className="styles__TableCell___yJCq7 styles__contact-identity___mL3IJ u-flex u-flex-items-center u-ellipsis"
@@ -11,12 +11,15 @@
11
11
 
12
12
  .contact-phone
13
13
  flex 0 0 12rem
14
+ padding 0
14
15
 
15
16
  .contact-cozyurl
16
17
  flex 0 0 12rem
18
+ padding 0
17
19
 
18
20
  .contact-email
19
21
  flex-basis 30%
22
+ padding 0
20
23
 
21
24
  .contact-myself
22
25
  color var(--secondaryTextColor)
@@ -24,6 +27,7 @@
24
27
 
25
28
  .contact-identity
26
29
  flex-basis 30%
30
+ padding 0
27
31
 
28
32
  +small-screen()
29
33
  flex 1 1 auto
@@ -32,9 +32,6 @@ const useStyles = makeStyles(() => ({
32
32
  alignSelf: 'auto',
33
33
  alignItems: 'center',
34
34
  marginLeft: '0.5rem'
35
- },
36
- listItemIcon: {
37
- marginLeft: '1rem'
38
35
  }
39
36
  }))
40
37
 
@@ -65,8 +62,8 @@ const FilePickerBodyItem = ({
65
62
  <>
66
63
  <ListItem
67
64
  disabled={!hasChoice && isFile(item)}
65
+ size="small"
68
66
  button
69
- className="u-p-0"
70
67
  data-testid="list-item"
71
68
  >
72
69
  <div
@@ -74,7 +71,7 @@ const FilePickerBodyItem = ({
74
71
  className={styles['filePickerBreadcrumb-wrapper']}
75
72
  onClick={handleListItemClick(item)}
76
73
  >
77
- <ListItemIcon className={classes.listItemIcon}>
74
+ <ListItemIcon>
78
75
  <Icon
79
76
  icon={isDirectory(item) ? FileTypeFolder : FileTypeText}
80
77
  width="32"
@@ -95,7 +92,7 @@ const FilePickerBodyItem = ({
95
92
  )}
96
93
  <div
97
94
  data-testid="choice-onclick"
98
- className="u-ph-1 u-pv-half u-h-2 u-flex u-flex-items-center"
95
+ className="u-pv-half u-h-2 u-flex u-flex-items-center"
99
96
  onClick={hasChoice ? handleChoiceClick(item) : undefined}
100
97
  >
101
98
  <Input
@@ -43,6 +43,8 @@ import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider'
43
43
  import FileTypeFolderIcon from 'cozy-ui/transpiled/react/Icons/FileTypeFolder'
44
44
  import FiletypeTextIcon from 'cozy-ui/transpiled/react/Icons/FileTypeText'
45
45
  import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots"
46
+ import PenIcon from "cozy-ui/transpiled/react/Icons/Pen"
47
+ import TrashIcon from "cozy-ui/transpiled/react/Icons/Trash"
46
48
  import IconButton from 'cozy-ui/transpiled/react/IconButton'
47
49
  import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
48
50
  import FileIcon from 'cozy-ui/transpiled/react/Icons/File'
@@ -55,180 +57,173 @@ import PieChartIcon from 'cozy-ui/transpiled/react/Icons/PieChart'
55
57
  import CommentIcon from 'cozy-ui/transpiled/react/Icons/Comment'
56
58
  import MagicTrickIcon from 'cozy-ui/transpiled/react/Icons/MagicTrick'
57
59
  import Radio from 'cozy-ui/transpiled/react/Radios'
60
+ import Checkbox from 'cozy-ui/transpiled/react/Checkbox'
58
61
  import Variants from 'cozy-ui/docs/components/Variants'
59
62
 
60
63
  initialState = { showMenu: false }
61
64
 
62
65
  const anchorRef = React.useRef()
63
66
  const hideMenu = () => setState({ showMenu: false })
64
- const toggleMenu = () => {setState(state => ({ showMenu: !state.showMenu }))}
67
+ const toggleMenu = () => setState(state => ({ showMenu: !state.showMenu }))
65
68
 
66
- const initialVariants = [{ dense: false, }]
69
+ const initialVariants = [{ dense: false, disabledGutters: false, doubleGutters: false, small: false, large: false }]
67
70
 
68
71
  ;
69
72
 
70
73
  <BreakpointsProvider>
71
74
  <Variants initialVariants={initialVariants} screenshotAllVariants>
72
- {variant => (
73
- <>
74
- <List dense={variant.dense} subheader={<ListSubheader>Section 1</ListSubheader>}>
75
- <ListItem button divider={variant.divider}>
76
- <ListItemIcon>
77
- <Icon icon={FileTypeFolderIcon} size={32} />
78
- </ListItemIcon>
79
- <ListItemText primary="I'm a primary text"/>
80
- <ListItemText secondary="Metadata"/>
81
- <ListItemText secondary="Metadata"/>
82
- </ListItem>
83
-
84
- <Divider component="li" variant="inset" />
85
-
86
- <ListItem button>
87
- <ListItemIcon>
88
- <Icon icon={FiletypeTextIcon} size={32} />
89
- </ListItemIcon>
90
- <ListItemText primary="I'm a primary text" secondary="I'm a secondary text"/>
91
- </ListItem>
92
-
93
- <Divider component="li" variant="inset" />
94
-
95
- <ListItem button>
96
- <ListItemIcon>
97
- <Icon icon={FiletypeTextIcon} size={32} />
98
- </ListItemIcon>
99
- <ListItemText
100
- primary={
101
- <Typography variant="caption">I'm a primary text</Typography>
102
- }
103
- secondary={
104
- <Typography variant="body1">I'm a secondary text</Typography>
105
- }
106
- />
107
- </ListItem>
108
- </List>
109
-
110
- <List
111
- dense={variant.dense}
112
- subheader={<ListSubheader style={{ textIndent: '1rem' }}>Mobile alignment even on desktop</ListSubheader>}
113
- >
114
- <ListItem style={{ paddingLeft: '1rem' }} button>
115
- <ListItemIcon>
116
- <Icon icon={FileTypeFolderIcon} size={32} />
117
- </ListItemIcon>
118
- <ListItemText primary="I'm a primary text"/>
119
- </ListItem>
120
-
121
- <Divider component="li" variant="inset" />
122
-
123
- <ListItem style={{ paddingLeft: '1rem' }} button>
124
- <ListItemIcon>
125
- <Icon icon={FileTypeFolderIcon} size={32} />
126
- </ListItemIcon>
127
- <ListItemText primary="I'm a primary text"/>
128
- </ListItem>
129
- </List>
130
-
131
- <List dense={variant.dense} subheader={<ListSubheader>Section 2</ListSubheader>}>
132
- <ListItem button>
133
- <ListItemIcon>
134
- <Icon icon={CommentIcon} />
135
- </ListItemIcon>
136
- <ListItemText primary="Support" />
137
- <ListItemSecondaryAction>
138
- <IconButton ref={anchorRef} onClick={toggleMenu}>
139
- <Icon icon={DotsIcon} />
140
- </IconButton>
141
- </ListItemSecondaryAction>
142
- </ListItem>
143
- {state.showMenu && (
144
- <ActionMenu
145
- anchorElRef={anchorRef}
146
- autoclose
147
- onClose={hideMenu}
148
- >
149
- <ActionMenuItem left={<Icon icon={FileIcon} />}>
150
- <Typography variant="body1" gutterBottom>
151
- Item 1
152
- </Typography>
153
- <Typography variant="caption" color="textSecondary">
154
- Descriptive text to elaborate on what item 3 does.
155
- </Typography>
156
- </ActionMenuItem>
157
- <ActionMenuItem left={<Icon icon={FileIcon} />}>
158
- <Typography variant="body1" gutterBottom>
159
- Item 2
160
- </Typography>
161
- </ActionMenuItem>
162
- </ActionMenu>
163
- )}
164
- <Divider component="li" variant="inset" />
165
-
166
- <ListItem button>
167
- <ListItemIcon>
168
- <Icon icon={MagicTrickIcon} />
169
- </ListItemIcon>
170
- <ListItemText primary="Double actions" />
171
- <ListItemSecondaryAction>
172
- <IconButton>
75
+ {variant => {
76
+ const gutters = variant.disabledGutters ? 'disabled' : variant.doubleGutters ? 'double' : 'default'
77
+ const size = variant.small ? 'small' : variant.large ? 'large' : 'medium'
78
+
79
+ const listItemProps = { gutters, size }
80
+
81
+ return (
82
+ <>
83
+ <List dense={variant.dense} subheader={<ListSubheader>Section 1</ListSubheader>}>
84
+ <ListItem {...listItemProps} button divider={variant.divider}>
85
+ <ListItemIcon>
86
+ <Icon icon={FileTypeFolderIcon} size={32} />
87
+ </ListItemIcon>
88
+ <ListItemText primary="I'm a primary text"/>
89
+ <ListItemText secondary="Metadata"/>
90
+ <ListItemText secondary="Metadata"/>
91
+ </ListItem>
92
+
93
+ <Divider component="li" variant="inset" />
94
+
95
+ <ListItem {...listItemProps} button>
96
+ <ListItemIcon>
97
+ <Icon icon={FiletypeTextIcon} size={32} />
98
+ </ListItemIcon>
99
+ <ListItemText primary="I'm a primary text" secondary="I'm a secondary text"/>
100
+ </ListItem>
101
+
102
+ <Divider component="li" variant="inset" />
103
+
104
+ <ListItem {...listItemProps} button>
105
+ <ListItemIcon>
106
+ <Icon icon={FiletypeTextIcon} size={32} />
107
+ </ListItemIcon>
108
+ <ListItemText
109
+ primary="I'm a primary text"
110
+ secondary="I'm a secondary text"
111
+ primaryTypographyProps={{ variant: 'caption' }}
112
+ secondaryTypographyProps={{ color: 'initial', variant: variant.dense ? 'body2' : 'body1' }}
113
+ />
114
+ </ListItem>
115
+ </List>
116
+
117
+ <List dense={variant.dense} subheader={<ListSubheader>Section 2</ListSubheader>}>
118
+ <ListItem {...listItemProps} button>
119
+ <ListItemIcon>
120
+ <Icon icon={CommentIcon} />
121
+ </ListItemIcon>
122
+ <ListItemText primary="Support" />
123
+ <ListItemSecondaryAction>
124
+ <IconButton ref={anchorRef} onClick={toggleMenu}>
125
+ <Icon icon={DotsIcon} />
126
+ </IconButton>
127
+ </ListItemSecondaryAction>
128
+ </ListItem>
129
+ {state.showMenu && (
130
+ <ActionMenu
131
+ anchorElRef={anchorRef}
132
+ autoclose
133
+ onClose={hideMenu}
134
+ >
135
+ <ActionMenuItem left={<Icon icon={FileIcon} />}>
136
+ <Typography variant="body1" gutterBottom>
137
+ Item 1
138
+ </Typography>
139
+ <Typography variant="caption" color="textSecondary">
140
+ Descriptive text to elaborate on what item 3 does.
141
+ </Typography>
142
+ </ActionMenuItem>
143
+ <ActionMenuItem left={<Icon icon={FileIcon} />}>
144
+ <Typography variant="body1" gutterBottom>
145
+ Item 2
146
+ </Typography>
147
+ </ActionMenuItem>
148
+ </ActionMenu>
149
+ )}
150
+ <Divider component="li" variant="inset" />
151
+
152
+ <ListItem {...listItemProps} button>
153
+ <ListItemIcon>
154
+ <Icon icon={MagicTrickIcon} />
155
+ </ListItemIcon>
156
+ <ListItemText primary="Double actions" />
157
+ <ListItemSecondaryAction>
158
+ <IconButton>
159
+ <Icon icon={RightIcon} />
160
+ </IconButton>
161
+ <IconButton>
162
+ <Icon icon={DotsIcon} />
163
+ </IconButton>
164
+ </ListItemSecondaryAction>
165
+ </ListItem>
166
+ </List>
167
+
168
+ <Divider />
169
+
170
+ <List dense={variant.dense}>
171
+ <ListItem {...listItemProps} button>
172
+ <ListItemIcon>
173
+ <Icon icon={PeopleIcon} />
174
+ </ListItemIcon>
175
+ <ListItemText primary="Profil" />
176
+ <ListItemIcon>
173
177
  <Icon icon={RightIcon} />
174
- </IconButton>
175
- <IconButton>
176
- <Icon icon={DotsIcon} />
177
- </IconButton>
178
- </ListItemSecondaryAction>
179
- </ListItem>
180
- </List>
181
-
182
- <Divider />
183
-
184
- <List dense={variant.dense}>
185
- <ListItem button>
186
- <ListItemIcon>
187
- <Icon icon={PeopleIcon} />
188
- </ListItemIcon>
189
- <ListItemText primary="Profil" />
190
- <Icon icon={RightIcon} />
191
- </ListItem>
192
-
193
- <Divider component="li" variant="inset" />
194
-
195
- <ListItem button>
196
- <ListItemIcon>
197
- <Icon icon={PeopleIcon} />
198
- </ListItemIcon>
199
- <ListItemText primary={content.ada.short} secondary={content.ada.short} />
200
- <Radio edge="end" />
201
- </ListItem>
202
-
203
- <Divider component="li" variant="inset" />
204
-
205
- <ListItem button>
206
- <ListItemIcon>
207
- <Icon icon={HelpIcon} />
208
- </ListItemIcon>
209
- <ListItemText primary="Help" />
210
- <Icon icon={LinkOutIcon} />
211
- </ListItem>
212
-
213
- <Divider component="li" variant="inset" />
214
-
215
- <ListItem button>
216
- <ListItemIcon>
217
- <Icon icon={PieChartIcon} />
218
- </ListItemIcon>
219
- <ListItemText primary="Storage" />
220
- <Typography
221
- style={{ color: "var(--secondaryTextColor)" }}
222
- className="u-mr-half"
223
- variant="body2"
224
- >
225
- 82% used
226
- </Typography>
227
- <Icon icon={RightIcon} />
228
- </ListItem>
229
- </List>
230
- </>
231
- )}
178
+ </ListItemIcon>
179
+ </ListItem>
180
+
181
+ <Divider component="li" variant="inset" />
182
+
183
+ <ListItem {...listItemProps} button>
184
+ <ListItemIcon>
185
+ <Icon icon={PeopleIcon} />
186
+ </ListItemIcon>
187
+ <ListItemText primary={content.ada.short} secondary={content.ada.short} />
188
+ <ListItemIcon>
189
+ <Radio />
190
+ </ListItemIcon>
191
+ </ListItem>
192
+
193
+ <Divider component="li" variant="inset" />
194
+
195
+ <ListItem {...listItemProps} button>
196
+ <ListItemIcon>
197
+ <Icon icon={HelpIcon} />
198
+ </ListItemIcon>
199
+ <ListItemText primary="Help" />
200
+ <ListItemIcon>
201
+ <Icon icon={LinkOutIcon} />
202
+ </ListItemIcon>
203
+ </ListItem>
204
+
205
+ <Divider component="li" variant="inset" />
206
+
207
+ <ListItem {...listItemProps} button>
208
+ <ListItemIcon>
209
+ <Icon icon={PieChartIcon} />
210
+ </ListItemIcon>
211
+ <ListItemText primary="Storage" />
212
+ <Typography
213
+ style={{ color: "var(--secondaryTextColor)" }}
214
+ className="u-mr-half"
215
+ variant="body2"
216
+ >
217
+ 82% used
218
+ </Typography>
219
+ <ListItemIcon>
220
+ <Icon icon={RightIcon} />
221
+ </ListItemIcon>
222
+ </ListItem>
223
+ </List>
224
+ </>
225
+ )
226
+ }}
232
227
  </Variants>
233
228
  </BreakpointsProvider>
234
229
  ```
@@ -0,0 +1,99 @@
1
+
2
+
3
+ ```jsx
4
+ import Variants from 'cozy-ui/docs/components/Variants'
5
+ import List from 'cozy-ui/transpiled/react/MuiCozyTheme/List'
6
+ import ListSubheader from 'cozy-ui/transpiled/react/MuiCozyTheme/ListSubheader'
7
+ import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem'
8
+ import ListItemIcon from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemIcon'
9
+ import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
10
+ import ListItemSecondaryAction from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemSecondaryAction'
11
+ import Icon from 'cozy-ui/transpiled/react/Icon'
12
+ import IconButton from 'cozy-ui/transpiled/react/IconButton'
13
+ import CommentIcon from 'cozy-ui/transpiled/react/Icons/Comment'
14
+ import PeopleIcon from 'cozy-ui/transpiled/react/Icons/People'
15
+ import RightIcon from 'cozy-ui/transpiled/react/Icons/Right'
16
+ import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots"
17
+ import PenIcon from "cozy-ui/transpiled/react/Icons/Pen"
18
+ import TrashIcon from "cozy-ui/transpiled/react/Icons/Trash"
19
+ import Radio from 'cozy-ui/transpiled/react/Radios'
20
+ import Checkbox from 'cozy-ui/transpiled/react/Checkbox'
21
+
22
+ const initialVariants = [{
23
+ dense: false,
24
+ longText: false,
25
+ disabledGutters: false,
26
+ doubleGutters: false,
27
+ small: false,
28
+ large: false,
29
+ bigIcons: false,
30
+ smallIcons: false,
31
+ multipleLeftIcons: false,
32
+ multipleRightIcons: false,
33
+ withActions: false
34
+ }]
35
+
36
+ ;
37
+
38
+ <Variants initialVariants={initialVariants} screenshotAllVariants>
39
+ {variant => {
40
+ const gutters = variant.disabledGutters ? 'disabled' : variant.doubleGutters ? 'double' : 'default'
41
+ const size = variant.small ? 'small' : variant.large ? 'large' : 'medium'
42
+ const props = { gutters, size }
43
+ const iconSize = variant.smallIcons ? 8 : variant.bigIcons ? 32 : 16
44
+ const text = variant.longText ? content.ada.short : "I'm a primary text"
45
+
46
+ return (
47
+ <>
48
+ <List dense={variant.dense} subheader={<ListSubheader>Section 1</ListSubheader>}>
49
+ <ListItem {...props} button>
50
+ <ListItemIcon>
51
+ <Icon icon={CommentIcon} size={iconSize} />
52
+ </ListItemIcon>
53
+ {variant.multipleLeftIcons && (
54
+ <>
55
+ <ListItemIcon>
56
+ <Icon icon={PeopleIcon} size={iconSize} />
57
+ </ListItemIcon>
58
+ <ListItemIcon>
59
+ <Radio />
60
+ </ListItemIcon>
61
+ <ListItemIcon>
62
+ <Checkbox />
63
+ </ListItemIcon>
64
+ </>
65
+ )}
66
+ <ListItemText primary={text} />
67
+ {variant.multipleRightIcons && (
68
+ <>
69
+ <ListItemIcon>
70
+ <Icon icon={RightIcon} size={iconSize} />
71
+ </ListItemIcon>
72
+ <ListItemIcon>
73
+ <Radio />
74
+ </ListItemIcon>
75
+ <ListItemIcon>
76
+ <Checkbox />
77
+ </ListItemIcon>
78
+ </>
79
+ )}
80
+ {variant.withActions && (
81
+ <ListItemSecondaryAction>
82
+ <IconButton>
83
+ <Icon icon={PenIcon} />
84
+ </IconButton>
85
+ <IconButton>
86
+ <Icon icon={TrashIcon} />
87
+ </IconButton>
88
+ <IconButton>
89
+ <Icon icon={DotsIcon} />
90
+ </IconButton>
91
+ </ListItemSecondaryAction>
92
+ )}
93
+ </ListItem>
94
+ </List>
95
+ </>
96
+ )
97
+ }}
98
+ </Variants>
99
+ ```