@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
package/esm/v1/DSModal.js CHANGED
@@ -1,139 +1,148 @@
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, {
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import PropTypes from "prop-types";
4
+ import ReactModal from "react-modal";
5
+ import { convertPropToCssClassName } from "@elliemae/ds-classnames";
6
+ import { DSIconSizes } from "@elliemae/ds-icon";
7
+ import { Close } from "@elliemae/ds-icons";
8
+ import DSButton from "@elliemae/ds-button";
9
+ import MODAL_TYPE, { modalTypes } from "../constants";
10
+ import ModalFeedBack from "./ModalFeedBack/ModalFeedBack";
11
+ import { sizes, iconSizes } from "@elliemae/ds-shared/prop-types";
12
+ const DSModal = ({
13
+ containerProps = {},
14
+ className = "",
15
+ dataTestId = "ds-modal",
16
+ additionalFooterCssClass = "",
17
+ style = {},
18
+ iconCloseSize = DSIconSizes.S,
19
+ modalType = MODAL_TYPE.DEFAULT,
20
+ showHeader = true,
21
+ showFooter = true,
22
+ children,
23
+ centered = true,
24
+ confirmLabel = "Accept",
25
+ modalTitle = "",
26
+ size = "medium",
27
+ isOpen = false,
28
+ onClose = () => null,
29
+ onAfterOpen = () => null,
30
+ onConfirm = () => null,
31
+ onReject = () => null,
32
+ rejectLabel = "Cancel",
33
+ shouldCloseOnOverlayClick = false,
34
+ hasError = false,
35
+ hasWarning = false,
36
+ hasSuccess = false,
37
+ hasInfo = false,
38
+ hasHelp = false,
39
+ actionsRef = () => null,
40
+ appElement = "#root",
41
+ overridePropsConfirmButton = {},
42
+ overridePropsRejectButton = {},
43
+ zIndex = 10
44
+ }) => {
45
+ typeof document !== "undefined" && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement);
46
+ const { cssClassName, classNameElement, classNameBlock, classNameModifier, classNameBlockModifier } = convertPropToCssClassName("modal", className, {
68
47
  hasError,
69
48
  hasWarning,
70
49
  hasSuccess,
71
50
  modalType,
72
51
  size
73
52
  });
74
- const {
75
- WARNING,
76
- ERROR,
77
- SUCCESS,
78
- HELP,
79
- INFO
80
- } = MODAL_TYPE;
53
+ const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;
81
54
  const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;
82
55
  const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;
83
- return /*#__PURE__*/_jsx(ReactModal, {
56
+ return /* @__PURE__ */ React2.createElement(ReactModal, {
84
57
  testId: dataTestId,
85
58
  className: cssClassName,
86
59
  contentLabel: modalTitle,
87
- isOpen: isOpen,
88
- onAfterOpen: onAfterOpen,
60
+ isOpen,
61
+ onAfterOpen,
89
62
  onRequestClose: onClose,
90
- overlayClassName: "".concat(classNameBlock('overlay'), " ").concat(classNameModifier(centered && 'center')),
91
- shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
63
+ overlayClassName: `${classNameBlock("overlay")} ${classNameModifier(centered && "center")}`,
64
+ shouldCloseOnOverlayClick,
92
65
  style: {
93
- content: _objectSpread({}, style),
66
+ content: {
67
+ ...style
68
+ },
94
69
  overlay: {
95
70
  zIndex
96
71
  }
97
72
  }
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
- })));
73
+ }, /* @__PURE__ */ React2.createElement("div", {
74
+ ...containerProps
75
+ }, showHeader && /* @__PURE__ */ React2.createElement("div", {
76
+ className: classNameBlock("modal-header")
77
+ }, /* @__PURE__ */ React2.createElement("div", {
78
+ className: classNameElement("title", "modal-header")
79
+ }, modalTitle), /* @__PURE__ */ React2.createElement("div", {
80
+ className: classNameElement("icon", "modal-header")
81
+ }, /* @__PURE__ */ React2.createElement(DSButton, {
82
+ buttonType: "link",
83
+ icon: /* @__PURE__ */ React2.createElement(Close, null),
84
+ onClick: onClose,
85
+ size: iconCloseSize
86
+ }))), /* @__PURE__ */ React2.createElement("div", {
87
+ className: classNameElement("body")
88
+ }, showFeedBack && /* @__PURE__ */ React2.createElement(ModalFeedBack, {
89
+ hasError,
90
+ hasHelp,
91
+ hasInfo,
92
+ hasSuccess,
93
+ hasWarning,
94
+ modalType
95
+ }), children), showFooter && !isAFeedbackType && /* @__PURE__ */ React2.createElement("div", {
96
+ className: `${classNameBlock("modal-footer")} ${additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, "modal-footer") : ""}`
97
+ }, /* @__PURE__ */ React2.createElement("div", {
98
+ ref: actionsRef,
99
+ className: classNameBlock("modal-footer-actions")
100
+ }, modalType === MODAL_TYPE.CONFIRM && /* @__PURE__ */ React2.createElement(DSButton, {
101
+ buttonType: "secondary",
102
+ className: `${classNameElement("button-action")} ${classNameModifier("reject", "button-action")} `,
103
+ labelText: rejectLabel,
104
+ onClick: onReject,
105
+ ...overridePropsRejectButton
106
+ }), /* @__PURE__ */ React2.createElement(DSButton, {
107
+ buttonType: "primary",
108
+ className: `${classNameElement("button-action")} ${classNameModifier("confirm", "button-action")} `,
109
+ labelText: confirmLabel,
110
+ onClick: onConfirm,
111
+ ...overridePropsConfirmButton
112
+ })))));
113
+ };
114
+ DSModal.propTypes = {
115
+ className: PropTypes.string,
116
+ additionalFooterCssClass: PropTypes.string,
117
+ style: PropTypes.shape({}),
118
+ iconCloseSize: PropTypes.oneOf(iconSizes),
119
+ modalType: PropTypes.oneOf(modalTypes),
120
+ showHeader: PropTypes.bool,
121
+ showFooter: PropTypes.bool,
122
+ children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired,
123
+ centered: PropTypes.bool,
124
+ confirmLabel: PropTypes.string,
125
+ modalTitle: PropTypes.string,
126
+ size: PropTypes.oneOf(sizes),
127
+ isOpen: PropTypes.bool,
128
+ onClose: PropTypes.func,
129
+ onAfterOpen: PropTypes.func,
130
+ onConfirm: PropTypes.func,
131
+ onReject: PropTypes.func,
132
+ rejectLabel: PropTypes.string,
133
+ shouldCloseOnOverlayClick: PropTypes.bool,
134
+ hasError: PropTypes.bool,
135
+ hasWarning: PropTypes.bool,
136
+ hasSuccess: PropTypes.bool,
137
+ hasInfo: PropTypes.bool,
138
+ hasHelp: PropTypes.bool,
139
+ actionsRef: PropTypes.func,
140
+ appElement: PropTypes.string,
141
+ overridePropsConfirmButton: PropTypes.shape({}),
142
+ overridePropsRejectButton: PropTypes.shape({})
143
+ };
144
+ var DSModal_default = DSModal;
145
+ export {
146
+ DSModal_default as default
137
147
  };
138
-
139
- export { DSModal as default };
148
+ //# sourceMappingURL=DSModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModal.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactModal from 'react-modal';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSIconSizes } from '@elliemae/ds-icon';\nimport { Close } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport MODAL_TYPE, { modalTypes } from '../constants';\nimport ModalFeedBack from './ModalFeedBack/ModalFeedBack';\nimport { sizes, iconSizes } from '@elliemae/ds-shared/prop-types';\n\nconst DSModal = ({\n containerProps = {},\n className = '',\n dataTestId = 'ds-modal',\n additionalFooterCssClass = '',\n style = {},\n iconCloseSize = DSIconSizes.S,\n modalType = MODAL_TYPE.DEFAULT,\n showHeader = true,\n showFooter = true,\n children,\n centered = true,\n confirmLabel = 'Accept',\n modalTitle = '',\n size = 'medium',\n isOpen = false,\n onClose = () => null,\n onAfterOpen = () => null,\n onConfirm = () => null,\n onReject = () => null,\n rejectLabel = 'Cancel',\n shouldCloseOnOverlayClick = false,\n hasError = false,\n hasWarning = false,\n hasSuccess = false,\n hasInfo = false,\n hasHelp = false,\n actionsRef = () => null,\n appElement = '#root',\n overridePropsConfirmButton = {},\n overridePropsRejectButton = {},\n zIndex = 10,\n}) => {\n // http://reactcommunity.org/react-modal/accessibility/ https://github.com/reactjs/react-modal#examples\n typeof document !== 'undefined' && document && ReactModal.setAppElement && ReactModal.setAppElement(appElement); // eslint-disable-line\n const { cssClassName, classNameElement, classNameBlock, classNameModifier, classNameBlockModifier } =\n convertPropToCssClassName('modal', className, {\n hasError,\n hasWarning,\n hasSuccess,\n modalType,\n size,\n });\n\n const { WARNING, ERROR, SUCCESS, HELP, INFO } = MODAL_TYPE;\n\n const isAFeedbackType = [WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1;\n const showFeedBack = isAFeedbackType || hasError || hasWarning || hasSuccess || hasInfo || hasHelp;\n\n return (\n <ReactModal\n testId={dataTestId}\n className={cssClassName}\n contentLabel={modalTitle}\n isOpen={isOpen}\n onAfterOpen={onAfterOpen}\n onRequestClose={onClose}\n overlayClassName={`${classNameBlock('overlay')} ${classNameModifier(centered && 'center')}`}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n style={{\n content: {\n ...style,\n },\n overlay: {\n zIndex,\n },\n }}\n >\n <div {...containerProps}>\n {showHeader && (\n <div className={classNameBlock('modal-header')}>\n <div className={classNameElement('title', 'modal-header')}>{modalTitle}</div>\n <div className={classNameElement('icon', 'modal-header')}>\n <DSButton buttonType=\"link\" icon={<Close />} onClick={onClose} size={iconCloseSize} />\n </div>\n </div>\n )}\n <div className={classNameElement('body')}>\n {showFeedBack && (\n <ModalFeedBack\n hasError={hasError}\n hasHelp={hasHelp}\n hasInfo={hasInfo}\n hasSuccess={hasSuccess}\n hasWarning={hasWarning}\n modalType={modalType}\n />\n )}\n {children}\n </div>\n {showFooter && !isAFeedbackType && (\n <div\n className={`${classNameBlock('modal-footer')} ${\n additionalFooterCssClass ? classNameBlockModifier(additionalFooterCssClass, 'modal-footer') : ''\n }`}\n >\n <div ref={actionsRef} className={classNameBlock('modal-footer-actions')}>\n {modalType === MODAL_TYPE.CONFIRM && (\n <DSButton\n buttonType=\"secondary\"\n className={`${classNameElement('button-action')} ${classNameModifier('reject', 'button-action')} `}\n labelText={rejectLabel}\n onClick={onReject}\n {...overridePropsRejectButton}\n />\n )}\n <DSButton\n buttonType=\"primary\"\n className={`${classNameElement('button-action')} ${classNameModifier('confirm', 'button-action')} `}\n labelText={confirmLabel}\n onClick={onConfirm}\n {...overridePropsConfirmButton}\n />\n </div>\n </div>\n )}\n </div>\n </ReactModal>\n );\n};\n\nDSModal.propTypes = {\n className: PropTypes.string,\n /**\n * Add an additional css class to the footer\n */\n additionalFooterCssClass: PropTypes.string,\n /**\n * Set style for the modal\n */\n style: PropTypes.shape({}),\n /**\n * Select size for the close icon\n */\n iconCloseSize: PropTypes.oneOf(iconSizes),\n /**\n * ['default', 'alert', 'confirm', 'notification', 'warning', 'error', 'success', 'help', 'info']\n */\n modalType: PropTypes.oneOf(modalTypes),\n /**\n * Show the header or not\n */\n showHeader: PropTypes.bool,\n /**\n * Show the footer or not\n */\n showFooter: PropTypes.bool,\n /**\n * Main content of the modal\n */\n children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired,\n /**\n * Content is centered or not\n */\n centered: PropTypes.bool,\n /**\n * Text to be added in the confirm button\n */\n confirmLabel: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n modalTitle: PropTypes.string,\n /**\n * Text to be added in the modal title\n */\n size: PropTypes.oneOf(sizes),\n /**\n * Modal is open or not\n */\n isOpen: PropTypes.bool,\n /**\n * Allows a function to be triggered once the modal is closed\n */\n onClose: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal is opened\n */\n onAfterOpen: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is confirmed\n */\n onConfirm: PropTypes.func,\n /**\n * Allows a function to be triggered once the modal open is rejected\n */\n onReject: PropTypes.func,\n /**\n * Text to be added in the reject button\n */\n rejectLabel: PropTypes.string,\n /**\n * If modal should close on overlay click\n */\n shouldCloseOnOverlayClick: PropTypes.bool,\n /**\n * Modal has error or not\n */\n hasError: PropTypes.bool,\n /**\n * Modal has warning or not\n */\n hasWarning: PropTypes.bool,\n /**\n * Modal has success or not\n */\n hasSuccess: PropTypes.bool,\n /**\n * Modal has info or not\n */\n hasInfo: PropTypes.bool,\n /**\n * Modal has help or not\n */\n hasHelp: PropTypes.bool,\n actionsRef: PropTypes.func,\n appElement: PropTypes.string,\n /**\n * Customized props for the confirm button\n */\n overridePropsConfirmButton: PropTypes.shape({}),\n /**\n * Customized props for the reject button\n */\n overridePropsRejectButton: PropTypes.shape({}),\n};\n\nexport default DSModal;\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,UAAU,CAAC;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,QAAQ;AAAA,EACR,gBAAgB,YAAY;AAAA,EAC5B,YAAY,WAAW;AAAA,EACvB,aAAa;AAAA,EACb,aAAa;AAAA,EACb;AAAA,EACA,WAAW;AAAA,EACX,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU,MAAM;AAAA,EAChB,cAAc,MAAM;AAAA,EACpB,YAAY,MAAM;AAAA,EAClB,WAAW,MAAM;AAAA,EACjB,cAAc;AAAA,EACd,4BAA4B;AAAA,EAC5B,WAAW;AAAA,EACX,aAAa;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,EACV,aAAa,MAAM;AAAA,EACnB,aAAa;AAAA,EACb,6BAA6B;AAAA,EAC7B,4BAA4B;AAAA,EAC5B,SAAS;AAAA,MACL;AAEJ,SAAO,aAAa,eAAe,YAAY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 +1,16 @@
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
+ import * as React from "react";
2
+ const modalTypes = [
3
+ MODAL_TYPE.DEFAULT,
4
+ MODAL_TYPE.ALERT,
5
+ MODAL_TYPE.CONFIRM,
6
+ MODAL_TYPE.NOTIFICATION,
7
+ MODAL_TYPE.WARNING,
8
+ MODAL_TYPE.ERROR,
9
+ MODAL_TYPE.SUCCESS,
10
+ MODAL_TYPE.HELP,
11
+ MODAL_TYPE.INFO
12
+ ];
13
+ export {
14
+ modalTypes
15
+ };
16
+ //# sourceMappingURL=DSModalType.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModalType.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const modalTypes = [\n MODAL_TYPE.DEFAULT,\n MODAL_TYPE.ALERT,\n MODAL_TYPE.CONFIRM,\n MODAL_TYPE.NOTIFICATION,\n MODAL_TYPE.WARNING,\n MODAL_TYPE.ERROR,\n MODAL_TYPE.SUCCESS,\n MODAL_TYPE.HELP,\n MODAL_TYPE.INFO,\n];\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,aAAa;AAAA,EACxB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA;",
6
+ "names": []
7
+ }
@@ -1,143 +1,82 @@
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 => {
1
+ import * as React from "react";
2
+ import { Component, createElement } from "react";
3
+ import { MODAL_TYPE } from "../constants";
4
+ var DSModalWrapper_default = (WrappedComponent) => {
15
5
  class DSModalWrapper extends Component {
16
6
  constructor() {
17
7
  super(...arguments);
18
8
  this.state = {
19
9
  childready: false,
20
- additionalFooterCssClass: 'loading',
10
+ additionalFooterCssClass: "loading",
21
11
  container: null,
22
12
  actions: null,
23
- height: '100%'
13
+ height: "100%"
24
14
  };
25
-
26
- this.onHeaderHeight = e => {
15
+ this.onHeaderHeight = (e) => {
27
16
  this.heightHeaderFlag = true;
28
17
  this.heightHeader = e.height || 0;
29
18
  };
30
-
31
- this.onFooterHeight = e => {
19
+ this.onFooterHeight = (e) => {
32
20
  this.heightFooterFlag = true;
33
21
  this.heightFooter = e.height || 0;
34
22
  };
35
-
36
- this.onResize = _ref => {
37
- let {
38
- bounds
39
- } = _ref;
40
-
23
+ this.onResize = ({ bounds }) => {
41
24
  if (this.heightFooterFlag && this.heightHeaderFlag) {
42
25
  return this.setState({
43
26
  height: bounds.height - this.heightFooter - this.heightHeader
44
27
  });
45
28
  }
46
-
47
- return setTimeout(this.onResize({
48
- bounds
49
- }), 0);
29
+ return setTimeout(this.onResize({ bounds }), 0);
50
30
  };
51
-
52
- this.handleContainer = node => {
53
- if (node) this.setState({
54
- container: node
55
- });
31
+ this.handleContainer = (node) => {
32
+ if (node)
33
+ this.setState({ container: node });
56
34
  this.handleResize();
57
35
  };
58
-
59
- this.handleActions = node => {
60
- if (node) this.setState({
61
- actions: node
62
- });
36
+ this.handleActions = (node) => {
37
+ if (node)
38
+ this.setState({ actions: node });
63
39
  this.handleResize();
64
40
  };
65
41
  }
66
-
67
42
  componentDidMount() {
68
- window.addEventListener('resize', this.handleResize);
43
+ window.addEventListener("resize", this.handleResize);
69
44
  }
70
-
71
45
  componentWillUnmount() {
72
- window.removeEventListener('resize', this.handleResize);
46
+ window.removeEventListener("resize", this.handleResize);
73
47
  }
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
48
  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
-
49
+ if (!this.state)
50
+ return null;
51
+ const { container, actions, childready } = this.state;
52
+ if (!childready)
53
+ return null;
54
+ this.setState({ additionalFooterCssClass: null });
55
+ const { clientWidth: containerWidth } = container;
56
+ const { clientWidth: actionsWidth } = actions;
98
57
  if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
99
- return this.setState({
100
- additionalFooterCssClass: 'fluid-actions'
101
- });
58
+ return this.setState({ additionalFooterCssClass: "fluid-actions" });
102
59
  }
103
-
104
- return this.setState({
105
- additionalFooterCssClass: null
106
- });
60
+ return this.setState({ additionalFooterCssClass: null });
107
61
  }
108
-
109
62
  verifyNodes() {
110
- const {
111
- modalType
112
- } = this.props;
113
-
63
+ const { modalType } = this.props;
114
64
  if (modalType !== MODAL_TYPE.DEFAULT) {
115
65
  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;
66
+ const { container, actions } = this.state;
67
+ if (!container || !actions)
68
+ return null;
122
69
  clearInterval(nodesInterval);
123
- this.setState({
124
- childready: true
125
- });
70
+ this.setState({ childready: true });
126
71
  return this.handleResize();
127
72
  }, 100);
128
73
  }
129
74
  }
130
-
131
75
  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), {}, {
76
+ const { props, state } = this;
77
+ const { additionalFooterCssClass, height } = state;
78
+ return createElement(WrappedComponent, {
79
+ ...props,
141
80
  height,
142
81
  onResize: this.onResize,
143
82
  onFooterHeight: this.onFooterHeight,
@@ -146,15 +85,16 @@ var DSModalWrapper = (WrappedComponent => {
146
85
  actionsRef: this.handleActions,
147
86
  additionalFooterCssClass,
148
87
  onAfterOpen: () => {
149
- if (props.onAfterOpen) props.onAfterOpen();
88
+ if (props.onAfterOpen)
89
+ props.onAfterOpen();
150
90
  this.verifyNodes();
151
91
  }
152
- }));
92
+ });
153
93
  }
154
-
155
94
  }
156
-
157
95
  return DSModalWrapper;
158
- });
159
-
160
- export { DSModalWrapper as default };
96
+ };
97
+ export {
98
+ DSModalWrapper_default as default
99
+ };
100
+ //# sourceMappingURL=DSModalWrapper.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/v1/DSModalWrapper.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Component, createElement } from 'react';\nimport { MODAL_TYPE } from '../constants';\n\nexport default (WrappedComponent) => {\n class DSModalWrapper extends Component {\n state = {\n childready: false,\n additionalFooterCssClass: 'loading',\n container: null,\n actions: null,\n height: '100%',\n };\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n }\n\n onHeaderHeight = (e) => {\n this.heightHeaderFlag = true;\n this.heightHeader = e.height || 0;\n };\n\n onFooterHeight = (e) => {\n this.heightFooterFlag = true;\n this.heightFooter = e.height || 0;\n };\n\n onResize = ({ bounds }) => {\n if (this.heightFooterFlag && this.heightHeaderFlag) {\n return this.setState({\n height: bounds.height - this.heightFooter - this.heightHeader,\n });\n }\n return setTimeout(this.onResize({ bounds }), 0);\n };\n\n handleContainer = (node) => {\n if (node) this.setState({ container: node });\n this.handleResize();\n };\n\n handleActions = (node) => {\n if (node) this.setState({ actions: node });\n this.handleResize();\n };\n\n /**\n * Change button width to 100% if the\n * combined width of the button (or button group) exceed 50% of the container width.\n */\n handleResize() {\n if (!this.state) return null;\n const { container, actions, childready } = this.state;\n if (!childready) return null;\n this.setState({ additionalFooterCssClass: null }); // !important reset to default state to recalculate\n const { clientWidth: containerWidth } = container;\n const { clientWidth: actionsWidth } = actions;\n // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.\n if (\n containerWidth &&\n actionsWidth &&\n (actionsWidth / containerWidth) * 100 > 50\n ) {\n return this.setState({ additionalFooterCssClass: 'fluid-actions' });\n }\n return this.setState({ additionalFooterCssClass: null });\n }\n\n verifyNodes() {\n const { modalType } = this.props;\n if (modalType !== MODAL_TYPE.DEFAULT) {\n const nodesInterval = setInterval(() => {\n // !important it checks when nodes are availables\n const { container, actions } = this.state;\n if (!container || !actions) return null;\n clearInterval(nodesInterval);\n this.setState({ childready: true });\n return this.handleResize();\n }, 100);\n }\n }\n\n render() {\n const { props, state } = this;\n const { additionalFooterCssClass, height } = state;\n return createElement(WrappedComponent, {\n ...props,\n height,\n onResize: this.onResize,\n onFooterHeight: this.onFooterHeight,\n onHeaderHeight: this.onHeaderHeight,\n containerRef: this.handleContainer,\n actionsRef: this.handleActions,\n additionalFooterCssClass,\n onAfterOpen: () => {\n if (props.onAfterOpen) props.onAfterOpen();\n this.verifyNodes();\n },\n });\n }\n }\n\n return DSModalWrapper;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA,IAAO,yBAAQ,CAAC,qBAAqB;AACnC,+BAA6B,UAAU;AAAA,IAAvC,cAJF;AAIE;AACE,mBAAQ;AAAA,QACN,YAAY;AAAA,QACZ,0BAA0B;AAAA,QAC1B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,QAAQ;AAAA;AAWV,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA;AAGlC,4BAAiB,CAAC,MAAM;AACtB,aAAK,mBAAmB;AACxB,aAAK,eAAe,EAAE,UAAU;AAAA;AAGlC,sBAAW,CAAC,EAAE,aAAa;AACzB,YAAI,KAAK,oBAAoB,KAAK,kBAAkB;AAClD,iBAAO,KAAK,SAAS;AAAA,YACnB,QAAQ,OAAO,SAAS,KAAK,eAAe,KAAK;AAAA;AAAA;AAGrD,eAAO,WAAW,KAAK,SAAS,EAAE,WAAW;AAAA;AAG/C,6BAAkB,CAAC,SAAS;AAC1B,YAAI;AAAM,eAAK,SAAS,EAAE,WAAW;AACrC,aAAK;AAAA;AAGP,2BAAgB,CAAC,SAAS;AACxB,YAAI;AAAM,eAAK,SAAS,EAAE,SAAS;AACnC,aAAK;AAAA;AAAA;AAAA,IAlCP,oBAAoB;AAClB,aAAO,iBAAiB,UAAU,KAAK;AAAA;AAAA,IAGzC,uBAAuB;AACrB,aAAO,oBAAoB,UAAU,KAAK;AAAA;AAAA,IAoC5C,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