@portnet/ui 0.1.7 → 0.1.8

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.
@@ -64,11 +64,19 @@ const StyledTabs = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, re
64
64
  fontSize: ".8rem"
65
65
  },
66
66
  "& .Mui-selected": {
67
- color: _apperance.palette.primary
67
+ color: _apperance.palette.primary,
68
+ background: "#d0d6e0"
68
69
  },
69
70
  "& .MuiTabs-indicator": {
70
- backgroundColor: _apperance.palette.primary,
71
+ backgroundColor: "#d1eaff",
71
72
  height: "3px"
73
+ },
74
+ "&:hover": {
75
+ color: "#40a9ff",
76
+ opacity: 1
77
+ },
78
+ "&.Mui-focusVisible": {
79
+ backgroundColor: "#d1eaff"
72
80
  }
73
81
  }
74
82
  };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("core-js/modules/web.dom-collections.iterator.js");
8
+ var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
9
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
10
+ var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
11
+ var _system = require("@mui/system");
12
+ var _react = _interopRequireDefault(require("react"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ const ActionPopover = _ref => {
16
+ let {
17
+ row,
18
+ actions
19
+ } = _ref;
20
+ const [anchorEl, setAnchorEl] = _react.default.useState(null);
21
+ const handleClick = event => {
22
+ setAnchorEl(event.currentTarget);
23
+ };
24
+ const handleClose = () => {
25
+ setAnchorEl(null);
26
+ };
27
+ const open = Boolean(anchorEl);
28
+ const id = open ? 'simple-popover' : undefined;
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
30
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
31
+ "aria-describedby": id,
32
+ onClick: handleClick,
33
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoreVert.default, {})
34
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
35
+ id: id,
36
+ open: open,
37
+ anchorEl: anchorEl,
38
+ onClose: handleClose,
39
+ anchorOrigin: {
40
+ vertical: 'bottom',
41
+ horizontal: 'left'
42
+ },
43
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
44
+ p: 2,
45
+ children: actions.map((action, index) => /*#__PURE__*/_react.default.cloneElement(action, {
46
+ row,
47
+ key: index,
48
+ onClick: handleClose // Assuming you want to close the popover when an action is clicked
49
+ }))
50
+ })
51
+ })]
52
+ });
53
+ };
54
+ var _default = exports.default = ActionPopover;
@@ -18,6 +18,8 @@ var _PuiCheckbox = _interopRequireDefault(require("../inputs/PuiCheckbox"));
18
18
  var _PuiIcon = _interopRequireDefault(require("../others/PuiIcon"));
19
19
  var _PuiTooltip = _interopRequireDefault(require("../others/PuiTooltip"));
20
20
  var _PuiTableAction = _interopRequireDefault(require("./PuiTableAction"));
21
+ var _ActionPopover = _interopRequireDefault(require("./ActionPopover"));
22
+ var _system = require("@mui/system");
21
23
  var _jsxRuntime = require("react/jsx-runtime");
22
24
  const _excluded = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange"];
23
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -37,6 +39,10 @@ const StyledMuiTable = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props
37
39
  "&.MuiDataGrid-root": {
38
40
  fontSize: ".8em",
39
41
  "& .tableActionColumn": {
42
+ "& .MuiDataGrid-columnHeaderTitle": {
43
+ justifyContent: "center",
44
+ display: "flex"
45
+ },
40
46
  "& .MuiDataGrid-columnHeaderTitleContainer": {
41
47
  justifyContent: "center"
42
48
  }
@@ -116,7 +122,16 @@ const StyledMuiTable = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props
116
122
  }
117
123
  },
118
124
  "& .MuiDataGrid-row": {
119
- maxHeight: "none !important"
125
+ maxHeight: "none !important",
126
+ "&:nth-of-type(odd)": {
127
+ backgroundColor: "#f9f9f9" // color for odd rows
128
+ },
129
+ "&:nth-of-type(even)": {
130
+ backgroundColor: "#c3e7f3" // color for even rows
131
+ },
132
+ "&:hover": {
133
+ backgroundColor: "#378bb8"
134
+ }
120
135
  },
121
136
  "& .MuiDataGrid-virtualScrollerContent": {
122
137
  "& .MuiDataGrid-row": {
@@ -285,25 +300,38 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
285
300
  React.useEffect(() => {
286
301
  const newColumns = Boolean(actions.length) ? [...columns, {
287
302
  field: "action",
288
- width: 10,
303
+ headerName: "Actions",
289
304
  sortable: false,
290
- renderHeader: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTableAction.default, {
291
- disabled: true,
292
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoreVert.default, {
293
- sx: {
294
- color: _apperance.palette.gray.dark
295
- }
296
- })
297
- }),
305
+ filterable: false,
306
+ width: 100,
298
307
  renderCell: _ref4 => {
299
308
  let {
300
309
  row
301
310
  } = _ref4;
302
- return oneActionOnly ? ( /*#__PURE__*/React.cloneElement(actions[0], {
303
- row
304
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(TableActions, {
305
- row: row,
306
- actions: actions
311
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
312
+ sx: {
313
+ display: 'flex',
314
+ gap: '8px',
315
+ // Adjust the space between icons as needed
316
+ flexWrap: 'wrap',
317
+ // Keep icons on the same line; remove if you want them to wrap
318
+ justifyContent: 'center',
319
+ // Center the icons horizontally
320
+ alignItems: 'center',
321
+ // Align icons vertically
322
+ minWidth: 0 // Prevent the flex container from stretching past its content width
323
+ },
324
+ children: actions.map((action, index) => /*#__PURE__*/React.cloneElement(action, {
325
+ row,
326
+ key: index,
327
+ sx: _objectSpread(_objectSpread({}, action.props.sx), {}, {
328
+ marginRight: 0,
329
+ // Remove any outer margins
330
+ '&:last-child': {
331
+ marginRight: 0 // Ensure the last item doesn't push the container width
332
+ }
333
+ })
334
+ }))
307
335
  });
308
336
  },
309
337
  cellClassName: "tableAction",
@@ -33,7 +33,8 @@ const PuiTableAction = _ref => {
33
33
  sx: _objectSpread(_objectSpread({}, sx), {}, {
34
34
  "& .MuiSvgIcon-root": {
35
35
  width: ".75em !important",
36
- height: ".75em !important"
36
+ height: ".75em !important",
37
+ color: "#1e498c"
37
38
  }
38
39
  }),
39
40
  title: title,
@@ -60,7 +60,8 @@ const PuiSearchPage = _ref2 => {
60
60
  onRetour,
61
61
  onReset,
62
62
  onSubmit,
63
- children: _children
63
+ children: _children,
64
+ additionalActions
64
65
  } = _ref2;
65
66
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
66
67
  title: title,
@@ -144,7 +145,16 @@ const PuiSearchPage = _ref2 => {
144
145
  loadingPosition: "start",
145
146
  children: "Rechercher"
146
147
  })
147
- })]
148
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
149
+ item: true,
150
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
151
+ color: "primary",
152
+ startIcon: actionItem.icon,
153
+ onClick: actionItem.action,
154
+ loadingPosition: "start",
155
+ children: actionItem.name
156
+ })
157
+ }, index))]
148
158
  }),
149
159
  children: _children
150
160
  })
@@ -167,7 +177,12 @@ PuiSearchPage.propTypes = {
167
177
  retour: _propTypes.default.bool,
168
178
  onRetour: _propTypes.default.func,
169
179
  onReset: _propTypes.default.func,
170
- onSubmit: _propTypes.default.func
180
+ onSubmit: _propTypes.default.func,
181
+ additionalActions: _propTypes.default.arrayOf(_propTypes.default.shape({
182
+ name: _propTypes.default.string.isRequired,
183
+ action: _propTypes.default.func.isRequired,
184
+ iconType: _propTypes.default.string
185
+ }))
171
186
  };
172
187
  PuiSearchPage.defaultProps = {
173
188
  formik: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",