cloudmr-ux 1.0.9 → 1.1.0

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
@@ -185,6 +185,19 @@ declare function CmrConfirmation({ name, message, cancelText, color, open, setOp
185
185
  confirmText?: string;
186
186
  }): react_jsx_runtime.JSX.Element;
187
187
 
188
+ interface TabInfo {
189
+ id: number;
190
+ text: string;
191
+ disable?: boolean;
192
+ children: JSX.Element;
193
+ }
194
+
195
+ interface CmrTabsProps {
196
+ tabList: TabInfo[];
197
+ onTabSelected?: (tabId: number) => void;
198
+ }
199
+ declare function CmrTabs(props: CmrTabsProps): react_jsx_runtime.JSX.Element;
200
+
188
201
  interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
189
202
  dataSource: any[];
190
203
  idAlias?: string;
@@ -195,4 +208,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
195
208
 
196
209
  declare const CmrTable: FC<CmrTableProps>;
197
210
 
198
- export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, LambdaFile };
211
+ export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
package/dist/index.js CHANGED
@@ -40,7 +40,8 @@ __export(src_exports, {
40
40
  CmrPanel: () => Panel_default,
41
41
  CmrRadioGroup: () => CmrRadioGroup_default,
42
42
  CmrSelect: () => CmrSelect_default,
43
- CmrTable: () => CmrTable2
43
+ CmrTable: () => CmrTable2,
44
+ CmrTabs: () => CmrTabs
44
45
  });
45
46
  module.exports = __toCommonJS(src_exports);
46
47
 
@@ -896,9 +897,81 @@ function CmrConfirmation({
896
897
  ] });
897
898
  }
898
899
 
900
+ // src/CmrTabs/CmrTabs.tsx
901
+ var React8 = __toESM(require("react"));
902
+ var import_Tabs = __toESM(require("@mui/material/Tabs"));
903
+ var import_Tab = __toESM(require("@mui/material/Tab"));
904
+ var import_Container = __toESM(require("@mui/material/Container"));
905
+ var import_Typography2 = __toESM(require("@mui/material/Typography"));
906
+ var import_Box2 = __toESM(require("@mui/material/Box"));
907
+ var import_react6 = require("react");
908
+ var import_jsx_runtime13 = require("react/jsx-runtime");
909
+ function CustomTabPanel(props) {
910
+ const { children, value, index, ...other } = props;
911
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
912
+ "div",
913
+ {
914
+ role: "tabpanel",
915
+ hidden: value !== index,
916
+ id: `simple-tabpanel-${index}`,
917
+ "aria-labelledby": `simple-tab-${index}`,
918
+ ...other,
919
+ 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 }) })
920
+ }
921
+ );
922
+ }
923
+ function a11yProps(index) {
924
+ return {
925
+ id: `simple-tab-${index}`,
926
+ "aria-controls": `simple-tabpanel-${index}`
927
+ };
928
+ }
929
+ function CmrTabs(props) {
930
+ const [value, setValue] = React8.useState(0);
931
+ const handleChange = (event, newValue) => {
932
+ setValue(newValue);
933
+ if (props.onTabSelected)
934
+ props.onTabSelected(newValue);
935
+ };
936
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
937
+ import_Container.default,
938
+ {
939
+ maxWidth: "lg",
940
+ sx: {
941
+ flex: 1,
942
+ display: "flex",
943
+ flexDirection: "column",
944
+ mt: 4
945
+ },
946
+ children: [
947
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Box2.default, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
948
+ import_Tabs.default,
949
+ {
950
+ value,
951
+ onChange: handleChange,
952
+ "aria-label": "basic tabs example",
953
+ textColor: "inherit",
954
+ TabIndicatorProps: {
955
+ style: {
956
+ backgroundColor: "#580F8B"
957
+ }
958
+ },
959
+ 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) }))
960
+ }
961
+ ) }),
962
+ props.tabList.map(
963
+ (tab, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CustomTabPanel, { value, index, children: (0, import_react6.cloneElement)(tab.children, {
964
+ visible: value == index
965
+ }) })
966
+ )
967
+ ]
968
+ }
969
+ );
970
+ }
971
+
899
972
  // src/CmrTable/CmrTable.tsx
900
973
  var import_x_data_grid = require("@mui/x-data-grid");
901
- var import_jsx_runtime13 = require("react/jsx-runtime");
974
+ var import_jsx_runtime14 = require("react/jsx-runtime");
902
975
  var CmrTable = (props) => {
903
976
  const {
904
977
  dataSource,
@@ -910,7 +983,7 @@ var CmrTable = (props) => {
910
983
  showCheckbox = true,
911
984
  ...rest
912
985
  } = props;
913
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
986
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
914
987
  import_x_data_grid.DataGrid,
915
988
  {
916
989
  rows: dataSource ? dataSource.map((row) => ({
@@ -946,5 +1019,6 @@ var CmrTable2 = CmrTable_default;
946
1019
  CmrPanel,
947
1020
  CmrRadioGroup,
948
1021
  CmrSelect,
949
- CmrTable
1022
+ CmrTable,
1023
+ CmrTabs
950
1024
  });
package/dist/index.mjs CHANGED
@@ -856,9 +856,81 @@ function CmrConfirmation({
856
856
  ] });
857
857
  }
858
858
 
859
+ // src/CmrTabs/CmrTabs.tsx
860
+ import * as React8 from "react";
861
+ import Tabs from "@mui/material/Tabs";
862
+ import Tab from "@mui/material/Tab";
863
+ import Container from "@mui/material/Container";
864
+ import Typography3 from "@mui/material/Typography";
865
+ import Box3 from "@mui/material/Box";
866
+ import { cloneElement as cloneElement2 } from "react";
867
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
868
+ function CustomTabPanel(props) {
869
+ const { children, value, index, ...other } = props;
870
+ return /* @__PURE__ */ jsx13(
871
+ "div",
872
+ {
873
+ role: "tabpanel",
874
+ hidden: value !== index,
875
+ id: `simple-tabpanel-${index}`,
876
+ "aria-labelledby": `simple-tab-${index}`,
877
+ ...other,
878
+ children: /* @__PURE__ */ jsx13(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx13(Typography3, { children }) })
879
+ }
880
+ );
881
+ }
882
+ function a11yProps(index) {
883
+ return {
884
+ id: `simple-tab-${index}`,
885
+ "aria-controls": `simple-tabpanel-${index}`
886
+ };
887
+ }
888
+ function CmrTabs(props) {
889
+ const [value, setValue] = React8.useState(0);
890
+ const handleChange = (event, newValue) => {
891
+ setValue(newValue);
892
+ if (props.onTabSelected)
893
+ props.onTabSelected(newValue);
894
+ };
895
+ return /* @__PURE__ */ jsxs9(
896
+ Container,
897
+ {
898
+ maxWidth: "lg",
899
+ sx: {
900
+ flex: 1,
901
+ display: "flex",
902
+ flexDirection: "column",
903
+ mt: 4
904
+ },
905
+ children: [
906
+ /* @__PURE__ */ jsx13(Box3, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ jsx13(
907
+ Tabs,
908
+ {
909
+ value,
910
+ onChange: handleChange,
911
+ "aria-label": "basic tabs example",
912
+ textColor: "inherit",
913
+ TabIndicatorProps: {
914
+ style: {
915
+ backgroundColor: "#580F8B"
916
+ }
917
+ },
918
+ 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) }))
919
+ }
920
+ ) }),
921
+ props.tabList.map(
922
+ (tab, index) => /* @__PURE__ */ jsx13(CustomTabPanel, { value, index, children: cloneElement2(tab.children, {
923
+ visible: value == index
924
+ }) })
925
+ )
926
+ ]
927
+ }
928
+ );
929
+ }
930
+
859
931
  // src/CmrTable/CmrTable.tsx
860
932
  import { DataGrid } from "@mui/x-data-grid";
861
- import { jsx as jsx13 } from "react/jsx-runtime";
933
+ import { jsx as jsx14 } from "react/jsx-runtime";
862
934
  var CmrTable = (props) => {
863
935
  const {
864
936
  dataSource,
@@ -870,7 +942,7 @@ var CmrTable = (props) => {
870
942
  showCheckbox = true,
871
943
  ...rest
872
944
  } = props;
873
- return /* @__PURE__ */ jsx13("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx13(
945
+ return /* @__PURE__ */ jsx14("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx14(
874
946
  DataGrid,
875
947
  {
876
948
  rows: dataSource ? dataSource.map((row) => ({
@@ -905,5 +977,6 @@ export {
905
977
  Panel_default as CmrPanel,
906
978
  CmrRadioGroup_default as CmrRadioGroup,
907
979
  CmrSelect_default as CmrSelect,
908
- CmrTable2 as CmrTable
980
+ CmrTable2 as CmrTable,
981
+ CmrTabs
909
982
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",