@elliemae/ds-dialog 2.4.2-rc.3 → 2.4.3-rc.0
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/DSDialogCTX.js +1 -12
- package/cjs/config/useDialog.js +15 -26
- package/cjs/parts/dialogContent/useDialogContent.js +3 -7
- package/cjs/propTypes.js +1 -1
- package/cjs/styles.js +11 -8
- package/cjs/utils.js +4 -1
- package/esm/DSDialogCTX.js +2 -13
- package/esm/config/useDialog.js +15 -26
- package/esm/parts/dialogContent/useDialogContent.js +3 -7
- package/esm/propTypes.js +1 -1
- package/esm/styles.js +11 -7
- package/esm/utils.js +3 -2
- package/package.json +5 -5
- package/types/sharedTypes.d.ts +0 -1
- package/types/utils.d.ts +2 -0
package/cjs/DSDialogCTX.js
CHANGED
|
@@ -3,19 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var defaultProps = require('./defaultProps.js');
|
|
7
6
|
|
|
8
|
-
const defaultContext = {
|
|
9
|
-
props: defaultProps.defaultProps,
|
|
10
|
-
actualPortalRef: /*#__PURE__*/react.createRef(),
|
|
11
|
-
containerRef: /*#__PURE__*/react.createRef(),
|
|
12
|
-
portalClassName: '',
|
|
13
|
-
portalInfo: {
|
|
14
|
-
overflow: false,
|
|
15
|
-
paddingRight: '0px',
|
|
16
|
-
scrollbarWidth: '0px'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
7
|
+
const defaultContext = {};
|
|
19
8
|
const DSDialogContext = /*#__PURE__*/react.createContext(defaultContext);
|
|
20
9
|
|
|
21
10
|
exports.DSDialogContext = DSDialogContext;
|
package/cjs/config/useDialog.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
11
|
var react = require('react');
|
|
13
12
|
var lodash = require('lodash');
|
|
14
13
|
var uid = require('uid');
|
|
15
14
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
16
15
|
var defaultProps = require('../defaultProps.js');
|
|
17
16
|
var propTypes = require('../propTypes.js');
|
|
17
|
+
var utils = require('../utils.js');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
20
|
|
|
@@ -34,10 +34,9 @@ const useDialog = props => {
|
|
|
34
34
|
const containerRef = react.useRef(null);
|
|
35
35
|
const [portalInfo, setPortalInfo] = react.useState({
|
|
36
36
|
paddingRight: '0px',
|
|
37
|
-
scrollbarWidth: '0px'
|
|
38
|
-
overflow: false
|
|
37
|
+
scrollbarWidth: '0px'
|
|
39
38
|
});
|
|
40
|
-
const portalClassName = react.useMemo(() =>
|
|
39
|
+
const portalClassName = react.useMemo(() => `ds-dialog-${uid.uid(8)}`, []);
|
|
41
40
|
react.useEffect(() => {
|
|
42
41
|
if (portalRef) actualPortalRef.current = portalRef.current;else actualPortalRef.current = document.getElementsByTagName('body')['0'];
|
|
43
42
|
}, [portalRef]);
|
|
@@ -52,38 +51,28 @@ const useDialog = props => {
|
|
|
52
51
|
}, [actualPortalRef, isOpen, portalClassName]);
|
|
53
52
|
react.useEffect(() => {
|
|
54
53
|
if (actualPortalRef.current) {
|
|
55
|
-
var _window$getComputedSt;
|
|
56
|
-
|
|
57
|
-
const paddingRight = (_window$getComputedSt = window.getComputedStyle(actualPortalRef.current, null)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue('padding-right');
|
|
58
54
|
setPortalInfo(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
59
|
-
paddingRight
|
|
55
|
+
paddingRight: utils.getCurrentRightPadding(actualPortalRef.current)
|
|
60
56
|
}));
|
|
61
57
|
}
|
|
62
58
|
}, []);
|
|
63
|
-
const
|
|
64
|
-
if (actualPortalRef.current) {
|
|
65
|
-
const body = actualPortalRef.current;
|
|
66
|
-
const {
|
|
67
|
-
clientWidth,
|
|
68
|
-
clientHeight,
|
|
69
|
-
scrollHeight
|
|
70
|
-
} = body;
|
|
59
|
+
const calculateScrollbar = react.useCallback(() => {
|
|
60
|
+
if (actualPortalRef.current && !isOpen) {
|
|
71
61
|
setPortalInfo(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
72
|
-
scrollbarWidth:
|
|
73
|
-
overflow: scrollHeight > clientHeight
|
|
62
|
+
scrollbarWidth: utils.getScrollbarWidth(actualPortalRef.current)
|
|
74
63
|
}));
|
|
75
64
|
}
|
|
76
|
-
}, [
|
|
77
|
-
const
|
|
65
|
+
}, [isOpen]);
|
|
66
|
+
const debouncedCalculateScrollbar = react.useMemo(() => lodash.debounce(calculateScrollbar, 300), [calculateScrollbar]);
|
|
78
67
|
react.useEffect(() => {
|
|
79
|
-
window.addEventListener('resize',
|
|
68
|
+
window.addEventListener('resize', debouncedCalculateScrollbar);
|
|
80
69
|
return () => {
|
|
81
|
-
window.removeEventListener('resize',
|
|
70
|
+
window.removeEventListener('resize', debouncedCalculateScrollbar);
|
|
82
71
|
};
|
|
83
|
-
}, [
|
|
72
|
+
}, [calculateScrollbar, debouncedCalculateScrollbar]);
|
|
84
73
|
react.useEffect(() => {
|
|
85
|
-
|
|
86
|
-
}, [
|
|
74
|
+
calculateScrollbar();
|
|
75
|
+
}, [calculateScrollbar, isOpen]);
|
|
87
76
|
const ctx = react.useMemo(() => ({
|
|
88
77
|
props: propsWithDefault,
|
|
89
78
|
actualPortalRef,
|
|
@@ -21,16 +21,12 @@ const useDialogContent = () => {
|
|
|
21
21
|
if (e.key === 'Escape') onClose();
|
|
22
22
|
}, [onClose]);
|
|
23
23
|
react.useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
|
|
24
|
+
if (!removeAutoFocus) containerRef?.current?.focus();
|
|
27
25
|
}, [containerRef, removeAutoFocus]);
|
|
28
26
|
const focusContainer = react.useCallback(() => {
|
|
29
27
|
setTimeout(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const isContainerOrChildFocused = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.contains(document.activeElement);
|
|
33
|
-
if (!isContainerOrChildFocused) (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.focus) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
|
|
28
|
+
const isContainerOrChildFocused = containerRef.current?.contains(document.activeElement);
|
|
29
|
+
if (!isContainerOrChildFocused) containerRef.current?.focus?.();
|
|
34
30
|
});
|
|
35
31
|
}, [containerRef]);
|
|
36
32
|
react.useEffect(() => {
|
package/cjs/propTypes.js
CHANGED
|
@@ -25,7 +25,7 @@ const propTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttribute
|
|
|
25
25
|
removeAutoFocus: dsPropsHelpers.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),
|
|
26
26
|
onClickOutside: dsPropsHelpers.PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside.').defaultValue(() => {}),
|
|
27
27
|
onClose: dsPropsHelpers.PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),
|
|
28
|
-
size: dsPropsHelpers.PropTypes.oneOf(utils.DSDialogSizesArrayValues).description(
|
|
28
|
+
size: dsPropsHelpers.PropTypes.oneOf(utils.DSDialogSizesArrayValues).description(`Dialog's width size.`).defaultValue(utils.DSDialogSizes.DEFAULT)
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
exports.propTypes = propTypes;
|
package/cjs/styles.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
5
|
var styled = require('styled-components');
|
|
7
6
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
7
|
var styledComponents = require('@xstyled/styled-components');
|
|
@@ -10,21 +9,25 @@ var utils = require('./utils.js');
|
|
|
10
9
|
|
|
11
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
11
|
|
|
13
|
-
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
14
12
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
const PortalStyles = dsSystem.createGlobalStyle
|
|
14
|
+
/* eslint-disable max-lines */
|
|
15
|
+
const PortalStyles = dsSystem.createGlobalStyle`
|
|
16
|
+
${_ref => {
|
|
18
17
|
let {
|
|
19
18
|
portalClassName
|
|
20
19
|
} = _ref;
|
|
21
|
-
return
|
|
22
|
-
}
|
|
20
|
+
return `.${portalClassName}`;
|
|
21
|
+
}} {
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
${_ref2 => {
|
|
23
24
|
let {
|
|
24
25
|
portalInfo
|
|
25
26
|
} = _ref2;
|
|
26
|
-
return portalInfo.
|
|
27
|
-
}
|
|
27
|
+
return portalInfo.scrollbarWidth !== '0px' ? `padding-right: calc( ${portalInfo.paddingRight} + ${portalInfo.scrollbarWidth} ) !important;` : ``;
|
|
28
|
+
}}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
28
31
|
const StyledDialogBackground = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
29
32
|
componentId: "sc-106vqwv-0"
|
|
30
33
|
})(["position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;z-index:", ";"], _ref3 => {
|
package/cjs/utils.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
8
|
|
|
10
9
|
const getSpaceProps = props => Object.fromEntries(Object.entries(props).filter(_ref => {
|
|
11
10
|
let [key] = _ref;
|
|
@@ -28,8 +27,12 @@ const allSizes = {
|
|
|
28
27
|
'x-large': '1042px',
|
|
29
28
|
'xx-large': '1440px'
|
|
30
29
|
};
|
|
30
|
+
const getScrollbarWidth = element => element.tagName === 'BODY' ? `${window.innerWidth - element.clientWidth}px` : `${element.offsetWidth - element.clientWidth}px`;
|
|
31
|
+
const getCurrentRightPadding = element => window.getComputedStyle(element, null)?.getPropertyValue('padding-right');
|
|
31
32
|
|
|
32
33
|
exports.DSDialogSizes = DSDialogSizes;
|
|
33
34
|
exports.DSDialogSizesArrayValues = DSDialogSizesArrayValues;
|
|
34
35
|
exports.allSizes = allSizes;
|
|
36
|
+
exports.getCurrentRightPadding = getCurrentRightPadding;
|
|
37
|
+
exports.getScrollbarWidth = getScrollbarWidth;
|
|
35
38
|
exports.getSpaceProps = getSpaceProps;
|
package/esm/DSDialogCTX.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { createContext
|
|
2
|
-
import { defaultProps } from './defaultProps.js';
|
|
1
|
+
import { createContext } from 'react';
|
|
3
2
|
|
|
4
|
-
const defaultContext = {
|
|
5
|
-
props: defaultProps,
|
|
6
|
-
actualPortalRef: /*#__PURE__*/createRef(),
|
|
7
|
-
containerRef: /*#__PURE__*/createRef(),
|
|
8
|
-
portalClassName: '',
|
|
9
|
-
portalInfo: {
|
|
10
|
-
overflow: false,
|
|
11
|
-
paddingRight: '0px',
|
|
12
|
-
scrollbarWidth: '0px'
|
|
13
|
-
}
|
|
14
|
-
};
|
|
3
|
+
const defaultContext = {};
|
|
15
4
|
const DSDialogContext = /*#__PURE__*/createContext(defaultContext);
|
|
16
5
|
|
|
17
6
|
export { DSDialogContext };
|
package/esm/config/useDialog.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
7
|
import { useRef, useState, useMemo, useEffect, useLayoutEffect, useCallback } from 'react';
|
|
9
8
|
import { debounce } from 'lodash';
|
|
10
9
|
import { uid } from 'uid';
|
|
11
10
|
import { useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
|
|
12
11
|
import { defaultProps } from '../defaultProps.js';
|
|
13
12
|
import { propTypes } from '../propTypes.js';
|
|
13
|
+
import { getCurrentRightPadding, getScrollbarWidth } from '../utils.js';
|
|
14
14
|
|
|
15
15
|
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; }
|
|
16
16
|
|
|
@@ -26,10 +26,9 @@ const useDialog = props => {
|
|
|
26
26
|
const containerRef = useRef(null);
|
|
27
27
|
const [portalInfo, setPortalInfo] = useState({
|
|
28
28
|
paddingRight: '0px',
|
|
29
|
-
scrollbarWidth: '0px'
|
|
30
|
-
overflow: false
|
|
29
|
+
scrollbarWidth: '0px'
|
|
31
30
|
});
|
|
32
|
-
const portalClassName = useMemo(() =>
|
|
31
|
+
const portalClassName = useMemo(() => `ds-dialog-${uid(8)}`, []);
|
|
33
32
|
useEffect(() => {
|
|
34
33
|
if (portalRef) actualPortalRef.current = portalRef.current;else actualPortalRef.current = document.getElementsByTagName('body')['0'];
|
|
35
34
|
}, [portalRef]);
|
|
@@ -44,38 +43,28 @@ const useDialog = props => {
|
|
|
44
43
|
}, [actualPortalRef, isOpen, portalClassName]);
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
if (actualPortalRef.current) {
|
|
47
|
-
var _window$getComputedSt;
|
|
48
|
-
|
|
49
|
-
const paddingRight = (_window$getComputedSt = window.getComputedStyle(actualPortalRef.current, null)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue('padding-right');
|
|
50
46
|
setPortalInfo(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
51
|
-
paddingRight
|
|
47
|
+
paddingRight: getCurrentRightPadding(actualPortalRef.current)
|
|
52
48
|
}));
|
|
53
49
|
}
|
|
54
50
|
}, []);
|
|
55
|
-
const
|
|
56
|
-
if (actualPortalRef.current) {
|
|
57
|
-
const body = actualPortalRef.current;
|
|
58
|
-
const {
|
|
59
|
-
clientWidth,
|
|
60
|
-
clientHeight,
|
|
61
|
-
scrollHeight
|
|
62
|
-
} = body;
|
|
51
|
+
const calculateScrollbar = useCallback(() => {
|
|
52
|
+
if (actualPortalRef.current && !isOpen) {
|
|
63
53
|
setPortalInfo(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
64
|
-
scrollbarWidth:
|
|
65
|
-
overflow: scrollHeight > clientHeight
|
|
54
|
+
scrollbarWidth: getScrollbarWidth(actualPortalRef.current)
|
|
66
55
|
}));
|
|
67
56
|
}
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
57
|
+
}, [isOpen]);
|
|
58
|
+
const debouncedCalculateScrollbar = useMemo(() => debounce(calculateScrollbar, 300), [calculateScrollbar]);
|
|
70
59
|
useEffect(() => {
|
|
71
|
-
window.addEventListener('resize',
|
|
60
|
+
window.addEventListener('resize', debouncedCalculateScrollbar);
|
|
72
61
|
return () => {
|
|
73
|
-
window.removeEventListener('resize',
|
|
62
|
+
window.removeEventListener('resize', debouncedCalculateScrollbar);
|
|
74
63
|
};
|
|
75
|
-
}, [
|
|
64
|
+
}, [calculateScrollbar, debouncedCalculateScrollbar]);
|
|
76
65
|
useEffect(() => {
|
|
77
|
-
|
|
78
|
-
}, [
|
|
66
|
+
calculateScrollbar();
|
|
67
|
+
}, [calculateScrollbar, isOpen]);
|
|
79
68
|
const ctx = useMemo(() => ({
|
|
80
69
|
props: propsWithDefault,
|
|
81
70
|
actualPortalRef,
|
|
@@ -17,16 +17,12 @@ const useDialogContent = () => {
|
|
|
17
17
|
if (e.key === 'Escape') onClose();
|
|
18
18
|
}, [onClose]);
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
|
|
20
|
+
if (!removeAutoFocus) containerRef?.current?.focus();
|
|
23
21
|
}, [containerRef, removeAutoFocus]);
|
|
24
22
|
const focusContainer = useCallback(() => {
|
|
25
23
|
setTimeout(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const isContainerOrChildFocused = (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.contains(document.activeElement);
|
|
29
|
-
if (!isContainerOrChildFocused) (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.focus) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
|
|
24
|
+
const isContainerOrChildFocused = containerRef.current?.contains(document.activeElement);
|
|
25
|
+
if (!isContainerOrChildFocused) containerRef.current?.focus?.();
|
|
30
26
|
});
|
|
31
27
|
}, [containerRef]);
|
|
32
28
|
useEffect(() => {
|
package/esm/propTypes.js
CHANGED
|
@@ -17,7 +17,7 @@ const propTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}
|
|
|
17
17
|
removeAutoFocus: 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),
|
|
18
18
|
onClickOutside: PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside.').defaultValue(() => {}),
|
|
19
19
|
onClose: PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),
|
|
20
|
-
size: PropTypes.oneOf(DSDialogSizesArrayValues).description(
|
|
20
|
+
size: PropTypes.oneOf(DSDialogSizesArrayValues).description(`Dialog's width size.`).defaultValue(DSDialogSizes.DEFAULT)
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export { propTypes };
|
package/esm/styles.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import { createGlobalStyle } from '@elliemae/ds-system';
|
|
4
3
|
import { space, sizing, layout, flexboxes } from '@xstyled/styled-components';
|
|
5
4
|
import { allSizes } from './utils.js';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
const PortalStyles = createGlobalStyle
|
|
6
|
+
/* eslint-disable max-lines */
|
|
7
|
+
const PortalStyles = createGlobalStyle`
|
|
8
|
+
${_ref => {
|
|
9
9
|
let {
|
|
10
10
|
portalClassName
|
|
11
11
|
} = _ref;
|
|
12
|
-
return
|
|
13
|
-
}
|
|
12
|
+
return `.${portalClassName}`;
|
|
13
|
+
}} {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
${_ref2 => {
|
|
14
16
|
let {
|
|
15
17
|
portalInfo
|
|
16
18
|
} = _ref2;
|
|
17
|
-
return portalInfo.
|
|
18
|
-
}
|
|
19
|
+
return portalInfo.scrollbarWidth !== '0px' ? `padding-right: calc( ${portalInfo.paddingRight} + ${portalInfo.scrollbarWidth} ) !important;` : ``;
|
|
20
|
+
}}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
19
23
|
const StyledDialogBackground = /*#__PURE__*/styled.div.withConfig({
|
|
20
24
|
componentId: "sc-106vqwv-0"
|
|
21
25
|
})(["position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;z-index:", ";"], _ref3 => {
|
package/esm/utils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
4
|
|
|
6
5
|
const getSpaceProps = props => Object.fromEntries(Object.entries(props).filter(_ref => {
|
|
7
6
|
let [key] = _ref;
|
|
@@ -24,5 +23,7 @@ const allSizes = {
|
|
|
24
23
|
'x-large': '1042px',
|
|
25
24
|
'xx-large': '1440px'
|
|
26
25
|
};
|
|
26
|
+
const getScrollbarWidth = element => element.tagName === 'BODY' ? `${window.innerWidth - element.clientWidth}px` : `${element.offsetWidth - element.clientWidth}px`;
|
|
27
|
+
const getCurrentRightPadding = element => window.getComputedStyle(element, null)?.getPropertyValue('padding-right');
|
|
27
28
|
|
|
28
|
-
export { DSDialogSizes, DSDialogSizesArrayValues, allSizes, getSpaceProps };
|
|
29
|
+
export { DSDialogSizes, DSDialogSizesArrayValues, allSizes, getCurrentRightPadding, getScrollbarWidth, getSpaceProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dialog",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dialog",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"build": "node ../../scripts/build/build.js"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@elliemae/ds-button": "2.4.
|
|
84
|
-
"@elliemae/ds-icons": "2.4.
|
|
85
|
-
"@elliemae/ds-props-helpers": "2.4.
|
|
86
|
-
"@elliemae/ds-system": "2.4.
|
|
83
|
+
"@elliemae/ds-button": "2.4.3-rc.0",
|
|
84
|
+
"@elliemae/ds-icons": "2.4.3-rc.0",
|
|
85
|
+
"@elliemae/ds-props-helpers": "2.4.3-rc.0",
|
|
86
|
+
"@elliemae/ds-system": "2.4.3-rc.0",
|
|
87
87
|
"react-desc": "~4.1.3"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
package/types/sharedTypes.d.ts
CHANGED
package/types/utils.d.ts
CHANGED