@nethru/ui 2.0.6 → 2.0.8
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.
- package/base/AddableFormList.js +1 -1
- package/base/FormContent.js +14 -0
- package/base/HelpTooltipIcon.js +22 -0
- package/base/SectionLabel.js +14 -0
- package/base/editor/Editor.js +62 -16
- package/base/index.js +4 -1
- package/base/styles/createTheme.js +3 -1
- package/base/styles/globalStyles.js +0 -13
- package/base/styles/mui/formLabel.js +12 -0
- package/base/styles/typography.js +3 -2
- package/package.json +1 -1
package/base/AddableFormList.js
CHANGED
|
@@ -57,7 +57,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
57
57
|
})
|
|
58
58
|
})]
|
|
59
59
|
})]
|
|
60
|
-
}, form.id)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
|
|
60
|
+
}, form.id ?? form)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
|
|
61
61
|
variant: "bodySmRegular",
|
|
62
62
|
children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
|
|
63
63
|
})]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const FormContent = /*#__PURE__*/forwardRef(({
|
|
5
|
+
children,
|
|
6
|
+
...props
|
|
7
|
+
}, ref) => {
|
|
8
|
+
return /*#__PURE__*/_jsx(Typography, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
variant: "bodyXlMedium",
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
export default FormContent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
3
|
+
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const HelpTooltipIcon = /*#__PURE__*/forwardRef(({
|
|
6
|
+
tooltip,
|
|
7
|
+
onClick,
|
|
8
|
+
...props
|
|
9
|
+
}, ref) => {
|
|
10
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
title: tooltip,
|
|
13
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
14
|
+
size: "small",
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
children: /*#__PURE__*/_jsx(InfoOutlinedIcon, {
|
|
17
|
+
fontSize: "inherit"
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
export default HelpTooltipIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const SectionLabel = /*#__PURE__*/forwardRef(({
|
|
5
|
+
children,
|
|
6
|
+
...props
|
|
7
|
+
}, ref) => {
|
|
8
|
+
return /*#__PURE__*/_jsx(Typography, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
variant: "bodyLgSemibold",
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
export default SectionLabel;
|
package/base/editor/Editor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { Box,
|
|
2
|
+
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';
|
|
@@ -7,6 +7,10 @@ import { nScript } from './nScript';
|
|
|
7
7
|
import { Decoration, EditorView } from "@codemirror/view";
|
|
8
8
|
import { RegExpCursor, SearchCursor } from '@codemirror/search';
|
|
9
9
|
import { StateEffect, StateField } from "@codemirror/state";
|
|
10
|
+
import borderRadius from "../styles/borderRadius";
|
|
11
|
+
import { blue, grey, red, yellow } from "../colors";
|
|
12
|
+
import typography from "../styles/typography";
|
|
13
|
+
import shadow from "../styles/shadow";
|
|
10
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
16
|
export default function Editor({
|
|
@@ -32,29 +36,70 @@ export default function Editor({
|
|
|
32
36
|
const [view, setView] = useState();
|
|
33
37
|
const [content, setContent] = useState('');
|
|
34
38
|
const [focused, setFocused] = useState(false);
|
|
39
|
+
const theme = useMemo(() => EditorView.theme({
|
|
40
|
+
'&': {
|
|
41
|
+
fontSize: '13px',
|
|
42
|
+
outline: 'none !important'
|
|
43
|
+
},
|
|
44
|
+
'.cm-scroller': {
|
|
45
|
+
border: `1px solid ${error ? red[500] : focused ? grey[900] : grey[300]}`,
|
|
46
|
+
borderRadius: `${borderRadius[2]}px`
|
|
47
|
+
},
|
|
48
|
+
'.cm-gutters': {
|
|
49
|
+
width: '42px',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
fontFamily: typography.fontFamily,
|
|
52
|
+
...typography.bodyMdMedium,
|
|
53
|
+
backgroundColor: grey[50],
|
|
54
|
+
borderRight: `1px solid ${grey[300]}`
|
|
55
|
+
},
|
|
56
|
+
'.cm-content': {
|
|
57
|
+
...typography.code,
|
|
58
|
+
backgroundColor: '#fff'
|
|
59
|
+
},
|
|
60
|
+
'.cm-content.cm-lineWrapping': {
|
|
61
|
+
wordBreak: 'break-all'
|
|
62
|
+
},
|
|
63
|
+
'.cm-content .cm-activeLine': {
|
|
64
|
+
backgroundColor: blue[5]
|
|
65
|
+
},
|
|
66
|
+
'.cm-content .cm-selectionMatch': {
|
|
67
|
+
backgroundColor: blue[100]
|
|
68
|
+
},
|
|
69
|
+
'.cm-selectionLayer .cm-selectionBackground': {
|
|
70
|
+
backgroundColor: `${blue[200]} !important`
|
|
71
|
+
},
|
|
72
|
+
'.cm-tooltip': {
|
|
73
|
+
fontFamily: typography.fontFamily,
|
|
74
|
+
...typography.bodySmRegular,
|
|
75
|
+
borderRadius: `${borderRadius[1]}px`,
|
|
76
|
+
boxShadow: shadow[1]
|
|
77
|
+
},
|
|
78
|
+
'.cm-tooltip-autocomplete ul li[aria-selected]': {
|
|
79
|
+
color: 'unset',
|
|
80
|
+
backgroundColor: blue[100]
|
|
81
|
+
},
|
|
82
|
+
'.cm-tooltip.cm-completionInfo': {
|
|
83
|
+
top: '0px !important',
|
|
84
|
+
left: '101% !important',
|
|
85
|
+
maxWidth: '300px !important'
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
dark: false
|
|
89
|
+
}), [focused, error]);
|
|
35
90
|
const styles = useMemo(() => {
|
|
36
91
|
return {
|
|
37
|
-
maxWidth: restrictWidth && ref.current ? `${ref.current.offsetWidth}px` : 'unset'
|
|
38
|
-
borderBottom: focused || error ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${!readOnly ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
|
|
92
|
+
maxWidth: restrictWidth && ref.current ? `${ref.current.offsetWidth}px` : 'unset'
|
|
39
93
|
};
|
|
40
94
|
// eslint-disable-next-line
|
|
41
|
-
}, [
|
|
42
|
-
const helperTextStyles = useMemo(() => {
|
|
43
|
-
return {
|
|
44
|
-
color: error ? '#d32f2f' : '#555',
|
|
45
|
-
fontSize: 12,
|
|
46
|
-
ml: '14px',
|
|
47
|
-
mt: '3px'
|
|
48
|
-
};
|
|
49
|
-
}, [error]);
|
|
95
|
+
}, [restrictWidth, ref.current]);
|
|
50
96
|
const highlight = useMemo(() => {
|
|
51
97
|
const highlightEffect = StateEffect.define();
|
|
52
98
|
const decoration = Decoration.mark({
|
|
53
99
|
attributes: {
|
|
54
|
-
style:
|
|
100
|
+
style: `background-color: ${yellow[100]}`
|
|
55
101
|
}
|
|
56
102
|
});
|
|
57
|
-
|
|
58
103
|
const extension = StateField.define({
|
|
59
104
|
create() {
|
|
60
105
|
return Decoration.none;
|
|
@@ -153,13 +198,14 @@ export default function Editor({
|
|
|
153
198
|
},
|
|
154
199
|
onCreateEditor: (view, state) => setView(view),
|
|
155
200
|
onUpdate: handleUpdate,
|
|
201
|
+
theme: theme,
|
|
156
202
|
style: {
|
|
157
203
|
...style,
|
|
158
204
|
...styles
|
|
159
205
|
},
|
|
160
206
|
...props
|
|
161
|
-
}), helperText && /*#__PURE__*/_jsx(
|
|
162
|
-
|
|
207
|
+
}), helperText && /*#__PURE__*/_jsx(FormHelperText, {
|
|
208
|
+
error: error,
|
|
163
209
|
children: helperText
|
|
164
210
|
})]
|
|
165
211
|
});
|
package/base/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export { default as ConfirmDialog } from "./dialog/ConfirmDialog";
|
|
|
17
17
|
export { default as DataGrid } from "./datagrid/DataGrid";
|
|
18
18
|
export { default as Dialog } from "./dialog/Dialog";
|
|
19
19
|
export { default as DropdownButton } from "./DropdownButton";
|
|
20
|
+
export { default as FormContent } from "./FormContent";
|
|
21
|
+
export { default as HelpTooltipIcon } from "./HelpTooltipIcon";
|
|
20
22
|
export { default as Editor } from "./editor/Editor";
|
|
21
23
|
export { default as Frame } from "./frame/Frame";
|
|
22
24
|
export { default as MainHeader } from "./MainHeader";
|
|
@@ -25,8 +27,9 @@ export { default as PropertyTable } from "./PropertyTable";
|
|
|
25
27
|
export { default as Radio } from "./Radio";
|
|
26
28
|
export { default as SearchableSelect } from "./SearchableSelect";
|
|
27
29
|
export { default as SearchTextField } from "./SearchTextField";
|
|
28
|
-
export { default as
|
|
30
|
+
export { default as SectionLabel } from "./SectionLabel";
|
|
29
31
|
export { default as Select } from "./Select";
|
|
32
|
+
export { default as Sidebar } from "./frame/sidebar/Sidebar";
|
|
30
33
|
export { default as Slider } from "./Slider";
|
|
31
34
|
export { default as Snackbar } from "./Snackbar";
|
|
32
35
|
export { default as Switch } from "./Switch";
|
|
@@ -17,6 +17,8 @@ import * as select from "./mui/select";
|
|
|
17
17
|
import * as autocomplete from "./mui/autocomplete";
|
|
18
18
|
import * as textField from "./mui/textField";
|
|
19
19
|
import * as formControl from "./mui/formControl";
|
|
20
|
+
import * as formControlLabel from "./mui/formControlLabel";
|
|
21
|
+
import * as formLabel from "./mui/formLabel";
|
|
20
22
|
import * as outlinedInput from "./mui/outlinedInput";
|
|
21
23
|
import * as formHelperText from "./mui/formHelperText";
|
|
22
24
|
import * as inputLabel from "./mui/inputLabel";
|
|
@@ -24,7 +26,6 @@ import * as popover from "./mui/popover";
|
|
|
24
26
|
import * as paper from "./mui/paper";
|
|
25
27
|
import * as list from "./mui/list";
|
|
26
28
|
import * as menuItem from "./mui/menuItem";
|
|
27
|
-
import * as formControlLabel from "./mui/formControlLabel";
|
|
28
29
|
import * as chip from "./mui/chip";
|
|
29
30
|
import * as slider from "./mui/slider";
|
|
30
31
|
import * as tabs from "./mui/tabs";
|
|
@@ -68,6 +69,7 @@ export default function createTheme() {
|
|
|
68
69
|
MuiTextField: textField.styles,
|
|
69
70
|
MuiFormControl: formControl.styles,
|
|
70
71
|
MuiFormControlLabel: formControlLabel.styles,
|
|
72
|
+
MuiFormLabel: formLabel.styles,
|
|
71
73
|
MuiInputLabel: inputLabel.styles,
|
|
72
74
|
MuiOutlinedInput: outlinedInput.styles,
|
|
73
75
|
MuiFormHelperText: formHelperText.styles,
|
|
@@ -22,19 +22,6 @@ const globalStyles = {
|
|
|
22
22
|
backgroundColor: blueGrey.contentBg,
|
|
23
23
|
minWidth: '1280px'
|
|
24
24
|
},
|
|
25
|
-
code: {
|
|
26
|
-
fontFamily: typography.fontFamily
|
|
27
|
-
},
|
|
28
|
-
'.cm-theme-light': {
|
|
29
|
-
fontFamily: "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
|
|
30
|
-
fontSize: '14px'
|
|
31
|
-
},
|
|
32
|
-
'.cm-editor, .cm-editor.cm-focused': {
|
|
33
|
-
outline: '1px solid #eaeaea'
|
|
34
|
-
},
|
|
35
|
-
'.cm-editor .cm-content.cm-lineWrapping': {
|
|
36
|
-
wordBreak: 'break-all'
|
|
37
|
-
},
|
|
38
25
|
'.highcharts-tooltip-box': {
|
|
39
26
|
fillOpacity: 0
|
|
40
27
|
},
|
|
@@ -121,9 +121,10 @@ const typography = {
|
|
|
121
121
|
letterSpacing: 0
|
|
122
122
|
},
|
|
123
123
|
code: {
|
|
124
|
+
fontFamily: "D2Coding, 'D2 coding', monospace",
|
|
124
125
|
color: grey[900],
|
|
125
|
-
fontSize: '
|
|
126
|
-
fontWeight:
|
|
126
|
+
fontSize: '14px',
|
|
127
|
+
fontWeight: 400,
|
|
127
128
|
lineHeight: 1.6,
|
|
128
129
|
letterSpacing: 0
|
|
129
130
|
}
|