cozy-ui-plus 5.3.0 → 6.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.
@@ -4,7 +4,7 @@ import React, { useRef } from 'react'
4
4
  import Icon from 'cozy-ui/transpiled/react/Icon'
5
5
  import CrossSmallIcon from 'cozy-ui/transpiled/react/Icons/CrossSmall'
6
6
  import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
7
- import Label from 'cozy-ui/transpiled/react/Label'
7
+ import InputLabel from 'cozy-ui/transpiled/react/InputLabel'
8
8
  import Stack from 'cozy-ui/transpiled/react/Stack'
9
9
  import Button from 'cozy-ui/transpiled/react/deprecated/Button'
10
10
 
@@ -70,7 +70,7 @@ const CollectionField = props => {
70
70
 
71
71
  return (
72
72
  <FieldContainer {...rest}>
73
- <Label>{label}</Label>
73
+ <InputLabel>{label}</InputLabel>
74
74
  <Stack>
75
75
  {values.length > 0 ? (
76
76
  <Stack spacing="s">
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`HasValueCondition component should not render its children if value is falsy 1`] = `
4
4
  <form
@@ -22,7 +22,6 @@ import AddContactDialog from './AddContact/AddContactDialog'
22
22
  import ContactsListContent from './ContactsListContent'
23
23
  import MobileHeader from './MobileHeader'
24
24
  import styles from './styles.styl'
25
- import CozyTheme from '../providers/CozyTheme'
26
25
 
27
26
  const ContactsListModal = ({
28
27
  onItemClick,
@@ -64,9 +63,7 @@ const ContactsListModal = ({
64
63
 
65
64
  return (
66
65
  <TopAnchoredDialog {...dialogProps}>
67
- <CozyTheme variant={isMobile ? 'inverted' : 'normal'}>
68
- <DialogCloseButton onClick={dismissAction} />
69
- </CozyTheme>
66
+ <DialogCloseButton onClick={dismissAction} />
70
67
  <DialogTitle
71
68
  {...dialogTitleProps}
72
69
  className={cx(dialogTitleProps.className, {
@@ -7,36 +7,32 @@ import PreviousIcon from 'cozy-ui/transpiled/react/Icons/Previous'
7
7
  import Input from 'cozy-ui/transpiled/react/Input'
8
8
  import Paper from 'cozy-ui/transpiled/react/Paper'
9
9
 
10
- import CozyTheme from '../providers/CozyTheme'
11
-
12
10
  const barStyle = {
13
11
  height: 48
14
12
  }
15
13
 
16
14
  const MobileHeader = ({ filter, placeholder, onChange, onDismiss }) => {
17
15
  return (
18
- <CozyTheme variant="inverted">
19
- <Paper
20
- square
21
- elevation={0}
22
- className="u-flex u-flex-items-center u-pr-3 u-pl-half"
23
- style={barStyle}
24
- >
25
- <IconButton className="u-mr-half" onClick={onDismiss} size="medium">
26
- <Icon icon={PreviousIcon} />
27
- </IconButton>
28
- <Input
29
- type="text"
30
- placeholder={placeholder}
31
- id={placeholder}
32
- value={filter}
33
- onChange={onChange}
34
- autoFocus
35
- fullWidth
36
- disableUnderline
37
- />
38
- </Paper>
39
- </CozyTheme>
16
+ <Paper
17
+ square
18
+ elevation={0}
19
+ className="u-flex u-flex-items-center u-pr-3 u-pl-half"
20
+ style={barStyle}
21
+ >
22
+ <IconButton className="u-mr-half" onClick={onDismiss} size="medium">
23
+ <Icon icon={PreviousIcon} />
24
+ </IconButton>
25
+ <Input
26
+ type="text"
27
+ placeholder={placeholder}
28
+ id={placeholder}
29
+ value={filter}
30
+ onChange={onChange}
31
+ autoFocus
32
+ fullWidth
33
+ disableUnderline
34
+ />
35
+ </Paper>
40
36
  )
41
37
  }
42
38
 
@@ -4,9 +4,9 @@ import PropTypes from 'prop-types'
4
4
  import React, { useState } from 'react'
5
5
 
6
6
  import labelStyles from 'cozy-ui/react/Label/styles.styl'
7
- import Label from 'cozy-ui/transpiled/react/Label'
7
+ import InputLabel from 'cozy-ui/transpiled/react/InputLabel'
8
8
  import SelectBox from 'cozy-ui/transpiled/react/SelectBox'
9
- import Textarea from 'cozy-ui/transpiled/react/Textarea'
9
+ import TextField from 'cozy-ui/transpiled/react/TextField'
10
10
  import Input from 'cozy-ui/transpiled/react/legacy/Input'
11
11
 
12
12
  import styles from './styles.styl'
@@ -141,7 +141,8 @@ const Field = props => {
141
141
  )
142
142
  case 'textarea':
143
143
  return (
144
- <Textarea
144
+ <TextField
145
+ multiline
145
146
  autoCapitalize={autoCapitalize}
146
147
  disabled={disabled}
147
148
  id={id}
@@ -151,7 +152,7 @@ const Field = props => {
151
152
  onKeyUp={onKeyUp}
152
153
  onFocus={onFocus}
153
154
  onBlur={onBlur}
154
- readOnly={readOnly}
155
+ inputProps={{ readOnly }}
155
156
  {...controlledProps}
156
157
  />
157
158
  )
@@ -224,9 +225,9 @@ const Field = props => {
224
225
 
225
226
  return (
226
227
  <FieldContainer className={className} variant={variant}>
227
- <Label htmlFor={id} {...labelProps}>
228
+ <InputLabel htmlFor={id} {...labelProps}>
228
229
  {label}
229
- </Label>
230
+ </InputLabel>
230
231
  {side && (
231
232
  <div
232
233
  className={cx(styles['o-side'], labelStyles['c-label'], {
@@ -26,7 +26,7 @@ describe('Field component', () => {
26
26
  onChange={() => {}}
27
27
  />
28
28
  )
29
- ).not.toThrowError()
29
+ ).not.toThrow()
30
30
  expect(() =>
31
31
  render(
32
32
  <Field
@@ -36,7 +36,7 @@ describe('Field component', () => {
36
36
  onChange={() => {}}
37
37
  />
38
38
  )
39
- ).toThrowError()
39
+ ).toThrow()
40
40
  })
41
41
 
42
42
  it('should expect string type value for all types but select', () => {
@@ -49,11 +49,11 @@ describe('Field component', () => {
49
49
  onChange={() => {}}
50
50
  />
51
51
  )
52
- ).not.toThrowError()
52
+ ).not.toThrow()
53
53
  expect(() =>
54
54
  render(
55
55
  <Field label="mock field" type="text" value={{}} onChange={() => {}} />
56
56
  )
57
- ).toThrowError()
57
+ ).toThrow()
58
58
  })
59
59
  })
@@ -7,7 +7,6 @@ import Icon from 'cozy-ui/transpiled/react/Icon'
7
7
  import FiletypeNoteIcon from 'cozy-ui/transpiled/react/Icons/FileTypeNote'
8
8
  import FiletypeTextIcon from 'cozy-ui/transpiled/react/Icons/FileTypeText'
9
9
  import Skeleton from 'cozy-ui/transpiled/react/Skeleton'
10
- import Thumbnail from 'cozy-ui/transpiled/react/Thumbnail'
11
10
 
12
11
  import FileImageLoader from '../../FileImageLoader'
13
12
 
@@ -23,19 +22,28 @@ const ItemIcon = ({ icon, file }) => {
23
22
  linkType="tiny"
24
23
  render={src => {
25
24
  return (
26
- <Thumbnail>
25
+ <div className="u-flex u-w-2 u-h-2 u-flex-items-center u-flex-justify-center">
27
26
  {src ? (
28
- <img src={src} alt="" />
27
+ <img
28
+ className="u-w-2 u-h-2"
29
+ style={{ objectFit: 'contain' }}
30
+ src={src}
31
+ alt=""
32
+ />
29
33
  ) : (
30
- <Skeleton variant="rect" animation="wave" />
34
+ <Skeleton
35
+ className="u-w-100 u-h-100"
36
+ variant="rect"
37
+ animation="wave"
38
+ />
31
39
  )}
32
- </Thumbnail>
40
+ </div>
33
41
  )
34
42
  }}
35
43
  renderFallback={() => (
36
- <Thumbnail>
44
+ <div className="u-flex u-w-2 u-h-2 u-flex-items-center u-flex-justify-center">
37
45
  <Icon icon={isNote(file) ? FiletypeNoteIcon : FiletypeTextIcon} />
38
- </Thumbnail>
46
+ </div>
39
47
  )}
40
48
  />
41
49
  )
@@ -80,7 +80,7 @@ describe('Paywall', () => {
80
80
  name: 'I understand'
81
81
  })
82
82
  fireEvent.click(actionButton)
83
- expect(onCloseSpy).toBeCalledTimes(1)
83
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
84
84
  })
85
85
 
86
86
  it('should display the default case when there is a premium link but it is not enabled', async () => {
@@ -94,7 +94,7 @@ describe('Paywall', () => {
94
94
  name: 'I understand'
95
95
  })
96
96
  fireEvent.click(actionButton)
97
- expect(onCloseSpy).toBeCalledTimes(1)
97
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
98
98
  })
99
99
 
100
100
  it('should display the premium case when the premium link is enabled and available', async () => {
@@ -109,7 +109,7 @@ describe('Paywall', () => {
109
109
  name: 'Check our plans'
110
110
  })
111
111
  fireEvent.click(actionButton)
112
- expect(openSpy).toBeCalledWith(
112
+ expect(openSpy).toHaveBeenCalledWith(
113
113
  'http://mycozy.cloud/cozy/instances/123/premium?lang=en',
114
114
  '_self'
115
115
  )
@@ -132,7 +132,7 @@ describe('Paywall', () => {
132
132
  name: 'I understand'
133
133
  })
134
134
  fireEvent.click(actionButton)
135
- expect(onCloseSpy).toBeCalledTimes(1)
135
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
136
136
  })
137
137
 
138
138
  it('should display the default case when the premium link is not available in public context', async () => {
@@ -148,7 +148,7 @@ describe('Paywall', () => {
148
148
  name: 'I understand'
149
149
  })
150
150
  fireEvent.click(actionButton)
151
- expect(onCloseSpy).toBeCalledTimes(1)
151
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
152
152
  })
153
153
 
154
154
  describe('on flagship', () => {
@@ -165,7 +165,7 @@ describe('Paywall', () => {
165
165
  name: 'I understand'
166
166
  })
167
167
  fireEvent.click(actionButton)
168
- expect(onCloseSpy).toBeCalledTimes(1)
168
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
169
169
  })
170
170
 
171
171
  it('should display the premium case without an action button to access the premium link when flag flagship.iap.enabled is false', async () => {
@@ -182,7 +182,7 @@ describe('Paywall', () => {
182
182
  name: 'I understand'
183
183
  })
184
184
  fireEvent.click(actionButton)
185
- expect(onCloseSpy).toBeCalledTimes(1)
185
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
186
186
  })
187
187
 
188
188
  it('should display the premium case without an action button to access the premium link when flag flagship.iap.enabled is false and iap is unavailable', async () => {
@@ -201,7 +201,7 @@ describe('Paywall', () => {
201
201
  })
202
202
 
203
203
  fireEvent.click(actionButton)
204
- expect(onCloseSpy).toBeCalledTimes(1)
204
+ expect(onCloseSpy).toHaveBeenCalledTimes(1)
205
205
  })
206
206
 
207
207
  it('should display the premium case with an action button to access the premium link when flag flagship.iap.enabled is true and iap is available', async () => {
@@ -219,7 +219,7 @@ describe('Paywall', () => {
219
219
  name: 'Check our plans'
220
220
  })
221
221
  fireEvent.click(actionButton)
222
- expect(openSpy).toBeCalledWith(
222
+ expect(openSpy).toHaveBeenCalledWith(
223
223
  'http://mycozy.cloud/cozy/instances/123/premium?lang=en',
224
224
  '_self'
225
225
  )
@@ -3,7 +3,6 @@ import React from 'react'
3
3
 
4
4
  import ButtonBase from 'cozy-ui/transpiled/react/ButtonBase'
5
5
  import Icon, { iconPropType } from 'cozy-ui/transpiled/react/Icon'
6
- import IconStack from 'cozy-ui/transpiled/react/IconStack'
7
6
  import FileDuotoneIcon from 'cozy-ui/transpiled/react/Icons/FileDuotone'
8
7
  import Typography from 'cozy-ui/transpiled/react/Typography'
9
8
  import { makeStyles } from 'cozy-ui/transpiled/react/styles'
@@ -27,19 +26,15 @@ const QualificationItem = ({ icon, label, isSelected, onClick, ...props }) => {
27
26
 
28
27
  return (
29
28
  <ButtonBase {...props} className={styles.item} onClick={onClick}>
30
- <IconStack
31
- className="u-mb-half"
32
- foreground={
33
- icon && (
34
- <Icon
35
- icon={icon}
36
- color={
37
- isSelected ? 'var(--primaryColor)' : 'var(--secondaryTextColor)'
38
- }
39
- />
40
- )
41
- }
42
- background={
29
+ <div className="u-mb-half">
30
+ {icon ? (
31
+ <Icon
32
+ icon={icon}
33
+ color={
34
+ isSelected ? 'var(--primaryColor)' : 'var(--secondaryTextColor)'
35
+ }
36
+ />
37
+ ) : (
43
38
  <Icon
44
39
  icon={FileDuotoneIcon}
45
40
  size="32"
@@ -47,8 +42,8 @@ const QualificationItem = ({ icon, label, isSelected, onClick, ...props }) => {
47
42
  isSelected ? 'var(--primaryColor)' : 'var(--secondaryTextColor)'
48
43
  }
49
44
  />
50
- }
51
- />
45
+ )}
46
+ </div>
52
47
  <Typography variant="caption">{label}</Typography>
53
48
  </ButtonBase>
54
49
  )
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
 
3
+ import { nameToColor } from 'cozy-ui/transpiled/react/Avatar/helpers'
3
4
  import { TileIcon } from 'cozy-ui/transpiled/react/Tile'
4
5
  import Typography from 'cozy-ui/transpiled/react/Typography'
5
- import { nameToColor } from 'cozy-ui/transpiled/react/legacy/Avatar/helpers'
6
6
  import { makeStyles } from 'cozy-ui/transpiled/react/styles'
7
7
 
8
8
  import styles from '../AppTile/styles.styl'