@elliemae/ds-modal 1.60.0 → 2.0.0-alpha.12

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.
Files changed (111) hide show
  1. package/cjs/DSModal.js +59 -68
  2. package/cjs/constants.js +5 -6
  3. package/cjs/index.js +6 -29
  4. package/cjs/v1/DSModal.js +142 -13
  5. package/cjs/v1/DSModalType.js +1 -2
  6. package/cjs/v1/DSModalWrapper.js +116 -143
  7. package/cjs/v1/ModalFeedBack/ModalFeedBack.js +54 -55
  8. package/cjs/v2/DSModal.js +63 -102
  9. package/cjs/v2/blocks.js +65 -43
  10. package/cjs/v2/components/DecisionHeader.js +15 -15
  11. package/cjs/v2/components/FeedbackIcon.js +24 -23
  12. package/cjs/v2/components/Footer.js +50 -40
  13. package/cjs/v2/components/FormHeader.js +19 -19
  14. package/cjs/v2/components/ModalContent.js +99 -112
  15. package/cjs/v2/components/SelectionHeader.js +28 -19
  16. package/cjs/v2/components/Title.js +12 -13
  17. package/cjs/v2/helpers.js +17 -8
  18. package/esm/DSModal.js +23 -32
  19. package/esm/constants.js +4 -5
  20. package/esm/index.js +0 -23
  21. package/esm/v1/DSModal.js +138 -12
  22. package/esm/v1/DSModalType.js +1 -2
  23. package/esm/v1/DSModalWrapper.js +115 -137
  24. package/esm/v1/ModalFeedBack/ModalFeedBack.js +53 -54
  25. package/esm/v2/DSModal.js +54 -93
  26. package/esm/v2/blocks.js +65 -39
  27. package/esm/v2/components/DecisionHeader.js +12 -12
  28. package/esm/v2/components/FeedbackIcon.js +21 -20
  29. package/esm/v2/components/Footer.js +46 -36
  30. package/esm/v2/components/FormHeader.js +15 -15
  31. package/esm/v2/components/ModalContent.js +89 -103
  32. package/esm/v2/components/SelectionHeader.js +23 -15
  33. package/esm/v2/components/Title.js +9 -10
  34. package/esm/v2/helpers.js +17 -8
  35. package/package.json +101 -14
  36. package/types/DSModal.d.ts +14 -0
  37. package/types/constants.d.ts +25 -0
  38. package/types/index.d.ts +4 -0
  39. package/types/v1/DSModal.d.ts +143 -0
  40. package/types/v1/DSModalType.d.ts +1 -0
  41. package/types/v1/ModalFeedBack/ModalFeedBack.d.ts +11 -0
  42. package/types/v2/DSModal.d.ts +260 -0
  43. package/types/v2/blocks.d.ts +9 -0
  44. package/types/v2/components/DecisionHeader.d.ts +6 -0
  45. package/types/v2/components/FeedbackIcon.d.ts +5 -0
  46. package/types/v2/components/Footer.d.ts +13 -0
  47. package/types/v2/components/FormHeader.d.ts +8 -0
  48. package/types/v2/components/ModalContent.d.ts +21 -0
  49. package/types/v2/components/SelectionHeader.d.ts +8 -0
  50. package/types/v2/components/Title.d.ts +6 -0
  51. package/types/v2/components/tests/DecisionHeader.test.d.ts +1 -0
  52. package/types/v2/components/tests/FeedbackIcon.test.d.ts +1 -0
  53. package/types/v2/components/tests/Footer.test.d.ts +1 -0
  54. package/types/v2/components/tests/FormHeader.test.d.ts +1 -0
  55. package/types/v2/components/tests/SelectionHeader.test.d.ts +1 -0
  56. package/types/v2/helpers.d.ts +16 -0
  57. package/types/v2/tests/DSModal.test.d.ts +1 -0
  58. package/DSModal/package.json +0 -10
  59. package/cjs/DSModal-3126a986.js +0 -316
  60. package/cjs/DSModal-3126a986.js.map +0 -1
  61. package/cjs/DSModal.js.map +0 -1
  62. package/cjs/constants.js.map +0 -1
  63. package/cjs/index.js.map +0 -1
  64. package/cjs/v1/DSModal.js.map +0 -1
  65. package/cjs/v1/DSModalType.js.map +0 -1
  66. package/cjs/v1/DSModalWrapper.js.map +0 -1
  67. package/cjs/v1/ModalFeedBack/ModalFeedBack.js.map +0 -1
  68. package/cjs/v2/DSModal.js.map +0 -1
  69. package/cjs/v2/blocks.js.map +0 -1
  70. package/cjs/v2/components/DecisionHeader.js.map +0 -1
  71. package/cjs/v2/components/FeedbackIcon.js.map +0 -1
  72. package/cjs/v2/components/Footer.js.map +0 -1
  73. package/cjs/v2/components/FormHeader.js.map +0 -1
  74. package/cjs/v2/components/ModalContent.js.map +0 -1
  75. package/cjs/v2/components/SelectionHeader.js.map +0 -1
  76. package/cjs/v2/components/Title.js.map +0 -1
  77. package/cjs/v2/helpers.js.map +0 -1
  78. package/constants/package.json +0 -10
  79. package/esm/DSModal-a8b0fbf0.js +0 -303
  80. package/esm/DSModal-a8b0fbf0.js.map +0 -1
  81. package/esm/DSModal.js.map +0 -1
  82. package/esm/constants.js.map +0 -1
  83. package/esm/index.js.map +0 -1
  84. package/esm/v1/DSModal.js.map +0 -1
  85. package/esm/v1/DSModalType.js.map +0 -1
  86. package/esm/v1/DSModalWrapper.js.map +0 -1
  87. package/esm/v1/ModalFeedBack/ModalFeedBack.js.map +0 -1
  88. package/esm/v2/DSModal.js.map +0 -1
  89. package/esm/v2/blocks.js.map +0 -1
  90. package/esm/v2/components/DecisionHeader.js.map +0 -1
  91. package/esm/v2/components/FeedbackIcon.js.map +0 -1
  92. package/esm/v2/components/Footer.js.map +0 -1
  93. package/esm/v2/components/FormHeader.js.map +0 -1
  94. package/esm/v2/components/ModalContent.js.map +0 -1
  95. package/esm/v2/components/SelectionHeader.js.map +0 -1
  96. package/esm/v2/components/Title.js.map +0 -1
  97. package/esm/v2/helpers.js.map +0 -1
  98. package/v1/DSModal/package.json +0 -10
  99. package/v1/DSModalType/package.json +0 -10
  100. package/v1/DSModalWrapper/package.json +0 -10
  101. package/v1/ModalFeedBack/ModalFeedBack/package.json +0 -10
  102. package/v2/DSModal/package.json +0 -10
  103. package/v2/blocks/package.json +0 -10
  104. package/v2/components/DecisionHeader/package.json +0 -10
  105. package/v2/components/FeedbackIcon/package.json +0 -10
  106. package/v2/components/Footer/package.json +0 -10
  107. package/v2/components/FormHeader/package.json +0 -10
  108. package/v2/components/ModalContent/package.json +0 -10
  109. package/v2/components/SelectionHeader/package.json +0 -10
  110. package/v2/components/Title/package.json +0 -10
  111. package/v2/helpers/package.json +0 -10
package/esm/v1/DSModal.js CHANGED
@@ -1,13 +1,139 @@
1
- import '@babel/runtime/helpers/esm/extends';
2
- import '@babel/runtime/helpers/esm/defineProperty';
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';
3
8
  import 'react';
4
- import 'prop-types';
5
- import 'react-modal';
6
- import '@elliemae/ds-classnames';
7
- import '@elliemae/ds-icon';
8
- import '@elliemae/ds-icons';
9
- import '@elliemae/ds-button';
10
- import '../constants.js';
11
- import './ModalFeedBack/ModalFeedBack.js';
12
- export { D as default } from '../DSModal-a8b0fbf0.js';
13
- //# sourceMappingURL=DSModal.js.map
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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(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; }
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 };
@@ -1,4 +1,3 @@
1
- var modalTypes = [MODAL_TYPE.DEFAULT, MODAL_TYPE.ALERT, MODAL_TYPE.CONFIRM, MODAL_TYPE.NOTIFICATION, MODAL_TYPE.WARNING, MODAL_TYPE.ERROR, MODAL_TYPE.SUCCESS, MODAL_TYPE.HELP, MODAL_TYPE.INFO];
1
+ const modalTypes = [MODAL_TYPE.DEFAULT, MODAL_TYPE.ALERT, MODAL_TYPE.CONFIRM, MODAL_TYPE.NOTIFICATION, MODAL_TYPE.WARNING, MODAL_TYPE.ERROR, MODAL_TYPE.SUCCESS, MODAL_TYPE.HELP, MODAL_TYPE.INFO];
2
2
 
3
3
  export { modalTypes };
4
- //# sourceMappingURL=DSModalType.js.map
@@ -1,36 +1,21 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
3
- import _createClass from '@babel/runtime/helpers/esm/createClass';
4
- import _inherits from '@babel/runtime/helpers/esm/inherits';
5
- import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
6
- import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
7
- import { createElement, Component } from 'react';
7
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
+ import { Component, createElement } from 'react';
8
9
  import { MODAL_TYPE } from '../constants.js';
9
10
 
10
11
  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; }
11
12
 
12
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(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; }
13
-
14
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
-
16
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
- var DSModalWrapper = (function (WrappedComponent) {
18
- var DSModalWrapper = /*#__PURE__*/function (_Component) {
19
- _inherits(DSModalWrapper, _Component);
20
-
21
- var _super = _createSuper(DSModalWrapper);
22
-
23
- function DSModalWrapper() {
24
- var _this;
25
-
26
- _classCallCheck(this, DSModalWrapper);
27
-
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
-
32
- _this = _super.call.apply(_super, [this].concat(args));
33
- _this.state = {
14
+ var DSModalWrapper = (WrappedComponent => {
15
+ class DSModalWrapper extends Component {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.state = {
34
19
  childready: false,
35
20
  additionalFooterCssClass: 'loading',
36
21
  container: null,
@@ -38,145 +23,138 @@ var DSModalWrapper = (function (WrappedComponent) {
38
23
  height: '100%'
39
24
  };
40
25
 
41
- _this.onHeaderHeight = function (e) {
42
- _this.heightHeaderFlag = true;
43
- _this.heightHeader = e.height || 0;
26
+ this.onHeaderHeight = e => {
27
+ this.heightHeaderFlag = true;
28
+ this.heightHeader = e.height || 0;
44
29
  };
45
30
 
46
- _this.onFooterHeight = function (e) {
47
- _this.heightFooterFlag = true;
48
- _this.heightFooter = e.height || 0;
31
+ this.onFooterHeight = e => {
32
+ this.heightFooterFlag = true;
33
+ this.heightFooter = e.height || 0;
49
34
  };
50
35
 
51
- _this.onResize = function (_ref) {
52
- var bounds = _ref.bounds;
36
+ this.onResize = _ref => {
37
+ let {
38
+ bounds
39
+ } = _ref;
53
40
 
54
- if (_this.heightFooterFlag && _this.heightHeaderFlag) {
55
- return _this.setState({
56
- height: bounds.height - _this.heightFooter - _this.heightHeader
41
+ if (this.heightFooterFlag && this.heightHeaderFlag) {
42
+ return this.setState({
43
+ height: bounds.height - this.heightFooter - this.heightHeader
57
44
  });
58
45
  }
59
46
 
60
- return setTimeout(_this.onResize({
61
- bounds: bounds
47
+ return setTimeout(this.onResize({
48
+ bounds
62
49
  }), 0);
63
50
  };
64
51
 
65
- _this.handleContainer = function (node) {
66
- if (node) _this.setState({
52
+ this.handleContainer = node => {
53
+ if (node) this.setState({
67
54
  container: node
68
55
  });
69
-
70
- _this.handleResize();
56
+ this.handleResize();
71
57
  };
72
58
 
73
- _this.handleActions = function (node) {
74
- if (node) _this.setState({
59
+ this.handleActions = node => {
60
+ if (node) this.setState({
75
61
  actions: node
76
62
  });
77
-
78
- _this.handleResize();
63
+ this.handleResize();
79
64
  };
65
+ }
80
66
 
81
- return _this;
67
+ componentDidMount() {
68
+ window.addEventListener('resize', this.handleResize);
82
69
  }
83
70
 
84
- _createClass(DSModalWrapper, [{
85
- key: "componentDidMount",
86
- value: function componentDidMount() {
87
- window.addEventListener('resize', this.handleResize);
88
- }
89
- }, {
90
- key: "componentWillUnmount",
91
- value: function componentWillUnmount() {
92
- window.removeEventListener('resize', this.handleResize);
93
- }
94
- }, {
95
- key: "handleResize",
96
- value:
97
- /**
98
- * Change button width to 100% if the
99
- * combined width of the button (or button group) exceed 50% of the container width.
100
- */
101
- function handleResize() {
102
- if (!this.state) return null;
103
- var _this$state = this.state,
104
- container = _this$state.container,
105
- actions = _this$state.actions,
106
- childready = _this$state.childready;
107
- if (!childready) return null;
108
- this.setState({
109
- additionalFooterCssClass: null
110
- }); // !important reset to default state to recalculate
111
-
112
- var containerWidth = container.clientWidth;
113
- var actionsWidth = actions.clientWidth; // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.
114
-
115
- if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
116
- return this.setState({
117
- additionalFooterCssClass: 'fluid-actions'
118
- });
119
- }
71
+ componentWillUnmount() {
72
+ window.removeEventListener('resize', this.handleResize);
73
+ }
120
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) {
121
99
  return this.setState({
122
- additionalFooterCssClass: null
100
+ additionalFooterCssClass: 'fluid-actions'
123
101
  });
124
102
  }
125
- }, {
126
- key: "verifyNodes",
127
- value: function verifyNodes() {
128
- var _this2 = this;
129
-
130
- var modalType = this.props.modalType;
131
-
132
- if (modalType !== MODAL_TYPE.DEFAULT) {
133
- var nodesInterval = setInterval(function () {
134
- // !important it checks when nodes are availables
135
- var _this2$state = _this2.state,
136
- container = _this2$state.container,
137
- actions = _this2$state.actions;
138
- if (!container || !actions) return null;
139
- clearInterval(nodesInterval);
140
-
141
- _this2.setState({
142
- childready: true
143
- });
144
-
145
- return _this2.handleResize();
146
- }, 100);
147
- }
148
- }
149
- }, {
150
- key: "render",
151
- value: function render() {
152
- var _this3 = this;
153
-
154
- var props = this.props,
155
- state = this.state;
156
- var additionalFooterCssClass = state.additionalFooterCssClass,
157
- height = state.height;
158
- return /*#__PURE__*/createElement(WrappedComponent, _objectSpread(_objectSpread({}, props), {}, {
159
- height: height,
160
- onResize: this.onResize,
161
- onFooterHeight: this.onFooterHeight,
162
- onHeaderHeight: this.onHeaderHeight,
163
- containerRef: this.handleContainer,
164
- actionsRef: this.handleActions,
165
- additionalFooterCssClass: additionalFooterCssClass,
166
- onAfterOpen: function onAfterOpen() {
167
- if (props.onAfterOpen) props.onAfterOpen();
168
-
169
- _this3.verifyNodes();
170
- }
171
- }));
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);
172
128
  }
173
- }]);
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
+ }
174
154
 
175
- return DSModalWrapper;
176
- }(Component);
155
+ }
177
156
 
178
157
  return DSModalWrapper;
179
158
  });
180
159
 
181
160
  export { DSModalWrapper as default };
182
- //# sourceMappingURL=DSModalWrapper.js.map
@@ -1,21 +1,27 @@
1
- import React from 'react';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
2
3
  import { InfoCircle, HelpCircle, CheckmarkCircle, WarningCircle } from '@elliemae/ds-icons';
3
4
  import { convertPropToCssClassName } from '@elliemae/ds-classnames';
4
5
  import { MODAL_TYPE } from '../../constants.js';
5
6
 
6
- var feedbackIconSize = 'xxl';
7
- var WARNING = MODAL_TYPE.WARNING,
8
- ERROR = MODAL_TYPE.ERROR,
9
- SUCCESS = MODAL_TYPE.SUCCESS,
10
- HELP = MODAL_TYPE.HELP,
11
- INFO = MODAL_TYPE.INFO;
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;
12
16
 
13
- var getModalType = function getModalType(modalType, _ref) {
14
- var hasError = _ref.hasError,
15
- hasWarning = _ref.hasWarning,
16
- hasSuccess = _ref.hasSuccess,
17
- hasInfo = _ref.hasInfo,
18
- hasHelp = _ref.hasHelp;
17
+ const getModalType = (modalType, _ref) => {
18
+ let {
19
+ hasError,
20
+ hasWarning,
21
+ hasSuccess,
22
+ hasInfo,
23
+ hasHelp
24
+ } = _ref;
19
25
  if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;
20
26
  if (hasError) return ERROR;
21
27
  if (hasWarning) return WARNING;
@@ -25,69 +31,62 @@ var getModalType = function getModalType(modalType, _ref) {
25
31
  return INFO;
26
32
  };
27
33
 
28
- var getIconType = function getIconType(modalType) {
34
+ const getIconType = modalType => {
29
35
  switch (modalType) {
30
36
  case WARNING:
31
37
  case ERROR:
32
- return /*#__PURE__*/React.createElement(WarningCircle, {
38
+ return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx(WarningCircle, {
33
39
  size: feedbackIconSize
34
- });
40
+ }));
35
41
 
36
42
  case SUCCESS:
37
- return /*#__PURE__*/React.createElement(CheckmarkCircle, {
43
+ return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx(CheckmarkCircle, {
38
44
  size: feedbackIconSize
39
- });
45
+ }));
40
46
 
41
47
  case HELP:
42
- return /*#__PURE__*/React.createElement(HelpCircle, {
48
+ return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx(HelpCircle, {
43
49
  size: feedbackIconSize
44
- });
50
+ }));
45
51
 
46
52
  case INFO:
47
- return /*#__PURE__*/React.createElement(InfoCircle, {
53
+ return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx(InfoCircle, {
48
54
  size: feedbackIconSize
49
- });
55
+ }));
50
56
 
51
57
  default:
52
- return /*#__PURE__*/React.createElement(InfoCircle, {
58
+ return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx(InfoCircle, {
53
59
  size: feedbackIconSize
54
- });
60
+ }));
55
61
  }
56
62
  };
57
63
 
58
- var ModalFeedBack = function ModalFeedBack(_ref2) {
59
- var _ref2$className = _ref2.className,
60
- className = _ref2$className === void 0 ? '' : _ref2$className,
61
- _ref2$modalType = _ref2.modalType,
62
- modalType = _ref2$modalType === void 0 ? null : _ref2$modalType,
63
- _ref2$hasError = _ref2.hasError,
64
- hasError = _ref2$hasError === void 0 ? false : _ref2$hasError,
65
- _ref2$hasWarning = _ref2.hasWarning,
66
- hasWarning = _ref2$hasWarning === void 0 ? false : _ref2$hasWarning,
67
- _ref2$hasSuccess = _ref2.hasSuccess,
68
- hasSuccess = _ref2$hasSuccess === void 0 ? false : _ref2$hasSuccess,
69
- _ref2$hasInfo = _ref2.hasInfo,
70
- hasInfo = _ref2$hasInfo === void 0 ? false : _ref2$hasInfo,
71
- _ref2$hasHelp = _ref2.hasHelp,
72
- hasHelp = _ref2$hasHelp === void 0 ? false : _ref2$hasHelp;
73
- var type = getModalType(modalType, {
74
- hasError: hasError,
75
- hasWarning: hasWarning,
76
- hasSuccess: hasSuccess,
77
- hasInfo: hasInfo,
78
- hasHelp: hasHelp
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
79
80
  });
80
-
81
- var _convertPropToCssClas = convertPropToCssClassName('modal-feedback', className, {
81
+ const {
82
+ cssClassName
83
+ } = convertPropToCssClassName('modal-feedback', className, {
82
84
  modalType: type
83
- }),
84
- cssClassName = _convertPropToCssClas.cssClassName;
85
-
86
- var feedbackIcon = getIconType(type);
87
- return /*#__PURE__*/React.createElement("div", {
85
+ });
86
+ const feedbackIcon = getIconType(type);
87
+ return /*#__PURE__*/_jsx("div", {
88
88
  className: cssClassName
89
- }, feedbackIcon);
89
+ }, void 0, feedbackIcon);
90
90
  };
91
91
 
92
92
  export { ModalFeedBack as default };
93
- //# sourceMappingURL=ModalFeedBack.js.map