cozy-ui 126.5.0 → 126.6.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,10 @@
1
+ # [126.6.0](https://github.com/cozy/cozy-ui/compare/v126.5.0...v126.6.0) (2025-06-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * **ActionsMenu:** Add autoclose on context menu event ([fb883f0](https://github.com/cozy/cozy-ui/commit/fb883f0))
7
+
1
8
  # [126.5.0](https://github.com/cozy/cozy-ui/compare/v126.4.0...v126.5.0) (2025-06-19)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "126.5.0",
3
+ "version": "126.6.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -20,6 +20,7 @@ const ActionsMenu = forwardRef(
20
20
  children,
21
21
  componentsProps,
22
22
  onClose,
23
+ autoCloseOnContextMenu,
23
24
  ...props
24
25
  },
25
26
  ref
@@ -34,6 +35,12 @@ const ActionsMenu = forwardRef(
34
35
  anchorOrigin={anchorOrigin}
35
36
  transformOrigin={transformOrigin}
36
37
  keepMounted
38
+ {...(autoCloseOnContextMenu && {
39
+ onContextMenu: ev => {
40
+ ev.preventDefault()
41
+ onClose()
42
+ }
43
+ })}
37
44
  onClose={onClose}
38
45
  >
39
46
  {children}
@@ -53,6 +60,7 @@ ActionsMenu.defaultProps = {
53
60
  horizontal: 'left'
54
61
  },
55
62
  autoClose: true,
63
+ autoCloseOnContextMenu: true,
56
64
  componentsProps: {}
57
65
  }
58
66
 
@@ -70,6 +78,8 @@ ActionsMenu.propTypes = {
70
78
  }),
71
79
  /** Whether the menu should automatically close itself when an item is clicked */
72
80
  autoClose: PropTypes.bool,
81
+ /** Whether the menu should automatically close itself when right-click is triggered */
82
+ autoCloseOnContextMenu: PropTypes.bool,
73
83
  /* Props passed to components with the same name */
74
84
  componentsProps: PropTypes.shape({
75
85
  /** Props spread to ActionsItems component */
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["docs", "actions", "anchorOrigin", "children", "componentsProps", "onClose"];
3
+ var _excluded = ["docs", "actions", "anchorOrigin", "children", "componentsProps", "onClose", "autoCloseOnContextMenu"];
4
4
  import PropTypes from 'prop-types';
5
5
  import React, { forwardRef } from 'react';
6
6
  import ActionsItems from "cozy-ui/transpiled/react/ActionsMenu/ActionsItems";
@@ -23,6 +23,7 @@ var ActionsMenu = /*#__PURE__*/forwardRef(function (_ref2, ref) {
23
23
  children = _ref2.children,
24
24
  componentsProps = _ref2.componentsProps,
25
25
  onClose = _ref2.onClose,
26
+ autoCloseOnContextMenu = _ref2.autoCloseOnContextMenu,
26
27
  props = _objectWithoutProperties(_ref2, _excluded);
27
28
 
28
29
  var transformOrigin = useTransformOrigin(anchorOrigin);
@@ -31,7 +32,13 @@ var ActionsMenu = /*#__PURE__*/forwardRef(function (_ref2, ref) {
31
32
  getContentAnchorEl: null,
32
33
  anchorOrigin: anchorOrigin,
33
34
  transformOrigin: transformOrigin,
34
- keepMounted: true,
35
+ keepMounted: true
36
+ }, autoCloseOnContextMenu && {
37
+ onContextMenu: function onContextMenu(ev) {
38
+ ev.preventDefault();
39
+ onClose();
40
+ }
41
+ }, {
35
42
  onClose: onClose
36
43
  }), children, /*#__PURE__*/React.createElement(ActionsItems, _extends({}, componentsProps.actionsItems, {
37
44
  docs: docs,
@@ -44,6 +51,7 @@ ActionsMenu.defaultProps = {
44
51
  horizontal: 'left'
45
52
  },
46
53
  autoClose: true,
54
+ autoCloseOnContextMenu: true,
47
55
  componentsProps: {}
48
56
  };
49
57
  ActionsMenu.propTypes = {
@@ -65,6 +73,9 @@ ActionsMenu.propTypes = {
65
73
  /** Whether the menu should automatically close itself when an item is clicked */
66
74
  autoClose: PropTypes.bool,
67
75
 
76
+ /** Whether the menu should automatically close itself when right-click is triggered */
77
+ autoCloseOnContextMenu: PropTypes.bool,
78
+
68
79
  /* Props passed to components with the same name */
69
80
  componentsProps: PropTypes.shape({
70
81
  /** Props spread to ActionsItems component */