ssovee-os-web-ui 0.1.67 → 0.1.71

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/README.md CHANGED
@@ -55,6 +55,31 @@ export function Example() {
55
55
  }
56
56
  ```
57
57
 
58
+ ## JSON editor
59
+
60
+ `JsonEditor` is a controlled Monaco editor configured for JSON by default:
61
+
62
+ ```tsx
63
+ import { useState } from "react";
64
+ import { JsonEditor } from "ssovee-os-web-ui";
65
+
66
+ export function SettingsEditor() {
67
+ const [value, setValue] = useState('{"enabled":true}');
68
+
69
+ return (
70
+ <JsonEditor
71
+ value={value}
72
+ onChange={setValue}
73
+ theme="light"
74
+ height="320px"
75
+ options={{ minimap: { enabled: false } }}
76
+ />
77
+ );
78
+ }
79
+ ```
80
+
81
+ Use `theme="vs-dark"` for a dark editor. The component also accepts Monaco `language`, `height`, and `options` props.
82
+
58
83
  ## Window components
59
84
 
60
85
  ### Simple window
@@ -179,6 +204,7 @@ The package exports these components and types for external use:
179
204
  - `Button`
180
205
  - `Input`
181
206
  - `TextArea`
207
+ - `JsonEditor`
182
208
  - `Select`
183
209
  - `SelectOption`
184
210
  - `Checkbox`
package/dist/index.cjs CHANGED
@@ -3,8 +3,11 @@
3
3
  var React22 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var react = require('@phosphor-icons/react');
6
+ var Editor = require('@monaco-editor/react');
6
7
  var uaParserJs = require('ua-parser-js');
7
8
 
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
8
11
  function _interopNamespace(e) {
9
12
  if (e && e.__esModule) return e;
10
13
  var n = Object.create(null);
@@ -24,6 +27,7 @@ function _interopNamespace(e) {
24
27
  }
25
28
 
26
29
  var React22__namespace = /*#__PURE__*/_interopNamespace(React22);
30
+ var Editor__default = /*#__PURE__*/_interopDefault(Editor);
27
31
 
28
32
  // src/components/Button.tsx
29
33
 
@@ -302,6 +306,28 @@ var TextArea = React22__namespace.default.forwardRef(
302
306
  );
303
307
  TextArea.displayName = "TextArea";
304
308
  var TextArea_default = TextArea;
309
+ var JsonEditor = ({
310
+ value,
311
+ onChange,
312
+ language = "json",
313
+ theme = "light",
314
+ height = "100%",
315
+ options,
316
+ className
317
+ }) => {
318
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: { height }, children: /* @__PURE__ */ jsxRuntime.jsx(
319
+ Editor__default.default,
320
+ {
321
+ height: "100%",
322
+ language,
323
+ theme,
324
+ value,
325
+ onChange: (nextValue) => onChange(nextValue ?? ""),
326
+ options
327
+ }
328
+ ) });
329
+ };
330
+ var JsonEditor_default = JsonEditor;
305
331
  var Select = React22__namespace.default.forwardRef(
306
332
  ({
307
333
  className,
@@ -3430,6 +3456,7 @@ exports.Dropdown = Dropdown_default;
3430
3456
  exports.FileUpload = FileUpload_default;
3431
3457
  exports.ImageWithPlaceholder = ImageWithPlaceholder_default;
3432
3458
  exports.Input = Input_default;
3459
+ exports.JsonEditor = JsonEditor_default;
3433
3460
  exports.Loading = Loading_default;
3434
3461
  exports.Modal = Modal_default;
3435
3462
  exports.Pagination = Pagination_default;