@elliemae/ds-dialog 1.60.0 → 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.
- package/cjs/DSDialog.js +47 -33
- package/cjs/DSDialogDatatestid.js +10 -0
- package/cjs/DSDialogInternalTypes.d.js +2 -0
- package/cjs/DSDialogTypes.js +2 -0
- package/cjs/defaultProps.js +8 -4
- package/cjs/index.js +4 -15
- package/cjs/propTypes.js +4 -3
- package/cjs/styles.js +78 -55
- package/cjs/utils.js +27 -13
- package/esm/DSDialog.js +45 -31
- package/esm/DSDialogDatatestid.js +6 -0
- package/esm/DSDialogInternalTypes.d.js +1 -0
- package/esm/DSDialogTypes.js +1 -0
- package/esm/defaultProps.js +8 -4
- package/esm/index.js +2 -15
- package/esm/propTypes.js +4 -3
- package/esm/styles.js +77 -54
- package/esm/utils.js +25 -10
- package/package.json +61 -11
- package/types/DSDialog.d.ts +30 -0
- package/types/DSDialogDatatestid.d.ts +4 -0
- package/types/DSDialogTypes.d.ts +10 -0
- package/types/defaultProps.d.ts +2 -0
- package/types/index.d.ts +4 -0
- package/types/propTypes.d.ts +19 -0
- package/types/styles.d.ts +15 -0
- package/types/utils.d.ts +19 -0
- package/DSDialog/package.json +0 -10
- package/cjs/DSDialog.js.map +0 -1
- package/cjs/defaultProps.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/propTypes.js.map +0 -1
- package/cjs/styles.js.map +0 -1
- package/cjs/types/index.d.js +0 -3
- package/cjs/types/index.d.js.map +0 -1
- package/cjs/utils.js.map +0 -1
- package/defaultProps/package.json +0 -10
- package/esm/DSDialog.js.map +0 -1
- package/esm/defaultProps.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/propTypes.js.map +0 -1
- package/esm/styles.js.map +0 -1
- package/esm/types/index.d.js +0 -2
- package/esm/types/index.d.js.map +0 -1
- package/esm/utils.js.map +0 -1
- package/propTypes/package.json +0 -10
- package/styles/package.json +0 -10
- package/types/package.json +0 -10
- package/utils/package.json +0 -10
package/cjs/DSDialog.js
CHANGED
|
@@ -2,79 +2,93 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
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 _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
12
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
13
|
var ReactDOM = require('react-dom');
|
|
8
|
-
var
|
|
14
|
+
var react = require('react');
|
|
9
15
|
var reactDesc = require('react-desc');
|
|
10
16
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
11
17
|
var styles = require('./styles.js');
|
|
12
18
|
var propTypes = require('./propTypes.js');
|
|
13
19
|
var defaultProps = require('./defaultProps.js');
|
|
14
20
|
var utils = require('./utils.js');
|
|
15
|
-
require('
|
|
16
|
-
require('
|
|
17
|
-
require('@elliemae/ds-system');
|
|
18
|
-
require('styled-system');
|
|
19
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
21
|
+
var DSDialogDatatestid = require('./DSDialogDatatestid.js');
|
|
22
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
20
23
|
|
|
21
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
25
|
|
|
23
|
-
var
|
|
26
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
24
28
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
25
29
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
26
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
30
|
|
|
28
|
-
var
|
|
31
|
+
var _FixedBody;
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
var propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultProps.defaultProps);
|
|
32
|
-
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, DSDialogWithSchema.toTypescript());
|
|
33
|
+
const _excluded = ["children", "isOpen", "onClickOutside", "centered", "size", "removeAutoFocus", "zIndex"];
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
isOpen = propsWithDefault.isOpen,
|
|
36
|
-
onClickOutside = propsWithDefault.onClickOutside,
|
|
37
|
-
centered = propsWithDefault.centered,
|
|
38
|
-
size = propsWithDefault.size,
|
|
39
|
-
removeAutoFocus = propsWithDefault.removeAutoFocus,
|
|
40
|
-
rest = _objectWithoutProperties__default['default'](propsWithDefault, _excluded);
|
|
35
|
+
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; }
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
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__default["default"](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; }
|
|
38
|
+
|
|
39
|
+
const DSDialog = props => {
|
|
40
|
+
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultProps.defaultProps);
|
|
41
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, propTypes.propTypes);
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
children,
|
|
45
|
+
isOpen,
|
|
46
|
+
onClickOutside,
|
|
47
|
+
centered,
|
|
48
|
+
size,
|
|
49
|
+
removeAutoFocus,
|
|
50
|
+
zIndex
|
|
51
|
+
} = propsWithDefault,
|
|
52
|
+
rest = _objectWithoutProperties__default["default"](propsWithDefault, _excluded);
|
|
53
|
+
|
|
54
|
+
const containerRef = react.useRef(null);
|
|
55
|
+
const handleOutsideClick = react.useCallback(e => {
|
|
44
56
|
if (e.target.dataset.portalbg) onClickOutside();
|
|
45
57
|
}, [onClickOutside]);
|
|
46
|
-
|
|
58
|
+
const handleOnKeyDown = react.useCallback(e => {
|
|
47
59
|
if (e.key === 'Escape') onClickOutside();
|
|
48
60
|
}, [onClickOutside]);
|
|
49
|
-
|
|
61
|
+
react.useEffect(() => {
|
|
50
62
|
var _containerRef$current;
|
|
51
63
|
|
|
52
64
|
if (isOpen && !removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
|
|
53
65
|
}, [isOpen, removeAutoFocus]);
|
|
54
66
|
|
|
55
67
|
if (isOpen) {
|
|
56
|
-
return /*#__PURE__*/ReactDOM__default[
|
|
68
|
+
return /*#__PURE__*/ReactDOM__default["default"].createPortal( /*#__PURE__*/_jsx__default["default"](styles.StyledDialogBackground, {
|
|
57
69
|
onClick: handleOutsideClick,
|
|
58
|
-
"data-portalbg": true
|
|
59
|
-
|
|
70
|
+
"data-portalbg": true,
|
|
71
|
+
"data-testid": DSDialogDatatestid.DSDialogDatatestid.BACKGROUND,
|
|
72
|
+
zIndex: zIndex
|
|
73
|
+
}, void 0, _FixedBody || (_FixedBody = /*#__PURE__*/_jsx__default["default"](styles.FixedBody, {})), /*#__PURE__*/jsxRuntime.jsx(styles.StyledDialogContainer, _objectSpread(_objectSpread({
|
|
60
74
|
role: "dialog",
|
|
61
75
|
"aria-modal": true,
|
|
62
76
|
ref: containerRef,
|
|
63
77
|
tabIndex: !removeAutoFocus ? 0 : undefined,
|
|
64
78
|
onKeyDown: handleOnKeyDown
|
|
65
|
-
}, utils.getSpaceProps(rest), {
|
|
79
|
+
}, utils.getSpaceProps(rest)), {}, {
|
|
66
80
|
size: size,
|
|
67
|
-
centered: centered
|
|
68
|
-
|
|
81
|
+
centered: centered,
|
|
82
|
+
"data-testid": DSDialogDatatestid.DSDialogDatatestid.CONTAINER,
|
|
83
|
+
children: children
|
|
84
|
+
}))), document.getElementsByTagName('body')[0]);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
return null;
|
|
72
88
|
};
|
|
73
89
|
|
|
74
|
-
|
|
75
|
-
var DSDialogWithSchema = reactDesc.describe(DSDialog);
|
|
90
|
+
const DSDialogWithSchema = reactDesc.describe(DSDialog);
|
|
76
91
|
DSDialogWithSchema.propTypes = propTypes.propTypes;
|
|
77
92
|
|
|
78
93
|
exports.DSDialog = DSDialog;
|
|
79
94
|
exports.DSDialogWithSchema = DSDialogWithSchema;
|
|
80
|
-
//# sourceMappingURL=DSDialog.js.map
|
package/cjs/defaultProps.js
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
|
|
7
|
+
const noop = () => {};
|
|
8
|
+
|
|
9
|
+
const defaultProps = {
|
|
6
10
|
isOpen: false,
|
|
7
11
|
centered: false,
|
|
8
|
-
size:
|
|
12
|
+
size: utils.DSDialogSizes.DEFAULT,
|
|
9
13
|
removeAutoFocus: false,
|
|
10
|
-
onClickOutside:
|
|
14
|
+
onClickOutside: noop,
|
|
15
|
+
zIndex: 10
|
|
11
16
|
};
|
|
12
17
|
|
|
13
18
|
exports.defaultProps = defaultProps;
|
|
14
|
-
//# sourceMappingURL=defaultProps.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,26 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSDialog = require('./DSDialog.js');
|
|
6
|
+
var DSDialogDatatestid = require('./DSDialogDatatestid.js');
|
|
7
|
+
var utils = require('./utils.js');
|
|
6
8
|
var styles = require('./styles.js');
|
|
7
|
-
require('@babel/runtime/helpers/extends');
|
|
8
|
-
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
9
|
-
require('react-dom');
|
|
10
|
-
require('react');
|
|
11
|
-
require('react-desc');
|
|
12
|
-
require('@elliemae/ds-props-helpers');
|
|
13
|
-
require('./propTypes.js');
|
|
14
|
-
require('./defaultProps.js');
|
|
15
|
-
require('./utils.js');
|
|
16
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
17
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
18
|
-
require('styled-components');
|
|
19
|
-
require('@elliemae/ds-system');
|
|
20
|
-
require('styled-system');
|
|
21
9
|
|
|
22
10
|
|
|
23
11
|
|
|
24
12
|
exports.DSDialog = DSDialog.DSDialog;
|
|
25
13
|
exports.DSDialogWithSchema = DSDialog.DSDialogWithSchema;
|
|
14
|
+
exports.DSDialogDatatestid = DSDialogDatatestid.DSDialogDatatestid;
|
|
15
|
+
exports.DSDialogSizes = utils.DSDialogSizes;
|
|
26
16
|
exports.DSDialogAddon = styles.DSDialogAddon;
|
|
27
17
|
exports.DSDialogBody = styles.DSDialogBody;
|
|
28
18
|
exports.DSDialogDefaultLayout = styles.DSDialogDefaultLayout;
|
|
@@ -32,4 +22,3 @@ exports.DSDialogPrimaryMessage = styles.DSDialogPrimaryMessage;
|
|
|
32
22
|
exports.DSDialogSecondaryMessage = styles.DSDialogSecondaryMessage;
|
|
33
23
|
exports.DSDialogSeparator = styles.DSDialogSeparator;
|
|
34
24
|
exports.DSDialogTitle = styles.DSDialogTitle;
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/propTypes.js
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
|
+
var utils = require('./utils.js');
|
|
6
7
|
|
|
7
8
|
/* eslint-disable max-len */
|
|
8
|
-
|
|
9
|
+
const propTypes = {
|
|
9
10
|
isOpen: reactDesc.PropTypes.bool.description('Wether the Dialog is open or not.').defaultValue(false),
|
|
10
11
|
children: reactDesc.PropTypes.node.description('Nested components.').isRequired,
|
|
11
12
|
centered: reactDesc.PropTypes.bool.description('Centers the Dialog.').defaultValue(false),
|
|
13
|
+
size: reactDesc.PropTypes.oneOf(utils.DSDialogSizesArrayValues).description("Dialog's width size.").defaultValue(utils.DSDialogSizes.DEFAULT),
|
|
12
14
|
removeAutoFocus: reactDesc.PropTypes.bool.description('Removes focus in the Dialog container when is open. If you want to focus an specific element in the Dialog, it should be set to true.').defaultValue(false),
|
|
13
|
-
onClickOutside: reactDesc.PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.').defaultValue(
|
|
15
|
+
onClickOutside: reactDesc.PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.').defaultValue(() => {})
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
exports.propTypes = propTypes;
|
|
17
|
-
//# sourceMappingURL=propTypes.js.map
|
package/cjs/styles.js
CHANGED
|
@@ -6,6 +6,7 @@ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiter
|
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
8
|
var styledSystem = require('styled-system');
|
|
9
|
+
var utils = require('./utils.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
@@ -13,92 +14,115 @@ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_tagged
|
|
|
13
14
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
15
|
|
|
15
16
|
var _templateObject;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
small: '320px',
|
|
19
|
-
medium: '656px',
|
|
20
|
-
large: '848px',
|
|
21
|
-
'x-large': '1042px',
|
|
22
|
-
'xx-large': '1440px'
|
|
23
|
-
};
|
|
24
|
-
var FixedBody = dsSystem.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default['default'](["\n body {\n overflow: hidden;\n }\n"])));
|
|
25
|
-
var StyledDialogBackground = /*#__PURE__*/styled__default['default'].div.withConfig({
|
|
17
|
+
const FixedBody = dsSystem.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n body {\n overflow: hidden;\n }\n"])));
|
|
18
|
+
const StyledDialogBackground = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
26
19
|
componentId: "sc-106vqwv-0"
|
|
27
|
-
})(["position:fixed;top:0;bottom:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;"]
|
|
28
|
-
|
|
20
|
+
})(["position:fixed;top:0;bottom:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;z-index:", ";"], _ref => {
|
|
21
|
+
let {
|
|
22
|
+
zIndex
|
|
23
|
+
} = _ref;
|
|
24
|
+
return zIndex;
|
|
25
|
+
});
|
|
26
|
+
const StyledDialogContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
29
27
|
componentId: "sc-106vqwv-1"
|
|
30
|
-
})(["height:fit-content;position:absolute;top:0;bottom:0;left:0;right:0;margin:", ";width:", ";min-width:300px;box-shadow:0 10px 20px 0 ", ";background:", ";overflow-y:
|
|
31
|
-
|
|
28
|
+
})(["height:fit-content;position:absolute;top:0;bottom:0;left:0;right:0;margin:", ";width:", ";min-width:300px;box-shadow:0 10px 20px 0 ", ";background:", ";overflow-y:auto;", " &:focus{outline:none;}"], _ref2 => {
|
|
29
|
+
let {
|
|
30
|
+
centered
|
|
31
|
+
} = _ref2;
|
|
32
32
|
return centered ? 'auto' : '20vh auto auto auto';
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
33
|
+
}, _ref3 => {
|
|
34
|
+
let {
|
|
35
|
+
size
|
|
36
|
+
} = _ref3;
|
|
37
|
+
return utils.allSizes[size];
|
|
38
|
+
}, _ref4 => {
|
|
39
|
+
let {
|
|
40
|
+
theme
|
|
41
|
+
} = _ref4;
|
|
38
42
|
return theme.colors.neutral[500];
|
|
39
|
-
},
|
|
40
|
-
|
|
43
|
+
}, _ref5 => {
|
|
44
|
+
let {
|
|
45
|
+
theme
|
|
46
|
+
} = _ref5;
|
|
41
47
|
return theme.colors.neutral['000'];
|
|
42
48
|
}, styledSystem.space);
|
|
43
|
-
|
|
49
|
+
const DSDialogTitle = /*#__PURE__*/styled__default["default"].h3.withConfig({
|
|
44
50
|
componentId: "sc-106vqwv-2"
|
|
45
|
-
})(["font-size:", ";display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;"],
|
|
46
|
-
|
|
51
|
+
})(["font-size:", ";display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;"], _ref6 => {
|
|
52
|
+
let {
|
|
53
|
+
theme
|
|
54
|
+
} = _ref6;
|
|
47
55
|
return theme.fontSizes.title[700];
|
|
48
56
|
});
|
|
49
|
-
|
|
57
|
+
const DSDialogAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
50
58
|
componentId: "sc-106vqwv-3"
|
|
51
59
|
})([""]);
|
|
52
|
-
|
|
60
|
+
const DSDialogHeader = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
53
61
|
componentId: "sc-106vqwv-4"
|
|
54
|
-
})(["display:grid;align-items:center;grid-auto-flow:column;min-height:", ";padding:10px ", ";& ", " + ", "{align-self:flex-start;justify-self:flex-end;}& ", ":only-child{justify-self:flex-end;}", ""],
|
|
55
|
-
|
|
62
|
+
})(["display:grid;align-items:center;grid-auto-flow:column;min-height:", ";padding:10px ", ";& ", " + ", "{align-self:flex-start;justify-self:flex-end;}& ", ":only-child{justify-self:flex-end;}", ""], _ref7 => {
|
|
63
|
+
let {
|
|
64
|
+
theme
|
|
65
|
+
} = _ref7;
|
|
56
66
|
return theme.space.m;
|
|
57
|
-
},
|
|
58
|
-
|
|
67
|
+
}, _ref8 => {
|
|
68
|
+
let {
|
|
69
|
+
theme
|
|
70
|
+
} = _ref8;
|
|
59
71
|
return theme.space.xs;
|
|
60
72
|
}, DSDialogTitle, DSDialogAddon, DSDialogAddon, styledSystem.space);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
}).withConfig({
|
|
73
|
+
const DSDialogSeparator = /*#__PURE__*/styled__default["default"].hr.attrs(() => ({
|
|
74
|
+
'aria-hidden': true
|
|
75
|
+
})).withConfig({
|
|
66
76
|
componentId: "sc-106vqwv-5"
|
|
67
|
-
})(["margin:0;border-top:1px solid ", ";"],
|
|
68
|
-
|
|
77
|
+
})(["margin:0;border-top:1px solid ", ";"], _ref9 => {
|
|
78
|
+
let {
|
|
79
|
+
theme
|
|
80
|
+
} = _ref9;
|
|
69
81
|
return theme.colors.neutral['080'];
|
|
70
82
|
});
|
|
71
|
-
|
|
83
|
+
const DSDialogBody = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
72
84
|
componentId: "sc-106vqwv-6"
|
|
73
|
-
})(["padding:", ";overflow-y:auto;", " ", " ", ""],
|
|
74
|
-
|
|
85
|
+
})(["padding:", ";overflow-y:auto;", " ", " ", ""], _ref10 => {
|
|
86
|
+
let {
|
|
87
|
+
theme
|
|
88
|
+
} = _ref10;
|
|
75
89
|
return theme.space.xs;
|
|
76
90
|
}, styledSystem.layout, styledSystem.space, styledSystem.flexbox);
|
|
77
|
-
|
|
91
|
+
const DSDialogPrimaryMessage = /*#__PURE__*/styled__default["default"].h3.withConfig({
|
|
78
92
|
componentId: "sc-106vqwv-7"
|
|
79
93
|
})(["margin:0;"]);
|
|
80
|
-
|
|
94
|
+
const DSDialogSecondaryMessage = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
81
95
|
componentId: "sc-106vqwv-8"
|
|
82
|
-
})(["margin:0;color:", ";"],
|
|
83
|
-
|
|
96
|
+
})(["margin:0;color:", ";"], _ref11 => {
|
|
97
|
+
let {
|
|
98
|
+
theme
|
|
99
|
+
} = _ref11;
|
|
84
100
|
return theme.colors.neutral[500];
|
|
85
101
|
});
|
|
86
|
-
|
|
102
|
+
const DSDialogDefaultLayout = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
87
103
|
componentId: "sc-106vqwv-9"
|
|
88
|
-
})(["display:grid;grid-auto-flow:row;justify-items:center;align-items:center;grid-gap:", ";", "{text-align:center;}"],
|
|
89
|
-
|
|
104
|
+
})(["display:grid;grid-auto-flow:row;justify-items:center;align-items:center;grid-gap:", ";", "{text-align:center;}"], _ref12 => {
|
|
105
|
+
let {
|
|
106
|
+
theme
|
|
107
|
+
} = _ref12;
|
|
90
108
|
return theme.space.xxs;
|
|
91
109
|
}, DSDialogSecondaryMessage);
|
|
92
|
-
|
|
110
|
+
const DSDialogFooter = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
93
111
|
componentId: "sc-106vqwv-10"
|
|
94
|
-
})(["display:grid;grid-auto-flow:column;align-items:center;justify-content:flex-end;grid-gap:", ";min-height:", ";padding:0 ", ";", " ", ""],
|
|
95
|
-
|
|
112
|
+
})(["display:grid;grid-auto-flow:column;align-items:center;justify-content:flex-end;grid-gap:", ";min-height:", ";padding:0 ", ";", " ", ""], _ref13 => {
|
|
113
|
+
let {
|
|
114
|
+
theme
|
|
115
|
+
} = _ref13;
|
|
96
116
|
return theme.space.xxs;
|
|
97
|
-
},
|
|
98
|
-
|
|
117
|
+
}, _ref14 => {
|
|
118
|
+
let {
|
|
119
|
+
theme
|
|
120
|
+
} = _ref14;
|
|
99
121
|
return theme.space.m;
|
|
100
|
-
},
|
|
101
|
-
|
|
122
|
+
}, _ref15 => {
|
|
123
|
+
let {
|
|
124
|
+
theme
|
|
125
|
+
} = _ref15;
|
|
102
126
|
return theme.space.xs;
|
|
103
127
|
}, styledSystem.space, styledSystem.flexbox);
|
|
104
128
|
|
|
@@ -114,4 +138,3 @@ exports.DSDialogTitle = DSDialogTitle;
|
|
|
114
138
|
exports.FixedBody = FixedBody;
|
|
115
139
|
exports.StyledDialogBackground = StyledDialogBackground;
|
|
116
140
|
exports.StyledDialogContainer = StyledDialogContainer;
|
|
117
|
-
//# sourceMappingURL=styles.js.map
|
package/cjs/utils.js
CHANGED
|
@@ -2,20 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
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/web.dom-collections.iterator.js');
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const getSpaceProps = props => Object.fromEntries(Object.entries(props).filter(_ref => {
|
|
11
|
+
let [key] = _ref;
|
|
12
|
+
return /^[pm][xytblr]?$/.exec(key);
|
|
13
|
+
}));
|
|
14
|
+
const DSDialogSizes = {
|
|
15
|
+
DEFAULT: 'default',
|
|
16
|
+
SMALL: 'small',
|
|
17
|
+
MEDIUM: 'medium',
|
|
18
|
+
LARGE: 'large',
|
|
19
|
+
XLARGE: 'x-large',
|
|
20
|
+
XXLARGE: 'xx-large'
|
|
21
|
+
};
|
|
22
|
+
const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
|
|
23
|
+
const allSizes = {
|
|
24
|
+
default: '576px',
|
|
25
|
+
small: '320px',
|
|
26
|
+
medium: '656px',
|
|
27
|
+
large: '848px',
|
|
28
|
+
'x-large': '1042px',
|
|
29
|
+
'xx-large': '1440px'
|
|
18
30
|
};
|
|
19
31
|
|
|
32
|
+
exports.DSDialogSizes = DSDialogSizes;
|
|
33
|
+
exports.DSDialogSizesArrayValues = DSDialogSizesArrayValues;
|
|
34
|
+
exports.allSizes = allSizes;
|
|
20
35
|
exports.getSpaceProps = getSpaceProps;
|
|
21
|
-
//# sourceMappingURL=utils.js.map
|
package/esm/DSDialog.js
CHANGED
|
@@ -1,68 +1,82 @@
|
|
|
1
|
-
import
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
9
|
import ReactDOM from 'react-dom';
|
|
4
|
-
import
|
|
10
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
5
11
|
import { describe } from 'react-desc';
|
|
6
12
|
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
7
13
|
import { StyledDialogBackground, FixedBody, StyledDialogContainer } from './styles.js';
|
|
8
14
|
import { propTypes } from './propTypes.js';
|
|
9
15
|
import { defaultProps } from './defaultProps.js';
|
|
10
16
|
import { getSpaceProps } from './utils.js';
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '@elliemae/ds-system';
|
|
14
|
-
import 'styled-system';
|
|
15
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
17
|
+
import { DSDialogDatatestid } from './DSDialogDatatestid.js';
|
|
18
|
+
import { jsx } from 'react/jsx-runtime';
|
|
16
19
|
|
|
17
|
-
var
|
|
20
|
+
var _FixedBody;
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
var propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
21
|
-
useValidateTypescriptPropTypes(propsWithDefault, DSDialogWithSchema.toTypescript());
|
|
22
|
+
const _excluded = ["children", "isOpen", "onClickOutside", "centered", "size", "removeAutoFocus", "zIndex"];
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
isOpen = propsWithDefault.isOpen,
|
|
25
|
-
onClickOutside = propsWithDefault.onClickOutside,
|
|
26
|
-
centered = propsWithDefault.centered,
|
|
27
|
-
size = propsWithDefault.size,
|
|
28
|
-
removeAutoFocus = propsWithDefault.removeAutoFocus,
|
|
29
|
-
rest = _objectWithoutProperties(propsWithDefault, _excluded);
|
|
24
|
+
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; }
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
const DSDialog = props => {
|
|
29
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
30
|
+
useValidateTypescriptPropTypes(propsWithDefault, propTypes);
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
children,
|
|
34
|
+
isOpen,
|
|
35
|
+
onClickOutside,
|
|
36
|
+
centered,
|
|
37
|
+
size,
|
|
38
|
+
removeAutoFocus,
|
|
39
|
+
zIndex
|
|
40
|
+
} = propsWithDefault,
|
|
41
|
+
rest = _objectWithoutProperties(propsWithDefault, _excluded);
|
|
42
|
+
|
|
43
|
+
const containerRef = useRef(null);
|
|
44
|
+
const handleOutsideClick = useCallback(e => {
|
|
33
45
|
if (e.target.dataset.portalbg) onClickOutside();
|
|
34
46
|
}, [onClickOutside]);
|
|
35
|
-
|
|
47
|
+
const handleOnKeyDown = useCallback(e => {
|
|
36
48
|
if (e.key === 'Escape') onClickOutside();
|
|
37
49
|
}, [onClickOutside]);
|
|
38
|
-
useEffect(
|
|
50
|
+
useEffect(() => {
|
|
39
51
|
var _containerRef$current;
|
|
40
52
|
|
|
41
53
|
if (isOpen && !removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
|
|
42
54
|
}, [isOpen, removeAutoFocus]);
|
|
43
55
|
|
|
44
56
|
if (isOpen) {
|
|
45
|
-
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx(StyledDialogBackground, {
|
|
46
58
|
onClick: handleOutsideClick,
|
|
47
|
-
"data-portalbg": true
|
|
48
|
-
|
|
59
|
+
"data-portalbg": true,
|
|
60
|
+
"data-testid": DSDialogDatatestid.BACKGROUND,
|
|
61
|
+
zIndex: zIndex
|
|
62
|
+
}, void 0, _FixedBody || (_FixedBody = /*#__PURE__*/_jsx(FixedBody, {})), /*#__PURE__*/jsx(StyledDialogContainer, _objectSpread(_objectSpread({
|
|
49
63
|
role: "dialog",
|
|
50
64
|
"aria-modal": true,
|
|
51
65
|
ref: containerRef,
|
|
52
66
|
tabIndex: !removeAutoFocus ? 0 : undefined,
|
|
53
67
|
onKeyDown: handleOnKeyDown
|
|
54
|
-
}, getSpaceProps(rest), {
|
|
68
|
+
}, getSpaceProps(rest)), {}, {
|
|
55
69
|
size: size,
|
|
56
|
-
centered: centered
|
|
57
|
-
|
|
70
|
+
centered: centered,
|
|
71
|
+
"data-testid": DSDialogDatatestid.CONTAINER,
|
|
72
|
+
children: children
|
|
73
|
+
}))), document.getElementsByTagName('body')[0]);
|
|
58
74
|
}
|
|
59
75
|
|
|
60
76
|
return null;
|
|
61
77
|
};
|
|
62
78
|
|
|
63
|
-
|
|
64
|
-
var DSDialogWithSchema = describe(DSDialog);
|
|
79
|
+
const DSDialogWithSchema = describe(DSDialog);
|
|
65
80
|
DSDialogWithSchema.propTypes = propTypes;
|
|
66
81
|
|
|
67
82
|
export { DSDialog, DSDialogWithSchema };
|
|
68
|
-
//# sourceMappingURL=DSDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/esm/defaultProps.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { DSDialogSizes } from './utils.js';
|
|
2
|
+
|
|
3
|
+
const noop = () => {};
|
|
4
|
+
|
|
5
|
+
const defaultProps = {
|
|
2
6
|
isOpen: false,
|
|
3
7
|
centered: false,
|
|
4
|
-
size:
|
|
8
|
+
size: DSDialogSizes.DEFAULT,
|
|
5
9
|
removeAutoFocus: false,
|
|
6
|
-
onClickOutside:
|
|
10
|
+
onClickOutside: noop,
|
|
11
|
+
zIndex: 10
|
|
7
12
|
};
|
|
8
13
|
|
|
9
14
|
export { defaultProps };
|
|
10
|
-
//# sourceMappingURL=defaultProps.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
export { DSDialog, DSDialogWithSchema } from './DSDialog.js';
|
|
2
|
+
export { DSDialogDatatestid } from './DSDialogDatatestid.js';
|
|
3
|
+
export { DSDialogSizes } from './utils.js';
|
|
2
4
|
export { DSDialogAddon, DSDialogBody, DSDialogDefaultLayout, DSDialogFooter, DSDialogHeader, DSDialogPrimaryMessage, DSDialogSecondaryMessage, DSDialogSeparator, DSDialogTitle } from './styles.js';
|
|
3
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
4
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import 'react-dom';
|
|
6
|
-
import 'react';
|
|
7
|
-
import 'react-desc';
|
|
8
|
-
import '@elliemae/ds-props-helpers';
|
|
9
|
-
import './propTypes.js';
|
|
10
|
-
import './defaultProps.js';
|
|
11
|
-
import './utils.js';
|
|
12
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
13
|
-
import '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
14
|
-
import 'styled-components';
|
|
15
|
-
import '@elliemae/ds-system';
|
|
16
|
-
import 'styled-system';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|