@mailstep/design-system 0.7.47-beta.8 → 0.7.47-beta.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.47-beta.8",
3
+ "version": "0.7.47-beta.9",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useCallback, useMemo } from 'react';
14
14
  import Checkbox from '../../../../Forms/Checkbox';
15
15
  import { x } from '@xstyled/styled-components';
@@ -19,6 +19,7 @@ export var RowActionsCell = function (_a) {
19
19
  var actionColumnDefinition = _a.actionColumnDefinition, rowData = _a.rowData, uxState = _a.uxState, withCheckboxes = _a.withCheckboxes, onUxChange = _a.onUxChange, onRowAction = _a.onRowAction;
20
20
  var rowDataId = rowData === null || rowData === void 0 ? void 0 : rowData.id;
21
21
  // @TODO this should be in parent component
22
+ console.log('uxState', uxState);
22
23
  var checkedRows = uxState === null || uxState === void 0 ? void 0 : uxState.checkedRows;
23
24
  var canEdit = isFunction(actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit)
24
25
  ? actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit(rowData)
@@ -53,20 +54,5 @@ export var RowActionsCell = function (_a) {
53
54
  onClick();
54
55
  }
55
56
  }, [onClick]);
56
- var actions = useMemo(function () {
57
- var actionOptions = [];
58
- if (withCheckboxes) {
59
- actionOptions.push(_jsx(x.div, { w: "100%", h: "100%", display: "flex", children: _jsx(Checkbox, { checked: isChecked, onChange: onCheckboxChange, label: "" }) }));
60
- }
61
- if (canEdit) {
62
- actionOptions.push(_jsx(IconButtonInCell, { icon: "pen", onClick: handleOnClick, linkTo: linkTo }, "edit"));
63
- }
64
- if (!canEdit && canRead) {
65
- actionOptions.push(_jsx(IconButtonInCell, { icon: "chevronRight", onClick: handleOnClick, linkTo: linkTo }, "read"));
66
- }
67
- return actionOptions;
68
- }, [canEdit, canRead, handleOnClick, linkTo, isChecked, withCheckboxes, onCheckboxChange]);
69
- if (actions.length === 0)
70
- return null;
71
- return (_jsx(x.div, { w: "100%", display: "flex", alignItems: "center", gap: "16px", children: actions }));
57
+ return (_jsxs(x.div, { w: "100%", display: "flex", alignItems: "center", gap: "16px", children: [withCheckboxes && (_jsx(x.div, { w: "100%", h: "100%", display: "flex", children: _jsx(Checkbox, { checked: isChecked, onChange: onCheckboxChange, label: "" }) })), canEdit && _jsx(IconButtonInCell, { icon: "pen", onClick: handleOnClick, linkTo: linkTo }, "edit"), !canEdit && canRead && _jsx(IconButtonInCell, { icon: "chevronRight", onClick: handleOnClick, linkTo: linkTo }, "read")] }));
72
58
  };
@@ -21,7 +21,7 @@ var useEditReadAsColumn = function (props) {
21
21
  return {
22
22
  flexBasis: (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.flexBasis) || 88,
23
23
  forceCheckboxes: true,
24
- addRowNumbers: actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.addRowNumbers,
24
+ addRowNumbers: actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.addRowNumbers
25
25
  };
26
26
  }
27
27
  else if (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.addRowNumbers) {
@@ -74,7 +74,17 @@ var useEditReadAsColumn = function (props) {
74
74
  else {
75
75
  return columnsDefinitions;
76
76
  }
77
- }, [flexBasis, stickTo, canRowEdit, canRowRead, columnsDefinitions]);
77
+ }, [
78
+ flexBasis,
79
+ stickTo,
80
+ canRowEdit,
81
+ canRowRead,
82
+ columnsDefinitions,
83
+ withCheckboxes,
84
+ gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.uxState,
85
+ actionColumnDefinition,
86
+ gridActions === null || gridActions === void 0 ? void 0 : gridActions.handleUxChange
87
+ ]);
78
88
  return {
79
89
  columnsDefinitions: modifiedColumnsDefinitions,
80
90
  actionColumnDefinition: actionColumnDefinition,