@nethru/ui 2.0.3 → 2.0.5

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
+ };
@@ -13,6 +13,8 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
13
13
  readOnly,
14
14
  gap = 2,
15
15
  margins = [5, 5],
16
+ showAddButton = true,
17
+ showRemoveButton = true,
16
18
  ...props
17
19
  }, ref) => {
18
20
  return /*#__PURE__*/_jsx(Stack, {
@@ -29,20 +31,28 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
29
31
  alignItems: "start",
30
32
  gap: 1,
31
33
  marginTop: `${margins[index > 0 ? 1 : 0]}px`,
32
- children: [/*#__PURE__*/_jsx(Tooltip, {
34
+ children: [showRemoveButton && /*#__PURE__*/_jsx(Tooltip, {
33
35
  title: "\uC0AD\uC81C",
34
36
  children: /*#__PURE__*/_jsx(IconButton, {
35
- color: "crud",
37
+ variant: "menu",
36
38
  onClick: _ => onRemove(index),
37
39
  disabled: forms.length === 1,
38
- children: /*#__PURE__*/_jsx(RemoveIcon, {})
40
+ children: /*#__PURE__*/_jsx(RemoveIcon, {
41
+ sx: {
42
+ fontSize: 17
43
+ }
44
+ })
39
45
  })
40
- }), /*#__PURE__*/_jsx(Tooltip, {
46
+ }), showAddButton && /*#__PURE__*/_jsx(Tooltip, {
41
47
  title: "\uCD94\uAC00",
42
48
  children: /*#__PURE__*/_jsx(IconButton, {
43
- color: "crud",
49
+ variant: "menu",
44
50
  onClick: _ => onAdd(index),
45
- children: /*#__PURE__*/_jsx(AddIcon, {})
51
+ children: /*#__PURE__*/_jsx(AddIcon, {
52
+ sx: {
53
+ fontSize: 17
54
+ }
55
+ })
46
56
  })
47
57
  })]
48
58
  })]
package/base/Switch.js CHANGED
@@ -10,6 +10,7 @@ const Switch = /*#__PURE__*/forwardRef(({
10
10
  return /*#__PURE__*/_jsx(FormControlLabel, {
11
11
  ref: ref,
12
12
  label: label,
13
+ labelPlacement: "start",
13
14
  control: /*#__PURE__*/_jsx(MuiSwitch, {
14
15
  ...props,
15
16
  color: "info"
@@ -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,9 +33,6 @@ 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
38
  export { default as CircularProgress } from "./deprecated/CircularProgress";
@@ -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
- minHeight: '45px !important',
74
- paddingTop: 10,
75
- paddingBottom: 10,
76
+ minHeight: '40px !important',
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
  }
@@ -1,6 +1,9 @@
1
1
  import { grey } from "../../colors";
2
2
  import borderRadius from "../borderRadius";
3
3
  export const styles = {
4
+ defaultProps: {
5
+ columnSpacing: 5
6
+ },
4
7
  styleOverrides: {
5
8
  item: {
6
9
  '.MuiGrid-box': {
@@ -27,7 +27,7 @@ export const styles = {
27
27
  },
28
28
  style: {
29
29
  '&': {
30
- backgroundColor: undefined,
30
+ backgroundColor: grey[5],
31
31
  borderRadius: borderRadius[2],
32
32
  '&:active': {
33
33
  backgroundColor: grey[10],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
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
- }