cloudmr-ux 1.0.9 → 1.1.1

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.css CHANGED
@@ -172,6 +172,16 @@
172
172
  margin-left: 4px;
173
173
  }
174
174
 
175
+ /* src/CmrComponents/checkbox/Checkbox.css */
176
+ .cmr-checkbox {
177
+ margin-bottom: 4px;
178
+ &__text {
179
+ font-size: 16px;
180
+ line-height: 15px;
181
+ text-align: justify;
182
+ }
183
+ }
184
+
175
185
  /* src/CmrTable/CmrTable.css */
176
186
  .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-columnHeader:focus-within,
177
187
  .css-1lymaxv-MuiDataGrid-root .MuiDataGrid-cell:focus-within {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ButtonProps, SxProps, Theme } from '@mui/material';
3
- import React, { ChangeEvent, ReactNode, CSSProperties, FC } from 'react';
3
+ import React, { ReactNode, ChangeEvent, CSSProperties, FC } from 'react';
4
4
  import { SizeType } from 'antd/lib/config-provider/SizeContext';
5
5
  import { CollapsibleType } from 'antd/es/collapse/CollapsePanel';
6
6
  import { ExpandIconPosition } from 'antd/es/collapse/Collapse';
@@ -9,18 +9,6 @@ import { DataGridProps } from '@mui/x-data-grid';
9
9
 
10
10
  declare const CmrButton: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
11
11
 
12
- interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
13
- autoFocus?: boolean;
14
- checked?: boolean;
15
- defaultChecked?: boolean;
16
- disabled?: boolean;
17
- indeterminate?: boolean;
18
- onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
19
- children?: any;
20
- style?: any;
21
- }
22
- declare const CmrCheckbox: (props: CmrCheckboxProps) => react_jsx_runtime.JSX.Element;
23
-
24
12
  interface CmrInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
25
13
  defaultValue?: string;
26
14
  id?: string;
@@ -185,6 +173,32 @@ declare function CmrConfirmation({ name, message, cancelText, color, open, setOp
185
173
  confirmText?: string;
186
174
  }): react_jsx_runtime.JSX.Element;
187
175
 
176
+ interface TabInfo {
177
+ id: number;
178
+ text: string;
179
+ disable?: boolean;
180
+ children: JSX.Element;
181
+ }
182
+
183
+ interface CmrTabsProps {
184
+ tabList: TabInfo[];
185
+ onTabSelected?: (tabId: number) => void;
186
+ }
187
+ declare function CmrTabs(props: CmrTabsProps): react_jsx_runtime.JSX.Element;
188
+
189
+ interface CmrCheckboxProps extends React.HTMLAttributes<HTMLDivElement> {
190
+ autoFocus?: boolean;
191
+ checked?: boolean;
192
+ defaultChecked?: boolean;
193
+ disabled?: boolean;
194
+ indeterminate?: boolean;
195
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
196
+ children?: any;
197
+ style?: any;
198
+ sx?: any;
199
+ }
200
+ declare const CmrCheckbox: (props: CmrCheckboxProps) => react_jsx_runtime.JSX.Element;
201
+
188
202
  interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
189
203
  dataSource: any[];
190
204
  idAlias?: string;
@@ -195,4 +209,4 @@ interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
195
209
 
196
210
  declare const CmrTable: FC<CmrTableProps>;
197
211
 
198
- export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, LambdaFile };
212
+ export { CmrUpload as CMRUpload, CmrButton, CmrCheckbox, CmrCollapse, CmrConfirmation, CmrInput, CmrNameDialog, CmrPanel, CmrRadioGroup, CmrSelect, CmrTable, CmrTableProps, CmrTabs, LambdaFile };
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  CMRUpload: () => Upload_default,
34
34
  CmrButton: () => CmrButton,
35
- CmrCheckbox: () => CmrCheckbox,
35
+ CmrCheckbox: () => Checkbox_default,
36
36
  CmrCollapse: () => Collapse_default,
37
37
  CmrConfirmation: () => CmrConfirmation,
38
38
  CmrInput: () => CmrInput,
@@ -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
 
@@ -75,28 +76,6 @@ var CmrButton = (props) => {
75
76
  var import_material2 = require("@mui/material");
76
77
  var import_material3 = require("@mui/material");
77
78
  var import_jsx_runtime2 = require("react/jsx-runtime");
78
- var CmrCheckbox = (props) => {
79
- const { defaultChecked, onChange, children, ...rest } = props;
80
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
81
- import_material3.FormControlLabel,
82
- {
83
- disabled: props.disabled,
84
- style: props.style,
85
- className: props.className,
86
- control: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
87
- import_material2.Checkbox,
88
- {
89
- style: props.style,
90
- checked: props.checked,
91
- defaultChecked,
92
- onChange
93
- }
94
- ),
95
- label: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "cmr-label", style: { paddingRight: 0, color: "var(--bs-card-color)" }, children: props.children }),
96
- labelPlacement: "end"
97
- }
98
- );
99
- };
100
79
 
101
80
  // src/CmrComponents/CmrInput/CmrInput.tsx
102
81
  var import_antd = require("antd");
@@ -896,9 +875,102 @@ function CmrConfirmation({
896
875
  ] });
897
876
  }
898
877
 
878
+ // src/CmrTabs/CmrTabs.tsx
879
+ var React8 = __toESM(require("react"));
880
+ var import_Tabs = __toESM(require("@mui/material/Tabs"));
881
+ var import_Tab = __toESM(require("@mui/material/Tab"));
882
+ var import_Container = __toESM(require("@mui/material/Container"));
883
+ var import_Typography2 = __toESM(require("@mui/material/Typography"));
884
+ var import_Box2 = __toESM(require("@mui/material/Box"));
885
+ var import_react6 = require("react");
886
+ var import_jsx_runtime13 = require("react/jsx-runtime");
887
+ function CustomTabPanel(props) {
888
+ const { children, value, index, ...other } = props;
889
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
890
+ "div",
891
+ {
892
+ role: "tabpanel",
893
+ hidden: value !== index,
894
+ id: `simple-tabpanel-${index}`,
895
+ "aria-labelledby": `simple-tab-${index}`,
896
+ ...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 }) })
898
+ }
899
+ );
900
+ }
901
+ function a11yProps(index) {
902
+ return {
903
+ id: `simple-tab-${index}`,
904
+ "aria-controls": `simple-tabpanel-${index}`
905
+ };
906
+ }
907
+ function CmrTabs(props) {
908
+ const [value, setValue] = React8.useState(0);
909
+ const handleChange = (event, newValue) => {
910
+ setValue(newValue);
911
+ if (props.onTabSelected)
912
+ props.onTabSelected(newValue);
913
+ };
914
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
915
+ import_Container.default,
916
+ {
917
+ maxWidth: "lg",
918
+ sx: {
919
+ flex: 1,
920
+ display: "flex",
921
+ flexDirection: "column",
922
+ mt: 4
923
+ },
924
+ 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)(
926
+ import_Tabs.default,
927
+ {
928
+ value,
929
+ onChange: handleChange,
930
+ "aria-label": "basic tabs example",
931
+ textColor: "inherit",
932
+ TabIndicatorProps: {
933
+ style: {
934
+ backgroundColor: "#580F8B"
935
+ }
936
+ },
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) }))
938
+ }
939
+ ) }),
940
+ props.tabList.map(
941
+ (tab, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CustomTabPanel, { value, index, children: (0, import_react6.cloneElement)(tab.children, {
942
+ visible: value == index
943
+ }) })
944
+ )
945
+ ]
946
+ }
947
+ );
948
+ }
949
+
950
+ // src/CmrComponents/checkbox/Checkbox.tsx
951
+ var import_material9 = require("@mui/material");
952
+ var import_material10 = require("@mui/material");
953
+ var import_jsx_runtime14 = require("react/jsx-runtime");
954
+ var CmrCheckbox = (props) => {
955
+ const { defaultChecked, onChange, children, ...rest } = props;
956
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
957
+ import_material10.FormControlLabel,
958
+ {
959
+ disabled: props.disabled,
960
+ style: props.style,
961
+ 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 }),
964
+ sx: props.sx,
965
+ labelPlacement: "end"
966
+ }
967
+ );
968
+ };
969
+ var Checkbox_default = CmrCheckbox;
970
+
899
971
  // src/CmrTable/CmrTable.tsx
900
972
  var import_x_data_grid = require("@mui/x-data-grid");
901
- var import_jsx_runtime13 = require("react/jsx-runtime");
973
+ var import_jsx_runtime15 = require("react/jsx-runtime");
902
974
  var CmrTable = (props) => {
903
975
  const {
904
976
  dataSource,
@@ -910,7 +982,7 @@ var CmrTable = (props) => {
910
982
  showCheckbox = true,
911
983
  ...rest
912
984
  } = 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)(
985
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
914
986
  import_x_data_grid.DataGrid,
915
987
  {
916
988
  rows: dataSource ? dataSource.map((row) => ({
@@ -946,5 +1018,6 @@ var CmrTable2 = CmrTable_default;
946
1018
  CmrPanel,
947
1019
  CmrRadioGroup,
948
1020
  CmrSelect,
949
- CmrTable
1021
+ CmrTable,
1022
+ CmrTabs
950
1023
  });
package/dist/index.mjs CHANGED
@@ -29,28 +29,6 @@ var CmrButton = (props) => {
29
29
  import { Checkbox } from "@mui/material";
30
30
  import { FormControlLabel } from "@mui/material";
31
31
  import { jsx as jsx2 } from "react/jsx-runtime";
32
- var CmrCheckbox = (props) => {
33
- const { defaultChecked, onChange, children, ...rest } = props;
34
- return /* @__PURE__ */ jsx2(
35
- FormControlLabel,
36
- {
37
- disabled: props.disabled,
38
- style: props.style,
39
- className: props.className,
40
- control: /* @__PURE__ */ jsx2(
41
- Checkbox,
42
- {
43
- style: props.style,
44
- checked: props.checked,
45
- defaultChecked,
46
- onChange
47
- }
48
- ),
49
- label: /* @__PURE__ */ jsx2("span", { className: "cmr-label", style: { paddingRight: 0, color: "var(--bs-card-color)" }, children: props.children }),
50
- labelPlacement: "end"
51
- }
52
- );
53
- };
54
32
 
55
33
  // src/CmrComponents/CmrInput/CmrInput.tsx
56
34
  import { Input } from "antd";
@@ -856,9 +834,102 @@ function CmrConfirmation({
856
834
  ] });
857
835
  }
858
836
 
837
+ // src/CmrTabs/CmrTabs.tsx
838
+ import * as React8 from "react";
839
+ import Tabs from "@mui/material/Tabs";
840
+ import Tab from "@mui/material/Tab";
841
+ import Container from "@mui/material/Container";
842
+ import Typography3 from "@mui/material/Typography";
843
+ import Box3 from "@mui/material/Box";
844
+ import { cloneElement as cloneElement2 } from "react";
845
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
846
+ function CustomTabPanel(props) {
847
+ const { children, value, index, ...other } = props;
848
+ return /* @__PURE__ */ jsx13(
849
+ "div",
850
+ {
851
+ role: "tabpanel",
852
+ hidden: value !== index,
853
+ id: `simple-tabpanel-${index}`,
854
+ "aria-labelledby": `simple-tab-${index}`,
855
+ ...other,
856
+ children: /* @__PURE__ */ jsx13(Box3, { sx: { p: 0 }, style: { display: value === index ? void 0 : "none" }, children: /* @__PURE__ */ jsx13(Typography3, { children }) })
857
+ }
858
+ );
859
+ }
860
+ function a11yProps(index) {
861
+ return {
862
+ id: `simple-tab-${index}`,
863
+ "aria-controls": `simple-tabpanel-${index}`
864
+ };
865
+ }
866
+ function CmrTabs(props) {
867
+ const [value, setValue] = React8.useState(0);
868
+ const handleChange = (event, newValue) => {
869
+ setValue(newValue);
870
+ if (props.onTabSelected)
871
+ props.onTabSelected(newValue);
872
+ };
873
+ return /* @__PURE__ */ jsxs9(
874
+ Container,
875
+ {
876
+ maxWidth: "lg",
877
+ sx: {
878
+ flex: 1,
879
+ display: "flex",
880
+ flexDirection: "column",
881
+ mt: 4
882
+ },
883
+ children: [
884
+ /* @__PURE__ */ jsx13(Box3, { sx: { borderBottom: 1, borderColor: "divider", mb: 4 }, children: /* @__PURE__ */ jsx13(
885
+ Tabs,
886
+ {
887
+ value,
888
+ onChange: handleChange,
889
+ "aria-label": "basic tabs example",
890
+ textColor: "inherit",
891
+ TabIndicatorProps: {
892
+ style: {
893
+ backgroundColor: "#580F8B"
894
+ }
895
+ },
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) }))
897
+ }
898
+ ) }),
899
+ props.tabList.map(
900
+ (tab, index) => /* @__PURE__ */ jsx13(CustomTabPanel, { value, index, children: cloneElement2(tab.children, {
901
+ visible: value == index
902
+ }) })
903
+ )
904
+ ]
905
+ }
906
+ );
907
+ }
908
+
909
+ // src/CmrComponents/checkbox/Checkbox.tsx
910
+ import { Checkbox as Checkbox2 } from "@mui/material";
911
+ import { FormControlLabel as FormControlLabel3 } from "@mui/material";
912
+ import { jsx as jsx14 } from "react/jsx-runtime";
913
+ var CmrCheckbox = (props) => {
914
+ const { defaultChecked, onChange, children, ...rest } = props;
915
+ return /* @__PURE__ */ jsx14(
916
+ FormControlLabel3,
917
+ {
918
+ disabled: props.disabled,
919
+ style: props.style,
920
+ 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 }),
923
+ sx: props.sx,
924
+ labelPlacement: "end"
925
+ }
926
+ );
927
+ };
928
+ var Checkbox_default = CmrCheckbox;
929
+
859
930
  // src/CmrTable/CmrTable.tsx
860
931
  import { DataGrid } from "@mui/x-data-grid";
861
- import { jsx as jsx13 } from "react/jsx-runtime";
932
+ import { jsx as jsx15 } from "react/jsx-runtime";
862
933
  var CmrTable = (props) => {
863
934
  const {
864
935
  dataSource,
@@ -870,7 +941,7 @@ var CmrTable = (props) => {
870
941
  showCheckbox = true,
871
942
  ...rest
872
943
  } = props;
873
- return /* @__PURE__ */ jsx13("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx13(
944
+ return /* @__PURE__ */ jsx15("div", { style: style ?? { height: "400px", width: "100%" }, className: className ?? "", children: /* @__PURE__ */ jsx15(
874
945
  DataGrid,
875
946
  {
876
947
  rows: dataSource ? dataSource.map((row) => ({
@@ -897,7 +968,7 @@ var CmrTable2 = CmrTable_default;
897
968
  export {
898
969
  Upload_default as CMRUpload,
899
970
  CmrButton,
900
- CmrCheckbox,
971
+ Checkbox_default as CmrCheckbox,
901
972
  Collapse_default as CmrCollapse,
902
973
  CmrConfirmation,
903
974
  CmrInput,
@@ -905,5 +976,6 @@ export {
905
976
  Panel_default as CmrPanel,
906
977
  CmrRadioGroup_default as CmrRadioGroup,
907
978
  CmrSelect_default as CmrSelect,
908
- CmrTable2 as CmrTable
979
+ CmrTable2 as CmrTable,
980
+ CmrTabs
909
981
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",