cozy-ui 57.5.3 → 57.7.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 CHANGED
@@ -1,3 +1,39 @@
1
+ # [57.7.0](https://github.com/cozy/cozy-ui/compare/v57.6.0...v57.7.0) (2021-11-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add viewBox to LogoutLarge icon ([6196caa](https://github.com/cozy/cozy-ui/commit/6196caa))
7
+
8
+
9
+ ### Features
10
+
11
+ * Add IconComponent prop to SquareAppIcon ([22591ff](https://github.com/cozy/cozy-ui/commit/22591ff))
12
+ * Add type prop to SquareAppIcon ([d9799c7](https://github.com/cozy/cozy-ui/commit/d9799c7))
13
+ * Do not use backdrop-filter on SquareAppIcon anymore ([451d54f](https://github.com/cozy/cozy-ui/commit/451d54f))
14
+
15
+ # [57.6.0](https://github.com/cozy/cozy-ui/compare/v57.5.5...v57.6.0) (2021-11-08)
16
+
17
+
18
+ ### Features
19
+
20
+ * Add `autoCapitalize` prop in Fields ([54efb34](https://github.com/cozy/cozy-ui/commit/54efb34))
21
+
22
+ ## [57.5.5](https://github.com/cozy/cozy-ui/compare/v57.5.4...v57.5.5) (2021-11-08)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * Do not stretch small screenshots ([4c7f48f](https://github.com/cozy/cozy-ui/commit/4c7f48f))
28
+ * Revert "Merge pull request [#1956](https://github.com/cozy/cozy-ui/issues/1956) from cozy/test/waitFor" ([#1962](https://github.com/cozy/cozy-ui/issues/1962)) ([374bda4](https://github.com/cozy/cozy-ui/commit/374bda4))
29
+
30
+ ## [57.5.4](https://github.com/cozy/cozy-ui/compare/v57.5.3...v57.5.4) (2021-11-04)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * AppTile doesn't require name prop ([3a74932](https://github.com/cozy/cozy-ui/commit/3a74932))
36
+
1
37
  ## [57.5.3](https://github.com/cozy/cozy-ui/compare/v57.5.2...v57.5.3) (2021-11-04)
2
38
 
3
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "57.5.3",
3
+ "version": "57.7.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -94,7 +94,7 @@
94
94
  "cozy-sharing": "^3.10.0",
95
95
  "css-loader": "0.28.11",
96
96
  "cssnano": "4.1.11",
97
- "cssnano-preset-advanced": "4.0.7",
97
+ "cssnano-preset-advanced": "4.0.8",
98
98
  "enzyme": "3.11.0",
99
99
  "enzyme-adapter-react-16": "1.15.6",
100
100
  "enzyme-to-json": "3.6.2",
@@ -1,21 +1,24 @@
1
1
  Component used to show an app status, can be used in
2
2
  a list of apps for example in the Store.
3
3
 
4
- ```
4
+ ```jsx
5
5
  import AppTile from '.'
6
6
  import mockApps from '../AppSections/_mockApps'
7
7
  import { I18n } from '../I18n'
8
+ import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
8
9
 
9
10
  const locale = {}
11
+ const app = mockApps[0]
10
12
 
11
- const app = mockApps[0];
13
+ ;
12
14
 
13
15
  <I18n dictRequire={lang => locale} lang="en">
14
- <div className='u-flex'>
16
+ <Grid container>
15
17
  <AppTile app={app} />
16
18
  <AppTile app={{...app, maintenance: true}} />
19
+ <AppTile app={{...app, maintenance: true}} displaySpecificMaintenanceStyle={true} />
17
20
  <AppTile app={{...app, availableVersion: true}} />
18
21
  <AppTile app={{...app, availableVersion: true}} showStatus={['maintenance']} />
19
- </div>
22
+ </Grid>
20
23
  </I18n>
21
24
  ```
@@ -106,7 +106,7 @@ export const AppTile = ({
106
106
 
107
107
  AppTile.propTypes = {
108
108
  app: AppDoctype,
109
- name: PropTypes.string.isRequired,
109
+ name: PropTypes.string,
110
110
  namePrefix: PropTypes.string,
111
111
  onClick: PropTypes.func,
112
112
  IconComponent: PropTypes.element,
@@ -6,7 +6,7 @@ Like `Input` component, it can have the following properties:
6
6
 
7
7
  ##### Example
8
8
 
9
- ```
9
+ ```jsx
10
10
  import Field from 'cozy-ui/transpiled/react/Field';
11
11
  <form>
12
12
  <Field
@@ -21,7 +21,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
21
21
 
22
22
  ##### Inline variant
23
23
 
24
- ```
24
+ ```jsx
25
25
  import Field from 'cozy-ui/transpiled/react/Field';
26
26
  <form>
27
27
  <Field
@@ -39,7 +39,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
39
39
 
40
40
  An input is controlled if `props.value` is passed, even if it is empty.
41
41
 
42
- ```
42
+ ```jsx
43
43
  import Field from 'cozy-ui/transpiled/react/Field';
44
44
 
45
45
  initialState = { value: '' }
@@ -58,7 +58,7 @@ It gives access to the underlying `<input />` element, for example to give focus
58
58
 
59
59
  ##### Example
60
60
 
61
- ```
61
+ ```jsx
62
62
  import Field from 'cozy-ui/transpiled/react/Field';
63
63
  import Button from 'cozy-ui/transpiled/react/Button';
64
64
  class FieldWithFocus extends React.Component {
@@ -91,7 +91,7 @@ Name of the form field, injected into `Input`, `TextArea` or `SelectBox` compone
91
91
 
92
92
  ##### Exemple
93
93
 
94
- ```
94
+ ```jsx
95
95
  import Field from 'cozy-ui/transpiled/react/Field';
96
96
  <form>
97
97
  <Field
@@ -103,7 +103,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
103
103
 
104
104
  #### Field when there's an error
105
105
 
106
- ```
106
+ ```jsx
107
107
  import Field from 'cozy-ui/transpiled/react/Field';
108
108
  <form>
109
109
  <Field
@@ -118,7 +118,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
118
118
 
119
119
  #### Field with SelectBox
120
120
 
121
- ```
121
+ ```jsx
122
122
  import Field from 'cozy-ui/transpiled/react/Field';
123
123
  const options = [
124
124
  {
@@ -168,7 +168,7 @@ initialState = { selectedContact: null };
168
168
 
169
169
  #### Password field with show/hide button
170
170
 
171
- ```
171
+ ```jsx
172
172
  import Field from 'cozy-ui/transpiled/react/Field';
173
173
  <form>
174
174
  <Field
@@ -185,7 +185,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
185
185
 
186
186
  #### Password field without show/hide button
187
187
 
188
- ```
188
+ ```jsx
189
189
  import Field from 'cozy-ui/transpiled/react/Field';
190
190
  <form>
191
191
  <Field
@@ -198,7 +198,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
198
198
 
199
199
  #### Side element
200
200
 
201
- ```
201
+ ```jsx
202
202
  import Field from 'cozy-ui/transpiled/react/Field';
203
203
  <form>
204
204
  <Field
@@ -210,7 +210,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
210
210
 
211
211
  #### Side element with fullwidth element
212
212
 
213
- ```
213
+ ```jsx
214
214
  import Field from 'cozy-ui/transpiled/react/Field';
215
215
  <form>
216
216
  <Field
@@ -223,7 +223,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
223
223
 
224
224
  #### Customized label and input
225
225
 
226
- ```
226
+ ```jsx
227
227
  import Field from 'cozy-ui/transpiled/react/Field';
228
228
  <form>
229
229
  <Field
@@ -240,7 +240,7 @@ import Field from 'cozy-ui/transpiled/react/Field';
240
240
 
241
241
  #### Password with custom secondaryComponent
242
242
 
243
- ```
243
+ ```jsx
244
244
  import Field from 'cozy-ui/transpiled/react/Field';
245
245
  import MuiButton from 'cozy-ui/transpiled/react/MuiCozyTheme/Buttons';
246
246
 
@@ -271,7 +271,7 @@ import MuiButton from 'cozy-ui/transpiled/react/MuiCozyTheme/Buttons';
271
271
 
272
272
  #### Controlled Field
273
273
 
274
- ```
274
+ ```jsx
275
275
  import Field from 'cozy-ui/transpiled/react/Field';
276
276
  <form>
277
277
  <Field
@@ -282,3 +282,29 @@ import Field from 'cozy-ui/transpiled/react/Field';
282
282
  Value: { state.value }
283
283
  </form>
284
284
  ```
285
+
286
+ #### Mobile specific props
287
+
288
+ On mobile devices, following props may be useful to control on-screen keyboard's behavior
289
+
290
+ Note that `autoCapitalize` property is not handled by all mobile browsers and it also depends on the on-screen keyboard installed by the user and its configuration (i.e. [Android SwiftKey configuration](https://support.swiftkey.com/hc/en-us/articles/201468481-How-do-I-turn-off-Auto-Capitalize-))
291
+
292
+ ```jsx
293
+ import Field from 'cozy-ui/transpiled/react/Field';
294
+ import Variants from 'cozy-ui/docs/components/Variants';
295
+
296
+ const initialVariants = [
297
+ { autoCapitalize: false, autoComplete: false }
298
+ ];
299
+
300
+ <Variants initialVariants={initialVariants}>{
301
+ variant => (
302
+ <form>
303
+ <Field
304
+ autoCapitalize={variant.autoCapitalize ? 'on' : 'none'}
305
+ autoComplete={variant.autoComplete ? 'on' : 'off'}
306
+ />
307
+ </form>
308
+ )
309
+ }</Variants>
310
+ ```
@@ -16,6 +16,7 @@ import ContactPicker from '../ContactPicker'
16
16
  * for example
17
17
  */
18
18
  const inputSpecificPropTypes = {
19
+ autoCapitalize: PropTypes.string,
19
20
  autoComplete: PropTypes.string,
20
21
  onKeyUp: PropTypes.func
21
22
  }
@@ -102,6 +103,7 @@ const FieldContainer = props => {
102
103
 
103
104
  const Field = props => {
104
105
  const {
106
+ autoCapitalize,
105
107
  autoComplete,
106
108
  className,
107
109
  disabled,
@@ -146,6 +148,7 @@ const Field = props => {
146
148
  case 'textarea':
147
149
  return (
148
150
  <Textarea
151
+ autoCapitalize={autoCapitalize}
149
152
  disabled={disabled}
150
153
  id={id}
151
154
  name={name}
@@ -161,6 +164,7 @@ const Field = props => {
161
164
  case 'password':
162
165
  return (
163
166
  <InputPassword
167
+ autoCapitalize={autoCapitalize}
164
168
  autoComplete={autoComplete}
165
169
  disabled={disabled}
166
170
  fullwidth={fullwidth}
@@ -198,6 +202,7 @@ const Field = props => {
198
202
  case 'number':
199
203
  return (
200
204
  <Input
205
+ autoCapitalize={autoCapitalize}
201
206
  autoComplete={autoComplete}
202
207
  disabled={disabled}
203
208
  fullwidth={fullwidth}
@@ -3,7 +3,7 @@ import React from 'react'
3
3
 
4
4
  function SvgLogoutLarge(props) {
5
5
  return (
6
- <svg {...props}>
6
+ <svg viewBox="0 0 44 44" {...props}>
7
7
  <g fill="none" fillRule="evenodd">
8
8
  <rect
9
9
  width={27.5}
@@ -4,6 +4,8 @@ application.
4
4
  ```jsx
5
5
  import Grid from 'cozy-ui/transpiled/react/MuiCozyTheme/Grid'
6
6
  import SquareAppIcon from 'cozy-ui/transpiled/react/SquareAppIcon'
7
+ import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
8
+ import Icon from 'cozy-ui/transpiled/react/Icon'
7
9
  import { useCozyTheme } from 'cozy-ui/transpiled/react/CozyTheme'
8
10
  import cloudWallpaper from '../../docs/cloud-wallpaper.jpg'
9
11
 
@@ -32,5 +34,26 @@ const theme = useCozyTheme()
32
34
  <Grid item>
33
35
  <SquareAppIcon name="Shortcut" variant="shortcut" />
34
36
  </Grid>
37
+ <Grid item>
38
+ <SquareAppIcon name="Custom Icon" IconContent={<Icon icon={CozyIcon} size="48" />} />
39
+ </Grid>
40
+ <Grid item>
41
+ <SquareAppIcon name="Icon Grid" IconContent={(
42
+ <Grid container spacing={0}>
43
+ <Grid item xs={6}>
44
+ <Icon icon={CozyIcon} />
45
+ </Grid>
46
+ <Grid item xs={6}>
47
+ <Icon icon={CozyIcon} />
48
+ </Grid>
49
+ <Grid item xs={6}>
50
+ <Icon icon={CozyIcon} />
51
+ </Grid>
52
+ <Grid item xs={6}>
53
+ <Icon icon={CozyIcon} />
54
+ </Grid>
55
+ </Grid>
56
+ )} />
57
+ </Grid>
35
58
  </Grid>
36
59
  ```
@@ -4,6 +4,8 @@ import React from 'react'
4
4
  import { render } from '@testing-library/react'
5
5
  import CozyClient, { CozyProvider } from 'cozy-client'
6
6
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
7
+ import Icon from 'cozy-ui/transpiled/react/Icon'
8
+ import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
7
9
 
8
10
  import SquareAppIcon from './index'
9
11
 
@@ -66,4 +68,11 @@ describe('SquareAppIcon component', () => {
66
68
  const root = render(<Wrapper variant="shortcut" name="shortcut" />)
67
69
  expect(root.getByTestId('square-app-icon')).toMatchSnapshot()
68
70
  })
71
+
72
+ it('should render correctly an app with custom content', () => {
73
+ const root = render(
74
+ <Wrapper name="custom icon" IconContent={<Icon icon={CozyIcon} />} />
75
+ )
76
+ expect(root.getByTestId('square-app-icon')).toMatchSnapshot()
77
+ })
69
78
  })
@@ -355,3 +355,46 @@ exports[`SquareAppIcon component should render correctly an app in shortcut stat
355
355
  </h6>
356
356
  </div>
357
357
  `;
358
+
359
+ exports[`SquareAppIcon component should render correctly an app with custom content 1`] = `
360
+ <div
361
+ class="makeStyles-tileWrapper-53"
362
+ data-testid="square-app-icon"
363
+ >
364
+ <span
365
+ class="MuiBadge-root"
366
+ >
367
+ <span
368
+ class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-51"
369
+ >
370
+ <div
371
+ class="styles__SquareAppIcon-icon-container___39MRl"
372
+ >
373
+ <svg
374
+ class="styles__icon___23x3R"
375
+ height="16"
376
+ viewBox="0 0 52 52"
377
+ width="16"
378
+ >
379
+ <path
380
+ d="M38.231 44H13.769C6.175 44 0 37.756 0 30.08c0-3.66 1.394-7.117 3.927-9.733 2.219-2.29 5.093-3.715 8.203-4.086a13.887 13.887 0 014.042-8.292A13.608 13.608 0 0125.801 4c3.62 0 7.04 1.407 9.629 3.968a13.897 13.897 0 014.038 8.25C46.482 16.853 52 22.828 52 30.082 52 37.756 45.82 44 38.23 44h.001zm-.163-3.001h.104c5.97 0 10.828-4.91 10.828-10.947 0-6.035-4.857-10.946-10.828-10.946h-.11c-.779 0-1.417-.627-1.435-1.417C36.492 11.794 31.637 7 25.803 7c-5.835 0-10.692 4.796-10.826 10.69a1.445 1.445 0 01-1.403 1.42C7.744 19.244 3 24.153 3 30.052 3 36.09 7.857 41 13.828 41h.088l.035-.002c.03 0 .062 0 .093.002h24.021l.003-.001zm-4.302-11.776c-.875-.585-.918-1.659-.92-1.706A.52.52 0 0032.32 27a.523.523 0 00-.506.536c.002.039.016.543.251 1.137a7.99 7.99 0 01-11.138.019 3.554 3.554 0 00.257-1.155.523.523 0 00-.503-.536.526.526 0 00-.528.515c0 .043-.042 1.121-.92 1.706a.536.536 0 00-.15.731.51.51 0 00.714.154c.225-.15.414-.322.572-.505a9.006 9.006 0 0012.251-.01c.16.184.35.36.582.515a.503.503 0 00.281.085.516.516 0 00.432-.24.537.537 0 00-.15-.731v.002z"
381
+ fill="#297EF2"
382
+ fill-rule="evenodd"
383
+ />
384
+ </svg>
385
+ </div>
386
+ <span
387
+ class="MuiBadge-badge badgeSizeLarge MuiBadge-anchorOriginTopRightRectangle"
388
+ />
389
+ </span>
390
+ <span
391
+ class="MuiBadge-badge Component-qualifier-54 MuiBadge-anchorOriginBottomRightRectangle MuiBadge-invisible"
392
+ />
393
+ </span>
394
+ <h6
395
+ class="MuiTypography-root makeStyles-name-49 u-spacellipsis MuiTypography-h6 MuiTypography-alignCenter"
396
+ >
397
+ custom icon
398
+ </h6>
399
+ </div>
400
+ `;
@@ -61,7 +61,7 @@ const useStyles = makeStyles(theme => ({
61
61
  }
62
62
  }))
63
63
 
64
- export const SquareAppIcon = ({ app, name, variant }) => {
64
+ export const SquareAppIcon = ({ app, type, name, variant, IconContent }) => {
65
65
  const classes = useStyles()
66
66
  const appName = name || (app && app.name) || app || ''
67
67
  const letter = appName[0] || ''
@@ -116,8 +116,10 @@ export const SquareAppIcon = ({ app, name, variant }) => {
116
116
  <div className={styles['SquareAppIcon-icon-container']}>
117
117
  {variant === 'add' ? (
118
118
  <Icon icon={iconPlus} color={color} />
119
+ ) : IconContent ? (
120
+ IconContent
119
121
  ) : (
120
- <AppIcon app={app} />
122
+ <AppIcon app={app} type={type} />
121
123
  )}
122
124
  </div>
123
125
  )}
@@ -137,7 +139,15 @@ export const SquareAppIcon = ({ app, name, variant }) => {
137
139
  SquareAppIcon.propTypes = {
138
140
  app: PropTypes.oneOfType([AppDoctype, PropTypes.string]),
139
141
  name: PropTypes.string,
140
- variant: PropTypes.oneOf(['ghost', 'maintenance', 'error', 'add', 'shortcut'])
142
+ variant: PropTypes.oneOf([
143
+ 'ghost',
144
+ 'maintenance',
145
+ 'error',
146
+ 'add',
147
+ 'shortcut'
148
+ ]),
149
+ IconContent: PropTypes.node,
150
+ type: PropTypes.oneOf(['app', 'konnector'])
141
151
  }
142
152
 
143
153
  export default SquareAppIcon
@@ -32,14 +32,11 @@ $color = constants['color'] // hard-coded color, because the component is curren
32
32
  .SquareAppIcon-wrapper-fx
33
33
  background-color alpha($color, .32)
34
34
  border 1px dashed var(--white)
35
- @supports not (backdrop-filter: blur(48px))
36
- background-color alpha($color, .48)
37
- .SquareAppIcon-icon-container
38
- backdrop-filter blur(48px)
35
+ background-color alpha($color, .48)
39
36
 
40
37
  .SquareAppIcon-wrapper-ghost
41
38
  .SquareAppIcon-icon-container
42
- mix-blend-mode screen // need to apply backdrop-filter and mix blend-mode in a separated element to have the proper effect
39
+ mix-blend-mode screen
43
40
  svg, img
44
41
  filter saturate(0%)
45
42