@nethru/ui 2.0.6 → 2.0.7
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/editor/Editor.js +61 -16
- package/base/styles/globalStyles.js +0 -13
- 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
|
})]
|
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,69 @@ 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
|
+
},
|
|
59
|
+
'.cm-content.cm-lineWrapping': {
|
|
60
|
+
wordBreak: 'break-all'
|
|
61
|
+
},
|
|
62
|
+
'.cm-content .cm-activeLine': {
|
|
63
|
+
backgroundColor: blue[5]
|
|
64
|
+
},
|
|
65
|
+
'.cm-content .cm-selectionMatch': {
|
|
66
|
+
backgroundColor: blue[100]
|
|
67
|
+
},
|
|
68
|
+
'.cm-selectionLayer .cm-selectionBackground': {
|
|
69
|
+
backgroundColor: `${blue[200]} !important`
|
|
70
|
+
},
|
|
71
|
+
'.cm-tooltip': {
|
|
72
|
+
fontFamily: typography.fontFamily,
|
|
73
|
+
...typography.bodySmRegular,
|
|
74
|
+
borderRadius: `${borderRadius[1]}px`,
|
|
75
|
+
boxShadow: shadow[1]
|
|
76
|
+
},
|
|
77
|
+
'.cm-tooltip-autocomplete ul li[aria-selected]': {
|
|
78
|
+
color: 'unset',
|
|
79
|
+
backgroundColor: blue[100]
|
|
80
|
+
},
|
|
81
|
+
'.cm-tooltip.cm-completionInfo': {
|
|
82
|
+
top: '0px !important',
|
|
83
|
+
left: '101% !important',
|
|
84
|
+
maxWidth: '300px !important'
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
dark: false
|
|
88
|
+
}), [focused, error]);
|
|
35
89
|
const styles = useMemo(() => {
|
|
36
90
|
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)`
|
|
91
|
+
maxWidth: restrictWidth && ref.current ? `${ref.current.offsetWidth}px` : 'unset'
|
|
39
92
|
};
|
|
40
93
|
// 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]);
|
|
94
|
+
}, [restrictWidth, ref.current]);
|
|
50
95
|
const highlight = useMemo(() => {
|
|
51
96
|
const highlightEffect = StateEffect.define();
|
|
52
97
|
const decoration = Decoration.mark({
|
|
53
98
|
attributes: {
|
|
54
|
-
style:
|
|
99
|
+
style: `background-color: ${yellow[100]}`
|
|
55
100
|
}
|
|
56
101
|
});
|
|
57
|
-
|
|
58
102
|
const extension = StateField.define({
|
|
59
103
|
create() {
|
|
60
104
|
return Decoration.none;
|
|
@@ -153,13 +197,14 @@ export default function Editor({
|
|
|
153
197
|
},
|
|
154
198
|
onCreateEditor: (view, state) => setView(view),
|
|
155
199
|
onUpdate: handleUpdate,
|
|
200
|
+
theme: theme,
|
|
156
201
|
style: {
|
|
157
202
|
...style,
|
|
158
203
|
...styles
|
|
159
204
|
},
|
|
160
205
|
...props
|
|
161
|
-
}), helperText && /*#__PURE__*/_jsx(
|
|
162
|
-
|
|
206
|
+
}), helperText && /*#__PURE__*/_jsx(FormHelperText, {
|
|
207
|
+
error: error,
|
|
163
208
|
children: helperText
|
|
164
209
|
})]
|
|
165
210
|
});
|
|
@@ -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
|
}
|