cozy-ui 127.9.0 → 127.10.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
+ # [127.10.0](https://github.com/cozy/cozy-ui/compare/v127.9.0...v127.10.0) (2025-07-31)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Actions:** Add `makeAction` to simplify action creation ([941e9b7](https://github.com/cozy/cozy-ui/commit/941e9b7))
7
+
1
8
  # [127.9.0](https://github.com/cozy/cozy-ui/compare/v127.8.0...v127.9.0) (2025-07-31)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "127.9.0",
3
+ "version": "127.10.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -0,0 +1,42 @@
1
+ import React, { forwardRef } from 'react'
2
+
3
+ import Icon from '../../Icon'
4
+ import ListItemIcon from '../../ListItemIcon'
5
+ import ListItemText from '../../ListItemText'
6
+ import ActionsMenuItem from '../ActionsMenuItem'
7
+
8
+ const makeComponent = ({ label, icon, name }) => {
9
+ const Component = forwardRef((props, ref) => {
10
+ return (
11
+ <ActionsMenuItem {...props} ref={ref}>
12
+ <ListItemIcon>
13
+ <Icon icon={icon} />
14
+ </ListItemIcon>
15
+ <ListItemText primary={label} />
16
+ </ActionsMenuItem>
17
+ )
18
+ })
19
+
20
+ Component.displayName = name
21
+
22
+ return Component
23
+ }
24
+
25
+ export const makeAction = ({
26
+ name,
27
+ label,
28
+ icon,
29
+ disabled,
30
+ displayCondition,
31
+ action
32
+ }) => {
33
+ return {
34
+ name,
35
+ icon,
36
+ label,
37
+ disabled,
38
+ displayCondition,
39
+ action,
40
+ Component: makeComponent({ label, icon, name })
41
+ }
42
+ }
@@ -0,0 +1,17 @@
1
+ export function makeAction({ name, label, icon, disabled, displayCondition, action }: {
2
+ name: any;
3
+ label: any;
4
+ icon: any;
5
+ disabled: any;
6
+ displayCondition: any;
7
+ action: any;
8
+ }): {
9
+ name: any;
10
+ icon: any;
11
+ label: any;
12
+ disabled: any;
13
+ displayCondition: any;
14
+ action: any;
15
+ Component: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
16
+ };
17
+ import React from "react";
@@ -0,0 +1,45 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef } from 'react';
3
+ import Icon from "cozy-ui/transpiled/react/Icon";
4
+ import ListItemIcon from "cozy-ui/transpiled/react/ListItemIcon";
5
+ import ListItemText from "cozy-ui/transpiled/react/ListItemText";
6
+ import ActionsMenuItem from "cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem";
7
+
8
+ var makeComponent = function makeComponent(_ref) {
9
+ var label = _ref.label,
10
+ icon = _ref.icon,
11
+ name = _ref.name;
12
+ var Component = /*#__PURE__*/forwardRef(function (props, ref) {
13
+ return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
14
+ ref: ref
15
+ }), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
16
+ icon: icon
17
+ })), /*#__PURE__*/React.createElement(ListItemText, {
18
+ primary: label
19
+ }));
20
+ });
21
+ Component.displayName = name;
22
+ return Component;
23
+ };
24
+
25
+ export var makeAction = function makeAction(_ref2) {
26
+ var name = _ref2.name,
27
+ label = _ref2.label,
28
+ icon = _ref2.icon,
29
+ disabled = _ref2.disabled,
30
+ displayCondition = _ref2.displayCondition,
31
+ action = _ref2.action;
32
+ return {
33
+ name: name,
34
+ icon: icon,
35
+ label: label,
36
+ disabled: disabled,
37
+ displayCondition: displayCondition,
38
+ action: action,
39
+ Component: makeComponent({
40
+ label: label,
41
+ icon: icon,
42
+ name: name
43
+ })
44
+ };
45
+ };