cozy-ui 85.9.0 → 86.1.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 (42) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +1 -1
  3. package/react/ActionsMenu/Actions/call.js +4 -2
  4. package/react/ActionsMenu/Actions/divider.js +4 -4
  5. package/react/ActionsMenu/Actions/emailTo.js +4 -2
  6. package/react/ActionsMenu/Actions/locales/withActionsLocales.jsx +2 -7
  7. package/react/ActionsMenu/Actions/modify.js +4 -2
  8. package/react/ActionsMenu/Actions/smsTo.js +4 -2
  9. package/react/ActionsMenu/Actions/viewInContacts.js +4 -2
  10. package/react/ActionsMenu/ActionsItems.jsx +5 -5
  11. package/react/ActionsMenu/ActionsMenuItem.jsx +9 -1
  12. package/react/ActionsMenu/index.jsx +29 -4
  13. package/react/I18n/index.jsx +7 -3
  14. package/react/I18n/withOnlyLocales.jsx +4 -4
  15. package/react/MuiCozyTheme/Divider/index.jsx +7 -4
  16. package/react/MuiCozyTheme/ListItem/ListItemBase/Renaming/RenameInput.jsx +24 -19
  17. package/react/MuiCozyTheme/ListItem/ListItemBase/index.jsx +18 -14
  18. package/react/MuiCozyTheme/ListItem/ListItemContact/helpers.js +2 -2
  19. package/react/MuiCozyTheme/ListItem/ListItemContact/helpers.spec.js +7 -7
  20. package/react/MuiCozyTheme/ListItem/ListItemContact/useActions.jsx +5 -3
  21. package/react/Viewer/Panel/QualificationListItemInformation.jsx +1 -2
  22. package/react/Viewer/locales/en.json +1 -7
  23. package/react/Viewer/locales/fr.json +1 -7
  24. package/transpiled/react/ActionsMenu/Actions/call.js +4 -10
  25. package/transpiled/react/ActionsMenu/Actions/divider.js +5 -4
  26. package/transpiled/react/ActionsMenu/Actions/emailTo.js +4 -10
  27. package/transpiled/react/ActionsMenu/Actions/locales/withActionsLocales.js +2 -8
  28. package/transpiled/react/ActionsMenu/Actions/modify.js +4 -10
  29. package/transpiled/react/ActionsMenu/Actions/smsTo.js +4 -10
  30. package/transpiled/react/ActionsMenu/Actions/viewInContacts.js +4 -10
  31. package/transpiled/react/ActionsMenu/ActionsItems.js +15 -10
  32. package/transpiled/react/ActionsMenu/ActionsMenuItem.js +9 -1
  33. package/transpiled/react/ActionsMenu/index.js +19 -6
  34. package/transpiled/react/I18n/index.js +4 -4
  35. package/transpiled/react/I18n/withOnlyLocales.js +7 -6
  36. package/transpiled/react/MuiCozyTheme/Divider/index.js +10 -5
  37. package/transpiled/react/MuiCozyTheme/ListItem/ListItemBase/Renaming/RenameInput.js +96 -92
  38. package/transpiled/react/MuiCozyTheme/ListItem/ListItemBase/index.js +19 -14
  39. package/transpiled/react/MuiCozyTheme/ListItem/ListItemContact/helpers.js +2 -2
  40. package/transpiled/react/MuiCozyTheme/ListItem/ListItemContact/useActions.js +1 -3
  41. package/transpiled/react/Viewer/Panel/QualificationListItemInformation.js +1 -3
  42. package/transpiled/react/Viewer/hoc/withViewerLocales.js +2 -14
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ # [86.1.0](https://github.com/cozy/cozy-ui/compare/v86.0.0...v86.1.0) (2023-06-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * Remove `mespapiers.migrated.metadata` flag ([43bcc3e](https://github.com/cozy/cozy-ui/commit/43bcc3e))
7
+
8
+ # [86.0.0](https://github.com/cozy/cozy-ui/compare/v85.9.0...v86.0.0) (2023-06-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **ActionsMenu:** Divider actions wasn't spreading ref ([15a9554](https://github.com/cozy/cozy-ui/commit/15a9554))
14
+ * **ActionsMenu:** Now force autofocus on first item for better a11y ([4264903](https://github.com/cozy/cozy-ui/commit/4264903))
15
+ * **ActionsMenu:** Now spread props first to avoid override ([c30e183](https://github.com/cozy/cozy-ui/commit/c30e183))
16
+ * **ActionsMenu:** Prop `doc` was spread to ActionsMenuItem child ([a2160c1](https://github.com/cozy/cozy-ui/commit/a2160c1))
17
+ * **Divider:** Ref wasn't spreaded ([8220dba](https://github.com/cozy/cozy-ui/commit/8220dba))
18
+ * **I18n:** Translate() wasn't spreading ref ([b23c16f](https://github.com/cozy/cozy-ui/commit/b23c16f))
19
+ * **I18n:** WithOnlyLocales wasn't spreading ref ([5ca4004](https://github.com/cozy/cozy-ui/commit/5ca4004))
20
+ * **ListItem:** Remove autoFocus and set focus on mount in RenameInput ([04d9985](https://github.com/cozy/cozy-ui/commit/04d9985))
21
+
22
+
23
+ ### Features
24
+
25
+ * **ActionsMenu:** Add possibility to spread props to ActionsItems ([20534cb](https://github.com/cozy/cozy-ui/commit/20534cb))
26
+ * **ListItemContact:** Use new ActionsMenu to get better accessibility ([e77d043](https://github.com/cozy/cozy-ui/commit/e77d043))
27
+
28
+
29
+ ### BREAKING CHANGES
30
+
31
+ * **ActionsMenu:** `ActionsItems` no longer support `isLast` and `setIsRenaming` props. You have to use `actionOptions` to pass them. You should not be worried about this BC, `ActionsItems` is generally not used directly in apps
32
+
1
33
  # [85.9.0](https://github.com/cozy/cozy-ui/compare/v85.8.1...v85.9.0) (2023-06-19)
2
34
 
3
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "85.9.0",
3
+ "version": "86.1.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -6,6 +6,7 @@ import ActionsMenuItem from '../ActionsMenuItem'
6
6
  import ListItemIcon from '../../MuiCozyTheme/ListItemIcon'
7
7
  import Icon from '../../Icon'
8
8
  import ListItemText from '../../ListItemText'
9
+ import { useI18n } from '../../I18n'
9
10
 
10
11
  export const call = () => {
11
12
  return {
@@ -15,8 +16,9 @@ export const call = () => {
15
16
  !!phoneNumber && window.open(`tel:${phoneNumber}`, '_self')
16
17
  },
17
18
  Component: withActionsLocales(
18
- // eslint-disable-next-line no-unused-vars
19
- forwardRef(({ t, f, lang, ...props }, ref) => {
19
+ forwardRef((props, ref) => {
20
+ const { t } = useI18n()
21
+
20
22
  return (
21
23
  <ActionsMenuItem {...props} ref={ref}>
22
24
  <ListItemIcon>
@@ -1,12 +1,12 @@
1
- import React from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
 
3
3
  import Divider from '../../MuiCozyTheme/Divider'
4
4
 
5
5
  export const divider = () => {
6
6
  return {
7
7
  name: 'divider',
8
- Component: function divider() {
9
- return <Divider className="u-mv-half" />
10
- }
8
+ Component: forwardRef((props, ref) => {
9
+ return <Divider className="u-mv-half" ref={ref} />
10
+ })
11
11
  }
12
12
  }
@@ -6,6 +6,7 @@ import ActionsMenuItem from '../ActionsMenuItem'
6
6
  import ListItemIcon from '../../MuiCozyTheme/ListItemIcon'
7
7
  import Icon from '../../Icon'
8
8
  import ListItemText from '../../ListItemText'
9
+ import { useI18n } from '../../I18n'
9
10
 
10
11
  export const emailTo = () => {
11
12
  return {
@@ -15,8 +16,9 @@ export const emailTo = () => {
15
16
  !!emailAddress && window.open(`mailto:${emailAddress}`, '_self')
16
17
  },
17
18
  Component: withActionsLocales(
18
- // eslint-disable-next-line no-unused-vars
19
- forwardRef(({ t, f, lang, ...props }, ref) => {
19
+ forwardRef((props, ref) => {
20
+ const { t } = useI18n()
21
+
20
22
  return (
21
23
  <ActionsMenuItem {...props} ref={ref}>
22
24
  <ListItemIcon>
@@ -1,4 +1,4 @@
1
- import withLocales from '../../../I18n/withLocales'
1
+ import withOnlyLocales from '../../../I18n/withOnlyLocales'
2
2
 
3
3
  import en from '../../../ActionMenu/Actions/locales/en.json'
4
4
  import fr from '../../../ActionMenu/Actions/locales/fr.json'
@@ -8,9 +8,4 @@ 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
- */
16
- export default withLocales(locales)
11
+ export default withOnlyLocales(locales)
@@ -8,6 +8,7 @@ import Icon from '../../Icon'
8
8
  import PenIcon from '../../Icons/Pen'
9
9
  import ActionsMenuItem from '../ActionsMenuItem'
10
10
  import withActionsLocales from './locales/withActionsLocales'
11
+ import { useI18n } from '../../I18n'
11
12
 
12
13
  export const modify = () => {
13
14
  return {
@@ -26,8 +27,9 @@ export const modify = () => {
26
27
  window.open(webLink, '_blank')
27
28
  },
28
29
  Component: withActionsLocales(
29
- // eslint-disable-next-line no-unused-vars
30
- forwardRef(({ t, f, lang, ...props }, ref) => {
30
+ forwardRef((props, ref) => {
31
+ const { t } = useI18n()
32
+
31
33
  return (
32
34
  <ActionsMenuItem ref={ref} {...props}>
33
35
  <ListItemIcon>
@@ -6,6 +6,7 @@ import ActionsMenuItem from '../ActionsMenuItem'
6
6
  import ListItemIcon from '../../MuiCozyTheme/ListItemIcon'
7
7
  import Icon from '../../Icon'
8
8
  import ListItemText from '../../ListItemText'
9
+ import { useI18n } from '../../I18n'
9
10
 
10
11
  export const smsTo = () => {
11
12
  return {
@@ -15,8 +16,9 @@ export const smsTo = () => {
15
16
  !!phoneNumber && window.open(`sms:${phoneNumber}`, '_self')
16
17
  },
17
18
  Component: withActionsLocales(
18
- // eslint-disable-next-line no-unused-vars
19
- forwardRef(({ t, f, lang, ...props }, ref) => {
19
+ forwardRef((props, ref) => {
20
+ const { t } = useI18n()
21
+
20
22
  return (
21
23
  <ActionsMenuItem {...props} ref={ref}>
22
24
  <ListItemIcon>
@@ -8,6 +8,7 @@ import ActionsMenuItem from '../ActionsMenuItem'
8
8
  import ListItemIcon from '../../MuiCozyTheme/ListItemIcon'
9
9
  import Icon from '../../Icon'
10
10
  import ListItemText from '../../ListItemText'
11
+ import { useI18n } from '../../I18n'
11
12
 
12
13
  export const viewInContacts = () => {
13
14
  return {
@@ -26,8 +27,9 @@ export const viewInContacts = () => {
26
27
  window.open(webLink, '_blank')
27
28
  },
28
29
  Component: withActionsLocales(
29
- // eslint-disable-next-line no-unused-vars
30
- forwardRef(({ t, f, lang, ...props }, ref) => {
30
+ forwardRef((props, ref) => {
31
+ const { t } = useI18n()
32
+
31
33
  return (
32
34
  <ActionsMenuItem ref={ref} {...props}>
33
35
  <ListItemIcon>
@@ -6,7 +6,7 @@ import { useI18n } from '../I18n'
6
6
  import { getActionName, getOnlyNeededActions } from './Actions/helpers'
7
7
 
8
8
  const ActionsItems = forwardRef(
9
- ({ doc, actions, isLast, setIsRenaming, onClick, ...props }, ref) => {
9
+ ({ doc, actions, actionOptions, onClick, ...props }, ref) => {
10
10
  const client = useClient()
11
11
  const { t } = useI18n()
12
12
  const cleanedActions = useMemo(() => getOnlyNeededActions(actions, doc), [
@@ -21,8 +21,7 @@ const ActionsItems = forwardRef(
21
21
  const { Component: ActionComponent, action, disabled } = actionDefinition
22
22
 
23
23
  const handleClick = () => {
24
- action && action(doc, { client, t, isLast })
25
- actionName === 'rename' && setIsRenaming(true)
24
+ action && action(doc, { client, t, ...actionOptions })
26
25
  onClick && onClick()
27
26
  }
28
27
 
@@ -32,6 +31,7 @@ const ActionsItems = forwardRef(
32
31
  ref={ref}
33
32
  key={actionName + idx}
34
33
  doc={doc}
34
+ autoFocus={idx === 0}
35
35
  disabled={disabled}
36
36
  onClick={handleClick}
37
37
  />
@@ -43,8 +43,8 @@ const ActionsItems = forwardRef(
43
43
  ActionsItems.propTypes = {
44
44
  doc: PropTypes.object,
45
45
  actions: PropTypes.array,
46
- isLast: PropTypes.bool,
47
- setIsRenaming: PropTypes.func,
46
+ /** Props spread to action method of Actions component */
47
+ actionOptions: PropTypes.object,
48
48
  onClick: PropTypes.func
49
49
  }
50
50
 
@@ -1,13 +1,21 @@
1
1
  import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
+ import omit from 'lodash/omit'
3
4
 
4
5
  import MenuItem from '../MenuItem'
5
6
  import ListItem from '../MuiCozyTheme/ListItem'
6
7
 
8
+ const cleanPropsForDOM = props => {
9
+ const nonDOMProps = ['doc']
10
+
11
+ return omit(props, nonDOMProps)
12
+ }
13
+
7
14
  const ActionsMenuItem = forwardRef(({ isListItem, ...props }, ref) => {
8
15
  const Component = isListItem ? ListItem : MenuItem
16
+ const compProps = cleanPropsForDOM(props)
9
17
 
10
- return <Component {...props} ref={ref} button ellipsis={false} />
18
+ return <Component {...compProps} ref={ref} button ellipsis={false} />
11
19
  })
12
20
 
13
21
  ActionsMenuItem.displayName = 'ActionsMenuItem'
@@ -12,20 +12,36 @@ const useTransformOrigin = ({ vertical, horizontal }) => {
12
12
  }
13
13
 
14
14
  const ActionsMenu = forwardRef(
15
- ({ doc, actions, anchorOrigin, children, ...props }, ref) => {
15
+ (
16
+ {
17
+ doc,
18
+ actions,
19
+ anchorOrigin,
20
+ children,
21
+ componentsProps,
22
+ onClose,
23
+ ...props
24
+ },
25
+ ref
26
+ ) => {
16
27
  const transformOrigin = useTransformOrigin(anchorOrigin)
17
28
 
18
29
  return (
19
30
  <ActionsMenuWrapper
31
+ {...props}
20
32
  anchorEl={ref.current}
21
33
  getContentAnchorEl={null}
22
34
  anchorOrigin={anchorOrigin}
23
35
  transformOrigin={transformOrigin}
24
36
  keepMounted
25
- {...props}
37
+ onClose={onClose}
26
38
  >
27
39
  {children}
28
- <ActionsItems doc={doc} actions={actions} />
40
+ <ActionsItems
41
+ {...componentsProps.actionsItems}
42
+ doc={doc}
43
+ actions={actions}
44
+ />
29
45
  </ActionsMenuWrapper>
30
46
  )
31
47
  }
@@ -36,7 +52,8 @@ ActionsMenu.defaultProps = {
36
52
  vertical: 'bottom',
37
53
  horizontal: 'left'
38
54
  },
39
- autoClose: true
55
+ autoClose: true,
56
+ componentsProps: {}
40
57
  }
41
58
 
42
59
  ActionsMenu.propTypes = {
@@ -53,6 +70,14 @@ ActionsMenu.propTypes = {
53
70
  }),
54
71
  /** Whether the menu should automatically close itself when an item is clicked */
55
72
  autoClose: PropTypes.bool,
73
+ /* Props passed to components with the same name */
74
+ componentsProps: PropTypes.shape({
75
+ /** Props spread to ActionsItems component */
76
+ actionsItems: PropTypes.shape({
77
+ /** Props spread to action method of Actions component */
78
+ actionOptions: PropTypes.object
79
+ })
80
+ }),
56
81
  /** Function triggered when closing the menu */
57
82
  onClose: PropTypes.func
58
83
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  'use strict'
6
6
 
7
- import React, { Component, useContext, useMemo } from 'react'
7
+ import React, { Component, useContext, useMemo, forwardRef } from 'react'
8
8
  import PropTypes from 'prop-types'
9
9
  import Polyglot from 'node-polyglot'
10
10
 
@@ -78,19 +78,23 @@ I18n.childContextTypes = {
78
78
 
79
79
  // higher order decorator for components that need `t` and/or `f`
80
80
  export const translate = () => WrappedComponent => {
81
- const Wrapper = props => {
81
+ const Wrapper = forwardRef((props, ref) => {
82
82
  const i18nContext = useContext(I18nContext)
83
+
83
84
  return (
84
85
  <WrappedComponent
85
86
  {...props}
87
+ ref={ref}
86
88
  t={i18nContext && i18nContext.t}
87
89
  f={i18nContext && i18nContext.f}
88
90
  lang={i18nContext && i18nContext.lang}
89
91
  />
90
92
  )
91
- }
93
+ })
94
+
92
95
  Wrapper.displayName = `withI18n(${WrappedComponent.displayName ||
93
96
  WrappedComponent.name})`
97
+
94
98
  return Wrapper
95
99
  }
96
100
 
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
  import { I18n, useI18n } from '.'
3
3
 
4
4
  /**
@@ -13,15 +13,15 @@ const withOnlyLocales = localesOrRequire => Component => {
13
13
  ? localesOrRequire
14
14
  : localeCode => localesOrRequire[localeCode]
15
15
 
16
- const Wrapped = props => {
16
+ const Wrapped = forwardRef((props, ref) => {
17
17
  const { lang } = useI18n()
18
18
 
19
19
  return (
20
20
  <I18n dictRequire={requireLocale} lang={lang}>
21
- <Component {...props} />
21
+ <Component {...props} ref={ref} />
22
22
  </I18n>
23
23
  )
24
- }
24
+ })
25
25
 
26
26
  Wrapped.propTypes = {
27
27
  ...(Component.propTypes || {})
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
  import MuiDivider from '@material-ui/core/Divider'
3
3
 
4
4
  import { withStyles } from '../../styles'
@@ -9,12 +9,15 @@ import TextDivider from './TextDivider'
9
9
  * @desc If this component is provided a string children, it will render a `<TextDivider>` component
10
10
  * and will handle the `textAlign` prop that accepts a `"center"` or undefined value
11
11
  */
12
- const Divider = props =>
12
+ const Divider = forwardRef((props, ref) =>
13
13
  typeof props.children === 'string' ? (
14
- <TextDivider {...props} />
14
+ <TextDivider {...props} ref={ref} />
15
15
  ) : (
16
- <MuiDivider {...props} />
16
+ <MuiDivider {...props} ref={ref} />
17
17
  )
18
+ )
19
+
20
+ Divider.displayName = 'Divider'
18
21
 
19
22
  Divider.propTypes = {
20
23
  ...TextDivider.propTypes
@@ -42,22 +42,6 @@ const RenameInput = ({ file, onClose }) => {
42
42
  const [isModalOpened, setIsModalOpened] = useState(false)
43
43
  const defaultValue = file.name
44
44
 
45
- const handleKeyDown = async event => {
46
- if (event.key === KEYS.ENTER) {
47
- await check()
48
- } else if (event.key === KEYS.ESCAPE) {
49
- await cancel()
50
- }
51
- }
52
-
53
- const handleBlur = async () => {
54
- // On top of "normal" blurs, the event happens all the time after a submit or a cancel, because this component is removed from the DOM while having the focus.
55
- // we want to do things only on "normal" blurs, *not* after a cancel
56
- if (!isModalOpened && !isBusy) {
57
- await check()
58
- }
59
- }
60
-
61
45
  const check = async () => {
62
46
  const { value } = textInput.current
63
47
  if (value === '' || value === '.' || value === '..') {
@@ -96,13 +80,34 @@ const RenameInput = ({ file, onClose }) => {
96
80
  onClose()
97
81
  }
98
82
 
99
- useEffect(() => {
83
+ const handleKeyDown = async event => {
84
+ if (event.key === KEYS.ENTER) {
85
+ await check()
86
+ } else if (event.key === KEYS.ESCAPE) {
87
+ await cancel()
88
+ }
89
+ }
90
+
91
+ const handleBlur = async () => {
92
+ // On top of "normal" blurs, the event happens all the time after a submit or a cancel, because this component is removed from the DOM while having the focus.
93
+ // we want to do things only on "normal" blurs, *not* after a cancel
94
+ if (!isModalOpened && !isBusy) {
95
+ await check()
96
+ }
97
+ }
98
+
99
+ const handleFocus = () => {
100
100
  const { length } = splitFilename({
101
101
  name: defaultValue,
102
102
  type: 'file'
103
103
  }).filename
104
+
104
105
  textInput.current.setSelectionRange(0, length)
105
- }, [defaultValue])
106
+ }
107
+
108
+ useEffect(() => {
109
+ textInput.current.focus()
110
+ }, [])
106
111
 
107
112
  return (
108
113
  <InputGroup className={styles.inputGroup}>
@@ -110,9 +115,9 @@ const RenameInput = ({ file, onClose }) => {
110
115
  ref={textInput}
111
116
  type="text"
112
117
  defaultValue={defaultValue}
113
- autoFocus
114
118
  disabled={isModalOpened || isBusy}
115
119
  onBlur={handleBlur}
120
+ onFocus={handleFocus}
116
121
  onKeyDown={handleKeyDown}
117
122
  />
118
123
  {(isModalOpened || isBusy) && <Spinner className={styles.spinner} />}
@@ -9,13 +9,11 @@ import IconButton from '../../../IconButton'
9
9
  import Icon from '../../../Icon'
10
10
  import DotsIcon from '../../../Icons/Dots'
11
11
  import ExpandedAttributes from '../ExpandedAttributes'
12
- import ActionMenuWithClose from '../../../ActionMenu/ActionMenuWithClose'
13
- import { ActionMenuHeader } from '../../../ActionMenu'
14
- import ActionsItems from '../../../ActionMenu/Actions/ActionsItems'
15
- import useBreakpoints from '../../../hooks/useBreakpoints'
12
+ import ActionsMenu from '../../../ActionsMenu'
16
13
  import RenameInput from './Renaming/RenameInput'
17
14
  import withListItemLocales from '../hoc/withListItemLocales'
18
15
  import Checkbox from '../../../Checkbox'
16
+ import ActionsMenuMobileHeader from '../../../ActionsMenu/ActionsMenuMobileHeader'
19
17
 
20
18
  const ListItemBase = ({
21
19
  doc,
@@ -31,11 +29,10 @@ const ListItemBase = ({
31
29
  const [showActionMenu, setShowActionMenu] = useState(false)
32
30
  const [isRenaming, setIsRenaming] = useState(false)
33
31
  const anchorRef = useRef()
34
- const { isMobile } = useBreakpoints()
35
32
 
36
33
  const toggleMenu = () => setShowActionMenu(v => !v)
37
34
 
38
- const showActionMenuHeader = isMobile && actionMenuComp?.Header
35
+ const showActionMenuHeader = actionMenuComp?.Header
39
36
  const isButton = !isRenaming && !!onClick
40
37
  const handleClick =
41
38
  !isRenaming && !isSelected && onClick ? onClick : undefined
@@ -69,19 +66,26 @@ const ListItemBase = ({
69
66
  <ExpandedAttributes doc={doc} expandedAttributes={expandedAttributes} />
70
67
  )}
71
68
  {showActionMenu && (
72
- <ActionMenuWithClose
69
+ <ActionsMenu
70
+ open
73
71
  ref={anchorRef}
72
+ doc={doc}
73
+ actions={actions}
74
+ anchorOrigin={{
75
+ vertical: 'bottom',
76
+ horizontal: 'right'
77
+ }}
78
+ componentsProps={{
79
+ actionsItems: { actionOptions: { setIsRenaming } }
80
+ }}
74
81
  onClose={() => setShowActionMenu(false)}
75
82
  >
76
83
  {showActionMenuHeader && (
77
- <ActionMenuHeader>{actionMenuComp.Header}</ActionMenuHeader>
84
+ <ActionsMenuMobileHeader>
85
+ {actionMenuComp.Header}
86
+ </ActionsMenuMobileHeader>
78
87
  )}
79
- <ActionsItems
80
- doc={doc}
81
- actions={actions}
82
- setIsRenaming={setIsRenaming}
83
- />
84
- </ActionMenuWithClose>
88
+ </ActionsMenu>
85
89
  )}
86
90
  </>
87
91
  )
@@ -1,4 +1,4 @@
1
- import { hr, emailTo, smsTo, call } from '../../../ActionMenu/Actions'
1
+ import { divider, emailTo, smsTo, call } from '../../../ActionsMenu/Actions'
2
2
 
3
3
  export const makeOptionalActions = contact => {
4
4
  const hasPhoneAction = contact.phone?.length > 0
@@ -6,7 +6,7 @@ export const makeOptionalActions = contact => {
6
6
  const hasMessageActions = hasPhoneAction || hasEmailAction
7
7
 
8
8
  const actionsAndOptions = [
9
- { action: hr, condition: hasMessageActions },
9
+ { action: divider, condition: hasMessageActions },
10
10
  { action: call, condition: hasPhoneAction },
11
11
  { action: smsTo, condition: hasPhoneAction },
12
12
  { action: emailTo, condition: hasEmailAction }
@@ -1,31 +1,31 @@
1
- import { hr, emailTo, smsTo, call } from '../../../ActionMenu/Actions'
1
+ import { divider, emailTo, smsTo, call } from '../../../ActionsMenu/Actions'
2
2
 
3
3
  import { makeOptionalActions } from './helpers'
4
4
 
5
5
  describe('makeOptionalActions', () => {
6
- it('should return hr, call, smsTo, emailTo', () => {
6
+ it('should return divider, call, smsTo, emailTo', () => {
7
7
  const res = makeOptionalActions({
8
8
  email: [{ address: 'mail@cozy.com' }],
9
9
  phone: [{ number: '123456' }]
10
10
  })
11
11
 
12
- expect(res).toStrictEqual([hr, call, smsTo, emailTo])
12
+ expect(res).toStrictEqual([divider, call, smsTo, emailTo])
13
13
  })
14
14
 
15
- it('should return hr, emailTo', () => {
15
+ it('should return divider, emailTo', () => {
16
16
  const res = makeOptionalActions({
17
17
  email: [{ address: 'mail@cozy.com' }]
18
18
  })
19
19
 
20
- expect(res).toStrictEqual([hr, emailTo])
20
+ expect(res).toStrictEqual([divider, emailTo])
21
21
  })
22
22
 
23
- it('should return hr, call, smsTo', () => {
23
+ it('should return divider, call, smsTo', () => {
24
24
  const res = makeOptionalActions({
25
25
  phone: [{ number: '123456' }]
26
26
  })
27
27
 
28
- expect(res).toStrictEqual([hr, call, smsTo])
28
+ expect(res).toStrictEqual([divider, call, smsTo])
29
29
  })
30
30
 
31
31
  it('should empty array', () => {
@@ -1,8 +1,10 @@
1
1
  import { useMemo } from 'react'
2
2
 
3
- import { makeActions } from '../../../ActionMenu/Actions/helpers'
4
- import { modify } from '../../../ActionMenu/Actions/modify'
5
- import { viewInContacts } from '../../../ActionMenu/Actions/viewInContacts'
3
+ import {
4
+ makeActions,
5
+ modify,
6
+ viewInContacts
7
+ } from '../../../ActionsMenu/Actions'
6
8
  import { makeOptionalActions } from './helpers'
7
9
 
8
10
  const useActions = contact => {
@@ -2,7 +2,6 @@ import React, { forwardRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import { getBoundT } from 'cozy-client/dist/models/document/locales'
5
- import flag from 'cozy-flags'
6
5
 
7
6
  import ListItem from '../../MuiCozyTheme/ListItem'
8
7
  import ListItemSecondaryAction from '../../MuiCozyTheme/ListItemSecondaryAction'
@@ -42,7 +41,7 @@ const QualificationListItemInformation = forwardRef(
42
41
 
43
42
  const currentValue = makeInformationValue({ name, value, t, scannerT })
44
43
  const title =
45
- name === 'number' && flag('mespapiers.migrated.metadata') // TODO Remove duplicate translations when remove this flag
44
+ name === 'number'
46
45
  ? t(
47
46
  `Viewer.panel.qualification.information.title.${qualificationLabel}.${name}`
48
47
  )
@@ -79,13 +79,7 @@
79
79
  "country": "Beneficiary nationality",
80
80
  "refTaxIncome": "Reference tax income",
81
81
  "contractType": "Contract type",
82
- "noticePeriod": "Expiration alert",
83
- "number": "License number",
84
- "cafFileNumber": "CAF file number",
85
- "cardNumber": "National ID card number",
86
- "vinNumber": "Vehicle registration number (VIN)",
87
- "ibanNumber": "IBAN number",
88
- "passportNumber": "Passport number"
82
+ "noticePeriod": "Expiration alert"
89
83
  },
90
84
  "day": "day |||| days"
91
85
  },
@@ -79,13 +79,7 @@
79
79
  "country": "Nationalité du bénéficiaire",
80
80
  "refTaxIncome": "Revenu fiscal de référence",
81
81
  "contractType": "Type de contrat",
82
- "noticePeriod": "Alerte d’expiration",
83
- "number": "Numéro du permis",
84
- "cafFileNumber": "Numéro de dossier CAF",
85
- "cardNumber": "Numéro de la carte d'identité",
86
- "vinNumber": "Numéro de la carte grise (VIN)",
87
- "ibanNumber": "Numéro d'IBAN",
88
- "passportNumber": "Numéro du passeport"
82
+ "noticePeriod": "Alerte d’expiration"
89
83
  },
90
84
  "day": "jour |||| jours"
91
85
  },