@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,149 +1,113 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- require('core-js/modules/web.dom-collections.iterator.js');
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var react = require('react');
11
- var constants = require('../constants.js');
12
-
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
16
-
17
- 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; }
18
-
19
- 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__default["default"](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; }
20
- var DSModalWrapper = (WrappedComponent => {
21
- class DSModalWrapper extends react.Component {
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var DSModalWrapper_exports = {};
29
+ __export(DSModalWrapper_exports, {
30
+ default: () => DSModalWrapper_default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = require("react");
34
+ var import_constants = require("../constants");
35
+ var DSModalWrapper_default = (WrappedComponent) => {
36
+ class DSModalWrapper extends import_react.Component {
22
37
  constructor() {
23
38
  super(...arguments);
24
39
  this.state = {
25
40
  childready: false,
26
- additionalFooterCssClass: 'loading',
41
+ additionalFooterCssClass: "loading",
27
42
  container: null,
28
43
  actions: null,
29
- height: '100%'
44
+ height: "100%"
30
45
  };
31
-
32
- this.onHeaderHeight = e => {
46
+ this.onHeaderHeight = (e) => {
33
47
  this.heightHeaderFlag = true;
34
48
  this.heightHeader = e.height || 0;
35
49
  };
36
-
37
- this.onFooterHeight = e => {
50
+ this.onFooterHeight = (e) => {
38
51
  this.heightFooterFlag = true;
39
52
  this.heightFooter = e.height || 0;
40
53
  };
41
-
42
- this.onResize = _ref => {
43
- let {
44
- bounds
45
- } = _ref;
46
-
54
+ this.onResize = ({ bounds }) => {
47
55
  if (this.heightFooterFlag && this.heightHeaderFlag) {
48
56
  return this.setState({
49
57
  height: bounds.height - this.heightFooter - this.heightHeader
50
58
  });
51
59
  }
52
-
53
- return setTimeout(this.onResize({
54
- bounds
55
- }), 0);
60
+ return setTimeout(this.onResize({ bounds }), 0);
56
61
  };
57
-
58
- this.handleContainer = node => {
59
- if (node) this.setState({
60
- container: node
61
- });
62
+ this.handleContainer = (node) => {
63
+ if (node)
64
+ this.setState({ container: node });
62
65
  this.handleResize();
63
66
  };
64
-
65
- this.handleActions = node => {
66
- if (node) this.setState({
67
- actions: node
68
- });
67
+ this.handleActions = (node) => {
68
+ if (node)
69
+ this.setState({ actions: node });
69
70
  this.handleResize();
70
71
  };
71
72
  }
72
-
73
73
  componentDidMount() {
74
- window.addEventListener('resize', this.handleResize);
74
+ window.addEventListener("resize", this.handleResize);
75
75
  }
76
-
77
76
  componentWillUnmount() {
78
- window.removeEventListener('resize', this.handleResize);
77
+ window.removeEventListener("resize", this.handleResize);
79
78
  }
80
-
81
- /**
82
- * Change button width to 100% if the
83
- * combined width of the button (or button group) exceed 50% of the container width.
84
- */
85
79
  handleResize() {
86
- if (!this.state) return null;
87
- const {
88
- container,
89
- actions,
90
- childready
91
- } = this.state;
92
- if (!childready) return null;
93
- this.setState({
94
- additionalFooterCssClass: null
95
- }); // !important reset to default state to recalculate
96
-
97
- const {
98
- clientWidth: containerWidth
99
- } = container;
100
- const {
101
- clientWidth: actionsWidth
102
- } = actions; // Change button width to 100% if the combined width of the button (or button group) exceed 50% of the container width.
103
-
80
+ if (!this.state)
81
+ return null;
82
+ const { container, actions, childready } = this.state;
83
+ if (!childready)
84
+ return null;
85
+ this.setState({ additionalFooterCssClass: null });
86
+ const { clientWidth: containerWidth } = container;
87
+ const { clientWidth: actionsWidth } = actions;
104
88
  if (containerWidth && actionsWidth && actionsWidth / containerWidth * 100 > 50) {
105
- return this.setState({
106
- additionalFooterCssClass: 'fluid-actions'
107
- });
89
+ return this.setState({ additionalFooterCssClass: "fluid-actions" });
108
90
  }
109
-
110
- return this.setState({
111
- additionalFooterCssClass: null
112
- });
91
+ return this.setState({ additionalFooterCssClass: null });
113
92
  }
114
-
115
93
  verifyNodes() {
116
- const {
117
- modalType
118
- } = this.props;
119
-
120
- if (modalType !== constants.MODAL_TYPE.DEFAULT) {
94
+ const { modalType } = this.props;
95
+ if (modalType !== import_constants.MODAL_TYPE.DEFAULT) {
121
96
  const nodesInterval = setInterval(() => {
122
- // !important it checks when nodes are availables
123
- const {
124
- container,
125
- actions
126
- } = this.state;
127
- if (!container || !actions) return null;
97
+ const { container, actions } = this.state;
98
+ if (!container || !actions)
99
+ return null;
128
100
  clearInterval(nodesInterval);
129
- this.setState({
130
- childready: true
131
- });
101
+ this.setState({ childready: true });
132
102
  return this.handleResize();
133
103
  }, 100);
134
104
  }
135
105
  }
136
-
137
106
  render() {
138
- const {
139
- props,
140
- state
141
- } = this;
142
- const {
143
- additionalFooterCssClass,
144
- height
145
- } = state;
146
- return /*#__PURE__*/react.createElement(WrappedComponent, _objectSpread(_objectSpread({}, props), {}, {
107
+ const { props, state } = this;
108
+ const { additionalFooterCssClass, height } = state;
109
+ return (0, import_react.createElement)(WrappedComponent, {
110
+ ...props,
147
111
  height,
148
112
  onResize: this.onResize,
149
113
  onFooterHeight: this.onFooterHeight,
@@ -152,15 +116,14 @@ var DSModalWrapper = (WrappedComponent => {
152
116
  actionsRef: this.handleActions,
153
117
  additionalFooterCssClass,
154
118
  onAfterOpen: () => {
155
- if (props.onAfterOpen) props.onAfterOpen();
119
+ if (props.onAfterOpen)
120
+ props.onAfterOpen();
156
121
  this.verifyNodes();
157
122
  }
158
- }));
123
+ });
159
124
  }
160
-
161
125
  }
162
-
163
126
  return DSModalWrapper;
164
- });
165
-
166
- module.exports = DSModalWrapper;
127
+ };
128
+ module.exports = __toCommonJS(DSModalWrapper_exports);
129
+ //# sourceMappingURL=DSModalWrapper.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/v1/DSModalWrapper.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyC;AACzC,uBAA2B;AAE3B,IAAO,yBAAQ,CAAC,qBAAqB;AACnC,+BAA6B,uBAAU;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,eAAe;AACb,UAAI,CAAC,KAAK;AAAO,eAAO;AACxB,YAAM,EAAE,WAAW,SAAS,eAAe,KAAK;AAChD,UAAI,CAAC;AAAY,eAAO;AACxB,WAAK,SAAS,EAAE,0BAA0B;AAC1C,YAAM,EAAE,aAAa,mBAAmB;AACxC,YAAM,EAAE,aAAa,iBAAiB;AAEtC,UACE,kBACA,gBACC,eAAe,iBAAkB,MAAM,IACxC;AACA,eAAO,KAAK,SAAS,EAAE,0BAA0B;AAAA;AAEnD,aAAO,KAAK,SAAS,EAAE,0BAA0B;AAAA;AAAA,IAGnD,cAAc;AACZ,YAAM,EAAE,cAAc,KAAK;AAC3B,UAAI,cAAc,4BAAW,SAAS;AACpC,cAAM,gBAAgB,YAAY,MAAM;AAEtC,gBAAM,EAAE,WAAW,YAAY,KAAK;AACpC,cAAI,CAAC,aAAa,CAAC;AAAS,mBAAO;AACnC,wBAAc;AACd,eAAK,SAAS,EAAE,YAAY;AAC5B,iBAAO,KAAK;AAAA,WACX;AAAA;AAAA;AAAA,IAIP,SAAS;AACP,YAAM,EAAE,OAAO,UAAU;AACzB,YAAM,EAAE,0BAA0B,WAAW;AAC7C,aAAO,gCAAc,kBAAkB;AAAA,WAClC;AAAA,QACH;AAAA,QACA,UAAU,KAAK;AAAA,QACf,gBAAgB,KAAK;AAAA,QACrB,gBAAgB,KAAK;AAAA,QACrB,cAAc,KAAK;AAAA,QACnB,YAAY,KAAK;AAAA,QACjB;AAAA,QACA,aAAa,MAAM;AACjB,cAAI,MAAM;AAAa,kBAAM;AAC7B,eAAK;AAAA;AAAA;AAAA;AAAA;AAMb,SAAO;AAAA;",
6
+ "names": []
7
+ }
@@ -1,82 +1,90 @@
1
- 'use strict';
2
-
3
- var _jsx = require('@babel/runtime/helpers/jsx');
4
- require('react');
5
- var dsIcons = require('@elliemae/ds-icons');
6
- var dsClassnames = require('@elliemae/ds-classnames');
7
- var constants = require('../../constants.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
- var _WarningCircle, _CheckmarkCircle, _HelpCircle, _InfoCircle, _InfoCircle2;
14
- const feedbackIconSize = 'xxl';
15
- const {
16
- WARNING,
17
- ERROR,
18
- SUCCESS,
19
- HELP,
20
- INFO
21
- } = constants.MODAL_TYPE;
22
-
23
- const getModalType = (modalType, _ref) => {
24
- let {
25
- hasError,
26
- hasWarning,
27
- hasSuccess,
28
- hasInfo,
29
- hasHelp
30
- } = _ref;
31
- if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1) return modalType;
32
- if (hasError) return ERROR;
33
- if (hasWarning) return WARNING;
34
- if (hasSuccess) return SUCCESS;
35
- if (hasHelp) return HELP;
36
- if (hasInfo) return INFO;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var ModalFeedBack_exports = {};
29
+ __export(ModalFeedBack_exports, {
30
+ default: () => ModalFeedBack_default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react = __toESM(require("react"));
34
+ var import_ds_icons = require("@elliemae/ds-icons");
35
+ var import_ds_classnames = require("@elliemae/ds-classnames");
36
+ var import_constants = require("../../constants");
37
+ const feedbackIconSize = "xxl";
38
+ const { WARNING, ERROR, SUCCESS, HELP, INFO } = import_constants.MODAL_TYPE;
39
+ const getModalType = (modalType, { hasError, hasWarning, hasSuccess, hasInfo, hasHelp }) => {
40
+ if ([WARNING, ERROR, SUCCESS, HELP, INFO].indexOf(modalType) > -1)
41
+ return modalType;
42
+ if (hasError)
43
+ return ERROR;
44
+ if (hasWarning)
45
+ return WARNING;
46
+ if (hasSuccess)
47
+ return SUCCESS;
48
+ if (hasHelp)
49
+ return HELP;
50
+ if (hasInfo)
51
+ return INFO;
37
52
  return INFO;
38
53
  };
39
-
40
- const getIconType = modalType => {
54
+ const getIconType = (modalType) => {
41
55
  switch (modalType) {
42
56
  case WARNING:
43
57
  case ERROR:
44
- return _WarningCircle || (_WarningCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.WarningCircle, {
58
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.WarningCircle, {
45
59
  size: feedbackIconSize
46
- }));
47
-
60
+ });
48
61
  case SUCCESS:
49
- return _CheckmarkCircle || (_CheckmarkCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.CheckmarkCircle, {
62
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.CheckmarkCircle, {
50
63
  size: feedbackIconSize
51
- }));
52
-
64
+ });
53
65
  case HELP:
54
- return _HelpCircle || (_HelpCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.HelpCircle, {
66
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.HelpCircle, {
55
67
  size: feedbackIconSize
56
- }));
57
-
68
+ });
58
69
  case INFO:
59
- return _InfoCircle || (_InfoCircle = /*#__PURE__*/_jsx__default["default"](dsIcons.InfoCircle, {
70
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.InfoCircle, {
60
71
  size: feedbackIconSize
61
- }));
62
-
72
+ });
63
73
  default:
64
- return _InfoCircle2 || (_InfoCircle2 = /*#__PURE__*/_jsx__default["default"](dsIcons.InfoCircle, {
74
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_icons.InfoCircle, {
65
75
  size: feedbackIconSize
66
- }));
76
+ });
67
77
  }
68
78
  };
69
-
70
- const ModalFeedBack = _ref2 => {
71
- let {
72
- className = '',
73
- modalType = null,
74
- hasError = false,
75
- hasWarning = false,
76
- hasSuccess = false,
77
- hasInfo = false,
78
- hasHelp = false
79
- } = _ref2;
79
+ const ModalFeedBack = ({
80
+ className = "",
81
+ modalType = null,
82
+ hasError = false,
83
+ hasWarning = false,
84
+ hasSuccess = false,
85
+ hasInfo = false,
86
+ hasHelp = false
87
+ }) => {
80
88
  const type = getModalType(modalType, {
81
89
  hasError,
82
90
  hasWarning,
@@ -84,15 +92,12 @@ const ModalFeedBack = _ref2 => {
84
92
  hasInfo,
85
93
  hasHelp
86
94
  });
87
- const {
88
- cssClassName
89
- } = dsClassnames.convertPropToCssClassName('modal-feedback', className, {
90
- modalType: type
91
- });
95
+ const { cssClassName } = (0, import_ds_classnames.convertPropToCssClassName)("modal-feedback", className, { modalType: type });
92
96
  const feedbackIcon = getIconType(type);
93
- return /*#__PURE__*/_jsx__default["default"]("div", {
97
+ return /* @__PURE__ */ import_react.default.createElement("div", {
94
98
  className: cssClassName
95
- }, void 0, feedbackIcon);
99
+ }, feedbackIcon);
96
100
  };
97
-
98
- module.exports = ModalFeedBack;
101
+ var ModalFeedBack_default = ModalFeedBack;
102
+ module.exports = __toCommonJS(ModalFeedBack_exports);
103
+ //# sourceMappingURL=ModalFeedBack.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/v1/ModalFeedBack/ModalFeedBack.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,sBAAuE;AACvE,2BAA0C;AAC1C,uBAA2B;AAE3B,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,mDAAC,+BAAD;AAAA,QAAe,MAAM;AAAA;AAAA,SACzB;AACH,aAAO,mDAAC,iCAAD;AAAA,QAAiB,MAAM;AAAA;AAAA,SAC3B;AACH,aAAO,mDAAC,4BAAD;AAAA,QAAY,MAAM;AAAA;AAAA,SACtB;AACH,aAAO,mDAAC,4BAAD;AAAA,QAAY,MAAM;AAAA;AAAA;AAEzB,aAAO,mDAAC,4BAAD;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,oDAA0B,kBAAkB,WAAW,EAAE,WAAW;AAC7F,QAAM,eAAe,YAAY;AAEjC,SAAO,mDAAC,OAAD;AAAA,IAAK,WAAW;AAAA,KAAe;AAAA;AAGxC,IAAO,wBAAQ;",
6
+ "names": []
7
+ }