@nethru/ui 1.0.81 → 2.0.0

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.
Files changed (140) hide show
  1. package/base/AddableFormList.js +56 -0
  2. package/base/Alert.js +27 -0
  3. package/base/Checkbox.js +20 -0
  4. package/base/CircularProgressButton.js +36 -0
  5. package/base/ColumnedSection.js +44 -0
  6. package/base/DropdownButton.js +74 -0
  7. package/base/MainHeader.js +56 -0
  8. package/base/MenuItem.js +92 -0
  9. package/base/PropertyTable.js +69 -0
  10. package/base/SearchTextField.js +44 -0
  11. package/base/SearchableSelect.js +64 -0
  12. package/base/Select.js +33 -0
  13. package/{dist → base}/Slider.js +12 -13
  14. package/base/Snackbar.js +33 -0
  15. package/base/Switch.js +20 -0
  16. package/base/assets/icons.js +390 -0
  17. package/base/assets/images.js +1 -0
  18. package/base/colors/blue.js +15 -0
  19. package/base/colors/blueGrey.js +6 -0
  20. package/base/colors/green.js +13 -0
  21. package/base/colors/grey.js +18 -0
  22. package/base/colors/index.js +9 -0
  23. package/base/colors/lime.js +13 -0
  24. package/base/colors/orange.js +13 -0
  25. package/base/colors/purple.js +13 -0
  26. package/base/colors/red.js +13 -0
  27. package/base/colors/yellow.js +13 -0
  28. package/base/datagrid/DataGrid.js +57 -0
  29. package/base/datagrid/Footer.js +51 -0
  30. package/base/datagrid/Pagination.js +24 -0
  31. package/base/dialog/AlertDialog.js +21 -0
  32. package/base/dialog/ConfirmDialog.js +29 -0
  33. package/base/dialog/Dialog.js +56 -0
  34. package/base/dialog/SimpleDialog.js +33 -0
  35. package/{dist → base}/error/Error.js +1 -2
  36. package/base/frame/AppBar.js +54 -0
  37. package/base/frame/Brand.js +36 -0
  38. package/base/frame/Frame.js +49 -0
  39. package/{dist → base/frame}/sidebar/MenuToggler.js +14 -3
  40. package/{dist → base/frame}/sidebar/PrimaryMenu.js +15 -20
  41. package/base/frame/sidebar/SecondaryMenu.js +41 -0
  42. package/{dist → base/frame}/sidebar/Sidebar.js +21 -10
  43. package/base/frame/sidebar/SidebarContext.js +74 -0
  44. package/base/frame/sidebar/css/primary.module.css +69 -0
  45. package/base/frame/sidebar/css/sidebar.module.css +63 -0
  46. package/base/index.js +33 -0
  47. package/{dist → base}/samples/menu.sample.json +2 -2
  48. package/base/styles/borderRadius.js +7 -0
  49. package/base/styles/createTheme.js +90 -0
  50. package/base/styles/globalStyles.js +47 -0
  51. package/base/styles/mui/alert.js +40 -0
  52. package/base/styles/mui/appBar.js +17 -0
  53. package/base/styles/mui/autocomplete.js +46 -0
  54. package/base/styles/mui/avatar.js +14 -0
  55. package/base/styles/mui/button.js +276 -0
  56. package/base/styles/mui/buttonBase.js +10 -0
  57. package/base/styles/mui/checkbox.js +37 -0
  58. package/base/styles/mui/chip.js +83 -0
  59. package/base/styles/mui/cssBaseline.js +12 -0
  60. package/base/styles/mui/dataGrid.js +101 -0
  61. package/base/styles/mui/dialog.js +13 -0
  62. package/base/styles/mui/dialogActions.js +8 -0
  63. package/base/styles/mui/dialogContent.js +10 -0
  64. package/base/styles/mui/dialogTitle.js +11 -0
  65. package/base/styles/mui/formControl.js +8 -0
  66. package/base/styles/mui/formControlLabel.js +9 -0
  67. package/base/styles/mui/formHelperText.js +10 -0
  68. package/base/styles/mui/grid.js +15 -0
  69. package/base/styles/mui/icon.js +12 -0
  70. package/base/styles/mui/iconButton.js +79 -0
  71. package/base/styles/mui/inputLabel.js +13 -0
  72. package/base/styles/mui/list.js +11 -0
  73. package/base/styles/mui/menuItem.js +83 -0
  74. package/base/styles/mui/outlinedInput.js +53 -0
  75. package/base/styles/mui/paginationItem.js +25 -0
  76. package/base/styles/mui/paper.js +8 -0
  77. package/base/styles/mui/popover.js +11 -0
  78. package/base/styles/mui/select.js +11 -0
  79. package/base/styles/mui/slider.js +15 -0
  80. package/base/styles/mui/snackbar.js +24 -0
  81. package/base/styles/mui/switch.js +33 -0
  82. package/base/styles/mui/tab.js +23 -0
  83. package/base/styles/mui/tablePagination.js +8 -0
  84. package/base/styles/mui/tabs.js +20 -0
  85. package/base/styles/mui/textField.js +11 -0
  86. package/base/styles/mui/toggleButton.js +96 -0
  87. package/base/styles/mui/tooltip.js +22 -0
  88. package/base/styles/palette.js +40 -0
  89. package/base/styles/shadow.js +8 -0
  90. package/base/styles/typography.js +131 -0
  91. package/package.json +14 -10
  92. package/dist/Accordion.js +0 -45
  93. package/dist/AccordionDetails.js +0 -19
  94. package/dist/AccordionSummary.js +0 -35
  95. package/dist/AlertDialog.js +0 -55
  96. package/dist/AppBar.js +0 -68
  97. package/dist/AppendableFormList.js +0 -56
  98. package/dist/AvatarDropdown.js +0 -80
  99. package/dist/Button.js +0 -61
  100. package/dist/Checkbox.js +0 -27
  101. package/dist/CircularProgress.js +0 -33
  102. package/dist/ColumnedSection.js +0 -64
  103. package/dist/ConfirmDialog.js +0 -65
  104. package/dist/DataGrid.js +0 -150
  105. package/dist/Dialog.js +0 -42
  106. package/dist/DropdownButton.js +0 -59
  107. package/dist/FormLabel.js +0 -23
  108. package/dist/Frame.js +0 -47
  109. package/dist/GroupSelect.js +0 -67
  110. package/dist/ListItem.js +0 -21
  111. package/dist/ListItemDivider.js +0 -15
  112. package/dist/ListItemGrid.js +0 -12
  113. package/dist/ListItemText.js +0 -44
  114. package/dist/MainHeader.js +0 -59
  115. package/dist/PropertyTable.js +0 -141
  116. package/dist/ReferenceChipList.js +0 -59
  117. package/dist/SearchTextField.js +0 -24
  118. package/dist/SearchableSelect.js +0 -41
  119. package/dist/Section.js +0 -22
  120. package/dist/Select.js +0 -48
  121. package/dist/ShadowedSection.js +0 -36
  122. package/dist/Snackbar.js +0 -51
  123. package/dist/StatusChip.js +0 -34
  124. package/dist/Switch.js +0 -37
  125. package/dist/TabbedSection.js +0 -37
  126. package/dist/Tabs.js +0 -38
  127. package/dist/TextField.js +0 -25
  128. package/dist/index.js +0 -42
  129. package/dist/samples/global.sample.css +0 -59
  130. package/dist/sidebar/MenuTree.js +0 -95
  131. package/dist/sidebar/MenuTreeGroup.js +0 -65
  132. package/dist/sidebar/SecondaryMenu.js +0 -36
  133. package/dist/sidebar/SidebarContext.js +0 -122
  134. package/dist/sidebar/css/primary.module.css +0 -80
  135. package/dist/sidebar/css/sidebar.module.css +0 -50
  136. package/dist/variables.js +0 -6
  137. /package/{dist → base}/editor/Editor.js +0 -0
  138. /package/{dist → base}/editor/nScript.js +0 -0
  139. /package/{dist → base}/editor/nScriptKeywords.js +0 -0
  140. /package/{dist → base}/error/HttpError.js +0 -0
@@ -1,59 +0,0 @@
1
- /* variable */
2
- :root {
3
- --body-background-color: #f8f9fa;
4
- --gnb-height: 64px;
5
- --primary-menu-width: 56px;
6
- --secondary-menu-width: 256px;
7
- }
8
-
9
-
10
- /* global */
11
- html, body {
12
- margin: 0;
13
- height: 100%;
14
- }
15
-
16
- #root {
17
- display: flex;
18
- flex-direction: column;
19
- height: 100%;
20
- }
21
-
22
-
23
- /* margin */
24
- .ml-auto {
25
- margin-left: auto;
26
- }
27
- .mr-auto {
28
- margin-right: auto;
29
- }
30
- .mt-auto {
31
- margin-top: auto;
32
- }
33
- .mt-bottom {
34
- margin-bottom: auto;
35
- }
36
-
37
-
38
- /* Highchart */
39
- .highcharts-tooltip-box {
40
- fill-opacity: 0;
41
- }
42
-
43
- .highcharts-tooltip > span {
44
- background: #fff;
45
- border: 1px solid #ccc;
46
- border-radius: 3px;
47
- padding: 8px;
48
- }
49
-
50
-
51
- /* CodeMirror */
52
- .cm-theme-light {
53
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
54
- font-size: 14px;
55
- }
56
-
57
- .cm-editor, .cm-editor.cm-focused {
58
- outline: 1px solid #eaeaea;
59
- }
@@ -1,95 +0,0 @@
1
- import { useNavigate } from "react-router-dom";
2
- import { getMenuTreeStates, useSidebarContext } from "./SidebarContext";
3
- import { TreeItem, TreeView } from "@mui/x-tree-view";
4
- import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
5
- import ArrowRightIcon from '@mui/icons-material/ArrowRight';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const HAS_CHILDREN = "has-children";
8
- export default function MenuTree({
9
- id,
10
- data
11
- }) {
12
- const styles = {
13
- paddingRight: '18px',
14
- '.MuiTreeItem-content': {
15
- padding: '7px 8px'
16
- },
17
- '.MuiTreeItem-content.Mui-selected': {
18
- backgroundColor: 'rgba(25, 118, 210, 0.2)'
19
- },
20
- '.MuiTreeItem-content .MuiTreeItem-label': {
21
- fontSize: '0.9rem'
22
- },
23
- 'li.has-children > .MuiTreeItem-content': {
24
- backgroundColor: 'transparent'
25
- }
26
- };
27
- const navigate = useNavigate();
28
- const {
29
- states,
30
- dispatch
31
- } = useSidebarContext();
32
- const {
33
- expanded
34
- } = getMenuTreeStates(states, id);
35
- const handleSelect = (event, ids) => {
36
- dispatch({
37
- type: "treeItemSelected",
38
- id,
39
- ids,
40
- hasChildren: hasChildren(event.target)
41
- });
42
- const node = getNode(ids);
43
- if (node && node.href) navigate(node.href instanceof Array ? node.href[0] : node.href);
44
- };
45
- const handleToggle = (event, ids) => {
46
- dispatch({
47
- type: "treeItemExpanded",
48
- id,
49
- ids
50
- });
51
- };
52
- return /*#__PURE__*/_jsx(TreeView, {
53
- defaultCollapseIcon: /*#__PURE__*/_jsx(ArrowDropDownIcon, {}),
54
- defaultExpandIcon: /*#__PURE__*/_jsx(ArrowRightIcon, {}),
55
- sx: styles,
56
- selected: states.activeSecondaryItem || '',
57
- expanded: expanded,
58
- onNodeSelect: handleSelect,
59
- onNodeToggle: handleToggle,
60
- children: render(data)
61
- });
62
- function render(nodes) {
63
- return nodes ? nodes.map(node => /*#__PURE__*/_jsx(TreeItem, {
64
- nodeId: node.id,
65
- label: node.name,
66
- className: node.submenu.length > 0 ? HAS_CHILDREN : "",
67
- children: render(node.submenu)
68
- }, node.id)) : null;
69
- }
70
- function hasChildren(element) {
71
- const target = findTreeItemRoot(element);
72
- return target ? hasClass(target, HAS_CHILDREN) : false;
73
- }
74
- function findTreeItemRoot(element) {
75
- while (element) {
76
- if (hasClass(element, "MuiTreeItem-root")) break;
77
- element = element.parentElement;
78
- }
79
- return element;
80
- }
81
- function hasClass(element, className) {
82
- return [...element.classList].includes(className);
83
- }
84
- function getNode(id, nodes) {
85
- nodes = nodes || data;
86
- for (let node of nodes) {
87
- if (node.id === id) return node;
88
- if (node.submenu.length > 0) {
89
- const child = getNode(id, node.submenu);
90
- if (child) return child;
91
- }
92
- }
93
- return null;
94
- }
95
- }
@@ -1,65 +0,0 @@
1
- import { getMenuGroupStates, useSidebarContext } from './SidebarContext';
2
- import Accordion from '@mui/material/Accordion';
3
- import AccordionSummary from '@mui/material/AccordionSummary';
4
- import AccordionDetails from '@mui/material/AccordionDetails';
5
- import Typography from '@mui/material/Typography';
6
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
7
- import { variables } from '../variables';
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
10
- export default function MenuTreeGroup({
11
- id,
12
- title,
13
- children
14
- }) {
15
- const styles = {
16
- backgroundColor: variables.bodyBackgroundColor,
17
- boxShadow: 'none',
18
- '&:before': {
19
- display: 'none'
20
- },
21
- '&.Mui-expanded': {
22
- margin: 0
23
- },
24
- '.MuiSvgIcon-root': {
25
- width: '0.9em',
26
- height: '0.9em'
27
- },
28
- '.MuiAccordionSummary-root.Mui-expanded': {
29
- minHeight: '48px'
30
- },
31
- '.MuiAccordionSummary-content.Mui-expanded': {
32
- margin: 0
33
- },
34
- '.MuiAccordionDetails-root': {
35
- padding: '0 16px 0 8px'
36
- }
37
- };
38
- const {
39
- states,
40
- dispatch
41
- } = useSidebarContext();
42
- const expanded = getMenuGroupStates(states, id);
43
- const handleChange = (event, expanded) => {
44
- dispatch({
45
- type: "menuGroupExpanded",
46
- id,
47
- expanded
48
- });
49
- };
50
- return /*#__PURE__*/_jsxs(Accordion, {
51
- expanded: expanded,
52
- onChange: handleChange,
53
- square: true,
54
- sx: styles,
55
- children: [/*#__PURE__*/_jsx(AccordionSummary, {
56
- expandIcon: /*#__PURE__*/_jsx(ExpandMoreIcon, {}),
57
- children: /*#__PURE__*/_jsx(Typography, {
58
- variant: "body2",
59
- children: title
60
- })
61
- }), /*#__PURE__*/_jsx(AccordionDetails, {
62
- children: children
63
- })]
64
- });
65
- }
@@ -1,36 +0,0 @@
1
- import { Divider, Stack } from '@mui/material';
2
- import MenuTreeGroup from './MenuTreeGroup';
3
- import MenuTree from './MenuTree';
4
- import styles from './css/sidebar.module.css';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- export default function SecondaryMenu({
7
- sections,
8
- closed
9
- }) {
10
- return /*#__PURE__*/_jsx(Stack, {
11
- className: `${styles.secondary} ${closed ? styles.closed : styles.opened}`,
12
- children: sections.map((section, index) => {
13
- let jsx = [];
14
- jsx.push(index > 0 ? /*#__PURE__*/_jsx(Divider, {
15
- sx: {
16
- ml: 2,
17
- mr: 2
18
- }
19
- }, `${section.id}_${index}`) : null);
20
- jsx.push(section.name ? /*#__PURE__*/_jsx(MenuTreeGroup, {
21
- id: section.id,
22
- title: section.name,
23
- children: /*#__PURE__*/_jsx(MenuTree, {
24
- id: section.id,
25
- data: section.menu
26
- })
27
- }, section.id) : /*#__PURE__*/_jsx("div", {
28
- children: /*#__PURE__*/_jsx(MenuTree, {
29
- id: section.id,
30
- data: section.menu
31
- })
32
- }, section.id));
33
- return jsx;
34
- })
35
- });
36
- }
@@ -1,122 +0,0 @@
1
- import { createContext, useContext, useReducer } from "react";
2
- import { produce } from "immer";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- const SidebarContext = /*#__PURE__*/createContext();
5
- export function SidebarContextProvider({
6
- menu,
7
- icons,
8
- children
9
- }) {
10
- const [states, dispatch] = useReducer(reducer, initialStates);
11
- return /*#__PURE__*/_jsx(SidebarContext.Provider, {
12
- value: {
13
- menu,
14
- icons,
15
- states,
16
- dispatch
17
- },
18
- children: children
19
- });
20
- }
21
- export function useSidebarContext() {
22
- return useContext(SidebarContext);
23
- }
24
- export function getMenuGroupStates(states, id) {
25
- return states.menuGroupsExpanded[id] !== undefined ? states.menuGroupsExpanded[id] : true;
26
- }
27
- export function getMenuTreeStates(states, id) {
28
- return states.menuTrees[id] || emptyState();
29
- }
30
- function reducer(states, action) {
31
- const {
32
- id,
33
- type
34
- } = action;
35
- switch (type) {
36
- case 'secondaryMenuToggled':
37
- return produce(states, draft => {
38
- draft.menuClosed = !states.menuClosed;
39
- });
40
- case 'menuGroupExpanded':
41
- return produce(states, draft => {
42
- draft.menuGroupsExpanded[id] = action.expanded;
43
- });
44
- case 'treeItemSelected':
45
- return produce(states, draft => {
46
- for (const key in draft.menuTrees) {
47
- draft.menuTrees[key].selected = [];
48
- }
49
- if (!(id in draft.menuTrees)) draft.menuTrees[id] = emptyState();
50
- draft.menuTrees[id].selected = action.ids;
51
- });
52
- case 'treeItemExpanded':
53
- return produce(states, draft => {
54
- if (!(id in draft.menuTrees)) draft.menuTrees[id] = emptyState();
55
- draft.menuTrees[id].expanded = [...action.ids];
56
- });
57
- case 'updateActiveItems':
58
- return produce(states, draft => {
59
- updateActiveItems(draft, action.menu, action.href);
60
- });
61
- default:
62
- throw new Error(`Undefined Sidebar Action Type: ${JSON.stringify(action)}`);
63
- }
64
- }
65
- function emptyState() {
66
- return {
67
- selected: [],
68
- expanded: []
69
- };
70
- }
71
- const initialStates = {
72
- activePrimaryItem: undefined,
73
- activeSecondaryItem: undefined,
74
- menuClosed: false,
75
- menuGroupsExpanded: {},
76
- menuTrees: {}
77
- };
78
- function updateActiveItems(draft, menu, href) {
79
- draft.activePrimaryItem = undefined;
80
- draft.activeSecondaryItem = undefined;
81
- for (let item of menu) {
82
- if (item.href === href) {
83
- draft.activePrimaryItem = item.id;
84
- return;
85
- }
86
- if (updateActiveSection(item.sections)) {
87
- draft.activePrimaryItem = item.id;
88
- return;
89
- }
90
- }
91
- function updateActiveSection(sections) {
92
- if (!sections) return;
93
- for (let section of sections) {
94
- if (startsWith(section.href)) {
95
- draft.activeSecondaryItem = section.id;
96
- return true;
97
- }
98
- if (updateActiveSubmenuItems(section.id, section.menu)) {
99
- draft.menuGroupsExpanded[section.id] = true;
100
- return true;
101
- }
102
- }
103
- }
104
- function updateActiveSubmenuItems(id, submenu) {
105
- if (!submenu) return;
106
- for (let item of submenu) {
107
- if (startsWith(item.href)) {
108
- if (!(id in draft.menuTrees)) draft.menuTrees[id] = emptyState();
109
- draft.activeSecondaryItem = item.id;
110
- return true;
111
- }
112
- if (updateActiveSubmenuItems(id, item.submenu)) {
113
- draft.menuTrees[id].expanded.push(item.id);
114
- return true;
115
- }
116
- }
117
- }
118
- function startsWith(hrefs) {
119
- const menuHrefs = hrefs instanceof Array ? hrefs : [hrefs];
120
- return menuHrefs.some(menuHref => href.startsWith(menuHref));
121
- }
122
- }
@@ -1,80 +0,0 @@
1
- .container {
2
- display: flex;
3
- flex-direction: column;
4
- position: absolute;
5
- width: var(--primary-menu-width);
6
- height: 100%;
7
- border-right: 1px solid #dee2e6;
8
- z-index: 30;
9
- transition-property: width background-color;
10
- transition-duration: .2s;
11
- }
12
- .container:hover {
13
- width: 240px;
14
- background-color: #fff;
15
- box-shadow: 1px 1px 12px #dadce0;
16
- }
17
- .container a {
18
- text-decoration: none;
19
- cursor: pointer;
20
- }
21
- .container a:first-child {
22
- padding-top: 10px;
23
- }
24
- .container a:last-child {
25
- padding-bottom: 10px;
26
- }
27
-
28
- .nav-item {
29
- position: relative;
30
- display: flex;
31
- height: 48px;
32
- align-items: center;
33
- color: #495057;
34
- }
35
- .nav-item:hover {
36
- /*border-radius: 0 48px 48px 0;*/
37
- background-color: #e9ecef;
38
- }
39
- .nav-item.active {
40
- /*color: #fff;*/
41
- /*border-left: 5px solid #0d6efd;*/
42
- }
43
- .container:hover .nav-item.active {
44
- /*border-radius: 0 48px 48px 0;*/
45
- /*background-color: #0d6efd !important;*/
46
- }
47
-
48
- .highlight {
49
- position: absolute;
50
- left: 0px;
51
- width: 5px;
52
- height: 36px;
53
- z-index: 100;
54
- /*border-radius: 50%;*/
55
- background-color: #0d6efd;
56
- transition-property: height;
57
- transition-duration: .2s;
58
- }
59
- .container:hover .highlight {
60
- height: 48px;
61
- /*display: none;*/
62
- }
63
-
64
- .icon {
65
- margin: 4px 15px 0px 16px;
66
- }
67
- .icon > svg {
68
- width: 24px;
69
- height: 24px;
70
- }
71
-
72
- .text {
73
- font-size: .9rem;
74
- display: none;
75
- white-space: nowrap;
76
- overflow-x: hidden;
77
- }
78
- .container:hover .text {
79
- display: block;
80
- }
@@ -1,50 +0,0 @@
1
- .container {
2
- display: flex;
3
- position: relative;
4
- background-color: var(--body-background-color);
5
- transition: width .2s;
6
- }
7
- .container.opened {
8
- width: calc(var(--primary-menu-width) + var(--secondary-menu-width));
9
- }
10
- .container.closed {
11
- width: var(--primary-menu-width);
12
- }
13
-
14
-
15
- .secondary {
16
- position: absolute;
17
- left: var(--primary-menu-width);
18
- height: 100%;
19
- z-index: 0;
20
- white-space: nowrap;
21
- overflow-x: hidden;
22
- }
23
- .secondary.opened {
24
- width: var(--secondary-menu-width);
25
- }
26
- .secondary.closed {
27
- width: 0px;
28
- overflow: hidden;
29
- }
30
-
31
- .toggler {
32
- position: absolute;
33
- bottom: 12px;
34
- width: 24px;
35
- height: 32px;
36
- padding-top: 2px;
37
- z-index: 15;
38
- cursor: pointer;
39
- transition: left .2s;
40
- }
41
- .toggler.opened {
42
- left: 264px;
43
- }
44
- .toggler.closed {
45
- left: var(--primary-menu-width);
46
- background-color: #f1f3f4;
47
- border: unset;
48
- border-radius: 0 50% 50% 0/0 50% 50% 0;
49
- box-shadow: 1px 1px 1px 1px #e8eaed;
50
- }
package/dist/variables.js DELETED
@@ -1,6 +0,0 @@
1
- export const variables = {
2
- bodyBackgroundColor: '#f8f9fa',
3
- gnbHeight: 64,
4
- primaryMenuWidth: 56,
5
- secondaryMenuWidth: 256
6
- };
File without changes
File without changes
File without changes
File without changes