@nethru/ui 2.1.7 → 2.1.9

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.
@@ -3,11 +3,9 @@ import { Box, FormHelperText } from "@mui/material";
3
3
  import CodeMirror from '@uiw/react-codemirror';
4
4
  import { javascript } from '@codemirror/lang-javascript';
5
5
  import { json } from '@codemirror/lang-json';
6
- import { nScript } from './nScript';
7
- import { Decoration, EditorView } from "@codemirror/view";
6
+ import { Decoration, EditorView, keymap as keyMapper } from "@codemirror/view";
8
7
  import { RegExpCursor, SearchCursor } from '@codemirror/search';
9
8
  import { StateEffect, StateField } from "@codemirror/state";
10
- import { keymap as keyMapper } from '@codemirror/view';
11
9
  import { defaultKeymap } from '@codemirror/commands';
12
10
  import borderRadius from "../styles/borderRadius";
13
11
  import { blue, grey, red, yellow } from "../colors";
@@ -135,7 +133,7 @@ export default function Editor({
135
133
  case 'json':
136
134
  return json();
137
135
  case 'nscript':
138
- return nScript;
136
+ return undefined;
139
137
  default:
140
138
  return javascript({
141
139
  jsx: true
@@ -146,7 +144,8 @@ export default function Editor({
146
144
  return [keyMapper.of(keymap), keyMapper.of(defaultKeymap)];
147
145
  }, [keymap]);
148
146
  const extensionList = useMemo(() => {
149
- const result = [languageExtension, EditorView.lineWrapping, highlight.extension, ...keymapExtension];
147
+ const result = [EditorView.lineWrapping, highlight.extension, ...keymapExtension];
148
+ if (languageExtension) result.push(languageExtension);
150
149
  if (onScroll) {
151
150
  result.push(EditorView.domEventHandlers({
152
151
  scroll(event, view) {
@@ -14,6 +14,7 @@ const AppBar = /*#__PURE__*/forwardRef(({
14
14
  ...props
15
15
  }, ref) => {
16
16
  const {
17
+ sections,
17
18
  states
18
19
  } = useSidebarContext();
19
20
  const styles = useMemo(() => ({
@@ -46,9 +47,12 @@ const AppBar = /*#__PURE__*/forwardRef(({
46
47
  children: [children, !children && /*#__PURE__*/_jsx(Box, {}), avatarSlot]
47
48
  })]
48
49
  })
49
- }), /*#__PURE__*/_jsx(Box, {
50
+ }), !isEmpty(sections) && /*#__PURE__*/_jsx(Box, {
50
51
  sx: styles
51
52
  })]
52
53
  });
53
54
  });
54
- export default AppBar;
55
+ export default AppBar;
56
+ function isEmpty(list) {
57
+ return list && list.length === 0;
58
+ }
@@ -21,7 +21,10 @@ const Frame = /*#__PURE__*/forwardRef(({
21
21
  flexGrow: 1,
22
22
  overflow: 'auto',
23
23
  height: '100%',
24
- backgroundColor: blueGrey.contentBg
24
+ backgroundColor: blueGrey.contentBg,
25
+ borderRadius: '8px 0px 0px 0px',
26
+ zIndex: `var(--contents-zindex)`,
27
+ boxShadow: '-10px 1px 8px -10px #65656533, 0px -10px 8px -10px #65656533'
25
28
  }), []);
26
29
  return /*#__PURE__*/_jsx(Box, {
27
30
  ref: ref,
@@ -1,4 +1,4 @@
1
- import { forwardRef, useCallback, useEffect, useState } from "react";
1
+ import { forwardRef, useCallback, useEffect } from "react";
2
2
  import { useLocation, useNavigate } from "react-router-dom";
3
3
  import { Stack } from "@mui/material";
4
4
  import { useSidebarContext } from "./SidebarContext";
@@ -7,11 +7,13 @@ import SecondaryMenu from "./SecondaryMenu";
7
7
  import MenuToggler from "./MenuToggler";
8
8
  import styles from './css/sidebar.module.css';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const Sidebar = /*#__PURE__*/forwardRef((props, ref) => {
12
- const [sections, setSections] = useState();
13
13
  const {
14
14
  menu,
15
+ sections,
16
+ setSections,
15
17
  states,
16
18
  dispatch
17
19
  } = useSidebarContext();
@@ -43,17 +45,19 @@ const Sidebar = /*#__PURE__*/forwardRef((props, ref) => {
43
45
  }, [states]);
44
46
  return /*#__PURE__*/_jsxs(Stack, {
45
47
  ref: ref,
46
- className: `${styles.container} ${closed || isEmpty(sections) ? styles.closed : styles.opened}`,
48
+ className: `${styles.container} ${closed ? styles.closed : styles.opened} ${isEmpty(sections) && styles.none}`,
47
49
  children: [/*#__PURE__*/_jsx(PrimaryMenu, {
48
50
  items: menu,
49
51
  onClick: handleClick
50
- }), /*#__PURE__*/_jsx(SecondaryMenu, {
51
- sections: sections ? sections : [],
52
- closed: !isEmpty(sections) ? closed : true,
53
- onClick: handleClick
54
- }), !isEmpty(sections) && /*#__PURE__*/_jsx(MenuToggler, {
55
- closed: closed,
56
- onClick: handleToggle
52
+ }), !isEmpty(sections) && /*#__PURE__*/_jsxs(_Fragment, {
53
+ children: [/*#__PURE__*/_jsx(SecondaryMenu, {
54
+ sections: sections || [],
55
+ closed: !isEmpty(sections) ? closed : true,
56
+ onClick: handleClick
57
+ }), /*#__PURE__*/_jsx(MenuToggler, {
58
+ closed: closed,
59
+ onClick: handleToggle
60
+ })]
57
61
  })]
58
62
  });
59
63
  });
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useReducer } from "react";
1
+ import { createContext, useContext, useReducer, useState } from "react";
2
2
  import { produce } from "immer";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  const SidebarContext = /*#__PURE__*/createContext();
@@ -8,9 +8,12 @@ export function SidebarContextProvider({
8
8
  children
9
9
  }) {
10
10
  const [states, dispatch] = useReducer(reducer, initialStates);
11
+ const [sections, setSections] = useState();
11
12
  return /*#__PURE__*/_jsx(SidebarContext.Provider, {
12
13
  value: {
13
14
  menu,
15
+ sections,
16
+ setSections,
14
17
  icons,
15
18
  states,
16
19
  dispatch
@@ -13,6 +13,11 @@
13
13
  width: calc(var(--primary-menu-width) + var(--secondary-menu-collapsed-width));
14
14
  min-width: calc(var(--primary-menu-width) + var(--secondary-menu-collapsed-width));
15
15
  }
16
+ .container.none {
17
+ width: calc(var(--primary-menu-width));
18
+ min-width: calc(var(--primary-menu-width));
19
+ z-index: var(--primary-menu-only-zindex);
20
+ }
16
21
 
17
22
 
18
23
  .secondary {
@@ -6,17 +6,19 @@ const globalStyles = {
6
6
  '--frame-background-color': blueGrey.frameBg,
7
7
  '--gnb-background-color': blueGrey.gnbBg,
8
8
  '--gnb-height': '64px',
9
- '--gnb-zindex': 1101,
10
- '--sidebar-zindex': 1100,
9
+ '--gnb-zindex': 1103,
10
+ '--sidebar-zindex': 1102,
11
+ '--primary-menu-only-zindex': 1100,
11
12
  '--primary-menu-width': '72px',
12
- '--primary-menu-zindex': 1102,
13
+ '--primary-menu-zindex': 1104,
13
14
  '--secondary-menu-width': '180px',
14
15
  '--secondary-menu-collapsed-width': '30px',
15
- '--secondary-menu-zindex': 1103,
16
- '--secondary-menu-toggler-zindex': 1104,
17
- '--aside-zindex': 1105,
18
- '--aside-button-zindex': 1106,
19
- '--divider-zindex': 1107
16
+ '--secondary-menu-zindex': 1105,
17
+ '--secondary-menu-toggler-zindex': 1106,
18
+ '--aside-zindex': 1107,
19
+ '--aside-button-zindex': 1108,
20
+ '--divider-zindex': 1109,
21
+ '--contents-zindex': 1101
20
22
  },
21
23
  'html, body, #root': {
22
24
  margin: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"