@elliemae/ds-modal 3.0.0-next.0 → 3.0.0-next.4
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
package/esm/v1/DSModal.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import 'react';
|
|
9
|
-
import ReactModal from 'react-modal';
|
|
10
|
-
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
11
|
-
import { DSIconSizes } from '@elliemae/ds-icon';
|
|
12
|
-
import { Close } from '@elliemae/ds-icons';
|
|
13
|
-
import DSButton from '@elliemae/ds-button';
|
|
14
|
-
import { MODAL_TYPE } from '../constants.js';
|
|
15
|
-
import ModalFeedBack from './ModalFeedBack/ModalFeedBack.js';
|
|
16
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
var _Close;
|
|
19
|
-
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
|
|
24
|
-
const DSModal = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
containerProps = {},
|
|
27
|
-
className = '',
|
|
28
|
-
dataTestId = 'ds-modal',
|
|
29
|
-
additionalFooterCssClass = '',
|
|
30
|
-
style = {},
|
|
31
|
-
iconCloseSize = DSIconSizes.S,
|
|
32
|
-
modalType = MODAL_TYPE.DEFAULT,
|
|
33
|
-
showHeader = true,
|
|
34
|
-
showFooter = true,
|
|
35
|
-
children,
|
|
36
|
-
centered = true,
|
|
37
|
-
confirmLabel = 'Accept',
|
|
38
|
-
modalTitle = '',
|
|
39
|
-
size = 'medium',
|
|
40
|
-
isOpen = false,
|
|
41
|
-
onClose = () => null,
|
|
42
|
-
onAfterOpen = () => null,
|
|
43
|
-
onConfirm = () => null,
|
|
44
|
-
onReject = () => null,
|
|
45
|
-
rejectLabel = 'Cancel',
|
|
46
|
-
shouldCloseOnOverlayClick = false,
|
|
47
|
-
hasError = false,
|
|
48
|
-
hasWarning = false,
|
|
49
|
-
hasSuccess = false,
|
|
50
|
-
hasInfo = false,
|
|
51
|
-
hasHelp = false,
|
|
52
|
-
actionsRef = () => null,
|
|
53
|
-
appElement = '#root',
|
|
54
|
-
overridePropsConfirmButton = {},
|
|
55
|
-
overridePropsRejectButton = {},
|
|
56
|
-
zIndex = 10
|
|
57
|
-
} = _ref;
|
|
58
|
-
// http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples
|
|
59
|
-
typeof document !== 'undefined' && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement); // eslint-disable-line
|
|
60
|
-
|
|
61
|
-
const {
|
|
62
|
-
cssClassName,
|
|
63
|
-
classNameElement,
|
|
64
|
-
classNameBlock,
|
|
65
|
-
classNameModifier,
|
|
66
|
-
classNameBlockModifier
|
|
67
|
-
} = convertPropToCssClassName('modal', className, {
|
|
68
|
-
hasError,
|
|
69
|
-
hasWarning,
|
|
70
|
-
hasSuccess,
|
|
71
|
-
modalType,
|
|
72
|
-
size
|
|
73
|
-
});
|
|
74
|
-
const {
|
|
75
|
-
WARNING,
|
|
76
|
-
ERROR,
|
|
77
|
-
SUCCESS,
|
|
78
|
-
HELP,
|
|
79
|
-
INFO
|
|
80
|
-
} = MODAL_TYPE;
|
|
81
|
-
const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
|
|
82
|
-
const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
|
|
83
|
-
return /*#__PURE__*/_jsx(ReactModal, {
|
|
84
|
-
testId: dataTestId,
|
|
85
|
-
className: cssClassName,
|
|
86
|
-
contentLabel: modalTitle,
|
|
87
|
-
isOpen: isOpen,
|
|
88
|
-
onAfterOpen: onAfterOpen,
|
|
89
|
-
onRequestClose: onClose,
|
|
90
|
-
overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered && 'center')),
|
|
91
|
-
shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
|
|
92
|
-
style: {
|
|
93
|
-
content: _objectSpread({}, style),
|
|
94
|
-
overlay: {
|
|
95
|
-
zIndex
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}, void 0, /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
99
|
-
children: [showHeader && /*#__PURE__*/_jsx("div", {
|
|
100
|
-
className: classNameBlock('modal-header')
|
|
101
|
-
}, void 0, /*#__PURE__*/_jsx("div", {
|
|
102
|
-
className: classNameElement('title', 'modal-header')
|
|
103
|
-
}, void 0, modalTitle), /*#__PURE__*/_jsx("div", {
|
|
104
|
-
className: classNameElement('icon', 'modal-header')
|
|
105
|
-
}, void 0, /*#__PURE__*/_jsx(DSButton, {
|
|
106
|
-
buttonType: "link",
|
|
107
|
-
icon: _Close || (_Close = /*#__PURE__*/_jsx(Close, {})),
|
|
108
|
-
onClick: onClose,
|
|
109
|
-
size: iconCloseSize
|
|
110
|
-
}))), /*#__PURE__*/_jsx("div", {
|
|
111
|
-
className: classNameElement('body')
|
|
112
|
-
}, void 0, showFeedBack && /*#__PURE__*/_jsx(ModalFeedBack, {
|
|
113
|
-
hasError: hasError,
|
|
114
|
-
hasHelp: hasHelp,
|
|
115
|
-
hasInfo: hasInfo,
|
|
116
|
-
hasSuccess: hasSuccess,
|
|
117
|
-
hasWarning: hasWarning,
|
|
118
|
-
modalType: modalType
|
|
119
|
-
}), children), showFooter && !isAFeedbackType && /*#__PURE__*/_jsx("div", {
|
|
120
|
-
className: "".concat(classNameBlock('modal-footer'), " ").concat(additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : '')
|
|
121
|
-
}, void 0, /*#__PURE__*/jsxs("div", {
|
|
122
|
-
ref: actionsRef,
|
|
123
|
-
className: classNameBlock('modal-footer-actions'),
|
|
124
|
-
children: [modalType === MODAL_TYPE.CONFIRM && /*#__PURE__*/jsx(DSButton, _objectSpread({
|
|
125
|
-
buttonType: "secondary",
|
|
126
|
-
className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('reject', 'button-action'), " "),
|
|
127
|
-
labelText: rejectLabel,
|
|
128
|
-
onClick: onReject
|
|
129
|
-
}, overridePropsRejectButton)), /*#__PURE__*/jsx(DSButton, _objectSpread({
|
|
130
|
-
buttonType: "primary",
|
|
131
|
-
className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('confirm', 'button-action'), " "),
|
|
132
|
-
labelText: confirmLabel,
|
|
133
|
-
onClick: onConfirm
|
|
134
|
-
}, overridePropsConfirmButton))]
|
|
135
|
-
}))]
|
|
136
|
-
})));
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export { DSModal as default };
|
package/esm/v1/DSModalType.js
DELETED
package/esm/v1/DSModalWrapper.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
-
import { Component, createElement } from 'react';
|
|
9
|
-
import { MODAL_TYPE } from '../constants.js';
|
|
10
|
-
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
-
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
var DSModalWrapper = (WrappedComponent => {
|
|
15
|
-
class DSModalWrapper extends Component {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.state = {
|
|
19
|
-
childready: false,
|
|
20
|
-
additionalFooterCssClass: 'loading',
|
|
21
|
-
container: null,
|
|
22
|
-
actions: null,
|
|
23
|
-
height: '100%'
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
this.onHeaderHeight = e => {
|
|
27
|
-
this.heightHeaderFlag = true;
|
|
28
|
-
this.heightHeader = e.height || 0;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
this.onFooterHeight = e => {
|
|
32
|
-
this.heightFooterFlag = true;
|
|
33
|
-
this.heightFooter = e.height || 0;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
this.onResize = _ref => {
|
|
37
|
-
let {
|
|
38
|
-
bounds
|
|
39
|
-
} = _ref;
|
|
40
|
-
|
|
41
|
-
if (this.heightFooterFlag && this.heightHeaderFlag) {
|
|
42
|
-
return this.setState({
|
|
43
|
-
height: bounds.height - this.heightFooter - this.heightHeader
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return setTimeout(this.onResize({
|
|
48
|
-
bounds
|
|
49
|
-
}), 0);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
this.handleContainer = node => {
|
|
53
|
-
if (node) this.setState({
|
|
54
|
-
container: node
|
|
55
|
-
});
|
|
56
|
-
this.handleResize();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.handleActions = node => {
|
|
60
|
-
if (node) this.setState({
|
|
61
|
-
actions: node
|
|
62
|
-
});
|
|
63
|
-
this.handleResize();
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
componentDidMount() {
|
|
68
|
-
window.addEventListener('resize', this.handleResize);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
componentWillUnmount() {
|
|
72
|
-
window.removeEventListener('resize', this.handleResize);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Change button width to 100% if the
|
|
77
|
-
* combined width of the button (or button group) exceed 50% of the container width.
|
|
78
|
-
*/
|
|
79
|
-
handleResize() {
|
|
80
|
-
if (!this.state) return null;
|
|
81
|
-
const {
|
|
82
|
-
container,
|
|
83
|
-
actions,
|
|
84
|
-
childready
|
|
85
|
-
} = this.state;
|
|
86
|
-
if (!childready) return null;
|
|
87
|
-
this.setState({
|
|
88
|
-
additionalFooterCssClass: null
|
|
89
|
-
}); // !important reset to default state to recalculate
|
|
90
|
-
|
|
91
|
-
const {
|
|
92
|
-
clientWidth: containerWidth
|
|
93
|
-
} = container;
|
|
94
|
-
const {
|
|
95
|
-
clientWidth: actionsWidth
|
|
96
|
-
} = actions; // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.
|
|
97
|
-
|
|
98
|
-
if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
|
|
99
|
-
return this.setState({
|
|
100
|
-
additionalFooterCssClass: 'fluid-actions'
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return this.setState({
|
|
105
|
-
additionalFooterCssClass: null
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
verifyNodes() {
|
|
110
|
-
const {
|
|
111
|
-
modalType
|
|
112
|
-
} = this.props;
|
|
113
|
-
|
|
114
|
-
if (modalType !== MODAL_TYPE.DEFAULT) {
|
|
115
|
-
const nodesInterval = setInterval(() => {
|
|
116
|
-
// !important it checks when nodes are availables
|
|
117
|
-
const {
|
|
118
|
-
container,
|
|
119
|
-
actions
|
|
120
|
-
} = this.state;
|
|
121
|
-
if (!container || !actions) return null;
|
|
122
|
-
clearInterval(nodesInterval);
|
|
123
|
-
this.setState({
|
|
124
|
-
childready: true
|
|
125
|
-
});
|
|
126
|
-
return this.handleResize();
|
|
127
|
-
}, 100);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
render() {
|
|
132
|
-
const {
|
|
133
|
-
props,
|
|
134
|
-
state
|
|
135
|
-
} = this;
|
|
136
|
-
const {
|
|
137
|
-
additionalFooterCssClass,
|
|
138
|
-
height
|
|
139
|
-
} = state;
|
|
140
|
-
return /*#__PURE__*/createElement(WrappedComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
141
|
-
height,
|
|
142
|
-
onResize: this.onResize,
|
|
143
|
-
onFooterHeight: this.onFooterHeight,
|
|
144
|
-
onHeaderHeight: this.onHeaderHeight,
|
|
145
|
-
containerRef: this.handleContainer,
|
|
146
|
-
actionsRef: this.handleActions,
|
|
147
|
-
additionalFooterCssClass,
|
|
148
|
-
onAfterOpen: () => {
|
|
149
|
-
if (props.onAfterOpen) props.onAfterOpen();
|
|
150
|
-
this.verifyNodes();
|
|
151
|
-
}
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return DSModalWrapper;
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
export { DSModalWrapper as default };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { InfoCircle, HelpCircle, CheckmarkCircle, WarningCircle } from '@elliemae/ds-icons';
|
|
4
|
-
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
5
|
-
import { MODAL_TYPE } from '../../constants.js';
|
|
6
|
-
|
|
7
|
-
var _WarningCircle, _CheckmarkCircle, _HelpCircle, _InfoCircle, _InfoCircle2;
|
|
8
|
-
const feedbackIconSize = 'xxl';
|
|
9
|
-
const {
|
|
10
|
-
WARNING,
|
|
11
|
-
ERROR,
|
|
12
|
-
SUCCESS,
|
|
13
|
-
HELP,
|
|
14
|
-
INFO
|
|
15
|
-
} = MODAL_TYPE;
|
|
16
|
-
|
|
17
|
-
const getModalType = (modalType, _ref) => {
|
|
18
|
-
let {
|
|
19
|
-
hasError,
|
|
20
|
-
hasWarning,
|
|
21
|
-
hasSuccess,
|
|
22
|
-
hasInfo,
|
|
23
|
-
hasHelp
|
|
24
|
-
} = _ref;
|
|
25
|
-
if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;
|
|
26
|
-
if (hasError) return ERROR;
|
|
27
|
-
if (hasWarning) return WARNING;
|
|
28
|
-
if (hasSuccess) return SUCCESS;
|
|
29
|
-
if (hasHelp) return HELP;
|
|
30
|
-
if (hasInfo) return INFO;
|
|
31
|
-
return INFO;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const getIconType = modalType => {
|
|
35
|
-
switch (modalType) {
|
|
36
|
-
case WARNING:
|
|
37
|
-
case ERROR:
|
|
38
|
-
return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx(WarningCircle, {
|
|
39
|
-
size: feedbackIconSize
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
case SUCCESS:
|
|
43
|
-
return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx(CheckmarkCircle, {
|
|
44
|
-
size: feedbackIconSize
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
case HELP:
|
|
48
|
-
return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx(HelpCircle, {
|
|
49
|
-
size: feedbackIconSize
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
case INFO:
|
|
53
|
-
return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx(InfoCircle, {
|
|
54
|
-
size: feedbackIconSize
|
|
55
|
-
}));
|
|
56
|
-
|
|
57
|
-
default:
|
|
58
|
-
return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx(InfoCircle, {
|
|
59
|
-
size: feedbackIconSize
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const ModalFeedBack = _ref2 => {
|
|
65
|
-
let {
|
|
66
|
-
className = '',
|
|
67
|
-
modalType = null,
|
|
68
|
-
hasError = false,
|
|
69
|
-
hasWarning = false,
|
|
70
|
-
hasSuccess = false,
|
|
71
|
-
hasInfo = false,
|
|
72
|
-
hasHelp = false
|
|
73
|
-
} = _ref2;
|
|
74
|
-
const type = getModalType(modalType, {
|
|
75
|
-
hasError,
|
|
76
|
-
hasWarning,
|
|
77
|
-
hasSuccess,
|
|
78
|
-
hasInfo,
|
|
79
|
-
hasHelp
|
|
80
|
-
});
|
|
81
|
-
const {
|
|
82
|
-
cssClassName
|
|
83
|
-
} = convertPropToCssClassName('modal-feedback', className, {
|
|
84
|
-
modalType: type
|
|
85
|
-
});
|
|
86
|
-
const feedbackIcon = getIconType(type);
|
|
87
|
-
return /*#__PURE__*/_jsx("div", {
|
|
88
|
-
className: cssClassName
|
|
89
|
-
}, void 0, feedbackIcon);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export { ModalFeedBack as default };
|
package/esm/v2/DSModal.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import 'react';
|
|
9
|
-
import { PropTypes, describe } from 'react-desc';
|
|
10
|
-
import ReactModal from 'react-modal';
|
|
11
|
-
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
12
|
-
import { MODAL_TYPE_V2 } from '../constants.js';
|
|
13
|
-
import { DSModalContent } from './components/ModalContent.js';
|
|
14
|
-
export { DSModalContent } from './components/ModalContent.js';
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
|
-
const DSModal = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
containerProps = {},
|
|
23
|
-
className = '',
|
|
24
|
-
style = {},
|
|
25
|
-
size = 'default',
|
|
26
|
-
//
|
|
27
|
-
modalType = MODAL_TYPE_V2.INFORMATION,
|
|
28
|
-
modalSubType = null,
|
|
29
|
-
modalTitle = '',
|
|
30
|
-
dataTestId = 'ds-modal',
|
|
31
|
-
centered = false,
|
|
32
|
-
showRejectButton = false,
|
|
33
|
-
showClose = true,
|
|
34
|
-
searchProps = {},
|
|
35
|
-
// override
|
|
36
|
-
actionsRef = () => null,
|
|
37
|
-
additionalFooterCssClass,
|
|
38
|
-
overridePropsConfirmButton = {},
|
|
39
|
-
overridePropsRejectButton = {},
|
|
40
|
-
// react modal
|
|
41
|
-
children,
|
|
42
|
-
isOpen = true,
|
|
43
|
-
onClose = () => null,
|
|
44
|
-
onAfterOpen = () => null,
|
|
45
|
-
onConfirm = () => null,
|
|
46
|
-
onReject = () => null,
|
|
47
|
-
rejectLabel = 'Discard',
|
|
48
|
-
confirmLabel = 'Save',
|
|
49
|
-
shouldCloseOnOverlayClick = false,
|
|
50
|
-
appElement = '#root',
|
|
51
|
-
zIndex = 10,
|
|
52
|
-
removePadding = false
|
|
53
|
-
} = _ref;
|
|
54
|
-
|
|
55
|
-
if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && document && ReactModal.setAppElement) {
|
|
56
|
-
ReactModal.setAppElement(appElement);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const {
|
|
60
|
-
cssClassName,
|
|
61
|
-
classNameBlock,
|
|
62
|
-
classNameModifier
|
|
63
|
-
} = convertPropToCssClassName('modal-v2', className, {
|
|
64
|
-
size
|
|
65
|
-
});
|
|
66
|
-
return /*#__PURE__*/_jsx(ReactModal, {
|
|
67
|
-
testId: dataTestId,
|
|
68
|
-
className: "".concat(cssClassName, " ").concat(classNameBlock("type-".concat(modalType))),
|
|
69
|
-
contentLabel: modalTitle,
|
|
70
|
-
isOpen: isOpen,
|
|
71
|
-
onAfterOpen: onAfterOpen,
|
|
72
|
-
onRequestClose: onClose,
|
|
73
|
-
overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered ? 'center' : 'top')),
|
|
74
|
-
shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
|
|
75
|
-
style: {
|
|
76
|
-
content: _objectSpread({}, style),
|
|
77
|
-
overlay: {
|
|
78
|
-
// 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
|
|
79
|
-
zIndex
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, void 0, /*#__PURE__*/_jsx(DSModalContent, {
|
|
83
|
-
actionsRef: actionsRef,
|
|
84
|
-
additionalFooterCssClass: additionalFooterCssClass,
|
|
85
|
-
confirmLabel: confirmLabel,
|
|
86
|
-
containerProps: containerProps,
|
|
87
|
-
modalSubType: modalSubType,
|
|
88
|
-
modalTitle: modalTitle,
|
|
89
|
-
modalType: modalType,
|
|
90
|
-
onClose: onClose,
|
|
91
|
-
onConfirm: onConfirm,
|
|
92
|
-
onReject: onReject,
|
|
93
|
-
overridePropsConfirmButton: overridePropsConfirmButton,
|
|
94
|
-
overridePropsRejectButton: overridePropsRejectButton,
|
|
95
|
-
rejectLabel: rejectLabel,
|
|
96
|
-
searchProps: searchProps,
|
|
97
|
-
showClose: showClose,
|
|
98
|
-
showRejectButton: showRejectButton,
|
|
99
|
-
removePadding: removePadding
|
|
100
|
-
}, void 0, children));
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const props = {
|
|
104
|
-
/** inject props to container wrapper */
|
|
105
|
-
containerProps: PropTypes.object.description('inject props to container wrapper'),
|
|
106
|
-
|
|
107
|
-
/** css class */
|
|
108
|
-
className: PropTypes.string.description('css class'),
|
|
109
|
-
|
|
110
|
-
/** style object for container wrapper */
|
|
111
|
-
style: PropTypes.object.description('style object for container wrapper'),
|
|
112
|
-
|
|
113
|
-
/** modal container title */
|
|
114
|
-
modalTitle: PropTypes.string.description('modal container title'),
|
|
115
|
-
|
|
116
|
-
/** center container */
|
|
117
|
-
centered: PropTypes.bool.description('center container'),
|
|
118
|
-
|
|
119
|
-
/** show reject button */
|
|
120
|
-
showRejectButton: PropTypes.bool.description('show reject button'),
|
|
121
|
-
|
|
122
|
-
/** show close button */
|
|
123
|
-
showClose: PropTypes.bool.description('show close button'),
|
|
124
|
-
|
|
125
|
-
/*
|
|
126
|
-
Props for search component
|
|
127
|
-
*/
|
|
128
|
-
searchProps: PropTypes.object.description('Props for search component'),
|
|
129
|
-
|
|
130
|
-
/** css class for footer */
|
|
131
|
-
additionalFooterCssClass: PropTypes.string.description('css class for footer'),
|
|
132
|
-
|
|
133
|
-
/** override props confirm button */
|
|
134
|
-
overridePropsConfirmButton: PropTypes.object.description('override props confirm button'),
|
|
135
|
-
|
|
136
|
-
/** override props reject button */
|
|
137
|
-
overridePropsRejectButton: PropTypes.object.description('override props reject button'),
|
|
138
|
-
|
|
139
|
-
/** controlled isOpen flag */
|
|
140
|
-
isOpen: PropTypes.bool.description('controlled isOpen flag'),
|
|
141
|
-
|
|
142
|
-
/** close callback */
|
|
143
|
-
onClose: PropTypes.func.description('close callback'),
|
|
144
|
-
|
|
145
|
-
/** after open callback */
|
|
146
|
-
onAfterOpen: PropTypes.func.description('after open callback'),
|
|
147
|
-
|
|
148
|
-
/** confirm callback */
|
|
149
|
-
onConfirm: PropTypes.func.description('confirm callback'),
|
|
150
|
-
|
|
151
|
-
/** reject callback */
|
|
152
|
-
onReject: PropTypes.func.description('reject callback'),
|
|
153
|
-
|
|
154
|
-
/** reject label */
|
|
155
|
-
rejectLabel: PropTypes.string.description('reject label'),
|
|
156
|
-
|
|
157
|
-
/** confirm text string */
|
|
158
|
-
confirmLabel: PropTypes.string.description('confirm text string'),
|
|
159
|
-
|
|
160
|
-
/** modal container size */
|
|
161
|
-
size: PropTypes.oneOf(['default', 'xx-large', 'x-large', 'large', 'medium', 'small']).description('modal container size'),
|
|
162
|
-
|
|
163
|
-
/** modal sub type */
|
|
164
|
-
modalSubType: PropTypes.any.description('modal sub type'),
|
|
165
|
-
|
|
166
|
-
/** modal type */
|
|
167
|
-
modalType: PropTypes.any.description('modal type'),
|
|
168
|
-
|
|
169
|
-
/** ref for modal footer actions */
|
|
170
|
-
actionsRef: PropTypes.any.description('ref for modal footer actions'),
|
|
171
|
-
|
|
172
|
-
/** modal container children */
|
|
173
|
-
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf([PropTypes.element])]).description('modal container children'),
|
|
174
|
-
|
|
175
|
-
/** close on click outside container */
|
|
176
|
-
shouldCloseOnOverlayClick: PropTypes.bool.description('close on click outside container'),
|
|
177
|
-
|
|
178
|
-
/*
|
|
179
|
-
App element ID to inject the modal
|
|
180
|
-
*/
|
|
181
|
-
appElement: PropTypes.string.description('App element ID to inject the modal'),
|
|
182
|
-
|
|
183
|
-
/** zindex for modal container */
|
|
184
|
-
zIndex: PropTypes.number.description('zindex for modal container'),
|
|
185
|
-
|
|
186
|
-
/** remove modal builtin padding */
|
|
187
|
-
removePadding: PropTypes.bool.description('remove modal builtin padding')
|
|
188
|
-
};
|
|
189
|
-
const DSModalWithSchema = describe(DSModal);
|
|
190
|
-
DSModalWithSchema.propTypes = props;
|
|
191
|
-
|
|
192
|
-
export { DSModalWithSchema, DSModal as default };
|
package/esm/v2/blocks.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
2
|
-
|
|
3
|
-
const blockName = 'modal-v2';
|
|
4
|
-
const ModalHeader = aggregatedClasses('div')(blockName, 'modal-header', _ref => {
|
|
5
|
-
let {
|
|
6
|
-
type,
|
|
7
|
-
showClose
|
|
8
|
-
} = _ref;
|
|
9
|
-
return {
|
|
10
|
-
[type]: type,
|
|
11
|
-
'with-close': showClose
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
const ModalHeaderTopRight = aggregatedClasses('div')(blockName, 'modal-header-close', _ref2 => {
|
|
15
|
-
let {
|
|
16
|
-
type
|
|
17
|
-
} = _ref2;
|
|
18
|
-
return {
|
|
19
|
-
[type]: type
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
const ModalFeedback = aggregatedClasses('div')(blockName, 'modal-feedback', _ref3 => {
|
|
23
|
-
let {
|
|
24
|
-
type
|
|
25
|
-
} = _ref3;
|
|
26
|
-
return {
|
|
27
|
-
[type]: type
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
const ModalTitle = aggregatedClasses('h3')(blockName, 'modal-title', _ref4 => {
|
|
31
|
-
let {
|
|
32
|
-
type
|
|
33
|
-
} = _ref4;
|
|
34
|
-
return {
|
|
35
|
-
[type]: type
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
const ModalContent = aggregatedClasses('div')(blockName, 'modal-content', _ref5 => {
|
|
39
|
-
let {
|
|
40
|
-
type,
|
|
41
|
-
removePadding
|
|
42
|
-
} = _ref5;
|
|
43
|
-
return {
|
|
44
|
-
[type]: type,
|
|
45
|
-
'remove-padding': removePadding
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
const ModalWrapper = aggregatedClasses('div')(blockName, 'modal-wrapper', _ref6 => {
|
|
49
|
-
let {
|
|
50
|
-
type,
|
|
51
|
-
removePadding
|
|
52
|
-
} = _ref6;
|
|
53
|
-
return {
|
|
54
|
-
[type]: type,
|
|
55
|
-
'remove-padding': removePadding
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
const ModalFooter = aggregatedClasses('div')(blockName, 'modal-footer', _ref7 => {
|
|
59
|
-
let {
|
|
60
|
-
type,
|
|
61
|
-
additionalFooterCssClass
|
|
62
|
-
} = _ref7;
|
|
63
|
-
return {
|
|
64
|
-
[type]: type,
|
|
65
|
-
[additionalFooterCssClass]: additionalFooterCssClass
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
const ModalFooterActions = aggregatedClasses('div')(blockName, 'modal-footer-actions', _ref8 => {
|
|
69
|
-
let {
|
|
70
|
-
type
|
|
71
|
-
} = _ref8;
|
|
72
|
-
return {
|
|
73
|
-
[type]: type
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export { ModalContent, ModalFeedback, ModalFooter, ModalFooterActions, ModalHeader, ModalHeaderTopRight, ModalTitle, ModalWrapper };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { Close } from '@elliemae/ds-icons';
|
|
4
|
-
import DSButton from '@elliemae/ds-button';
|
|
5
|
-
import { ModalHeader } from '../blocks.js';
|
|
6
|
-
|
|
7
|
-
var _Close;
|
|
8
|
-
const DecisionHeader = _ref => {
|
|
9
|
-
let {
|
|
10
|
-
onClose,
|
|
11
|
-
showClose
|
|
12
|
-
} = _ref;
|
|
13
|
-
return /*#__PURE__*/_jsx(ModalHeader, {
|
|
14
|
-
classProps: {
|
|
15
|
-
type: 'decision',
|
|
16
|
-
showClose
|
|
17
|
-
}
|
|
18
|
-
}, void 0, showClose && /*#__PURE__*/_jsx(DSButton, {
|
|
19
|
-
buttonType: "link",
|
|
20
|
-
containerProps: {
|
|
21
|
-
'data-testid': 'modal-button-close'
|
|
22
|
-
},
|
|
23
|
-
icon: _Close || (_Close = /*#__PURE__*/_jsx(Close, {})),
|
|
24
|
-
onClick: onClose
|
|
25
|
-
}));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { DecisionHeader, DecisionHeader as default };
|