cozy-ui 135.5.0 → 135.7.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 (43) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/assets/icons/ui/expand.svg +1 -0
  3. package/assets/icons/ui/export.svg +1 -0
  4. package/assets/icons/ui/narrow.svg +1 -0
  5. package/package.json +1 -1
  6. package/react/ActionsMenu/Actions/exportToText.js +54 -0
  7. package/react/ActionsMenu/Actions/helpers.js +20 -0
  8. package/react/ActionsMenu/Actions/index.js +1 -0
  9. package/react/ActionsMenu/Actions/locales/en.json +2 -1
  10. package/react/ActionsMenu/Actions/locales/fr.json +2 -1
  11. package/react/ActionsMenu/Actions/locales/ru.json +3 -2
  12. package/react/ActionsMenu/Actions/locales/vi.json +3 -2
  13. package/react/ActionsMenu/Actions/pdfHelpers.js +187 -0
  14. package/react/Icon/Readme.md +7 -1
  15. package/react/Icons/Expand.jsx +12 -0
  16. package/react/Icons/Export.jsx +13 -0
  17. package/react/Icons/Narrow.jsx +16 -0
  18. package/react/Table/Readme.md +2 -1
  19. package/react/Table/Virtualized/FixedHeaderContent.jsx +14 -12
  20. package/react/Table/Virtualized/RowContent.jsx +16 -14
  21. package/react/Table/Virtualized/TableRow.jsx +8 -0
  22. package/react/Table/Virtualized/index.jsx +9 -3
  23. package/transpiled/react/ActionsMenu/Actions/exportToText.d.ts +13 -0
  24. package/transpiled/react/ActionsMenu/Actions/exportToText.js +84 -0
  25. package/transpiled/react/ActionsMenu/Actions/helpers.d.ts +1 -0
  26. package/transpiled/react/ActionsMenu/Actions/helpers.js +20 -1
  27. package/transpiled/react/ActionsMenu/Actions/index.d.ts +1 -0
  28. package/transpiled/react/ActionsMenu/Actions/index.js +2 -1
  29. package/transpiled/react/ActionsMenu/Actions/locales/withActionsLocales.js +8 -4
  30. package/transpiled/react/ActionsMenu/Actions/pdfHelpers.d.ts +34 -0
  31. package/transpiled/react/ActionsMenu/Actions/pdfHelpers.js +242 -0
  32. package/transpiled/react/Icon/icons-sprite.d.ts +1 -1
  33. package/transpiled/react/Icon/icons-sprite.js +1 -1
  34. package/transpiled/react/Icons/Expand.d.ts +2 -0
  35. package/transpiled/react/Icons/Expand.js +14 -0
  36. package/transpiled/react/Icons/Export.d.ts +2 -0
  37. package/transpiled/react/Icons/Export.js +16 -0
  38. package/transpiled/react/Icons/Narrow.d.ts +2 -0
  39. package/transpiled/react/Icons/Narrow.js +16 -0
  40. package/transpiled/react/Table/Virtualized/FixedHeaderContent.js +1 -1
  41. package/transpiled/react/Table/Virtualized/RowContent.js +1 -1
  42. package/transpiled/react/Table/Virtualized/TableRow.js +12 -1
  43. package/transpiled/react/Table/Virtualized/index.js +11 -4
@@ -0,0 +1,2 @@
1
+ export default SvgExpand;
2
+ declare function SvgExpand(props: any): JSX.Element;
@@ -0,0 +1,14 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/expand.svg` to regenerate;
3
+ import React from 'react';
4
+
5
+ function SvgExpand(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ viewBox: "0 0 16 16",
8
+ fill: "none"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M14.8 15.2a.8.8 0 00-.8-.8H2.8a.8.8 0 000 1.6H14a.8.8 0 00.8-.8zm0-14.4A.8.8 0 0014 0H2.8a.8.8 0 100 1.6H14a.8.8 0 00.8-.8zM6.893 9.833a.799.799 0 00-1.128 1.132l1.928 1.928a1 1 0 001.414 0l1.928-1.928a.799.799 0 00-1.128-1.132l-.707.703V5.464l.707.703a.799.799 0 001.128-1.132L9.107 3.107a1 1 0 00-1.414 0L5.765 5.035a.799.799 0 001.128 1.132l.707-.703v5.072l-.707-.703z"
11
+ }));
12
+ }
13
+
14
+ export default SvgExpand;
@@ -0,0 +1,2 @@
1
+ export default SvgExport;
2
+ declare function SvgExport(props: any): JSX.Element;
@@ -0,0 +1,16 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/export.svg` to regenerate;
3
+ import React from 'react';
4
+
5
+ function SvgExport(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ viewBox: "0 0 16 16",
8
+ fill: "none"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ d: "M14.8 4v10.4l-.008.159A1.6 1.6 0 0113.2 16H3.6a1.6 1.6 0 01-1.014-.362l-.117-.107a1.6 1.6 0 01-.461-.972L2 14.4V1.6c0-.372.13-.73.362-1.014L2.47.469A1.6 1.6 0 013.599 0h7.2l4 4zM3.6 14.4h9.6V5.6h-1.598a2.4 2.4 0 01-2.4-2.4V1.6H3.6v12.8zm7.202-11.2a.8.8 0 00.8.8h.935l-1.736-1.736V3.2z"
11
+ }), /*#__PURE__*/React.createElement("path", {
12
+ d: "M8.401 7.2a.8.8 0 01.8.799v2.867l1.034-1.032a.8.8 0 111.131 1.13l-2.4 2.401a.794.794 0 01-.436.222.817.817 0 01-.13.013.793.793 0 01-.127-.013.794.794 0 01-.438-.222l-2.4-2.4a.8.8 0 111.131-1.131l1.035 1.034V8a.8.8 0 01.8-.8z"
13
+ }));
14
+ }
15
+
16
+ export default SvgExport;
@@ -0,0 +1,2 @@
1
+ export default SvgNarrow;
2
+ declare function SvgNarrow(props: any): JSX.Element;
@@ -0,0 +1,16 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ // Automatically created, please run `scripts/generate-svgr-icon.sh assets/icons/ui/narrow.svg` to regenerate;
3
+ import React from 'react';
4
+
5
+ function SvgNarrow(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ viewBox: "0 0 16 16",
8
+ fill: "none"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fillRule: "evenodd",
11
+ clipRule: "evenodd",
12
+ d: "M15.736.264a.9.9 0 010 1.274L12.07 5.204h2.027a.9.9 0 110 1.802H9.896a.9.9 0 01-.901-.9V1.901a.9.9 0 111.802 0V3.93L14.462.264a.9.9 0 011.274 0zM1 9.895a.9.9 0 01.902-.901h4.203a.9.9 0 01.901.9v4.204a.9.9 0 01-1.802 0V12.07l-3.666 3.667a.9.9 0 01-1.274-1.274l3.667-3.666H1.9a.9.9 0 01-.9-.901z"
13
+ }));
14
+ }
15
+
16
+ export default SvgNarrow;
@@ -29,7 +29,7 @@ var FixedHeaderContent = function FixedHeaderContent(_ref) {
29
29
  onSelectAllClick = _ref.onSelectAllClick;
30
30
  var classes = useStyles();
31
31
  var selectedCount = context.selectedItems.length;
32
- return /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
32
+ return /*#__PURE__*/React.createElement(TableRow, null, context.withCheckbox && /*#__PURE__*/React.createElement(TableCell, {
33
33
  align: "center",
34
34
  padding: "checkbox"
35
35
  }, /*#__PURE__*/React.createElement(Checkbox, {
@@ -14,7 +14,7 @@ var RowContent = function RowContent(_ref) {
14
14
  onLongPress = _ref.onLongPress,
15
15
  onClick = _ref.onClick;
16
16
  var selectedCount = context.selectedItems.length;
17
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableCell, {
17
+ return /*#__PURE__*/React.createElement(React.Fragment, null, context.withCheckbox && /*#__PURE__*/React.createElement(TableCell, {
18
18
  align: "center",
19
19
  padding: "checkbox"
20
20
  }, /*#__PURE__*/React.createElement(Checkbox, {
@@ -14,10 +14,21 @@ var TableRow = function TableRow(_ref) {
14
14
  var _item = item || context.data[props['data-item-index']];
15
15
 
16
16
  var isSelected = context.isSelectedItem(_item);
17
+
18
+ var handleClick = function handleClick() {
19
+ if (!context.withCheckbox && _item) {
20
+ var _context$onSelect;
21
+
22
+ var index = props['data-item-index'];
23
+ (_context$onSelect = context.onSelect) === null || _context$onSelect === void 0 ? void 0 : _context$onSelect.call(context, _item, null, index);
24
+ }
25
+ };
26
+
17
27
  return /*#__PURE__*/React.createElement(TableRowClassic, _extends({}, props, {
18
28
  className: cx(className, 'virtualized'),
19
29
  selected: isSelected,
20
- hover: true
30
+ hover: true,
31
+ onClick: !context.withCheckbox ? handleClick : props.onClick
21
32
  }));
22
33
  };
23
34
 
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["rows", "columns", "groups", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "context", "components", "onSortChange", "isNewItem"];
5
+ var _excluded = ["rows", "columns", "groups", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "context", "components", "onSortChange", "isNewItem", "withCheckbox"];
6
6
 
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
8
 
@@ -33,6 +33,7 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
33
33
  components = _ref.components,
34
34
  onSortChange = _ref.onSortChange,
35
35
  isNewItem = _ref.isNewItem,
36
+ withCheckbox = _ref.withCheckbox,
36
37
  props = _objectWithoutProperties(_ref, _excluded);
37
38
 
38
39
  var _useState = useState((_defaultOrder$directi = defaultOrder === null || defaultOrder === void 0 ? void 0 : defaultOrder.direction) !== null && _defaultOrder$directi !== void 0 ? _defaultOrder$directi : 'asc'),
@@ -60,7 +61,9 @@ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
60
61
  // we use directly `data` prop if no groupCounts
61
62
  isSelectedItem: isSelectedItem,
62
63
  selectedItems: selectedItems,
63
- isNewItem: isNewItem
64
+ isNewItem: isNewItem,
65
+ withCheckbox: withCheckbox,
66
+ onSelect: onSelect
64
67
  });
65
68
 
66
69
  var handleSort = function handleSort(property) {
@@ -130,7 +133,8 @@ VirtualizedTable.defaultProps = {
130
133
  selectedItems: [],
131
134
  isSelectedItem: function isSelectedItem() {},
132
135
  onSelect: function onSelect() {},
133
- onSelectAll: function onSelectAll() {}
136
+ onSelectAll: function onSelectAll() {},
137
+ withCheckbox: true
134
138
  };
135
139
  VirtualizedTable.propTypes = {
136
140
  /** Rows to display in the table */
@@ -167,6 +171,9 @@ VirtualizedTable.propTypes = {
167
171
  onSortChange: PropTypes.func,
168
172
 
169
173
  /** Function to determine if a row is new */
170
- isNewItem: PropTypes.func
174
+ isNewItem: PropTypes.func,
175
+
176
+ /** Whether to show checkboxes. When false, rows become clickable for selection */
177
+ withCheckbox: PropTypes.bool
171
178
  };
172
179
  export default VirtualizedTable;