cloudmr-ux 1.1.1 → 1.1.2

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
@@ -173,6 +173,11 @@ declare function CmrConfirmation({ name, message, cancelText, color, open, setOp
173
173
  confirmText?: string;
174
174
  }): react_jsx_runtime.JSX.Element;
175
175
 
176
+ declare function CmrDeletionDialog(props: {
177
+ name: string | undefined;
178
+ deletionCallback: () => void;
179
+ }): react_jsx_runtime.JSX.Element;
180
+
176
181
  interface TabInfo {
177
182
  id: number;
178
183
  text: string;
@@ -209,4 +214,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
209
214
 
210
215
  declare const CmrTable: FC<CmrTableProps>;
211
216
 
212
- export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
217
+ export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrDeletionDialog, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(src_exports, {
35
35
  CmrCheckbox: () => Checkbox_default,
36
36
  CmrCollapse: () => Collapse_default,
37
37
  CmrConfirmation: () => CmrConfirmation,
38
+ CmrDeletionDialog: () => CmrDeletionDialog,
38
39
  CmrInput: () => CmrInput,
39
40
  CmrNameDialog: () => CmrNameDialog,
40
41
  CmrPanel: () => Panel_default,
@@ -875,18 +876,71 @@ function CmrConfirmation({
875
876
  ] });
876
877
  }
877
878
 
878
- // src/CmrTabs/CmrTabs.tsx
879
+ // src/CmrComponents/dialogue/DeletionDialog.tsx
879
880
  var React8 = __toESM(require("react"));
881
+ var import_TextField3 = __toESM(require("@mui/material/TextField"));
882
+ var import_Dialog4 = __toESM(require("@mui/material/Dialog"));
883
+ var import_DialogActions4 = __toESM(require("@mui/material/DialogActions"));
884
+ var import_DialogContent4 = __toESM(require("@mui/material/DialogContent"));
885
+ var import_DialogContentText3 = __toESM(require("@mui/material/DialogContentText"));
886
+ var import_DialogTitle4 = __toESM(require("@mui/material/DialogTitle"));
887
+ var import_jsx_runtime13 = require("react/jsx-runtime");
888
+ function CmrDeletionDialog(props) {
889
+ const [open, setOpen] = React8.useState(true);
890
+ const [text, setText] = React8.useState("");
891
+ const handleClickOpen = () => {
892
+ setOpen(true);
893
+ };
894
+ const handleClose = () => {
895
+ setOpen(false);
896
+ };
897
+ const handleConfirm = () => {
898
+ if (text === props.name) {
899
+ props.deletionCallback();
900
+ setOpen(false);
901
+ }
902
+ };
903
+ const handleTextFieldChange = (e) => {
904
+ setText(e.target.value);
905
+ };
906
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_Dialog4.default, { open, onClose: handleClose, children: [
907
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_DialogTitle4.default, { children: "Confirmation" }),
908
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_DialogContent4.default, { children: [
909
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_DialogContentText3.default, { children: "To delete the files, please type your full name below and confirm." }),
910
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
911
+ import_TextField3.default,
912
+ {
913
+ autoFocus: true,
914
+ margin: "dense",
915
+ id: "name",
916
+ type: "email",
917
+ placeholder: props.name,
918
+ fullWidth: true,
919
+ inputProps: { style: { fontSize: "16pt" } },
920
+ variant: "standard",
921
+ onChange: handleTextFieldChange
922
+ }
923
+ )
924
+ ] }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_DialogActions4.default, { children: [
926
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "btn btn-secondary", onClick: handleClose, children: "Cancel" }),
927
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "btn btn-danger", onClick: handleConfirm, children: "Confirm" })
928
+ ] })
929
+ ] }) });
930
+ }
931
+
932
+ // src/CmrTabs/CmrTabs.tsx
933
+ var React9 = __toESM(require("react"));
880
934
  var import_Tabs = __toESM(require("@mui/material/Tabs"));
881
935
  var import_Tab = __toESM(require("@mui/material/Tab"));
882
936
  var import_Container = __toESM(require("@mui/material/Container"));
883
937
  var import_Typography2 = __toESM(require("@mui/material/Typography"));
884
938
  var import_Box2 = __toESM(require("@mui/material/Box"));
885
939
  var import_react6 = require("react");
886
- var import_jsx_runtime13 = require("react/jsx-runtime");
940
+ var import_jsx_runtime14 = require("react/jsx-runtime");
887
941
  function CustomTabPanel(props) {
888
942
  const { children, value, index, ...other } = props;
889
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
943
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
890
944
  "div",
891
945
  {
892
946
  role: "tabpanel",
@@ -894,7 +948,7 @@ function CustomTabPanel(props) {
894
948
  id: `simple-tabpanel-${index}`,
895
949
  "aria-labelledby": `simple-tab-${index}`,
896
950
  ...other,
897
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Box2.default, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Typography2.default, { children }) })
951
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Box2.default, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Typography2.default, { children }) })
898
952
  }
899
953
  );
900
954
  }
@@ -905,13 +959,13 @@ function a11yProps(index) {
905
959
  };
906
960
  }
907
961
  function CmrTabs(props) {
908
- const [value, setValue] = React8.useState(0);
962
+ const [value, setValue] = React9.useState(0);
909
963
  const handleChange = (event, newValue) => {
910
964
  setValue(newValue);
911
965
  if (props.onTabSelected)
912
966
  props.onTabSelected(newValue);
913
967
  };
914
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
968
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
915
969
  import_Container.default,
916
970
  {
917
971
  maxWidth: "lg",
@@ -922,7 +976,7 @@ function CmrTabs(props) {
922
976
  mt: 4
923
977
  },
924
978
  children: [
925
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Box2.default, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
979
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Box2.default, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
926
980
  import_Tabs.default,
927
981
  {
928
982
  value,
@@ -934,11 +988,11 @@ function CmrTabs(props) {
934
988
  backgroundColor: "#580F8B"
935
989
  }
936
990
  },
937
- children: props.tabList.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Tab.default, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
991
+ children: props.tabList.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Tab.default, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
938
992
  }
939
993
  ) }),
940
994
  props.tabList.map(
941
- (tab, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CustomTabPanel, { value, index, children: (0, import_react6.cloneElement)(tab.children, {
995
+ (tab, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CustomTabPanel, { value, index, children: (0, import_react6.cloneElement)(tab.children, {
942
996
  visible: value == index
943
997
  }) })
944
998
  )
@@ -950,17 +1004,17 @@ function CmrTabs(props) {
950
1004
  // src/CmrComponents/checkbox/Checkbox.tsx
951
1005
  var import_material9 = require("@mui/material");
952
1006
  var import_material10 = require("@mui/material");
953
- var import_jsx_runtime14 = require("react/jsx-runtime");
1007
+ var import_jsx_runtime15 = require("react/jsx-runtime");
954
1008
  var CmrCheckbox = (props) => {
955
1009
  const { defaultChecked, onChange, children, ...rest } = props;
956
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1010
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
957
1011
  import_material10.FormControlLabel,
958
1012
  {
959
1013
  disabled: props.disabled,
960
1014
  style: props.style,
961
1015
  className: props.className,
962
- control: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material9.Checkbox, { style: props.style, checked: props.checked, defaultChecked, onChange }),
963
- label: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label_default, { children: props.children }),
1016
+ control: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material9.Checkbox, { style: props.style, checked: props.checked, defaultChecked, onChange }),
1017
+ label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label_default, { children: props.children }),
964
1018
  sx: props.sx,
965
1019
  labelPlacement: "end"
966
1020
  }
@@ -970,7 +1024,7 @@ var Checkbox_default = CmrCheckbox;
970
1024
 
971
1025
  // src/CmrTable/CmrTable.tsx
972
1026
  var import_x_data_grid = require("@mui/x-data-grid");
973
- var import_jsx_runtime15 = require("react/jsx-runtime");
1027
+ var import_jsx_runtime16 = require("react/jsx-runtime");
974
1028
  var CmrTable = (props) => {
975
1029
  const {
976
1030
  dataSource,
@@ -982,7 +1036,7 @@ var CmrTable = (props) => {
982
1036
  showCheckbox = true,
983
1037
  ...rest
984
1038
  } = props;
985
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1039
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
986
1040
  import_x_data_grid.DataGrid,
987
1041
  {
988
1042
  rows: dataSource ? dataSource.map((row) => ({
@@ -1013,6 +1067,7 @@ var CmrTable2 = CmrTable_default;
1013
1067
  CmrCheckbox,
1014
1068
  CmrCollapse,
1015
1069
  CmrConfirmation,
1070
+ CmrDeletionDialog,
1016
1071
  CmrInput,
1017
1072
  CmrNameDialog,
1018
1073
  CmrPanel,
package/dist/index.mjs CHANGED
@@ -834,18 +834,71 @@ function CmrConfirmation({
834
834
  ] });
835
835
  }
836
836
 
837
- // src/CmrTabs/CmrTabs.tsx
837
+ // src/CmrComponents/dialogue/DeletionDialog.tsx
838
838
  import * as React8 from "react";
839
+ import TextField3 from "@mui/material/TextField";
840
+ import Dialog4 from "@mui/material/Dialog";
841
+ import DialogActions4 from "@mui/material/DialogActions";
842
+ import DialogContent4 from "@mui/material/DialogContent";
843
+ import DialogContentText3 from "@mui/material/DialogContentText";
844
+ import DialogTitle4 from "@mui/material/DialogTitle";
845
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
846
+ function CmrDeletionDialog(props) {
847
+ const [open, setOpen] = React8.useState(true);
848
+ const [text, setText] = React8.useState("");
849
+ const handleClickOpen = () => {
850
+ setOpen(true);
851
+ };
852
+ const handleClose = () => {
853
+ setOpen(false);
854
+ };
855
+ const handleConfirm = () => {
856
+ if (text === props.name) {
857
+ props.deletionCallback();
858
+ setOpen(false);
859
+ }
860
+ };
861
+ const handleTextFieldChange = (e) => {
862
+ setText(e.target.value);
863
+ };
864
+ return /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsxs9(Dialog4, { open, onClose: handleClose, children: [
865
+ /* @__PURE__ */ jsx13(DialogTitle4, { children: "Confirmation" }),
866
+ /* @__PURE__ */ jsxs9(DialogContent4, { children: [
867
+ /* @__PURE__ */ jsx13(DialogContentText3, { children: "To delete the files, please type your full name below and confirm." }),
868
+ /* @__PURE__ */ jsx13(
869
+ TextField3,
870
+ {
871
+ autoFocus: true,
872
+ margin: "dense",
873
+ id: "name",
874
+ type: "email",
875
+ placeholder: props.name,
876
+ fullWidth: true,
877
+ inputProps: { style: { fontSize: "16pt" } },
878
+ variant: "standard",
879
+ onChange: handleTextFieldChange
880
+ }
881
+ )
882
+ ] }),
883
+ /* @__PURE__ */ jsxs9(DialogActions4, { children: [
884
+ /* @__PURE__ */ jsx13("button", { className: "btn btn-secondary", onClick: handleClose, children: "Cancel" }),
885
+ /* @__PURE__ */ jsx13("button", { className: "btn btn-danger", onClick: handleConfirm, children: "Confirm" })
886
+ ] })
887
+ ] }) });
888
+ }
889
+
890
+ // src/CmrTabs/CmrTabs.tsx
891
+ import * as React9 from "react";
839
892
  import Tabs from "@mui/material/Tabs";
840
893
  import Tab from "@mui/material/Tab";
841
894
  import Container from "@mui/material/Container";
842
895
  import Typography3 from "@mui/material/Typography";
843
896
  import Box3 from "@mui/material/Box";
844
897
  import { cloneElement as cloneElement2 } from "react";
845
- import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
898
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
846
899
  function CustomTabPanel(props) {
847
900
  const { children, value, index, ...other } = props;
848
- return /* @__PURE__ */ jsx13(
901
+ return /* @__PURE__ */ jsx14(
849
902
  "div",
850
903
  {
851
904
  role: "tabpanel",
@@ -853,7 +906,7 @@ function CustomTabPanel(props) {
853
906
  id: `simple-tabpanel-${index}`,
854
907
  "aria-labelledby": `simple-tab-${index}`,
855
908
  ...other,
856
- children: /* @__PURE__ */ jsx13(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx13(Typography3, { children }) })
909
+ children: /* @__PURE__ */ jsx14(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx14(Typography3, { children }) })
857
910
  }
858
911
  );
859
912
  }
@@ -864,13 +917,13 @@ function a11yProps(index) {
864
917
  };
865
918
  }
866
919
  function CmrTabs(props) {
867
- const [value, setValue] = React8.useState(0);
920
+ const [value, setValue] = React9.useState(0);
868
921
  const handleChange = (event, newValue) => {
869
922
  setValue(newValue);
870
923
  if (props.onTabSelected)
871
924
  props.onTabSelected(newValue);
872
925
  };
873
- return /* @__PURE__ */ jsxs9(
926
+ return /* @__PURE__ */ jsxs10(
874
927
  Container,
875
928
  {
876
929
  maxWidth: "lg",
@@ -881,7 +934,7 @@ function CmrTabs(props) {
881
934
  mt: 4
882
935
  },
883
936
  children: [
884
- /* @__PURE__ */ jsx13(Box3, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ jsx13(
937
+ /* @__PURE__ */ jsx14(Box3, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ jsx14(
885
938
  Tabs,
886
939
  {
887
940
  value,
@@ -893,11 +946,11 @@ function CmrTabs(props) {
893
946
  backgroundColor: "#580F8B"
894
947
  }
895
948
  },
896
- children: props.tabList.map((tab, index) => /* @__PURE__ */ jsx13(Tab, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
949
+ children: props.tabList.map((tab, index) => /* @__PURE__ */ jsx14(Tab, { sx: { color: value == index ? "#580F8B" : void 0 }, style: { fontSize: "14px", textTransform: "uppercase", fontWeight: 400 }, label: tab.text, ...a11yProps(index) }))
897
950
  }
898
951
  ) }),
899
952
  props.tabList.map(
900
- (tab, index) => /* @__PURE__ */ jsx13(CustomTabPanel, { value, index, children: cloneElement2(tab.children, {
953
+ (tab, index) => /* @__PURE__ */ jsx14(CustomTabPanel, { value, index, children: cloneElement2(tab.children, {
901
954
  visible: value == index
902
955
  }) })
903
956
  )
@@ -909,17 +962,17 @@ function CmrTabs(props) {
909
962
  // src/CmrComponents/checkbox/Checkbox.tsx
910
963
  import { Checkbox as Checkbox2 } from "@mui/material";
911
964
  import { FormControlLabel as FormControlLabel3 } from "@mui/material";
912
- import { jsx as jsx14 } from "react/jsx-runtime";
965
+ import { jsx as jsx15 } from "react/jsx-runtime";
913
966
  var CmrCheckbox = (props) => {
914
967
  const { defaultChecked, onChange, children, ...rest } = props;
915
- return /* @__PURE__ */ jsx14(
968
+ return /* @__PURE__ */ jsx15(
916
969
  FormControlLabel3,
917
970
  {
918
971
  disabled: props.disabled,
919
972
  style: props.style,
920
973
  className: props.className,
921
- control: /* @__PURE__ */ jsx14(Checkbox2, { style: props.style, checked: props.checked, defaultChecked, onChange }),
922
- label: /* @__PURE__ */ jsx14(Label_default, { children: props.children }),
974
+ control: /* @__PURE__ */ jsx15(Checkbox2, { style: props.style, checked: props.checked, defaultChecked, onChange }),
975
+ label: /* @__PURE__ */ jsx15(Label_default, { children: props.children }),
923
976
  sx: props.sx,
924
977
  labelPlacement: "end"
925
978
  }
@@ -929,7 +982,7 @@ var Checkbox_default = CmrCheckbox;
929
982
 
930
983
  // src/CmrTable/CmrTable.tsx
931
984
  import { DataGrid } from "@mui/x-data-grid";
932
- import { jsx as jsx15 } from "react/jsx-runtime";
985
+ import { jsx as jsx16 } from "react/jsx-runtime";
933
986
  var CmrTable = (props) => {
934
987
  const {
935
988
  dataSource,
@@ -941,7 +994,7 @@ var CmrTable = (props) => {
941
994
  showCheckbox = true,
942
995
  ...rest
943
996
  } = props;
944
- return /* @__PURE__ */ jsx15("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx15(
997
+ return /* @__PURE__ */ jsx16("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx16(
945
998
  DataGrid,
946
999
  {
947
1000
  rows: dataSource ? dataSource.map((row) => ({
@@ -971,6 +1024,7 @@ export {
971
1024
  Checkbox_default as CmrCheckbox,
972
1025
  Collapse_default as CmrCollapse,
973
1026
  CmrConfirmation,
1027
+ CmrDeletionDialog,
974
1028
  CmrInput,
975
1029
  CmrNameDialog,
976
1030
  Panel_default as CmrPanel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",