@elliemae/ds-modal 1.57.1-rc.0 → 2.0.0-alpha.11

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 +54 -68
  2. package/cjs/constants.js +5 -6
  3. package/cjs/index.js +6 -29
  4. package/cjs/v1/DSModal.js +137 -13
  5. package/cjs/v1/DSModalType.js +1 -2
  6. package/cjs/v1/DSModalWrapper.js +110 -146
  7. package/cjs/v1/ModalFeedBack/ModalFeedBack.js +60 -56
  8. package/cjs/v2/DSModal.js +56 -102
  9. package/cjs/v2/blocks.js +49 -51
  10. package/cjs/v2/components/DecisionHeader.js +25 -27
  11. package/cjs/v2/components/FeedbackIcon.js +35 -28
  12. package/cjs/v2/components/Footer.js +33 -31
  13. package/cjs/v2/components/FormHeader.js +34 -36
  14. package/cjs/v2/components/ModalContent.js +68 -89
  15. package/cjs/v2/components/SelectionHeader.js +32 -30
  16. package/cjs/v2/components/Title.js +13 -17
  17. package/cjs/v2/helpers.js +17 -13
  18. package/esm/DSModal.js +18 -32
  19. package/esm/constants.js +4 -5
  20. package/esm/index.js +0 -23
  21. package/esm/v1/DSModal.js +132 -12
  22. package/esm/v1/DSModalType.js +1 -2
  23. package/esm/v1/DSModalWrapper.js +109 -139
  24. package/esm/v1/ModalFeedBack/ModalFeedBack.js +55 -55
  25. package/esm/v2/DSModal.js +48 -94
  26. package/esm/v2/blocks.js +49 -47
  27. package/esm/v2/components/DecisionHeader.js +21 -24
  28. package/esm/v2/components/FeedbackIcon.js +27 -25
  29. package/esm/v2/components/Footer.js +29 -27
  30. package/esm/v2/components/FormHeader.js +29 -32
  31. package/esm/v2/components/ModalContent.js +54 -76
  32. package/esm/v2/components/SelectionHeader.js +26 -26
  33. package/esm/v2/components/Title.js +10 -14
  34. package/esm/v2/helpers.js +17 -13
  35. package/package.json +92 -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 +91 -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,133 @@
1
- import '@babel/runtime/helpers/esm/extends';
2
- import '@babel/runtime/helpers/esm/defineProperty';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
3
  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
4
+ import ReactModal from 'react-modal';
5
+ import { convertPropToCssClassName } from '@elliemae/ds-classnames';
6
+ import CloseIcon from '@elliemae/ds-icons/Close';
7
+ import { DSIconSizes } from '@elliemae/ds-basic/Icon';
8
+ import DSButton from '@elliemae/ds-basic/Button';
9
+ import { MODAL_TYPE } from '../constants.js';
10
+ import ModalFeedBack from './ModalFeedBack/ModalFeedBack.js';
11
+ import { jsxs, jsx } from 'react/jsx-runtime';
12
+
13
+ var _CloseIcon;
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+
19
+ const DSModal = ({
20
+ containerProps = {},
21
+ className = '',
22
+ dataTestId = 'ds-modal',
23
+ additionalFooterCssClass = '',
24
+ style = {},
25
+ iconCloseSize = DSIconSizes.S,
26
+ modalType = MODAL_TYPE.DEFAULT,
27
+ showHeader = true,
28
+ showFooter = true,
29
+ children,
30
+ centered = true,
31
+ confirmLabel = 'Accept',
32
+ modalTitle = '',
33
+ size = 'medium',
34
+ isOpen = false,
35
+ onClose = () => null,
36
+ onAfterOpen = () => null,
37
+ onConfirm = () => null,
38
+ onReject = () => null,
39
+ rejectLabel = 'Cancel',
40
+ shouldCloseOnOverlayClick = false,
41
+ hasError = false,
42
+ hasWarning = false,
43
+ hasSuccess = false,
44
+ hasInfo = false,
45
+ hasHelp = false,
46
+ actionsRef = () => null,
47
+ appElement = '#root',
48
+ overridePropsConfirmButton = {},
49
+ overridePropsRejectButton = {},
50
+ zIndex = 10
51
+ }) => {
52
+ // http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples
53
+ typeof document !== 'undefined' && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement); // eslint-disable-line
54
+
55
+ const {
56
+ cssClassName,
57
+ classNameElement,
58
+ classNameBlock,
59
+ classNameModifier,
60
+ classNameBlockModifier
61
+ } = convertPropToCssClassName('modal', className, {
62
+ hasError,
63
+ hasWarning,
64
+ hasSuccess,
65
+ modalType,
66
+ size
67
+ });
68
+ const {
69
+ WARNING,
70
+ ERROR,
71
+ SUCCESS,
72
+ HELP,
73
+ INFO
74
+ } = MODAL_TYPE;
75
+ const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
76
+ const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
77
+ return /*#__PURE__*/_jsx(ReactModal, {
78
+ testId: dataTestId,
79
+ className: cssClassName,
80
+ contentLabel: modalTitle,
81
+ isOpen: isOpen,
82
+ onAfterOpen: onAfterOpen,
83
+ onRequestClose: onClose,
84
+ overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered && 'center')),
85
+ shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
86
+ style: {
87
+ content: _objectSpread({}, style),
88
+ overlay: {
89
+ zIndex
90
+ }
91
+ }
92
+ }, void 0, /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
93
+ children: [showHeader && /*#__PURE__*/_jsx("div", {
94
+ className: classNameBlock('modal-header')
95
+ }, void 0, /*#__PURE__*/_jsx("div", {
96
+ className: classNameElement('title', 'modal-header')
97
+ }, void 0, modalTitle), /*#__PURE__*/_jsx("div", {
98
+ className: classNameElement('icon', 'modal-header')
99
+ }, void 0, /*#__PURE__*/_jsx(DSButton, {
100
+ buttonType: "link",
101
+ icon: _CloseIcon || (_CloseIcon = /*#__PURE__*/_jsx(CloseIcon, {})),
102
+ onClick: onClose,
103
+ size: iconCloseSize
104
+ }))), /*#__PURE__*/_jsx("div", {
105
+ className: classNameElement('body')
106
+ }, void 0, showFeedBack && /*#__PURE__*/_jsx(ModalFeedBack, {
107
+ hasError: hasError,
108
+ hasHelp: hasHelp,
109
+ hasInfo: hasInfo,
110
+ hasSuccess: hasSuccess,
111
+ hasWarning: hasWarning,
112
+ modalType: modalType
113
+ }), children), showFooter && !isAFeedbackType && /*#__PURE__*/_jsx("div", {
114
+ className: "".concat(classNameBlock('modal-footer'), " ").concat(additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : '')
115
+ }, void 0, /*#__PURE__*/jsxs("div", {
116
+ ref: actionsRef,
117
+ className: classNameBlock('modal-footer-actions'),
118
+ children: [modalType === MODAL_TYPE.CONFIRM && /*#__PURE__*/jsx(DSButton, _objectSpread({
119
+ buttonType: "secondary",
120
+ className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('reject', 'button-action'), " "),
121
+ labelText: rejectLabel,
122
+ onClick: onReject
123
+ }, overridePropsRejectButton)), /*#__PURE__*/jsx(DSButton, _objectSpread({
124
+ buttonType: "primary",
125
+ className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('confirm', 'button-action'), " "),
126
+ labelText: confirmLabel,
127
+ onClick: onConfirm
128
+ }, overridePropsConfirmButton))]
129
+ }))]
130
+ })));
131
+ };
132
+
133
+ 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,38 +1,17 @@
1
- import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
2
- import _createClass from '@babel/runtime/helpers/esm/createClass';
3
- import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
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
1
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import { createElement, Component } from 'react';
2
+ import 'core-js/modules/web.dom-collections.iterator.js';
3
+ import { Component, createElement } from 'react';
9
4
  import { MODAL_TYPE } from '../constants.js';
10
5
 
11
6
  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
7
 
13
8
  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; }
9
+ var DSModalWrapper = (WrappedComponent => {
10
+ class DSModalWrapper extends Component {
11
+ constructor(...args) {
12
+ super(...args);
14
13
 
15
- 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); }; }
16
-
17
- 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; } }
18
- var DSModalWrapper = (function (WrappedComponent) {
19
- var DSModalWrapper = /*#__PURE__*/function (_Component) {
20
- _inherits(DSModalWrapper, _Component);
21
-
22
- var _super = _createSuper(DSModalWrapper);
23
-
24
- function DSModalWrapper() {
25
- var _this;
26
-
27
- _classCallCheck(this, DSModalWrapper);
28
-
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
-
33
- _this = _super.call.apply(_super, [this].concat(args));
34
-
35
- _defineProperty(_assertThisInitialized(_this), "state", {
14
+ _defineProperty(this, "state", {
36
15
  childready: false,
37
16
  additionalFooterCssClass: 'loading',
38
17
  container: null,
@@ -40,145 +19,136 @@ var DSModalWrapper = (function (WrappedComponent) {
40
19
  height: '100%'
41
20
  });
42
21
 
43
- _defineProperty(_assertThisInitialized(_this), "onHeaderHeight", function (e) {
44
- _this.heightHeaderFlag = true;
45
- _this.heightHeader = e.height || 0;
22
+ _defineProperty(this, "onHeaderHeight", e => {
23
+ this.heightHeaderFlag = true;
24
+ this.heightHeader = e.height || 0;
46
25
  });
47
26
 
48
- _defineProperty(_assertThisInitialized(_this), "onFooterHeight", function (e) {
49
- _this.heightFooterFlag = true;
50
- _this.heightFooter = e.height || 0;
27
+ _defineProperty(this, "onFooterHeight", e => {
28
+ this.heightFooterFlag = true;
29
+ this.heightFooter = e.height || 0;
51
30
  });
52
31
 
53
- _defineProperty(_assertThisInitialized(_this), "onResize", function (_ref) {
54
- var bounds = _ref.bounds;
55
-
56
- if (_this.heightFooterFlag && _this.heightHeaderFlag) {
57
- return _this.setState({
58
- height: bounds.height - _this.heightFooter - _this.heightHeader
32
+ _defineProperty(this, "onResize", ({
33
+ bounds
34
+ }) => {
35
+ if (this.heightFooterFlag && this.heightHeaderFlag) {
36
+ return this.setState({
37
+ height: bounds.height - this.heightFooter - this.heightHeader
59
38
  });
60
39
  }
61
40
 
62
- return setTimeout(_this.onResize({
63
- bounds: bounds
41
+ return setTimeout(this.onResize({
42
+ bounds
64
43
  }), 0);
65
44
  });
66
45
 
67
- _defineProperty(_assertThisInitialized(_this), "handleContainer", function (node) {
68
- if (node) _this.setState({
46
+ _defineProperty(this, "handleContainer", node => {
47
+ if (node) this.setState({
69
48
  container: node
70
49
  });
71
-
72
- _this.handleResize();
50
+ this.handleResize();
73
51
  });
74
52
 
75
- _defineProperty(_assertThisInitialized(_this), "handleActions", function (node) {
76
- if (node) _this.setState({
53
+ _defineProperty(this, "handleActions", node => {
54
+ if (node) this.setState({
77
55
  actions: node
78
56
  });
79
-
80
- _this.handleResize();
57
+ this.handleResize();
81
58
  });
59
+ }
82
60
 
83
- return _this;
61
+ componentDidMount() {
62
+ window.addEventListener('resize', this.handleResize);
84
63
  }
85
64
 
86
- _createClass(DSModalWrapper, [{
87
- key: "componentDidMount",
88
- value: function componentDidMount() {
89
- window.addEventListener('resize', this.handleResize);
90
- }
91
- }, {
92
- key: "componentWillUnmount",
93
- value: function componentWillUnmount() {
94
- window.removeEventListener('resize', this.handleResize);
95
- }
96
- }, {
97
- key: "handleResize",
98
- value:
99
- /**
100
- * Change button width to 100% if the
101
- * combined width of the button (or button group) exceed 50% of the container width.
102
- */
103
- function handleResize() {
104
- if (!this.state) return null;
105
- var _this$state = this.state,
106
- container = _this$state.container,
107
- actions = _this$state.actions,
108
- childready = _this$state.childready;
109
- if (!childready) return null;
110
- this.setState({
111
- additionalFooterCssClass: null
112
- }); // !important reset to default state to recalculate
113
-
114
- var containerWidth = container.clientWidth;
115
- 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.
116
-
117
- if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
118
- return this.setState({
119
- additionalFooterCssClass: 'fluid-actions'
120
- });
121
- }
65
+ componentWillUnmount() {
66
+ window.removeEventListener('resize', this.handleResize);
67
+ }
122
68
 
69
+ /**
70
+ * Change button width to 100% if the
71
+ * combined width of the button (or button group) exceed 50% of the container width.
72
+ */
73
+ handleResize() {
74
+ if (!this.state) return null;
75
+ const {
76
+ container,
77
+ actions,
78
+ childready
79
+ } = this.state;
80
+ if (!childready) return null;
81
+ this.setState({
82
+ additionalFooterCssClass: null
83
+ }); // !important reset to default state to recalculate
84
+
85
+ const {
86
+ clientWidth: containerWidth
87
+ } = container;
88
+ const {
89
+ clientWidth: actionsWidth
90
+ } = actions; // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.
91
+
92
+ if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
123
93
  return this.setState({
124
- additionalFooterCssClass: null
94
+ additionalFooterCssClass: 'fluid-actions'
125
95
  });
126
96
  }
127
- }, {
128
- key: "verifyNodes",
129
- value: function verifyNodes() {
130
- var _this2 = this;
131
-
132
- var modalType = this.props.modalType;
133
-
134
- if (modalType !== MODAL_TYPE.DEFAULT) {
135
- var nodesInterval = setInterval(function () {
136
- // !important it checks when nodes are availables
137
- var _this2$state = _this2.state,
138
- container = _this2$state.container,
139
- actions = _this2$state.actions;
140
- if (!container || !actions) return null;
141
- clearInterval(nodesInterval);
142
-
143
- _this2.setState({
144
- childready: true
145
- });
146
-
147
- return _this2.handleResize();
148
- }, 100);
149
- }
150
- }
151
- }, {
152
- key: "render",
153
- value: function render() {
154
- var _this3 = this;
155
-
156
- var props = this.props,
157
- state = this.state;
158
- var additionalFooterCssClass = state.additionalFooterCssClass,
159
- height = state.height;
160
- return /*#__PURE__*/createElement(WrappedComponent, _objectSpread(_objectSpread({}, props), {}, {
161
- height: height,
162
- onResize: this.onResize,
163
- onFooterHeight: this.onFooterHeight,
164
- onHeaderHeight: this.onHeaderHeight,
165
- containerRef: this.handleContainer,
166
- actionsRef: this.handleActions,
167
- additionalFooterCssClass: additionalFooterCssClass,
168
- onAfterOpen: function onAfterOpen() {
169
- if (props.onAfterOpen) props.onAfterOpen();
170
-
171
- _this3.verifyNodes();
172
- }
173
- }));
97
+
98
+ return this.setState({
99
+ additionalFooterCssClass: null
100
+ });
101
+ }
102
+
103
+ verifyNodes() {
104
+ const {
105
+ modalType
106
+ } = this.props;
107
+
108
+ if (modalType !== MODAL_TYPE.DEFAULT) {
109
+ const nodesInterval = setInterval(() => {
110
+ // !important it checks when nodes are availables
111
+ const {
112
+ container,
113
+ actions
114
+ } = this.state;
115
+ if (!container || !actions) return null;
116
+ clearInterval(nodesInterval);
117
+ this.setState({
118
+ childready: true
119
+ });
120
+ return this.handleResize();
121
+ }, 100);
174
122
  }
175
- }]);
123
+ }
124
+
125
+ render() {
126
+ const {
127
+ props,
128
+ state
129
+ } = this;
130
+ const {
131
+ additionalFooterCssClass,
132
+ height
133
+ } = state;
134
+ return /*#__PURE__*/createElement(WrappedComponent, _objectSpread(_objectSpread({}, props), {}, {
135
+ height,
136
+ onResize: this.onResize,
137
+ onFooterHeight: this.onFooterHeight,
138
+ onHeaderHeight: this.onHeaderHeight,
139
+ containerRef: this.handleContainer,
140
+ actionsRef: this.handleActions,
141
+ additionalFooterCssClass,
142
+ onAfterOpen: () => {
143
+ if (props.onAfterOpen) props.onAfterOpen();
144
+ this.verifyNodes();
145
+ }
146
+ }));
147
+ }
176
148
 
177
- return DSModalWrapper;
178
- }(Component);
149
+ }
179
150
 
180
151
  return DSModalWrapper;
181
152
  });
182
153
 
183
154
  export { DSModalWrapper as default };
184
- //# sourceMappingURL=DSModalWrapper.js.map
@@ -1,21 +1,29 @@
1
- import React from 'react';
2
- import { InfoCircle, HelpCircle, CheckmarkCircle, WarningCircle } from '@elliemae/ds-icons';
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
3
+ import WarningCircle from '@elliemae/ds-icons/WarningCircle';
4
+ import CheckmarkCircle from '@elliemae/ds-icons/CheckmarkCircle';
5
+ import HelpCircle from '@elliemae/ds-icons/HelpCircle';
6
+ import InfoCircle from '@elliemae/ds-icons/InfoCircle';
3
7
  import { convertPropToCssClassName } from '@elliemae/ds-classnames';
4
8
  import { MODAL_TYPE } from '../../constants.js';
5
9
 
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;
10
+ var _WarningCircle, _CheckmarkCircle, _HelpCircle, _InfoCircle, _InfoCircle2;
11
+ const feedbackIconSize = 'xxl';
12
+ const {
13
+ WARNING,
14
+ ERROR,
15
+ SUCCESS,
16
+ HELP,
17
+ INFO
18
+ } = MODAL_TYPE;
12
19
 
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;
20
+ const getModalType = (modalType, {
21
+ hasError,
22
+ hasWarning,
23
+ hasSuccess,
24
+ hasInfo,
25
+ hasHelp
26
+ }) => {
19
27
  if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;
20
28
  if (hasError) return ERROR;
21
29
  if (hasWarning) return WARNING;
@@ -25,69 +33,61 @@ var getModalType = function getModalType(modalType, _ref) {
25
33
  return INFO;
26
34
  };
27
35
 
28
- var getIconType = function getIconType(modalType) {
36
+ const getIconType = modalType => {
29
37
  switch (modalType) {
30
38
  case WARNING:
31
39
  case ERROR:
32
- return /*#__PURE__*/React.createElement(WarningCircle, {
40
+ return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx(WarningCircle, {
33
41
  size: feedbackIconSize
34
- });
42
+ }));
35
43
 
36
44
  case SUCCESS:
37
- return /*#__PURE__*/React.createElement(CheckmarkCircle, {
45
+ return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx(CheckmarkCircle, {
38
46
  size: feedbackIconSize
39
- });
47
+ }));
40
48
 
41
49
  case HELP:
42
- return /*#__PURE__*/React.createElement(HelpCircle, {
50
+ return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx(HelpCircle, {
43
51
  size: feedbackIconSize
44
- });
52
+ }));
45
53
 
46
54
  case INFO:
47
- return /*#__PURE__*/React.createElement(InfoCircle, {
55
+ return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx(InfoCircle, {
48
56
  size: feedbackIconSize
49
- });
57
+ }));
50
58
 
51
59
  default:
52
- return /*#__PURE__*/React.createElement(InfoCircle, {
60
+ return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx(InfoCircle, {
53
61
  size: feedbackIconSize
54
- });
62
+ }));
55
63
  }
56
64
  };
57
65
 
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
66
+ const ModalFeedBack = ({
67
+ className = '',
68
+ modalType = null,
69
+ hasError = false,
70
+ hasWarning = false,
71
+ hasSuccess = false,
72
+ hasInfo = false,
73
+ hasHelp = false
74
+ }) => {
75
+ const type = getModalType(modalType, {
76
+ hasError,
77
+ hasWarning,
78
+ hasSuccess,
79
+ hasInfo,
80
+ hasHelp
79
81
  });
80
-
81
- var _convertPropToCssClas = convertPropToCssClassName('modal-feedback', className, {
82
+ const {
83
+ cssClassName
84
+ } = convertPropToCssClassName('modal-feedback', className, {
82
85
  modalType: type
83
- }),
84
- cssClassName = _convertPropToCssClas.cssClassName;
85
-
86
- var feedbackIcon = getIconType(type);
87
- return /*#__PURE__*/React.createElement("div", {
86
+ });
87
+ const feedbackIcon = getIconType(type);
88
+ return /*#__PURE__*/_jsx("div", {
88
89
  className: cssClassName
89
- }, feedbackIcon);
90
+ }, void 0, feedbackIcon);
90
91
  };
91
92
 
92
93
  export { ModalFeedBack as default };
93
- //# sourceMappingURL=ModalFeedBack.js.map