@elliemae/ds-modal-slide 2.2.0 → 2.3.0-alpha.3

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,176 +1,152 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _jsx = require('@babel/runtime/helpers/jsx');
6
- require('core-js/modules/web.dom-collections.iterator.js');
7
- var React = require('react');
8
- var reactDesc = require('react-desc');
9
- var ReactDOM = require('react-dom');
10
- var dsSystem = require('@elliemae/ds-system');
11
- var dsGrid = require('@elliemae/ds-grid');
12
- var DSSeparator = require('@elliemae/ds-separator');
13
- var blocks = require('./components/blocks.js');
14
- var Header = require('./components/Header.js');
15
- var Footer = require('./components/Footer.js');
16
-
17
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
-
19
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
20
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
- var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
22
- var DSSeparator__default = /*#__PURE__*/_interopDefaultLegacy(DSSeparator);
23
-
24
- var _DSSeparator, _DSSeparator2;
25
-
26
- const DSModalSlide = _ref => {
27
- let {
28
- isOpen = false,
29
- children,
30
- getContainer,
31
- centered = false,
32
- fullWidth = false,
33
- header = null,
34
- footer = null,
35
- fadeOut = 1500,
36
- fadeIn = 1500,
37
- overrideHeight = false
38
- } = _ref;
39
- const [isMoving, setMoving] = React.useState(false);
40
- const [show, setShow] = React.useState(isOpen);
41
- const [width, setWidth] = React.useState(50);
42
- const theme = dsSystem.useTheme();
43
- const contentRows = [...(header ? [theme.space.m] : []), '0px', 'auto', '0px', ...(footer ? [theme.space.m] : [])];
44
- const updateShow = React.useCallback(() => {
45
- if (fullWidth) setWidth(100);else setWidth(50);
46
-
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 DSModalSlide_exports = {};
29
+ __export(DSModalSlide_exports, {
30
+ DSModalSlide: () => DSModalSlide,
31
+ DSModalSlideWithSchema: () => DSModalSlideWithSchema,
32
+ ModalFooter: () => import_Footer.default,
33
+ ModalHeader: () => import_Header.default,
34
+ default: () => DSModalSlide_default
35
+ });
36
+ var React = __toESM(require("react"));
37
+ var import_react = __toESM(require("react"));
38
+ var import_react_desc = require("react-desc");
39
+ var import_react_dom = __toESM(require("react-dom"));
40
+ var import_ds_system = require("@elliemae/ds-system");
41
+ var import_ds_grid = require("@elliemae/ds-grid");
42
+ var import_ds_separator = __toESM(require("@elliemae/ds-separator"));
43
+ var import_blocks = require("./components/blocks");
44
+ var import_Header = __toESM(require("./components/Header"));
45
+ var import_Footer = __toESM(require("./components/Footer"));
46
+ const DSModalSlide = ({
47
+ isOpen = false,
48
+ children,
49
+ getContainer,
50
+ centered = false,
51
+ fullWidth = false,
52
+ header = null,
53
+ footer = null,
54
+ fadeOut = 1500,
55
+ fadeIn = 1500,
56
+ overrideHeight = false
57
+ }) => {
58
+ const [isMoving, setMoving] = (0, import_react.useState)(false);
59
+ const [show, setShow] = (0, import_react.useState)(isOpen);
60
+ const [width, setWidth] = (0, import_react.useState)(50);
61
+ const theme = (0, import_ds_system.useTheme)();
62
+ const contentRows = [...header ? [theme.space.m] : [], "0px", "auto", "0px", ...footer ? [theme.space.m] : []];
63
+ const updateShow = (0, import_react.useCallback)(() => {
64
+ if (fullWidth)
65
+ setWidth(100);
66
+ else
67
+ setWidth(50);
47
68
  if (isOpen !== show) {
48
69
  setMoving(true);
49
-
50
70
  if (isOpen) {
51
71
  setShow(isOpen);
52
72
  }
53
73
  }
54
74
  }, [isOpen, fullWidth, isMoving]);
55
- React.useEffect(updateShow, [isOpen, fullWidth]);
56
- if (!show) return null;
75
+ (0, import_react.useEffect)(updateShow, [isOpen, fullWidth]);
76
+ if (!show)
77
+ return null;
57
78
  const container = getContainer();
58
- if (!container) return null;
59
-
79
+ if (!container)
80
+ return null;
60
81
  const handleAnimationEnd = () => {
61
82
  setMoving(false);
62
- if (!isOpen) setShow(isOpen);
83
+ if (!isOpen)
84
+ setShow(isOpen);
63
85
  };
64
-
65
- let {
66
- height
67
- } = container.getBoundingClientRect();
68
-
86
+ let { height } = container.getBoundingClientRect();
69
87
  if (overrideHeight && container.scrollHeight > height) {
70
88
  height = container.scrollHeight;
71
89
  }
72
-
73
90
  if (!container.style.position) {
74
- container.style.position = 'relative';
91
+ container.style.position = "relative";
75
92
  }
76
-
77
- return /*#__PURE__*/ReactDOM__default["default"].createPortal( /*#__PURE__*/_jsx__default["default"](blocks.Wrapper, {
93
+ return import_react_dom.default.createPortal(/* @__PURE__ */ import_react.default.createElement(import_blocks.Wrapper, {
78
94
  classProps: {
79
95
  show: isOpen,
80
96
  centered
81
97
  },
82
98
  style: {
83
- '--height': height,
84
- '--fade-in': fadeIn,
85
- '--fade-out': fadeOut,
86
- '--width': width
99
+ "--height": height,
100
+ "--fade-in": fadeIn,
101
+ "--fade-out": fadeOut,
102
+ "--width": width
87
103
  }
88
- }, void 0, /*#__PURE__*/_jsx__default["default"](blocks.Overlay, {
104
+ }, /* @__PURE__ */ import_react.default.createElement(import_blocks.Overlay, {
89
105
  classProps: {
90
106
  show: isOpen
91
107
  }
92
- }, void 0, /*#__PURE__*/_jsx__default["default"](blocks.Content, {
108
+ }, /* @__PURE__ */ import_react.default.createElement(import_blocks.Content, {
93
109
  onAnimationEnd: handleAnimationEnd,
94
110
  classProps: {
95
111
  show: isOpen
96
112
  }
97
- }, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
113
+ }, /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
98
114
  style: {
99
- height: '100%',
100
- width: '100%',
101
- maxHeight: '100%',
102
- overflow: 'hidden',
103
- '-webkit-backface-visibility': 'hidden',
104
- 'backface-visibility': 'hidden',
105
- '-webkit-transform-style': 'preserve-3d'
115
+ height: "100%",
116
+ width: "100%",
117
+ maxHeight: "100%",
118
+ overflow: "hidden",
119
+ "-webkit-backface-visibility": "hidden",
120
+ "backface-visibility": "hidden",
121
+ "-webkit-transform-style": "preserve-3d"
106
122
  },
107
123
  rows: contentRows,
108
124
  "data-testid": "ds-modal-slide"
109
- }, void 0, header && /*#__PURE__*/React__default["default"].cloneElement(header, {
110
- fullWidth
111
- }), header && (_DSSeparator || (_DSSeparator = /*#__PURE__*/_jsx__default["default"](DSSeparator__default["default"], {
125
+ }, header && import_react.default.cloneElement(header, { fullWidth }), header && /* @__PURE__ */ import_react.default.createElement(import_ds_separator.default, {
112
126
  position: "initial",
113
127
  type: "non-form"
114
- }))), /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
115
- style: {
116
- overflow: 'hidden'
117
- }
118
- }, void 0, /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
119
- style: {
120
- overflow: 'auto'
121
- }
122
- }, void 0, /*#__PURE__*/_jsx__default["default"](blocks.ActualContent, {}, void 0, children))), footer && (_DSSeparator2 || (_DSSeparator2 = /*#__PURE__*/_jsx__default["default"](DSSeparator__default["default"], {
128
+ }), /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
129
+ style: { overflow: "hidden" }
130
+ }, /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
131
+ style: { overflow: "auto" }
132
+ }, /* @__PURE__ */ import_react.default.createElement(import_blocks.ActualContent, null, children))), footer && /* @__PURE__ */ import_react.default.createElement(import_ds_separator.default, {
123
133
  position: "initial",
124
134
  type: "non-form"
125
- }))), footer)))), container);
135
+ }), footer)))), container);
126
136
  };
127
-
128
137
  const props = {
129
- /**
130
- * If the modal slide is centered or not
131
- */
132
- centered: reactDesc.PropTypes.bool.description('If the modal slide is centered or not'),
133
-
134
- /**
135
- * If the modal slide is visible or not
136
- */
137
- isOpen: reactDesc.PropTypes.bool.description('If the modal slide is visible or not'),
138
-
139
- /**
140
- * Main content of the modal
141
- */
142
- children: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.element, reactDesc.PropTypes.string, reactDesc.PropTypes.any]).isRequired.description('Main content of the modal'),
143
-
144
- /**
145
- * If the modal slide takes the full width or not
146
- */
147
- fullWidth: reactDesc.PropTypes.bool.description('If the modal slide takes the full width or not'),
148
-
149
- /**
150
- * If the modal slide has a header, only available for full width option
151
- */
152
- header: reactDesc.PropTypes.element.description('If the modal slide has a header, only available for full width option'),
153
-
154
- /**
155
- * Ratio of fade out
156
- */
157
- fadeOut: reactDesc.PropTypes.number.description('Ratio of fade out'),
158
-
159
- /**
160
- * Ratio of fade in
161
- */
162
- fadeIn: reactDesc.PropTypes.number.description('Ratio of fade in'),
163
-
164
- /**
165
- * Override the panel height to scroll height of the container
166
- */
167
- overrideHeight: reactDesc.PropTypes.bool.description('Override the panel height to scroll height of the container')
138
+ centered: import_react_desc.PropTypes.bool.description("If the modal slide is centered or not"),
139
+ isOpen: import_react_desc.PropTypes.bool.description("If the modal slide is visible or not"),
140
+ children: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.element, import_react_desc.PropTypes.string, import_react_desc.PropTypes.any]).isRequired.description("Main content of the modal"),
141
+ fullWidth: import_react_desc.PropTypes.bool.description("If the modal slide takes the full width or not"),
142
+ header: import_react_desc.PropTypes.element.description("If the modal slide has a header, only available for full width option"),
143
+ fadeOut: import_react_desc.PropTypes.number.description("Ratio of fade out"),
144
+ fadeIn: import_react_desc.PropTypes.number.description("Ratio of fade in"),
145
+ overrideHeight: import_react_desc.PropTypes.bool.description("Override the panel height to scroll height of the container")
168
146
  };
169
- const DSModalSlideWithSchema = reactDesc.describe(DSModalSlide);
147
+ DSModalSlide.propTypes = props;
148
+ const DSModalSlideWithSchema = (0, import_react_desc.describe)(DSModalSlide);
170
149
  DSModalSlideWithSchema.propTypes = props;
171
-
172
- exports.ModalHeader = Header["default"];
173
- exports.ModalFooter = Footer["default"];
174
- exports.DSModalSlide = DSModalSlide;
175
- exports.DSModalSlideWithSchema = DSModalSlideWithSchema;
176
- exports["default"] = DSModalSlide;
150
+ var DSModalSlide_default = DSModalSlide;
151
+ module.exports = __toCommonJS(DSModalSlide_exports);
152
+ //# sourceMappingURL=DSModalSlide.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSModalSlide.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useState, useEffect, useCallback } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport ReactDOM from 'react-dom';\nimport { useTheme } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport DSSeparator from '@elliemae/ds-separator';\nimport { Wrapper, Overlay, Content, ActualContent } from './components/blocks';\nimport ModalHeader from './components/Header';\nimport ModalFooter from './components/Footer';\n\n// eslint-disable-next-line complexity\nconst DSModalSlide = ({\n isOpen = false,\n children,\n getContainer,\n centered = false,\n fullWidth = false,\n header = null,\n footer = null,\n fadeOut = 1500,\n fadeIn = 1500,\n overrideHeight = false,\n}) => {\n const [isMoving, setMoving] = useState(false);\n const [show, setShow] = useState(isOpen);\n const [width, setWidth] = useState(50);\n const theme = useTheme();\n const contentRows = [...(header ? [theme.space.m] : []), '0px', 'auto', '0px', ...(footer ? [theme.space.m] : [])];\n\n const updateShow = useCallback(() => {\n if (fullWidth) setWidth(100);\n else setWidth(50);\n if (isOpen !== show) {\n setMoving(true);\n if (isOpen) {\n setShow(isOpen);\n }\n }\n }, [isOpen, fullWidth, isMoving]);\n\n useEffect(updateShow, [isOpen, fullWidth]);\n\n if (!show) return null;\n\n const container = getContainer();\n if (!container) return null;\n\n const handleAnimationEnd = () => {\n setMoving(false);\n if (!isOpen) setShow(isOpen);\n };\n\n let { height } = container.getBoundingClientRect();\n if (overrideHeight && container.scrollHeight > height) {\n height = container.scrollHeight;\n }\n if (!container.style.position) {\n container.style.position = 'relative';\n }\n\n return ReactDOM.createPortal(\n <Wrapper\n classProps={{\n show: isOpen,\n centered,\n }}\n style={{\n '--height': height,\n '--fade-in': fadeIn,\n '--fade-out': fadeOut,\n '--width': width,\n }}\n >\n <Overlay\n classProps={{\n show: isOpen,\n }}\n >\n <Content\n onAnimationEnd={handleAnimationEnd}\n classProps={{\n show: isOpen,\n }}\n >\n <Grid\n style={{\n height: '100%',\n width: '100%',\n maxHeight: '100%',\n overflow: 'hidden',\n '-webkit-backface-visibility': 'hidden',\n 'backface-visibility': 'hidden',\n '-webkit-transform-style': 'preserve-3d',\n }}\n rows={contentRows}\n data-testid=\"ds-modal-slide\"\n >\n {header && React.cloneElement(header, { fullWidth })}\n {header && <DSSeparator position=\"initial\" type=\"non-form\" />}\n <Grid style={{ overflow: 'hidden' }}>\n <Grid style={{ overflow: 'auto' }}>\n <ActualContent>{children}</ActualContent>\n </Grid>\n </Grid>\n {footer && <DSSeparator position=\"initial\" type=\"non-form\" />}\n {footer}\n </Grid>\n </Content>\n </Overlay>\n </Wrapper>,\n container,\n );\n};\n\nconst props = {\n /**\n * If the modal slide is centered or not\n */\n centered: PropTypes.bool.description('If the modal slide is centered or not'),\n /**\n * If the modal slide is visible or not\n */\n isOpen: PropTypes.bool.description('If the modal slide is visible or not'),\n /**\n * Main content of the modal\n */\n children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.any]).isRequired.description(\n 'Main content of the modal',\n ),\n /**\n * If the modal slide takes the full width or not\n */\n fullWidth: PropTypes.bool.description('If the modal slide takes the full width or not'),\n /**\n * If the modal slide has a header, only available for full width option\n */\n header: PropTypes.element.description('If the modal slide has a header, only available for full width option'),\n /**\n * Ratio of fade out\n */\n fadeOut: PropTypes.number.description('Ratio of fade out'),\n /**\n * Ratio of fade in\n */\n fadeIn: PropTypes.number.description('Ratio of fade in'),\n /**\n * Override the panel height to scroll height of the container\n */\n overrideHeight: PropTypes.bool.description('Override the panel height to scroll height of the container'),\n};\n\nDSModalSlide.propTypes = props;\n\nconst DSModalSlideWithSchema = describe(DSModalSlide);\nDSModalSlideWithSchema.propTypes = props;\n\nexport { ModalHeader, ModalFooter, DSModalSlide, DSModalSlideWithSchema };\n\nexport default DSModalSlide;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -1,101 +1,81 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
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 _jsx = require('@babel/runtime/helpers/jsx');
11
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
12
- require('react');
13
- var reactDesc = require('react-desc');
14
- var DSButton = require('@elliemae/ds-button');
15
- var blocks = require('./blocks.js');
16
- var jsxRuntime = require('react/jsx-runtime');
17
-
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
-
20
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
21
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
22
- var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
23
-
24
- 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; }
25
-
26
- 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; }
27
-
28
- const ModalFooter = _ref => {
29
- let {
30
- confirmLabel = 'Confirm',
31
- rejectLabel = 'Cancel',
32
- onConfirm,
33
- onReject,
34
- confirmProps = {
35
- disabled: false
36
- },
37
- rejectProps = {
38
- disabled: false
39
- }
40
- } = _ref;
41
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
42
- children: /*#__PURE__*/_jsx__default["default"](blocks.FooterWrapper, {}, void 0, !!onReject && /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
43
- buttonType: "secondary",
44
- className: "action-reject",
45
- containerProps: {
46
- 'data-testid': 'modal-footer-reject-btn'
47
- },
48
- labelText: rejectLabel,
49
- onClick: onReject
50
- }, rejectProps)), !!onConfirm && /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread({
51
- buttonType: "primary",
52
- className: "action-confirm",
53
- containerProps: {
54
- 'data-testid': 'modal-footer-confirm-btn'
55
- },
56
- labelText: confirmLabel,
57
- onClick: onConfirm
58
- }, confirmProps)))
59
- });
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 });
60
11
  };
61
-
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 Footer_exports = {};
29
+ __export(Footer_exports, {
30
+ DSModalSlideFooterWithSchema: () => DSModalSlideFooterWithSchema,
31
+ default: () => Footer_default
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_react = __toESM(require("react"));
35
+ var import_react_desc = require("react-desc");
36
+ var import_ds_button = __toESM(require("@elliemae/ds-button"));
37
+ var import_blocks = require("./blocks");
38
+ const ModalFooter = ({
39
+ confirmLabel = "Confirm",
40
+ rejectLabel = "Cancel",
41
+ onConfirm,
42
+ onReject,
43
+ confirmProps = {
44
+ disabled: false
45
+ },
46
+ rejectProps = {
47
+ disabled: false
48
+ }
49
+ }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_blocks.FooterWrapper, null, !!onReject && /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
50
+ buttonType: "secondary",
51
+ className: "action-reject",
52
+ containerProps: { "data-testid": "modal-footer-reject-btn" },
53
+ labelText: rejectLabel,
54
+ onClick: onReject,
55
+ ...rejectProps
56
+ }), !!onConfirm && /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
57
+ buttonType: "primary",
58
+ className: "action-confirm",
59
+ containerProps: { "data-testid": "modal-footer-confirm-btn" },
60
+ labelText: confirmLabel,
61
+ onClick: onConfirm,
62
+ ...confirmProps
63
+ })));
62
64
  const props = {
63
- /**
64
- * Confirm Label
65
- */
66
- confirmLabel: reactDesc.PropTypes.string.description('Confirm Label'),
67
-
68
- /**
69
- * Reject Label
70
- */
71
- rejectLabel: reactDesc.PropTypes.string.description('Reject Label'),
72
-
73
- /**
74
- * Callback
75
- */
76
- onConfirm: reactDesc.PropTypes.func.description('Callback'),
77
-
78
- /**
79
- * Callback
80
- */
81
- onReject: reactDesc.PropTypes.func.description('Callback'),
82
-
83
- /**
84
- * Extra DSButton props for confirm btn.
85
- */
86
- confirmProps: reactDesc.PropTypes.shape({
87
- disabled: reactDesc.PropTypes.bool
88
- }).description('Extra DSButton props for confirm btn.'),
89
-
90
- /**
91
- * Extra DSButton props for reject btn.
92
- */
93
- rejectProps: reactDesc.PropTypes.shape({
94
- disabled: reactDesc.PropTypes.bool
95
- }).description('Extra DSButton props for reject btn.')
65
+ confirmLabel: import_react_desc.PropTypes.string.description("Confirm Label"),
66
+ rejectLabel: import_react_desc.PropTypes.string.description("Reject Label"),
67
+ onConfirm: import_react_desc.PropTypes.func.description("Callback"),
68
+ onReject: import_react_desc.PropTypes.func.description("Callback"),
69
+ confirmProps: import_react_desc.PropTypes.shape({
70
+ disabled: import_react_desc.PropTypes.bool
71
+ }).description("Extra DSButton props for confirm btn."),
72
+ rejectProps: import_react_desc.PropTypes.shape({
73
+ disabled: import_react_desc.PropTypes.bool
74
+ }).description("Extra DSButton props for reject btn.")
96
75
  };
97
- const DSModalSlideFooterWithSchema = reactDesc.describe(ModalFooter);
76
+ ModalFooter.propTypes = props;
77
+ const DSModalSlideFooterWithSchema = (0, import_react_desc.describe)(ModalFooter);
98
78
  DSModalSlideFooterWithSchema.propTypes = props;
99
-
100
- exports.DSModalSlideFooterWithSchema = DSModalSlideFooterWithSchema;
101
- exports["default"] = ModalFooter;
79
+ var Footer_default = ModalFooter;
80
+ module.exports = __toCommonJS(Footer_exports);
81
+ //# sourceMappingURL=Footer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Footer.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport DSButton from '@elliemae/ds-button';\nimport { FooterWrapper } from './blocks';\n\nconst ModalFooter = ({\n confirmLabel = 'Confirm',\n rejectLabel = 'Cancel',\n onConfirm,\n onReject,\n confirmProps = {\n disabled: false,\n },\n rejectProps = {\n disabled: false,\n },\n}) => (\n <>\n <FooterWrapper>\n {!!onReject && (\n <DSButton\n buttonType=\"secondary\"\n className=\"action-reject\"\n containerProps={{ 'data-testid': 'modal-footer-reject-btn' }}\n labelText={rejectLabel}\n onClick={onReject}\n {...rejectProps}\n />\n )}\n {!!onConfirm && (\n <DSButton\n buttonType=\"primary\"\n className=\"action-confirm\"\n containerProps={{ 'data-testid': 'modal-footer-confirm-btn' }}\n labelText={confirmLabel}\n onClick={onConfirm}\n {...confirmProps}\n />\n )}\n </FooterWrapper>\n </>\n);\n\nconst props = {\n /**\n * Confirm Label\n */\n confirmLabel: PropTypes.string.description('Confirm Label'),\n /**\n * Reject Label\n */\n rejectLabel: PropTypes.string.description('Reject Label'),\n /**\n * Callback\n */\n onConfirm: PropTypes.func.description('Callback'),\n /**\n * Callback\n */\n onReject: PropTypes.func.description('Callback'),\n /**\n * Extra DSButton props for confirm btn.\n */\n confirmProps: PropTypes.shape({\n disabled: PropTypes.bool,\n }).description('Extra DSButton props for confirm btn.'),\n /**\n * Extra DSButton props for reject btn.\n */\n rejectProps: PropTypes.shape({\n disabled: PropTypes.bool,\n }).description('Extra DSButton props for reject btn.'),\n};\n\nModalFooter.propTypes = props;\n\nconst DSModalSlideFooterWithSchema = describe(ModalFooter);\nDSModalSlideFooterWithSchema.propTypes = props;\n\nexport { DSModalSlideFooterWithSchema };\n\nexport default ModalFooter;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,uBAAqB;AACrB,oBAA8B;AAE9B,MAAM,cAAc,CAAC;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,eAAe;AAAA,IACb,UAAU;AAAA;AAAA,EAEZ,cAAc;AAAA,IACZ,UAAU;AAAA;AAAA,MAGZ,wFACE,mDAAC,6BAAD,MACG,CAAC,CAAC,YACD,mDAAC,0BAAD;AAAA,EACE,YAAW;AAAA,EACX,WAAU;AAAA,EACV,gBAAgB,EAAE,eAAe;AAAA,EACjC,WAAW;AAAA,EACX,SAAS;AAAA,KACL;AAAA,IAGP,CAAC,CAAC,aACD,mDAAC,0BAAD;AAAA,EACE,YAAW;AAAA,EACX,WAAU;AAAA,EACV,gBAAgB,EAAE,eAAe;AAAA,EACjC,WAAW;AAAA,EACX,SAAS;AAAA,KACL;AAAA;AAOd,MAAM,QAAQ;AAAA,EAIZ,cAAc,4BAAU,OAAO,YAAY;AAAA,EAI3C,aAAa,4BAAU,OAAO,YAAY;AAAA,EAI1C,WAAW,4BAAU,KAAK,YAAY;AAAA,EAItC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAIrC,cAAc,4BAAU,MAAM;AAAA,IAC5B,UAAU,4BAAU;AAAA,KACnB,YAAY;AAAA,EAIf,aAAa,4BAAU,MAAM;AAAA,IAC3B,UAAU,4BAAU;AAAA,KACnB,YAAY;AAAA;AAGjB,YAAY,YAAY;AAExB,MAAM,+BAA+B,gCAAS;AAC9C,6BAA6B,YAAY;AAIzC,IAAO,iBAAQ;",
6
+ "names": []
7
+ }