@elliemae/ds-codeeditor 2.2.0-next.3 → 2.3.0-alpha.1

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.
@@ -1,31 +1,50 @@
1
- 'use strict';
2
-
3
- var _jsx = require('@babel/runtime/helpers/jsx');
4
- var React = require('react');
5
- var AceEditor = require('react-ace');
6
- var DSModal = require('@elliemae/ds-modal');
7
- var DSCodeEditorForm = require('./DSCodeEditorForm.js');
8
- require('brace/mode/javascript.js');
9
- require('brace/theme/tomorrow.js');
10
- var jsxRuntime = require('react/jsx-runtime');
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
15
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
- var AceEditor__default = /*#__PURE__*/_interopDefaultLegacy(AceEditor);
17
- var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
18
-
19
- class DSCodeEditorImpl extends React.Component {
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var DSCodeEditorImpl_exports = {};
29
+ __export(DSCodeEditorImpl_exports, {
30
+ default: () => DSCodeEditorImpl_default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = __toESM(require("react"));
34
+ var import_react_ace = __toESM(require("react-ace"));
35
+ var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
36
+ var import_DSCodeEditorForm = __toESM(require("./DSCodeEditorForm"));
37
+ var import_javascript = require("brace/mode/javascript.js");
38
+ var import_tomorrow = require("brace/theme/tomorrow.js");
39
+ class DSCodeEditorImpl extends import_react.Component {
20
40
  constructor(props) {
21
41
  super(props);
22
42
  this.state = {
23
43
  value: props.value,
24
44
  errors: []
25
45
  };
26
- this.reactAceComponent = /*#__PURE__*/React__default["default"].createRef();
46
+ this.reactAceComponent = import_react.default.createRef();
27
47
  }
28
-
29
48
  render() {
30
49
  const {
31
50
  onSave,
@@ -43,46 +62,37 @@ class DSCodeEditorImpl extends React.Component {
43
62
  style,
44
63
  containerProps
45
64
  } = this.props;
46
- const {
47
- value,
48
- errors
49
- } = this.state;
50
- return /*#__PURE__*/_jsx__default["default"](DSModal__default["default"], {
65
+ const { value, errors } = this.state;
66
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_modal.default, {
51
67
  centered: false,
52
- confirmLabel: confirmLabel,
53
- containerProps: containerProps,
54
- isOpen: isOpen,
55
- modalTitle: modalTitle,
56
- modalType: modalType,
68
+ confirmLabel,
69
+ containerProps,
70
+ isOpen,
71
+ modalTitle,
72
+ modalType,
57
73
  onClose: () => onClose(value, fileName, errors),
58
74
  onConfirm: () => onSave(value, fileName, errors),
59
75
  onReject: () => onReject(value, fileName, errors),
60
- rejectLabel: rejectLabel,
61
- size: size,
62
- style: style
63
- }, void 0, /*#__PURE__*/_jsx__default["default"](DSCodeEditorForm, {
64
- fileName: fileName,
76
+ rejectLabel,
77
+ size,
78
+ style
79
+ }, /* @__PURE__ */ import_react.default.createElement(import_DSCodeEditorForm.default, {
80
+ fileName,
65
81
  reactAceComponent: this.reactAceComponent
66
- }), /*#__PURE__*/jsxRuntime.jsx(AceEditor__default["default"], {
82
+ }), /* @__PURE__ */ import_react.default.createElement(import_react_ace.default, {
67
83
  ref: this.reactAceComponent,
68
- editorProps: {
69
- $blockScrolling: true
70
- },
71
- maxLines: maxLines,
72
- minLines: minLines,
84
+ editorProps: { $blockScrolling: true },
85
+ maxLines,
86
+ minLines,
73
87
  mode: "javascript",
74
88
  name: "ace-code-edior",
75
- onChange: val => this.setState({
76
- value: val
77
- }),
78
- onValidate: annotations => this.setState({
79
- errors: annotations
80
- }),
89
+ onChange: (val) => this.setState({ value: val }),
90
+ onValidate: (annotations) => this.setState({ errors: annotations }),
81
91
  theme: "tomorrow",
82
- value: value
92
+ value
83
93
  }));
84
94
  }
85
-
86
95
  }
87
-
88
- module.exports = DSCodeEditorImpl;
96
+ var DSCodeEditorImpl_default = DSCodeEditorImpl;
97
+ module.exports = __toCommonJS(DSCodeEditorImpl_exports);
98
+ //# sourceMappingURL=DSCodeEditorImpl.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/DSCodeEditorImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React, { Component } from 'react';\nimport AceEditor from 'react-ace';\nimport DSModal from '@elliemae/ds-modal';\nimport DSCodeEditorForm from './DSCodeEditorForm';\nimport 'brace/mode/javascript.js';\nimport 'brace/theme/tomorrow.js';\n\nclass DSCodeEditorImpl extends Component {\n constructor(props) {\n super(props);\n this.state = {\n value: props.value,\n errors: [],\n };\n this.reactAceComponent = React.createRef();\n }\n\n render() {\n const {\n onSave,\n onClose,\n onReject,\n isOpen,\n fileName,\n confirmLabel,\n maxLines,\n minLines,\n modalTitle,\n modalType,\n rejectLabel,\n size,\n style,\n containerProps,\n } = this.props;\n\n const { value, errors } = this.state;\n return (\n <DSModal\n centered={false}\n confirmLabel={confirmLabel}\n containerProps={containerProps}\n isOpen={isOpen}\n modalTitle={modalTitle}\n modalType={modalType}\n onClose={() => onClose(value, fileName, errors)}\n onConfirm={() => onSave(value, fileName, errors)}\n onReject={() => onReject(value, fileName, errors)}\n rejectLabel={rejectLabel}\n size={size}\n style={style}\n >\n <DSCodeEditorForm\n fileName={fileName}\n reactAceComponent={this.reactAceComponent}\n />\n <AceEditor\n ref={this.reactAceComponent}\n editorProps={{ $blockScrolling: true }}\n maxLines={maxLines}\n minLines={minLines}\n mode=\"javascript\"\n name=\"ace-code-edior\"\n onChange={val => this.setState({ value: val })}\n onValidate={annotations => this.setState({ errors: annotations })}\n theme=\"tomorrow\"\n value={value}\n />\n </DSModal>\n );\n }\n}\n\nexport default DSCodeEditorImpl;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiC;AACjC,uBAAsB;AACtB,sBAAoB;AACpB,8BAA6B;AAC7B,wBAAO;AACP,sBAAO;AAEP,+BAA+B,uBAAU;AAAA,EACvC,YAAY,OAAO;AACjB,UAAM;AACN,SAAK,QAAQ;AAAA,MACX,OAAO,MAAM;AAAA,MACb,QAAQ;AAAA;AAEV,SAAK,oBAAoB,qBAAM;AAAA;AAAA,EAGjC,SAAS;AACP,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAET,UAAM,EAAE,OAAO,WAAW,KAAK;AAC/B,WACE,mDAAC,yBAAD;AAAA,MACE,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,MAAM,QAAQ,OAAO,UAAU;AAAA,MACxC,WAAW,MAAM,OAAO,OAAO,UAAU;AAAA,MACzC,UAAU,MAAM,SAAS,OAAO,UAAU;AAAA,MAC1C;AAAA,MACA;AAAA,MACA;AAAA,OAEA,mDAAC,iCAAD;AAAA,MACE;AAAA,MACA,mBAAmB,KAAK;AAAA,QAE1B,mDAAC,0BAAD;AAAA,MACE,KAAK,KAAK;AAAA,MACV,aAAa,EAAE,iBAAiB;AAAA,MAChC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,MAAK;AAAA,MACL,UAAU,SAAO,KAAK,SAAS,EAAE,OAAO;AAAA,MACxC,YAAY,iBAAe,KAAK,SAAS,EAAE,QAAQ;AAAA,MACnD,OAAM;AAAA,MACN;AAAA;AAAA;AAAA;AAOV,IAAO,2BAAQ;",
6
+ "names": []
7
+ }
package/cjs/index.js CHANGED
@@ -1,10 +1,36 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSCodeEditor = require('./DSCodeEditor.js');
6
-
7
-
8
-
9
- exports.CodeEditorWithSchema = DSCodeEditor.CodeEditorWithSchema;
10
- exports["default"] = DSCodeEditor["default"];
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ CodeEditorWithSchema: () => import_DSCodeEditor.CodeEditorWithSchema,
31
+ default: () => import_DSCodeEditor.default
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_DSCodeEditor = __toESM(require("./DSCodeEditor"));
35
+ module.exports = __toCommonJS(src_exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { default, CodeEditorWithSchema } from './DSCodeEditor';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA8C;",
6
+ "names": []
7
+ }
@@ -1,116 +1,102 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import { useState, useRef } from 'react';
4
- import { PropTypes, describe } from 'react-desc';
5
- import DSModal, { modalTypes } from '@elliemae/ds-modal';
6
- import AceEditor from 'react-ace';
7
- import DSCodeEditorForm from './components/DSCodeEditorForm.js';
8
- import 'brace/mode/javascript.js';
9
- import 'brace/theme/tomorrow.js';
10
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
11
-
12
- const DSCodeEditor = _ref => {
13
- let {
14
- containerProps = {},
15
- value: defaultValue = '',
16
- onSave = () => null,
17
- onClose = () => null,
18
- onReject = () => null,
19
- onChange = () => null,
20
- isOpen = false,
21
- fileName = '',
22
- confirmLabel = 'Save',
23
- maxLines = 20,
24
- minLines = 20,
25
- modalTitle = 'Javascript Editor',
26
- modalType = 'confirm',
27
- rejectLabel = 'Close',
28
- size = 'large',
29
- style = {},
30
- useModal = true,
31
- showHeader = true,
32
- showSyntaxChecks = true
33
- } = _ref;
34
- const [{
35
- value,
36
- errors
37
- }, setState] = useState({
1
+ import * as React from "react";
2
+ import React2, { useState, useRef } from "react";
3
+ import { describe, PropTypes } from "react-desc";
4
+ import DSModal, { modalTypes } from "@elliemae/ds-modal";
5
+ import AceEditor from "react-ace";
6
+ import DSCodeEditorForm from "./components/DSCodeEditorForm";
7
+ import "brace/mode/javascript.js";
8
+ import "brace/theme/tomorrow.js";
9
+ const DSCodeEditor = ({
10
+ containerProps = {},
11
+ value: defaultValue = "",
12
+ onSave = () => null,
13
+ onClose = () => null,
14
+ onReject = () => null,
15
+ onChange = () => null,
16
+ isOpen = false,
17
+ fileName = "",
18
+ confirmLabel = "Save",
19
+ maxLines = 20,
20
+ minLines = 20,
21
+ modalTitle = "Javascript Editor",
22
+ modalType = "confirm",
23
+ rejectLabel = "Close",
24
+ size = "large",
25
+ style = {},
26
+ useModal = true,
27
+ showHeader = true,
28
+ showSyntaxChecks = true
29
+ }) => {
30
+ const [{ value, errors }, setState] = useState({
38
31
  value: defaultValue,
39
32
  errors: []
40
33
  });
41
34
  const reactAceComponent = useRef();
42
-
43
- const editor = /*#__PURE__*/jsxs(Fragment, {
44
- children: [showHeader && /*#__PURE__*/_jsx(DSCodeEditorForm, {
45
- fileName: fileName,
46
- reactAceComponent: reactAceComponent
47
- }), /*#__PURE__*/jsx(AceEditor, {
48
- ref: reactAceComponent,
49
- editorProps: {
50
- $blockScrolling: true
51
- },
52
- maxLines: maxLines,
53
- minLines: minLines,
54
- mode: "javascript",
55
- name: "ace-code-edior",
56
- onChange: val => {
57
- setState({
58
- errors,
59
- value: val
60
- });
61
- onChange(val, errors);
62
- },
63
- onValidate: annotations => setState({
64
- value,
65
- errors: annotations
66
- }),
67
- theme: "tomorrow",
68
- setOptions: {
69
- useWorker: showSyntaxChecks
70
- },
71
- value: value
72
- })]
73
- });
74
-
75
- if (!useModal) return editor;
76
- return /*#__PURE__*/_jsx(DSModal, {
35
+ const editor = /* @__PURE__ */ React2.createElement(React2.Fragment, null, showHeader && /* @__PURE__ */ React2.createElement(DSCodeEditorForm, {
36
+ fileName,
37
+ reactAceComponent
38
+ }), /* @__PURE__ */ React2.createElement(AceEditor, {
39
+ ref: reactAceComponent,
40
+ editorProps: { $blockScrolling: true },
41
+ maxLines,
42
+ minLines,
43
+ mode: "javascript",
44
+ name: "ace-code-edior",
45
+ onChange: (val) => {
46
+ setState({ errors, value: val });
47
+ onChange(val, errors);
48
+ },
49
+ onValidate: (annotations) => setState({ value, errors: annotations }),
50
+ theme: "tomorrow",
51
+ setOptions: {
52
+ useWorker: showSyntaxChecks
53
+ },
54
+ value
55
+ }));
56
+ if (!useModal)
57
+ return editor;
58
+ return /* @__PURE__ */ React2.createElement(DSModal, {
77
59
  centered: false,
78
- confirmLabel: confirmLabel,
79
- containerProps: containerProps,
80
- isOpen: isOpen,
81
- modalTitle: modalTitle,
82
- modalType: modalType,
60
+ confirmLabel,
61
+ containerProps,
62
+ isOpen,
63
+ modalTitle,
64
+ modalType,
83
65
  onClose: () => onClose(value, fileName, errors),
84
66
  onConfirm: () => onSave(value, fileName, errors),
85
67
  onReject: () => onReject(value, fileName, errors),
86
- rejectLabel: rejectLabel,
87
- size: size,
88
- style: style
89
- }, void 0, editor);
68
+ rejectLabel,
69
+ size,
70
+ style
71
+ }, editor);
90
72
  };
91
-
92
73
  const codeEditorProps = {
93
- containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
94
- value: PropTypes.string.description('editors content').isRequired,
95
- onSave: PropTypes.func.description('function called when the user press save'),
96
- onClose: PropTypes.func.description('function called when the user closes the modal'),
97
- onReject: PropTypes.func.description('function called when is rejected'),
98
- onChange: PropTypes.func.description('function executed when code editor value changes').isRequired,
99
- isOpen: PropTypes.bool.description('Whether the modal is opened or not').defaultValue(false),
100
- fileName: PropTypes.string.description('File name to open in the editor'),
101
- maxLines: PropTypes.number.description('Max lines in the editor content').defaultValue(20),
102
- minLines: PropTypes.number.description('Min lines in the editor content').defaultValue(20),
103
- modalTitle: PropTypes.string.description('Modal title').defaultValue('Javascript Editor'),
104
- confirmLabel: PropTypes.string.description('Customize modal confirm label').defaultValue('Save'),
105
- rejectLabel: PropTypes.string.description('Customize modal rejection label').defaultValue('Close'),
106
- modalType: PropTypes.oneOf(modalTypes).description('Modal type').defaultValue('confirm'),
107
- size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']).description('modal size').defaultValue('large'),
108
- style: PropTypes.object.description('css inline style'),
109
- useModal: PropTypes.bool.description('whether to use code editor inside modal or not').defaultValue(true),
110
- showHeader: PropTypes.bool.description('show editors header').defaultValue(true),
111
- showSyntaxChecks: PropTypes.bool.description('show syntax warnings and checks').defaultValue(true)
74
+ containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
75
+ value: PropTypes.string.description("editors content").isRequired,
76
+ onSave: PropTypes.func.description("function called when the user press save"),
77
+ onClose: PropTypes.func.description("function called when the user closes the modal"),
78
+ onReject: PropTypes.func.description("function called when is rejected"),
79
+ onChange: PropTypes.func.description("function executed when code editor value changes").isRequired,
80
+ isOpen: PropTypes.bool.description("Whether the modal is opened or not").defaultValue(false),
81
+ fileName: PropTypes.string.description("File name to open in the editor"),
82
+ maxLines: PropTypes.number.description("Max lines in the editor content").defaultValue(20),
83
+ minLines: PropTypes.number.description("Min lines in the editor content").defaultValue(20),
84
+ modalTitle: PropTypes.string.description("Modal title").defaultValue("Javascript Editor"),
85
+ confirmLabel: PropTypes.string.description("Customize modal confirm label").defaultValue("Save"),
86
+ rejectLabel: PropTypes.string.description("Customize modal rejection label").defaultValue("Close"),
87
+ modalType: PropTypes.oneOf(modalTypes).description("Modal type").defaultValue("confirm"),
88
+ size: PropTypes.oneOf(["xsmall", "small", "medium", "large", "xlarge"]).description("modal size").defaultValue("large"),
89
+ style: PropTypes.object.description("css inline style"),
90
+ useModal: PropTypes.bool.description("whether to use code editor inside modal or not").defaultValue(true),
91
+ showHeader: PropTypes.bool.description("show editors header").defaultValue(true),
92
+ showSyntaxChecks: PropTypes.bool.description("show syntax warnings and checks").defaultValue(true)
112
93
  };
94
+ DSCodeEditor.propTypes = codeEditorProps;
113
95
  const CodeEditorWithSchema = describe(DSCodeEditor);
114
96
  CodeEditorWithSchema.propTypes = codeEditorProps;
115
-
116
- export { CodeEditorWithSchema, DSCodeEditor as default };
97
+ var DSCodeEditor_default = DSCodeEditor;
98
+ export {
99
+ CodeEditorWithSchema,
100
+ DSCodeEditor_default as default
101
+ };
102
+ //# sourceMappingURL=DSCodeEditor.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSCodeEditor.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useState, useRef } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport DSModal, { modalTypes } from '@elliemae/ds-modal';\nimport AceEditor from 'react-ace';\nimport DSCodeEditorForm from './components/DSCodeEditorForm';\nimport 'brace/mode/javascript.js';\nimport 'brace/theme/tomorrow.js';\n\nconst DSCodeEditor = ({\n containerProps = {},\n value: defaultValue = '',\n onSave = () => null,\n onClose = () => null,\n onReject = () => null,\n onChange = () => null,\n isOpen = false,\n fileName = '',\n confirmLabel = 'Save',\n maxLines = 20,\n minLines = 20,\n modalTitle = 'Javascript Editor',\n modalType = 'confirm',\n rejectLabel = 'Close',\n size = 'large',\n style = {},\n useModal = true,\n showHeader = true,\n showSyntaxChecks = true,\n}) => {\n const [{ value, errors }, setState] = useState({\n value: defaultValue,\n errors: [],\n });\n const reactAceComponent = useRef();\n\n const editor = (\n <>\n {showHeader && (\n <DSCodeEditorForm\n fileName={fileName}\n reactAceComponent={reactAceComponent}\n />\n )}\n <AceEditor\n ref={reactAceComponent}\n editorProps={{ $blockScrolling: true }}\n maxLines={maxLines}\n minLines={minLines}\n mode=\"javascript\"\n name=\"ace-code-edior\"\n onChange={(val) => {\n setState({ errors, value: val });\n onChange(val, errors);\n }}\n onValidate={(annotations) => setState({ value, errors: annotations })}\n theme=\"tomorrow\"\n setOptions={{\n useWorker: showSyntaxChecks,\n }}\n value={value}\n />\n </>\n );\n if (!useModal) return editor;\n return (\n <DSModal\n centered={false}\n confirmLabel={confirmLabel}\n containerProps={containerProps}\n isOpen={isOpen}\n modalTitle={modalTitle}\n modalType={modalType}\n onClose={() => onClose(value, fileName, errors)}\n onConfirm={() => onSave(value, fileName, errors)}\n onReject={() => onReject(value, fileName, errors)}\n rejectLabel={rejectLabel}\n size={size}\n style={style}\n >\n {editor}\n </DSModal>\n );\n};\n\nconst codeEditorProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n value: PropTypes.string.description('editors content').isRequired,\n onSave: PropTypes.func.description(\n 'function called when the user press save',\n ),\n onClose: PropTypes.func.description(\n 'function called when the user closes the modal',\n ),\n onReject: PropTypes.func.description('function called when is rejected'),\n onChange: PropTypes.func.description(\n 'function executed when code editor value changes',\n ).isRequired,\n isOpen: PropTypes.bool\n .description('Whether the modal is opened or not')\n .defaultValue(false),\n fileName: PropTypes.string.description('File name to open in the editor'),\n maxLines: PropTypes.number\n .description('Max lines in the editor content')\n .defaultValue(20),\n minLines: PropTypes.number\n .description('Min lines in the editor content')\n .defaultValue(20),\n modalTitle: PropTypes.string\n .description('Modal title')\n .defaultValue('Javascript Editor'),\n confirmLabel: PropTypes.string\n .description('Customize modal confirm label')\n .defaultValue('Save'),\n rejectLabel: PropTypes.string\n .description('Customize modal rejection label')\n .defaultValue('Close'),\n modalType: PropTypes.oneOf(modalTypes)\n .description('Modal type')\n .defaultValue('confirm'),\n size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge'])\n .description('modal size')\n .defaultValue('large'),\n style: PropTypes.object.description('css inline style'),\n useModal: PropTypes.bool\n .description('whether to use code editor inside modal or not')\n .defaultValue(true),\n showHeader: PropTypes.bool\n .description('show editors header')\n .defaultValue(true),\n showSyntaxChecks: PropTypes.bool\n .description('show syntax warnings and checks')\n .defaultValue(true),\n};\n\nDSCodeEditor.propTypes = codeEditorProps;\n\nconst CodeEditorWithSchema = describe(DSCodeEditor);\nCodeEditorWithSchema.propTypes = codeEditorProps;\n\nexport { CodeEditorWithSchema };\nexport default DSCodeEditor;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB;AAAA,EACjB,OAAO,eAAe;AAAA,EACtB,SAAS,MAAM;AAAA,EACf,UAAU,MAAM;AAAA,EAChB,WAAW,MAAM;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,eAAe;AAAA,EACf,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,aAAa;AAAA,EACb,mBAAmB;AAAA,MACf;AACJ,QAAM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