cozy-ui 84.1.1 → 84.1.3

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,20 @@
1
+ ## [84.1.3](https://github.com/cozy/cozy-ui/compare/v84.1.2...v84.1.3) (2023-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ActionsMenu actions:** Stop spreading `t`, `f`, `lang` into child ([4fa0cc0](https://github.com/cozy/cozy-ui/commit/4fa0cc0))
7
+ * **ActionsMenuItem:** We used transpiled version of imports, and... ([233ae1f](https://github.com/cozy/cozy-ui/commit/233ae1f))
8
+ * **ListItem:** Stop spreading `gutters` and `ellipsis` to children ([0de5e66](https://github.com/cozy/cozy-ui/commit/0de5e66))
9
+ * **ListItemText:** DisplayName and forwardRef was missing ([a70322c](https://github.com/cozy/cozy-ui/commit/a70322c))
10
+
11
+ ## [84.1.2](https://github.com/cozy/cozy-ui/compare/v84.1.1...v84.1.2) (2023-04-27)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * ActionsMenu target wasn't good in global import ([cac334a](https://github.com/cozy/cozy-ui/commit/cac334a))
17
+
1
18
  ## [84.1.1](https://github.com/cozy/cozy-ui/compare/v84.1.0...v84.1.1) (2023-04-27)
2
19
 
3
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "84.1.1",
3
+ "version": "84.1.3",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -15,7 +15,8 @@ export const call = () => {
15
15
  !!phoneNumber && window.open(`tel:${phoneNumber}`, '_self')
16
16
  },
17
17
  Component: withActionsLocales(
18
- forwardRef(({ t, ...props }, ref) => {
18
+ // eslint-disable-next-line no-unused-vars
19
+ forwardRef(({ t, f, lang, ...props }, ref) => {
19
20
  return (
20
21
  <ActionsMenuItem {...props} ref={ref}>
21
22
  <ListItemIcon>
@@ -15,7 +15,8 @@ export const emailTo = () => {
15
15
  !!emailAddress && window.open(`mailto:${emailAddress}`, '_self')
16
16
  },
17
17
  Component: withActionsLocales(
18
- forwardRef(({ t, ...props }, ref) => {
18
+ // eslint-disable-next-line no-unused-vars
19
+ forwardRef(({ t, f, lang, ...props }, ref) => {
19
20
  return (
20
21
  <ActionsMenuItem {...props} ref={ref}>
21
22
  <ListItemIcon>
@@ -8,4 +8,9 @@ export const locales = {
8
8
  fr
9
9
  }
10
10
 
11
+ /**
12
+ * TODO: We should use something else than withLocales here. Because it's an HOC
13
+ * so it spreads t, f, lang into child props.
14
+ * We don't use HOC anymore, so we just want to use new I18n context with new locales
15
+ */
11
16
  export default withLocales(locales)
@@ -26,7 +26,8 @@ export const modify = () => {
26
26
  window.open(webLink, '_blank')
27
27
  },
28
28
  Component: withActionsLocales(
29
- forwardRef(({ t, ...props }, ref) => {
29
+ // eslint-disable-next-line no-unused-vars
30
+ forwardRef(({ t, f, lang, ...props }, ref) => {
30
31
  return (
31
32
  <ActionsMenuItem ref={ref} {...props}>
32
33
  <ListItemIcon>
@@ -15,7 +15,8 @@ export const smsTo = () => {
15
15
  !!phoneNumber && window.open(`sms:${phoneNumber}`, '_self')
16
16
  },
17
17
  Component: withActionsLocales(
18
- forwardRef(({ t, ...props }, ref) => {
18
+ // eslint-disable-next-line no-unused-vars
19
+ forwardRef(({ t, f, lang, ...props }, ref) => {
19
20
  return (
20
21
  <ActionsMenuItem {...props} ref={ref}>
21
22
  <ListItemIcon>
@@ -26,7 +26,8 @@ export const viewInContacts = () => {
26
26
  window.open(webLink, '_blank')
27
27
  },
28
28
  Component: withActionsLocales(
29
- forwardRef(({ t, ...props }, ref) => {
29
+ // eslint-disable-next-line no-unused-vars
30
+ forwardRef(({ t, f, lang, ...props }, ref) => {
30
31
  return (
31
32
  <ActionsMenuItem ref={ref} {...props}>
32
33
  <ListItemIcon>
@@ -1,8 +1,8 @@
1
1
  import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
- import MenuItem from 'cozy-ui/transpiled/react/MenuItem'
5
- import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem'
4
+ import MenuItem from '../MenuItem'
5
+ import ListItem from '../MuiCozyTheme/ListItem'
6
6
 
7
7
  const ActionsMenuItem = forwardRef(({ isListItem, ...props }, ref) => {
8
8
  const Component = isListItem ? ListItem : MenuItem
@@ -10,6 +10,8 @@ const ActionsMenuItem = forwardRef(({ isListItem, ...props }, ref) => {
10
10
  return <Component {...props} ref={ref} button ellipsis={false} />
11
11
  })
12
12
 
13
+ ActionsMenuItem.displayName = 'ActionsMenuItem'
14
+
13
15
  ActionsMenuItem.propTypes = {
14
16
  /** Whether the ActionsMenuItem will return a ListItem or MenuItem */
15
17
  isListItem: PropTypes.bool
@@ -75,7 +75,10 @@ const customAction = () => ({
75
75
  <ListItemIcon>
76
76
  <Icon icon={FileIcon} />
77
77
  </ListItemIcon>
78
- <ListItemText primary="This is a custom action, with a very long text to show how it is displayed" />
78
+ <ListItemText
79
+ primary="This is a custom action, with a very long text to show how it is displayed"
80
+ secondary="This is a custom action, with a very long text to show how it is displayed"
81
+ />
79
82
  </ActionsMenuItem>
80
83
  )
81
84
  })
@@ -5,7 +5,6 @@ exports[`ContactRow should match the contact snapshot 1`] = `
5
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"
9
8
  onClick={[Function]}
10
9
  size="medium"
11
10
  >
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo } from 'react'
1
+ import React, { forwardRef, useEffect, useMemo } from 'react'
2
2
  import cx from 'classnames'
3
3
  import MUIListItemText from '@material-ui/core/ListItemText'
4
4
  import once from 'lodash/once'
@@ -22,7 +22,7 @@ const getTypographyProp = (props, className, ellipsis) => {
22
22
  }
23
23
  }
24
24
 
25
- const ListItemText = props => {
25
+ const ListItemText = forwardRef((props, ref) => {
26
26
  const {
27
27
  primaryText,
28
28
  secondaryText,
@@ -68,6 +68,7 @@ const ListItemText = props => {
68
68
 
69
69
  return (
70
70
  <MUIListItemText
71
+ ref={ref}
71
72
  primary={primary}
72
73
  secondary={secondary}
73
74
  primaryTypographyProps={primaryTypographyProps}
@@ -75,7 +76,9 @@ const ListItemText = props => {
75
76
  {...rest}
76
77
  />
77
78
  )
78
- }
79
+ })
80
+
81
+ ListItemText.displayName = 'ListItemText'
79
82
 
80
83
  ListItemText.defaultProps = {
81
84
  ellipsis: true
@@ -79,25 +79,34 @@ const useOverridenChildren = ({ gutters, ellipsis, ...props }) => {
79
79
  })
80
80
  }
81
81
 
82
- const ListItem = forwardRef(({ className, ...props }, ref) => {
83
- const secondaryActionPaddingRight = useSecondaryAction(props)
84
- const guttersValue = useGutters(props)
85
-
86
- const styles = useStyles({ secondaryActionPaddingRight, guttersValue })
87
- const overridenChildren = useOverridenChildren(props)
88
-
89
- return (
90
- <MuiListItem
91
- {...props}
92
- ref={ref}
93
- classes={merge(props.classes, styles)}
94
- className={cx(className, props.size)}
95
- disableGutters={props.disableGutters || props.gutters === 'disabled'}
96
- >
97
- {overridenChildren}
98
- </MuiListItem>
99
- )
100
- })
82
+ const ListItem = forwardRef(
83
+ ({ className, gutters, ellipsis, ...props }, ref) => {
84
+ const secondaryActionPaddingRight = useSecondaryAction({
85
+ gutters,
86
+ ...props
87
+ })
88
+ const guttersValue = useGutters({ gutters, ...props })
89
+
90
+ const styles = useStyles({ secondaryActionPaddingRight, guttersValue })
91
+ const overridenChildren = useOverridenChildren({
92
+ gutters,
93
+ ellipsis,
94
+ ...props
95
+ })
96
+
97
+ return (
98
+ <MuiListItem
99
+ {...props}
100
+ ref={ref}
101
+ classes={merge(props.classes, styles)}
102
+ className={cx(className, props.size)}
103
+ disableGutters={props.disableGutters || gutters === 'disabled'}
104
+ >
105
+ {overridenChildren}
106
+ </MuiListItem>
107
+ )
108
+ }
109
+ )
101
110
 
102
111
  ListItem.displayName = 'ListItem'
103
112