@nethru/ui 2.0.12 → 2.0.13

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.
@@ -31,6 +31,10 @@ const AccordionSummary = /*#__PURE__*/forwardRef(({
31
31
  }), children, subcontent && /*#__PURE__*/_jsx(Typography, {
32
32
  variant: "bodySmSemibold",
33
33
  color: grey[600],
34
+ sx: {
35
+ whiteSpace: 'normal',
36
+ wordBreak: 'break-all'
37
+ },
34
38
  children: subcontent
35
39
  })]
36
40
  })
@@ -484,4 +484,17 @@ export const DisapprovalIcon = createSvgIcon( /*#__PURE__*/_jsx("svg", {
484
484
  d: "M12 16C12.2833 16 12.5208 15.9042 12.7125 15.7125C12.9042 15.5208 13 15.2833 13 15C13 14.7167 12.9042 14.4792 12.7125 14.2875C12.5208 14.0958 12.2833 14 12 14C11.7167 14 11.4792 14.0958 11.2875 14.2875C11.0958 14.4792 11 14.7167 11 15C11 15.2833 11.0958 15.5208 11.2875 15.7125C11.4792 15.9042 11.7167 16 12 16ZM11 12H13V7H11V12ZM12 22C9.68333 21.4167 7.77083 20.0875 6.2625 18.0125C4.75417 15.9375 4 13.6333 4 11.1V5L12 2L20 5V11.1C20 13.6333 19.2458 15.9375 17.7375 18.0125C16.2292 20.0875 14.3167 21.4167 12 22ZM12 19.9C13.7333 19.35 15.1667 18.25 16.3 16.6C17.4333 14.95 18 13.1167 18 11.1V6.375L12 4.125L6 6.375V11.1C6 13.1167 6.56667 14.95 7.7 16.6C8.83333 18.25 10.2667 19.35 12 19.9Z",
485
485
  fill: "#7B7B7B"
486
486
  })
487
- }), 'Disapproval');
487
+ }), 'Disapproval');
488
+ export const SplitLayoutIcon = createSvgIcon( /*#__PURE__*/_jsx("svg", {
489
+ width: "24",
490
+ height: "24",
491
+ viewBox: "0 0 24 24",
492
+ fill: "none",
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ children: /*#__PURE__*/_jsx("path", {
495
+ fillRule: "evenodd",
496
+ clipRule: "evenodd",
497
+ d: "M14.9 6.8H16C16.6627 6.8 17.2 7.33726 17.2 8V16C17.2 16.6627 16.6627 17.2 16 17.2H14.9V6.8ZM13.1 6.8H8C7.33726 6.8 6.8 7.33726 6.8 8V16C6.8 16.6627 7.33726 17.2 8 17.2H13.1V6.8ZM5 8C5 6.34315 6.34315 5 8 5H16C17.6569 5 19 6.34315 19 8V16C19 17.6569 17.6569 19 16 19H8C6.34315 19 5 17.6569 5 16V8Z",
498
+ fill: "#7B7B7B"
499
+ })
500
+ }), 'SplitLayout');
@@ -10,37 +10,32 @@ const Frame = /*#__PURE__*/forwardRef(({
10
10
  menu,
11
11
  menuIcons = {},
12
12
  children,
13
- footer,
14
13
  mainRef,
15
14
  onScroll
16
15
  }, ref) => {
17
16
  const containerStyles = useMemo(() => ({
18
17
  display: 'flex',
19
- flexGrow: 1,
20
- overflow: 'auto',
21
- marginTop: 'var(--gnb-height)'
18
+ height: '100%'
22
19
  }), []);
23
20
  const contentStyles = useMemo(() => ({
24
21
  flexGrow: 1,
25
22
  overflow: 'auto',
26
- padding: '24px 28px',
23
+ height: '100%',
27
24
  backgroundColor: blueGrey.contentBg
28
25
  }), []);
29
26
  return /*#__PURE__*/_jsx(Box, {
30
27
  ref: ref,
28
+ height: "100%",
31
29
  children: /*#__PURE__*/_jsxs(SidebarContextProvider, {
32
30
  menu: menu,
33
31
  icons: menuIcons,
34
32
  children: [appBar, /*#__PURE__*/_jsxs(Box, {
35
33
  sx: containerStyles,
36
- children: [sideBar, /*#__PURE__*/_jsxs(Box, {
34
+ children: [sideBar, /*#__PURE__*/_jsx(Box, {
37
35
  ref: mainRef,
38
- component: "section",
39
36
  sx: contentStyles,
40
37
  onScroll: onScroll,
41
- children: [/*#__PURE__*/_jsx("main", {
42
- children: children
43
- }), footer]
38
+ children: children
44
39
  })]
45
40
  })]
46
41
  })
@@ -0,0 +1,25 @@
1
+ import { forwardRef } from "react";
2
+ import { Box } from '@mui/material';
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ const SimpleLayout = /*#__PURE__*/forwardRef(({
5
+ children,
6
+ footer,
7
+ sx,
8
+ ...props
9
+ }, ref) => {
10
+ return /*#__PURE__*/_jsxs(Box, {
11
+ ref: ref,
12
+ component: "section",
13
+ sx: {
14
+ ...sectionStyles,
15
+ ...sx
16
+ },
17
+ ...props,
18
+ children: [children, footer]
19
+ });
20
+ });
21
+ export default SimpleLayout;
22
+ const sectionStyles = {
23
+ height: '100%',
24
+ padding: '24px 28px'
25
+ };
@@ -0,0 +1,149 @@
1
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { Box, Grid, IconButton, Stack, Tooltip } from '@mui/material';
3
+ import { blueGrey, grey } from "../colors";
4
+ import { SplitLayoutIcon } from "../assets/icons";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const SplitLayout = /*#__PURE__*/forwardRef(({
8
+ defaultAsidePortion = 33,
9
+ minWidths = [500, 300],
10
+ resetButtonMarginTop = 13,
11
+ children,
12
+ aside,
13
+ footer,
14
+ sx,
15
+ ...props
16
+ }, ref) => {
17
+ const containerRef = useRef(null);
18
+ const asideRef = useRef(null);
19
+ const currentX = useRef();
20
+ const [resizing, setResizing] = useState(false);
21
+ const [asidePortion, setAsidePortion] = useState(aside ? defaultAsidePortion : 0);
22
+ const arrangedMinWidths = useMemo(() => [Math.min(minWidths[0], 703), Math.min(minWidths[1], 346)], [minWidths]);
23
+ const resetButtonStyles = useMemo(() => ({
24
+ position: 'absolute',
25
+ top: `${resetButtonMarginTop}px`,
26
+ right: '16px',
27
+ zIndex: 'var(--aside-button-zindex)',
28
+ transition: 'opacity .5s',
29
+ '&': {
30
+ backgroundColor: '#dfe0e1'
31
+ },
32
+ ':hover, &.Mui-focusVisible': {
33
+ backgroundColor: '#d9dadb'
34
+ },
35
+ '&:active': {
36
+ backgroundColor: '#c7c8c8'
37
+ }
38
+ }), [resetButtonMarginTop]);
39
+ const handleMouseDown = useCallback(event => {
40
+ event.preventDefault();
41
+ currentX.current = event.clientX;
42
+ setResizing(true);
43
+ }, [setResizing]);
44
+ const handleMouseUp = useCallback(event => {
45
+ setResizing(false);
46
+ }, [setResizing]);
47
+ const handleMouseMove = useCallback(event => {
48
+ if (!resizing) return;
49
+ const containerWidth = containerRef.current.clientWidth;
50
+ const asideWidth = asideRef.current.clientWidth + currentX.current - event.clientX;
51
+ const sectionWidth = containerWidth - asideWidth;
52
+ currentX.current = event.clientX;
53
+ if (sectionWidth < arrangedMinWidths[0] || asideWidth < arrangedMinWidths[1]) return;
54
+ setAsidePortion(asideWidth / containerWidth * 100);
55
+ }, [resizing, arrangedMinWidths]);
56
+ const reset = useCallback(event => {
57
+ setAsidePortion(defaultAsidePortion);
58
+ }, [defaultAsidePortion]);
59
+ useEffect(() => {
60
+ if (resizing) {
61
+ document.addEventListener('mousemove', handleMouseMove);
62
+ document.addEventListener('mouseup', handleMouseUp);
63
+ document.body.style.cursor = 'col-resize';
64
+ } else {
65
+ document.removeEventListener('mousemove', handleMouseMove);
66
+ document.removeEventListener('mouseup', handleMouseUp);
67
+ document.body.style.cursor = 'unset';
68
+ }
69
+ return () => {
70
+ document.removeEventListener('mousemove', handleMouseMove);
71
+ document.removeEventListener('mouseup', handleMouseUp);
72
+ };
73
+ }, [resizing, handleMouseMove, handleMouseUp]);
74
+ useEffect(() => {
75
+ if (!aside) setAsidePortion(0);else if (asidePortion === 0) setAsidePortion(defaultAsidePortion);
76
+ // eslint-disable-next-line
77
+ }, [aside]);
78
+ return /*#__PURE__*/_jsxs(Grid, {
79
+ container: true,
80
+ ref: containerRef,
81
+ columns: 100,
82
+ columnSpacing: 0,
83
+ sx: {
84
+ ...containerStyles,
85
+ ...sx
86
+ },
87
+ ...props,
88
+ children: [/*#__PURE__*/_jsxs(Grid, {
89
+ item: true,
90
+ component: "section",
91
+ xs: 100 - asidePortion,
92
+ sx: sectionStyles,
93
+ children: [children, footer]
94
+ }), aside && /*#__PURE__*/_jsxs(Grid, {
95
+ ref: asideRef,
96
+ item: true,
97
+ component: "aside",
98
+ xs: asidePortion,
99
+ sx: {
100
+ position: 'relative'
101
+ },
102
+ children: [/*#__PURE__*/_jsxs(Stack, {
103
+ direction: "row",
104
+ sx: {
105
+ height: '100%'
106
+ },
107
+ children: [/*#__PURE__*/_jsx(Box, {
108
+ onMouseDown: handleMouseDown,
109
+ sx: dividerStyles
110
+ }), /*#__PURE__*/_jsx(Box, {
111
+ sx: asideStyles,
112
+ children: aside
113
+ })]
114
+ }), /*#__PURE__*/_jsx(Tooltip, {
115
+ title: "\uAE30\uBCF8 \uBD84\uD560\uB85C \uBCC0\uACBD",
116
+ children: /*#__PURE__*/_jsx(IconButton, {
117
+ variant: "crud",
118
+ onClick: reset,
119
+ sx: {
120
+ ...resetButtonStyles,
121
+ opacity: asidePortion > 0 && asidePortion !== defaultAsidePortion ? 1 : 0
122
+ },
123
+ children: /*#__PURE__*/_jsx(SplitLayoutIcon, {})
124
+ })
125
+ })]
126
+ })]
127
+ });
128
+ });
129
+ export default SplitLayout;
130
+ const containerStyles = {
131
+ height: '100%'
132
+ };
133
+ const sectionStyles = {
134
+ padding: '24px 28px'
135
+ };
136
+ const dividerStyles = {
137
+ width: '6px',
138
+ height: '100%',
139
+ borderLeft: `1px solid ${grey[400]}`,
140
+ backgroundColor: blueGrey.frameBg,
141
+ cursor: 'col-resize',
142
+ zIndex: 'var(--divider-zindex)'
143
+ };
144
+ const asideStyles = {
145
+ flexGrow: 1,
146
+ backgroundColor: blueGrey.frameBg,
147
+ padding: '6px 16px 6px 10px',
148
+ zIndex: 'var(--aside-zindex)'
149
+ };
@@ -4,8 +4,9 @@
4
4
  flex-direction: column;
5
5
  width: calc(var(--primary-menu-width) + 10px);
6
6
  padding-right: 10px;
7
- height: 100%;
7
+ height: calc(100% - var(--gnb-height));
8
8
  background-color: var(--frame-background-color);
9
+ z-index: var(--primary-menu-zindex);
9
10
  }
10
11
  .container a {
11
12
  text-decoration: none;
@@ -15,7 +15,7 @@
15
15
  .secondary {
16
16
  position: fixed;
17
17
  left: var(--primary-menu-width);
18
- height: 100%;
18
+ height: calc(100% - var(--gnb-height));
19
19
  z-index: var(--secondary-menu-zindex);
20
20
  white-space: nowrap;
21
21
  overflow-x: hidden;
package/base/index.js CHANGED
@@ -33,8 +33,10 @@ export { default as SearchTextField } from "./SearchTextField";
33
33
  export { default as SectionLabel } from "./SectionLabel";
34
34
  export { default as Select } from "./Select";
35
35
  export { default as Sidebar } from "./frame/sidebar/Sidebar";
36
+ export { default as SimpleLayout } from "./frame/SimpleLayout";
36
37
  export { default as Slider } from "./Slider";
37
38
  export { default as Snackbar } from "./Snackbar";
39
+ export { default as SplitLayout } from "./frame/SplitLayout";
38
40
  export { default as Switch } from "./Switch";
39
41
  export * from './frame/sidebar/SidebarContext';
40
42
  export { default as Error } from "./error/Error";
@@ -8,10 +8,14 @@ const globalStyles = {
8
8
  '--gnb-height': '64px',
9
9
  '--gnb-zindex': 1100,
10
10
  '--primary-menu-width': '72px',
11
+ '--primary-menu-zindex': 1101,
11
12
  '--secondary-menu-width': '180px',
12
13
  '--secondary-menu-collapsed-width': '30px',
13
- '--secondary-menu-zindex': 1101,
14
- '--secondary-menu-toggler-zindex': 1102
14
+ '--secondary-menu-zindex': 1102,
15
+ '--secondary-menu-toggler-zindex': 1103,
16
+ '--aside-zindex': 1104,
17
+ '--aside-button-zindex': 1105,
18
+ '--divider-zindex': 1106
15
19
  },
16
20
  'html, body, #root': {
17
21
  margin: 0,
@@ -20,7 +24,8 @@ const globalStyles = {
20
24
  body: {
21
25
  fontFamily: typography.fontFamily,
22
26
  backgroundColor: blueGrey.contentBg,
23
- minWidth: '1280px'
27
+ minWidth: '1280px',
28
+ paddingTop: 'var(--gnb-height)'
24
29
  },
25
30
  '.highcharts-tooltip-box': {
26
31
  fillOpacity: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"