@elliemae/ds-dialog 2.3.0-next.1 → 2.3.0-next.14

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 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,19 +61,25 @@ 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
- if (globalAttributes.onKeyDown) globalAttributes.onKeyDown(e);
69
- }, [globalAttributes, onClose]);
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
 
73
80
  const body = document.getElementsByTagName('body')[0];
74
81
  const {
75
- offsetHeight,
82
+ clientHeight,
76
83
  scrollHeight
77
84
  } = body;
78
85
  const padding = (_window$getComputedSt = window.getComputedStyle(body, null)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue('padding-right');
@@ -81,7 +88,7 @@ const DSDialog = props => {
81
88
  padding: '0px'
82
89
  });
83
90
  return setBodyInfo({
84
- overflow: offsetHeight < scrollHeight,
91
+ overflow: scrollHeight > clientHeight,
85
92
  padding
86
93
  });
87
94
  }, [isOpen]);
@@ -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
- }, globalAttributes), {}, {
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,19 +50,25 @@ 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
- if (globalAttributes.onKeyDown) globalAttributes.onKeyDown(e);
58
- }, [globalAttributes, onClose]);
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
 
62
69
  const body = document.getElementsByTagName('body')[0];
63
70
  const {
64
- offsetHeight,
71
+ clientHeight,
65
72
  scrollHeight
66
73
  } = body;
67
74
  const padding = (_window$getComputedSt = window.getComputedStyle(body, null)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue('padding-right');
@@ -70,7 +77,7 @@ const DSDialog = props => {
70
77
  padding: '0px'
71
78
  });
72
79
  return setBodyInfo({
73
- overflow: offsetHeight < scrollHeight,
80
+ overflow: scrollHeight > clientHeight,
74
81
  padding
75
82
  });
76
83
  }, [isOpen]);
@@ -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
- }, globalAttributes), {}, {
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.1",
3
+ "version": "2.3.0-next.14",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Dialog",
6
6
  "module": "./esm/index.js",
@@ -60,8 +60,10 @@
60
60
  "build": "node ../../scripts/build/build.js"
61
61
  },
62
62
  "dependencies": {
63
- "@elliemae/ds-props-helpers": "2.3.0-next.1",
64
- "@elliemae/ds-system": "2.3.0-next.1",
63
+ "@elliemae/ds-button": "2.3.0-next.14",
64
+ "@elliemae/ds-icons": "2.3.0-next.14",
65
+ "@elliemae/ds-props-helpers": "2.3.0-next.14",
66
+ "@elliemae/ds-system": "2.3.0-next.14",
65
67
  "@xstyled/styled-components": "~3.1.1",
66
68
  "react-desc": "~4.1.3"
67
69
  },