@elliemae/ds-modal 2.0.0-alpha.11 → 2.0.0-alpha.12

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.
@@ -1,34 +1,37 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import 'react';
3
- import CloseIcon from '@elliemae/ds-icons/Close';
4
- import DSButton from '@elliemae/ds-basic/Button';
3
+ import { Close } from '@elliemae/ds-icons';
4
+ import DSButton from '@elliemae/ds-button';
5
5
  import { ModalHeader, ModalHeaderTopRight } from '../blocks.js';
6
6
  import { Title } from './Title.js';
7
7
 
8
- var _CloseIcon;
9
- const FormHeader = ({
10
- showClose,
11
- modalTitle,
12
- modalType,
13
- onClose
14
- }) => /*#__PURE__*/_jsx(ModalHeader, {
15
- classProps: {
16
- type: 'selection'
17
- }
18
- }, void 0, /*#__PURE__*/_jsx(Title, {
19
- modalTitle: modalTitle,
20
- modalType: modalType
21
- }), /*#__PURE__*/_jsx(ModalHeaderTopRight, {
22
- classProps: {
23
- type: 'form'
24
- }
25
- }, void 0, showClose && /*#__PURE__*/_jsx(DSButton, {
26
- buttonType: "link",
27
- containerProps: {
28
- 'data-testid': 'modal-close-btn'
29
- },
30
- icon: _CloseIcon || (_CloseIcon = /*#__PURE__*/_jsx(CloseIcon, {})),
31
- onClick: onClose
32
- })));
8
+ var _Close;
9
+ const FormHeader = _ref => {
10
+ let {
11
+ showClose,
12
+ modalTitle,
13
+ modalType,
14
+ onClose
15
+ } = _ref;
16
+ return /*#__PURE__*/_jsx(ModalHeader, {
17
+ classProps: {
18
+ type: 'selection'
19
+ }
20
+ }, void 0, /*#__PURE__*/_jsx(Title, {
21
+ modalTitle: modalTitle,
22
+ modalType: modalType
23
+ }), /*#__PURE__*/_jsx(ModalHeaderTopRight, {
24
+ classProps: {
25
+ type: 'form'
26
+ }
27
+ }, void 0, showClose && /*#__PURE__*/_jsx(DSButton, {
28
+ buttonType: "link",
29
+ containerProps: {
30
+ 'data-testid': 'modal-close-btn'
31
+ },
32
+ icon: _Close || (_Close = /*#__PURE__*/_jsx(Close, {})),
33
+ onClick: onClose
34
+ })));
35
+ };
33
36
 
34
37
  export { FormHeader, FormHeader as default };
@@ -1,3 +1,8 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
3
8
  import 'react';
@@ -15,81 +20,84 @@ import { jsxs } from 'react/jsx-runtime';
15
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
16
21
 
17
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
- const DSModalContent = ({
19
- containerProps = {},
20
- //
21
- modalType = MODAL_TYPE_V2.INFORMATION,
22
- modalSubType = null,
23
- modalTitle = '',
24
- showRejectButton = false,
25
- showClose = true,
26
- searchProps = {},
27
- // override
28
- actionsRef = () => null,
29
- additionalFooterCssClass,
30
- overridePropsConfirmButton = {},
31
- overridePropsRejectButton = {},
32
- // react modal
33
- children,
34
- onClose = () => null,
35
- onConfirm = () => null,
36
- onReject = () => null,
37
- rejectLabel = 'Discard',
38
- confirmLabel = 'Save',
39
- removePadding = false
40
- }) => /*#__PURE__*/jsxs(ModalWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
41
- children: [showForm({
42
- modalType,
43
- modalSubType
44
- }) && /*#__PURE__*/_jsx(FormHeader, {
45
- modalTitle: modalTitle,
46
- modalType: modalType,
47
- onClose: onClose,
48
- showClose: showClose
49
- }), showSelection({
50
- modalType,
51
- modalSubType
52
- }) && /*#__PURE__*/_jsx(SelectionHeader, {
53
- modalTitle: modalTitle,
54
- modalType: modalType,
55
- searchProps: searchProps,
56
- showClose: showClose
57
- }), showDecision({
58
- modalType,
59
- modalSubType
60
- }) && /*#__PURE__*/_jsx(DecisionHeader, {
61
- onClose: onClose,
62
- showClose: showClose
63
- }), showFeedBack({
64
- modalType,
65
- modalSubType
66
- }) && /*#__PURE__*/_jsx(FeedbackIcon, {
67
- modalSubType: modalSubType
68
- }), showDecision({
69
- modalType,
70
- modalSubType
71
- }) && /*#__PURE__*/_jsx(Title, {
72
- modalTitle: modalTitle,
73
- modalType: modalType
74
- }), /*#__PURE__*/_jsx(ModalContent, {
75
- classProps: {
76
- type: modalType,
77
- removePadding
78
- }
79
- }, void 0, children), showFooter({
80
- modalType,
81
- modalSubType
82
- }) && /*#__PURE__*/_jsx(Footer, {
83
- actionsRef: actionsRef,
84
- additionalFooterCssClass: additionalFooterCssClass,
85
- confirmLabel: confirmLabel,
86
- onConfirm: onConfirm,
87
- onReject: onReject,
88
- overridePropsConfirmButton: overridePropsConfirmButton,
89
- overridePropsRejectButton: overridePropsRejectButton,
90
- rejectLabel: rejectLabel,
91
- showRejectButton: showRejectButton
92
- })]
93
- }));
23
+ const DSModalContent = _ref => {
24
+ let {
25
+ containerProps = {},
26
+ //
27
+ modalType = MODAL_TYPE_V2.INFORMATION,
28
+ modalSubType = null,
29
+ modalTitle = '',
30
+ showRejectButton = false,
31
+ showClose = true,
32
+ searchProps = {},
33
+ // override
34
+ actionsRef = () => null,
35
+ additionalFooterCssClass,
36
+ overridePropsConfirmButton = {},
37
+ overridePropsRejectButton = {},
38
+ // react modal
39
+ children,
40
+ onClose = () => null,
41
+ onConfirm = () => null,
42
+ onReject = () => null,
43
+ rejectLabel = 'Discard',
44
+ confirmLabel = 'Save',
45
+ removePadding = false
46
+ } = _ref;
47
+ return /*#__PURE__*/jsxs(ModalWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
48
+ children: [showForm({
49
+ modalType,
50
+ modalSubType
51
+ }) && /*#__PURE__*/_jsx(FormHeader, {
52
+ modalTitle: modalTitle,
53
+ modalType: modalType,
54
+ onClose: onClose,
55
+ showClose: showClose
56
+ }), showSelection({
57
+ modalType,
58
+ modalSubType
59
+ }) && /*#__PURE__*/_jsx(SelectionHeader, {
60
+ modalTitle: modalTitle,
61
+ modalType: modalType,
62
+ searchProps: searchProps,
63
+ showClose: showClose
64
+ }), showDecision({
65
+ modalType,
66
+ modalSubType
67
+ }) && /*#__PURE__*/_jsx(DecisionHeader, {
68
+ onClose: onClose,
69
+ showClose: showClose
70
+ }), showFeedBack({
71
+ modalType,
72
+ modalSubType
73
+ }) && /*#__PURE__*/_jsx(FeedbackIcon, {
74
+ modalSubType: modalSubType
75
+ }), showDecision({
76
+ modalType,
77
+ modalSubType
78
+ }) && /*#__PURE__*/_jsx(Title, {
79
+ modalTitle: modalTitle,
80
+ modalType: modalType
81
+ }), /*#__PURE__*/_jsx(ModalContent, {
82
+ classProps: {
83
+ type: modalType,
84
+ removePadding
85
+ }
86
+ }, void 0, children), showFooter({
87
+ modalType,
88
+ modalSubType
89
+ }) && /*#__PURE__*/_jsx(Footer, {
90
+ actionsRef: actionsRef,
91
+ additionalFooterCssClass: additionalFooterCssClass,
92
+ confirmLabel: confirmLabel,
93
+ onConfirm: onConfirm,
94
+ onReject: onReject,
95
+ overridePropsConfirmButton: overridePropsConfirmButton,
96
+ overridePropsRejectButton: overridePropsRejectButton,
97
+ rejectLabel: rejectLabel,
98
+ showRejectButton: showRejectButton
99
+ })]
100
+ }));
101
+ };
94
102
 
95
103
  export { DSModalContent };
@@ -1,7 +1,12 @@
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';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
3
8
  import 'react';
4
- import DSSearchBox from '@elliemae/ds-basic/form/SearchBox';
9
+ import { DSSearchBox } from '@elliemae/ds-form';
5
10
  import { ModalHeader, ModalHeaderTopRight } from '../blocks.js';
6
11
  import { Title } from './Title.js';
7
12
  import { jsx } from 'react/jsx-runtime';
@@ -9,23 +14,26 @@ import { jsx } from 'react/jsx-runtime';
9
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
10
15
 
11
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12
- const SelectionHeader = ({
13
- searchProps = {},
14
- modalTitle,
15
- modalType,
16
- showClose
17
- }) => /*#__PURE__*/_jsx(ModalHeader, {
18
- classProps: {
19
- type: 'selection'
20
- }
21
- }, void 0, /*#__PURE__*/_jsx(Title, {
22
- modalTitle: modalTitle,
23
- modalType: modalType
24
- }), showClose && /*#__PURE__*/_jsx(ModalHeaderTopRight, {
25
- classProps: {
26
- type: 'selection'
27
- },
28
- "data-testid": "modal-search-box"
29
- }, void 0, /*#__PURE__*/jsx(DSSearchBox, _objectSpread({}, searchProps))));
17
+ const SelectionHeader = _ref => {
18
+ let {
19
+ searchProps = {},
20
+ modalTitle,
21
+ modalType,
22
+ showClose
23
+ } = _ref;
24
+ return /*#__PURE__*/_jsx(ModalHeader, {
25
+ classProps: {
26
+ type: 'selection'
27
+ }
28
+ }, void 0, /*#__PURE__*/_jsx(Title, {
29
+ modalTitle: modalTitle,
30
+ modalType: modalType
31
+ }), showClose && /*#__PURE__*/_jsx(ModalHeaderTopRight, {
32
+ classProps: {
33
+ type: 'selection'
34
+ },
35
+ "data-testid": "modal-search-box"
36
+ }, void 0, /*#__PURE__*/jsx(DSSearchBox, _objectSpread({}, searchProps))));
37
+ };
30
38
 
31
39
  export { SelectionHeader, SelectionHeader as default };
@@ -2,13 +2,16 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import 'react';
3
3
  import { ModalTitle } from '../blocks.js';
4
4
 
5
- const Title = ({
6
- modalTitle,
7
- modalType
8
- }) => /*#__PURE__*/_jsx(ModalTitle, {
9
- classProps: {
10
- type: modalType
11
- }
12
- }, void 0, modalTitle);
5
+ const Title = _ref => {
6
+ let {
7
+ modalTitle,
8
+ modalType
9
+ } = _ref;
10
+ return /*#__PURE__*/_jsx(ModalTitle, {
11
+ classProps: {
12
+ type: modalType
13
+ }
14
+ }, void 0, modalTitle);
15
+ };
13
16
 
14
17
  export { Title, Title as default };
package/esm/v2/helpers.js CHANGED
@@ -1,31 +1,36 @@
1
1
  import { MODAL_TYPE_V2, MODAL_SUB_TYPE_V2 } from '../constants.js';
2
2
 
3
- function showDecision({
4
- modalType
5
- }) {
3
+ function showDecision(_ref) {
4
+ let {
5
+ modalType
6
+ } = _ref;
6
7
  return [MODAL_TYPE_V2.INFORMATION, MODAL_TYPE_V2.DECISION].indexOf(modalType) > -1;
7
8
  }
8
- function showFeedBack({
9
- modalType,
10
- modalSubType
11
- }) {
9
+ function showFeedBack(_ref2) {
10
+ let {
11
+ modalType,
12
+ modalSubType
13
+ } = _ref2;
12
14
  return showDecision({
13
15
  modalType
14
16
  }) && Object.values(MODAL_SUB_TYPE_V2).indexOf(modalSubType) > -1;
15
17
  }
16
- function showFooter({
17
- modalType
18
- }) {
18
+ function showFooter(_ref3) {
19
+ let {
20
+ modalType
21
+ } = _ref3;
19
22
  return modalType !== MODAL_TYPE_V2.INFORMATION;
20
23
  }
21
- function showSelection({
22
- modalType
23
- }) {
24
+ function showSelection(_ref4) {
25
+ let {
26
+ modalType
27
+ } = _ref4;
24
28
  return modalType === MODAL_TYPE_V2.SELECTION;
25
29
  }
26
- function showForm({
27
- modalType
28
- }) {
30
+ function showForm(_ref5) {
31
+ let {
32
+ modalType
33
+ } = _ref5;
29
34
  return modalType === MODAL_TYPE_V2.FORM;
30
35
  }
31
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-modal",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.12",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Modal",
6
6
  "module": "./esm/index.js",
@@ -96,12 +96,21 @@
96
96
  "build": "node ../../scripts/build/build.js"
97
97
  },
98
98
  "dependencies": {
99
- "@elliemae/ds-basic": "2.0.0-alpha.11",
100
- "@elliemae/ds-classnames": "2.0.0-alpha.11",
99
+ "@elliemae/ds-button": "2.0.0-alpha.12",
100
+ "@elliemae/ds-classnames": "2.0.0-alpha.12",
101
+ "@elliemae/ds-form": "2.0.0-alpha.12",
102
+ "@elliemae/ds-icon": "2.0.0-alpha.12",
103
+ "@elliemae/ds-icons": "2.0.0-alpha.12",
104
+ "@elliemae/ds-shared": "2.0.0-alpha.12",
105
+ "@elliemae/ds-system": "2.0.0-alpha.12",
101
106
  "prop-types": "~15.7.2",
102
- "react-measure": "~2.5.2",
107
+ "react-desc": "~4.1.3",
103
108
  "react-modal": "~3.12.1"
104
109
  },
110
+ "devDependencies": {
111
+ "@testing-library/jest-dom": "~5.15.0",
112
+ "@testing-library/react": "~12.1.2"
113
+ },
105
114
  "peerDependencies": {
106
115
  "lodash": "^4.17.21",
107
116
  "react": "~17.0.2",
@@ -7,7 +7,7 @@ declare const DSModal: {
7
7
  dataTestId?: string | undefined;
8
8
  additionalFooterCssClass?: string | undefined;
9
9
  style?: {} | undefined;
10
- iconCloseSize?: any;
10
+ iconCloseSize?: string | undefined;
11
11
  modalType?: string | undefined;
12
12
  showHeader?: boolean | undefined;
13
13
  showFooter?: boolean | undefined;