@elliemae/ds-wysiwygeditor 3.16.0 → 3.16.1-rc.10
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/DSWYSIWYGEditor.js +5 -1
- package/dist/cjs/DSWYSIWYGEditor.js.map +2 -2
- package/dist/cjs/components/CustomImageUploader.js +5 -1
- package/dist/cjs/components/CustomImageUploader.js.map +2 -2
- package/dist/cjs/components/CustomToolbar.js +7 -3
- package/dist/cjs/components/CustomToolbar.js.map +2 -2
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js +45 -14
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +2 -2
- package/dist/cjs/components/ImageLibraryModal.js +5 -8
- package/dist/cjs/components/ImageLibraryModal.js.map +2 -2
- package/dist/cjs/components/InsertFieldModal.js +5 -1
- package/dist/cjs/components/InsertFieldModal.js.map +2 -2
- package/dist/cjs/components/TippedButton.js +4 -0
- package/dist/cjs/components/TippedButton.js.map +1 -1
- package/dist/cjs/components/TippedSelect.js +4 -0
- package/dist/cjs/components/TippedSelect.js.map +1 -1
- package/dist/cjs/components/colors.js +4 -0
- package/dist/cjs/components/colors.js.map +1 -1
- package/dist/cjs/components/customFields.js +5 -0
- package/dist/cjs/components/customFields.js.map +1 -1
- package/dist/cjs/constants.js +6 -1
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/index.js +8 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +4 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +1 -1
- package/dist/cjs/quillOverrides/Image.js +6 -2
- package/dist/cjs/quillOverrides/Image.js.map +2 -2
- package/dist/cjs/quillOverrides/IndentStyle.js +4 -0
- package/dist/cjs/quillOverrides/IndentStyle.js.map +2 -2
- package/dist/cjs/quillOverrides/LinkFormat.js +4 -0
- package/dist/cjs/quillOverrides/LinkFormat.js.map +1 -1
- package/dist/cjs/quillOverrides/PlainClipboard.js +4 -0
- package/dist/cjs/quillOverrides/PlainClipboard.js.map +1 -1
- package/dist/cjs/utils.js +4 -0
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/DSWYSIWYGEditor.js +1 -1
- package/dist/esm/DSWYSIWYGEditor.js.map +2 -2
- package/dist/esm/components/CustomImageUploader.js +1 -1
- package/dist/esm/components/CustomImageUploader.js.map +2 -2
- package/dist/esm/components/CustomToolbar.js +3 -3
- package/dist/esm/components/CustomToolbar.js.map +1 -1
- package/dist/esm/components/DSWYSIWYGEditorImpl.js +41 -14
- package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +2 -2
- package/dist/esm/components/ImageLibraryModal.js +1 -8
- package/dist/esm/components/ImageLibraryModal.js.map +2 -2
- package/dist/esm/components/InsertFieldModal.js +1 -1
- package/dist/esm/components/InsertFieldModal.js.map +2 -2
- package/dist/esm/components/TippedButton.js.map +1 -1
- package/dist/esm/components/TippedSelect.js.map +1 -1
- package/dist/esm/components/customFields.js +1 -0
- package/dist/esm/components/customFields.js.map +1 -1
- package/dist/esm/constants.js +2 -1
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/quillOverrides/Image.js +2 -2
- package/dist/esm/quillOverrides/Image.js.map +2 -2
- package/dist/esm/quillOverrides/IndentStyle.js.map +2 -2
- package/dist/types/DSWYSIWYGEditor.d.ts +13 -12
- package/dist/types/components/CustomImageUploader.d.ts +1 -0
- package/dist/types/components/CustomToolbar.d.ts +1 -0
- package/dist/types/components/InsertFieldModal.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/package.json +12 -12
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,7 +37,7 @@ var React = __toESM(require("react"));
|
|
|
33
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
38
|
var import_react = require("react");
|
|
35
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
-
var import_DSWYSIWYGEditorImpl = __toESM(require("./components/DSWYSIWYGEditorImpl"));
|
|
40
|
+
var import_DSWYSIWYGEditorImpl = __toESM(require("./components/DSWYSIWYGEditorImpl.js"));
|
|
37
41
|
const DSWYSIWYGEditor = ({
|
|
38
42
|
value = "",
|
|
39
43
|
onChange = () => null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSWYSIWYGEditor.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\nDSWYSIWYGEditor.displayName = 'DSWYSIWYGEditor';\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl.js';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\nDSWYSIWYGEditor.displayName = 'DSWYSIWYGEditor';\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsBnB;AAtBJ,mBAA2C;AAC3C,8BAAoC;AACpC,iCAAgC;AAEhC,MAAM,kBAAkB,CAAC;AAAA,EACvB,QAAQ;AAAA,EACR,WAAW,MAAM;AAAA,EACjB,cAAc,MAAM;AAAA,EACpB,eAAe,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAc,MAAM;AAAA,EAAC;AAC3B,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,WAAW;AAEpD,8BAAU,MAAM,YAAY,WAAW,GAAG,CAAC,WAAW,CAAC;AAEvD,SACE;AAAA,IAAC,2BAAAA;AAAA,IAAA;AAAA,MACC,eAAa;AAAA,MACb,wBAAwB;AAAA,MACxB,kBAAkB;AAAA,MAClB,gBAAgB,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb,YAAY,MAAM,YAAY,CAAC,QAAQ;AAAA,MACvC;AAAA,MACA;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,MAAM,qBAAqB;AAAA,EACzB,OAAO,kCAAU,OAAO,YAAY,eAAe,EAAE;AAAA,EACrD,UAAU,kCAAU,KAAK;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EAAE;AAAA,EACF,aAAa,kCAAU,KAAK,YAAY,8BAA8B;AAAA,EACtE,cAAc,kCAAU,OAAO,YAAY,kCAAkC;AAAA,EAC7E,eAAe,kCAAU,QAAQ,YAAY,gBAAgB;AAAA,EAC7D,iBAAiB,kCAAU,OAAO,YAAY,8BAA8B;AAAA,EAC5E,aAAa,kCAAU,KAAK,YAAY,qCAAqC,EAAE,aAAa,KAAK;AAAA,EACjG,QAAQ,kCAAU,OAAO,YAAY,iCAAiC;AAAA,EACtE,UAAU,kCAAU,OAAO;AAAA,IACzB;AAAA,EACF;AAAA,EACA,WAAW,kCAAU,OAAO,YAAY,mDAAmD,EAAE,aAAa,CAAC,CAAC;AAAA,EAC5G,QAAQ,kCAAU,OAAO;AAAA,IACvB;AAAA,EACF;AACF;AAEA,gBAAgB,YAAY;AAC5B,gBAAgB,cAAc;AAC9B,MAAM,uBAAmB,kCAAS,eAAe;AACjD,iBAAiB,YAAY;AAG7B,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["DSWYSIWYGEditorImpl"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,7 +37,7 @@ var import_react = require("react");
|
|
|
33
37
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
34
38
|
var import_ds_uploader = __toESM(require("@elliemae/ds-uploader"));
|
|
35
39
|
var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
|
|
36
|
-
var import_TippedButton = require("./TippedButton");
|
|
40
|
+
var import_TippedButton = require("./TippedButton.js");
|
|
37
41
|
const ALLOWED_TYPES_TEXT = "JPG, JPEG, PNG, GIF, BMP, TIFF";
|
|
38
42
|
const ALLOWED_TYPES = /image\/(jpeg|jpg|png|gif|bmp|tiff)/;
|
|
39
43
|
const DEFAULT_MAX_SIZE = 1024 * 1024;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/CustomImageUploader.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\nimport { Image } from '@elliemae/ds-icons';\nimport DSUploader from '@elliemae/ds-uploader';\nimport DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';\nimport { TippedButton } from './TippedButton';\n\nconst ALLOWED_TYPES_TEXT = 'JPG, JPEG, PNG, GIF, BMP, TIFF';\nconst ALLOWED_TYPES = /image\\/(jpeg|jpg|png|gif|bmp|tiff)/;\nconst DEFAULT_MAX_SIZE = 1024 * 1024; // 1 MB\n\nexport const CustomImageUploader = ({\n quillRef,\n editorFieldName,\n allowedImageTypes = ALLOWED_TYPES_TEXT,\n uploadAsset = () => null,\n zIndex = 1,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [error, setError] = useState(null);\n const [inProgress, setInProgress] = useState(false);\n const [lastSelection, setLastSelection] = useState({ index: 0, length: 0 });\n\n const elementId = `uploadImage${editorFieldName}`;\n\n // eslint-disable-next-line consistent-return\n const handleFileChange = async (files) => {\n if (!inProgress) {\n setError(null);\n const selectedFile = files[0];\n if (!selectedFile) {\n setError('Please select a file.');\n return false;\n }\n if (!selectedFile.type.match(ALLOWED_TYPES)) {\n setError('File must be an image.');\n } else if (selectedFile.size > DEFAULT_MAX_SIZE) {\n setError('File is too large.');\n } else {\n const fr = new FileReader();\n fr.onload = async () => {\n setInProgress(true);\n try {\n const url = await uploadAsset({\n name: selectedFile.name,\n type: selectedFile.type,\n description: selectedFile.name,\n isSystemAsset: false,\n file: fr.result,\n });\n setIsOpen(false);\n quillRef?.getEditor().insertEmbed(lastSelection?.index || 0, 'image', url);\n } catch (e) {\n setError('An error has occurred, try again');\n }\n setInProgress(false);\n };\n fr.readAsArrayBuffer(selectedFile);\n }\n }\n };\n return (\n <>\n <TippedButton\n zIndex={zIndex}\n tip=\"Insert Image\"\n onClick={() => {\n setLastSelection(quillRef?.getEditor().getSelection());\n setIsOpen(true);\n }}\n >\n <Image color={['neutral', 500]} size=\"s\" />\n </TippedButton>\n <DSModal\n isOpen={isOpen}\n title=\"\"\n onConfirm={() => {\n setIsOpen(false);\n }}\n onClose={() => {\n setIsOpen(false);\n }}\n showClose\n version={2}\n size=\"xsmall\"\n modalType={MODAL_TYPE_V2.DECISION}\n confirmLabel=\"Cancel\"\n message=\"\"\n >\n {!inProgress && (\n <DSUploader\n containerProps={{ id: elementId }}\n showAltAction={false}\n acceptedTypesText={allowedImageTypes}\n onDrop={handleFileChange}\n />\n )}\n {inProgress && 'Upload in progress...'}\n {error && <div style={{ color: 'red', marginTop: '10px' }}>{error}</div>}\n </DSModal>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\nimport { Image } from '@elliemae/ds-icons';\nimport DSUploader from '@elliemae/ds-uploader';\nimport DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';\nimport { TippedButton } from './TippedButton.js';\n\nconst ALLOWED_TYPES_TEXT = 'JPG, JPEG, PNG, GIF, BMP, TIFF';\nconst ALLOWED_TYPES = /image\\/(jpeg|jpg|png|gif|bmp|tiff)/;\nconst DEFAULT_MAX_SIZE = 1024 * 1024; // 1 MB\n\nexport const CustomImageUploader = ({\n quillRef,\n editorFieldName,\n allowedImageTypes = ALLOWED_TYPES_TEXT,\n uploadAsset = () => null,\n zIndex = 1,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [error, setError] = useState(null);\n const [inProgress, setInProgress] = useState(false);\n const [lastSelection, setLastSelection] = useState({ index: 0, length: 0 });\n\n const elementId = `uploadImage${editorFieldName}`;\n\n // eslint-disable-next-line consistent-return\n const handleFileChange = async (files) => {\n if (!inProgress) {\n setError(null);\n const selectedFile = files[0];\n if (!selectedFile) {\n setError('Please select a file.');\n return false;\n }\n if (!selectedFile.type.match(ALLOWED_TYPES)) {\n setError('File must be an image.');\n } else if (selectedFile.size > DEFAULT_MAX_SIZE) {\n setError('File is too large.');\n } else {\n const fr = new FileReader();\n fr.onload = async () => {\n setInProgress(true);\n try {\n const url = await uploadAsset({\n name: selectedFile.name,\n type: selectedFile.type,\n description: selectedFile.name,\n isSystemAsset: false,\n file: fr.result,\n });\n setIsOpen(false);\n quillRef?.getEditor().insertEmbed(lastSelection?.index || 0, 'image', url);\n } catch (e) {\n setError('An error has occurred, try again');\n }\n setInProgress(false);\n };\n fr.readAsArrayBuffer(selectedFile);\n }\n }\n };\n return (\n <>\n <TippedButton\n zIndex={zIndex}\n tip=\"Insert Image\"\n onClick={() => {\n setLastSelection(quillRef?.getEditor().getSelection());\n setIsOpen(true);\n }}\n >\n <Image color={['neutral', 500]} size=\"s\" />\n </TippedButton>\n <DSModal\n isOpen={isOpen}\n title=\"\"\n onConfirm={() => {\n setIsOpen(false);\n }}\n onClose={() => {\n setIsOpen(false);\n }}\n showClose\n version={2}\n size=\"xsmall\"\n modalType={MODAL_TYPE_V2.DECISION}\n confirmLabel=\"Cancel\"\n message=\"\"\n >\n {!inProgress && (\n <DSUploader\n containerProps={{ id: elementId }}\n showAltAction={false}\n acceptedTypesText={allowedImageTypes}\n onDrop={handleFileChange}\n />\n )}\n {inProgress && 'Upload in progress...'}\n {error && <div style={{ color: 'red', marginTop: '10px' }}>{error}</div>}\n </DSModal>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiEnB;AA7DJ,mBAAgC;AAChC,sBAAsB;AACtB,yBAAuB;AACvB,sBAAuC;AACvC,0BAA6B;AAE7B,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,mBAAmB,OAAO;AAEzB,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,cAAc,MAAM;AAAA,EACpB,SAAS;AACX,MAAM;AACJ,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,IAAI;AACvC,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,EAAE,OAAO,GAAG,QAAQ,EAAE,CAAC;AAE1E,QAAM,YAAY,cAAc;AAGhC,QAAM,mBAAmB,OAAO,UAAU;AACxC,QAAI,CAAC,YAAY;AACf,eAAS,IAAI;AACb,YAAM,eAAe,MAAM,CAAC;AAC5B,UAAI,CAAC,cAAc;AACjB,iBAAS,uBAAuB;AAChC,eAAO;AAAA,MACT;AACA,UAAI,CAAC,aAAa,KAAK,MAAM,aAAa,GAAG;AAC3C,iBAAS,wBAAwB;AAAA,MACnC,WAAW,aAAa,OAAO,kBAAkB;AAC/C,iBAAS,oBAAoB;AAAA,MAC/B,OAAO;AACL,cAAM,KAAK,IAAI,WAAW;AAC1B,WAAG,SAAS,YAA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AAAA;AAAA;AAAA,IACpE;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": ["DSModal", "DSUploader"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -34,9 +38,9 @@ var import_react = require("react");
|
|
|
34
38
|
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
35
39
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
36
40
|
var import_ds_dropdownmenu = __toESM(require("@elliemae/ds-dropdownmenu"));
|
|
37
|
-
var import_constants = require("../constants");
|
|
38
|
-
var import_TippedButton = require("./TippedButton");
|
|
39
|
-
var import_TippedSelect = require("./TippedSelect");
|
|
41
|
+
var import_constants = require("../constants.js");
|
|
42
|
+
var import_TippedButton = require("./TippedButton.js");
|
|
43
|
+
var import_TippedSelect = require("./TippedSelect.js");
|
|
40
44
|
const optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(" ", "-"));
|
|
41
45
|
const CustomFields = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "\u1438\u1433" });
|
|
42
46
|
const Color = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: color });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/CustomToolbar.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/control-has-associated-label */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable react/button-has-type */\nimport React, { useState } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { ArrowheadDown } from '@elliemae/ds-icons';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { colors, fonts, sizes, sizesReal } from '../constants';\nimport { TippedButton } from './TippedButton';\nimport { TippedSelect } from './TippedSelect';\n\n// Functions -----------------------------------------\nconst optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(' ', '-'));\n\n// Stateless Components -----------------------------------------\n\nconst CustomFields = () => <span>\u1438\u1433</span>; // eslint-disable-line react/jsx-one-expression-per-line\nconst Color = ({ color }) => <option value={color} />;\nconst Colors = ({ className, tip, zIndex }) => (\n <TippedSelect className={className} tip={tip} zIndex={zIndex}>\n {colors.map((color) => (\n <Color key={color} color={color} />\n ))}\n </TippedSelect>\n);\n\nexport const CustomDropdown = ({\n options,\n label,\n onSelectMenuItem = () => null,\n onClickOutsideMenu = () => null,\n onClose = () => null,\n closeMenuOnItemSelection,\n isOpen,\n minWidth,\n maxWidth,\n zIndex = 10,\n}) => (\n <DSDropdownMenu\n onClickOutsideMenu={onClickOutsideMenu}\n options={options}\n onSelectMenuItem={onSelectMenuItem}\n onClose={onClose}\n closeMenuOnItemSelection={closeMenuOnItemSelection}\n isOpen={isOpen}\n minWidth={minWidth}\n maxWidth={maxWidth}\n zIndex={zIndex}\n preventOverflow=\"scrollParent\"\n triggerComponent={<DSButton labelText={label} buttonType=\"text\" icon={<ArrowheadDown />} />}\n />\n);\n\nconst Divider = () => (\n <div\n style={{\n height: '21px',\n width: '1px',\n margin: '0 10px',\n padding: '0',\n borderLeft: '1px solid #bbb',\n display: 'inline-block',\n }}\n ></div>\n);\n\nexport const CustomToolbar = ({\n customFields,\n customItems = [],\n hideItems = {},\n onShowHTML = () => {},\n id = 'toolbar',\n userProps,\n}) => {\n const {\n HEADER,\n FONT,\n FONT_SIZE,\n BOLD,\n ITALIC,\n UNDERLINE,\n STRIKE,\n SUB,\n SUPER,\n ORDERED_LIST,\n BULLET_LIST,\n INDENT_MINUS_ONE,\n INDENT_PLUS_ONE,\n ALIGN,\n FONT_COLOR,\n FONT_BACKGROUND_COLOR,\n HYPERLINK,\n IMAGE,\n CLEAR_FORMAT,\n SHOW_HTML,\n } = hideItems;\n const [showHTML, setShowHTML] = useState(false);\n\n const handleShowHTML = (e) => {\n e.preventDefault();\n setShowHTML(!showHTML);\n onShowHTML();\n };\n\n return (\n <div id={id} className=\"ds-ql-custom-toolbar\">\n {(!HEADER || !FONT || !FONT_SIZE) && (\n <span className=\"ql-formats\">\n {!HEADER && (\n <>\n <TippedSelect\n className=\"ql-header\"\n tip=\"Header\"\n values={['', '1', '2', '3', '4', '5', '6']}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT && (\n <>\n <TippedSelect\n className=\"ql-font\"\n defaultValue=\"sans-serif\"\n options={fonts}\n tip=\"Font\"\n values={optionsToValues(fonts)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT_SIZE && (\n <>\n <TippedSelect\n className=\"ql-size\"\n options={sizes}\n tip=\"Font Size\"\n values={optionsToValues(sizesReal)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n </span>\n )}\n {(!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && (\n <span className=\"ql-formats\">\n {!BOLD && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-bold\" tip=\"Bold\" />}\n {!ITALIC && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-italic\" tip=\"Italic\" />}\n {!UNDERLINE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-underline\" tip=\"Underline\" />}\n {!STRIKE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-strike\" tip=\"Strike\" />}\n </span>\n )}\n {(!SUB || !SUPER) && (\n <span className=\"ql-formats\">\n {!SUB && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Sub\" value=\"sub\" />}\n {!SUPER && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Super\" value=\"super\" />}\n <Divider />\n </span>\n )}\n {(!ORDERED_LIST || !BULLET_LIST) && (\n <span className=\"ql-formats\">\n {!ORDERED_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Ordered List\" value=\"ordered\" />\n )}\n {!BULLET_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Bullet List\" value=\"bullet\" />\n )}\n </span>\n )}\n {(!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && (\n <span className=\"ql-formats\">\n {!INDENT_MINUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent -1\" value=\"-1\" />\n )}\n {!INDENT_PLUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent +1\" value=\"+1\" />\n )}\n </span>\n )}\n {!ALIGN && (\n <span className=\"ql-formats\">\n <TippedSelect zIndex={userProps?.zIndex || 1} className=\"ql-align\" tip=\"Align\" />\n <Divider />\n </span>\n )}\n {(!FONT_COLOR || !FONT_BACKGROUND_COLOR) && (\n <span className=\"ql-formats\">\n {!FONT_COLOR && <Colors zIndex={userProps?.zIndex || 1} className=\"ql-color\" tip=\"Font Color\" />}\n {!FONT_BACKGROUND_COLOR && (\n <Colors zIndex={userProps?.zIndex || 1} className=\"ql-background\" tip=\"Font Background Color\" />\n )}\n <Divider />\n </span>\n )}\n {(!HYPERLINK || !IMAGE) && (\n <span className=\"ql-formats\">\n {!HYPERLINK && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-link\" tip=\"Hyperlink: Select Text First\" />\n )}\n {!IMAGE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-image\" tip=\"Insert Image\" />}\n <Divider />\n </span>\n )}\n {!CLEAR_FORMAT && (\n <span className=\"ql-formats\">\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-clean\" tip=\"Clear Format (Select Text)\" />\n </span>\n )}\n {!SHOW_HTML && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton\n zIndex={userProps?.zIndex || 1}\n style={{\n width: 'fit-content',\n color: '#1e79c2',\n fontWeight: '500',\n }}\n onClick={handleShowHTML}\n tip={showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n className=\"ql-customFields-html\"\n >\n {showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n </TippedButton>\n </span>\n )}\n {customFields && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-customFields\" tip=\"Insert Custom Field\">\n <CustomFields />\n </TippedButton>\n </span>\n )}\n {customItems && (\n <span style={{ display: 'inline-flex' }}>\n {customItems.map((Item) => (\n <>\n <Divider />\n <Item />\n </>\n ))}\n </span>\n )}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable complexity */\n/* eslint-disable jsx-a11y/control-has-associated-label */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\n/* eslint-disable react/button-has-type */\nimport React, { useState } from 'react';\nimport DSButton from '@elliemae/ds-button';\nimport { ArrowheadDown } from '@elliemae/ds-icons';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { colors, fonts, sizes, sizesReal } from '../constants.js';\nimport { TippedButton } from './TippedButton.js';\nimport { TippedSelect } from './TippedSelect.js';\n\n// Functions -----------------------------------------\nconst optionsToValues = (options) => options.map((opt) => opt.toLowerCase().replace(' ', '-'));\n\n// Stateless Components -----------------------------------------\n\nconst CustomFields = () => <span>\u1438\u1433</span>; // eslint-disable-line react/jsx-one-expression-per-line\nconst Color = ({ color }) => <option value={color} />;\nconst Colors = ({ className, tip, zIndex }) => (\n <TippedSelect className={className} tip={tip} zIndex={zIndex}>\n {colors.map((color) => (\n <Color key={color} color={color} />\n ))}\n </TippedSelect>\n);\n\nexport const CustomDropdown = ({\n options,\n label,\n onSelectMenuItem = () => null,\n onClickOutsideMenu = () => null,\n onClose = () => null,\n closeMenuOnItemSelection,\n isOpen,\n minWidth,\n maxWidth,\n zIndex = 10,\n}) => (\n <DSDropdownMenu\n onClickOutsideMenu={onClickOutsideMenu}\n options={options}\n onSelectMenuItem={onSelectMenuItem}\n onClose={onClose}\n closeMenuOnItemSelection={closeMenuOnItemSelection}\n isOpen={isOpen}\n minWidth={minWidth}\n maxWidth={maxWidth}\n zIndex={zIndex}\n preventOverflow=\"scrollParent\"\n triggerComponent={<DSButton labelText={label} buttonType=\"text\" icon={<ArrowheadDown />} />}\n />\n);\n\nconst Divider = () => (\n <div\n style={{\n height: '21px',\n width: '1px',\n margin: '0 10px',\n padding: '0',\n borderLeft: '1px solid #bbb',\n display: 'inline-block',\n }}\n ></div>\n);\n\nexport const CustomToolbar = ({\n customFields,\n customItems = [],\n hideItems = {},\n onShowHTML = () => {},\n id = 'toolbar',\n userProps,\n}) => {\n const {\n HEADER,\n FONT,\n FONT_SIZE,\n BOLD,\n ITALIC,\n UNDERLINE,\n STRIKE,\n SUB,\n SUPER,\n ORDERED_LIST,\n BULLET_LIST,\n INDENT_MINUS_ONE,\n INDENT_PLUS_ONE,\n ALIGN,\n FONT_COLOR,\n FONT_BACKGROUND_COLOR,\n HYPERLINK,\n IMAGE,\n CLEAR_FORMAT,\n SHOW_HTML,\n } = hideItems;\n const [showHTML, setShowHTML] = useState(false);\n\n const handleShowHTML = (e) => {\n e.preventDefault();\n setShowHTML(!showHTML);\n onShowHTML();\n };\n\n return (\n <div id={id} className=\"ds-ql-custom-toolbar\">\n {(!HEADER || !FONT || !FONT_SIZE) && (\n <span className=\"ql-formats\">\n {!HEADER && (\n <>\n <TippedSelect\n className=\"ql-header\"\n tip=\"Header\"\n values={['', '1', '2', '3', '4', '5', '6']}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT && (\n <>\n <TippedSelect\n className=\"ql-font\"\n defaultValue=\"sans-serif\"\n options={fonts}\n tip=\"Font\"\n values={optionsToValues(fonts)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n {!FONT_SIZE && (\n <>\n <TippedSelect\n className=\"ql-size\"\n options={sizes}\n tip=\"Font Size\"\n values={optionsToValues(sizesReal)}\n zIndex={userProps?.zIndex || 1}\n />\n <Divider />\n </>\n )}\n </span>\n )}\n {(!BOLD || !ITALIC || !UNDERLINE || !STRIKE) && (\n <span className=\"ql-formats\">\n {!BOLD && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-bold\" tip=\"Bold\" />}\n {!ITALIC && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-italic\" tip=\"Italic\" />}\n {!UNDERLINE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-underline\" tip=\"Underline\" />}\n {!STRIKE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-strike\" tip=\"Strike\" />}\n </span>\n )}\n {(!SUB || !SUPER) && (\n <span className=\"ql-formats\">\n {!SUB && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Sub\" value=\"sub\" />}\n {!SUPER && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-script\" tip=\"Super\" value=\"super\" />}\n <Divider />\n </span>\n )}\n {(!ORDERED_LIST || !BULLET_LIST) && (\n <span className=\"ql-formats\">\n {!ORDERED_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Ordered List\" value=\"ordered\" />\n )}\n {!BULLET_LIST && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-list\" tip=\"Bullet List\" value=\"bullet\" />\n )}\n </span>\n )}\n {(!INDENT_MINUS_ONE || !INDENT_PLUS_ONE) && (\n <span className=\"ql-formats\">\n {!INDENT_MINUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent -1\" value=\"-1\" />\n )}\n {!INDENT_PLUS_ONE && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-indent\" tip=\"Indent +1\" value=\"+1\" />\n )}\n </span>\n )}\n {!ALIGN && (\n <span className=\"ql-formats\">\n <TippedSelect zIndex={userProps?.zIndex || 1} className=\"ql-align\" tip=\"Align\" />\n <Divider />\n </span>\n )}\n {(!FONT_COLOR || !FONT_BACKGROUND_COLOR) && (\n <span className=\"ql-formats\">\n {!FONT_COLOR && <Colors zIndex={userProps?.zIndex || 1} className=\"ql-color\" tip=\"Font Color\" />}\n {!FONT_BACKGROUND_COLOR && (\n <Colors zIndex={userProps?.zIndex || 1} className=\"ql-background\" tip=\"Font Background Color\" />\n )}\n <Divider />\n </span>\n )}\n {(!HYPERLINK || !IMAGE) && (\n <span className=\"ql-formats\">\n {!HYPERLINK && (\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-link\" tip=\"Hyperlink: Select Text First\" />\n )}\n {!IMAGE && <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-image\" tip=\"Insert Image\" />}\n <Divider />\n </span>\n )}\n {!CLEAR_FORMAT && (\n <span className=\"ql-formats\">\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-clean\" tip=\"Clear Format (Select Text)\" />\n </span>\n )}\n {!SHOW_HTML && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton\n zIndex={userProps?.zIndex || 1}\n style={{\n width: 'fit-content',\n color: '#1e79c2',\n fontWeight: '500',\n }}\n onClick={handleShowHTML}\n tip={showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n className=\"ql-customFields-html\"\n >\n {showHTML ? 'SHOW TEXT' : 'SHOW HTML'}\n </TippedButton>\n </span>\n )}\n {customFields && (\n <span className=\"ql-formats\">\n <Divider />\n <TippedButton zIndex={userProps?.zIndex || 1} className=\"ql-customFields\" tip=\"Insert Custom Field\">\n <CustomFields />\n </TippedButton>\n </span>\n )}\n {customItems && (\n <span style={{ display: 'inline-flex' }}>\n {customItems.map((Item) => (\n <>\n <Divider />\n <Item />\n </>\n ))}\n </span>\n )}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBI;AAb3B,mBAAgC;AAChC,uBAAqB;AACrB,sBAA8B;AAC9B,6BAA2B;AAC3B,uBAAgD;AAChD,0BAA6B;AAC7B,0BAA6B;AAG7B,MAAM,kBAAkB,CAAC,YAAY,QAAQ,IAAI,CAAC,QAAQ,IAAI,YAAY,EAAE,QAAQ,KAAK,GAAG,CAAC;AAI7F,MAAM,eAAe,MAAM,4CAAC,UAAK,0BAAE;AACnC,MAAM,QAAQ,CAAC,EAAE,MAAM,MAAM,4CAAC,YAAO,OAAO,OAAO;AACnD,MAAM,SAAS,CAAC,EAAE,WAAW,KAAK,OAAO,MACvC,4CAAC,oCAAa,WAAsB,KAAU,QAC3C,kCAAO,IAAI,CAAC,UACX,4CAAC,SAAkB,SAAP,KAAqB,CAClC,GACH;AAGK,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,mBAAmB,MAAM;AAAA,EACzB,qBAAqB,MAAM;AAAA,EAC3B,UAAU,MAAM;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX,MACE;AAAA,EAAC,uBAAAA;AAAA,EAAA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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,IAED,CAAC,gBACA,4CAAC,UAAK,WAAU,cACd,sDAAC,oCAAa,QAAQ,WAAW,UAAU,GAAG,WAAU,YAAW,KAAI,8BAA6B,GACtG;AAAA,IAED,CAAC,aACA,6CAAC,UAAK,WAAU,cACd;AAAA,kDAAC,WAAQ;AAAA,MACT;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ,WAAW,UAAU;AAAA,UAC7B,OAAO;AAAA,YACL,OAAO;AAAA,YACP,OAAO;AAAA,YACP,YAAY;AAAA,UACd;AAAA,UACA,SAAS;AAAA,UACT,KAAK,WAAW,cAAc;AAAA,UAC9B,WAAU;AAAA,UAET,qBAAW,cAAc;AAAA;AAAA,MAC5B;AAAA,OACF;AAAA,IAED,gBACC,6CAAC,UAAK,WAAU,cACd;AAAA,kDAAC,WAAQ;AAAA,MACT,4CAAC,oCAAa,QAAQ,WAAW,UAAU,GAAG,WAAU,mBAAkB,KAAI,uBAC5E,sDAAC,gBAAa,GAChB;AAAA,OACF;AAAA,IAED,eACC,4CAAC,UAAK,OAAO,EAAE,SAAS,cAAc,GACnC,sBAAY,IAAI,CAAC,SAChB,4EACE;AAAA,kDAAC,WAAQ;AAAA,MACT,4CAAC,QAAK;AAAA,OACR,CACD,GACH;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": ["DSDropdownMenu", "DSButton"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -32,18 +36,20 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
32
36
|
var import_react = __toESM(require("react"));
|
|
33
37
|
var import_react_quill = __toESM(require("react-quill"));
|
|
34
38
|
var import_quill_blot_formatter = __toESM(require("quill-blot-formatter"));
|
|
35
|
-
var import_ImageLibraryModal = __toESM(require("./ImageLibraryModal"));
|
|
36
|
-
var import_InsertFieldModal = __toESM(require("./InsertFieldModal"));
|
|
37
|
-
var import_CustomToolbar = require("./CustomToolbar");
|
|
38
|
-
var import_IndentStyle = __toESM(require("../quillOverrides/IndentStyle"));
|
|
39
|
-
var import_LinkFormat = __toESM(require("../quillOverrides/LinkFormat"));
|
|
40
|
-
var import_Image = __toESM(require("../quillOverrides/Image"));
|
|
41
|
-
var import_utils = require("../utils");
|
|
42
|
-
var import_clipboardLinkWithTagMatcher = require("../quillMatchers/clipboardLinkWithTagMatcher");
|
|
39
|
+
var import_ImageLibraryModal = __toESM(require("./ImageLibraryModal.js"));
|
|
40
|
+
var import_InsertFieldModal = __toESM(require("./InsertFieldModal.js"));
|
|
41
|
+
var import_CustomToolbar = require("./CustomToolbar.js");
|
|
42
|
+
var import_IndentStyle = __toESM(require("../quillOverrides/IndentStyle.js"));
|
|
43
|
+
var import_LinkFormat = __toESM(require("../quillOverrides/LinkFormat.js"));
|
|
44
|
+
var import_Image = __toESM(require("../quillOverrides/Image.js"));
|
|
45
|
+
var import_utils = require("../utils.js");
|
|
46
|
+
var import_clipboardLinkWithTagMatcher = require("../quillMatchers/clipboardLinkWithTagMatcher.js");
|
|
47
|
+
var import_uid = require("uid");
|
|
43
48
|
import_react_quill.Quill.register("modules/blotFormatter", import_quill_blot_formatter.default);
|
|
44
49
|
const AlignStyle = import_react_quill.Quill.import("attributors/style/align");
|
|
45
50
|
const FontStyle = import_react_quill.Quill.import("attributors/style/font");
|
|
46
51
|
FontStyle.whitelist = [
|
|
52
|
+
// allow ONLY these fonts and the default
|
|
47
53
|
"serif",
|
|
48
54
|
"monospace",
|
|
49
55
|
"arial",
|
|
@@ -55,6 +61,7 @@ FontStyle.whitelist = [
|
|
|
55
61
|
];
|
|
56
62
|
const SizeStyle = import_react_quill.Quill.import("attributors/style/size");
|
|
57
63
|
SizeStyle.whitelist = [
|
|
64
|
+
// allow ONLY these sizes and the default
|
|
58
65
|
"x-small",
|
|
59
66
|
"large",
|
|
60
67
|
"x-large"
|
|
@@ -78,14 +85,18 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
78
85
|
}
|
|
79
86
|
},
|
|
80
87
|
clipboard: {
|
|
88
|
+
// toggle to add extra line breaks when pasting HTML:
|
|
81
89
|
matchVisual: false
|
|
82
90
|
},
|
|
83
|
-
|
|
91
|
+
// this next line breaks the component with the last version 2.0.0
|
|
92
|
+
// blotFormatter: {
|
|
93
|
+
// options... https://github.com/Fandom-OSS/quill-blot-formatter
|
|
94
|
+
// },
|
|
84
95
|
...this.props.quillModules
|
|
85
96
|
};
|
|
86
97
|
this.getEditor = () => this.quill?.getEditor();
|
|
98
|
+
// eslint-disable-next-line max-params
|
|
87
99
|
this.onChangeQuill = (html, delta, source, editor) => {
|
|
88
|
-
console.log("quill detected a change");
|
|
89
100
|
const { showRawHTML, onChange } = this.props;
|
|
90
101
|
if (!showRawHTML)
|
|
91
102
|
onChange(html, delta, source, editor);
|
|
@@ -121,9 +132,12 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
121
132
|
if (props.quillOverrides.length) {
|
|
122
133
|
props.quillOverrides.map((override) => import_react_quill.Quill.register(override, true));
|
|
123
134
|
}
|
|
135
|
+
const instanceUid = (0, import_uid.uid)(12);
|
|
124
136
|
this.state = {
|
|
125
137
|
isImageModalOpen: false,
|
|
126
|
-
isFieldModalOpen: false
|
|
138
|
+
isFieldModalOpen: false,
|
|
139
|
+
uid: instanceUid,
|
|
140
|
+
uniqueClassName: `ds-wysiwyg-editor-${instanceUid}`
|
|
127
141
|
};
|
|
128
142
|
const { toolbar } = this.quillModules;
|
|
129
143
|
if (props.imagesData) {
|
|
@@ -162,16 +176,32 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
162
176
|
customFields,
|
|
163
177
|
imagesData,
|
|
164
178
|
customToolbar,
|
|
165
|
-
handleImageClick,
|
|
166
|
-
handleCustomFieldClick,
|
|
167
179
|
height,
|
|
168
180
|
value,
|
|
169
181
|
showRawHTML,
|
|
170
182
|
onShowHTML,
|
|
171
|
-
onChange,
|
|
172
183
|
hideItems,
|
|
184
|
+
bounds,
|
|
185
|
+
// a bunch of props we don't want to pass to the editor
|
|
186
|
+
onChange,
|
|
187
|
+
handleImageClick,
|
|
188
|
+
handleCustomFieldClick,
|
|
173
189
|
...editorProps
|
|
174
190
|
} = this.props;
|
|
191
|
+
let finalBoundElement = document.body;
|
|
192
|
+
if (typeof bounds !== "undefined" && // there is no sure-fire way to check if something is a DOM element
|
|
193
|
+
// checking classList existance && that it's an instance of DOMTokenList is a close enough check for most cases
|
|
194
|
+
bounds?.classList && bounds?.classList instanceof DOMTokenList) {
|
|
195
|
+
finalBoundElement = bounds;
|
|
196
|
+
}
|
|
197
|
+
const elementsWithClass = document.querySelectorAll(`.${this.state.uniqueClassName}`);
|
|
198
|
+
elementsWithClass.forEach((element) => {
|
|
199
|
+
element.classList.remove(this.state.uniqueClassName);
|
|
200
|
+
});
|
|
201
|
+
if (!finalBoundElement.classList.contains(this.state.uniqueClassName)) {
|
|
202
|
+
finalBoundElement.classList.add(this.state.uniqueClassName);
|
|
203
|
+
}
|
|
204
|
+
const boundsWorkaround = `.${this.state.uniqueClassName}`;
|
|
175
205
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
176
206
|
"div",
|
|
177
207
|
{
|
|
@@ -198,6 +228,7 @@ class DSWYSIWYGEditorImpl extends import_react.default.PureComponent {
|
|
|
198
228
|
height,
|
|
199
229
|
borderBottom: "1px solid #ccc"
|
|
200
230
|
},
|
|
231
|
+
bounds: boundsWorkaround,
|
|
201
232
|
...editorProps,
|
|
202
233
|
id: "wysiwyg-text-container"
|
|
203
234
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DSWYSIWYGEditorImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport ReactQuill, { Quill } from 'react-quill';\nimport BlotFormatter from 'quill-blot-formatter';\nimport ImageLibraryModal from './ImageLibraryModal';\nimport InsertFieldModal from './InsertFieldModal';\nimport { CustomToolbar } from './CustomToolbar';\nimport IndentStyle from '../quillOverrides/IndentStyle';\nimport LinkFormat from '../quillOverrides/LinkFormat';\nimport Image from '../quillOverrides/Image';\nimport { formatHTML } from '../utils';\nimport { clipboardLinkWithTagMatcher } from '../quillMatchers/clipboardLinkWithTagMatcher';\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\n// Fix block styled formats ----------------\nconst AlignStyle = Quill.import('attributors/style/align');\nconst FontStyle = Quill.import('attributors/style/font');\nFontStyle.whitelist = [\n // allow ONLY these fonts and the default\n 'serif',\n 'monospace',\n 'arial',\n 'comic-sans',\n 'courier-new',\n 'georgia',\n 'helvetica',\n 'lucida',\n];\nconst SizeStyle = Quill.import('attributors/style/size');\nSizeStyle.whitelist = [\n // allow ONLY these sizes and the default\n 'x-small',\n 'large',\n 'x-large',\n];\n\n// Fix Doc Viewer p tags extra margin issue ---------\nconst Block = Quill.import('blots/block');\nBlock.tagName = 'p';\nQuill.register(Block);\n\nQuill.register(AlignStyle, true);\nQuill.register(IndentStyle, true);\nQuill.register(FontStyle, true);\nQuill.register(SizeStyle, true);\n// -----------------------------------------\nQuill.register(Image, true);\n\nexport default class DSWYSIWYGEditorImpl extends React.PureComponent {\n quillModules = {\n toolbar: {\n container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',\n handlers: {\n ...this.props.toolbarHandlers,\n },\n },\n clipboard: {\n // toggle to add extra line breaks when pasting HTML:\n matchVisual: false,\n },\n blotFormatter: {\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React from 'react';\nimport ReactQuill, { Quill } from 'react-quill';\nimport BlotFormatter from 'quill-blot-formatter';\nimport ImageLibraryModal from './ImageLibraryModal.js';\nimport InsertFieldModal from './InsertFieldModal.js';\nimport { CustomToolbar } from './CustomToolbar.js';\nimport IndentStyle from '../quillOverrides/IndentStyle.js';\nimport LinkFormat from '../quillOverrides/LinkFormat.js';\nimport Image from '../quillOverrides/Image.js';\nimport { formatHTML } from '../utils.js';\nimport { clipboardLinkWithTagMatcher } from '../quillMatchers/clipboardLinkWithTagMatcher.js';\nimport { uid } from 'uid';\n\n\nQuill.register('modules/blotFormatter', BlotFormatter);\n\n// Fix block styled formats ----------------\nconst AlignStyle = Quill.import('attributors/style/align');\nconst FontStyle = Quill.import('attributors/style/font');\nFontStyle.whitelist = [\n // allow ONLY these fonts and the default\n 'serif',\n 'monospace',\n 'arial',\n 'comic-sans',\n 'courier-new',\n 'georgia',\n 'helvetica',\n 'lucida',\n];\nconst SizeStyle = Quill.import('attributors/style/size');\nSizeStyle.whitelist = [\n // allow ONLY these sizes and the default\n 'x-small',\n 'large',\n 'x-large',\n];\n\n// Fix Doc Viewer p tags extra margin issue ---------\nconst Block = Quill.import('blots/block');\nBlock.tagName = 'p';\nQuill.register(Block);\n\nQuill.register(AlignStyle, true);\nQuill.register(IndentStyle, true);\nQuill.register(FontStyle, true);\nQuill.register(SizeStyle, true);\n// -----------------------------------------\nQuill.register(Image, true);\n\nexport default class DSWYSIWYGEditorImpl extends React.PureComponent {\n quillModules = {\n toolbar: {\n container: this.props.toolbarContainer ? `#${this.props.toolbarContainer}` : '#toolbar',\n handlers: {\n ...this.props.toolbarHandlers,\n },\n },\n clipboard: {\n // toggle to add extra line breaks when pasting HTML:\n matchVisual: false,\n },\n // this next line breaks the component with the last version 2.0.0\n // blotFormatter: {\n // options... https://github.com/Fandom-OSS/quill-blot-formatter\n // },\n ...this.props.quillModules,\n };\n\n constructor(props) {\n super(props);\n Quill.register(LinkFormat, true);\n if (props.quillOverrides.length) {\n props.quillOverrides.map((override) => Quill.register(override, true));\n }\n const instanceUid = uid(12);\n this.state = {\n isImageModalOpen: false,\n isFieldModalOpen: false,\n uid: instanceUid,\n uniqueClassName: `ds-wysiwyg-editor-${instanceUid}`,\n };\n const { toolbar } = this.quillModules;\n if (props.imagesData) {\n toolbar.handlers.image = (value) => {\n const { imagesData, handleImageClick } = this.props;\n if (!imagesData.length) {\n return;\n }\n this.setState({ isImageModalOpen: !!value });\n handleImageClick(value);\n };\n }\n if (props.customFields) {\n toolbar.handlers.customFields = (value) => {\n const { customFields, handleCustomFieldClick } = this.props;\n if (!customFields.length) {\n return;\n }\n this.setState({ isFieldModalOpen: !!value });\n handleCustomFieldClick(value);\n };\n }\n }\n\n componentDidMount() {\n // this.quill doesn't exist untill the full call-stack execute\n // we need to \"setTimeout\" so this componentDidMount work as expected\n setTimeout(() => {\n const quillDomRef = this.quill;\n this.props.getQuillRef(quillDomRef);\n\n const editor = quillDomRef?.getEditor();\n // https://github.com/quilljs/quill/issues/2677\n editor?.clipboard.addMatcher('a', clipboardLinkWithTagMatcher);\n });\n }\n\n getEditor = () => this.quill?.getEditor();\n\n // eslint-disable-next-line max-params\n onChangeQuill = (html, delta, source, editor) => {\n // console.log('quill detected a change');\n const { showRawHTML, onChange } = this.props;\n if (!showRawHTML) onChange(html, delta, source, editor);\n };\n\n onChangeTextArea = (e) => {\n const { showRawHTML, onChange } = this.props;\n if (showRawHTML) onChange(e.target.value);\n };\n\n onInserFieldConfirm = (fieldCode) => {\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertText(range.index, fieldCode);\n };\n\n onImageConfirm = (image) => {\n if (!image) {\n return;\n }\n const editor = this.getEditor();\n const range = editor.getSelection(true);\n editor.insertEmbed(range.index, 'image', image.url);\n };\n\n onFieldModalClose = () => {\n this.setState({ isFieldModalOpen: false });\n };\n\n onImageModalClose = () => {\n this.setState({ isImageModalOpen: false });\n };\n\n quillRef = (ref) => {\n this.quill = ref;\n };\n\n render() {\n const { isFieldModalOpen, isImageModalOpen } = this.state;\n const {\n containerProps = {},\n customFields,\n imagesData,\n customToolbar,\n height,\n value,\n showRawHTML,\n onShowHTML,\n hideItems,\n bounds,\n // a bunch of props we don't want to pass to the editor\n onChange,\n handleImageClick,\n handleCustomFieldClick,\n ...editorProps\n } = this.props;\n\n // workaround monkeypatch for quill bug, when bounds is set to element, it doesn't work\n // we force it to be a string instead and as such we make sure the css selector is present\n // by adding a class to the element if the bounds is set to element\n // adding a class to the body if the bounds is not set (default bounds is document.body)\n let finalBoundElement = document.body;\n if (\n typeof bounds !== 'undefined' &&\n // there is no sure-fire way to check if something is a DOM element\n // checking classList existance && that it's an instance of DOMTokenList is a close enough check for most cases\n bounds?.classList &&\n bounds?.classList instanceof DOMTokenList\n ) {\n finalBoundElement = bounds;\n }\n // we need to make sure only one element in the DOM has the class we are about to add\n // so we remove the class from all elements that have it before adding it to the finalBoundElement\n const elementsWithClass = document.querySelectorAll(`.${this.state.uniqueClassName}`);\n elementsWithClass.forEach((element) => {\n element.classList.remove(this.state.uniqueClassName);\n });\n\n if (!finalBoundElement.classList.contains(this.state.uniqueClassName)) {\n finalBoundElement.classList.add(this.state.uniqueClassName);\n }\n // we need to set the bounds to the class name we just added\n const boundsWorkaround = `.${this.state.uniqueClassName}`;\n\n return (\n <div\n // data-testid=\"wysiwyg-text-container\"\n {...containerProps}\n className={`quill-wysiwyg-editor ${showRawHTML ? 'show-raw' : ''}`}\n >\n {customToolbar || (\n <CustomToolbar\n customFields={customFields}\n onShowHTML={onShowHTML}\n hideItems={hideItems}\n userProps={this.props}\n />\n )}\n <ReactQuill\n ref={this.quillRef}\n modules={this.quillModules}\n onChange={this.onChangeQuill}\n value={value}\n style={{\n height,\n borderBottom: '1px solid #ccc',\n }}\n bounds={boundsWorkaround}\n {...editorProps}\n id=\"wysiwyg-text-container\"\n />\n <textarea\n className=\"raw-editor ql-container ql-snow ql-editor\"\n style={{\n width: '100%',\n resize: 'none',\n height,\n minHeight: '200px',\n }}\n onChange={this.onChangeTextArea}\n value={formatHTML(value)}\n />\n {imagesData && imagesData.length && (\n <ImageLibraryModal\n imagesData={imagesData}\n isOpen={isImageModalOpen}\n onClose={this.onImageModalClose}\n onConfirm={this.onImageConfirm}\n />\n )}\n {customFields && customFields.length && (\n <InsertFieldModal\n customFields={customFields}\n isOpen={isFieldModalOpen}\n onClose={this.onFieldModalClose}\n onConfirm={this.onInserFieldConfirm}\n />\n )}\n </div>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkNjB;AA/MN,mBAAkB;AAClB,yBAAkC;AAClC,kCAA0B;AAC1B,+BAA8B;AAC9B,8BAA6B;AAC7B,2BAA8B;AAC9B,yBAAwB;AACxB,wBAAuB;AACvB,mBAAkB;AAClB,mBAA2B;AAC3B,yCAA4C;AAC5C,iBAAoB;AAGpB,yBAAM,SAAS,yBAAyB,4BAAAA,OAAa;AAGrD,MAAM,aAAa,yBAAM,OAAO,yBAAyB;AACzD,MAAM,YAAY,yBAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,YAAY,yBAAM,OAAO,wBAAwB;AACvD,UAAU,YAAY;AAAA;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,QAAQ,yBAAM,OAAO,aAAa;AAC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ACL;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR;AAAA,gBACA,WAAW;AAAA,cACb;AAAA,cACA,UAAU,KAAK;AAAA,cACf,WAAO,yBAAW,KAAK;AAAA;AAAA,UACzB;AAAA,UACC,cAAc,WAAW,UACxB;AAAA,YAAC,yBAAAC;AAAA,YAAA;AAAA,cACC;AAAA,cACA,QAAQ;AAAA,cACR,SAAS,KAAK;AAAA,cACd,WAAW,KAAK;AAAA;AAAA,UAClB;AAAA,UAED,gBAAgB,aAAa,UAC5B;AAAA,YAAC,wBAAAC;AAAA,YAAA;AAAA,cACC;AAAA,cACA,QAAQ;AAAA,cACR,SAAS,KAAK;AAAA,cACd,WAAW,KAAK;AAAA;AAAA,UAClB;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["BlotFormatter", "IndentStyle", "Image", "React", "LinkFormat", "ReactQuill", "ImageLibraryModal", "InsertFieldModal"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -49,14 +53,7 @@ class ImageLibraryModal extends import_react.default.PureComponent {
|
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
render() {
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
-
import_ds_imagelibrarymodal.default,
|
|
54
|
-
{
|
|
55
|
-
...this.props,
|
|
56
|
-
onConfirm: this.onConfirm,
|
|
57
|
-
onSelect: this.onSelect
|
|
58
|
-
}
|
|
59
|
-
);
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_imagelibrarymodal.default, { ...this.props, onConfirm: this.onConfirm, onSelect: this.onSelect });
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
ImageLibraryModal.propTypes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ImageLibraryModal.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal';\nimport PropTypes from 'prop-types';\n\nexport default class ImageLibraryModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n onReject: PropTypes.func,\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n description: PropTypes.string,\n createdBy: PropTypes.string.isRequired,\n createdDate: PropTypes.string.isRequired,\n }),\n ),\n isOpen: PropTypes.bool.isRequired,\n };\n\n static defaultProps = {\n onReject: undefined,\n imagesData: [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n {\n url
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal';\nimport PropTypes from 'prop-types';\n\nexport default class ImageLibraryModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n onReject: PropTypes.func,\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n url: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n description: PropTypes.string,\n createdBy: PropTypes.string.isRequired,\n createdDate: PropTypes.string.isRequired,\n }),\n ),\n isOpen: PropTypes.bool.isRequired,\n };\n\n static defaultProps = {\n onReject: undefined,\n imagesData: [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n {\n url: 'https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e',\n name: 'no image 2',\n createdBy: 'user:Jane Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedImage: undefined,\n };\n }\n\n onSelect = (selectedImage) => {\n this.setState({ selectedImage });\n };\n\n onConfirm = () => {\n const { selectedImage } = this.state;\n const { onConfirm, onClose } = this.props;\n onConfirm(selectedImage);\n onClose();\n };\n\n render() {\n return <DSImageLibraryModal {...this.props} onConfirm={this.onConfirm} onSelect={this.onSelect} />;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2DZ;AA3DX,mBAAkB;AAClB,kCAAgC;AAChC,wBAAsB;AAEtB,MAAO,0BAAwC,aAAAA,QAAM,cAAc;AAAA,EAoCjE,YAAY,OAAO;AACjB,UAAM,KAAK;AAMb,oBAAW,CAAC,kBAAkB;AAC5B,WAAK,SAAS,EAAE,cAAc,CAAC;AAAA,IACjC;AAEA,qBAAY,MAAM;AAChB,YAAM,EAAE,cAAc,IAAI,KAAK;AAC/B,YAAM,EAAE,WAAW,QAAQ,IAAI,KAAK;AACpC,gBAAU,aAAa;AACvB,cAAQ;AAAA,IACV;AAdE,SAAK,QAAQ;AAAA,MACX,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EAaA,SAAS;AACP,WAAO,4CAAC,4BAAAC,SAAA,EAAqB,GAAG,KAAK,OAAO,WAAW,KAAK,WAAW,UAAU,KAAK,UAAU;AAAA,EAClG;AACF;AAzDqB,kBACZ,YAAY;AAAA,EACjB,WAAW,kBAAAC,QAAU,KAAK;AAAA,EAC1B,SAAS,kBAAAA,QAAU,KAAK;AAAA,EACxB,UAAU,kBAAAA,QAAU;AAAA,EACpB,YAAY,kBAAAA,QAAU;AAAA,IACpB,kBAAAA,QAAU,MAAM;AAAA,MACd,IAAI,kBAAAA,QAAU;AAAA,MACd,KAAK,kBAAAA,QAAU,OAAO;AAAA,MACtB,MAAM,kBAAAA,QAAU,OAAO;AAAA,MACvB,aAAa,kBAAAA,QAAU;AAAA,MACvB,WAAW,kBAAAA,QAAU,OAAO;AAAA,MAC5B,aAAa,kBAAAA,QAAU,OAAO;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EACA,QAAQ,kBAAAA,QAAU,KAAK;AACzB;AAhBmB,kBAkBZ,eAAe;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,IACV;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,KAAK;AAAA,MACL,MAAM;AAAA,MACN,WAAW;AAAA,MACX,aAAa;AAAA,IACf;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["React", "DSImageLibraryModal", "PropTypes"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -34,7 +38,7 @@ var import_prop_types = __toESM(require("prop-types"));
|
|
|
34
38
|
var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
|
|
35
39
|
var import_ds_shared = require("@elliemae/ds-shared");
|
|
36
40
|
var import_lodash = require("lodash");
|
|
37
|
-
var import_customFields = require("./customFields");
|
|
41
|
+
var import_customFields = require("./customFields.js");
|
|
38
42
|
const modalTypes = Object.values(import_ds_modal.MODAL_TYPE);
|
|
39
43
|
const elementClassName = "insertfieldmodal-element";
|
|
40
44
|
class InsertFieldModal extends import_react.default.PureComponent {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/InsertFieldModal.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable react/static-property-placement */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared';\nimport { includes } from 'lodash';\nimport { fields, getFieldName, getFieldCode } from './customFields';\n\nconst modalTypes = Object.values(MODAL_TYPE);\nconst elementClassName = 'insertfieldmodal-element';\n\nexport default class InsertFieldModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n confirmLabel: PropTypes.string,\n customFields: PropTypes.arrayOf(PropTypes.string),\n disableDoubleClick: PropTypes.bool,\n isOpen: PropTypes.bool,\n modalTitle: PropTypes.string,\n modalType: PropTypes.string,\n rejectLabel: PropTypes.string,\n shouldCloseOnOverlayClick: PropTypes.bool,\n size: PropTypes.string,\n onSelect: PropTypes.func,\n };\n\n static defaultProps = {\n confirmLabel: 'Add',\n customFields: fields,\n disableDoubleClick: false,\n isOpen: true,\n modalTitle: 'Add Field',\n modalType: modalTypes[1],\n rejectLabel: 'Cancel',\n shouldCloseOnOverlayClick: true,\n size: sizeOptions[1],\n onSelect: undefined,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedFieldCode: getFieldCode(fields[0]),\n };\n this.preventSpacebarScroll();\n }\n\n componentDidMount() {\n const { customFields } = this.props;\n if (customFields) {\n this.handleElementClick({}, customFields[0]);\n this.focusFirst = true;\n }\n }\n\n getDerivedStateFromProps(nextProps) {\n const { customFields } = this.props;\n if (!customFields && nextProps.customFields) {\n this.setState({ selectedFieldCode: customFields[0] });\n }\n }\n\n onConfirm = () => {\n const { onConfirm, onClose } = this.props;\n const { selectedFieldCode } = this.state;\n onConfirm(selectedFieldCode);\n onClose();\n };\n\n onReject = () => {\n const { onReject, onClose } = this.props;\n if (onReject) {\n onReject();\n } else {\n onClose();\n }\n };\n\n drawDiv = (className, content, content2) => (\n <div className={className}>\n <span>{content}</span>\n <span>{content2}</span>\n </div>\n );\n\n drawLabel = (className, label, value) => (\n <div className={className}>\n <span className=\"label\">{label}</span>\n <span className=\"value\">{value}</span>\n </div>\n );\n\n handleElementClick = (e, selectedFieldCode) => {\n if (e.key && e.key !== ' ') {\n return;\n }\n const { selectedFieldCode: fCode } = this.state;\n const { disableDoubleClick } = this.props;\n if (selectedFieldCode === fCode && !disableDoubleClick) {\n this.onConfirm();\n return;\n }\n this.setState({\n selectedFieldCode,\n });\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(selectedFieldCode);\n }\n };\n\n preventSpacebarScroll = () => {\n document.onkeypress = function (e) {\n if (!includes(e.target.className, elementClassName)) {\n return true;\n }\n e = e || window.event;\n const charCode = e.keyCode || e.which;\n if (charCode === 32) {\n e.preventDefault();\n return false;\n }\n return true;\n };\n };\n\n renderElements = () => {\n const { customFields } = this.props;\n if (!customFields) {\n return 'Empty';\n }\n const { selectedFieldCode } = this.state;\n return customFields.map((customField, idx) => {\n const extras = {};\n const fieldCode = getFieldCode(customField);\n if (this.focusFirst && idx === 0) {\n extras.ref = (element) => element && element.focus();\n this.focusFirst = undefined;\n } else if (fieldCode === selectedFieldCode) {\n extras.ref = (element) => element && element.focus();\n }\n return (\n <div\n key={fieldCode}\n className={elementClassName}\n onClick={(e) => this.handleElementClick(e, fieldCode)}\n onKeyUp={(e) => this.handleElementClick(e, fieldCode)}\n role=\"button\"\n tabIndex={0}\n {...extras}\n >\n {this.drawLabel('content', getFieldName(customField), fieldCode)}\n </div>\n );\n });\n };\n\n render() {\n const { customFields, onSelect, ...modalProps } = this.props;\n return (\n <DSModal {...modalProps} className=\"insert-field-modal\" onConfirm={this.onConfirm} onReject={this.onReject}>\n <div className=\"wrapper\">\n <div className=\"col-1\">\n {this.drawDiv('title', 'Field Name', '\u00AB Field ID \u00BB')}\n {this.renderElements()}\n </div>\n </div>\n </DSModal>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable react/static-property-placement */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared';\nimport { includes } from 'lodash';\nimport { fields, getFieldName, getFieldCode } from './customFields.js';\n\nconst modalTypes = Object.values(MODAL_TYPE);\nconst elementClassName = 'insertfieldmodal-element';\n\nexport default class InsertFieldModal extends React.PureComponent {\n static propTypes = {\n onConfirm: PropTypes.func.isRequired,\n onClose: PropTypes.func.isRequired,\n confirmLabel: PropTypes.string,\n customFields: PropTypes.arrayOf(PropTypes.string),\n disableDoubleClick: PropTypes.bool,\n isOpen: PropTypes.bool,\n modalTitle: PropTypes.string,\n modalType: PropTypes.string,\n rejectLabel: PropTypes.string,\n shouldCloseOnOverlayClick: PropTypes.bool,\n size: PropTypes.string,\n onSelect: PropTypes.func,\n };\n\n static defaultProps = {\n confirmLabel: 'Add',\n customFields: fields,\n disableDoubleClick: false,\n isOpen: true,\n modalTitle: 'Add Field',\n modalType: modalTypes[1],\n rejectLabel: 'Cancel',\n shouldCloseOnOverlayClick: true,\n size: sizeOptions[1],\n onSelect: undefined,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedFieldCode: getFieldCode(fields[0]),\n };\n this.preventSpacebarScroll();\n }\n\n componentDidMount() {\n const { customFields } = this.props;\n if (customFields) {\n this.handleElementClick({}, customFields[0]);\n this.focusFirst = true;\n }\n }\n\n getDerivedStateFromProps(nextProps) {\n const { customFields } = this.props;\n if (!customFields && nextProps.customFields) {\n this.setState({ selectedFieldCode: customFields[0] });\n }\n }\n\n onConfirm = () => {\n const { onConfirm, onClose } = this.props;\n const { selectedFieldCode } = this.state;\n onConfirm(selectedFieldCode);\n onClose();\n };\n\n onReject = () => {\n const { onReject, onClose } = this.props;\n if (onReject) {\n onReject();\n } else {\n onClose();\n }\n };\n\n drawDiv = (className, content, content2) => (\n <div className={className}>\n <span>{content}</span>\n <span>{content2}</span>\n </div>\n );\n\n drawLabel = (className, label, value) => (\n <div className={className}>\n <span className=\"label\">{label}</span>\n <span className=\"value\">{value}</span>\n </div>\n );\n\n handleElementClick = (e, selectedFieldCode) => {\n if (e.key && e.key !== ' ') {\n return;\n }\n const { selectedFieldCode: fCode } = this.state;\n const { disableDoubleClick } = this.props;\n if (selectedFieldCode === fCode && !disableDoubleClick) {\n this.onConfirm();\n return;\n }\n this.setState({\n selectedFieldCode,\n });\n const { onSelect } = this.props;\n if (onSelect) {\n onSelect(selectedFieldCode);\n }\n };\n\n preventSpacebarScroll = () => {\n document.onkeypress = function (e) {\n if (!includes(e.target.className, elementClassName)) {\n return true;\n }\n e = e || window.event;\n const charCode = e.keyCode || e.which;\n if (charCode === 32) {\n e.preventDefault();\n return false;\n }\n return true;\n };\n };\n\n renderElements = () => {\n const { customFields } = this.props;\n if (!customFields) {\n return 'Empty';\n }\n const { selectedFieldCode } = this.state;\n return customFields.map((customField, idx) => {\n const extras = {};\n const fieldCode = getFieldCode(customField);\n if (this.focusFirst && idx === 0) {\n extras.ref = (element) => element && element.focus();\n this.focusFirst = undefined;\n } else if (fieldCode === selectedFieldCode) {\n extras.ref = (element) => element && element.focus();\n }\n return (\n <div\n key={fieldCode}\n className={elementClassName}\n onClick={(e) => this.handleElementClick(e, fieldCode)}\n onKeyUp={(e) => this.handleElementClick(e, fieldCode)}\n role=\"button\"\n tabIndex={0}\n {...extras}\n >\n {this.drawLabel('content', getFieldName(customField), fieldCode)}\n </div>\n );\n });\n };\n\n render() {\n const { customFields, onSelect, ...modalProps } = this.props;\n return (\n <DSModal {...modalProps} className=\"insert-field-modal\" onConfirm={this.onConfirm} onReject={this.onReject}>\n <div className=\"wrapper\">\n <div className=\"col-1\">\n {this.drawDiv('title', 'Field Name', '\u00AB Field ID \u00BB')}\n {this.renderElements()}\n </div>\n </div>\n </DSModal>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkFnB;AA/EJ,mBAAkB;AAClB,wBAAsB;AACtB,sBAAoC;AACpC,uBAA4B;AAC5B,oBAAyB;AACzB,0BAAmD;AAEnD,MAAM,aAAa,OAAO,OAAO,0BAAU;AAC3C,MAAM,mBAAmB;AAEzB,MAAO,yBAAuC,aAAAA,QAAM,cAAc;AAAA,EA6BhE,YAAY,OAAO;AACjB,UAAM,KAAK;AAsBb,qBAAY,MAAM;AAChB,YAAM,EAAE,WAAW,QAAQ,IAAI,KAAK;AACpC,YAAM,EAAE,kBAAkB,IAAI,KAAK;AACnC,gBA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D,WACE,4CAAC,gBAAAC,SAAA,EAAS,GAAG,YAAY,WAAU,sBAAqB,WAAW,KAAK,WAAW,UAAU,KAAK,UAChG,sDAAC,SAAI,WAAU,WACb,uDAAC,SAAI,WAAU,SACZ;AAAA,WAAK,QAAQ,SAAS,cAAc,oBAAc;AAAA,MAClD,KAAK,eAAe;AAAA,OACvB,GACF,GACF;AAAA,EAEJ;AACF;AAhKqB,iBACZ,YAAY;AAAA,EACjB,WAAW,kBAAAC,QAAU,KAAK;AAAA,EAC1B,SAAS,kBAAAA,QAAU,KAAK;AAAA,EACxB,cAAc,kBAAAA,QAAU;AAAA,EACxB,cAAc,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,MAAM;AAAA,EAChD,oBAAoB,kBAAAA,QAAU;AAAA,EAC9B,QAAQ,kBAAAA,QAAU;AAAA,EAClB,YAAY,kBAAAA,QAAU;AAAA,EACtB,WAAW,kBAAAA,QAAU;AAAA,EACrB,aAAa,kBAAAA,QAAU;AAAA,EACvB,2BAA2B,kBAAAA,QAAU;AAAA,EACrC,MAAM,kBAAAA,QAAU;AAAA,EAChB,UAAU,kBAAAA,QAAU;AACtB;AAdmB,iBAgBZ,eAAe;AAAA,EACpB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW,WAAW,CAAC;AAAA,EACvB,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,MAAM,6BAAY,CAAC;AAAA,EACnB,UAAU;AACZ;",
|
|
6
6
|
"names": ["React", "DSModal", "PropTypes"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/TippedButton.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\ninterface TippedButtonPropsT {\n tip: string;\n zIndex: number;\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n className?: string;\n value?: string;\n}\n\nexport const TippedButton = ({\n className,\n tip,\n children,\n onClick = () => null,\n zIndex = 1,\n ...rest\n}: TippedButtonPropsT): JSX.Element => (\n <div className=\"tooltip\">\n <DSTooltipV3 text={tip} zIndex={zIndex} withoutPortal={false}>\n <button\n type=\"button\"\n className={className}\n onClick={(e) => {\n e.preventDefault();\n onClick(e);\n }}\n {...rest}\n >\n {children}\n </button>\n </DSTooltipV3>\n </div>\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuBjB;AAtBN,wBAA4B;AAYrB,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAChB,SAAS;AAAA,EACT,GAAG;AACL,MACE,4CAAC,SAAI,WAAU,WACb,sDAAC,iCAAY,MAAM,KAAK,QAAgB,eAAe,OACrD;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL;AAAA,IACA,SAAS,CAAC,MAAM;AACd,QAAE,eAAe;AACjB,cAAQ,CAAC;AAAA,IACX;AAAA,IACC,GAAG;AAAA,IAEH;AAAA;AACH,GACF,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/TippedSelect.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\ninterface TippedSelectPropsT {\n tip: string;\n onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;\n className?: string;\n options?: string[];\n defaultValue?: string;\n values?: string[];\n zIndex?: number;\n children?: React.ReactNode;\n}\n\nexport const TippedSelect = (props: TippedSelectPropsT): JSX.Element => {\n const { tip, onChange = () => null, className, options, defaultValue = '', values, zIndex, children } = props;\n const fallBackChildren =\n values &&\n values.map((value, index) => (\n <option key={value} value={value === 'normal' ? '' : value}>\n {options ? options[index] : null}\n </option>\n ));\n\n return (\n <div className=\"tooltip\">\n <DSTooltipV3 text={tip} zIndex={zIndex} withoutPortal={false}>\n <div>\n <select\n className={className}\n defaultValue={defaultValue}\n onChange={(e) => {\n e.persist();\n onChange(e);\n }}\n >\n {children || fallBackChildren}\n </select>\n </div>\n </DSTooltipV3>\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBjB;AAlBN,wBAA4B;AAarB,MAAM,eAAe,CAAC,UAA2C;AACtE,QAAM,EAAE,KAAK,WAAW,MAAM,MAAM,WAAW,SAAS,eAAe,IAAI,QAAQ,QAAQ,SAAS,IAAI;AACxG,QAAM,mBACJ,UACA,OAAO,IAAI,CAAC,OAAO,UACjB,4CAAC,YAAmB,OAAO,UAAU,WAAW,KAAK,OAClD,oBAAU,QAAQ,KAAK,IAAI,QADjB,KAEb,CACD;AAEH,SACE,4CAAC,SAAI,WAAU,WACb,sDAAC,iCAAY,MAAM,KAAK,QAAgB,eAAe,OACrD,sDAAC,SACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAU,CAAC,MAAM;AACf,UAAE,QAAQ;AACV,iBAAS,CAAC;AAAA,MACZ;AAAA,MAEC,sBAAY;AAAA;AAAA,EACf,GACF,GACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/colors.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["function sinToHex(i, size, phase) {\n const sin = Math.sin((Math.PI / size) * 2 * i + phase);\n const int = Math.floor(sin * 127) + 128;\n const hex = int.toString(16);\n\n return hex.length === 1 ? `0${hex}` : hex;\n}\nexport function getRainbowColors(size = 28) {\n const colors = new Array(size).fill(undefined);\n return colors.map((color, idx) => {\n const red = sinToHex(idx, size, (0 * Math.PI * 2) / 3); // 0 deg\n const blue = sinToHex(idx, size, (1 * Math.PI * 2) / 3); // 120 deg\n const green = sinToHex(idx, size, (2 * Math.PI * 2) / 3); // 240 deg\n\n color = `#${red}${green}${blue}`;\n return color;\n });\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,SAAS,SAAS,GAAG,MAAM,OAAO;AAChC,QAAM,MAAM,KAAK,IAAK,KAAK,KAAK,OAAQ,IAAI,IAAI,KAAK;AACrD,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,IAAI;AACpC,QAAM,MAAM,IAAI,SAAS,EAAE;AAE3B,SAAO,IAAI,WAAW,IAAI,IAAI,QAAQ;AACxC;AACO,SAAS,iBAAiB,OAAO,IAAI;AAC1C,QAAM,SAAS,IAAI,MAAM,IAAI,EAAE,KAAK,MAAS;AAC7C,SAAO,OAAO,IAAI,CAAC,OAAO,QAAQ;AAChC,UAAM,MAAM,SAAS,KAAK,MAAO,IAAI,KAAK,KAAK,IAAK,CAAC;AACrD,UAAM,OAAO,SAAS,KAAK,MAAO,IAAI,KAAK,KAAK,IAAK,CAAC;AACtD,UAAM,QAAQ,SAAS,KAAK,MAAO,IAAI,KAAK,KAAK,IAAK,CAAC;AAEvD,YAAQ,IAAI,MAAM,QAAQ;AAC1B,WAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|