@elliemae/ds-codeeditor 3.0.0-next.5 → 3.0.0-next.53
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/cjs/DSCodeEditor.js +10 -16
- package/dist/cjs/DSCodeEditor.js.map +2 -2
- package/dist/cjs/components/DSCodeEditorForm.js +10 -16
- package/dist/cjs/components/DSCodeEditorForm.js.map +2 -2
- package/dist/cjs/components/DSCodeEditorImpl.js +9 -16
- package/dist/cjs/components/DSCodeEditorImpl.js.map +1 -1
- package/dist/cjs/index.js +10 -16
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/DSCodeEditor.js +1 -0
- package/dist/esm/DSCodeEditor.js.map +2 -2
- package/dist/esm/components/DSCodeEditorForm.js +1 -0
- package/dist/esm/components/DSCodeEditorForm.js.map +2 -2
- package/dist/esm/components/DSCodeEditorImpl.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +14 -14
package/dist/cjs/DSCodeEditor.js
CHANGED
|
@@ -4,32 +4,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
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);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var DSCodeEditor_exports = {};
|
|
29
22
|
__export(DSCodeEditor_exports, {
|
|
30
23
|
CodeEditorWithSchema: () => CodeEditorWithSchema,
|
|
24
|
+
DSCodeEditor: () => DSCodeEditor,
|
|
31
25
|
default: () => DSCodeEditor_default
|
|
32
26
|
});
|
|
27
|
+
module.exports = __toCommonJS(DSCodeEditor_exports);
|
|
33
28
|
var React = __toESM(require("react"));
|
|
34
29
|
var import_react = __toESM(require("react"));
|
|
35
30
|
var import_react_desc = require("react-desc");
|
|
@@ -127,5 +122,4 @@ DSCodeEditor.propTypes = codeEditorProps;
|
|
|
127
122
|
const CodeEditorWithSchema = (0, import_react_desc.describe)(DSCodeEditor);
|
|
128
123
|
CodeEditorWithSchema.propTypes = codeEditorProps;
|
|
129
124
|
var DSCodeEditor_default = DSCodeEditor;
|
|
130
|
-
module.exports = __toCommonJS(DSCodeEditor_exports);
|
|
131
125
|
//# sourceMappingURL=DSCodeEditor.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSCodeEditor.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* 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, DSCodeEditor };\nexport default DSCodeEditor;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAwC;AACxC,wBAAoC;AACpC,sBAAoC;AACpC,uBAAsB;AACtB,8BAA6B;AAC7B,wBAAO;AACP,sBAAO;AAEP,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB,CAAC;AAAA,EAClB,OAAO,eAAe;AAAA,EACtB,SAAS,MAAM;AA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AAY;AAGjC,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
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);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var DSCodeEditorForm_exports = {};
|
|
29
22
|
__export(DSCodeEditorForm_exports, {
|
|
30
23
|
default: () => DSCodeEditorForm_default
|
|
31
24
|
});
|
|
25
|
+
module.exports = __toCommonJS(DSCodeEditorForm_exports);
|
|
32
26
|
var React = __toESM(require("react"));
|
|
33
27
|
var import_react = __toESM(require("react"));
|
|
34
28
|
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
@@ -49,6 +43,7 @@ class DSCodeEditorForm extends import_react.Component {
|
|
|
49
43
|
filteredText: "",
|
|
50
44
|
replaceText: ""
|
|
51
45
|
};
|
|
46
|
+
this.searchWord = this.searchWord.bind(this);
|
|
52
47
|
}
|
|
53
48
|
searchWord(isReplace, all) {
|
|
54
49
|
const {
|
|
@@ -162,5 +157,4 @@ class DSCodeEditorForm extends import_react.Component {
|
|
|
162
157
|
}
|
|
163
158
|
}
|
|
164
159
|
var DSCodeEditorForm_default = DSCodeEditorForm;
|
|
165
|
-
module.exports = __toCommonJS(DSCodeEditorForm_exports);
|
|
166
160
|
//# sourceMappingURL=DSCodeEditorForm.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DSCodeEditorForm.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { Component } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { DSCheckbox, DSTextBox, DSInputGroup } from '@elliemae/ds-form';\nimport { convertPropToCssClassName, aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ChevronSmallLeft, ChevronSmallRight } from '@elliemae/ds-icons';\n\nconst blockName = 'code-editor';\n\nconst { cssClassName, classNameBlock } = convertPropToCssClassName(blockName);\n\nconst CheckOptionsGroup = aggregatedClasses('div')(`${blockName}-options-group`);\n\nclass DSCodeEditorForm extends Component {\n constructor(props) {\n super(props);\n this.state = {\n find: false,\n replace: false,\n isCaseSensitive: false,\n isWholeWord: false,\n filteredText: '',\n replaceText: '',\n };\n }\n\n searchWord(isReplace, all) {\n const {\n reactAceComponent: {\n current: { editor },\n },\n } = this.props;\n const { isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n const options = {\n backwards: false,\n wrap: true,\n caseSensitive: isCaseSensitive,\n wholeWord: isWholeWord,\n regExp: true,\n };\n editor.find(filteredText, options);\n const selectedContent = editor.getSelectedText();\n if (isReplace && replaceText && selectedContent) {\n if (all) {\n editor.findAll(filteredText, options);\n editor.replaceAll(replaceText);\n } else {\n const range = editor.selection.getRange();\n editor.session.replace(range, replaceText);\n }\n }\n }\n\n render() {\n const { fileName } = this.props;\n\n const { find, replace, isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n return (\n <div className={`${cssClassName}`}>\n {fileName ? (\n <div className={classNameBlock('file-name')}>\n File Name: <span> {fileName} </span>\n </div>\n ) : null}\n <div className={classNameBlock('find-replace-btn')}>\n {!find && !replace ? (\n <DSButton buttonType=\"secondary\" labelText=\"Find\" onClick={() => this.setState({ find: true })} size=\"m\" />\n ) : null}\n {!replace ? (\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Find & Replace\"\n onClick={() => this.setState({ replace: true })}\n size=\"m\"\n />\n ) : null}\n </div>\n {find || replace ? (\n <DSInputGroup className={classNameBlock('find')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"find-textbox\"\n onChange={(e) => this.setState({ filteredText: e.currentTarget.value })}\n placeholder=\"Find\"\n rightComponent={\n <div className={classNameBlock('next-back-btn')}>\n <DSButton icon={<ChevronSmallLeft />} size=\"m\" />\n <DSButton icon={<ChevronSmallRight />} onClick={() => this.searchWord()} size=\"m\" />\n </div>\n }\n value={filteredText}\n />\n <CheckOptionsGroup>\n <DSCheckbox\n checked={isCaseSensitive}\n id=\"case-sensitive-check\"\n labelText=\"Case Sensitive\"\n name=\"case-sensitive-check\"\n onChange={() => this.setState({ isCaseSensitive: !isCaseSensitive })}\n />\n <DSCheckbox\n checked={isWholeWord}\n id=\"whole-word-check\"\n labelText=\"Whole Word\"\n name=\"whole-word-check\"\n onChange={() => this.setState({ isWholeWord: !isWholeWord })}\n />\n <DSCheckbox\n checked={replace}\n id=\"replace-check\"\n labelText=\"Replace\"\n name=\"replace-check\"\n onChange={() => this.setState({ replace: !replace })}\n />\n </CheckOptionsGroup>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Done\"\n onClick={() => this.setState({ replace: false, find: false })}\n size=\"m\"\n />\n </DSInputGroup>\n ) : null}\n {replace ? (\n <div className={classNameBlock('replace')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"replace-textbox\"\n onChange={(e) => this.setState({ replaceText: e.currentTarget.value })}\n placeholder=\"Replace\"\n value={replaceText}\n />\n <div className={classNameBlock('replace-btns')}>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace\"\n onClick={() => this.searchWord(true, false)}\n size=\"m\"\n />\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace All\"\n onClick={() => this.searchWord(true, true)}\n size=\"m\"\n />\n </div>\n </div>\n ) : null}\n </div>\n );\n }\n}\n\nexport default DSCodeEditorForm;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { Component } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { DSCheckbox, DSTextBox, DSInputGroup } from '@elliemae/ds-form';\nimport { convertPropToCssClassName, aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ChevronSmallLeft, ChevronSmallRight } from '@elliemae/ds-icons';\n\nconst blockName = 'code-editor';\n\nconst { cssClassName, classNameBlock } = convertPropToCssClassName(blockName);\n\nconst CheckOptionsGroup = aggregatedClasses('div')(`${blockName}-options-group`);\n\nclass DSCodeEditorForm extends Component {\n constructor(props) {\n super(props);\n this.state = {\n find: false,\n replace: false,\n isCaseSensitive: false,\n isWholeWord: false,\n filteredText: '',\n replaceText: '',\n };\n\n this.searchWord = this.searchWord.bind(this);\n }\n\n searchWord(isReplace, all) {\n const {\n reactAceComponent: {\n current: { editor },\n },\n } = this.props;\n const { isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n const options = {\n backwards: false,\n wrap: true,\n caseSensitive: isCaseSensitive,\n wholeWord: isWholeWord,\n regExp: true,\n };\n editor.find(filteredText, options);\n const selectedContent = editor.getSelectedText();\n if (isReplace && replaceText && selectedContent) {\n if (all) {\n editor.findAll(filteredText, options);\n editor.replaceAll(replaceText);\n } else {\n const range = editor.selection.getRange();\n editor.session.replace(range, replaceText);\n }\n }\n }\n\n render() {\n const { fileName } = this.props;\n\n const { find, replace, isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n return (\n <div className={`${cssClassName}`}>\n {fileName ? (\n <div className={classNameBlock('file-name')}>\n File Name: <span> {fileName} </span>\n </div>\n ) : null}\n <div className={classNameBlock('find-replace-btn')}>\n {!find && !replace ? (\n <DSButton buttonType=\"secondary\" labelText=\"Find\" onClick={() => this.setState({ find: true })} size=\"m\" />\n ) : null}\n {!replace ? (\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Find & Replace\"\n onClick={() => this.setState({ replace: true })}\n size=\"m\"\n />\n ) : null}\n </div>\n {find || replace ? (\n <DSInputGroup className={classNameBlock('find')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"find-textbox\"\n onChange={(e) => this.setState({ filteredText: e.currentTarget.value })}\n placeholder=\"Find\"\n rightComponent={\n <div className={classNameBlock('next-back-btn')}>\n <DSButton icon={<ChevronSmallLeft />} size=\"m\" />\n <DSButton icon={<ChevronSmallRight />} onClick={() => this.searchWord()} size=\"m\" />\n </div>\n }\n value={filteredText}\n />\n <CheckOptionsGroup>\n <DSCheckbox\n checked={isCaseSensitive}\n id=\"case-sensitive-check\"\n labelText=\"Case Sensitive\"\n name=\"case-sensitive-check\"\n onChange={() => this.setState({ isCaseSensitive: !isCaseSensitive })}\n />\n <DSCheckbox\n checked={isWholeWord}\n id=\"whole-word-check\"\n labelText=\"Whole Word\"\n name=\"whole-word-check\"\n onChange={() => this.setState({ isWholeWord: !isWholeWord })}\n />\n <DSCheckbox\n checked={replace}\n id=\"replace-check\"\n labelText=\"Replace\"\n name=\"replace-check\"\n onChange={() => this.setState({ replace: !replace })}\n />\n </CheckOptionsGroup>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Done\"\n onClick={() => this.setState({ replace: false, find: false })}\n size=\"m\"\n />\n </DSInputGroup>\n ) : null}\n {replace ? (\n <div className={classNameBlock('replace')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"replace-textbox\"\n onChange={(e) => this.setState({ replaceText: e.currentTarget.value })}\n placeholder=\"Replace\"\n value={replaceText}\n />\n <div className={classNameBlock('replace-btns')}>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace\"\n onClick={() => this.searchWord(true, false)}\n size=\"m\"\n />\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace All\"\n onClick={() => this.searchWord(true, true)}\n size=\"m\"\n />\n </div>\n </div>\n ) : null}\n </div>\n );\n }\n}\n\nexport default DSCodeEditorForm;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAiC;AACjC,uBAAqB;AACrB,qBAAoD;AACpD,2BAA6D;AAC7D,sBAAoD;AAEpD,MAAM,YAAY;AAElB,MAAM,EAAE,cAAc,mBAAmB,oDAA0B,SAAS;AAE5E,MAAM,oBAAoB,4CAAkB,KAAK,EAAE,GAAG,yBAAyB;AAE/E,MAAM,yBAAyB,uBAAU;AAAA,EACvC,YAAY,OAAO;AACjB,UAAM,KAAK;AACX,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,MACV,SAAS,MAAM,KAAK,SAAS,EAAE,SAAS,OAAO,MAAM,MAAM,CAAC;AAAA,MAC5D,MAAK;AAAA,KACP,CACF,IACE,MACH,UACC,mDAAC;AAAA,MAAI,WAAW,eAAe,SAAS;AAAA,OACtC,mDAAC;AAAA,MACC,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,IAAG;AAAA,MACH,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,aAAa,EAAE,cAAc,MAAM,CAAC;AAAA,MACrE,aAAY;AAAA,MACZ,OAAO;AAAA,KACT,GACA,mDAAC;AAAA,MAAI,WAAW,eAAe,cAAc;AAAA,OAC3C,mDAAC;AAAA,MACC,YAAW;AAAA,MACX,WAAU;AAAA,MACV,SAAS,MAAM,KAAK,WAAW,MAAM,KAAK;AAAA,MAC1C,MAAK;AAAA,KACP,GACA,mDAAC;AAAA,MACC,YAAW;AAAA,MACX,WAAU;AAAA,MACV,SAAS,MAAM,KAAK,WAAW,MAAM,IAAI;AAAA,MACzC,MAAK;AAAA,KACP,CACF,CACF,IACE,IACN;AAAA,EAEJ;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
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);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var DSCodeEditorImpl_exports = {};
|
|
29
22
|
__export(DSCodeEditorImpl_exports, {
|
|
30
23
|
default: () => DSCodeEditorImpl_default
|
|
31
24
|
});
|
|
25
|
+
module.exports = __toCommonJS(DSCodeEditorImpl_exports);
|
|
32
26
|
var React = __toESM(require("react"));
|
|
33
27
|
var import_react = __toESM(require("react"));
|
|
34
28
|
var import_react_ace = __toESM(require("react-ace"));
|
|
@@ -94,5 +88,4 @@ class DSCodeEditorImpl extends import_react.Component {
|
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
var DSCodeEditorImpl_default = DSCodeEditorImpl;
|
|
97
|
-
module.exports = __toCommonJS(DSCodeEditorImpl_exports);
|
|
98
91
|
//# sourceMappingURL=DSCodeEditorImpl.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DSCodeEditorImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAiC;AACjC,uBAAsB;AACtB,sBAAoB;AACpB,8BAA6B;AAC7B,wBAAO;A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|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
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);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var src_exports = {};
|
|
29
22
|
__export(src_exports, {
|
|
30
23
|
CodeEditorWithSchema: () => import_DSCodeEditor.CodeEditorWithSchema,
|
|
24
|
+
DSCodeEditor: () => import_DSCodeEditor.DSCodeEditor,
|
|
31
25
|
default: () => import_DSCodeEditor.default
|
|
32
26
|
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
33
28
|
var React = __toESM(require("react"));
|
|
34
29
|
var import_DSCodeEditor = __toESM(require("./DSCodeEditor"));
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
30
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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": "
|
|
4
|
+
"sourcesContent": ["export { default, DSCodeEditor, CodeEditorWithSchema } from './DSCodeEditor';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA4D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSCodeEditor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
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, DSCodeEditor };\nexport default DSCodeEditor;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB,CAAC;AAAA,EAClB,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,CAAC;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AAAA,EACb,mBAAmB;AAAA,MACf;AACJ,QAAM,CAAC,EAAE,OAAO,UAAU,YAAY,SAAS;AAAA,IAC7C,OAAO;AAAA,IACP,QAAQ,CAAC;AAAA,EACX,CAAC;AACD,QAAM,oBAAoB,OAAO;AAEjC,QAA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AE;AAAA,EAClB,UAAU,UAAU,OACjB,YAAY,iCAAiC,EAC7C,aAAa,EAAE;AAAA,EAClB,YAAY,UAAU,OACnB,YAAY,aAAa,EACzB,aAAa,mBAAmB;AAAA,EACnC,cAAc,UAAU,OACrB,YAAY,+BAA+B,EAC3C,aAAa,MAAM;AAAA,EACtB,aAAa,UAAU,OACpB,YAAY,iCAAiC,EAC7C,aAAa,OAAO;AAAA,EACvB,WAAW,UAAU,MAAM,UAAU,EAClC,YAAY,YAAY,EACxB,aAAa,SAAS;AAAA,EACzB,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,UAAU,SAAS,QAAQ,CAAC,EACnE,YAAY,YAAY,EACxB,aAAa,OAAO;AAAA,EACvB,OAAO,UAAU,OAAO,YAAY,kBAAkB;AAAA,EACtD,UAAU,UAAU,KACjB,YAAY,gDAAgD,EAC5D,aAAa,IAAI;AAAA,EACpB,YAAY,UAAU,KACnB,YAAY,qBAAqB,EACjC,aAAa,IAAI;AAAA,EACpB,kBAAkB,UAAU,KACzB,YAAY,iCAAiC,EAC7C,aAAa,IAAI;AACtB;AAEA,aAAa,YAAY;AAEzB,MAAM,uBAAuB,SAAS,YAAY;AAClD,qBAAqB,YAAY;AAGjC,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DSCodeEditorForm.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { Component } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { DSCheckbox, DSTextBox, DSInputGroup } from '@elliemae/ds-form';\nimport { convertPropToCssClassName, aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ChevronSmallLeft, ChevronSmallRight } from '@elliemae/ds-icons';\n\nconst blockName = 'code-editor';\n\nconst { cssClassName, classNameBlock } = convertPropToCssClassName(blockName);\n\nconst CheckOptionsGroup = aggregatedClasses('div')(`${blockName}-options-group`);\n\nclass DSCodeEditorForm extends Component {\n constructor(props) {\n super(props);\n this.state = {\n find: false,\n replace: false,\n isCaseSensitive: false,\n isWholeWord: false,\n filteredText: '',\n replaceText: '',\n };\n }\n\n searchWord(isReplace, all) {\n const {\n reactAceComponent: {\n current: { editor },\n },\n } = this.props;\n const { isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n const options = {\n backwards: false,\n wrap: true,\n caseSensitive: isCaseSensitive,\n wholeWord: isWholeWord,\n regExp: true,\n };\n editor.find(filteredText, options);\n const selectedContent = editor.getSelectedText();\n if (isReplace && replaceText && selectedContent) {\n if (all) {\n editor.findAll(filteredText, options);\n editor.replaceAll(replaceText);\n } else {\n const range = editor.selection.getRange();\n editor.session.replace(range, replaceText);\n }\n }\n }\n\n render() {\n const { fileName } = this.props;\n\n const { find, replace, isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n return (\n <div className={`${cssClassName}`}>\n {fileName ? (\n <div className={classNameBlock('file-name')}>\n File Name: <span> {fileName} </span>\n </div>\n ) : null}\n <div className={classNameBlock('find-replace-btn')}>\n {!find && !replace ? (\n <DSButton buttonType=\"secondary\" labelText=\"Find\" onClick={() => this.setState({ find: true })} size=\"m\" />\n ) : null}\n {!replace ? (\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Find & Replace\"\n onClick={() => this.setState({ replace: true })}\n size=\"m\"\n />\n ) : null}\n </div>\n {find || replace ? (\n <DSInputGroup className={classNameBlock('find')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"find-textbox\"\n onChange={(e) => this.setState({ filteredText: e.currentTarget.value })}\n placeholder=\"Find\"\n rightComponent={\n <div className={classNameBlock('next-back-btn')}>\n <DSButton icon={<ChevronSmallLeft />} size=\"m\" />\n <DSButton icon={<ChevronSmallRight />} onClick={() => this.searchWord()} size=\"m\" />\n </div>\n }\n value={filteredText}\n />\n <CheckOptionsGroup>\n <DSCheckbox\n checked={isCaseSensitive}\n id=\"case-sensitive-check\"\n labelText=\"Case Sensitive\"\n name=\"case-sensitive-check\"\n onChange={() => this.setState({ isCaseSensitive: !isCaseSensitive })}\n />\n <DSCheckbox\n checked={isWholeWord}\n id=\"whole-word-check\"\n labelText=\"Whole Word\"\n name=\"whole-word-check\"\n onChange={() => this.setState({ isWholeWord: !isWholeWord })}\n />\n <DSCheckbox\n checked={replace}\n id=\"replace-check\"\n labelText=\"Replace\"\n name=\"replace-check\"\n onChange={() => this.setState({ replace: !replace })}\n />\n </CheckOptionsGroup>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Done\"\n onClick={() => this.setState({ replace: false, find: false })}\n size=\"m\"\n />\n </DSInputGroup>\n ) : null}\n {replace ? (\n <div className={classNameBlock('replace')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"replace-textbox\"\n onChange={(e) => this.setState({ replaceText: e.currentTarget.value })}\n placeholder=\"Replace\"\n value={replaceText}\n />\n <div className={classNameBlock('replace-btns')}>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace\"\n onClick={() => this.searchWord(true, false)}\n size=\"m\"\n />\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace All\"\n onClick={() => this.searchWord(true, true)}\n size=\"m\"\n />\n </div>\n </div>\n ) : null}\n </div>\n );\n }\n}\n\nexport default DSCodeEditorForm;\n"],
|
|
5
|
-
"mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,EAAE,cAAc,mBAAmB,0BAA0B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { Component } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { DSCheckbox, DSTextBox, DSInputGroup } from '@elliemae/ds-form';\nimport { convertPropToCssClassName, aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ChevronSmallLeft, ChevronSmallRight } from '@elliemae/ds-icons';\n\nconst blockName = 'code-editor';\n\nconst { cssClassName, classNameBlock } = convertPropToCssClassName(blockName);\n\nconst CheckOptionsGroup = aggregatedClasses('div')(`${blockName}-options-group`);\n\nclass DSCodeEditorForm extends Component {\n constructor(props) {\n super(props);\n this.state = {\n find: false,\n replace: false,\n isCaseSensitive: false,\n isWholeWord: false,\n filteredText: '',\n replaceText: '',\n };\n\n this.searchWord = this.searchWord.bind(this);\n }\n\n searchWord(isReplace, all) {\n const {\n reactAceComponent: {\n current: { editor },\n },\n } = this.props;\n const { isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n const options = {\n backwards: false,\n wrap: true,\n caseSensitive: isCaseSensitive,\n wholeWord: isWholeWord,\n regExp: true,\n };\n editor.find(filteredText, options);\n const selectedContent = editor.getSelectedText();\n if (isReplace && replaceText && selectedContent) {\n if (all) {\n editor.findAll(filteredText, options);\n editor.replaceAll(replaceText);\n } else {\n const range = editor.selection.getRange();\n editor.session.replace(range, replaceText);\n }\n }\n }\n\n render() {\n const { fileName } = this.props;\n\n const { find, replace, isCaseSensitive, isWholeWord, filteredText, replaceText } = this.state;\n return (\n <div className={`${cssClassName}`}>\n {fileName ? (\n <div className={classNameBlock('file-name')}>\n File Name: <span> {fileName} </span>\n </div>\n ) : null}\n <div className={classNameBlock('find-replace-btn')}>\n {!find && !replace ? (\n <DSButton buttonType=\"secondary\" labelText=\"Find\" onClick={() => this.setState({ find: true })} size=\"m\" />\n ) : null}\n {!replace ? (\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Find & Replace\"\n onClick={() => this.setState({ replace: true })}\n size=\"m\"\n />\n ) : null}\n </div>\n {find || replace ? (\n <DSInputGroup className={classNameBlock('find')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"find-textbox\"\n onChange={(e) => this.setState({ filteredText: e.currentTarget.value })}\n placeholder=\"Find\"\n rightComponent={\n <div className={classNameBlock('next-back-btn')}>\n <DSButton icon={<ChevronSmallLeft />} size=\"m\" />\n <DSButton icon={<ChevronSmallRight />} onClick={() => this.searchWord()} size=\"m\" />\n </div>\n }\n value={filteredText}\n />\n <CheckOptionsGroup>\n <DSCheckbox\n checked={isCaseSensitive}\n id=\"case-sensitive-check\"\n labelText=\"Case Sensitive\"\n name=\"case-sensitive-check\"\n onChange={() => this.setState({ isCaseSensitive: !isCaseSensitive })}\n />\n <DSCheckbox\n checked={isWholeWord}\n id=\"whole-word-check\"\n labelText=\"Whole Word\"\n name=\"whole-word-check\"\n onChange={() => this.setState({ isWholeWord: !isWholeWord })}\n />\n <DSCheckbox\n checked={replace}\n id=\"replace-check\"\n labelText=\"Replace\"\n name=\"replace-check\"\n onChange={() => this.setState({ replace: !replace })}\n />\n </CheckOptionsGroup>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Done\"\n onClick={() => this.setState({ replace: false, find: false })}\n size=\"m\"\n />\n </DSInputGroup>\n ) : null}\n {replace ? (\n <div className={classNameBlock('replace')}>\n <DSTextBox\n className=\"find-word\"\n fluidWidth={false}\n id=\"replace-textbox\"\n onChange={(e) => this.setState({ replaceText: e.currentTarget.value })}\n placeholder=\"Replace\"\n value={replaceText}\n />\n <div className={classNameBlock('replace-btns')}>\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace\"\n onClick={() => this.searchWord(true, false)}\n size=\"m\"\n />\n <DSButton\n buttonType=\"secondary\"\n labelText=\"Replace All\"\n onClick={() => this.searchWord(true, true)}\n size=\"m\"\n />\n </div>\n </div>\n ) : null}\n </div>\n );\n }\n}\n\nexport default DSCodeEditorForm;\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,EAAE,cAAc,mBAAmB,0BAA0B,SAAS;AAE5E,MAAM,oBAAoB,kBAAkB,KAAK,EAAE,GAAG,yBAAyB;AAE/E,MAAM,yBAAy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CACF,GACA,qCAAC;AAAA,MACC,YAAW;AAAA,MACX,WAAU;AAAA,MACV,SAAS,MAAM,KAAK,SAAS,EAAE,SAAS,OAAO,MAAM,MAAM,CAAC;AAAA,MAC5D,MAAK;AAAA,KACP,CACF,IACE,MACH,UACC,qCAAC;AAAA,MAAI,WAAW,eAAe,SAAS;AAAA,OACtC,qCAAC;AAAA,MACC,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,IAAG;AAAA,MACH,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,aAAa,EAAE,cAAc,MAAM,CAAC;AAAA,MACrE,aAAY;AAAA,MACZ,OAAO;AAAA,KACT,GACA,qCAAC;AAAA,MAAI,WAAW,eAAe,cAAc;AAAA,OAC3C,qCAAC;AAAA,MACC,YAAW;AAAA,MACX,WAAU;AAAA,MACV,SAAS,MAAM,KAAK,WAAW,MAAM,KAAK;AAAA,MAC1C,MAAK;AAAA,KACP,GACA,qCAAC;AAAA,MACC,YAAW;AAAA,MACX,WAAU;AAAA,MACV,SAAS,MAAM,KAAK,WAAW,MAAM,IAAI;AAAA,MACzC,MAAK;AAAA,KACP,CACF,CACF,IACE,IACN;AAAA,EAEJ;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/DSCodeEditorImpl.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,yBAAyB,UAAU;AAAA,EACvC,YAAY,OAAO;AACjB,UAAM,KAAK;AACX,SAAK,QAAQ;AAAA,MACX,OAAO,MAAM;AAAA,MACb,QAAQ,CAAC;AAAA,IACX;AACA,SAAK,oBAAoB,OAAM,UAAU;AAAA,EAC3C;AAAA,EAEA,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,qCAAC;AAAA,MACC,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,MAAM,QAAQ,OAAO,UAAU,MAAM;AAAA,MAC9C,WAAW,MAAM,OAAO,OAAO,UAAU,MAAM;AAAA,MAC/C,UAAU,MAAM,SAAS,OAAO,UAAU,MAAM;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,OAEA,qCAAC;AAAA,MACC;AAAA,MACA,mBAAmB,KAAK;AAAA,KAC1B,GACA,qCAAC;AAAA,MACC,KAAK,KAAK;AAAA,MACV,aAAa,EAAE,iBAAiB,KAAK;AAAA,MACrC;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,MAAK;AAAA,MACL,UAAU,SAAO,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC;AAAA,MAC7C,YAAY,iBAAe,KAAK,SAAS,EAAE,QAAQ,YAAY,CAAC;AAAA,MAChE,OAAM;AAAA,MACN;AAAA,KACF,CACF;AAAA,EAEJ;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { default as default2, CodeEditorWithSchema } from "./DSCodeEditor";
|
|
2
|
+
import { default as default2, DSCodeEditor, CodeEditorWithSchema } from "./DSCodeEditor";
|
|
3
3
|
export {
|
|
4
4
|
CodeEditorWithSchema,
|
|
5
|
+
DSCodeEditor,
|
|
5
6
|
default2 as default
|
|
6
7
|
};
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, CodeEditorWithSchema } from './DSCodeEditor';\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, DSCodeEditor, CodeEditorWithSchema } from './DSCodeEditor';\n"],
|
|
5
5
|
"mappings": "AAAA;ACAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-codeeditor",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.53",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Code Editor",
|
|
6
6
|
"files": [
|
|
@@ -46,12 +46,19 @@
|
|
|
46
46
|
"reportFile": "tests.xml",
|
|
47
47
|
"indent": 4
|
|
48
48
|
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
51
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
52
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
53
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
54
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
55
|
+
},
|
|
49
56
|
"dependencies": {
|
|
50
|
-
"@elliemae/ds-button": "
|
|
51
|
-
"@elliemae/ds-classnames": "
|
|
52
|
-
"@elliemae/ds-form": "
|
|
53
|
-
"@elliemae/ds-icons": "
|
|
54
|
-
"@elliemae/ds-modal": "
|
|
57
|
+
"@elliemae/ds-button": "workspace:*",
|
|
58
|
+
"@elliemae/ds-classnames": "workspace:*",
|
|
59
|
+
"@elliemae/ds-form": "workspace:*",
|
|
60
|
+
"@elliemae/ds-icons": "workspace:*",
|
|
61
|
+
"@elliemae/ds-modal": "workspace:*",
|
|
55
62
|
"brace": "~0.11.1",
|
|
56
63
|
"react-ace": "~6.6.0",
|
|
57
64
|
"react-desc": "~4.1.3"
|
|
@@ -64,12 +71,5 @@
|
|
|
64
71
|
"publishConfig": {
|
|
65
72
|
"access": "public",
|
|
66
73
|
"typeSafety": false
|
|
67
|
-
},
|
|
68
|
-
"scripts": {
|
|
69
|
-
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
70
|
-
"test": "node ../../scripts/testing/test.mjs",
|
|
71
|
-
"lint": "node ../../scripts/lint.mjs",
|
|
72
|
-
"dts": "node ../../scripts/dts.mjs",
|
|
73
|
-
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|