@nethru/ui 1.0.53 → 1.0.55

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/dist/Editor.js CHANGED
@@ -3,11 +3,12 @@ import { javascript } from '@codemirror/lang-javascript';
3
3
  import { json } from '@codemirror/lang-json';
4
4
  import { EditorView } from "@codemirror/view";
5
5
  import { Box, Typography } from "@mui/material";
6
- import { useMemo, useState } from "react";
6
+ import { useEffect, useMemo, useRef, useState } from "react";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  export default function Editor({
10
10
  readOnly = false,
11
+ value,
11
12
  error = false,
12
13
  helperText,
13
14
  basicSetup,
@@ -17,18 +18,27 @@ export default function Editor({
17
18
  style,
18
19
  ...props
19
20
  }) {
21
+ const ref = useRef();
22
+ const [content, setContent] = useState('');
20
23
  const [focused, setFocused] = useState(false);
21
24
  const styles = useMemo(() => {
22
25
  return {
26
+ maxWidth: ref.current ? `${ref.current.offsetWidth}px` : 'unset',
23
27
  borderBottom: focused ? `3px solid ${error ? '#d32f2f' : '#1976d2'}` : `${!readOnly ? '2px' : '0px'} solid rgba(0, 0, 0, 0.42)`
24
28
  };
25
- }, [readOnly, error, focused]);
29
+ // eslint-disable-next-line
30
+ }, [readOnly, error, focused, ref.current]);
26
31
  const handleUpdate = viewUpdate => {
27
32
  setFocused(viewUpdate.view.hasFocus);
28
33
  if (onUpdate) onUpdate(viewUpdate);
29
34
  };
35
+ useEffect(() => {
36
+ setTimeout(() => setContent(value), 100);
37
+ }, [value]);
30
38
  return /*#__PURE__*/_jsxs(Box, {
39
+ ref: ref,
31
40
  children: [/*#__PURE__*/_jsx(CodeMirror, {
41
+ value: content,
32
42
  editable: !readOnly,
33
43
  extensions: [jsonFormat ? json() : javascript({
34
44
  jsx: true
package/dist/Frame.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { useEffect, useRef, useState } from "react";
1
2
  import { Box } from '@mui/material';
2
3
  import { SidebarContextProvider } from './sidebar/SidebarContext';
3
4
  import { variables } from './variables';
@@ -12,6 +13,8 @@ export default function Frame({
12
13
  menu,
13
14
  menuIcons = {}
14
15
  }) {
16
+ const ref = useRef();
17
+ const [width, setWidth] = useState('unset');
15
18
  const containerStyles = {
16
19
  display: 'flex',
17
20
  flexGrow: 1,
@@ -24,6 +27,17 @@ export default function Frame({
24
27
  overflow: 'auto',
25
28
  padding: '20px 40px'
26
29
  };
30
+ useEffect(() => {
31
+ if (!ref.current) return;
32
+ const observer = new ResizeObserver(entries => {
33
+ const width = entries.length > 0 ? entries[0].borderBoxSize[0].inlineSize : 0;
34
+ setWidth(width > 0 ? `${width}px` : 'unset');
35
+ });
36
+ observer.observe(ref.current);
37
+ return () => {
38
+ observer.disconnect();
39
+ };
40
+ }, []);
27
41
  return /*#__PURE__*/_jsxs(_Fragment, {
28
42
  children: [appBar, /*#__PURE__*/_jsxs(Box, {
29
43
  sx: containerStyles,
@@ -32,9 +46,13 @@ export default function Frame({
32
46
  icons: menuIcons,
33
47
  children: sideBar
34
48
  }), /*#__PURE__*/_jsxs(Box, {
49
+ ref: ref,
35
50
  component: "section",
36
51
  sx: contentStyles,
37
52
  children: [/*#__PURE__*/_jsx("main", {
53
+ style: {
54
+ maxWidth: width
55
+ },
38
56
  children: children
39
57
  }), footer]
40
58
  })]
@@ -1,4 +1,4 @@
1
- import { Autocomplete, Box, Divider } from "@mui/material";
1
+ import { Autocomplete, Box, Divider, Typography } from "@mui/material";
2
2
  import { TextField } from "@nethru/ui";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -30,6 +30,10 @@ export default function SearchableSelect({
30
30
  }),
31
31
  getOptionDisabled: option => option.type === 'divider',
32
32
  isOptionEqualToValue: (option, value) => option.id === value.id,
33
+ noOptionsText: /*#__PURE__*/_jsx(Typography, {
34
+ variant: "subtitle2",
35
+ children: "\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9 \uC5C6\uC74C"
36
+ }),
33
37
  ...props
34
38
  });
35
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"