@nethru/ui 2.0.5 → 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 +3 -2
- package/base/ColumnedSection.js +2 -2
- package/base/SearchableSelect.js +2 -0
- package/base/Select.js +2 -0
- package/base/editor/Editor.js +61 -16
- package/base/styles/globalStyles.js +2 -14
- package/base/styles/mui/button.js +2 -2
- package/base/styles/mui/formControlLabel.js +1 -0
- package/base/styles/typography.js +3 -2
- package/package.json +1 -1
package/base/AddableFormList.js
CHANGED
|
@@ -15,6 +15,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
15
15
|
margins = [5, 5],
|
|
16
16
|
showAddButton = true,
|
|
17
17
|
showRemoveButton = true,
|
|
18
|
+
allowEmpty = false,
|
|
18
19
|
...props
|
|
19
20
|
}, ref) => {
|
|
20
21
|
return /*#__PURE__*/_jsx(Stack, {
|
|
@@ -36,7 +37,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
36
37
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
37
38
|
variant: "menu",
|
|
38
39
|
onClick: _ => onRemove(index),
|
|
39
|
-
disabled: forms.length === 1,
|
|
40
|
+
disabled: !allowEmpty && forms.length === 1,
|
|
40
41
|
children: /*#__PURE__*/_jsx(RemoveIcon, {
|
|
41
42
|
sx: {
|
|
42
43
|
fontSize: 17
|
|
@@ -56,7 +57,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
|
|
|
56
57
|
})
|
|
57
58
|
})]
|
|
58
59
|
})]
|
|
59
|
-
}, form.id)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
|
|
60
|
+
}, form.id ?? form)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
|
|
60
61
|
variant: "bodySmRegular",
|
|
61
62
|
children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
|
|
62
63
|
})]
|
package/base/ColumnedSection.js
CHANGED
package/base/SearchableSelect.js
CHANGED
|
@@ -14,6 +14,7 @@ const SearchableSelect = /*#__PURE__*/forwardRef(({
|
|
|
14
14
|
labelKey = 'label',
|
|
15
15
|
groupKey,
|
|
16
16
|
error,
|
|
17
|
+
fullWidth,
|
|
17
18
|
formControlProps,
|
|
18
19
|
textFieldProps,
|
|
19
20
|
...props
|
|
@@ -37,6 +38,7 @@ const SearchableSelect = /*#__PURE__*/forwardRef(({
|
|
|
37
38
|
disabled: props.disabled,
|
|
38
39
|
error: error,
|
|
39
40
|
sx: styles,
|
|
41
|
+
fullWidth: fullWidth,
|
|
40
42
|
...formControlProps,
|
|
41
43
|
children: [label && /*#__PURE__*/_jsx(InputLabel, {
|
|
42
44
|
disabled: props.disabled,
|
package/base/Select.js
CHANGED
|
@@ -7,6 +7,7 @@ const Select = /*#__PURE__*/forwardRef(({
|
|
|
7
7
|
label,
|
|
8
8
|
helperText,
|
|
9
9
|
size,
|
|
10
|
+
fullWidth,
|
|
10
11
|
children,
|
|
11
12
|
formControlProps,
|
|
12
13
|
...props
|
|
@@ -21,6 +22,7 @@ const Select = /*#__PURE__*/forwardRef(({
|
|
|
21
22
|
disabled: props.disabled,
|
|
22
23
|
error: props.error,
|
|
23
24
|
sx: styles,
|
|
25
|
+
fullWidth: fullWidth,
|
|
24
26
|
...formControlProps,
|
|
25
27
|
children: [label && /*#__PURE__*/_jsx(InputLabel, {
|
|
26
28
|
children: label
|
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
|
});
|
|
@@ -19,20 +19,8 @@ const globalStyles = {
|
|
|
19
19
|
},
|
|
20
20
|
body: {
|
|
21
21
|
fontFamily: typography.fontFamily,
|
|
22
|
-
backgroundColor: blueGrey.contentBg
|
|
23
|
-
|
|
24
|
-
code: {
|
|
25
|
-
fontFamily: typography.fontFamily
|
|
26
|
-
},
|
|
27
|
-
'.cm-theme-light': {
|
|
28
|
-
fontFamily: "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
|
|
29
|
-
fontSize: '14px'
|
|
30
|
-
},
|
|
31
|
-
'.cm-editor, .cm-editor.cm-focused': {
|
|
32
|
-
outline: '1px solid #eaeaea'
|
|
33
|
-
},
|
|
34
|
-
'.cm-editor .cm-content.cm-lineWrapping': {
|
|
35
|
-
wordBreak: 'break-all'
|
|
22
|
+
backgroundColor: blueGrey.contentBg,
|
|
23
|
+
minWidth: '1280px'
|
|
36
24
|
},
|
|
37
25
|
'.highcharts-tooltip-box': {
|
|
38
26
|
fillOpacity: 0
|
|
@@ -249,14 +249,14 @@ export const styles = {
|
|
|
249
249
|
}) => ({
|
|
250
250
|
minWidth: 60,
|
|
251
251
|
height: ownerState.color === 'crud' ? 26 : 36,
|
|
252
|
-
padding: ownerState.color === 'crud' ? '
|
|
252
|
+
padding: ownerState.color === 'crud' ? '4px 6px' : '8px 12px',
|
|
253
253
|
fontSize: typography.bodyMdSemibold.fontSize,
|
|
254
254
|
fontWeight: typography.bodyMdSemibold.fontWeight
|
|
255
255
|
}),
|
|
256
256
|
sizeSmall: {
|
|
257
257
|
minWidth: '50px',
|
|
258
258
|
height: '26px',
|
|
259
|
-
padding: '8px
|
|
259
|
+
padding: '8px 8px',
|
|
260
260
|
fontSize: typography.bodySmSemibold.fontSize,
|
|
261
261
|
fontWeight: typography.bodySmSemibold.fontWeight
|
|
262
262
|
},
|
|
@@ -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
|
}
|