@elliemae/ds-modal 2.2.0-next.6 → 2.3.0-alpha.1

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 (71) hide show
  1. package/cjs/DSModal.js +86 -184
  2. package/cjs/DSModal.js.map +7 -0
  3. package/cjs/constants.js +67 -28
  4. package/cjs/constants.js.map +7 -0
  5. package/cjs/index.js +39 -18
  6. package/cjs/index.js.map +7 -0
  7. package/cjs/v1/DSModal.js +159 -130
  8. package/cjs/v1/DSModal.js.map +7 -0
  9. package/cjs/v1/DSModalType.js +45 -7
  10. package/cjs/v1/DSModalType.js.map +7 -0
  11. package/cjs/v1/DSModalWrapper.js +76 -113
  12. package/cjs/v1/DSModalWrapper.js.map +7 -0
  13. package/cjs/v1/ModalFeedBack/ModalFeedBack.js +77 -72
  14. package/cjs/v1/ModalFeedBack/ModalFeedBack.js.map +7 -0
  15. package/cjs/v2/DSModal.js +143 -186
  16. package/cjs/v2/DSModal.js.map +7 -0
  17. package/cjs/v2/blocks.js +69 -86
  18. package/cjs/v2/blocks.js.map +7 -0
  19. package/cjs/v2/components/DecisionHeader.js +47 -37
  20. package/cjs/v2/components/DecisionHeader.js.map +7 -0
  21. package/cjs/v2/components/FeedbackIcon.js +59 -50
  22. package/cjs/v2/components/FeedbackIcon.js.map +7 -0
  23. package/cjs/v2/components/Footer.js +68 -65
  24. package/cjs/v2/components/Footer.js.map +7 -0
  25. package/cjs/v2/components/FormHeader.js +53 -46
  26. package/cjs/v2/components/FormHeader.js.map +7 -0
  27. package/cjs/v2/components/ModalContent.js +95 -111
  28. package/cjs/v2/components/ModalContent.js.map +7 -0
  29. package/cjs/v2/components/SelectionHeader.js +50 -48
  30. package/cjs/v2/components/SelectionHeader.js.map +7 -0
  31. package/cjs/v2/components/Title.js +40 -25
  32. package/cjs/v2/components/Title.js.map +7 -0
  33. package/cjs/v2/helpers.js +49 -40
  34. package/cjs/v2/helpers.js.map +7 -0
  35. package/esm/DSModal.js +26 -142
  36. package/esm/DSModal.js.map +7 -0
  37. package/esm/constants.js +38 -20
  38. package/esm/constants.js.map +7 -0
  39. package/esm/index.js +10 -4
  40. package/esm/index.js.map +7 -0
  41. package/esm/v1/DSModal.js +130 -121
  42. package/esm/v1/DSModal.js.map +7 -0
  43. package/esm/v1/DSModalType.js +16 -3
  44. package/esm/v1/DSModalType.js.map +7 -0
  45. package/esm/v1/DSModalWrapper.js +45 -105
  46. package/esm/v1/DSModalWrapper.js.map +7 -0
  47. package/esm/v1/ModalFeedBack/ModalFeedBack.js +48 -66
  48. package/esm/v1/ModalFeedBack/ModalFeedBack.js.map +7 -0
  49. package/esm/v2/DSModal.js +112 -173
  50. package/esm/v2/DSModal.js.map +7 -0
  51. package/esm/v2/blocks.js +42 -77
  52. package/esm/v2/blocks.js.map +7 -0
  53. package/esm/v2/components/DecisionHeader.js +18 -27
  54. package/esm/v2/components/DecisionHeader.js.map +7 -0
  55. package/esm/v2/components/FeedbackIcon.js +25 -36
  56. package/esm/v2/components/FeedbackIcon.js.map +7 -0
  57. package/esm/v2/components/Footer.js +39 -54
  58. package/esm/v2/components/Footer.js.map +7 -0
  59. package/esm/v2/components/FormHeader.js +24 -36
  60. package/esm/v2/components/FormHeader.js.map +7 -0
  61. package/esm/v2/components/ModalContent.js +72 -102
  62. package/esm/v2/components/ModalContent.js.map +7 -0
  63. package/esm/v2/components/SelectionHeader.js +21 -38
  64. package/esm/v2/components/SelectionHeader.js.map +7 -0
  65. package/esm/v2/components/Title.js +11 -16
  66. package/esm/v2/components/Title.js.map +7 -0
  67. package/esm/v2/helpers.js +16 -28
  68. package/esm/v2/helpers.js.map +7 -0
  69. package/package.json +8 -8
  70. package/types/DSModal.d.ts +1 -1
  71. package/types/v2/DSModal.d.ts +1 -30
@@ -1,76 +1,59 @@
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;
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { WarningCircle, CheckmarkCircle, HelpCircle, InfoCircle } from "@elliemae/ds-icons";
4
+ import { convertPropToCssClassName } from "@elliemae/ds-classnames";
5
+ import { MODAL_TYPE } from "../../constants";
6
+ const feedbackIconSize = "xxl";
7
+ const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;
8
+ const getModalType = (modalType, { hasError, hasWarning, hasSuccess, hasInfo, hasHelp }) => {
9
+ if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1)
10
+ return modalType;
11
+ if (hasError)
12
+ return ERROR;
13
+ if (hasWarning)
14
+ return WARNING;
15
+ if (hasSuccess)
16
+ return SUCCESS;
17
+ if (hasHelp)
18
+ return HELP;
19
+ if (hasInfo)
20
+ return INFO;
31
21
  return INFO;
32
22
  };
33
-
34
- const getIconType = modalType => {
23
+ const getIconType = (modalType) => {
35
24
  switch (modalType) {
36
25
  case WARNING:
37
26
  case ERROR:
38
- return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx(WarningCircle, {
27
+ return /* @__PURE__ */ React2.createElement(WarningCircle, {
39
28
  size: feedbackIconSize
40
- }));
41
-
29
+ });
42
30
  case SUCCESS:
43
- return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx(CheckmarkCircle, {
31
+ return /* @__PURE__ */ React2.createElement(CheckmarkCircle, {
44
32
  size: feedbackIconSize
45
- }));
46
-
33
+ });
47
34
  case HELP:
48
- return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx(HelpCircle, {
35
+ return /* @__PURE__ */ React2.createElement(HelpCircle, {
49
36
  size: feedbackIconSize
50
- }));
51
-
37
+ });
52
38
  case INFO:
53
- return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx(InfoCircle, {
39
+ return /* @__PURE__ */ React2.createElement(InfoCircle, {
54
40
  size: feedbackIconSize
55
- }));
56
-
41
+ });
57
42
  default:
58
- return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx(InfoCircle, {
43
+ return /* @__PURE__ */ React2.createElement(InfoCircle, {
59
44
  size: feedbackIconSize
60
- }));
45
+ });
61
46
  }
62
47
  };
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;
48
+ const ModalFeedBack = ({
49
+ className = "",
50
+ modalType = null,
51
+ hasError = false,
52
+ hasWarning = false,
53
+ hasSuccess = false,
54
+ hasInfo = false,
55
+ hasHelp = false
56
+ }) => {
74
57
  const type = getModalType(modalType, {
75
58
  hasError,
76
59
  hasWarning,
@@ -78,15 +61,14 @@ const ModalFeedBack = _ref2 => {
78
61
  hasInfo,
79
62
  hasHelp
80
63
  });
81
- const {
82
- cssClassName
83
- } = convertPropToCssClassName('modal-feedback', className, {
84
- modalType: type
85
- });
64
+ const { cssClassName } = convertPropToCssClassName("modal-feedback", className, { modalType: type });
86
65
  const feedbackIcon = getIconType(type);
87
- return /*#__PURE__*/_jsx("div", {
66
+ return /* @__PURE__ */ React2.createElement("div", {
88
67
  className: cssClassName
89
- }, void 0, feedbackIcon);
68
+ }, feedbackIcon);
69
+ };
70
+ var ModalFeedBack_default = ModalFeedBack;
71
+ export {
72
+ ModalFeedBack_default as default
90
73
  };
91
-
92
- export { ModalFeedBack as default };
74
+ //# sourceMappingURL=ModalFeedBack.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/v1/ModalFeedBack/ModalFeedBack.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { WarningCircle, CheckmarkCircle, HelpCircle, InfoCircle } from '@elliemae/ds-icons';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { MODAL_TYPE } from '../../constants';\n\nconst feedbackIconSize = 'xxl';\n\nconst { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;\n\nconst getModalType = (modalType, { hasError, hasWarning, hasSuccess, hasInfo, hasHelp }) => {\n if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;\n if (hasError) return ERROR;\n if (hasWarning) return WARNING;\n if (hasSuccess) return SUCCESS;\n if (hasHelp) return HELP;\n if (hasInfo) return INFO;\n return INFO;\n};\n\nconst getIconType = (modalType) => {\n switch (modalType) {\n case WARNING:\n case ERROR:\n return <WarningCircle size={feedbackIconSize} />;\n case SUCCESS:\n return <CheckmarkCircle size={feedbackIconSize} />;\n case HELP:\n return <HelpCircle size={feedbackIconSize} />;\n case INFO:\n return <InfoCircle size={feedbackIconSize} />;\n default:\n return <InfoCircle size={feedbackIconSize} />;\n }\n};\n\nconst ModalFeedBack = ({\n className = '',\n modalType = null,\n hasError = false,\n hasWarning = false,\n hasSuccess = false,\n hasInfo = false,\n hasHelp = false,\n}) => {\n const type = getModalType(modalType, {\n hasError,\n hasWarning,\n hasSuccess,\n hasInfo,\n hasHelp,\n });\n const { cssClassName } = convertPropToCssClassName('modal-feedback', className, { modalType: type });\n const feedbackIcon = getIconType(type);\n\n return <div className={cssClassName}>{feedbackIcon}</div>;\n};\n\nexport default ModalFeedBack;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,mBAAmB;AAEzB,MAAM,EAAE,SAAS,OAAO,SAAS,MAAM,SAAS;AAEhD,MAAM,eAAe,CAAC,WAAW,EAAE,UAAU,YAAY,YAAY,SAAS,cAAc;AAC1F,MAAI,CAAC,SAAS,OAAO,SAAS,MAAM,MAAM,QAAQ,aAAa;AAAI,WAAO;AAC1E,MAAI;AAAU,WAAO;AACrB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAY,WAAO;AACvB,MAAI;AAAS,WAAO;AACpB,MAAI;AAAS,WAAO;AACpB,SAAO;AAAA;AAGT,MAAM,cAAc,CAAC,cAAc;AACjC,UAAQ;AAAA,SACD;AAAA,SACA;AACH,aAAO,qCAAC,eAAD;AAAA,QAAe,MAAM;AAAA;AAAA,SACzB;AACH,aAAO,qCAAC,iBAAD;AAAA,QAAiB,MAAM;AAAA;AAAA,SAC3B;AACH,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AAAA,SACtB;AACH,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AAAA;AAEzB,aAAO,qCAAC,YAAD;AAAA,QAAY,MAAM;AAAA;AAAA;AAAA;AAI/B,MAAM,gBAAgB,CAAC;AAAA,EACrB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,MACN;AACJ,QAAM,OAAO,aAAa,WAAW;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAEF,QAAM,EAAE,iBAAiB,0BAA0B,kBAAkB,WAAW,EAAE,WAAW;AAC7F,QAAM,eAAe,YAAY;AAEjC,SAAO,qCAAC,OAAD;AAAA,IAAK,WAAW;AAAA,KAAe;AAAA;AAGxC,IAAO,wBAAQ;",
6
+ "names": []
7
+ }
package/esm/v2/DSModal.js CHANGED
@@ -1,192 +1,131 @@
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 { PropTypes, describe } from 'react-desc';
10
- import ReactModal from 'react-modal';
11
- import { convertPropToCssClassName } from '@elliemae/ds-classnames';
12
- import { MODAL_TYPE_V2 } from '../constants.js';
13
- import { DSModalContent } from './components/ModalContent.js';
14
- export { DSModalContent } from './components/ModalContent.js';
15
-
16
- 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; }
17
-
18
- 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; }
19
-
20
- const DSModal = _ref => {
21
- let {
22
- containerProps = {},
23
- className = '',
24
- style = {},
25
- size = 'default',
26
- //
27
- modalType = MODAL_TYPE_V2.INFORMATION,
28
- modalSubType = null,
29
- modalTitle = '',
30
- dataTestId = 'ds-modal',
31
- centered = false,
32
- showRejectButton = false,
33
- showClose = true,
34
- searchProps = {},
35
- // override
36
- actionsRef = () => null,
37
- additionalFooterCssClass,
38
- overridePropsConfirmButton = {},
39
- overridePropsRejectButton = {},
40
- // react modal
41
- children,
42
- isOpen = true,
43
- onClose = () => null,
44
- onAfterOpen = () => null,
45
- onConfirm = () => null,
46
- onReject = () => null,
47
- rejectLabel = 'Discard',
48
- confirmLabel = 'Save',
49
- shouldCloseOnOverlayClick = false,
50
- appElement = '#root',
51
- zIndex = 10,
52
- removePadding = false
53
- } = _ref;
54
-
55
- if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && document && ReactModal.setAppElement) {
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { PropTypes, describe } from "react-desc";
4
+ import ReactModal from "react-modal";
5
+ import { convertPropToCssClassName } from "@elliemae/ds-classnames";
6
+ import { MODAL_TYPE_V2 } from "../constants";
7
+ import { DSModalContent } from "./components/ModalContent";
8
+ const DSModal = ({
9
+ containerProps = {},
10
+ className = "",
11
+ style = {},
12
+ size = "default",
13
+ modalType = MODAL_TYPE_V2.INFORMATION,
14
+ modalSubType = null,
15
+ modalTitle = "",
16
+ dataTestId = "ds-modal",
17
+ centered = false,
18
+ showRejectButton = false,
19
+ showClose = true,
20
+ searchProps = {},
21
+ actionsRef = () => null,
22
+ additionalFooterCssClass,
23
+ overridePropsConfirmButton = {},
24
+ overridePropsRejectButton = {},
25
+ children,
26
+ isOpen = true,
27
+ onClose = () => null,
28
+ onAfterOpen = () => null,
29
+ onConfirm = () => null,
30
+ onReject = () => null,
31
+ rejectLabel = "Discard",
32
+ confirmLabel = "Save",
33
+ shouldCloseOnOverlayClick = false,
34
+ appElement = "#root",
35
+ zIndex = 10,
36
+ removePadding = false
37
+ }) => {
38
+ if (typeof document !== "undefined" && true && document && ReactModal.setAppElement) {
56
39
  ReactModal.setAppElement(appElement);
57
40
  }
58
-
59
41
  const {
60
42
  cssClassName,
61
43
  classNameBlock,
62
44
  classNameModifier
63
- } = convertPropToCssClassName('modal-v2', className, {
64
- size
65
- });
66
- return /*#__PURE__*/_jsx(ReactModal, {
45
+ } = convertPropToCssClassName("modal-v2", className, { size });
46
+ return /* @__PURE__ */ React2.createElement(ReactModal, {
67
47
  testId: dataTestId,
68
- className: "".concat(cssClassName, " ").concat(classNameBlock("type-".concat(modalType))),
48
+ className: `${cssClassName} ${classNameBlock(`type-${modalType}`)}`,
69
49
  contentLabel: modalTitle,
70
- isOpen: isOpen,
71
- onAfterOpen: onAfterOpen,
50
+ isOpen,
51
+ onAfterOpen,
72
52
  onRequestClose: onClose,
73
- overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered ? 'center' : 'top')),
74
- shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
53
+ overlayClassName: `${classNameBlock("overlay")} ${classNameModifier(centered ? "center" : "top")}`,
54
+ shouldCloseOnOverlayClick,
75
55
  style: {
76
- content: _objectSpread({}, style),
56
+ content: {
57
+ ...style
58
+ },
77
59
  overlay: {
78
- // position: 'absolute', https://jira.elliemae.io/browse/PUI-1471, the overlay should be positioned based on the browser window rather positioned absolute to its parent
79
60
  zIndex
80
61
  }
81
62
  }
82
- }, void 0, /*#__PURE__*/_jsx(DSModalContent, {
83
- actionsRef: actionsRef,
84
- additionalFooterCssClass: additionalFooterCssClass,
85
- confirmLabel: confirmLabel,
86
- containerProps: containerProps,
87
- modalSubType: modalSubType,
88
- modalTitle: modalTitle,
89
- modalType: modalType,
90
- onClose: onClose,
91
- onConfirm: onConfirm,
92
- onReject: onReject,
93
- overridePropsConfirmButton: overridePropsConfirmButton,
94
- overridePropsRejectButton: overridePropsRejectButton,
95
- rejectLabel: rejectLabel,
96
- searchProps: searchProps,
97
- showClose: showClose,
98
- showRejectButton: showRejectButton,
99
- removePadding: removePadding
100
- }, void 0, children));
63
+ }, /* @__PURE__ */ React2.createElement(DSModalContent, {
64
+ actionsRef,
65
+ additionalFooterCssClass,
66
+ confirmLabel,
67
+ containerProps,
68
+ modalSubType,
69
+ modalTitle,
70
+ modalType,
71
+ onClose,
72
+ onConfirm,
73
+ onReject,
74
+ overridePropsConfirmButton,
75
+ overridePropsRejectButton,
76
+ rejectLabel,
77
+ searchProps,
78
+ showClose,
79
+ showRejectButton,
80
+ removePadding
81
+ }, children));
101
82
  };
102
-
103
83
  const props = {
104
- /** inject props to container wrapper */
105
- containerProps: PropTypes.object.description('inject props to container wrapper'),
106
-
107
- /** css class */
108
- className: PropTypes.string.description('css class'),
109
-
110
- /** style object for container wrapper */
111
- style: PropTypes.object.description('style object for container wrapper'),
112
-
113
- /** modal container title */
114
- modalTitle: PropTypes.string.description('modal container title'),
115
-
116
- /** center container */
117
- centered: PropTypes.bool.description('center container'),
118
-
119
- /** show reject button */
120
- showRejectButton: PropTypes.bool.description('show reject button'),
121
-
122
- /** show close button */
123
- showClose: PropTypes.bool.description('show close button'),
124
-
125
- /*
126
- Props for search component
127
- */
128
- searchProps: PropTypes.object.description('Props for search component'),
129
-
130
- /** css class for footer */
131
- additionalFooterCssClass: PropTypes.string.description('css class for footer'),
132
-
133
- /** override props confirm button */
134
- overridePropsConfirmButton: PropTypes.object.description('override props confirm button'),
135
-
136
- /** override props reject button */
137
- overridePropsRejectButton: PropTypes.object.description('override props reject button'),
138
-
139
- /** controlled isOpen flag */
140
- isOpen: PropTypes.bool.description('controlled isOpen flag'),
141
-
142
- /** close callback */
143
- onClose: PropTypes.func.description('close callback'),
144
-
145
- /** after open callback */
146
- onAfterOpen: PropTypes.func.description('after open callback'),
147
-
148
- /** confirm callback */
149
- onConfirm: PropTypes.func.description('confirm callback'),
150
-
151
- /** reject callback */
152
- onReject: PropTypes.func.description('reject callback'),
153
-
154
- /** reject label */
155
- rejectLabel: PropTypes.string.description('reject label'),
156
-
157
- /** confirm text string */
158
- confirmLabel: PropTypes.string.description('confirm text string'),
159
-
160
- /** modal container size */
161
- size: PropTypes.oneOf(['default', 'xx-large', 'x-large', 'large', 'medium', 'small']).description('modal container size'),
162
-
163
- /** modal sub type */
164
- modalSubType: PropTypes.any.description('modal sub type'),
165
-
166
- /** modal type */
167
- modalType: PropTypes.any.description('modal type'),
168
-
169
- /** ref for modal footer actions */
170
- actionsRef: PropTypes.any.description('ref for modal footer actions'),
171
-
172
- /** modal container children */
173
- children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf([PropTypes.element])]).description('modal container children'),
174
-
175
- /** close on click outside container */
176
- shouldCloseOnOverlayClick: PropTypes.bool.description('close on click outside container'),
177
-
178
- /*
179
- App element ID to inject the modal
180
- */
181
- appElement: PropTypes.string.description('App element ID to inject the modal'),
182
-
183
- /** zindex for modal container */
184
- zIndex: PropTypes.number.description('zindex for modal container'),
185
-
186
- /** remove modal builtin padding */
187
- removePadding: PropTypes.bool.description('remove modal builtin padding')
84
+ containerProps: PropTypes.object.description("inject props to container wrapper"),
85
+ className: PropTypes.string.description("css class"),
86
+ style: PropTypes.object.description("style object for container wrapper"),
87
+ modalTitle: PropTypes.string.description("modal container title"),
88
+ centered: PropTypes.bool.description("center container"),
89
+ showRejectButton: PropTypes.bool.description("show reject button"),
90
+ showClose: PropTypes.bool.description("show close button"),
91
+ searchProps: PropTypes.object.description("Props for search component"),
92
+ additionalFooterCssClass: PropTypes.string.description("css class for footer"),
93
+ overridePropsConfirmButton: PropTypes.object.description("override props confirm button"),
94
+ overridePropsRejectButton: PropTypes.object.description("override props reject button"),
95
+ isOpen: PropTypes.bool.description("controlled isOpen flag"),
96
+ onClose: PropTypes.func.description("close callback"),
97
+ onAfterOpen: PropTypes.func.description("after open callback"),
98
+ onConfirm: PropTypes.func.description("confirm callback"),
99
+ onReject: PropTypes.func.description("reject callback"),
100
+ rejectLabel: PropTypes.string.description("reject label"),
101
+ confirmLabel: PropTypes.string.description("confirm text string"),
102
+ size: PropTypes.oneOf([
103
+ "default",
104
+ "xx-large",
105
+ "x-large",
106
+ "large",
107
+ "medium",
108
+ "small"
109
+ ]).description("modal container size"),
110
+ modalSubType: PropTypes.any.description("modal sub type"),
111
+ modalType: PropTypes.any.description("modal type"),
112
+ actionsRef: PropTypes.any.description("ref for modal footer actions"),
113
+ children: PropTypes.oneOfType([
114
+ PropTypes.element,
115
+ PropTypes.arrayOf([PropTypes.element])
116
+ ]).description("modal container children"),
117
+ shouldCloseOnOverlayClick: PropTypes.bool.description("close on click outside container"),
118
+ appElement: PropTypes.string.description("App element ID to inject the modal"),
119
+ zIndex: PropTypes.number.description("zindex for modal container"),
120
+ removePadding: PropTypes.bool.description("remove modal builtin padding")
188
121
  };
122
+ DSModal.propTypes = props;
189
123
  const DSModalWithSchema = describe(DSModal);
190
124
  DSModalWithSchema.propTypes = props;
191
-
192
- export { DSModalWithSchema, DSModal as default };
125
+ var DSModal_default = DSModal;
126
+ export {
127
+ DSModalContent,
128
+ DSModalWithSchema,
129
+ DSModal_default as default
130
+ };
131
+ //# sourceMappingURL=DSModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v2/DSModal.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport ReactModal from 'react-modal';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { MODAL_TYPE_V2 } from '../constants';\nimport { DSModalContent } from './components/ModalContent';\n\nconst DSModal = ({\n containerProps = {},\n className = '',\n style = {},\n size = 'default',\n //\n modalType = MODAL_TYPE_V2.INFORMATION,\n modalSubType = null,\n modalTitle = '',\n dataTestId = 'ds-modal',\n centered = false,\n showRejectButton = false,\n showClose = true,\n searchProps = {},\n // override\n actionsRef = () => null,\n additionalFooterCssClass,\n overridePropsConfirmButton = {},\n overridePropsRejectButton = {},\n // react modal\n children,\n isOpen = true,\n onClose = () => null,\n onAfterOpen = () => null,\n onConfirm = () => null,\n onReject = () => null,\n rejectLabel = 'Discard',\n confirmLabel = 'Save',\n shouldCloseOnOverlayClick = false,\n appElement = '#root',\n zIndex = 10,\n removePadding = false,\n}) => {\n if (\n typeof document !== 'undefined' &&\n process.env.NODE_ENV !== 'test' &&\n document &&\n ReactModal.setAppElement\n ) {\n ReactModal.setAppElement(appElement);\n }\n\n const {\n cssClassName,\n classNameBlock,\n classNameModifier,\n } = convertPropToCssClassName('modal-v2', className, { size });\n\n return (\n <ReactModal\n testId={dataTestId}\n className={`${cssClassName} ${classNameBlock(`type-${modalType}`)}`}\n contentLabel={modalTitle}\n isOpen={isOpen}\n onAfterOpen={onAfterOpen}\n onRequestClose={onClose}\n overlayClassName={`${classNameBlock('overlay')} ${classNameModifier(\n centered ? 'center' : 'top',\n )}`}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n style={{\n content: {\n ...style,\n },\n overlay: {\n // position: 'absolute', https://jira.elliemae.io/browse/PUI-1471, the overlay should be positioned based on the browser window rather positioned absolute to its parent\n zIndex,\n },\n }}\n >\n <DSModalContent\n actionsRef={actionsRef}\n additionalFooterCssClass={additionalFooterCssClass}\n confirmLabel={confirmLabel}\n containerProps={containerProps}\n modalSubType={modalSubType}\n modalTitle={modalTitle}\n modalType={modalType}\n onClose={onClose}\n onConfirm={onConfirm}\n onReject={onReject}\n overridePropsConfirmButton={overridePropsConfirmButton}\n overridePropsRejectButton={overridePropsRejectButton}\n rejectLabel={rejectLabel}\n searchProps={searchProps}\n showClose={showClose}\n showRejectButton={showRejectButton}\n removePadding={removePadding}\n >\n {children}\n </DSModalContent>\n </ReactModal>\n );\n};\n\nconst props = {\n /** inject props to container wrapper */\n containerProps: PropTypes.object.description(\n 'inject props to container wrapper',\n ),\n /** css class */\n className: PropTypes.string.description('css class'),\n /** style object for container wrapper */\n style: PropTypes.object.description('style object for container wrapper'),\n /** modal container title */\n modalTitle: PropTypes.string.description('modal container title'),\n /** center container */\n centered: PropTypes.bool.description('center container'),\n /** show reject button */\n showRejectButton: PropTypes.bool.description('show reject button'),\n /** show close button */\n showClose: PropTypes.bool.description('show close button'),\n /*\n Props for search component\n */\n searchProps: PropTypes.object.description('Props for search component'),\n /** css class for footer */\n additionalFooterCssClass: PropTypes.string.description(\n 'css class for footer',\n ),\n /** override props confirm button */\n overridePropsConfirmButton: PropTypes.object.description(\n 'override props confirm button',\n ),\n /** override props reject button */\n overridePropsRejectButton: PropTypes.object.description(\n 'override props reject button',\n ),\n /** controlled isOpen flag */\n isOpen: PropTypes.bool.description('controlled isOpen flag'),\n /** close callback */\n onClose: PropTypes.func.description('close callback'),\n /** after open callback */\n onAfterOpen: PropTypes.func.description('after open callback'),\n /** confirm callback */\n onConfirm: PropTypes.func.description('confirm callback'),\n /** reject callback */\n onReject: PropTypes.func.description('reject callback'),\n /** reject label */\n rejectLabel: PropTypes.string.description('reject label'),\n /** confirm text string */\n confirmLabel: PropTypes.string.description('confirm text string'),\n /** modal container size */\n size: PropTypes.oneOf([\n 'default',\n 'xx-large',\n 'x-large',\n 'large',\n 'medium',\n 'small',\n ]).description('modal container size'),\n /** modal sub type */\n modalSubType: PropTypes.any.description('modal sub type'),\n /** modal type */\n modalType: PropTypes.any.description('modal type'),\n /** ref for modal footer actions */\n actionsRef: PropTypes.any.description('ref for modal footer actions'),\n /** modal container children */\n children: PropTypes.oneOfType([\n PropTypes.element,\n PropTypes.arrayOf([PropTypes.element]),\n ]).description('modal container children'),\n /** close on click outside container */\n shouldCloseOnOverlayClick: PropTypes.bool.description(\n 'close on click outside container',\n ),\n /*\n App element ID to inject the modal\n */\n appElement: PropTypes.string.description(\n 'App element ID to inject the modal',\n ),\n /** zindex for modal container */\n zIndex: PropTypes.number.description('zindex for modal container'),\n /** remove modal builtin padding */\n removePadding: PropTypes.bool.description('remove modal builtin padding'),\n};\n\nDSModal.propTypes = props;\n\nconst DSModalWithSchema = describe(DSModal);\nDSModalWithSchema.propTypes = props;\n\nexport { DSModalContent, DSModalWithSchema };\nexport default DSModal;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,UAAU,CAAC;AAAA,EACf,iBAAiB;AAAA,EACjB,YAA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IAAO,kBAAQ;",
6
+ "names": []
7
+ }
package/esm/v2/blocks.js CHANGED
@@ -1,77 +1,42 @@
1
- import { aggregatedClasses } from '@elliemae/ds-classnames';
2
-
3
- const blockName = 'modal-v2';
4
- const ModalHeader = aggregatedClasses('div')(blockName, 'modal-header', _ref => {
5
- let {
6
- type,
7
- showClose
8
- } = _ref;
9
- return {
10
- [type]: type,
11
- 'with-close': showClose
12
- };
13
- });
14
- const ModalHeaderTopRight = aggregatedClasses('div')(blockName, 'modal-header-close', _ref2 => {
15
- let {
16
- type
17
- } = _ref2;
18
- return {
19
- [type]: type
20
- };
21
- });
22
- const ModalFeedback = aggregatedClasses('div')(blockName, 'modal-feedback', _ref3 => {
23
- let {
24
- type
25
- } = _ref3;
26
- return {
27
- [type]: type
28
- };
29
- });
30
- const ModalTitle = aggregatedClasses('h3')(blockName, 'modal-title', _ref4 => {
31
- let {
32
- type
33
- } = _ref4;
34
- return {
35
- [type]: type
36
- };
37
- });
38
- const ModalContent = aggregatedClasses('div')(blockName, 'modal-content', _ref5 => {
39
- let {
40
- type,
41
- removePadding
42
- } = _ref5;
43
- return {
44
- [type]: type,
45
- 'remove-padding': removePadding
46
- };
47
- });
48
- const ModalWrapper = aggregatedClasses('div')(blockName, 'modal-wrapper', _ref6 => {
49
- let {
50
- type,
51
- removePadding
52
- } = _ref6;
53
- return {
54
- [type]: type,
55
- 'remove-padding': removePadding
56
- };
57
- });
58
- const ModalFooter = aggregatedClasses('div')(blockName, 'modal-footer', _ref7 => {
59
- let {
60
- type,
61
- additionalFooterCssClass
62
- } = _ref7;
63
- return {
64
- [type]: type,
65
- [additionalFooterCssClass]: additionalFooterCssClass
66
- };
67
- });
68
- const ModalFooterActions = aggregatedClasses('div')(blockName, 'modal-footer-actions', _ref8 => {
69
- let {
70
- type
71
- } = _ref8;
72
- return {
73
- [type]: type
74
- };
75
- });
76
-
77
- export { ModalContent, ModalFeedback, ModalFooter, ModalFooterActions, ModalHeader, ModalHeaderTopRight, ModalTitle, ModalWrapper };
1
+ import * as React from "react";
2
+ import { aggregatedClasses } from "@elliemae/ds-classnames";
3
+ const blockName = "modal-v2";
4
+ const ModalHeader = aggregatedClasses("div")(blockName, "modal-header", ({ type, showClose }) => ({
5
+ [type]: type,
6
+ "with-close": showClose
7
+ }));
8
+ const ModalHeaderTopRight = aggregatedClasses("div")(blockName, "modal-header-close", ({ type }) => ({
9
+ [type]: type
10
+ }));
11
+ const ModalFeedback = aggregatedClasses("div")(blockName, "modal-feedback", ({ type }) => ({
12
+ [type]: type
13
+ }));
14
+ const ModalTitle = aggregatedClasses("h3")(blockName, "modal-title", ({ type }) => ({
15
+ [type]: type
16
+ }));
17
+ const ModalContent = aggregatedClasses("div")(blockName, "modal-content", ({ type, removePadding }) => ({
18
+ [type]: type,
19
+ "remove-padding": removePadding
20
+ }));
21
+ const ModalWrapper = aggregatedClasses("div")(blockName, "modal-wrapper", ({ type, removePadding }) => ({
22
+ [type]: type,
23
+ "remove-padding": removePadding
24
+ }));
25
+ const ModalFooter = aggregatedClasses("div")(blockName, "modal-footer", ({ type, additionalFooterCssClass }) => ({
26
+ [type]: type,
27
+ [additionalFooterCssClass]: additionalFooterCssClass
28
+ }));
29
+ const ModalFooterActions = aggregatedClasses("div")(blockName, "modal-footer-actions", ({ type }) => ({
30
+ [type]: type
31
+ }));
32
+ export {
33
+ ModalContent,
34
+ ModalFeedback,
35
+ ModalFooter,
36
+ ModalFooterActions,
37
+ ModalHeader,
38
+ ModalHeaderTopRight,
39
+ ModalTitle,
40
+ ModalWrapper
41
+ };
42
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v2/blocks.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockName = 'modal-v2';\n\nexport const ModalHeader = aggregatedClasses('div')(blockName, 'modal-header', ({ type, showClose }) => ({\n [type]: type,\n 'with-close': showClose,\n}));\n\nexport const ModalHeaderTopRight = aggregatedClasses('div')(blockName, 'modal-header-close', ({ type }) => ({\n [type]: type,\n}));\n\nexport const ModalFeedback = aggregatedClasses('div')(blockName, 'modal-feedback', ({ type }) => ({\n [type]: type,\n}));\n\nexport const ModalTitle = aggregatedClasses('h3')(blockName, 'modal-title', ({ type }) => ({\n [type]: type,\n}));\n\nexport const ModalContent = aggregatedClasses('div')(blockName, 'modal-content', ({ type, removePadding }) => ({\n [type]: type,\n 'remove-padding': removePadding,\n}));\n\nexport const ModalWrapper = aggregatedClasses('div')(blockName, 'modal-wrapper', ({ type, removePadding }) => ({\n [type]: type,\n 'remove-padding': removePadding,\n}));\n\nexport const ModalFooter = aggregatedClasses('div')(\n blockName,\n 'modal-footer',\n ({ type, additionalFooterCssClass }) => ({\n [type]: type,\n [additionalFooterCssClass]: additionalFooterCssClass,\n }),\n);\n\nexport const ModalFooterActions = aggregatedClasses('div')(blockName, 'modal-footer-actions', ({ type }) => ({\n [type]: type,\n}));\n"],
5
+ "mappings": "AAAA;ACAA;AAEA,MAAM,YAAY;AAEX,MAAM,cAAc,kBAAkB,OAAO,WAAW,gBAAgB,CAAC,EAAE,MAAM,gBAAiB;AAAA,GACtG,OAAO;AAAA,EACR,cAAc;AAAA;AAGT,MAAM,sBAAsB,kBAAkB,OAAO,WAAW,sBAAsB,CAAC,EAAE,WAAY;AAAA,GACzG,OAAO;AAAA;AAGH,MAAM,gBAAgB,kBAAkB,OAAO,WAAW,kBAAkB,CAAC,EAAE,WAAY;AAAA,GAC/F,OAAO;AAAA;AAGH,MAAM,aAAa,kBAAkB,MAAM,WAAW,eAAe,CAAC,EAAE,WAAY;AAAA,GACxF,OAAO;AAAA;AAGH,MAAM,eAAe,kBAAkB,OAAO,WAAW,iBAAiB,CAAC,EAAE,MAAM,oBAAqB;AAAA,GAC5G,OAAO;AAAA,EACR,kBAAkB;AAAA;AAGb,MAAM,eAAe,kBAAkB,OAAO,WAAW,iBAAiB,CAAC,EAAE,MAAM,oBAAqB;AAAA,GAC5G,OAAO;AAAA,EACR,kBAAkB;AAAA;AAGb,MAAM,cAAc,kBAAkB,OAC3C,WACA,gBACA,CAAC,EAAE,MAAM,+BAAgC;AAAA,GACtC,OAAO;AAAA,GACP,2BAA2B;AAAA;AAIzB,MAAM,qBAAqB,kBAAkB,OAAO,WAAW,wBAAwB,CAAC,EAAE,WAAY;AAAA,GAC1G,OAAO;AAAA;",
6
+ "names": []
7
+ }