cloudmr-ux 1.0.8 → 1.0.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/dist/index.d.ts CHANGED
@@ -171,6 +171,20 @@ declare function CmrNameDialog(props: {
171
171
  setOpen: (open: boolean) => void;
172
172
  }): react_jsx_runtime.JSX.Element;
173
173
 
174
+ declare function CmrConfirmation({ name, message, cancelText, color, open, setOpen, confirmCallback, confirmText, cancellable, cancelCallback, width }: {
175
+ name: string | undefined;
176
+ cancelText?: string;
177
+ message: string | undefined;
178
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | undefined;
179
+ open: boolean;
180
+ setOpen: (open: boolean) => void;
181
+ confirmCallback?: () => void;
182
+ cancellable?: boolean;
183
+ cancelCallback?: () => void;
184
+ width?: number;
185
+ confirmText?: string;
186
+ }): react_jsx_runtime.JSX.Element;
187
+
174
188
  interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
175
189
  dataSource: any[];
176
190
  idAlias?: string;
@@ -181,4 +195,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
181
195
 
182
196
  declare const CmrTable: FC<CmrTableProps>;
183
197
 
184
- export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, LambdaFile };
198
+ export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, LambdaFile };
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(src_exports, {
34
34
  CmrButton: () => CmrButton,
35
35
  CmrCheckbox: () => CmrCheckbox,
36
36
  CmrCollapse: () => Collapse_default,
37
+ CmrConfirmation: () => CmrConfirmation,
37
38
  CmrInput: () => CmrInput,
38
39
  CmrNameDialog: () => CmrNameDialog,
39
40
  CmrPanel: () => Panel_default,
@@ -848,9 +849,56 @@ function CmrNameDialog(props) {
848
849
  ) });
849
850
  }
850
851
 
852
+ // src/CmrComponents/dialogue/Confirmation.tsx
853
+ var React7 = __toESM(require("react"));
854
+ var import_Dialog3 = __toESM(require("@mui/material/Dialog"));
855
+ var import_DialogActions3 = __toESM(require("@mui/material/DialogActions"));
856
+ var import_DialogContent3 = __toESM(require("@mui/material/DialogContent"));
857
+ var import_DialogContentText2 = __toESM(require("@mui/material/DialogContentText"));
858
+ var import_DialogTitle3 = __toESM(require("@mui/material/DialogTitle"));
859
+ var import_jsx_runtime12 = require("react/jsx-runtime");
860
+ function CmrConfirmation({
861
+ name,
862
+ message,
863
+ cancelText = "Cancel",
864
+ color,
865
+ open,
866
+ setOpen,
867
+ confirmCallback = () => {
868
+ },
869
+ confirmText = "Confirm",
870
+ cancellable = false,
871
+ cancelCallback = () => {
872
+ },
873
+ width
874
+ }) {
875
+ const [text, setText] = React7.useState("");
876
+ const handleClose = () => {
877
+ setOpen(false);
878
+ };
879
+ const handleConfirm = () => {
880
+ confirmCallback();
881
+ handleClose();
882
+ };
883
+ const handleCancel = () => {
884
+ cancelCallback();
885
+ handleClose();
886
+ };
887
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_Dialog3.default, { open, onClose: handleClose, children: [
888
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_DialogTitle3.default, { children: name ? name : "Confirmation" }),
889
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_DialogContent3.default, { sx: { width }, children: [
890
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_DialogContentText2.default, { alignContent: "center", children: message }),
891
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_DialogActions3.default, { className: "mt-4", children: [
892
+ cancellable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CmrButton, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: cancelText }),
893
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CmrButton, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
894
+ ] })
895
+ ] })
896
+ ] });
897
+ }
898
+
851
899
  // src/CmrTable/CmrTable.tsx
852
900
  var import_x_data_grid = require("@mui/x-data-grid");
853
- var import_jsx_runtime12 = require("react/jsx-runtime");
901
+ var import_jsx_runtime13 = require("react/jsx-runtime");
854
902
  var CmrTable = (props) => {
855
903
  const {
856
904
  dataSource,
@@ -862,7 +910,7 @@ var CmrTable = (props) => {
862
910
  showCheckbox = true,
863
911
  ...rest
864
912
  } = props;
865
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
913
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
866
914
  import_x_data_grid.DataGrid,
867
915
  {
868
916
  rows: dataSource ? dataSource.map((row) => ({
@@ -892,6 +940,7 @@ var CmrTable2 = CmrTable_default;
892
940
  CmrButton,
893
941
  CmrCheckbox,
894
942
  CmrCollapse,
943
+ CmrConfirmation,
895
944
  CmrInput,
896
945
  CmrNameDialog,
897
946
  CmrPanel,
package/dist/index.mjs CHANGED
@@ -809,9 +809,56 @@ function CmrNameDialog(props) {
809
809
  ) });
810
810
  }
811
811
 
812
+ // src/CmrComponents/dialogue/Confirmation.tsx
813
+ import * as React7 from "react";
814
+ import Dialog3 from "@mui/material/Dialog";
815
+ import DialogActions3 from "@mui/material/DialogActions";
816
+ import DialogContent3 from "@mui/material/DialogContent";
817
+ import DialogContentText2 from "@mui/material/DialogContentText";
818
+ import DialogTitle3 from "@mui/material/DialogTitle";
819
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
820
+ function CmrConfirmation({
821
+ name,
822
+ message,
823
+ cancelText = "Cancel",
824
+ color,
825
+ open,
826
+ setOpen,
827
+ confirmCallback = () => {
828
+ },
829
+ confirmText = "Confirm",
830
+ cancellable = false,
831
+ cancelCallback = () => {
832
+ },
833
+ width
834
+ }) {
835
+ const [text, setText] = React7.useState("");
836
+ const handleClose = () => {
837
+ setOpen(false);
838
+ };
839
+ const handleConfirm = () => {
840
+ confirmCallback();
841
+ handleClose();
842
+ };
843
+ const handleCancel = () => {
844
+ cancelCallback();
845
+ handleClose();
846
+ };
847
+ return /* @__PURE__ */ jsxs8(Dialog3, { open, onClose: handleClose, children: [
848
+ /* @__PURE__ */ jsx12(DialogTitle3, { children: name ? name : "Confirmation" }),
849
+ /* @__PURE__ */ jsxs8(DialogContent3, { sx: { width }, children: [
850
+ /* @__PURE__ */ jsx12(DialogContentText2, { alignContent: "center", children: message }),
851
+ /* @__PURE__ */ jsxs8(DialogActions3, { className: "mt-4", children: [
852
+ cancellable && /* @__PURE__ */ jsx12(CmrButton, { variant: "outlined", color: "inherit", sx: { color: "#333" }, onClick: handleCancel, children: cancelText }),
853
+ /* @__PURE__ */ jsx12(CmrButton, { variant: "contained", color, onClick: handleConfirm, children: confirmText })
854
+ ] })
855
+ ] })
856
+ ] });
857
+ }
858
+
812
859
  // src/CmrTable/CmrTable.tsx
813
860
  import { DataGrid } from "@mui/x-data-grid";
814
- import { jsx as jsx12 } from "react/jsx-runtime";
861
+ import { jsx as jsx13 } from "react/jsx-runtime";
815
862
  var CmrTable = (props) => {
816
863
  const {
817
864
  dataSource,
@@ -823,7 +870,7 @@ var CmrTable = (props) => {
823
870
  showCheckbox = true,
824
871
  ...rest
825
872
  } = props;
826
- return /* @__PURE__ */ jsx12("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx12(
873
+ return /* @__PURE__ */ jsx13("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx13(
827
874
  DataGrid,
828
875
  {
829
876
  rows: dataSource ? dataSource.map((row) => ({
@@ -852,6 +899,7 @@ export {
852
899
  CmrButton,
853
900
  CmrCheckbox,
854
901
  Collapse_default as CmrCollapse,
902
+ CmrConfirmation,
855
903
  CmrInput,
856
904
  CmrNameDialog,
857
905
  Panel_default as CmrPanel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",