@elliemae/ds-modal 3.27.0-next.1 → 3.27.0-next.2
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/index.js +4 -10
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +3 -10
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +2 -3
- package/package.json +6 -81
- package/dist/cjs/DSModal.js +0 -168
- package/dist/cjs/DSModal.js.map +0 -7
- package/dist/cjs/constants.js +0 -74
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/v1/DSModal.js +0 -265
- package/dist/cjs/v1/DSModal.js.map +0 -7
- package/dist/cjs/v1/DSModalType.js +0 -46
- package/dist/cjs/v1/DSModalType.js.map +0 -7
- package/dist/cjs/v1/DSModalWrapper.js +0 -134
- package/dist/cjs/v1/DSModalWrapper.js.map +0 -7
- package/dist/cjs/v1/ModalFeedBack/ModalFeedBack.js +0 -92
- package/dist/cjs/v1/ModalFeedBack/ModalFeedBack.js.map +0 -7
- package/dist/cjs/v2/DSModal.js +0 -200
- package/dist/cjs/v2/DSModal.js.map +0 -7
- package/dist/cjs/v2/blocks.js +0 -76
- package/dist/cjs/v2/blocks.js.map +0 -7
- package/dist/cjs/v2/components/DecisionHeader.js +0 -50
- package/dist/cjs/v2/components/DecisionHeader.js.map +0 -7
- package/dist/cjs/v2/components/FeedbackIcon.js +0 -57
- package/dist/cjs/v2/components/FeedbackIcon.js.map +0 -7
- package/dist/cjs/v2/components/Footer.js +0 -74
- package/dist/cjs/v2/components/Footer.js.map +0 -7
- package/dist/cjs/v2/components/FormHeader.js +0 -54
- package/dist/cjs/v2/components/FormHeader.js.map +0 -7
- package/dist/cjs/v2/components/ModalContent.js +0 -89
- package/dist/cjs/v2/components/ModalContent.js.map +0 -7
- package/dist/cjs/v2/components/SelectionHeader.js +0 -45
- package/dist/cjs/v2/components/SelectionHeader.js.map +0 -7
- package/dist/cjs/v2/components/Title.js +0 -40
- package/dist/cjs/v2/components/Title.js.map +0 -7
- package/dist/cjs/v2/helpers.js +0 -55
- package/dist/cjs/v2/helpers.js.map +0 -7
- package/dist/esm/DSModal.js +0 -138
- package/dist/esm/DSModal.js.map +0 -7
- package/dist/esm/constants.js +0 -44
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/v1/DSModal.js +0 -235
- package/dist/esm/v1/DSModal.js.map +0 -7
- package/dist/esm/v1/DSModalType.js +0 -16
- package/dist/esm/v1/DSModalType.js.map +0 -7
- package/dist/esm/v1/DSModalWrapper.js +0 -104
- package/dist/esm/v1/DSModalWrapper.js.map +0 -7
- package/dist/esm/v1/ModalFeedBack/ModalFeedBack.js +0 -62
- package/dist/esm/v1/ModalFeedBack/ModalFeedBack.js.map +0 -7
- package/dist/esm/v2/DSModal.js +0 -170
- package/dist/esm/v2/DSModal.js.map +0 -7
- package/dist/esm/v2/blocks.js +0 -46
- package/dist/esm/v2/blocks.js.map +0 -7
- package/dist/esm/v2/components/DecisionHeader.js +0 -20
- package/dist/esm/v2/components/DecisionHeader.js.map +0 -7
- package/dist/esm/v2/components/FeedbackIcon.js +0 -27
- package/dist/esm/v2/components/FeedbackIcon.js.map +0 -7
- package/dist/esm/v2/components/Footer.js +0 -44
- package/dist/esm/v2/components/Footer.js.map +0 -7
- package/dist/esm/v2/components/FormHeader.js +0 -24
- package/dist/esm/v2/components/FormHeader.js.map +0 -7
- package/dist/esm/v2/components/ModalContent.js +0 -59
- package/dist/esm/v2/components/ModalContent.js.map +0 -7
- package/dist/esm/v2/components/SelectionHeader.js +0 -15
- package/dist/esm/v2/components/SelectionHeader.js.map +0 -7
- package/dist/esm/v2/components/Title.js +0 -10
- package/dist/esm/v2/components/Title.js.map +0 -7
- package/dist/esm/v2/helpers.js +0 -25
- package/dist/esm/v2/helpers.js.map +0 -7
- package/dist/types/DSModal.d.ts +0 -13
- package/dist/types/constants.d.ts +0 -25
- package/dist/types/v1/DSModal.d.ts +0 -142
- package/dist/types/v1/DSModalType.d.ts +0 -1
- package/dist/types/v1/DSModalWrapper.d.ts +0 -133
- package/dist/types/v1/ModalFeedBack/ModalFeedBack.d.ts +0 -10
- package/dist/types/v2/DSModal.d.ts +0 -120
- package/dist/types/v2/blocks.d.ts +0 -9
- package/dist/types/v2/components/DecisionHeader.d.ts +0 -5
- package/dist/types/v2/components/FeedbackIcon.d.ts +0 -4
- package/dist/types/v2/components/Footer.d.ts +0 -12
- package/dist/types/v2/components/FormHeader.d.ts +0 -7
- package/dist/types/v2/components/ModalContent.d.ts +0 -20
- package/dist/types/v2/components/SelectionHeader.d.ts +0 -7
- package/dist/types/v2/components/Title.d.ts +0 -5
- package/dist/types/v2/components/tests/DecisionHeader.test.d.ts +0 -1
- package/dist/types/v2/components/tests/FeedbackIcon.test.d.ts +0 -1
- package/dist/types/v2/components/tests/Footer.test.d.ts +0 -1
- package/dist/types/v2/components/tests/FormHeader.test.d.ts +0 -1
- package/dist/types/v2/components/tests/SelectionHeader.test.d.ts +0 -1
- package/dist/types/v2/helpers.d.ts +0 -16
- package/dist/types/v2/tests/DSModal.test.d.ts +0 -1
package/dist/esm/v1/DSModal.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import ReactModal from "react-modal";
|
|
5
|
-
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
6
|
-
import { DSIconSizes } from "@elliemae/ds-icon";
|
|
7
|
-
import { Close } from "@elliemae/ds-icons";
|
|
8
|
-
import DSButton from "@elliemae/ds-button";
|
|
9
|
-
import MODAL_TYPE, { modalTypes } from "../constants.js";
|
|
10
|
-
import ModalFeedBack from "./ModalFeedBack/ModalFeedBack.js";
|
|
11
|
-
import { sizes, iconSizes } from "@elliemae/ds-shared";
|
|
12
|
-
const DSModal = ({
|
|
13
|
-
containerProps = {},
|
|
14
|
-
className = "",
|
|
15
|
-
dataTestId = "ds-modal",
|
|
16
|
-
additionalFooterCssClass = "",
|
|
17
|
-
style = {},
|
|
18
|
-
iconCloseSize = DSIconSizes.S,
|
|
19
|
-
modalType = MODAL_TYPE.DEFAULT,
|
|
20
|
-
showHeader = true,
|
|
21
|
-
showFooter = true,
|
|
22
|
-
children,
|
|
23
|
-
centered = true,
|
|
24
|
-
confirmLabel = "Accept",
|
|
25
|
-
modalTitle = "",
|
|
26
|
-
size = "medium",
|
|
27
|
-
isOpen = false,
|
|
28
|
-
onClose = () => null,
|
|
29
|
-
onAfterOpen = () => null,
|
|
30
|
-
onConfirm = () => null,
|
|
31
|
-
onReject = () => null,
|
|
32
|
-
rejectLabel = "Cancel",
|
|
33
|
-
shouldCloseOnOverlayClick = false,
|
|
34
|
-
hasError = false,
|
|
35
|
-
hasWarning = false,
|
|
36
|
-
hasSuccess = false,
|
|
37
|
-
hasInfo = false,
|
|
38
|
-
hasHelp = false,
|
|
39
|
-
actionsRef = () => null,
|
|
40
|
-
appElement = "body",
|
|
41
|
-
overridePropsConfirmButton = {},
|
|
42
|
-
overridePropsRejectButton = {},
|
|
43
|
-
zIndex = 10
|
|
44
|
-
}) => {
|
|
45
|
-
typeof document !== "undefined" && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement);
|
|
46
|
-
const { cssClassName, classNameElement, classNameBlock, classNameModifier, classNameBlockModifier } = convertPropToCssClassName("modal", className, {
|
|
47
|
-
hasError,
|
|
48
|
-
hasWarning,
|
|
49
|
-
hasSuccess,
|
|
50
|
-
modalType,
|
|
51
|
-
size
|
|
52
|
-
});
|
|
53
|
-
const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;
|
|
54
|
-
const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
|
|
55
|
-
const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
|
|
56
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
-
ReactModal,
|
|
58
|
-
{
|
|
59
|
-
testId: dataTestId,
|
|
60
|
-
className: cssClassName,
|
|
61
|
-
contentLabel: modalTitle,
|
|
62
|
-
isOpen,
|
|
63
|
-
onAfterOpen,
|
|
64
|
-
onRequestClose: onClose,
|
|
65
|
-
overlayClassName: `${classNameBlock("overlay")} ${classNameModifier(centered && "center")}`,
|
|
66
|
-
shouldCloseOnOverlayClick,
|
|
67
|
-
style: {
|
|
68
|
-
content: {
|
|
69
|
-
...style
|
|
70
|
-
},
|
|
71
|
-
overlay: {
|
|
72
|
-
zIndex
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
children: /* @__PURE__ */ jsxs("div", { ...containerProps, children: [
|
|
76
|
-
showHeader && /* @__PURE__ */ jsxs("div", { className: classNameBlock("modal-header"), children: [
|
|
77
|
-
/* @__PURE__ */ jsx("div", { className: classNameElement("title", "modal-header"), children: modalTitle }),
|
|
78
|
-
/* @__PURE__ */ jsx("div", { className: classNameElement("icon", "modal-header"), children: /* @__PURE__ */ jsx(DSButton, { buttonType: "link", icon: /* @__PURE__ */ jsx(Close, {}), onClick: onClose, size: iconCloseSize }) })
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ jsxs("div", { className: classNameElement("body"), children: [
|
|
81
|
-
showFeedBack && /* @__PURE__ */ jsx(
|
|
82
|
-
ModalFeedBack,
|
|
83
|
-
{
|
|
84
|
-
hasError,
|
|
85
|
-
hasHelp,
|
|
86
|
-
hasInfo,
|
|
87
|
-
hasSuccess,
|
|
88
|
-
hasWarning,
|
|
89
|
-
modalType
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
children
|
|
93
|
-
] }),
|
|
94
|
-
showFooter && !isAFeedbackType && /* @__PURE__ */ jsx(
|
|
95
|
-
"div",
|
|
96
|
-
{
|
|
97
|
-
className: `${classNameBlock("modal-footer")} ${additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, "modal-footer") : ""}`,
|
|
98
|
-
children: /* @__PURE__ */ jsxs("div", { ref: actionsRef, className: classNameBlock("modal-footer-actions"), children: [
|
|
99
|
-
modalType === MODAL_TYPE.CONFIRM && /* @__PURE__ */ jsx(
|
|
100
|
-
DSButton,
|
|
101
|
-
{
|
|
102
|
-
buttonType: "secondary",
|
|
103
|
-
className: `${classNameElement("button-action")} ${classNameModifier("reject", "button-action")} `,
|
|
104
|
-
labelText: rejectLabel,
|
|
105
|
-
onClick: onReject,
|
|
106
|
-
...overridePropsRejectButton
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
DSButton,
|
|
111
|
-
{
|
|
112
|
-
buttonType: "primary",
|
|
113
|
-
className: `${classNameElement("button-action")} ${classNameModifier("confirm", "button-action")} `,
|
|
114
|
-
labelText: confirmLabel,
|
|
115
|
-
onClick: onConfirm,
|
|
116
|
-
...overridePropsConfirmButton
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
] })
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
] })
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
DSModal.propTypes = {
|
|
127
|
-
className: PropTypes.string,
|
|
128
|
-
/**
|
|
129
|
-
* Add an additional css class to the footer
|
|
130
|
-
*/
|
|
131
|
-
additionalFooterCssClass: PropTypes.string,
|
|
132
|
-
/**
|
|
133
|
-
* Set style for the modal
|
|
134
|
-
*/
|
|
135
|
-
style: PropTypes.shape({}),
|
|
136
|
-
/**
|
|
137
|
-
* Select size for the close icon
|
|
138
|
-
*/
|
|
139
|
-
iconCloseSize: PropTypes.oneOf(iconSizes),
|
|
140
|
-
/**
|
|
141
|
-
* ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']
|
|
142
|
-
*/
|
|
143
|
-
modalType: PropTypes.oneOf(modalTypes),
|
|
144
|
-
/**
|
|
145
|
-
* Show the header or not
|
|
146
|
-
*/
|
|
147
|
-
showHeader: PropTypes.bool,
|
|
148
|
-
/**
|
|
149
|
-
* Show the footer or not
|
|
150
|
-
*/
|
|
151
|
-
showFooter: PropTypes.bool,
|
|
152
|
-
/**
|
|
153
|
-
* Main content of the modal
|
|
154
|
-
*/
|
|
155
|
-
children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired,
|
|
156
|
-
/**
|
|
157
|
-
* Content is centered or not
|
|
158
|
-
*/
|
|
159
|
-
centered: PropTypes.bool,
|
|
160
|
-
/**
|
|
161
|
-
* Text to be added in the confirm button
|
|
162
|
-
*/
|
|
163
|
-
confirmLabel: PropTypes.string,
|
|
164
|
-
/**
|
|
165
|
-
* Text to be added in the modal title
|
|
166
|
-
*/
|
|
167
|
-
modalTitle: PropTypes.string,
|
|
168
|
-
/**
|
|
169
|
-
* Text to be added in the modal title
|
|
170
|
-
*/
|
|
171
|
-
size: PropTypes.oneOf(sizes),
|
|
172
|
-
/**
|
|
173
|
-
* Modal is open or not
|
|
174
|
-
*/
|
|
175
|
-
isOpen: PropTypes.bool,
|
|
176
|
-
/**
|
|
177
|
-
* Allows a function to be triggered once the modal is closed
|
|
178
|
-
*/
|
|
179
|
-
onClose: PropTypes.func,
|
|
180
|
-
/**
|
|
181
|
-
* Allows a function to be triggered once the modal is opened
|
|
182
|
-
*/
|
|
183
|
-
onAfterOpen: PropTypes.func,
|
|
184
|
-
/**
|
|
185
|
-
* Allows a function to be triggered once the modal open is confirmed
|
|
186
|
-
*/
|
|
187
|
-
onConfirm: PropTypes.func,
|
|
188
|
-
/**
|
|
189
|
-
* Allows a function to be triggered once the modal open is rejected
|
|
190
|
-
*/
|
|
191
|
-
onReject: PropTypes.func,
|
|
192
|
-
/**
|
|
193
|
-
* Text to be added in the reject button
|
|
194
|
-
*/
|
|
195
|
-
rejectLabel: PropTypes.string,
|
|
196
|
-
/**
|
|
197
|
-
* If modal should close on overlay click
|
|
198
|
-
*/
|
|
199
|
-
shouldCloseOnOverlayClick: PropTypes.bool,
|
|
200
|
-
/**
|
|
201
|
-
* Modal has error or not
|
|
202
|
-
*/
|
|
203
|
-
hasError: PropTypes.bool,
|
|
204
|
-
/**
|
|
205
|
-
* Modal has warning or not
|
|
206
|
-
*/
|
|
207
|
-
hasWarning: PropTypes.bool,
|
|
208
|
-
/**
|
|
209
|
-
* Modal has success or not
|
|
210
|
-
*/
|
|
211
|
-
hasSuccess: PropTypes.bool,
|
|
212
|
-
/**
|
|
213
|
-
* Modal has info or not
|
|
214
|
-
*/
|
|
215
|
-
hasInfo: PropTypes.bool,
|
|
216
|
-
/**
|
|
217
|
-
* Modal has help or not
|
|
218
|
-
*/
|
|
219
|
-
hasHelp: PropTypes.bool,
|
|
220
|
-
actionsRef: PropTypes.func,
|
|
221
|
-
appElement: PropTypes.string,
|
|
222
|
-
/**
|
|
223
|
-
* Customized props for the confirm button
|
|
224
|
-
*/
|
|
225
|
-
overridePropsConfirmButton: PropTypes.shape({}),
|
|
226
|
-
/**
|
|
227
|
-
* Customized props for the reject button
|
|
228
|
-
*/
|
|
229
|
-
overridePropsRejectButton: PropTypes.shape({})
|
|
230
|
-
};
|
|
231
|
-
var DSModal_default = DSModal;
|
|
232
|
-
export {
|
|
233
|
-
DSModal_default as default
|
|
234
|
-
};
|
|
235
|
-
//# sourceMappingURL=DSModal.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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.js';\nimport ModalFeedBack from './ModalFeedBack/ModalFeedBack.js';\nimport { sizes, iconSizes } from '@elliemae/ds-shared';\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 = 'body',\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,YAAY,WAAW;ACkFb,SACE,KADF;AAhFV,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,OAAO,cAAc;AACrB,OAAO,cAAc,kBAAkB;AACvC,OAAO,mBAAmB;AAC1B,SAAS,OAAO,iBAAiB;AAEjC,MAAM,UAAU,CAAC;AAAA,EACf,iBAAiB,CAAC;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,QAAQ,CAAC;AAAA,EACT,gBAAg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AAO,kBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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,YAAY,WAAW;ACAhB,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;AACb;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Component, createElement } from "react";
|
|
3
|
-
import { MODAL_TYPE } from "../constants.js";
|
|
4
|
-
var DSModalWrapper_default = (WrappedComponent) => {
|
|
5
|
-
class DSModalWrapper extends Component {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.state = {
|
|
9
|
-
childready: false,
|
|
10
|
-
additionalFooterCssClass: "loading",
|
|
11
|
-
container: null,
|
|
12
|
-
actions: null,
|
|
13
|
-
height: "100%"
|
|
14
|
-
};
|
|
15
|
-
this.onHeaderHeight = (e) => {
|
|
16
|
-
this.heightHeaderFlag = true;
|
|
17
|
-
this.heightHeader = e.height || 0;
|
|
18
|
-
};
|
|
19
|
-
this.onFooterHeight = (e) => {
|
|
20
|
-
this.heightFooterFlag = true;
|
|
21
|
-
this.heightFooter = e.height || 0;
|
|
22
|
-
};
|
|
23
|
-
this.onResize = ({ bounds }) => {
|
|
24
|
-
if (this.heightFooterFlag && this.heightHeaderFlag) {
|
|
25
|
-
return this.setState({
|
|
26
|
-
height: bounds.height - this.heightFooter - this.heightHeader
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return setTimeout(this.onResize({ bounds }), 0);
|
|
30
|
-
};
|
|
31
|
-
this.handleContainer = (node) => {
|
|
32
|
-
if (node)
|
|
33
|
-
this.setState({ container: node });
|
|
34
|
-
this.handleResize();
|
|
35
|
-
};
|
|
36
|
-
this.handleActions = (node) => {
|
|
37
|
-
if (node)
|
|
38
|
-
this.setState({ actions: node });
|
|
39
|
-
this.handleResize();
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Change button width to 100% if the
|
|
43
|
-
* combined width of the button (or button group) exceed 50% of the container width.
|
|
44
|
-
*/
|
|
45
|
-
this.handleResize = () => {
|
|
46
|
-
if (!this.state)
|
|
47
|
-
return null;
|
|
48
|
-
const { container, actions, childready } = this.state;
|
|
49
|
-
if (!childready)
|
|
50
|
-
return null;
|
|
51
|
-
this.setState({ additionalFooterCssClass: null });
|
|
52
|
-
const { clientWidth: containerWidth } = container;
|
|
53
|
-
const { clientWidth: actionsWidth } = actions;
|
|
54
|
-
if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
|
|
55
|
-
return this.setState({ additionalFooterCssClass: "fluid-actions" });
|
|
56
|
-
}
|
|
57
|
-
return this.setState({ additionalFooterCssClass: null });
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
componentDidMount() {
|
|
61
|
-
window.addEventListener("resize", this.handleResize);
|
|
62
|
-
}
|
|
63
|
-
componentWillUnmount() {
|
|
64
|
-
window.removeEventListener("resize", this.handleResize);
|
|
65
|
-
}
|
|
66
|
-
verifyNodes() {
|
|
67
|
-
const { modalType } = this.props;
|
|
68
|
-
if (modalType !== MODAL_TYPE.DEFAULT) {
|
|
69
|
-
const nodesInterval = setInterval(() => {
|
|
70
|
-
const { container, actions } = this.state;
|
|
71
|
-
if (!container || !actions)
|
|
72
|
-
return null;
|
|
73
|
-
clearInterval(nodesInterval);
|
|
74
|
-
this.setState({ childready: true });
|
|
75
|
-
return this.handleResize();
|
|
76
|
-
}, 100);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
render() {
|
|
80
|
-
const { props, state } = this;
|
|
81
|
-
const { additionalFooterCssClass, height } = state;
|
|
82
|
-
return createElement(WrappedComponent, {
|
|
83
|
-
...props,
|
|
84
|
-
height,
|
|
85
|
-
onResize: this.onResize,
|
|
86
|
-
onFooterHeight: this.onFooterHeight,
|
|
87
|
-
onHeaderHeight: this.onHeaderHeight,
|
|
88
|
-
containerRef: this.handleContainer,
|
|
89
|
-
actionsRef: this.handleActions,
|
|
90
|
-
additionalFooterCssClass,
|
|
91
|
-
onAfterOpen: () => {
|
|
92
|
-
if (props.onAfterOpen)
|
|
93
|
-
props.onAfterOpen();
|
|
94
|
-
this.verifyNodes();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return DSModalWrapper;
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
DSModalWrapper_default as default
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=DSModalWrapper.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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.js';\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 (containerWidth && actionsWidth && (actionsWidth / containerWidth) * 100 > 50) {\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,YAAY,WAAW;ACAvB,SAAS,WAAW,qBAAqB;AACzC,SAAS,kBAAkB;AAE3B,IAAO,yBAAQ,CAAC,qBAAqB;AACnC,QAAM,uBAAuB,UAAU;AAAA,IAAvC;AAAA;AACE,mBAAQ;AAAA,QACN,YAAY;AAAA,QACZ,0BAA0B;AAAA,QAC1B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,QAAQ;AAAA,MACV;AAUA,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA,MAClC;AAEA,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA,MAClC;AAEA,sBAAW,CAAC,EAAE,OAAO,MAAM;AACzB,YAAI,KAAK,oBAAoB,KAAK,kBAAkB;AAClD,iBAAO,KAAK,SAAS;AAAA,YACnB,QAAQ,OAAO,SAAS,KAAK,eAAe,KAAK;AAAA,UACnD,CAAC;AAAA,QACH;AACA,eAAO,WAAW,KAAK,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC;AAAA,MAChD;AAEA,6BAAkB,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0BAA0B,OAAO,IAAI;AAC7C,aAAO,cAAc,kBAAkB;AAAA,QACrC,GAAG;AAAA,QACH;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,YAAY;AACzC,eAAK,YAAY;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { WarningCircle, CheckmarkCircle, HelpCircle, InfoCircle } from "@elliemae/ds-icons";
|
|
4
|
-
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
|
-
import { MODAL_TYPE } from "../../constants.js";
|
|
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__ */ jsx(WarningCircle, { size: feedbackIconSize });
|
|
28
|
-
case SUCCESS:
|
|
29
|
-
return /* @__PURE__ */ jsx(CheckmarkCircle, { size: feedbackIconSize });
|
|
30
|
-
case HELP:
|
|
31
|
-
return /* @__PURE__ */ jsx(HelpCircle, { size: feedbackIconSize });
|
|
32
|
-
case INFO:
|
|
33
|
-
return /* @__PURE__ */ jsx(InfoCircle, { size: feedbackIconSize });
|
|
34
|
-
default:
|
|
35
|
-
return /* @__PURE__ */ jsx(InfoCircle, { size: feedbackIconSize });
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const ModalFeedBack = ({
|
|
39
|
-
className = "",
|
|
40
|
-
modalType = null,
|
|
41
|
-
hasError = false,
|
|
42
|
-
hasWarning = false,
|
|
43
|
-
hasSuccess = false,
|
|
44
|
-
hasInfo = false,
|
|
45
|
-
hasHelp = false
|
|
46
|
-
}) => {
|
|
47
|
-
const type = getModalType(modalType, {
|
|
48
|
-
hasError,
|
|
49
|
-
hasWarning,
|
|
50
|
-
hasSuccess,
|
|
51
|
-
hasInfo,
|
|
52
|
-
hasHelp
|
|
53
|
-
});
|
|
54
|
-
const { cssClassName } = convertPropToCssClassName("modal-feedback", className, { modalType: type });
|
|
55
|
-
const feedbackIcon = getIconType(type);
|
|
56
|
-
return /* @__PURE__ */ jsx("div", { className: cssClassName, children: feedbackIcon });
|
|
57
|
-
};
|
|
58
|
-
var ModalFeedBack_default = ModalFeedBack;
|
|
59
|
-
export {
|
|
60
|
-
ModalFeedBack_default as default
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=ModalFeedBack.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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.js';\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,YAAY,WAAW;ACuBV;AAtBb,SAAS,eAAe,iBAAiB,YAAY,kBAAkB;AACvE,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAE3B,MAAM,mBAAmB;AAEzB,MAAM,EAAE,SAAS,OAAO,SAAS,MAAM,KAAK,IAAI;AAEhD,MAAM,eAAe,CAAC,WAAW,EAAE,UAAU,YAAY,YAAY,SAAS,QAAQ,MAAM;AAC1F,MAAI,CAAC,SAAS,OAAO,SAAS,MAAM,IAAI,EAAE,QAAQ,SAAS,IAAI;AAAI,WAAO;AAC1E,MAAI;AAAU,WAAO;AACrB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAS,WAAO;AACpB,MAAI;AAAS,WAAO;AACpB,SAAO;AACT;AAEA,MAAM,cAAc,CAAC,cAAc;AACjC,UAAQ,WAAW;AAAA,IACjB,KAAK;AAAA,IACL,KAAK;AACH,aAAO,oBAAC,iBAAc,MAAM,kBAAkB;AAAA,IAChD,KAAK;AACH,aAAO,oBAAC,mBAAgB,MAAM,kBAAkB;AAAA,IAClD,KAAK;AACH,aAAO,oBAAC,cAAW,MAAM,kBAAkB;AAAA,IAC7C,KAAK;AACH,aAAO,oBAAC,cAAW,MAAM,kBAAkB;AAAA,IAC7C;AACE,aAAO,oBAAC,cAAW,MAAM,kBAAkB;AAAA,EAC/C;AACF;AAEA,MAAM,gBAAgB,CAAC;AAAA,EACrB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AACZ,MAAM;AACJ,QAAM,OAAO,aAAa,WAAW;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,EAAE,aAAa,IAAI,0BAA0B,kBAAkB,WAAW,EAAE,WAAW,KAAK,CAAC;AACnG,QAAM,eAAe,YAAY,IAAI;AAErC,SAAO,oBAAC,SAAI,WAAW,cAAe,wBAAa;AACrD;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/v2/DSModal.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import { ThemeContext } from "@elliemae/ds-system";
|
|
5
|
-
import { PropTypes, describe } from "@elliemae/ds-props-helpers";
|
|
6
|
-
import ReactModal from "react-modal";
|
|
7
|
-
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
8
|
-
import { MODAL_TYPE_V2 } from "../constants.js";
|
|
9
|
-
import { DSModalContent } from "./components/ModalContent.js";
|
|
10
|
-
const DSModal = ({
|
|
11
|
-
containerProps = {},
|
|
12
|
-
className = "",
|
|
13
|
-
style = {},
|
|
14
|
-
size = "default",
|
|
15
|
-
//
|
|
16
|
-
modalType = MODAL_TYPE_V2.INFORMATION,
|
|
17
|
-
modalSubType = null,
|
|
18
|
-
modalTitle = "",
|
|
19
|
-
dataTestId = "ds-modal",
|
|
20
|
-
centered = false,
|
|
21
|
-
showRejectButton = false,
|
|
22
|
-
showClose = true,
|
|
23
|
-
searchProps = {},
|
|
24
|
-
// override
|
|
25
|
-
actionsRef = () => null,
|
|
26
|
-
additionalFooterCssClass,
|
|
27
|
-
overridePropsConfirmButton = {},
|
|
28
|
-
overridePropsRejectButton = {},
|
|
29
|
-
// react modal
|
|
30
|
-
children,
|
|
31
|
-
isOpen = true,
|
|
32
|
-
onClose = () => null,
|
|
33
|
-
onAfterOpen = () => null,
|
|
34
|
-
onConfirm = () => null,
|
|
35
|
-
onReject = () => null,
|
|
36
|
-
rejectLabel = "Discard",
|
|
37
|
-
confirmLabel = "Save",
|
|
38
|
-
shouldCloseOnOverlayClick = false,
|
|
39
|
-
appElement = "body",
|
|
40
|
-
zIndex,
|
|
41
|
-
removePadding = false
|
|
42
|
-
}) => {
|
|
43
|
-
if (typeof document !== "undefined" && true && document && ReactModal.setAppElement) {
|
|
44
|
-
ReactModal.setAppElement(appElement);
|
|
45
|
-
}
|
|
46
|
-
const { cssClassName, classNameBlock, classNameModifier } = convertPropToCssClassName("modal-v2", className, {
|
|
47
|
-
size
|
|
48
|
-
});
|
|
49
|
-
const theme = useContext(ThemeContext);
|
|
50
|
-
return /* @__PURE__ */ jsx(
|
|
51
|
-
ReactModal,
|
|
52
|
-
{
|
|
53
|
-
testId: dataTestId,
|
|
54
|
-
className: `${cssClassName} ${classNameBlock(`type-${modalType}`)}`,
|
|
55
|
-
contentLabel: modalTitle,
|
|
56
|
-
isOpen,
|
|
57
|
-
onAfterOpen,
|
|
58
|
-
onRequestClose: onClose,
|
|
59
|
-
overlayClassName: `${classNameBlock("overlay")} ${classNameModifier(centered ? "center" : "top")}`,
|
|
60
|
-
shouldCloseOnOverlayClick,
|
|
61
|
-
style: {
|
|
62
|
-
content: {
|
|
63
|
-
...style
|
|
64
|
-
},
|
|
65
|
-
overlay: {
|
|
66
|
-
// position: 'absolute', https://jira.elliemae.io/browse/PUI-1471, the overlay should be positioned based on the browser window rather positioned absolute to its parent
|
|
67
|
-
zIndex: zIndex ?? theme.zIndex.dialog
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
children: /* @__PURE__ */ jsx(
|
|
71
|
-
DSModalContent,
|
|
72
|
-
{
|
|
73
|
-
actionsRef,
|
|
74
|
-
additionalFooterCssClass,
|
|
75
|
-
confirmLabel,
|
|
76
|
-
containerProps,
|
|
77
|
-
modalSubType,
|
|
78
|
-
modalTitle,
|
|
79
|
-
modalType,
|
|
80
|
-
onClose,
|
|
81
|
-
onConfirm,
|
|
82
|
-
onReject,
|
|
83
|
-
overridePropsConfirmButton,
|
|
84
|
-
overridePropsRejectButton,
|
|
85
|
-
rejectLabel,
|
|
86
|
-
searchProps,
|
|
87
|
-
showClose,
|
|
88
|
-
showRejectButton,
|
|
89
|
-
removePadding,
|
|
90
|
-
children
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
const props = {
|
|
97
|
-
/** inject props to container wrapper */
|
|
98
|
-
containerProps: PropTypes.object.description("inject props to container wrapper"),
|
|
99
|
-
/** css class */
|
|
100
|
-
className: PropTypes.string.description("css class"),
|
|
101
|
-
/** style object for container wrapper */
|
|
102
|
-
style: PropTypes.object.description("style object for container wrapper"),
|
|
103
|
-
/** modal container title */
|
|
104
|
-
modalTitle: PropTypes.string.description("modal container title"),
|
|
105
|
-
/** center container */
|
|
106
|
-
centered: PropTypes.bool.description("center container"),
|
|
107
|
-
/** show reject button */
|
|
108
|
-
showRejectButton: PropTypes.bool.description("show reject button"),
|
|
109
|
-
/** show close button */
|
|
110
|
-
showClose: PropTypes.bool.description("show close button"),
|
|
111
|
-
/*
|
|
112
|
-
Props for search component
|
|
113
|
-
*/
|
|
114
|
-
searchProps: PropTypes.object.description("Props for search component"),
|
|
115
|
-
/** css class for footer */
|
|
116
|
-
additionalFooterCssClass: PropTypes.string.description("css class for footer"),
|
|
117
|
-
/** override props confirm button */
|
|
118
|
-
overridePropsConfirmButton: PropTypes.object.description("override props confirm button"),
|
|
119
|
-
/** override props reject button */
|
|
120
|
-
overridePropsRejectButton: PropTypes.object.description("override props reject button"),
|
|
121
|
-
/** controlled isOpen flag */
|
|
122
|
-
isOpen: PropTypes.bool.description("controlled isOpen flag"),
|
|
123
|
-
/** close callback */
|
|
124
|
-
onClose: PropTypes.func.description("close callback"),
|
|
125
|
-
/** after open callback */
|
|
126
|
-
onAfterOpen: PropTypes.func.description("after open callback"),
|
|
127
|
-
/** confirm callback */
|
|
128
|
-
onConfirm: PropTypes.func.description("confirm callback"),
|
|
129
|
-
/** reject callback */
|
|
130
|
-
onReject: PropTypes.func.description("reject callback"),
|
|
131
|
-
/** reject label */
|
|
132
|
-
rejectLabel: PropTypes.string.description("reject label"),
|
|
133
|
-
/** confirm text string */
|
|
134
|
-
confirmLabel: PropTypes.string.description("confirm text string"),
|
|
135
|
-
/** modal container size */
|
|
136
|
-
size: PropTypes.oneOf(["default", "xx-large", "x-large", "large", "medium", "small"]).description(
|
|
137
|
-
"modal container size"
|
|
138
|
-
),
|
|
139
|
-
/** modal sub type */
|
|
140
|
-
modalSubType: PropTypes.any.description("modal sub type"),
|
|
141
|
-
/** modal type */
|
|
142
|
-
modalType: PropTypes.any.description("modal type"),
|
|
143
|
-
/** ref for modal footer actions */
|
|
144
|
-
actionsRef: PropTypes.any.description("ref for modal footer actions"),
|
|
145
|
-
/** modal container children */
|
|
146
|
-
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]).description(
|
|
147
|
-
"modal container children"
|
|
148
|
-
),
|
|
149
|
-
/** close on click outside container */
|
|
150
|
-
shouldCloseOnOverlayClick: PropTypes.bool.description("close on click outside container"),
|
|
151
|
-
/*
|
|
152
|
-
App element ID to inject the modal
|
|
153
|
-
*/
|
|
154
|
-
appElement: PropTypes.string.description("App element ID to inject the modal"),
|
|
155
|
-
/** zindex for modal container */
|
|
156
|
-
zIndex: PropTypes.number.description("zindex for modal container"),
|
|
157
|
-
/** remove modal builtin padding */
|
|
158
|
-
removePadding: PropTypes.bool.description("remove modal builtin padding")
|
|
159
|
-
};
|
|
160
|
-
DSModal.propTypes = props;
|
|
161
|
-
DSModal.displayName = "DSModal";
|
|
162
|
-
const DSModalWithSchema = describe(DSModal);
|
|
163
|
-
DSModalWithSchema.propTypes = props;
|
|
164
|
-
var DSModal_default = DSModal;
|
|
165
|
-
export {
|
|
166
|
-
DSModalContent,
|
|
167
|
-
DSModalWithSchema,
|
|
168
|
-
DSModal_default as default
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=DSModal.js.map
|