@portnet/ui 2.0.7 → 2.0.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.
@@ -21,7 +21,7 @@ var _antd = require("antd");
21
21
  var _icons = require("@ant-design/icons");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["field", "headerName", "width", "renderCell", "sortable", "align"],
24
- _excluded2 = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "stickyColumns", "pinnedColumns", "getRowId", "onSelectionModelChange", "selectionModel", "onRowClick", "highlightHoveredRow", "stickyHeader", "hideFooter", "hideFooterPagination", "components", "componentsProps", "getRowClassName", "onActionClick"];
24
+ _excluded2 = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "load", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "stickyColumns", "pinnedColumns", "getRowId", "onSelectionModelChange", "selectionModel", "onRowClick", "highlightHoveredRow", "stickyHeader", "hideFooter", "hideFooterPagination", "components", "componentsProps", "getRowClassName", "onActionClick", "rowHeight"];
25
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); }
26
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
27
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -32,7 +32,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
32
32
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
33
33
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
34
34
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Styles personnalisés pour le tableau
35
- const tableCustomStyles = "\n /* Styles g\xE9n\xE9raux du tableau - inspir\xE9 du design de r\xE9f\xE9rence */\n .pui-table {\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n }\n \n .pui-table .ant-table {\n border-radius: 8px;\n }\n \n /* En-t\xEAtes de colonnes */\n .pui-table .ant-table-thead > tr > th {\n background-color: #f9fafb;\n color: #374151;\n font-weight: 600;\n font-size: 0.875rem;\n padding: 12px 16px;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s;\n }\n \n .pui-table .ant-table-thead > tr > th:hover {\n background-color: #f3f4f6;\n }\n \n /* Cellules du tableau */\n .pui-table .ant-table-tbody > tr > td {\n padding: 12px 16px;\n border-bottom: 1px solid #f3f4f6;\n color: #111827;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n }\n \n /* Lignes altern\xE9es */\n .pui-table .ant-table-tbody > tr:nth-child(even) > td {\n background-color: #f9fafb;\n }\n \n .pui-table .ant-table-tbody > tr:nth-child(odd) > td {\n background-color: #ffffff;\n }\n \n /* Effet de survol */\n .pui-table .ant-table-tbody > tr:hover > td {\n background-color: #f3f4f6 !important;\n }\n \n /* Styles des lignes s\xE9lectionn\xE9es */\n .pui-table .ant-table-tbody > tr.ant-table-row-selected > td {\n background-color: rgba(59, 130, 246, 0.05);\n }\n \n .pui-table .ant-table-tbody > tr.ant-table-row-selected:hover > td {\n background-color: rgba(59, 130, 246, 0.1) !important;\n }\n \n /* Styles des statuts */\n .pui-table .status-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1.5;\n }\n \n .pui-table .status-badge.cancelled {\n background-color: #fee2e2;\n color: #b91c1c;\n }\n \n .pui-table .status-badge.delivered {\n background-color: #dcfce7;\n color: #15803d;\n }\n \n .pui-table .status-badge.ready {\n background-color: #e0f2fe;\n color: #0369a1;\n }\n \n .pui-table .status-badge.on-the-way {\n background-color: #fef3c7;\n color: #92400e;\n }\n \n /* Pagination */\n .pui-table-pagination {\n padding: 12px 16px;\n border-top: 1px solid #f3f4f6;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n \n .pui-table-pagination .ant-pagination {\n margin: 0;\n }\n \n .pui-table-pagination .ant-pagination-item,\n .pui-table-pagination .ant-pagination-prev button,\n .pui-table-pagination .ant-pagination-next button {\n border-radius: 6px;\n border: 1px solid #e5e7eb;\n height: 32px;\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .pui-table-pagination .ant-pagination-item:hover,\n .pui-table-pagination .ant-pagination-prev:hover button,\n .pui-table-pagination .ant-pagination-next:hover button {\n border-color: #d1d5db;\n color: #4b5563;\n }\n \n .pui-table-pagination .ant-pagination-item-active {\n background-color: #3b82f6;\n border-color: #3b82f6;\n }\n \n .pui-table-pagination .ant-pagination-item-active a {\n color: white;\n }\n \n .pui-table-pagination .ant-pagination-item-active:hover {\n background-color: #2563eb;\n border-color: #2563eb;\n }\n \n /* Styles pour la colonne d'actions */\n .pui-table .actions-column {\n white-space: nowrap !important;\n overflow: visible !important;\n }\n \n .pui-table .action-button {\n padding: 4px 8px !important;\n margin: 0 2px !important;\n min-width: auto !important;\n height: 28px !important;\n line-height: 20px !important;\n transition: all 0.2s !important;\n }\n \n .pui-table .action-button:hover {\n background-color: rgba(24, 144, 255, 0.1) !important;\n color: #1890ff !important;\n }\n \n /* Bouton Cr\xE9er */\n .pui-create-button {\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 8px 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: all 0.2s;\n }\n \n .pui-create-button:hover {\n background-color: #2563eb;\n }\n \n /* Titre de la page */\n .pui-table-title {\n font-size: 1.5rem;\n font-weight: 600;\n color: #111827;\n margin-bottom: 16px;\n }\n";
35
+ const tableCustomStyles = "\n /* Styles g\xE9n\xE9raux du tableau - inspir\xE9 du design de r\xE9f\xE9rence */\n .pui-table {\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n }\n \n .pui-table .ant-table {\n border-radius: 8px;\n }\n \n /* En-t\xEAtes de colonnes */\n .pui-table .ant-table-thead > tr > th {\n background-color: #f9fafb;\n color: #374151;\n font-weight: 600;\n font-size: 0.875rem;\n padding: 12px 16px;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s;\n }\n \n .pui-table .ant-table-thead > tr > th:hover {\n background-color: #f3f4f6;\n }\n \n /* Cellules du tableau */\n .pui-table .ant-table-tbody > tr > td {\n padding: 12px 16px;\n border-bottom: 1px solid #f3f4f6;\n color: #111827;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n white-space: normal !important;\n word-wrap: break-word !important;\n word-break: break-word !important;\n max-width: 300px;\n overflow: visible;\n line-height: 1.5;\n }\n \n /* Lignes altern\xE9es */\n .pui-table .ant-table-tbody > tr:nth-child(even) > td {\n background-color: #f9fafb;\n }\n \n .pui-table .ant-table-tbody > tr:nth-child(odd) > td {\n background-color: #ffffff;\n }\n \n /* Effet de survol */\n .pui-table .ant-table-tbody > tr:hover > td {\n background-color: #f3f4f6 !important;\n }\n \n /* Styles des lignes s\xE9lectionn\xE9es */\n .pui-table .ant-table-tbody > tr.ant-table-row-selected > td {\n background-color: rgba(59, 130, 246, 0.05);\n }\n \n .pui-table .ant-table-tbody > tr.ant-table-row-selected:hover > td {\n background-color: rgba(59, 130, 246, 0.1) !important;\n }\n \n /* Styles des statuts */\n .pui-table .status-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1.5;\n }\n \n .pui-table .status-badge.cancelled {\n background-color: #fee2e2;\n color: #b91c1c;\n }\n \n .pui-table .status-badge.delivered {\n background-color: #dcfce7;\n color: #15803d;\n }\n \n .pui-table .status-badge.ready {\n background-color: #e0f2fe;\n color: #0369a1;\n }\n \n .pui-table .status-badge.on-the-way {\n background-color: #fef3c7;\n color: #92400e;\n }\n \n /* Pagination */\n .pui-table-pagination {\n padding: 12px 16px;\n border-top: 1px solid #f3f4f6;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n \n .pui-table-pagination .ant-pagination {\n margin: 0;\n }\n \n .pui-table-pagination .ant-pagination-item,\n .pui-table-pagination .ant-pagination-prev button,\n .pui-table-pagination .ant-pagination-next button {\n border-radius: 6px;\n border: 1px solid #e5e7eb;\n height: 32px;\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .pui-table-pagination .ant-pagination-item:hover,\n .pui-table-pagination .ant-pagination-prev:hover button,\n .pui-table-pagination .ant-pagination-next:hover button {\n border-color: #d1d5db;\n color: #4b5563;\n }\n \n .pui-table-pagination .ant-pagination-item-active {\n background-color: #3b82f6;\n border-color: #3b82f6;\n }\n \n .pui-table-pagination .ant-pagination-item-active a {\n color: white;\n }\n \n .pui-table-pagination .ant-pagination-item-active:hover {\n background-color: #2563eb;\n border-color: #2563eb;\n }\n \n /* Styles pour la colonne d'actions */\n .pui-table .actions-column {\n white-space: nowrap !important;\n overflow: visible !important;\n }\n \n .pui-table .action-button {\n padding: 4px 8px !important;\n margin: 0 2px !important;\n min-width: auto !important;\n height: 28px !important;\n line-height: 20px !important;\n transition: all 0.2s !important;\n }\n \n .pui-table .action-button:hover {\n background-color: rgba(24, 144, 255, 0.1) !important;\n color: #1890ff !important;\n }\n \n /* Bouton Cr\xE9er */\n .pui-create-button {\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 8px 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: all 0.2s;\n }\n \n .pui-create-button:hover {\n background-color: #2563eb;\n }\n \n /* Titre de la page */\n .pui-table-title {\n font-size: 1.5rem;\n font-weight: 600;\n color: #111827;\n margin-bottom: 16px;\n }\n";
36
36
 
37
37
  // Injection des styles dans le document
38
38
  const injectStyles = () => {
@@ -171,6 +171,33 @@ const convertColumns = (columns, onActionClick, actions) => {
171
171
  align
172
172
  } = column,
173
173
  rest = _objectWithoutProperties(column, _excluded);
174
+
175
+ // Fonction de rendu par défaut pour gérer les textes longs
176
+ const defaultRender = (text, record) => {
177
+ if (text === null || text === undefined) return "-";
178
+ const textStr = String(text);
179
+ const shouldShowTooltip = textStr.length > 30;
180
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
181
+ title: shouldShowTooltip ? textStr : "",
182
+ placement: "topLeft",
183
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
+ style: {
185
+ whiteSpace: 'normal',
186
+ wordWrap: 'break-word',
187
+ wordBreak: 'break-word',
188
+ overflow: 'hidden',
189
+ textOverflow: 'ellipsis',
190
+ lineHeight: '1.5',
191
+ maxHeight: '4.5em',
192
+ // Environ 3 lignes
193
+ display: '-webkit-box',
194
+ WebkitLineClamp: 3,
195
+ WebkitBoxOrient: 'vertical'
196
+ },
197
+ children: textStr
198
+ })
199
+ });
200
+ };
174
201
  return _objectSpread({
175
202
  title: headerName,
176
203
  dataIndex: field,
@@ -181,7 +208,7 @@ const convertColumns = (columns, onActionClick, actions) => {
181
208
  render: renderCell ? (text, record) => renderCell({
182
209
  row: record,
183
210
  value: text
184
- }) : undefined
211
+ }) : defaultRender
185
212
  }, rest);
186
213
  });
187
214
 
@@ -377,6 +404,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
377
404
  pageSize,
378
405
  checkboxSelection,
379
406
  loading,
407
+ load,
380
408
  stripped,
381
409
  actions,
382
410
  oneActionOnly,
@@ -396,7 +424,8 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
396
424
  components,
397
425
  componentsProps,
398
426
  getRowClassName,
399
- onActionClick
427
+ onActionClick,
428
+ rowHeight = 'auto'
400
429
  } = _ref3,
401
430
  rest = _objectWithoutProperties(_ref3, _excluded2);
402
431
  // Convertir les colonnes au format Ant Design
@@ -448,6 +477,12 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
448
477
  boxShadow: '0 2px 8px rgba(0,0,0,0.07)'
449
478
  } : {}), sx || {});
450
479
 
480
+ // Style pour les lignes du tableau
481
+ const rowStyle = {
482
+ height: rowHeight,
483
+ minHeight: rowHeight === 'auto' ? '60px' : rowHeight
484
+ };
485
+
451
486
  // Injection des styles CSS personnalisés
452
487
  React.useEffect(() => {
453
488
  injectStyles();
@@ -508,7 +543,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
508
543
  }
509
544
  },
510
545
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Spin, {
511
- spinning: loading,
546
+ spinning: loading || load,
512
547
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Table, _objectSpread({
513
548
  ref: ref,
514
549
  id: id,
@@ -530,7 +565,9 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
530
565
  if (record.isEditing) className += ' ant-table-row-editing';
531
566
  return className;
532
567
  },
533
- onRow: getRowProps
568
+ onRow: record => _objectSpread(_objectSpread({}, getRowProps(record)), {}, {
569
+ style: rowStyle
570
+ })
534
571
  }, rest)), !hideFooter && !hideFooterPagination && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
535
572
  className: "pui-table-pagination",
536
573
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiTablePagination, {
@@ -569,6 +606,7 @@ PuiTable.propTypes = {
569
606
  checkboxSelection: _propTypes.default.bool,
570
607
  paginationMode: _propTypes.default.oneOf(["client", "server", "none"]),
571
608
  loading: _propTypes.default.bool,
609
+ load: _propTypes.default.bool,
572
610
  onSelect: _propTypes.default.func,
573
611
  onPageChange: _propTypes.default.func,
574
612
  onPageSizeChange: _propTypes.default.func,
@@ -585,7 +623,8 @@ PuiTable.propTypes = {
585
623
  components: _propTypes.default.object,
586
624
  componentsProps: _propTypes.default.object,
587
625
  getRowClassName: _propTypes.default.func,
588
- onActionClick: _propTypes.default.func
626
+ onActionClick: _propTypes.default.func,
627
+ rowHeight: _propTypes.default.string
589
628
  };
590
629
  PuiTable.defaultProps = {
591
630
  oneActionOnly: false,
@@ -608,7 +647,10 @@ PuiTable.defaultProps = {
608
647
  components: null,
609
648
  componentsProps: null,
610
649
  getRowClassName: null,
611
- onActionClick: null
650
+ onActionClick: null,
651
+ rowHeight: 'auto',
652
+ loading: false,
653
+ load: false
612
654
  };
613
655
 
614
656
  // Composant pour l'en-tête de la table avec titre et bouton de création
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/esnext.iterator.filter.js");
4
+ require("core-js/modules/esnext.iterator.for-each.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ require("core-js/modules/esnext.iterator.constructor.js");
10
+ require("core-js/modules/esnext.iterator.map.js");
11
+ require("core-js/modules/web.dom-collections.iterator.js");
12
+ var _react = _interopRequireDefault(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _styles = require("@mui/material/styles");
15
+ var _material = require("@mui/material");
16
+ var _iconsMaterial = require("@mui/icons-material");
17
+ var _apperance = require("../../../config/apperance");
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ const _excluded = ["title", "userName", "avatarSrc", "onLogout", "onSettingsClick", "onProfileClick", "notificationsCount", "onNotificationsClick"]; // AppBar stylisée
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
24
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
25
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
27
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
28
+ const StyledAppBar = (0, _styles.styled)(_material.AppBar)(_ref => {
29
+ let {
30
+ theme
31
+ } = _ref;
32
+ return {
33
+ backgroundColor: _apperance.palette.white,
34
+ color: _apperance.palette.gray.darker,
35
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.05)',
36
+ position: 'fixed',
37
+ zIndex: 1100,
38
+ width: 'calc(100% - 280px)',
39
+ // Ajuster selon la largeur de la sidebar (280px)
40
+ marginLeft: '280px'
41
+ };
42
+ });
43
+
44
+ // Toolbar stylisée
45
+ const StyledToolbar = (0, _styles.styled)(_material.Toolbar)({
46
+ display: 'flex',
47
+ justifyContent: 'space-between',
48
+ height: '64px',
49
+ padding: '0 16px'
50
+ });
51
+
52
+ // Conteneur pour les actions à droite
53
+ const ActionContainer = (0, _styles.styled)(_material.Box)({
54
+ display: 'flex',
55
+ alignItems: 'center',
56
+ gap: '8px'
57
+ });
58
+
59
+ // Icône stylisée
60
+ const StyledIconButton = (0, _styles.styled)(_material.IconButton)({
61
+ color: _apperance.palette.gray.dark,
62
+ transition: 'all 0.2s ease',
63
+ '&:hover': {
64
+ color: _apperance.palette.primary,
65
+ backgroundColor: "".concat(_apperance.palette.primary, "10")
66
+ }
67
+ });
68
+
69
+ // Avatar stylisé
70
+ const StyledAvatar = (0, _styles.styled)(_material.Avatar)({
71
+ cursor: 'pointer',
72
+ width: 40,
73
+ height: 40,
74
+ transition: 'all 0.2s ease',
75
+ border: "2px solid transparent",
76
+ '&:hover': {
77
+ borderColor: _apperance.palette.primary
78
+ }
79
+ });
80
+
81
+ // Menu stylisé
82
+ const StyledMenu = (0, _styles.styled)(_material.Menu)({
83
+ '& .MuiPaper-root': {
84
+ borderRadius: '8px',
85
+ boxShadow: '0 4px 20px rgba(0, 0, 0, 0.1)',
86
+ overflow: 'hidden'
87
+ },
88
+ '& .MuiMenuItem-root': {
89
+ padding: '10px 16px',
90
+ fontSize: '0.9rem',
91
+ transition: 'all 0.2s ease',
92
+ '&:hover': {
93
+ backgroundColor: "".concat(_apperance.palette.primary, "10")
94
+ }
95
+ }
96
+ });
97
+
98
+ /**
99
+ * Composant Header - En-tête de l'application avec avatar en haut à droite
100
+ */
101
+ const Header = _ref2 => {
102
+ let {
103
+ title,
104
+ userName,
105
+ avatarSrc,
106
+ onLogout,
107
+ onSettingsClick,
108
+ onProfileClick,
109
+ notificationsCount = 0,
110
+ onNotificationsClick
111
+ } = _ref2,
112
+ props = _objectWithoutProperties(_ref2, _excluded);
113
+ const [anchorEl, setAnchorEl] = _react.default.useState(null);
114
+ const open = Boolean(anchorEl);
115
+ const handleAvatarClick = event => {
116
+ setAnchorEl(event.currentTarget);
117
+ };
118
+ const handleClose = () => {
119
+ setAnchorEl(null);
120
+ };
121
+ const handleProfileClick = () => {
122
+ if (onProfileClick) {
123
+ onProfileClick();
124
+ }
125
+ handleClose();
126
+ };
127
+ const handleSettingsClick = () => {
128
+ if (onSettingsClick) {
129
+ onSettingsClick();
130
+ }
131
+ handleClose();
132
+ };
133
+ const handleLogoutClick = () => {
134
+ if (onLogout) {
135
+ onLogout();
136
+ }
137
+ handleClose();
138
+ };
139
+
140
+ // Génération des initiales pour l'avatar si pas d'image
141
+ const getInitials = name => {
142
+ if (!name) return 'U';
143
+ return name.split(' ').map(part => part[0]).join('').toUpperCase().substring(0, 2);
144
+ };
145
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledAppBar, _objectSpread(_objectSpread({}, props), {}, {
146
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledToolbar, {
147
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
148
+ variant: "h6",
149
+ fontWeight: "bold",
150
+ children: title
151
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ActionContainer, {
152
+ children: [onNotificationsClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
153
+ onClick: onNotificationsClick,
154
+ title: "Notifications",
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Badge, {
156
+ badgeContent: notificationsCount,
157
+ color: "error",
158
+ max: 99,
159
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Notifications, {})
160
+ })
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledAvatar, {
162
+ src: avatarSrc,
163
+ alt: userName || 'Utilisateur',
164
+ onClick: handleAvatarClick,
165
+ "aria-controls": open ? 'user-menu' : undefined,
166
+ "aria-haspopup": "true",
167
+ "aria-expanded": open ? 'true' : undefined,
168
+ children: !avatarSrc && getInitials(userName)
169
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMenu, {
170
+ id: "user-menu",
171
+ anchorEl: anchorEl,
172
+ open: open,
173
+ onClose: handleClose,
174
+ MenuListProps: {
175
+ 'aria-labelledby': 'avatar-button'
176
+ },
177
+ anchorOrigin: {
178
+ vertical: 'bottom',
179
+ horizontal: 'right'
180
+ },
181
+ transformOrigin: {
182
+ vertical: 'top',
183
+ horizontal: 'right'
184
+ },
185
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
186
+ sx: {
187
+ px: 2,
188
+ py: 1
189
+ },
190
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
191
+ variant: "subtitle1",
192
+ fontWeight: "bold",
193
+ children: userName || 'Utilisateur'
194
+ })
195
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
196
+ onClick: handleProfileClick,
197
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
198
+ display: "flex",
199
+ alignItems: "center",
200
+ gap: 1,
201
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
202
+ sx: {
203
+ width: 24,
204
+ height: 24
205
+ },
206
+ src: avatarSrc,
207
+ children: !avatarSrc && getInitials(userName)
208
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
209
+ children: "Profil"
210
+ })]
211
+ })
212
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
213
+ onClick: handleSettingsClick,
214
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
215
+ display: "flex",
216
+ alignItems: "center",
217
+ gap: 1,
218
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Settings, {
219
+ fontSize: "small"
220
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
221
+ children: "Param\xE8tres"
222
+ })]
223
+ })
224
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
225
+ onClick: handleLogoutClick,
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
227
+ display: "flex",
228
+ alignItems: "center",
229
+ gap: 1,
230
+ color: "error.main",
231
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.ExitToApp, {
232
+ fontSize: "small"
233
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
234
+ children: "D\xE9connexion"
235
+ })]
236
+ })
237
+ })]
238
+ })]
239
+ })]
240
+ })
241
+ }));
242
+ };
243
+ Header.propTypes = {
244
+ title: _propTypes.default.string,
245
+ userName: _propTypes.default.string,
246
+ avatarSrc: _propTypes.default.string,
247
+ onLogout: _propTypes.default.func,
248
+ onSettingsClick: _propTypes.default.func,
249
+ onProfileClick: _propTypes.default.func,
250
+ notificationsCount: _propTypes.default.number,
251
+ onNotificationsClick: _propTypes.default.func
252
+ };
253
+ var _default = exports.default = Header;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/esnext.iterator.constructor.js");
4
+ require("core-js/modules/esnext.iterator.filter.js");
5
+ require("core-js/modules/esnext.iterator.for-each.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = void 0;
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _styles = require("@mui/material/styles");
13
+ var _material = require("@mui/material");
14
+ var _Sidebar = _interopRequireDefault(require("./Sidebar"));
15
+ var _Header = _interopRequireDefault(require("./Header"));
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ const _excluded = ["children", "title", "userName", "userRole", "avatarSrc", "logoUrl", "appName", "menuItems", "activeMenuId", "onLogout", "onSettingsClick", "onProfileClick", "notificationsCount", "onNotificationsClick"]; // Conteneur principal
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
25
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
26
+ const MainContainer = (0, _styles.styled)(_material.Box)({
27
+ display: 'flex'
28
+ });
29
+
30
+ // Conteneur du contenu
31
+ const ContentContainer = (0, _styles.styled)(_material.Box)({
32
+ marginLeft: '280px',
33
+ // Doit correspondre à la largeur de la Sidebar
34
+ marginTop: '64px',
35
+ // Doit correspondre à la hauteur du Header
36
+ width: 'calc(100% - 280px)',
37
+ minHeight: 'calc(100vh - 64px)',
38
+ padding: '24px',
39
+ backgroundColor: '#f9fafb',
40
+ // Fond légèrement grisé pour le contenu
41
+ boxSizing: 'border-box'
42
+ });
43
+
44
+ /**
45
+ * Composant Layout - Structure principale de l'application
46
+ */
47
+ const Layout = _ref => {
48
+ let {
49
+ children,
50
+ title,
51
+ userName,
52
+ userRole,
53
+ avatarSrc,
54
+ logoUrl,
55
+ appName,
56
+ menuItems,
57
+ activeMenuId,
58
+ onLogout,
59
+ onSettingsClick,
60
+ onProfileClick,
61
+ notificationsCount,
62
+ onNotificationsClick
63
+ } = _ref,
64
+ props = _objectWithoutProperties(_ref, _excluded);
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(MainContainer, _objectSpread(_objectSpread({}, props), {}, {
66
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Sidebar.default, {
67
+ items: menuItems,
68
+ logoUrl: logoUrl,
69
+ appName: appName,
70
+ userName: userName,
71
+ userRole: userRole,
72
+ onLogout: onLogout,
73
+ activeItemId: activeMenuId
74
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Header.default, {
75
+ title: title,
76
+ userName: userName,
77
+ avatarSrc: avatarSrc,
78
+ onLogout: onLogout,
79
+ onSettingsClick: onSettingsClick,
80
+ onProfileClick: onProfileClick,
81
+ notificationsCount: notificationsCount,
82
+ onNotificationsClick: onNotificationsClick
83
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ContentContainer, {
84
+ children: children
85
+ })]
86
+ }));
87
+ };
88
+ Layout.propTypes = {
89
+ children: _propTypes.default.node,
90
+ title: _propTypes.default.string,
91
+ userName: _propTypes.default.string,
92
+ userRole: _propTypes.default.string,
93
+ avatarSrc: _propTypes.default.string,
94
+ logoUrl: _propTypes.default.string,
95
+ appName: _propTypes.default.string,
96
+ menuItems: _propTypes.default.array,
97
+ activeMenuId: _propTypes.default.string,
98
+ onLogout: _propTypes.default.func,
99
+ onSettingsClick: _propTypes.default.func,
100
+ onProfileClick: _propTypes.default.func,
101
+ notificationsCount: _propTypes.default.number,
102
+ onNotificationsClick: _propTypes.default.func
103
+ };
104
+ var _default = exports.default = Layout;