@elliemae/ds-modal 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/DSModal.js +40 -35
- package/cjs/constants.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/v1/DSModal.js +60 -55
- package/cjs/v1/DSModalWrapper.js +25 -18
- package/cjs/v1/ModalFeedBack/ModalFeedBack.js +25 -30
- package/cjs/v2/DSModal.js +49 -42
- package/cjs/v2/blocks.js +72 -48
- package/cjs/v2/components/DecisionHeader.js +22 -20
- package/cjs/v2/components/FeedbackIcon.js +17 -23
- package/cjs/v2/components/Footer.js +45 -37
- package/cjs/v2/components/FormHeader.js +31 -29
- package/cjs/v2/components/ModalContent.js +85 -77
- package/cjs/v2/components/SelectionHeader.js +29 -22
- package/cjs/v2/components/Title.js +12 -9
- package/cjs/v2/helpers.js +21 -16
- package/esm/DSModal.js +5 -0
- package/esm/v1/DSModal.js +48 -42
- package/esm/v1/DSModalWrapper.js +24 -17
- package/esm/v1/ModalFeedBack/ModalFeedBack.js +19 -20
- package/esm/v2/DSModal.js +42 -35
- package/esm/v2/blocks.js +72 -48
- package/esm/v2/components/DecisionHeader.js +21 -18
- package/esm/v2/components/FeedbackIcon.js +11 -12
- package/esm/v2/components/Footer.js +43 -35
- package/esm/v2/components/FormHeader.js +30 -27
- package/esm/v2/components/ModalContent.js +84 -76
- package/esm/v2/components/SelectionHeader.js +27 -19
- package/esm/v2/components/Title.js +11 -8
- package/esm/v2/helpers.js +21 -16
- package/package.json +13 -4
- package/types/v1/DSModal.d.ts +1 -1
- package/types/v2/DSModal.d.ts +197 -28
- package/types/v2/components/SelectionHeader.d.ts +1 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/DSModal.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
12
|
require('react');
|
|
@@ -23,159 +28,159 @@ const _excluded = ["version"];
|
|
|
23
28
|
|
|
24
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
30
|
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
32
|
|
|
28
33
|
const DSModal = _ref => {
|
|
29
34
|
let {
|
|
30
35
|
version = 1
|
|
31
36
|
} = _ref,
|
|
32
|
-
rest = _objectWithoutProperties__default[
|
|
37
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
33
38
|
|
|
34
|
-
if (version === 2) return /*#__PURE__*/jsxRuntime.jsx(DSModal$1[
|
|
39
|
+
if (version === 2) return /*#__PURE__*/jsxRuntime.jsx(DSModal$1["default"], _objectSpread({}, rest));
|
|
35
40
|
return /*#__PURE__*/jsxRuntime.jsx(DSModal$2, _objectSpread({}, rest));
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
DSModal$2.propTypes = {
|
|
39
|
-
version: PropTypes__default[
|
|
40
|
-
className: PropTypes__default[
|
|
44
|
+
version: PropTypes__default["default"].oneOf([1, 2]),
|
|
45
|
+
className: PropTypes__default["default"].string,
|
|
41
46
|
|
|
42
47
|
/**
|
|
43
48
|
* Add an additional css class to the footer
|
|
44
49
|
*/
|
|
45
|
-
additionalFooterCssClass: PropTypes__default[
|
|
50
|
+
additionalFooterCssClass: PropTypes__default["default"].string,
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
53
|
* Set style for the modal
|
|
49
54
|
*/
|
|
50
|
-
style: PropTypes__default[
|
|
55
|
+
style: PropTypes__default["default"].objectOf(PropTypes__default["default"].string),
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
* Select size for the close icon
|
|
54
59
|
*/
|
|
55
|
-
iconCloseSize: PropTypes__default[
|
|
60
|
+
iconCloseSize: PropTypes__default["default"].oneOf(propTypes.iconSizes),
|
|
56
61
|
|
|
57
62
|
/**
|
|
58
63
|
* ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']
|
|
59
64
|
*/
|
|
60
|
-
modalType: PropTypes__default[
|
|
65
|
+
modalType: PropTypes__default["default"].oneOf(constants.modalTypes),
|
|
61
66
|
|
|
62
67
|
/**
|
|
63
68
|
* Show the header or not
|
|
64
69
|
*/
|
|
65
|
-
showHeader: PropTypes__default[
|
|
70
|
+
showHeader: PropTypes__default["default"].bool,
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* Show the footer or not
|
|
69
74
|
*/
|
|
70
|
-
showFooter: PropTypes__default[
|
|
75
|
+
showFooter: PropTypes__default["default"].bool,
|
|
71
76
|
|
|
72
77
|
/**
|
|
73
78
|
* Main content of the modal
|
|
74
79
|
*/
|
|
75
|
-
children: PropTypes__default[
|
|
80
|
+
children: PropTypes__default["default"].element.isRequired,
|
|
76
81
|
|
|
77
82
|
/**
|
|
78
83
|
* Content is centered or not
|
|
79
84
|
*/
|
|
80
|
-
centered: PropTypes__default[
|
|
85
|
+
centered: PropTypes__default["default"].bool,
|
|
81
86
|
|
|
82
87
|
/**
|
|
83
88
|
* Text to be added in the confirm button
|
|
84
89
|
*/
|
|
85
|
-
confirmLabel: PropTypes__default[
|
|
90
|
+
confirmLabel: PropTypes__default["default"].string,
|
|
86
91
|
|
|
87
92
|
/**
|
|
88
93
|
* Text to be added in the modal title
|
|
89
94
|
*/
|
|
90
|
-
modalTitle: PropTypes__default[
|
|
95
|
+
modalTitle: PropTypes__default["default"].string,
|
|
91
96
|
|
|
92
97
|
/**
|
|
93
98
|
* Text to be added in the modal title
|
|
94
99
|
*/
|
|
95
|
-
size: PropTypes__default[
|
|
100
|
+
size: PropTypes__default["default"].oneOf(propTypes.sizes),
|
|
96
101
|
|
|
97
102
|
/**
|
|
98
103
|
* Modal is open or not
|
|
99
104
|
*/
|
|
100
|
-
isOpen: PropTypes__default[
|
|
105
|
+
isOpen: PropTypes__default["default"].bool,
|
|
101
106
|
|
|
102
107
|
/**
|
|
103
108
|
* Allows a function to be triggered once the modal is closed
|
|
104
109
|
*/
|
|
105
|
-
onClose: PropTypes__default[
|
|
110
|
+
onClose: PropTypes__default["default"].func,
|
|
106
111
|
|
|
107
112
|
/**
|
|
108
113
|
* Allows a function to be triggered once the modal is opened
|
|
109
114
|
*/
|
|
110
|
-
onAfterOpen: PropTypes__default[
|
|
115
|
+
onAfterOpen: PropTypes__default["default"].func,
|
|
111
116
|
|
|
112
117
|
/**
|
|
113
118
|
* Allows a function to be triggered once the modal open is confirmed
|
|
114
119
|
*/
|
|
115
|
-
onConfirm: PropTypes__default[
|
|
120
|
+
onConfirm: PropTypes__default["default"].func,
|
|
116
121
|
|
|
117
122
|
/**
|
|
118
123
|
* Allows a function to be triggered once the modal open is rejected
|
|
119
124
|
*/
|
|
120
|
-
onReject: PropTypes__default[
|
|
125
|
+
onReject: PropTypes__default["default"].func,
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
128
|
* Text to be added in the reject button
|
|
124
129
|
*/
|
|
125
|
-
rejectLabel: PropTypes__default[
|
|
130
|
+
rejectLabel: PropTypes__default["default"].string,
|
|
126
131
|
|
|
127
132
|
/**
|
|
128
133
|
* If modal should close on overlay click
|
|
129
134
|
*/
|
|
130
|
-
shouldCloseOnOverlayClick: PropTypes__default[
|
|
135
|
+
shouldCloseOnOverlayClick: PropTypes__default["default"].bool,
|
|
131
136
|
|
|
132
137
|
/**
|
|
133
138
|
* Modal has error or not
|
|
134
139
|
*/
|
|
135
|
-
hasError: PropTypes__default[
|
|
140
|
+
hasError: PropTypes__default["default"].bool,
|
|
136
141
|
|
|
137
142
|
/**
|
|
138
143
|
* Modal has warning or not
|
|
139
144
|
*/
|
|
140
|
-
hasWarning: PropTypes__default[
|
|
145
|
+
hasWarning: PropTypes__default["default"].bool,
|
|
141
146
|
|
|
142
147
|
/**
|
|
143
148
|
* Modal has success or not
|
|
144
149
|
*/
|
|
145
|
-
hasSuccess: PropTypes__default[
|
|
150
|
+
hasSuccess: PropTypes__default["default"].bool,
|
|
146
151
|
|
|
147
152
|
/**
|
|
148
153
|
* Modal has info or not
|
|
149
154
|
*/
|
|
150
|
-
hasInfo: PropTypes__default[
|
|
155
|
+
hasInfo: PropTypes__default["default"].bool,
|
|
151
156
|
|
|
152
157
|
/**
|
|
153
158
|
* Modal has help or not
|
|
154
159
|
*/
|
|
155
|
-
hasHelp: PropTypes__default[
|
|
156
|
-
actionsRef: PropTypes__default[
|
|
157
|
-
appElement: PropTypes__default[
|
|
160
|
+
hasHelp: PropTypes__default["default"].bool,
|
|
161
|
+
actionsRef: PropTypes__default["default"].func,
|
|
162
|
+
appElement: PropTypes__default["default"].string,
|
|
158
163
|
|
|
159
164
|
/**
|
|
160
165
|
* Customized props for the confirm button
|
|
161
166
|
*/
|
|
162
|
-
overridePropsConfirmButton: PropTypes__default[
|
|
167
|
+
overridePropsConfirmButton: PropTypes__default["default"].objectOf(PropTypes__default["default"].shape({})),
|
|
163
168
|
|
|
164
169
|
/**
|
|
165
170
|
* Customized props for the reject button
|
|
166
171
|
*/
|
|
167
|
-
overridePropsRejectButton: PropTypes__default[
|
|
172
|
+
overridePropsRejectButton: PropTypes__default["default"].objectOf(PropTypes__default["default"].string),
|
|
168
173
|
|
|
169
174
|
/**
|
|
170
175
|
* Show confirm button
|
|
171
176
|
*/
|
|
172
|
-
showConfirmButton: PropTypes__default[
|
|
177
|
+
showConfirmButton: PropTypes__default["default"].bool,
|
|
173
178
|
|
|
174
179
|
/**
|
|
175
180
|
* Show confirm button
|
|
176
181
|
*/
|
|
177
|
-
customCloseComponent: PropTypes__default[
|
|
182
|
+
customCloseComponent: PropTypes__default["default"].element
|
|
178
183
|
};
|
|
179
184
|
|
|
180
185
|
exports.DSModalContent = ModalContent.DSModalContent;
|
|
181
|
-
exports[
|
|
186
|
+
exports["default"] = DSModal;
|
package/cjs/constants.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var ModalContent = require('./v2/components/ModalContent.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports
|
|
12
|
+
exports["default"] = DSModal$1["default"];
|
|
13
13
|
exports.MODAL_SUB_TYPE_V2 = constants.MODAL_SUB_TYPE_V2;
|
|
14
14
|
exports.MODAL_TYPE = constants.MODAL_TYPE;
|
|
15
15
|
exports.MODAL_TYPE_V2 = constants.MODAL_TYPE_V2;
|
package/cjs/v1/DSModal.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
3
8
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
9
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
10
|
require('react');
|
|
6
11
|
var ReactModal = require('react-modal');
|
|
7
12
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var DSButton = require('@elliemae/ds-
|
|
13
|
+
var dsIcon = require('@elliemae/ds-icon');
|
|
14
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
15
|
+
var DSButton = require('@elliemae/ds-button');
|
|
11
16
|
var constants = require('../constants.js');
|
|
12
17
|
var ModalFeedBack = require('./ModalFeedBack/ModalFeedBack.js');
|
|
13
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -17,50 +22,50 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
24
|
var ReactModal__default = /*#__PURE__*/_interopDefaultLegacy(ReactModal);
|
|
20
|
-
var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
|
|
21
25
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
22
26
|
|
|
23
|
-
var
|
|
27
|
+
var _Close;
|
|
24
28
|
|
|
25
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
26
30
|
|
|
27
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
28
32
|
|
|
29
|
-
const DSModal =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
33
|
+
const DSModal = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
containerProps = {},
|
|
36
|
+
className = '',
|
|
37
|
+
dataTestId = 'ds-modal',
|
|
38
|
+
additionalFooterCssClass = '',
|
|
39
|
+
style = {},
|
|
40
|
+
iconCloseSize = dsIcon.DSIconSizes.S,
|
|
41
|
+
modalType = constants.MODAL_TYPE.DEFAULT,
|
|
42
|
+
showHeader = true,
|
|
43
|
+
showFooter = true,
|
|
44
|
+
children,
|
|
45
|
+
centered = true,
|
|
46
|
+
confirmLabel = 'Accept',
|
|
47
|
+
modalTitle = '',
|
|
48
|
+
size = 'medium',
|
|
49
|
+
isOpen = false,
|
|
50
|
+
onClose = () => null,
|
|
51
|
+
onAfterOpen = () => null,
|
|
52
|
+
onConfirm = () => null,
|
|
53
|
+
onReject = () => null,
|
|
54
|
+
rejectLabel = 'Cancel',
|
|
55
|
+
shouldCloseOnOverlayClick = false,
|
|
56
|
+
hasError = false,
|
|
57
|
+
hasWarning = false,
|
|
58
|
+
hasSuccess = false,
|
|
59
|
+
hasInfo = false,
|
|
60
|
+
hasHelp = false,
|
|
61
|
+
actionsRef = () => null,
|
|
62
|
+
appElement = '#root',
|
|
63
|
+
overridePropsConfirmButton = {},
|
|
64
|
+
overridePropsRejectButton = {},
|
|
65
|
+
zIndex = 10
|
|
66
|
+
} = _ref;
|
|
62
67
|
// http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples
|
|
63
|
-
typeof document !== 'undefined' && document && ReactModal__default[
|
|
68
|
+
typeof document !== 'undefined' && document && ReactModal__default["default"].setAppElement && ReactModal__default["default"].setAppElement(appElement); // eslint-disable-line
|
|
64
69
|
|
|
65
70
|
const {
|
|
66
71
|
cssClassName,
|
|
@@ -84,14 +89,14 @@ const DSModal = ({
|
|
|
84
89
|
} = constants.MODAL_TYPE;
|
|
85
90
|
const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
|
|
86
91
|
const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
|
|
87
|
-
return /*#__PURE__*/_jsx__default[
|
|
92
|
+
return /*#__PURE__*/_jsx__default["default"](ReactModal__default["default"], {
|
|
88
93
|
testId: dataTestId,
|
|
89
94
|
className: cssClassName,
|
|
90
95
|
contentLabel: modalTitle,
|
|
91
96
|
isOpen: isOpen,
|
|
92
97
|
onAfterOpen: onAfterOpen,
|
|
93
98
|
onRequestClose: onClose,
|
|
94
|
-
overlayClassName:
|
|
99
|
+
overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered && 'center')),
|
|
95
100
|
shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
|
|
96
101
|
style: {
|
|
97
102
|
content: _objectSpread({}, style),
|
|
@@ -100,39 +105,39 @@ const DSModal = ({
|
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
}, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
103
|
-
children: [showHeader && /*#__PURE__*/_jsx__default[
|
|
108
|
+
children: [showHeader && /*#__PURE__*/_jsx__default["default"]("div", {
|
|
104
109
|
className: classNameBlock('modal-header')
|
|
105
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
110
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
|
|
106
111
|
className: classNameElement('title', 'modal-header')
|
|
107
|
-
}, void 0, modalTitle), /*#__PURE__*/_jsx__default[
|
|
112
|
+
}, void 0, modalTitle), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
108
113
|
className: classNameElement('icon', 'modal-header')
|
|
109
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
114
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
110
115
|
buttonType: "link",
|
|
111
|
-
icon:
|
|
116
|
+
icon: _Close || (_Close = /*#__PURE__*/_jsx__default["default"](dsIcons.Close, {})),
|
|
112
117
|
onClick: onClose,
|
|
113
118
|
size: iconCloseSize
|
|
114
|
-
}))), /*#__PURE__*/_jsx__default[
|
|
119
|
+
}))), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
115
120
|
className: classNameElement('body')
|
|
116
|
-
}, void 0, showFeedBack && /*#__PURE__*/_jsx__default[
|
|
121
|
+
}, void 0, showFeedBack && /*#__PURE__*/_jsx__default["default"](ModalFeedBack, {
|
|
117
122
|
hasError: hasError,
|
|
118
123
|
hasHelp: hasHelp,
|
|
119
124
|
hasInfo: hasInfo,
|
|
120
125
|
hasSuccess: hasSuccess,
|
|
121
126
|
hasWarning: hasWarning,
|
|
122
127
|
modalType: modalType
|
|
123
|
-
}), children), showFooter && !isAFeedbackType && /*#__PURE__*/_jsx__default[
|
|
124
|
-
className:
|
|
128
|
+
}), children), showFooter && !isAFeedbackType && /*#__PURE__*/_jsx__default["default"]("div", {
|
|
129
|
+
className: "".concat(classNameBlock('modal-footer'), " ").concat(additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : '')
|
|
125
130
|
}, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
126
131
|
ref: actionsRef,
|
|
127
132
|
className: classNameBlock('modal-footer-actions'),
|
|
128
|
-
children: [modalType === constants.MODAL_TYPE.CONFIRM && /*#__PURE__*/jsxRuntime.jsx(DSButton__default[
|
|
133
|
+
children: [modalType === constants.MODAL_TYPE.CONFIRM && /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
|
|
129
134
|
buttonType: "secondary",
|
|
130
|
-
className:
|
|
135
|
+
className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('reject', 'button-action'), " "),
|
|
131
136
|
labelText: rejectLabel,
|
|
132
137
|
onClick: onReject
|
|
133
|
-
}, overridePropsRejectButton)), /*#__PURE__*/jsxRuntime.jsx(DSButton__default[
|
|
138
|
+
}, overridePropsRejectButton)), /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
|
|
134
139
|
buttonType: "primary",
|
|
135
|
-
className:
|
|
140
|
+
className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('confirm', 'button-action'), " "),
|
|
136
141
|
labelText: confirmLabel,
|
|
137
142
|
onClick: onConfirm
|
|
138
143
|
}, overridePropsConfirmButton))]
|
package/cjs/v1/DSModalWrapper.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
4
10
|
var react = require('react');
|
|
5
11
|
var constants = require('../constants.js');
|
|
6
12
|
|
|
@@ -10,33 +16,34 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
10
16
|
|
|
11
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
18
|
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
20
|
var DSModalWrapper = (WrappedComponent => {
|
|
15
21
|
class DSModalWrapper extends react.Component {
|
|
16
|
-
constructor(
|
|
17
|
-
super(...
|
|
18
|
-
|
|
19
|
-
_defineProperty__default['default'](this, "state", {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.state = {
|
|
20
25
|
childready: false,
|
|
21
26
|
additionalFooterCssClass: 'loading',
|
|
22
27
|
container: null,
|
|
23
28
|
actions: null,
|
|
24
29
|
height: '100%'
|
|
25
|
-
}
|
|
30
|
+
};
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
this.onHeaderHeight = e => {
|
|
28
33
|
this.heightHeaderFlag = true;
|
|
29
34
|
this.heightHeader = e.height || 0;
|
|
30
|
-
}
|
|
35
|
+
};
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
this.onFooterHeight = e => {
|
|
33
38
|
this.heightFooterFlag = true;
|
|
34
39
|
this.heightFooter = e.height || 0;
|
|
35
|
-
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
this.onResize = _ref => {
|
|
43
|
+
let {
|
|
44
|
+
bounds
|
|
45
|
+
} = _ref;
|
|
36
46
|
|
|
37
|
-
_defineProperty__default['default'](this, "onResize", ({
|
|
38
|
-
bounds
|
|
39
|
-
}) => {
|
|
40
47
|
if (this.heightFooterFlag && this.heightHeaderFlag) {
|
|
41
48
|
return this.setState({
|
|
42
49
|
height: bounds.height - this.heightFooter - this.heightHeader
|
|
@@ -46,21 +53,21 @@ var DSModalWrapper = (WrappedComponent => {
|
|
|
46
53
|
return setTimeout(this.onResize({
|
|
47
54
|
bounds
|
|
48
55
|
}), 0);
|
|
49
|
-
}
|
|
56
|
+
};
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
this.handleContainer = node => {
|
|
52
59
|
if (node) this.setState({
|
|
53
60
|
container: node
|
|
54
61
|
});
|
|
55
62
|
this.handleResize();
|
|
56
|
-
}
|
|
63
|
+
};
|
|
57
64
|
|
|
58
|
-
|
|
65
|
+
this.handleActions = node => {
|
|
59
66
|
if (node) this.setState({
|
|
60
67
|
actions: node
|
|
61
68
|
});
|
|
62
69
|
this.handleResize();
|
|
63
|
-
}
|
|
70
|
+
};
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
componentDidMount() {
|
|
@@ -2,20 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
require('react');
|
|
5
|
-
var
|
|
6
|
-
var CheckmarkCircle = require('@elliemae/ds-icons/CheckmarkCircle');
|
|
7
|
-
var HelpCircle = require('@elliemae/ds-icons/HelpCircle');
|
|
8
|
-
var InfoCircle = require('@elliemae/ds-icons/InfoCircle');
|
|
5
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
9
6
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
7
|
var constants = require('../../constants.js');
|
|
11
8
|
|
|
12
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
10
|
|
|
14
11
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var WarningCircle__default = /*#__PURE__*/_interopDefaultLegacy(WarningCircle);
|
|
16
|
-
var CheckmarkCircle__default = /*#__PURE__*/_interopDefaultLegacy(CheckmarkCircle);
|
|
17
|
-
var HelpCircle__default = /*#__PURE__*/_interopDefaultLegacy(HelpCircle);
|
|
18
|
-
var InfoCircle__default = /*#__PURE__*/_interopDefaultLegacy(InfoCircle);
|
|
19
12
|
|
|
20
13
|
var _WarningCircle, _CheckmarkCircle, _HelpCircle, _InfoCircle, _InfoCircle2;
|
|
21
14
|
const feedbackIconSize = 'xxl';
|
|
@@ -27,13 +20,14 @@ const {
|
|
|
27
20
|
INFO
|
|
28
21
|
} = constants.MODAL_TYPE;
|
|
29
22
|
|
|
30
|
-
const getModalType = (modalType, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
const getModalType = (modalType, _ref) => {
|
|
24
|
+
let {
|
|
25
|
+
hasError,
|
|
26
|
+
hasWarning,
|
|
27
|
+
hasSuccess,
|
|
28
|
+
hasInfo,
|
|
29
|
+
hasHelp
|
|
30
|
+
} = _ref;
|
|
37
31
|
if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;
|
|
38
32
|
if (hasError) return ERROR;
|
|
39
33
|
if (hasWarning) return WARNING;
|
|
@@ -47,41 +41,42 @@ const getIconType = modalType => {
|
|
|
47
41
|
switch (modalType) {
|
|
48
42
|
case WARNING:
|
|
49
43
|
case ERROR:
|
|
50
|
-
return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx__default[
|
|
44
|
+
return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.WarningCircle, {
|
|
51
45
|
size: feedbackIconSize
|
|
52
46
|
}));
|
|
53
47
|
|
|
54
48
|
case SUCCESS:
|
|
55
|
-
return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx__default[
|
|
49
|
+
return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.CheckmarkCircle, {
|
|
56
50
|
size: feedbackIconSize
|
|
57
51
|
}));
|
|
58
52
|
|
|
59
53
|
case HELP:
|
|
60
|
-
return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx__default[
|
|
54
|
+
return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.HelpCircle, {
|
|
61
55
|
size: feedbackIconSize
|
|
62
56
|
}));
|
|
63
57
|
|
|
64
58
|
case INFO:
|
|
65
|
-
return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx__default[
|
|
59
|
+
return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.InfoCircle, {
|
|
66
60
|
size: feedbackIconSize
|
|
67
61
|
}));
|
|
68
62
|
|
|
69
63
|
default:
|
|
70
|
-
return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx__default[
|
|
64
|
+
return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx__default["default"](dsIcons.InfoCircle, {
|
|
71
65
|
size: feedbackIconSize
|
|
72
66
|
}));
|
|
73
67
|
}
|
|
74
68
|
};
|
|
75
69
|
|
|
76
|
-
const ModalFeedBack =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
const ModalFeedBack = _ref2 => {
|
|
71
|
+
let {
|
|
72
|
+
className = '',
|
|
73
|
+
modalType = null,
|
|
74
|
+
hasError = false,
|
|
75
|
+
hasWarning = false,
|
|
76
|
+
hasSuccess = false,
|
|
77
|
+
hasInfo = false,
|
|
78
|
+
hasHelp = false
|
|
79
|
+
} = _ref2;
|
|
85
80
|
const type = getModalType(modalType, {
|
|
86
81
|
hasError,
|
|
87
82
|
hasWarning,
|
|
@@ -95,7 +90,7 @@ const ModalFeedBack = ({
|
|
|
95
90
|
modalType: type
|
|
96
91
|
});
|
|
97
92
|
const feedbackIcon = getIconType(type);
|
|
98
|
-
return /*#__PURE__*/_jsx__default[
|
|
93
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
99
94
|
className: cssClassName
|
|
100
95
|
}, void 0, feedbackIcon);
|
|
101
96
|
};
|