@elliemae/ds-dialog 2.3.0-next.1 → 2.3.0-next.10
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 +15 -8
- package/cjs/propTypes.js +2 -3
- package/esm/DSDialog.js +15 -8
- package/esm/propTypes.js +2 -3
- package/package.json +3 -3
- package/types/DSDialog.d.ts +361 -361
- package/types/propTypes.d.ts +363 -362
- package/types/styles.d.ts +1 -5
- package/types/tests/DSDialog.test.d.ts +1 -0
package/cjs/DSDialog.js
CHANGED
|
@@ -28,7 +28,8 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
28
28
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
29
29
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
30
30
|
|
|
31
|
-
const _excluded = ["children", "isOpen", "onClickOutside", "onClose", "centered", "size", "removeAutoFocus", "zIndex"]
|
|
31
|
+
const _excluded = ["children", "isOpen", "onClickOutside", "onClose", "centered", "size", "removeAutoFocus", "zIndex"],
|
|
32
|
+
_excluded2 = ["className"];
|
|
32
33
|
|
|
33
34
|
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; }
|
|
34
35
|
|
|
@@ -60,13 +61,19 @@ const DSDialog = props => {
|
|
|
60
61
|
const handleOutsideClick = react.useCallback(e => {
|
|
61
62
|
if (e.target.dataset.portalbg) onClickOutside();
|
|
62
63
|
}, [onClickOutside]);
|
|
63
|
-
const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault, {
|
|
64
|
-
onClick: handleOutsideClick
|
|
65
|
-
});
|
|
66
64
|
const handleOnKeyDown = react.useCallback(e => {
|
|
67
65
|
if (e.key === 'Escape') onClose();
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
}, [onClose]);
|
|
67
|
+
|
|
68
|
+
const _useGetGlobalAttribut = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault, {
|
|
69
|
+
onClick: handleOutsideClick,
|
|
70
|
+
onKeyDown: handleOnKeyDown
|
|
71
|
+
}),
|
|
72
|
+
{
|
|
73
|
+
className
|
|
74
|
+
} = _useGetGlobalAttribut,
|
|
75
|
+
restOfGlobalAttributes = _objectWithoutProperties__default["default"](_useGetGlobalAttribut, _excluded2);
|
|
76
|
+
|
|
70
77
|
react.useEffect(() => {
|
|
71
78
|
var _window$getComputedSt;
|
|
72
79
|
|
|
@@ -93,6 +100,7 @@ const DSDialog = props => {
|
|
|
93
100
|
|
|
94
101
|
if (isOpen) {
|
|
95
102
|
return /*#__PURE__*/ReactDOM__default["default"].createPortal( /*#__PURE__*/_jsx__default["default"](styles.StyledDialogBackground, {
|
|
103
|
+
className: className,
|
|
96
104
|
onClick: handleOutsideClick,
|
|
97
105
|
"data-portalbg": true,
|
|
98
106
|
"data-testid": DSDialogDatatestid.DSDialogDatatestid.BACKGROUND,
|
|
@@ -108,8 +116,7 @@ const DSDialog = props => {
|
|
|
108
116
|
size: size,
|
|
109
117
|
centered: centered,
|
|
110
118
|
"data-testid": DSDialogDatatestid.DSDialogDatatestid.CONTAINER
|
|
111
|
-
},
|
|
112
|
-
onKeyDown: handleOnKeyDown,
|
|
119
|
+
}, restOfGlobalAttributes), {}, {
|
|
113
120
|
children: children
|
|
114
121
|
}))), document.getElementsByTagName('body')[0]);
|
|
115
122
|
}
|
package/cjs/propTypes.js
CHANGED
|
@@ -18,14 +18,13 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
18
18
|
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; }
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
|
-
const propTypes = _objectSpread(_objectSpread({
|
|
21
|
+
const propTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
22
22
|
isOpen: dsPropsHelpers.PropTypes.bool.description('Whether the Dialog is open or not.').defaultValue(false),
|
|
23
23
|
children: dsPropsHelpers.PropTypes.node.description('Nested components.').isRequired,
|
|
24
24
|
centered: dsPropsHelpers.PropTypes.bool.description('Centers the Dialog.').defaultValue(false),
|
|
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
|
-
onClose: dsPropsHelpers.PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {})
|
|
28
|
-
}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
27
|
+
onClose: dsPropsHelpers.PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),
|
|
29
28
|
size: dsPropsHelpers.PropTypes.oneOf(utils.DSDialogSizesArrayValues).description("Dialog's width size.").defaultValue(utils.DSDialogSizes.DEFAULT)
|
|
30
29
|
});
|
|
31
30
|
|
package/esm/DSDialog.js
CHANGED
|
@@ -17,7 +17,8 @@ import { getSpaceProps } from './utils.js';
|
|
|
17
17
|
import { DSDialogDatatestid } from './DSDialogDatatestid.js';
|
|
18
18
|
import { jsx } from 'react/jsx-runtime';
|
|
19
19
|
|
|
20
|
-
const _excluded = ["children", "isOpen", "onClickOutside", "onClose", "centered", "size", "removeAutoFocus", "zIndex"]
|
|
20
|
+
const _excluded = ["children", "isOpen", "onClickOutside", "onClose", "centered", "size", "removeAutoFocus", "zIndex"],
|
|
21
|
+
_excluded2 = ["className"];
|
|
21
22
|
|
|
22
23
|
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; }
|
|
23
24
|
|
|
@@ -49,13 +50,19 @@ const DSDialog = props => {
|
|
|
49
50
|
const handleOutsideClick = useCallback(e => {
|
|
50
51
|
if (e.target.dataset.portalbg) onClickOutside();
|
|
51
52
|
}, [onClickOutside]);
|
|
52
|
-
const globalAttributes = useGetGlobalAttributes(propsWithDefault, {
|
|
53
|
-
onClick: handleOutsideClick
|
|
54
|
-
});
|
|
55
53
|
const handleOnKeyDown = useCallback(e => {
|
|
56
54
|
if (e.key === 'Escape') onClose();
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
}, [onClose]);
|
|
56
|
+
|
|
57
|
+
const _useGetGlobalAttribut = useGetGlobalAttributes(propsWithDefault, {
|
|
58
|
+
onClick: handleOutsideClick,
|
|
59
|
+
onKeyDown: handleOnKeyDown
|
|
60
|
+
}),
|
|
61
|
+
{
|
|
62
|
+
className
|
|
63
|
+
} = _useGetGlobalAttribut,
|
|
64
|
+
restOfGlobalAttributes = _objectWithoutProperties(_useGetGlobalAttribut, _excluded2);
|
|
65
|
+
|
|
59
66
|
useEffect(() => {
|
|
60
67
|
var _window$getComputedSt;
|
|
61
68
|
|
|
@@ -82,6 +89,7 @@ const DSDialog = props => {
|
|
|
82
89
|
|
|
83
90
|
if (isOpen) {
|
|
84
91
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx(StyledDialogBackground, {
|
|
92
|
+
className: className,
|
|
85
93
|
onClick: handleOutsideClick,
|
|
86
94
|
"data-portalbg": true,
|
|
87
95
|
"data-testid": DSDialogDatatestid.BACKGROUND,
|
|
@@ -97,8 +105,7 @@ const DSDialog = props => {
|
|
|
97
105
|
size: size,
|
|
98
106
|
centered: centered,
|
|
99
107
|
"data-testid": DSDialogDatatestid.CONTAINER
|
|
100
|
-
},
|
|
101
|
-
onKeyDown: handleOnKeyDown,
|
|
108
|
+
}, restOfGlobalAttributes), {}, {
|
|
102
109
|
children: children
|
|
103
110
|
}))), document.getElementsByTagName('body')[0]);
|
|
104
111
|
}
|
package/esm/propTypes.js
CHANGED
|
@@ -10,14 +10,13 @@ import { DSDialogSizesArrayValues, DSDialogSizes } from './utils.js';
|
|
|
10
10
|
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; }
|
|
11
11
|
|
|
12
12
|
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(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; }
|
|
13
|
-
const propTypes = _objectSpread(_objectSpread({
|
|
13
|
+
const propTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
|
|
14
14
|
isOpen: PropTypes.bool.description('Whether the Dialog is open or not.').defaultValue(false),
|
|
15
15
|
children: PropTypes.node.description('Nested components.').isRequired,
|
|
16
16
|
centered: PropTypes.bool.description('Centers the Dialog.').defaultValue(false),
|
|
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
|
-
onClose: PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {})
|
|
20
|
-
}, globalAttributesPropTypes), {}, {
|
|
19
|
+
onClose: PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),
|
|
21
20
|
size: PropTypes.oneOf(DSDialogSizesArrayValues).description("Dialog's width size.").defaultValue(DSDialogSizes.DEFAULT)
|
|
22
21
|
});
|
|
23
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dialog",
|
|
3
|
-
"version": "2.3.0-next.
|
|
3
|
+
"version": "2.3.0-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dialog",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"build": "node ../../scripts/build/build.js"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@elliemae/ds-props-helpers": "2.3.0-next.
|
|
64
|
-
"@elliemae/ds-system": "2.3.0-next.
|
|
63
|
+
"@elliemae/ds-props-helpers": "2.3.0-next.10",
|
|
64
|
+
"@elliemae/ds-system": "2.3.0-next.10",
|
|
65
65
|
"@xstyled/styled-components": "~3.1.1",
|
|
66
66
|
"react-desc": "~4.1.3"
|
|
67
67
|
},
|