@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/cjs/DSModal.js CHANGED
@@ -2,194 +2,180 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
6
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
6
- var React = require('react');
7
+ require('react');
7
8
  var PropTypes = require('prop-types');
8
9
  var constants = require('./constants.js');
9
- var v1_DSModal = require('./DSModal-3126a986.js');
10
- var v2_DSModal = require('./v2/DSModal.js');
11
- var v2_components_ModalContent = require('./v2/components/ModalContent.js');
12
- require('@babel/runtime/helpers/extends');
13
- require('@babel/runtime/helpers/defineProperty');
14
- require('react-modal');
15
- require('@elliemae/ds-classnames');
16
- require('@elliemae/ds-icon');
17
- require('@elliemae/ds-icons');
18
- require('@elliemae/ds-button');
19
- require('./v1/ModalFeedBack/ModalFeedBack.js');
20
- require('react-desc');
21
- require('./v2/components/SelectionHeader.js');
22
- require('@elliemae/ds-form');
23
- require('./v2/blocks.js');
24
- require('./v2/components/Title.js');
25
- require('./v2/components/DecisionHeader.js');
26
- require('./v2/components/FormHeader.js');
27
- require('./v2/components/FeedbackIcon.js');
28
- require('./v2/components/Footer.js');
29
- require('./v2/helpers.js');
10
+ var DSModal$2 = require('./v1/DSModal.js');
11
+ var DSModal$1 = require('./v2/DSModal.js');
12
+ var propTypes = require('@elliemae/ds-shared/prop-types');
13
+ var jsxRuntime = require('react/jsx-runtime');
14
+ var ModalContent = require('./v2/components/ModalContent.js');
30
15
 
31
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
32
17
 
18
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
33
19
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
34
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
20
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
36
21
 
37
- var _excluded = ["version"];
22
+ const _excluded = ["version"];
38
23
 
39
- var DSModal = function DSModal(_ref) {
40
- var _ref$version = _ref.version,
41
- version = _ref$version === void 0 ? 1 : _ref$version,
42
- rest = _objectWithoutProperties__default['default'](_ref, _excluded);
24
+ 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; }
43
25
 
44
- if (version === 2) return /*#__PURE__*/React__default['default'].createElement(v2_DSModal['default'], rest);
45
- return /*#__PURE__*/React__default['default'].createElement(v1_DSModal.DSModal, rest);
46
- };
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["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
+
28
+ const DSModal = _ref => {
29
+ let {
30
+ version = 1
31
+ } = _ref,
32
+ rest = _objectWithoutProperties__default["default"](_ref, _excluded);
47
33
 
48
- DSModal.propTypes = {
49
- version: PropTypes__default['default'].oneOf([1, 2])
34
+ if (version === 2) return /*#__PURE__*/jsxRuntime.jsx(DSModal$1["default"], _objectSpread({}, rest));
35
+ return /*#__PURE__*/jsxRuntime.jsx(DSModal$2, _objectSpread({}, rest));
50
36
  };
51
- v1_DSModal.DSModal.propTypes = {
52
- version: PropTypes__default['default'].oneOf([1, 2]),
53
- className: PropTypes__default['default'].string,
37
+
38
+ DSModal$2.propTypes = {
39
+ version: PropTypes__default["default"].oneOf([1, 2]),
40
+ className: PropTypes__default["default"].string,
54
41
 
55
42
  /**
56
43
  * Add an additional css class to the footer
57
44
  */
58
- additionalFooterCssClass: PropTypes__default['default'].string,
45
+ additionalFooterCssClass: PropTypes__default["default"].string,
59
46
 
60
47
  /**
61
48
  * Set style for the modal
62
49
  */
63
- style: PropTypes__default['default'].objectOf(PropTypes__default['default'].string),
50
+ style: PropTypes__default["default"].objectOf(PropTypes__default["default"].string),
64
51
 
65
52
  /**
66
53
  * Select size for the close icon
67
54
  */
68
- iconCloseSize: PropTypes__default['default'].oneOf(v1_DSModal.iconSizes),
55
+ iconCloseSize: PropTypes__default["default"].oneOf(propTypes.iconSizes),
69
56
 
70
57
  /**
71
58
  * ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']
72
59
  */
73
- modalType: PropTypes__default['default'].oneOf(constants.modalTypes),
60
+ modalType: PropTypes__default["default"].oneOf(constants.modalTypes),
74
61
 
75
62
  /**
76
63
  * Show the header or not
77
64
  */
78
- showHeader: PropTypes__default['default'].bool,
65
+ showHeader: PropTypes__default["default"].bool,
79
66
 
80
67
  /**
81
68
  * Show the footer or not
82
69
  */
83
- showFooter: PropTypes__default['default'].bool,
70
+ showFooter: PropTypes__default["default"].bool,
84
71
 
85
72
  /**
86
73
  * Main content of the modal
87
74
  */
88
- children: PropTypes__default['default'].element.isRequired,
75
+ children: PropTypes__default["default"].element.isRequired,
89
76
 
90
77
  /**
91
78
  * Content is centered or not
92
79
  */
93
- centered: PropTypes__default['default'].bool,
80
+ centered: PropTypes__default["default"].bool,
94
81
 
95
82
  /**
96
83
  * Text to be added in the confirm button
97
84
  */
98
- confirmLabel: PropTypes__default['default'].string,
85
+ confirmLabel: PropTypes__default["default"].string,
99
86
 
100
87
  /**
101
88
  * Text to be added in the modal title
102
89
  */
103
- modalTitle: PropTypes__default['default'].string,
90
+ modalTitle: PropTypes__default["default"].string,
104
91
 
105
92
  /**
106
93
  * Text to be added in the modal title
107
94
  */
108
- size: PropTypes__default['default'].oneOf(v1_DSModal.sizes),
95
+ size: PropTypes__default["default"].oneOf(propTypes.sizes),
109
96
 
110
97
  /**
111
98
  * Modal is open or not
112
99
  */
113
- isOpen: PropTypes__default['default'].bool,
100
+ isOpen: PropTypes__default["default"].bool,
114
101
 
115
102
  /**
116
103
  * Allows a function to be triggered once the modal is closed
117
104
  */
118
- onClose: PropTypes__default['default'].func,
105
+ onClose: PropTypes__default["default"].func,
119
106
 
120
107
  /**
121
108
  * Allows a function to be triggered once the modal is opened
122
109
  */
123
- onAfterOpen: PropTypes__default['default'].func,
110
+ onAfterOpen: PropTypes__default["default"].func,
124
111
 
125
112
  /**
126
113
  * Allows a function to be triggered once the modal open is confirmed
127
114
  */
128
- onConfirm: PropTypes__default['default'].func,
115
+ onConfirm: PropTypes__default["default"].func,
129
116
 
130
117
  /**
131
118
  * Allows a function to be triggered once the modal open is rejected
132
119
  */
133
- onReject: PropTypes__default['default'].func,
120
+ onReject: PropTypes__default["default"].func,
134
121
 
135
122
  /**
136
123
  * Text to be added in the reject button
137
124
  */
138
- rejectLabel: PropTypes__default['default'].string,
125
+ rejectLabel: PropTypes__default["default"].string,
139
126
 
140
127
  /**
141
128
  * If modal should close on overlay click
142
129
  */
143
- shouldCloseOnOverlayClick: PropTypes__default['default'].bool,
130
+ shouldCloseOnOverlayClick: PropTypes__default["default"].bool,
144
131
 
145
132
  /**
146
133
  * Modal has error or not
147
134
  */
148
- hasError: PropTypes__default['default'].bool,
135
+ hasError: PropTypes__default["default"].bool,
149
136
 
150
137
  /**
151
138
  * Modal has warning or not
152
139
  */
153
- hasWarning: PropTypes__default['default'].bool,
140
+ hasWarning: PropTypes__default["default"].bool,
154
141
 
155
142
  /**
156
143
  * Modal has success or not
157
144
  */
158
- hasSuccess: PropTypes__default['default'].bool,
145
+ hasSuccess: PropTypes__default["default"].bool,
159
146
 
160
147
  /**
161
148
  * Modal has info or not
162
149
  */
163
- hasInfo: PropTypes__default['default'].bool,
150
+ hasInfo: PropTypes__default["default"].bool,
164
151
 
165
152
  /**
166
153
  * Modal has help or not
167
154
  */
168
- hasHelp: PropTypes__default['default'].bool,
169
- actionsRef: PropTypes__default['default'].func,
170
- appElement: PropTypes__default['default'].string,
155
+ hasHelp: PropTypes__default["default"].bool,
156
+ actionsRef: PropTypes__default["default"].func,
157
+ appElement: PropTypes__default["default"].string,
171
158
 
172
159
  /**
173
160
  * Customized props for the confirm button
174
161
  */
175
- overridePropsConfirmButton: PropTypes__default['default'].objectOf(PropTypes__default['default'].shape({})),
162
+ overridePropsConfirmButton: PropTypes__default["default"].objectOf(PropTypes__default["default"].shape({})),
176
163
 
177
164
  /**
178
165
  * Customized props for the reject button
179
166
  */
180
- overridePropsRejectButton: PropTypes__default['default'].objectOf(PropTypes__default['default'].string),
167
+ overridePropsRejectButton: PropTypes__default["default"].objectOf(PropTypes__default["default"].string),
181
168
 
182
169
  /**
183
170
  * Show confirm button
184
171
  */
185
- showConfirmButton: PropTypes__default['default'].bool,
172
+ showConfirmButton: PropTypes__default["default"].bool,
186
173
 
187
174
  /**
188
175
  * Show confirm button
189
176
  */
190
- customCloseComponent: PropTypes__default['default'].element
177
+ customCloseComponent: PropTypes__default["default"].element
191
178
  };
192
179
 
193
- exports.DSModalContent = v2_components_ModalContent.DSModalContent;
194
- exports['default'] = DSModal;
195
- //# sourceMappingURL=DSModal.js.map
180
+ exports.DSModalContent = ModalContent.DSModalContent;
181
+ exports["default"] = DSModal;
package/cjs/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var MODAL_TYPE = {
5
+ const MODAL_TYPE = {
6
6
  DEFAULT: 'default',
7
7
  ALERT: 'alert',
8
8
  CONFIRM: 'confirm',
@@ -13,14 +13,14 @@ var MODAL_TYPE = {
13
13
  HELP: 'help',
14
14
  INFO: 'info'
15
15
  };
16
- 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];
17
- var MODAL_TYPE_V2 = {
16
+ 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];
17
+ const MODAL_TYPE_V2 = {
18
18
  INFORMATION: 'information',
19
19
  DECISION: 'decision',
20
20
  SELECTION: 'selection',
21
21
  FORM: 'form'
22
22
  };
23
- var MODAL_SUB_TYPE_V2 = {
23
+ const MODAL_SUB_TYPE_V2 = {
24
24
  SUCCESS: 'success',
25
25
  WARNING: 'warning',
26
26
  ERROR: 'error',
@@ -30,6 +30,5 @@ var MODAL_SUB_TYPE_V2 = {
30
30
  exports.MODAL_SUB_TYPE_V2 = MODAL_SUB_TYPE_V2;
31
31
  exports.MODAL_TYPE = MODAL_TYPE;
32
32
  exports.MODAL_TYPE_V2 = MODAL_TYPE_V2;
33
- exports['default'] = MODAL_TYPE;
33
+ exports["default"] = MODAL_TYPE;
34
34
  exports.modalTypes = modalTypes;
35
- //# sourceMappingURL=constants.js.map
package/cjs/index.js CHANGED
@@ -2,40 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var DSModal = require('./DSModal.js');
5
+ var DSModal$1 = require('./DSModal.js');
6
6
  var constants = require('./constants.js');
7
- var v2_DSModal = require('./v2/DSModal.js');
8
- var v2_components_ModalContent = require('./v2/components/ModalContent.js');
9
- require('@babel/runtime/helpers/objectWithoutProperties');
10
- require('react');
11
- require('prop-types');
12
- require('./DSModal-3126a986.js');
13
- require('@babel/runtime/helpers/extends');
14
- require('@babel/runtime/helpers/defineProperty');
15
- require('react-modal');
16
- require('@elliemae/ds-classnames');
17
- require('@elliemae/ds-icon');
18
- require('@elliemae/ds-icons');
19
- require('@elliemae/ds-button');
20
- require('./v1/ModalFeedBack/ModalFeedBack.js');
21
- require('react-desc');
22
- require('./v2/components/SelectionHeader.js');
23
- require('@elliemae/ds-form');
24
- require('./v2/blocks.js');
25
- require('./v2/components/Title.js');
26
- require('./v2/components/DecisionHeader.js');
27
- require('./v2/components/FormHeader.js');
28
- require('./v2/components/FeedbackIcon.js');
29
- require('./v2/components/Footer.js');
30
- require('./v2/helpers.js');
7
+ var DSModal = require('./v2/DSModal.js');
8
+ var ModalContent = require('./v2/components/ModalContent.js');
31
9
 
32
10
 
33
11
 
34
- exports.default = DSModal['default'];
12
+ exports["default"] = DSModal$1["default"];
35
13
  exports.MODAL_SUB_TYPE_V2 = constants.MODAL_SUB_TYPE_V2;
36
14
  exports.MODAL_TYPE = constants.MODAL_TYPE;
37
15
  exports.MODAL_TYPE_V2 = constants.MODAL_TYPE_V2;
38
16
  exports.modalTypes = constants.modalTypes;
39
- exports.DSModalWithSchema = v2_DSModal.DSModalWithSchema;
40
- exports.DSModalContent = v2_components_ModalContent.DSModalContent;
41
- //# sourceMappingURL=index.js.map
17
+ exports.DSModalWithSchema = DSModal.DSModalWithSchema;
18
+ exports.DSModalContent = ModalContent.DSModalContent;
package/cjs/v1/DSModal.js CHANGED
@@ -1,19 +1,143 @@
1
1
  'use strict';
2
2
 
3
- require('@babel/runtime/helpers/extends');
4
- require('@babel/runtime/helpers/defineProperty');
3
+ var _jsx = require('@babel/runtime/helpers/jsx');
4
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
5
  require('react');
6
- require('prop-types');
7
- require('react-modal');
8
- require('@elliemae/ds-classnames');
9
- require('@elliemae/ds-icon');
10
- require('@elliemae/ds-icons');
11
- require('@elliemae/ds-button');
12
- require('../constants.js');
13
- require('./ModalFeedBack/ModalFeedBack.js');
14
- var v1_DSModal = require('../DSModal-3126a986.js');
6
+ var ReactModal = require('react-modal');
7
+ var dsClassnames = require('@elliemae/ds-classnames');
8
+ var CloseIcon = require('@elliemae/ds-icons/Close');
9
+ var Icon = require('@elliemae/ds-basic/Icon');
10
+ var DSButton = require('@elliemae/ds-basic/Button');
11
+ var constants = require('../constants.js');
12
+ var ModalFeedBack = require('./ModalFeedBack/ModalFeedBack.js');
13
+ var jsxRuntime = require('react/jsx-runtime');
15
14
 
15
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
16
 
17
+ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
18
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
19
+ var ReactModal__default = /*#__PURE__*/_interopDefaultLegacy(ReactModal);
20
+ var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
21
+ var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
17
22
 
18
- module.exports = v1_DSModal.DSModal;
19
- //# sourceMappingURL=DSModal.js.map
23
+ var _CloseIcon;
24
+
25
+ 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
+
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["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
+
29
+ const DSModal = ({
30
+ containerProps = {},
31
+ className = '',
32
+ dataTestId = 'ds-modal',
33
+ additionalFooterCssClass = '',
34
+ style = {},
35
+ iconCloseSize = Icon.DSIconSizes.S,
36
+ modalType = constants.MODAL_TYPE.DEFAULT,
37
+ showHeader = true,
38
+ showFooter = true,
39
+ children,
40
+ centered = true,
41
+ confirmLabel = 'Accept',
42
+ modalTitle = '',
43
+ size = 'medium',
44
+ isOpen = false,
45
+ onClose = () => null,
46
+ onAfterOpen = () => null,
47
+ onConfirm = () => null,
48
+ onReject = () => null,
49
+ rejectLabel = 'Cancel',
50
+ shouldCloseOnOverlayClick = false,
51
+ hasError = false,
52
+ hasWarning = false,
53
+ hasSuccess = false,
54
+ hasInfo = false,
55
+ hasHelp = false,
56
+ actionsRef = () => null,
57
+ appElement = '#root',
58
+ overridePropsConfirmButton = {},
59
+ overridePropsRejectButton = {},
60
+ zIndex = 10
61
+ }) => {
62
+ // http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples
63
+ typeof document !== 'undefined' && document && ReactModal__default["default"].setAppElement && ReactModal__default["default"].setAppElement(appElement); // eslint-disable-line
64
+
65
+ const {
66
+ cssClassName,
67
+ classNameElement,
68
+ classNameBlock,
69
+ classNameModifier,
70
+ classNameBlockModifier
71
+ } = dsClassnames.convertPropToCssClassName('modal', className, {
72
+ hasError,
73
+ hasWarning,
74
+ hasSuccess,
75
+ modalType,
76
+ size
77
+ });
78
+ const {
79
+ WARNING,
80
+ ERROR,
81
+ SUCCESS,
82
+ HELP,
83
+ INFO
84
+ } = constants.MODAL_TYPE;
85
+ const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
86
+ const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
87
+ return /*#__PURE__*/_jsx__default["default"](ReactModal__default["default"], {
88
+ testId: dataTestId,
89
+ className: cssClassName,
90
+ contentLabel: modalTitle,
91
+ isOpen: isOpen,
92
+ onAfterOpen: onAfterOpen,
93
+ onRequestClose: onClose,
94
+ overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered && 'center')),
95
+ shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
96
+ style: {
97
+ content: _objectSpread({}, style),
98
+ overlay: {
99
+ zIndex
100
+ }
101
+ }
102
+ }, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
103
+ children: [showHeader && /*#__PURE__*/_jsx__default["default"]("div", {
104
+ className: classNameBlock('modal-header')
105
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("div", {
106
+ className: classNameElement('title', 'modal-header')
107
+ }, void 0, modalTitle), /*#__PURE__*/_jsx__default["default"]("div", {
108
+ className: classNameElement('icon', 'modal-header')
109
+ }, void 0, /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
110
+ buttonType: "link",
111
+ icon: _CloseIcon || (_CloseIcon = /*#__PURE__*/_jsx__default["default"](CloseIcon__default["default"], {})),
112
+ onClick: onClose,
113
+ size: iconCloseSize
114
+ }))), /*#__PURE__*/_jsx__default["default"]("div", {
115
+ className: classNameElement('body')
116
+ }, void 0, showFeedBack && /*#__PURE__*/_jsx__default["default"](ModalFeedBack, {
117
+ hasError: hasError,
118
+ hasHelp: hasHelp,
119
+ hasInfo: hasInfo,
120
+ hasSuccess: hasSuccess,
121
+ hasWarning: hasWarning,
122
+ modalType: modalType
123
+ }), children), showFooter && !isAFeedbackType && /*#__PURE__*/_jsx__default["default"]("div", {
124
+ className: "".concat(classNameBlock('modal-footer'), " ").concat(additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : '')
125
+ }, void 0, /*#__PURE__*/jsxRuntime.jsxs("div", {
126
+ ref: actionsRef,
127
+ className: classNameBlock('modal-footer-actions'),
128
+ children: [modalType === constants.MODAL_TYPE.CONFIRM && /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
129
+ buttonType: "secondary",
130
+ className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('reject', 'button-action'), " "),
131
+ labelText: rejectLabel,
132
+ onClick: onReject
133
+ }, overridePropsRejectButton)), /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
134
+ buttonType: "primary",
135
+ className: "".concat(classNameElement('button-action'), " ").concat(classNameModifier('confirm', 'button-action'), " "),
136
+ labelText: confirmLabel,
137
+ onClick: onConfirm
138
+ }, overridePropsConfirmButton))]
139
+ }))]
140
+ })));
141
+ };
142
+
143
+ module.exports = DSModal;
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- 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];
5
+ 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];
6
6
 
7
7
  exports.modalTypes = modalTypes;
8
- //# sourceMappingURL=DSModalType.js.map