@movalib/movalib-commons 1.1.30 → 1.1.31

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.
@@ -1,4 +1,5 @@
1
1
  import React, { FunctionComponent } from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
2
3
  interface ConfirmationDialogProps {
3
4
  open: boolean;
4
5
  onClose: () => void;
@@ -8,6 +9,7 @@ interface ConfirmationDialogProps {
8
9
  closeLabel?: string;
9
10
  title?: React.ReactNode;
10
11
  message?: React.ReactNode;
12
+ sx?: SxProps<Theme>;
11
13
  }
12
14
  declare const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps>;
13
15
  export default ConfirmationDialog;
@@ -24,13 +24,13 @@ var Button_1 = __importDefault(require("@mui/material/Button"));
24
24
  var material_1 = require("@mui/material");
25
25
  var Tools_1 = require("./helpers/Tools");
26
26
  var ConfirmationDialog = function (_a) {
27
- var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel;
27
+ var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel, sx = _a.sx;
28
28
  var theme = (0, material_1.useTheme)();
29
29
  var defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
30
30
  var defaultTitle = "Confirmation";
31
31
  var defaultConfirmLabel = "Oui";
32
32
  var defaultCloseLabel = "Non";
33
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, { children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: "alert-dialog-title", sx: {
33
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", sx: __assign({}, sx) }, { children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: "alert-dialog-title", sx: {
34
34
  backgroundColor: theme.palette.grey[200]
35
35
  }, style: Tools_1.flexLeftRow }, { children: title || defaultTitle })), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, __assign({ sx: { textAlign: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(DialogContentText_1.default, __assign({ id: "alert-dialog-description", sx: { pt: 2 } }, { children: message || defaultMessage })), (0, jsx_runtime_1.jsx)(DialogContent_1.default, {})] })), (0, jsx_runtime_1.jsxs)(DialogActions_1.default, __assign({ sx: {
36
36
  py: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.1.30",
3
+ "version": "1.1.31",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5,7 +5,7 @@ import DialogContent from '@mui/material/DialogContent';
5
5
  import DialogContentText from '@mui/material/DialogContentText';
6
6
  import DialogTitle from '@mui/material/DialogTitle';
7
7
  import Button from '@mui/material/Button';
8
- import { useTheme } from '@mui/material';
8
+ import { SxProps, Theme, useTheme } from '@mui/material';
9
9
  import { flexLeftRow } from './helpers/Tools';
10
10
 
11
11
  interface ConfirmationDialogProps {
@@ -17,10 +17,11 @@ interface ConfirmationDialogProps {
17
17
  closeLabel?: string;
18
18
  title?: React.ReactNode;
19
19
  message?: React.ReactNode;
20
+ sx?: SxProps<Theme>;
20
21
  }
21
22
 
22
23
  const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open, onClose, onConfirm, title, message, showConfirm = true,
23
- confirmLabel, closeLabel }) => {
24
+ confirmLabel, closeLabel, sx }) => {
24
25
 
25
26
  const theme = useTheme();
26
27
  const defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
@@ -34,6 +35,7 @@ const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open,
34
35
  onClose={onClose}
35
36
  aria-labelledby="alert-dialog-title"
36
37
  aria-describedby="alert-dialog-description"
38
+ sx={{ ...sx }}
37
39
  >
38
40
  <DialogTitle id="alert-dialog-title" sx={{
39
41
  backgroundColor: theme.palette.grey[200]