@nethru/ui 2.0.2 → 2.0.4

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.
@@ -0,0 +1,52 @@
1
+ import { forwardRef } from "react";
2
+ import { Stack, Typography } from "@mui/material";
3
+ import MuiAccordionSummary from "@mui/material/AccordionSummary";
4
+ import { ExpandMoreIcon, NethruBulletIcon } from "./assets/icons";
5
+ import { grey } from "./colors";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const AccordionSummary = /*#__PURE__*/forwardRef(({
9
+ expandable = true,
10
+ subcontent,
11
+ children,
12
+ sx,
13
+ ...props
14
+ }, ref) => {
15
+ return /*#__PURE__*/_jsx(MuiAccordionSummary, {
16
+ ref: ref,
17
+ expandIcon: expandable ? /*#__PURE__*/_jsx(ExpandMoreIcon, {
18
+ sx: expandMoreStyles
19
+ }) : undefined,
20
+ sx: {
21
+ pointerEvents: 'none',
22
+ ...sx
23
+ },
24
+ ...props,
25
+ children: /*#__PURE__*/_jsxs(Stack, {
26
+ direction: "row",
27
+ alignItems: "center",
28
+ gap: 1.5,
29
+ children: [/*#__PURE__*/_jsx(NethruBulletIcon, {
30
+ sx: bulletStyles
31
+ }), children, subcontent && /*#__PURE__*/_jsx(Typography, {
32
+ variant: "bodySmSemibold",
33
+ color: grey[600],
34
+ children: subcontent
35
+ })]
36
+ })
37
+ });
38
+ });
39
+ export default AccordionSummary;
40
+ const expandMoreStyles = {
41
+ pointerEvents: 'auto',
42
+ fontSize: 24,
43
+ path: {
44
+ fill: grey[900]
45
+ }
46
+ };
47
+ const bulletStyles = {
48
+ fontSize: 18,
49
+ path: {
50
+ fill: grey[800]
51
+ }
52
+ };
@@ -300,6 +300,17 @@ export const CollapseIcon = createSvgIcon( /*#__PURE__*/_jsx("svg", {
300
300
  fill: "#333333"
301
301
  })
302
302
  }), 'Collapse');
303
+ export const ExpandMoreIcon = createSvgIcon( /*#__PURE__*/_jsx("svg", {
304
+ width: "24",
305
+ height: "24",
306
+ viewBox: "0 0 24 24",
307
+ fill: "none",
308
+ xmlns: "http://www.w3.org/2000/svg",
309
+ children: /*#__PURE__*/_jsx("path", {
310
+ d: "M7.40531 8.96412L6.35156 10.0181L12.0053 15.6719L17.6591 10.0181L16.6053 8.96412L12.0053 13.5641L7.40531 8.96412Z",
311
+ fill: "#7B7B7B"
312
+ })
313
+ }), 'Expand');
303
314
  export const MonitoringIcon = createSvgIcon( /*#__PURE__*/_jsx("svg", {
304
315
  width: "24",
305
316
  height: "24",
@@ -50,9 +50,6 @@
50
50
  }
51
51
 
52
52
 
53
- .icon {
54
- margin: 4px 15px 0px 16px;
55
- }
56
53
  .icon > svg {
57
54
  width: 24px;
58
55
  height: 24px;
@@ -65,5 +62,5 @@
65
62
  line-height: 1.4;
66
63
  letter-spacing: 0;
67
64
  white-space: nowrap;
68
- overflow-x: hidden;
65
+ overflow: hidden;
69
66
  }
package/base/index.js CHANGED
@@ -5,6 +5,7 @@ import globalStyles from './styles/globalStyles';
5
5
  import createTheme from './styles/createTheme';
6
6
  export { colors };
7
7
  export { borderRadius, shadow, globalStyles, createTheme };
8
+ export { default as AccordionSummary } from "./AccordionSummary";
8
9
  export { default as AddableFormList } from "./AddableFormList";
9
10
  export { default as AlertDialog } from "./dialog/AlertDialog";
10
11
  export { default as AppBar } from "./frame/AppBar";
@@ -32,12 +33,8 @@ export { default as Switch } from "./Switch";
32
33
  export * from './frame/sidebar/SidebarContext';
33
34
  export { default as Error } from "./error/Error";
34
35
  export { default as HttpError } from "./error/HttpError";
35
- export { default as Accordion } from "./deprecated/Accordion";
36
- export { default as AccordionDetails } from "./deprecated/AccordionDetails";
37
- export { default as AccordionSummary } from "./deprecated/AccordionSummary";
38
36
  export { default as AppendableFormList } from "./deprecated/AppendableFormList";
39
37
  export { default as AvatarDropdown } from "./deprecated/AvatarDropdown";
40
- export { default as Button } from "./deprecated/Button";
41
38
  export { default as CircularProgress } from "./deprecated/CircularProgress";
42
39
  export { default as FormLabel } from "./deprecated/FormLabel";
43
40
  export { default as GroupSelect } from "./deprecated/GroupSelect";
@@ -46,9 +43,7 @@ export { default as ListItemDivider } from "./deprecated/ListItemDivider";
46
43
  export { default as ListItemGrid } from "./deprecated/ListItemGrid";
47
44
  export { default as ListItemText } from "./deprecated/ListItemText";
48
45
  export { default as ReferenceChipList } from "./deprecated/ReferenceChipList";
49
- export { default as Section } from "./deprecated/Section";
50
46
  export { default as ShadowedSection } from "./deprecated/ShadowedSection";
51
47
  export { default as StatusChip } from "./deprecated/StatusChip";
52
48
  export { default as TabbedSection } from "./deprecated/TabbedSection";
53
- export { default as Tabs } from "./deprecated/Tabs";
54
- export { default as TextField } from "./deprecated/TextField";
49
+ export { default as Tabs } from "./deprecated/Tabs";
@@ -2,6 +2,9 @@ import { createTheme as createMuiTheme } from "@mui/material";
2
2
  import typography from "./typography";
3
3
  import palette from "./palette";
4
4
  import * as cssBaseline from "./mui/cssBaseline";
5
+ import * as accordion from "./mui/accordion";
6
+ import * as accordionSummary from "./mui/accordionSummary";
7
+ import * as accordionDetails from "./mui/accordionDetails";
5
8
  import * as buttonBase from "./mui/buttonBase";
6
9
  import * as icon from "./mui/icon";
7
10
  import * as button from "./mui/button";
@@ -48,6 +51,9 @@ export default function createTheme() {
48
51
  theme = createMuiTheme(theme, {
49
52
  components: {
50
53
  MuiCssBaseline: cssBaseline.styles,
54
+ MuiAccordion: accordion.styles,
55
+ MuiAccordionSummary: accordionSummary.styles,
56
+ MuiAccordionDetails: accordionDetails.styles,
51
57
  MuiButtonBase: buttonBase.styles,
52
58
  MuiButton: button.styles,
53
59
  MuiToggleButton: toggleButton.styles,
@@ -0,0 +1,16 @@
1
+ import { blueGrey } from "../../colors";
2
+ export const styles = {
3
+ styleOverrides: {
4
+ root: {
5
+ backgroundColor: blueGrey.contentBg,
6
+ boxShadow: 'none',
7
+ margin: '32px 0px',
8
+ '&.Mui-expanded': {
9
+ margin: '32px 0px'
10
+ },
11
+ '&:before': {
12
+ display: 'none'
13
+ }
14
+ }
15
+ }
16
+ };
@@ -0,0 +1,7 @@
1
+ export const styles = {
2
+ styleOverrides: {
3
+ root: {
4
+ padding: '24px 0px 0px 0px'
5
+ }
6
+ }
7
+ };
@@ -0,0 +1,21 @@
1
+ import { grey } from "../../colors";
2
+ import typography from "../typography";
3
+ export const styles = {
4
+ styleOverrides: {
5
+ root: {
6
+ minHeight: 42,
7
+ padding: '0px 0px',
8
+ borderBottom: `1px ${grey[300]} solid`,
9
+ '&.Mui-expanded': {
10
+ minHeight: 42
11
+ }
12
+ },
13
+ content: {
14
+ ...typography.headline2,
15
+ margin: '0px 0px',
16
+ '&.Mui-expanded': {
17
+ margin: '0px 0px'
18
+ }
19
+ }
20
+ }
21
+ };
@@ -67,24 +67,31 @@ export const styles = {
67
67
  rowReorderCell: {
68
68
  color: grey[700]
69
69
  },
70
+ 'row--editing': {
71
+ boxShadow: 'none'
72
+ },
70
73
  cell: ({
71
74
  ownerState
72
75
  }) => ({
73
76
  minHeight: '40px !important',
74
- paddingTop: 10,
75
- paddingBottom: 10,
76
77
  '&.MuiTypography-bold': {
77
78
  fontWeight: 'bold'
78
79
  },
79
80
  '&.MuiTypography-greyed': {
80
81
  color: grey[600]
81
82
  },
82
- '&:focus, &:focus-within': {
83
+ '&:focus': {
84
+ outline: ownerState?.editable ? `solid ${blue[500]} 1px` : 'none'
85
+ },
86
+ '&:focus-within': {
83
87
  outline: ownerState?.editable ? `solid ${blue[500]} 1px` : 'none'
84
88
  },
85
89
  '&.MuiDataGrid-cell--editing': {
86
90
  boxShadow: 'none',
87
- '&:focus, &:focus-within': {
91
+ '&:focus': {
92
+ outline: `solid ${blue[500]} 1px`
93
+ },
94
+ '&:focus-within': {
88
95
  outline: `solid ${blue[500]} 1px`
89
96
  }
90
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"
@@ -1,45 +0,0 @@
1
- import MuiAccordion from "@mui/material/Accordion";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- const styles = {
4
- border: '1px solid #eaeaea',
5
- boxShadow: 'none',
6
- '.MuiAccordionDetails-root': {
7
- pt: 0,
8
- pl: 8,
9
- pr: 8
10
- },
11
- '.MuiFormLabel-root.MuiInputLabel-root': {
12
- fontSize: '14px'
13
- },
14
- '.MuiInputBase-input.MuiInput-input': {
15
- color: '#555',
16
- fontSize: '15px'
17
- },
18
- '.MuiTabs-root.MuiTabs-vertical': {
19
- mt: 2
20
- },
21
- '.MuiTabs-root.MuiTabs-vertical .MuiButtonBase-root.MuiTab-root': {
22
- fontSize: '14px',
23
- minWidth: '32px',
24
- maxWidth: '32px'
25
- },
26
- '.MuiButtonBase-root.MuiToggleButton-root': {
27
- pt: '1px',
28
- pb: '1px',
29
- fontSize: '12px'
30
- }
31
- };
32
- export default function Accordion({
33
- children,
34
- sx,
35
- ...props
36
- }) {
37
- return /*#__PURE__*/_jsx(MuiAccordion, {
38
- sx: {
39
- ...sx,
40
- ...styles
41
- },
42
- ...props,
43
- children: children
44
- });
45
- }
@@ -1,19 +0,0 @@
1
- import MuiAccordionDetails from "@mui/material/AccordionDetails";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- const styles = {
4
- mb: 2
5
- };
6
- export default function AccordionDetails({
7
- children,
8
- sx,
9
- ...props
10
- }) {
11
- return /*#__PURE__*/_jsx(MuiAccordionDetails, {
12
- sx: {
13
- ...sx,
14
- ...styles
15
- },
16
- ...props,
17
- children: children
18
- });
19
- }
@@ -1,35 +0,0 @@
1
- import { Stack, Typography } from "@mui/material";
2
- import MuiAccordionSummary from "@mui/material/AccordionSummary";
3
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
- import { Fragment as _Fragment } from "react/jsx-runtime";
7
- export default function AccordionSummary({
8
- title,
9
- desc,
10
- children,
11
- ...props
12
- }) {
13
- return /*#__PURE__*/_jsxs(_Fragment, {
14
- children: [title && /*#__PURE__*/_jsx(MuiAccordionSummary, {
15
- expandIcon: /*#__PURE__*/_jsx(ExpandMoreIcon, {}),
16
- ...props,
17
- children: /*#__PURE__*/_jsxs(Stack, {
18
- direction: "row",
19
- alignItems: "flex-end",
20
- gap: 1,
21
- children: [/*#__PURE__*/_jsx(Typography, {
22
- children: title
23
- }), desc && /*#__PURE__*/_jsx(Typography, {
24
- variant: "caption",
25
- color: "#aaa",
26
- children: desc
27
- })]
28
- })
29
- }), !title && /*#__PURE__*/_jsx(MuiAccordionSummary, {
30
- expandIcon: /*#__PURE__*/_jsx(ExpandMoreIcon, {}),
31
- ...props,
32
- children: children
33
- })]
34
- });
35
- }
@@ -1,61 +0,0 @@
1
- import { useMemo } from "react";
2
- import MuiButton from "@mui/material/Button";
3
- import { Box, CircularProgress, IconButton } from "@mui/material";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
- export default function Button({
7
- label,
8
- icon,
9
- iconPlacement = 'start',
10
- iconSize = '20px',
11
- iconProps = {},
12
- progressProps = {},
13
- loading = false,
14
- ...props
15
- }) {
16
- const iconComponent = useMemo(() => {
17
- return icon ? /*#__PURE__*/_jsx(Box, {
18
- component: icon,
19
- sx: {
20
- '&.MuiSvgIcon-root': {
21
- fontSize: `${iconSize}!important`
22
- }
23
- },
24
- ...iconProps
25
- }) : null;
26
- }, [icon, iconSize, iconProps]);
27
- const startIcon = useMemo(() => {
28
- return iconPlacement === 'start' ? iconComponent : null;
29
- }, [iconComponent, iconPlacement]);
30
- const endIcon = useMemo(() => {
31
- return iconPlacement === 'end' ? iconComponent : null;
32
- }, [iconComponent, iconPlacement]);
33
- return /*#__PURE__*/_jsxs(Box, {
34
- sx: {
35
- position: 'relative',
36
- width: 'fit-content'
37
- },
38
- children: [label ? /*#__PURE__*/_jsx(MuiButton, {
39
- startIcon: startIcon,
40
- endIcon: endIcon,
41
- disabled: loading,
42
- ...props,
43
- children: label
44
- }) : /*#__PURE__*/_jsx(IconButton, {
45
- disabled: loading,
46
- ...props,
47
- children: iconComponent
48
- }), loading && /*#__PURE__*/_jsx(CircularProgress, {
49
- size: 24,
50
- thickness: 6,
51
- sx: {
52
- position: 'absolute',
53
- top: '50%',
54
- left: '50%',
55
- marginTop: '-12px',
56
- marginLeft: '-12px'
57
- },
58
- ...progressProps
59
- })]
60
- });
61
- }
@@ -1,25 +0,0 @@
1
- import MuiTextField from "@mui/material/TextField";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Fragment as _Fragment } from "react/jsx-runtime";
4
- export default function TextField({
5
- width,
6
- fontSize,
7
- textAlign,
8
- inputProps,
9
- ...props
10
- }) {
11
- const styles = {
12
- fontSize: fontSize ? fontSize : 16,
13
- textAlign: textAlign ? textAlign : 'left',
14
- width
15
- };
16
- return /*#__PURE__*/_jsx(_Fragment, {
17
- children: /*#__PURE__*/_jsx(MuiTextField, {
18
- inputProps: {
19
- ...inputProps,
20
- style: styles
21
- },
22
- ...props
23
- })
24
- });
25
- }