@elliemae/ds-modal 3.0.0-next.2 → 3.0.0-next.3
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/DSModal.js +111 -0
- package/dist/cjs/DSModal.js.map +7 -0
- package/dist/cjs/constants.js +73 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/v1/DSModal.js +185 -0
- package/dist/cjs/v1/DSModal.js.map +7 -0
- package/dist/cjs/v1/DSModalType.js +45 -0
- package/dist/cjs/v1/DSModalType.js.map +7 -0
- package/dist/cjs/v1/DSModalWrapper.js +145 -0
- package/dist/cjs/v1/DSModalWrapper.js.map +7 -0
- package/dist/cjs/v1/ModalFeedBack/ModalFeedBack.js +103 -0
- package/dist/cjs/v1/ModalFeedBack/ModalFeedBack.js.map +7 -0
- package/dist/cjs/v2/DSModal.js +172 -0
- package/dist/cjs/v2/DSModal.js.map +7 -0
- package/dist/cjs/v2/blocks.js +71 -0
- package/dist/cjs/v2/blocks.js.map +7 -0
- package/dist/cjs/v2/components/DecisionHeader.js +48 -0
- package/dist/cjs/v2/components/DecisionHeader.js.map +7 -0
- package/dist/cjs/v2/components/FeedbackIcon.js +73 -0
- package/dist/cjs/v2/components/FeedbackIcon.js.map +7 -0
- package/dist/cjs/v2/components/Footer.js +81 -0
- package/dist/cjs/v2/components/Footer.js.map +7 -0
- package/dist/cjs/v2/components/FormHeader.js +54 -0
- package/dist/cjs/v2/components/FormHeader.js.map +7 -0
- package/dist/cjs/v2/components/ModalContent.js +108 -0
- package/dist/cjs/v2/components/ModalContent.js.map +7 -0
- package/dist/cjs/v2/components/SelectionHeader.js +63 -0
- package/dist/cjs/v2/components/SelectionHeader.js.map +7 -0
- package/dist/cjs/v2/components/Title.js +41 -0
- package/dist/cjs/v2/components/Title.js.map +7 -0
- package/dist/cjs/v2/helpers.js +54 -0
- package/dist/cjs/v2/helpers.js.map +7 -0
- package/dist/esm/DSModal.js +84 -0
- package/dist/esm/DSModal.js.map +7 -0
- package/dist/esm/constants.js +44 -0
- package/dist/esm/constants.js.map +7 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/v1/DSModal.js +158 -0
- package/dist/esm/v1/DSModal.js.map +7 -0
- package/dist/esm/v1/DSModalType.js +16 -0
- package/dist/esm/v1/DSModalType.js.map +7 -0
- package/dist/esm/v1/DSModalWrapper.js +118 -0
- package/dist/esm/v1/DSModalWrapper.js.map +7 -0
- package/dist/esm/v1/ModalFeedBack/ModalFeedBack.js +74 -0
- package/dist/esm/v1/ModalFeedBack/ModalFeedBack.js.map +7 -0
- package/dist/esm/v2/DSModal.js +145 -0
- package/dist/esm/v2/DSModal.js.map +7 -0
- package/dist/esm/v2/blocks.js +42 -0
- package/dist/esm/v2/blocks.js.map +7 -0
- package/dist/esm/v2/components/DecisionHeader.js +19 -0
- package/dist/esm/v2/components/DecisionHeader.js.map +7 -0
- package/dist/esm/v2/components/FeedbackIcon.js +44 -0
- package/dist/esm/v2/components/FeedbackIcon.js.map +7 -0
- package/dist/esm/v2/components/Footer.js +54 -0
- package/dist/esm/v2/components/Footer.js.map +7 -0
- package/dist/esm/v2/components/FormHeader.js +25 -0
- package/dist/esm/v2/components/FormHeader.js.map +7 -0
- package/dist/esm/v2/components/ModalContent.js +87 -0
- package/dist/esm/v2/components/ModalContent.js.map +7 -0
- package/dist/esm/v2/components/SelectionHeader.js +36 -0
- package/dist/esm/v2/components/SelectionHeader.js.map +7 -0
- package/dist/esm/v2/components/Title.js +12 -0
- package/dist/esm/v2/components/Title.js.map +7 -0
- package/dist/esm/v2/helpers.js +25 -0
- package/dist/esm/v2/helpers.js.map +7 -0
- package/package.json +64 -55
- package/cjs/DSModal.js +0 -186
- package/cjs/constants.js +0 -34
- package/cjs/index.js +0 -18
- package/cjs/v1/DSModal.js +0 -148
- package/cjs/v1/DSModalType.js +0 -7
- package/cjs/v1/DSModalWrapper.js +0 -166
- package/cjs/v1/ModalFeedBack/ModalFeedBack.js +0 -98
- package/cjs/v2/DSModal.js +0 -203
- package/cjs/v2/blocks.js +0 -88
- package/cjs/v2/components/DecisionHeader.js +0 -38
- package/cjs/v2/components/FeedbackIcon.js +0 -64
- package/cjs/v2/components/Footer.js +0 -66
- package/cjs/v2/components/FormHeader.js +0 -47
- package/cjs/v2/components/ModalContent.js +0 -112
- package/cjs/v2/components/SelectionHeader.js +0 -49
- package/cjs/v2/components/Title.js +0 -26
- package/cjs/v2/helpers.js +0 -45
- package/esm/DSModal.js +0 -175
- package/esm/constants.js +0 -26
- package/esm/index.js +0 -4
- package/esm/v1/DSModal.js +0 -139
- package/esm/v1/DSModalType.js +0 -3
- package/esm/v1/DSModalWrapper.js +0 -160
- package/esm/v1/ModalFeedBack/ModalFeedBack.js +0 -92
- package/esm/v2/DSModal.js +0 -192
- package/esm/v2/blocks.js +0 -77
- package/esm/v2/components/DecisionHeader.js +0 -28
- package/esm/v2/components/FeedbackIcon.js +0 -55
- package/esm/v2/components/Footer.js +0 -55
- package/esm/v2/components/FormHeader.js +0 -37
- package/esm/v2/components/ModalContent.js +0 -103
- package/esm/v2/components/SelectionHeader.js +0 -39
- package/esm/v2/components/Title.js +0 -17
- package/esm/v2/helpers.js +0 -37
- package/types/DSModal.d.ts +0 -14
- package/types/constants.d.ts +0 -25
- package/types/index.d.ts +0 -4
- package/types/v1/DSModal.d.ts +0 -143
- package/types/v1/DSModalType.d.ts +0 -1
- package/types/v1/ModalFeedBack/ModalFeedBack.d.ts +0 -11
- package/types/v2/DSModal.d.ts +0 -260
- package/types/v2/blocks.d.ts +0 -9
- package/types/v2/components/DecisionHeader.d.ts +0 -6
- package/types/v2/components/FeedbackIcon.d.ts +0 -5
- package/types/v2/components/Footer.d.ts +0 -13
- package/types/v2/components/FormHeader.d.ts +0 -8
- package/types/v2/components/ModalContent.d.ts +0 -21
- package/types/v2/components/SelectionHeader.d.ts +0 -8
- package/types/v2/components/Title.d.ts +0 -6
- package/types/v2/components/tests/DecisionHeader.test.d.ts +0 -1
- package/types/v2/components/tests/FeedbackIcon.test.d.ts +0 -1
- package/types/v2/components/tests/Footer.test.d.ts +0 -1
- package/types/v2/components/tests/FormHeader.test.d.ts +0 -1
- package/types/v2/components/tests/SelectionHeader.test.d.ts +0 -1
- package/types/v2/helpers.d.ts +0 -16
- package/types/v2/tests/DSModal.test.d.ts +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { modalTypes } from './constants';\nimport DSModalV1 from './v1/DSModal';\nimport DSModalV2, { DSModalContent } from './v2/DSModal';\nimport { sizes, iconSizes } from '@elliemae/ds-shared/prop-types';\n\nconst DSModal = ({ version = 1, ...rest }) => {\n if (version === 2) return <DSModalV2 {...rest} />;\n return <DSModalV1 {...rest} />;\n};\n\nDSModal.propTypes = {\n version: PropTypes.oneOf([1, 2]),\n};\n\nDSModalV1.propTypes = {\n version: PropTypes.oneOf([1, 2]),\n className: PropTypes.string,\n /**\n * Add an additional css class to the footer\n */\n additionalFooterCssClass: PropTypes.string,\n /**\n * Set style for the modal\n */\n style: PropTypes.objectOf(PropTypes.string),\n /**\n * Select size for the close icon\n */\n iconCloseSize: PropTypes.oneOf(iconSizes),\n /**\n * ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']\n */\n modalType: PropTypes.oneOf(modalTypes),\n /**\n * Show the header or not\n */\n showHeader: PropTypes.bool,\n /**\n * Show the footer or not\n */\n showFooter: PropTypes.bool,\n /**\n * Main content of the modal\n */\n children: PropTypes.element.isRequired,\n /**\n * Content is centered or not\n */\n centered: PropTypes.bool,\n /**\n * Text to be added in the confirm button\n */\n confirmLabel: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n modalTitle: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n size: PropTypes.oneOf(sizes),\n /**\n * Modal is open or not\n */\n isOpen: PropTypes.bool,\n /**\n * Allows a function to be triggered once the modal is closed\n */\n onClose: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal is opened\n */\n onAfterOpen: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is confirmed\n */\n onConfirm: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is rejected\n */\n onReject: PropTypes.func,\n /**\n * Text to be added in the reject button\n */\n rejectLabel: PropTypes.string,\n /**\n * If modal should close on overlay click\n */\n shouldCloseOnOverlayClick: PropTypes.bool,\n /**\n * Modal has error or not\n */\n hasError: PropTypes.bool,\n /**\n * Modal has warning or not\n */\n hasWarning: PropTypes.bool,\n /**\n * Modal has success or not\n */\n hasSuccess: PropTypes.bool,\n /**\n * Modal has info or not\n */\n hasInfo: PropTypes.bool,\n /**\n * Modal has help or not\n */\n hasHelp: PropTypes.bool,\n actionsRef: PropTypes.func,\n appElement: PropTypes.string,\n /**\n * Customized props for the confirm button\n */\n overridePropsConfirmButton: PropTypes.objectOf(PropTypes.shape({})),\n /**\n * Customized props for the reject button\n */\n overridePropsRejectButton: PropTypes.objectOf(PropTypes.string),\n /**\n * Show confirm button\n */\n showConfirmButton: PropTypes.bool,\n /**\n * Show confirm button\n */\n customCloseComponent: PropTypes.element,\n};\nexport { DSModalContent, DSModal };\nexport default DSModal;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,UAAU,CAAC,OAA6B;AAA7B,eAAE,YAAU,MAAZ,IAAkB,iBAAlB,IAAkB,CAAhB;AACjB,MAAI,YAAY;AAAG,WAAO,qCAAC,WAAD,mBAAe;AACzC,SAAO,qCAAC,WAAD,mBAAe;AAAA;AA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|
+
ERROR: "error",
|
|
9
|
+
SUCCESS: "success",
|
|
10
|
+
HELP: "help",
|
|
11
|
+
INFO: "info"
|
|
12
|
+
};
|
|
13
|
+
const modalTypes = [
|
|
14
|
+
MODAL_TYPE.DEFAULT,
|
|
15
|
+
MODAL_TYPE.ALERT,
|
|
16
|
+
MODAL_TYPE.CONFIRM,
|
|
17
|
+
MODAL_TYPE.NOTIFICATION,
|
|
18
|
+
MODAL_TYPE.WARNING,
|
|
19
|
+
MODAL_TYPE.ERROR,
|
|
20
|
+
MODAL_TYPE.SUCCESS,
|
|
21
|
+
MODAL_TYPE.HELP,
|
|
22
|
+
MODAL_TYPE.INFO
|
|
23
|
+
];
|
|
24
|
+
const MODAL_TYPE_V2 = {
|
|
25
|
+
INFORMATION: "information",
|
|
26
|
+
DECISION: "decision",
|
|
27
|
+
SELECTION: "selection",
|
|
28
|
+
FORM: "form"
|
|
29
|
+
};
|
|
30
|
+
const MODAL_SUB_TYPE_V2 = {
|
|
31
|
+
SUCCESS: "success",
|
|
32
|
+
WARNING: "warning",
|
|
33
|
+
ERROR: "error",
|
|
34
|
+
INFORMATION: "information"
|
|
35
|
+
};
|
|
36
|
+
var constants_default = MODAL_TYPE;
|
|
37
|
+
export {
|
|
38
|
+
MODAL_SUB_TYPE_V2,
|
|
39
|
+
MODAL_TYPE,
|
|
40
|
+
MODAL_TYPE_V2,
|
|
41
|
+
constants_default as default,
|
|
42
|
+
modalTypes
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/constants.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const MODAL_TYPE = {\n DEFAULT: 'default',\n ALERT: 'alert',\n CONFIRM: 'confirm',\n NOTIFICATION: 'notification',\n WARNING: 'warning',\n ERROR: 'error',\n SUCCESS: 'success',\n HELP: 'help',\n INFO: 'info',\n};\n\nexport const modalTypes = [\n MODAL_TYPE.DEFAULT,\n MODAL_TYPE.ALERT,\n MODAL_TYPE.CONFIRM,\n MODAL_TYPE.NOTIFICATION,\n MODAL_TYPE.WARNING,\n MODAL_TYPE.ERROR,\n MODAL_TYPE.SUCCESS,\n MODAL_TYPE.HELP,\n MODAL_TYPE.INFO,\n];\n\nexport const MODAL_TYPE_V2 = {\n INFORMATION: 'information',\n DECISION: 'decision',\n SELECTION: 'selection',\n FORM: 'form',\n};\n\nexport const MODAL_SUB_TYPE_V2 = {\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n INFORMATION: 'information',\n};\n\nexport default MODAL_TYPE;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,aAAa;AAAA,EACxB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,cAAc;AAAA,EACd,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA;AAGD,MAAM,aAAa;AAAA,EACxB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA;AAGN,MAAM,gBAAgB;AAAA,EAC3B,aAAa;AAAA,EACb,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA;AAGD,MAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA;AAGf,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DSModal, DSModal as DSModal2 } from "./DSModal";
|
|
3
|
+
import { MODAL_TYPE, modalTypes, MODAL_TYPE_V2, MODAL_SUB_TYPE_V2 } from "./constants";
|
|
4
|
+
import { DSModalWithSchema } from "./v2/DSModal";
|
|
5
|
+
export {
|
|
6
|
+
DSModal,
|
|
7
|
+
DSModalWithSchema,
|
|
8
|
+
MODAL_SUB_TYPE_V2,
|
|
9
|
+
MODAL_TYPE,
|
|
10
|
+
MODAL_TYPE_V2,
|
|
11
|
+
DSModal2 as default,
|
|
12
|
+
modalTypes
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSModal, DSModal as default } from './DSModal';\nexport { MODAL_TYPE, modalTypes, MODAL_TYPE_V2, MODAL_SUB_TYPE_V2 } from './constants';\nexport { DSModalWithSchema } from './v2/DSModal';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import React2 from "react";
|
|
19
|
+
import PropTypes from "prop-types";
|
|
20
|
+
import ReactModal from "react-modal";
|
|
21
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
22
|
+
import { DSIconSizes } from "@elliemae/ds-icon";
|
|
23
|
+
import { Close } from "@elliemae/ds-icons";
|
|
24
|
+
import DSButton from "@elliemae/ds-button";
|
|
25
|
+
import MODAL_TYPE, { modalTypes } from "../constants";
|
|
26
|
+
import ModalFeedBack from "./ModalFeedBack/ModalFeedBack";
|
|
27
|
+
import { sizes, iconSizes } from "@elliemae/ds-shared/prop-types";
|
|
28
|
+
const DSModal = ({
|
|
29
|
+
containerProps = {},
|
|
30
|
+
className = "",
|
|
31
|
+
dataTestId = "ds-modal",
|
|
32
|
+
additionalFooterCssClass = "",
|
|
33
|
+
style = {},
|
|
34
|
+
iconCloseSize = DSIconSizes.S,
|
|
35
|
+
modalType = MODAL_TYPE.DEFAULT,
|
|
36
|
+
showHeader = true,
|
|
37
|
+
showFooter = true,
|
|
38
|
+
children,
|
|
39
|
+
centered = true,
|
|
40
|
+
confirmLabel = "Accept",
|
|
41
|
+
modalTitle = "",
|
|
42
|
+
size = "medium",
|
|
43
|
+
isOpen = false,
|
|
44
|
+
onClose = () => null,
|
|
45
|
+
onAfterOpen = () => null,
|
|
46
|
+
onConfirm = () => null,
|
|
47
|
+
onReject = () => null,
|
|
48
|
+
rejectLabel = "Cancel",
|
|
49
|
+
shouldCloseOnOverlayClick = false,
|
|
50
|
+
hasError = false,
|
|
51
|
+
hasWarning = false,
|
|
52
|
+
hasSuccess = false,
|
|
53
|
+
hasInfo = false,
|
|
54
|
+
hasHelp = false,
|
|
55
|
+
actionsRef = () => null,
|
|
56
|
+
appElement = "#root",
|
|
57
|
+
overridePropsConfirmButton = {},
|
|
58
|
+
overridePropsRejectButton = {},
|
|
59
|
+
zIndex = 10
|
|
60
|
+
}) => {
|
|
61
|
+
typeof document !== "undefined" && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement);
|
|
62
|
+
const { cssClassName, classNameElement, classNameBlock, classNameModifier, classNameBlockModifier } = convertPropToCssClassName("modal", className, {
|
|
63
|
+
hasError,
|
|
64
|
+
hasWarning,
|
|
65
|
+
hasSuccess,
|
|
66
|
+
modalType,
|
|
67
|
+
size
|
|
68
|
+
});
|
|
69
|
+
const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;
|
|
70
|
+
const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
|
|
71
|
+
const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
|
|
72
|
+
return /* @__PURE__ */ React2.createElement(ReactModal, {
|
|
73
|
+
testId: dataTestId,
|
|
74
|
+
className: cssClassName,
|
|
75
|
+
contentLabel: modalTitle,
|
|
76
|
+
isOpen,
|
|
77
|
+
onAfterOpen,
|
|
78
|
+
onRequestClose: onClose,
|
|
79
|
+
overlayClassName: `${classNameBlock("overlay")} ${classNameModifier(centered && "center")}`,
|
|
80
|
+
shouldCloseOnOverlayClick,
|
|
81
|
+
style: {
|
|
82
|
+
content: __spreadValues({}, style),
|
|
83
|
+
overlay: {
|
|
84
|
+
zIndex
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, /* @__PURE__ */ React2.createElement("div", __spreadValues({}, containerProps), showHeader && /* @__PURE__ */ React2.createElement("div", {
|
|
88
|
+
className: classNameBlock("modal-header")
|
|
89
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
90
|
+
className: classNameElement("title", "modal-header")
|
|
91
|
+
}, modalTitle), /* @__PURE__ */ React2.createElement("div", {
|
|
92
|
+
className: classNameElement("icon", "modal-header")
|
|
93
|
+
}, /* @__PURE__ */ React2.createElement(DSButton, {
|
|
94
|
+
buttonType: "link",
|
|
95
|
+
icon: /* @__PURE__ */ React2.createElement(Close, null),
|
|
96
|
+
onClick: onClose,
|
|
97
|
+
size: iconCloseSize
|
|
98
|
+
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
99
|
+
className: classNameElement("body")
|
|
100
|
+
}, showFeedBack && /* @__PURE__ */ React2.createElement(ModalFeedBack, {
|
|
101
|
+
hasError,
|
|
102
|
+
hasHelp,
|
|
103
|
+
hasInfo,
|
|
104
|
+
hasSuccess,
|
|
105
|
+
hasWarning,
|
|
106
|
+
modalType
|
|
107
|
+
}), children), showFooter && !isAFeedbackType && /* @__PURE__ */ React2.createElement("div", {
|
|
108
|
+
className: `${classNameBlock("modal-footer")} ${additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, "modal-footer") : ""}`
|
|
109
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
110
|
+
ref: actionsRef,
|
|
111
|
+
className: classNameBlock("modal-footer-actions")
|
|
112
|
+
}, modalType === MODAL_TYPE.CONFIRM && /* @__PURE__ */ React2.createElement(DSButton, __spreadValues({
|
|
113
|
+
buttonType: "secondary",
|
|
114
|
+
className: `${classNameElement("button-action")} ${classNameModifier("reject", "button-action")} `,
|
|
115
|
+
labelText: rejectLabel,
|
|
116
|
+
onClick: onReject
|
|
117
|
+
}, overridePropsRejectButton)), /* @__PURE__ */ React2.createElement(DSButton, __spreadValues({
|
|
118
|
+
buttonType: "primary",
|
|
119
|
+
className: `${classNameElement("button-action")} ${classNameModifier("confirm", "button-action")} `,
|
|
120
|
+
labelText: confirmLabel,
|
|
121
|
+
onClick: onConfirm
|
|
122
|
+
}, overridePropsConfirmButton))))));
|
|
123
|
+
};
|
|
124
|
+
DSModal.propTypes = {
|
|
125
|
+
className: PropTypes.string,
|
|
126
|
+
additionalFooterCssClass: PropTypes.string,
|
|
127
|
+
style: PropTypes.shape({}),
|
|
128
|
+
iconCloseSize: PropTypes.oneOf(iconSizes),
|
|
129
|
+
modalType: PropTypes.oneOf(modalTypes),
|
|
130
|
+
showHeader: PropTypes.bool,
|
|
131
|
+
showFooter: PropTypes.bool,
|
|
132
|
+
children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired,
|
|
133
|
+
centered: PropTypes.bool,
|
|
134
|
+
confirmLabel: PropTypes.string,
|
|
135
|
+
modalTitle: PropTypes.string,
|
|
136
|
+
size: PropTypes.oneOf(sizes),
|
|
137
|
+
isOpen: PropTypes.bool,
|
|
138
|
+
onClose: PropTypes.func,
|
|
139
|
+
onAfterOpen: PropTypes.func,
|
|
140
|
+
onConfirm: PropTypes.func,
|
|
141
|
+
onReject: PropTypes.func,
|
|
142
|
+
rejectLabel: PropTypes.string,
|
|
143
|
+
shouldCloseOnOverlayClick: PropTypes.bool,
|
|
144
|
+
hasError: PropTypes.bool,
|
|
145
|
+
hasWarning: PropTypes.bool,
|
|
146
|
+
hasSuccess: PropTypes.bool,
|
|
147
|
+
hasInfo: PropTypes.bool,
|
|
148
|
+
hasHelp: PropTypes.bool,
|
|
149
|
+
actionsRef: PropTypes.func,
|
|
150
|
+
appElement: PropTypes.string,
|
|
151
|
+
overridePropsConfirmButton: PropTypes.shape({}),
|
|
152
|
+
overridePropsRejectButton: PropTypes.shape({})
|
|
153
|
+
};
|
|
154
|
+
var DSModal_default = DSModal;
|
|
155
|
+
export {
|
|
156
|
+
DSModal_default as default
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=DSModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactModal from 'react-modal';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSIconSizes } from '@elliemae/ds-icon';\nimport { Close } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport MODAL_TYPE, { modalTypes } from '../constants';\nimport ModalFeedBack from './ModalFeedBack/ModalFeedBack';\nimport { sizes, iconSizes } from '@elliemae/ds-shared/prop-types';\n\nconst DSModal = ({\n containerProps = {},\n className = '',\n dataTestId = 'ds-modal',\n additionalFooterCssClass = '',\n style = {},\n iconCloseSize = DSIconSizes.S,\n modalType = MODAL_TYPE.DEFAULT,\n showHeader = true,\n showFooter = true,\n children,\n centered = true,\n confirmLabel = 'Accept',\n modalTitle = '',\n size = 'medium',\n isOpen = false,\n onClose = () => null,\n onAfterOpen = () => null,\n onConfirm = () => null,\n onReject = () => null,\n rejectLabel = 'Cancel',\n shouldCloseOnOverlayClick = false,\n hasError = false,\n hasWarning = false,\n hasSuccess = false,\n hasInfo = false,\n hasHelp = false,\n actionsRef = () => null,\n appElement = '#root',\n overridePropsConfirmButton = {},\n overridePropsRejectButton = {},\n zIndex = 10,\n}) => {\n // http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples\n typeof document !== 'undefined' && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement); // eslint-disable-line\n const { cssClassName, classNameElement, classNameBlock, classNameModifier, classNameBlockModifier } =\n convertPropToCssClassName('modal', className, {\n hasError,\n hasWarning,\n hasSuccess,\n modalType,\n size,\n });\n\n const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;\n\n const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;\n const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;\n\n return (\n <ReactModal\n testId={dataTestId}\n className={cssClassName}\n contentLabel={modalTitle}\n isOpen={isOpen}\n onAfterOpen={onAfterOpen}\n onRequestClose={onClose}\n overlayClassName={`${classNameBlock('overlay')} ${classNameModifier(centered && 'center')}`}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n style={{\n content: {\n ...style,\n },\n overlay: {\n zIndex,\n },\n }}\n >\n <div {...containerProps}>\n {showHeader && (\n <div className={classNameBlock('modal-header')}>\n <div className={classNameElement('title', 'modal-header')}>{modalTitle}</div>\n <div className={classNameElement('icon', 'modal-header')}>\n <DSButton buttonType=\"link\" icon={<Close />} onClick={onClose} size={iconCloseSize} />\n </div>\n </div>\n )}\n <div className={classNameElement('body')}>\n {showFeedBack && (\n <ModalFeedBack\n hasError={hasError}\n hasHelp={hasHelp}\n hasInfo={hasInfo}\n hasSuccess={hasSuccess}\n hasWarning={hasWarning}\n modalType={modalType}\n />\n )}\n {children}\n </div>\n {showFooter && !isAFeedbackType && (\n <div\n className={`${classNameBlock('modal-footer')} ${\n additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : ''\n }`}\n >\n <div ref={actionsRef} className={classNameBlock('modal-footer-actions')}>\n {modalType === MODAL_TYPE.CONFIRM && (\n <DSButton\n buttonType=\"secondary\"\n className={`${classNameElement('button-action')} ${classNameModifier('reject', 'button-action')} `}\n labelText={rejectLabel}\n onClick={onReject}\n {...overridePropsRejectButton}\n />\n )}\n <DSButton\n buttonType=\"primary\"\n className={`${classNameElement('button-action')} ${classNameModifier('confirm', 'button-action')} `}\n labelText={confirmLabel}\n onClick={onConfirm}\n {...overridePropsConfirmButton}\n />\n </div>\n </div>\n )}\n </div>\n </ReactModal>\n );\n};\n\nDSModal.propTypes = {\n className: PropTypes.string,\n /**\n * Add an additional css class to the footer\n */\n additionalFooterCssClass: PropTypes.string,\n /**\n * Set style for the modal\n */\n style: PropTypes.shape({}),\n /**\n * Select size for the close icon\n */\n iconCloseSize: PropTypes.oneOf(iconSizes),\n /**\n * ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']\n */\n modalType: PropTypes.oneOf(modalTypes),\n /**\n * Show the header or not\n */\n showHeader: PropTypes.bool,\n /**\n * Show the footer or not\n */\n showFooter: PropTypes.bool,\n /**\n * Main content of the modal\n */\n children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired,\n /**\n * Content is centered or not\n */\n centered: PropTypes.bool,\n /**\n * Text to be added in the confirm button\n */\n confirmLabel: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n modalTitle: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n size: PropTypes.oneOf(sizes),\n /**\n * Modal is open or not\n */\n isOpen: PropTypes.bool,\n /**\n * Allows a function to be triggered once the modal is closed\n */\n onClose: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal is opened\n */\n onAfterOpen: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is confirmed\n */\n onConfirm: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is rejected\n */\n onReject: PropTypes.func,\n /**\n * Text to be added in the reject button\n */\n rejectLabel: PropTypes.string,\n /**\n * If modal should close on overlay click\n */\n shouldCloseOnOverlayClick: PropTypes.bool,\n /**\n * Modal has error or not\n */\n hasError: PropTypes.bool,\n /**\n * Modal has warning or not\n */\n hasWarning: PropTypes.bool,\n /**\n * Modal has success or not\n */\n hasSuccess: PropTypes.bool,\n /**\n * Modal has info or not\n */\n hasInfo: PropTypes.bool,\n /**\n * Modal has help or not\n */\n hasHelp: PropTypes.bool,\n actionsRef: PropTypes.func,\n appElement: PropTypes.string,\n /**\n * Customized props for the confirm button\n */\n overridePropsConfirmButton: PropTypes.shape({}),\n /**\n * Customized props for the reject button\n */\n overridePropsRejectButton: PropTypes.shape({}),\n};\n\nexport default DSModal;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,UAAU,CAAC;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,QAAQ;AAAA,EACR,gBAAgB,YAAY;AAAA,EAC5B,YAAY,WAAW;AAAA,EACvB,aAAa;AAAA,EACb,aAAa;AAAA,EACb;AAAA,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AAa,UAAU;AAAA,EAIvB,WAAW,UAAU;AAAA,EAIrB,UAAU,UAAU;AAAA,EAIpB,aAAa,UAAU;AAAA,EAIvB,2BAA2B,UAAU;AAAA,EAIrC,UAAU,UAAU;AAAA,EAIpB,YAAY,UAAU;AAAA,EAItB,YAAY,UAAU;AAAA,EAItB,SAAS,UAAU;AAAA,EAInB,SAAS,UAAU;AAAA,EACnB,YAAY,UAAU;AAAA,EACtB,YAAY,UAAU;AAAA,EAItB,4BAA4B,UAAU,MAAM;AAAA,EAI5C,2BAA2B,UAAU,MAAM;AAAA;AAG7C,IAAO,kBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const modalTypes = [
|
|
3
|
+
MODAL_TYPE.DEFAULT,
|
|
4
|
+
MODAL_TYPE.ALERT,
|
|
5
|
+
MODAL_TYPE.CONFIRM,
|
|
6
|
+
MODAL_TYPE.NOTIFICATION,
|
|
7
|
+
MODAL_TYPE.WARNING,
|
|
8
|
+
MODAL_TYPE.ERROR,
|
|
9
|
+
MODAL_TYPE.SUCCESS,
|
|
10
|
+
MODAL_TYPE.HELP,
|
|
11
|
+
MODAL_TYPE.INFO
|
|
12
|
+
];
|
|
13
|
+
export {
|
|
14
|
+
modalTypes
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=DSModalType.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModalType.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const modalTypes = [\n MODAL_TYPE.DEFAULT,\n MODAL_TYPE.ALERT,\n MODAL_TYPE.CONFIRM,\n MODAL_TYPE.NOTIFICATION,\n MODAL_TYPE.WARNING,\n MODAL_TYPE.ERROR,\n MODAL_TYPE.SUCCESS,\n MODAL_TYPE.HELP,\n MODAL_TYPE.INFO,\n];\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,aAAa;AAAA,EACxB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import { Component, createElement } from "react";
|
|
22
|
+
import { MODAL_TYPE } from "../constants";
|
|
23
|
+
var DSModalWrapper_default = (WrappedComponent) => {
|
|
24
|
+
class DSModalWrapper extends Component {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.state = {
|
|
28
|
+
childready: false,
|
|
29
|
+
additionalFooterCssClass: "loading",
|
|
30
|
+
container: null,
|
|
31
|
+
actions: null,
|
|
32
|
+
height: "100%"
|
|
33
|
+
};
|
|
34
|
+
this.onHeaderHeight = (e) => {
|
|
35
|
+
this.heightHeaderFlag = true;
|
|
36
|
+
this.heightHeader = e.height || 0;
|
|
37
|
+
};
|
|
38
|
+
this.onFooterHeight = (e) => {
|
|
39
|
+
this.heightFooterFlag = true;
|
|
40
|
+
this.heightFooter = e.height || 0;
|
|
41
|
+
};
|
|
42
|
+
this.onResize = ({ bounds }) => {
|
|
43
|
+
if (this.heightFooterFlag && this.heightHeaderFlag) {
|
|
44
|
+
return this.setState({
|
|
45
|
+
height: bounds.height - this.heightFooter - this.heightHeader
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return setTimeout(this.onResize({ bounds }), 0);
|
|
49
|
+
};
|
|
50
|
+
this.handleContainer = (node) => {
|
|
51
|
+
if (node)
|
|
52
|
+
this.setState({ container: node });
|
|
53
|
+
this.handleResize();
|
|
54
|
+
};
|
|
55
|
+
this.handleActions = (node) => {
|
|
56
|
+
if (node)
|
|
57
|
+
this.setState({ actions: node });
|
|
58
|
+
this.handleResize();
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
window.addEventListener("resize", this.handleResize);
|
|
63
|
+
}
|
|
64
|
+
componentWillUnmount() {
|
|
65
|
+
window.removeEventListener("resize", this.handleResize);
|
|
66
|
+
}
|
|
67
|
+
handleResize() {
|
|
68
|
+
if (!this.state)
|
|
69
|
+
return null;
|
|
70
|
+
const { container, actions, childready } = this.state;
|
|
71
|
+
if (!childready)
|
|
72
|
+
return null;
|
|
73
|
+
this.setState({ additionalFooterCssClass: null });
|
|
74
|
+
const { clientWidth: containerWidth } = container;
|
|
75
|
+
const { clientWidth: actionsWidth } = actions;
|
|
76
|
+
if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
|
|
77
|
+
return this.setState({ additionalFooterCssClass: "fluid-actions" });
|
|
78
|
+
}
|
|
79
|
+
return this.setState({ additionalFooterCssClass: null });
|
|
80
|
+
}
|
|
81
|
+
verifyNodes() {
|
|
82
|
+
const { modalType } = this.props;
|
|
83
|
+
if (modalType !== MODAL_TYPE.DEFAULT) {
|
|
84
|
+
const nodesInterval = setInterval(() => {
|
|
85
|
+
const { container, actions } = this.state;
|
|
86
|
+
if (!container || !actions)
|
|
87
|
+
return null;
|
|
88
|
+
clearInterval(nodesInterval);
|
|
89
|
+
this.setState({ childready: true });
|
|
90
|
+
return this.handleResize();
|
|
91
|
+
}, 100);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
const { props, state } = this;
|
|
96
|
+
const { additionalFooterCssClass, height } = state;
|
|
97
|
+
return createElement(WrappedComponent, __spreadProps(__spreadValues({}, props), {
|
|
98
|
+
height,
|
|
99
|
+
onResize: this.onResize,
|
|
100
|
+
onFooterHeight: this.onFooterHeight,
|
|
101
|
+
onHeaderHeight: this.onHeaderHeight,
|
|
102
|
+
containerRef: this.handleContainer,
|
|
103
|
+
actionsRef: this.handleActions,
|
|
104
|
+
additionalFooterCssClass,
|
|
105
|
+
onAfterOpen: () => {
|
|
106
|
+
if (props.onAfterOpen)
|
|
107
|
+
props.onAfterOpen();
|
|
108
|
+
this.verifyNodes();
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return DSModalWrapper;
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
DSModalWrapper_default as default
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=DSModalWrapper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModalWrapper.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AAEA,IAAO,yBAAQ,CAAC,qBAAqB;AACnC,+BAA6B,UAAU;AAAA,IAAvC,cAJF;AAIE;AACE,mBAAQ;AAAA,QACN,YAAY;AAAA,QACZ,0BAA0B;AAAA,QAC1B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,QAAQ;AAAA;AAWV,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA;AAGlC,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA;AAGlC,sBAAW,CAAC,EAAE,aAAa;AACzB,YAAI,KAAK,oBAAoB,KAAK,kBAAkB;AAClD,iBAAO,KAAK,SAAS;AAAA,YACnB,QAAQ,OAAO,SAAS,KAAK,eAAe,KAAK;AAAA;AAAA;AAGrD,eAAO,WAAW,KAAK,SAAS,EAAE,WAAW;AAAA;AAG/C,6BAAkB,CAAC,SAAS;AAC1B,YAAI;AAAM,eAAK,SAAS,EAAE,WAAW;AACrC,aAAK;AAAA;AAGP,2BAAgB,CAAC,SAAS;AACxB,YAAI;AAAM,eAAK,SAAS,EAAE,SAAS;AACnC,aAAK;AAAA;AAAA;AAAA,IAlCP,oBAAoB;AAClB,aAAO,iBAAiB,UAAU,KAAK;AAAA;AAAA,IAGzC,uBAAuB;AACrB,aAAO,oBAAoB,UAAU,KAAK;AAAA;AAAA,IAoC5C,eAAe;AACb,UAAI,CAAC,KAAK;AAAO,eAAO;AACxB,YAAM,EAAE,WAAW,SAAS,eAAe,KAAK;AAChD,UAAI,CAAC;AAAY,eAAO;AACxB,WAAK,SAAS,EAAE,0BAA0B;AAC1C,YAAM,EAAE,aAAa,mBAAmB;AACxC,YAAM,EAAE,aAAa,iBAAiB;AAEtC,UACE,kBACA,gBACC,eAAe,iBAAkB,MAAM,IACxC;AACA,eAAO,KAAK,SAAS,EAAE,0BAA0B;AAAA;AAEnD,aAAO,KAAK,SAAS,EAAE,0BAA0B;AAAA;AAAA,IAGnD,cAAc;AACZ,YAAM,EAAE,cAAc,KAAK;AAC3B,UAAI,cAAc,WAAW,SAAS;AACpC,cAAM,gBAAgB,YAAY,MAAM;AAEtC,gBAAM,EAAE,WAAW,YAAY,KAAK;AACpC,cAAI,CAAC,aAAa,CAAC;AAAS,mBAAO;AACnC,wBAAc;AACd,eAAK,SAAS,EAAE,YAAY;AAC5B,iBAAO,KAAK;AAAA,WACX;AAAA;AAAA;AAAA,IAIP,SAAS;AACP,YAAM,EAAE,OAAO,UAAU;AACzB,YAAM,EAAE,0BAA0B,WAAW;AAC7C,aAAO,cAAc,kBAAkB,iCAClC,QADkC;AAAA,QAErC;AAAA,QACA,UAAU,KAAK;AAAA,QACf,gBAAgB,KAAK;AAAA,QACrB,gBAAgB,KAAK;AAAA,QACrB,cAAc,KAAK;AAAA,QACnB,YAAY,KAAK;AAAA,QACjB;AAAA,QACA,aAAa,MAAM;AACjB,cAAI,MAAM;AAAa,kBAAM;AAC7B,eAAK;AAAA;AAAA;AAAA;AAAA;AAMb,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { WarningCircle, CheckmarkCircle, HelpCircle, InfoCircle } from "@elliemae/ds-icons";
|
|
4
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
|
+
import { MODAL_TYPE } from "../../constants";
|
|
6
|
+
const feedbackIconSize = "xxl";
|
|
7
|
+
const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;
|
|
8
|
+
const getModalType = (modalType, { hasError, hasWarning, hasSuccess, hasInfo, hasHelp }) => {
|
|
9
|
+
if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1)
|
|
10
|
+
return modalType;
|
|
11
|
+
if (hasError)
|
|
12
|
+
return ERROR;
|
|
13
|
+
if (hasWarning)
|
|
14
|
+
return WARNING;
|
|
15
|
+
if (hasSuccess)
|
|
16
|
+
return SUCCESS;
|
|
17
|
+
if (hasHelp)
|
|
18
|
+
return HELP;
|
|
19
|
+
if (hasInfo)
|
|
20
|
+
return INFO;
|
|
21
|
+
return INFO;
|
|
22
|
+
};
|
|
23
|
+
const getIconType = (modalType) => {
|
|
24
|
+
switch (modalType) {
|
|
25
|
+
case WARNING:
|
|
26
|
+
case ERROR:
|
|
27
|
+
return /* @__PURE__ */ React2.createElement(WarningCircle, {
|
|
28
|
+
size: feedbackIconSize
|
|
29
|
+
});
|
|
30
|
+
case SUCCESS:
|
|
31
|
+
return /* @__PURE__ */ React2.createElement(CheckmarkCircle, {
|
|
32
|
+
size: feedbackIconSize
|
|
33
|
+
});
|
|
34
|
+
case HELP:
|
|
35
|
+
return /* @__PURE__ */ React2.createElement(HelpCircle, {
|
|
36
|
+
size: feedbackIconSize
|
|
37
|
+
});
|
|
38
|
+
case INFO:
|
|
39
|
+
return /* @__PURE__ */ React2.createElement(InfoCircle, {
|
|
40
|
+
size: feedbackIconSize
|
|
41
|
+
});
|
|
42
|
+
default:
|
|
43
|
+
return /* @__PURE__ */ React2.createElement(InfoCircle, {
|
|
44
|
+
size: feedbackIconSize
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const ModalFeedBack = ({
|
|
49
|
+
className = "",
|
|
50
|
+
modalType = null,
|
|
51
|
+
hasError = false,
|
|
52
|
+
hasWarning = false,
|
|
53
|
+
hasSuccess = false,
|
|
54
|
+
hasInfo = false,
|
|
55
|
+
hasHelp = false
|
|
56
|
+
}) => {
|
|
57
|
+
const type = getModalType(modalType, {
|
|
58
|
+
hasError,
|
|
59
|
+
hasWarning,
|
|
60
|
+
hasSuccess,
|
|
61
|
+
hasInfo,
|
|
62
|
+
hasHelp
|
|
63
|
+
});
|
|
64
|
+
const { cssClassName } = convertPropToCssClassName("modal-feedback", className, { modalType: type });
|
|
65
|
+
const feedbackIcon = getIconType(type);
|
|
66
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
67
|
+
className: cssClassName
|
|
68
|
+
}, feedbackIcon);
|
|
69
|
+
};
|
|
70
|
+
var ModalFeedBack_default = ModalFeedBack;
|
|
71
|
+
export {
|
|
72
|
+
ModalFeedBack_default as default
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=ModalFeedBack.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/v1/ModalFeedBack/ModalFeedBack.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { WarningCircle, CheckmarkCircle, HelpCircle, InfoCircle } from '@elliemae/ds-icons';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { MODAL_TYPE } from '../../constants';\n\nconst feedbackIconSize = 'xxl';\n\nconst { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;\n\nconst getModalType = (modalType, { hasError, hasWarning, hasSuccess, hasInfo, hasHelp }) => {\n if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;\n if (hasError) return ERROR;\n if (hasWarning) return WARNING;\n if (hasSuccess) return SUCCESS;\n if (hasHelp) return HELP;\n if (hasInfo) return INFO;\n return INFO;\n};\n\nconst getIconType = (modalType) => {\n switch (modalType) {\n case WARNING:\n case ERROR:\n return <WarningCircle size={feedbackIconSize} />;\n case SUCCESS:\n return <CheckmarkCircle size={feedbackIconSize} />;\n case HELP:\n return <HelpCircle size={feedbackIconSize} />;\n case INFO:\n return <InfoCircle size={feedbackIconSize} />;\n default:\n return <InfoCircle size={feedbackIconSize} />;\n }\n};\n\nconst ModalFeedBack = ({\n className = '',\n modalType = null,\n hasError = false,\n hasWarning = false,\n hasSuccess = false,\n hasInfo = false,\n hasHelp = false,\n}) => {\n const type = getModalType(modalType, {\n hasError,\n hasWarning,\n hasSuccess,\n hasInfo,\n hasHelp,\n });\n const { cssClassName } = convertPropToCssClassName('modal-feedback', className, { modalType: type });\n const feedbackIcon = getIconType(type);\n\n return <div className={cssClassName}>{feedbackIcon}</div>;\n};\n\nexport default ModalFeedBack;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB;AAEzB,MAAM,EAAE,SAAS,OAAO,SAAS,MAAM,SAAS;AAEhD,MAAM,eAAe,CAAC,WAAW,EAAE,UAAU,YAAY,YAAY,SAAS,cAAc;AAC1F,MAAI,CAAC,SAAS,OAAO,SAAS,MAAM,MAAM,QAAQ,aAAa;AAAI,WAAO;AAC1E,MAAI;AAAU,WAAO;AACrB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAS,WAAO;AACpB,MAAI;AAAS,WAAO;AACpB,SAAO;AAAA;AAGT,MAAM,cAAc,CAAC,cAAc;AACjC,UAAQ;AAAA,SACD;AAAA,SACA;AACH,aAAO,qCAAC,eAAD;AAAA,QAAe,MAAM;AAAA;AAAA,SACzB;AACH,aAAO,qCAAC,iBAAD;AAAA,QAAiB,MAAM;AAAA;AAAA,SAC3B;AACH,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AAAA,SACtB;AACH,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AAAA;AAEzB,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AA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