@elliemae/ds-modal 2.3.0-next.3 → 3.0.0-alpha.0

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