@zohodesk/components 1.6.17 → 1.6.19

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/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
4
4
 
5
+ # 1.6.19
6
+
7
+ - **DropBoxElement**
8
+ - `getSubContainerRef` prop supported to get the sub-container element reference.
9
+ - **Popup**
10
+ - Popup Unmount Memory Leak Issue Resolved .
11
+
12
+ # 1.6.18
13
+
14
+ - buttonComponentVersion temproary support given in LibraryContext , will remove once app is migrated
15
+
5
16
  # 1.6.17
6
17
 
7
18
  - Updated `@zohodesk-private/color-variable-preprocessor@1.3.3` package version - CTA category overridden variables are now generated only for the necessary CTA variables using the `buildOverriddenCTACategories` function.
@@ -23,8 +23,15 @@ export default function DropBox(props) {
23
23
  isRestrictScroll,
24
24
  needFocusScope,
25
25
  onClose,
26
- customProps
26
+ customProps,
27
+ getSubContainerRef
27
28
  } = props;
29
+
30
+ const setDropBoxRef = ele => {
31
+ getSubContainerRef && getSubContainerRef(ele);
32
+ dropBoxRef.current = ele;
33
+ };
34
+
28
35
  const {
29
36
  focusScopeProps = {}
30
37
  } = customProps;
@@ -55,10 +62,10 @@ export default function DropBox(props) {
55
62
  direction: direction
56
63
  }, props, {
57
64
  zIndexStyle: zIndexStyle,
58
- subContainerRef: dropBoxRef
65
+ getSubContainerRef: setDropBoxRef
59
66
  }))) : /*#__PURE__*/React.createElement(DropBoxElement, _extends({
60
67
  isModel: isModel,
61
- subContainerRef: dropBoxRef,
68
+ getSubContainerRef: setDropBoxRef,
62
69
  direction: direction
63
70
  }, props, {
64
71
  zIndexStyle: zIndexStyle
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/no-unknown-property */
2
- import React from 'react';
2
+ import React, { useRef, useCallback } from 'react';
3
3
  import useDropboxPosCalc from "./useDropboxPosCalc";
4
4
  import cssJSLogic from "./css/cssJSLogic";
5
5
  import { positionMapping } from '@zohodesk/dotkit/es/react/components/Popup/utils/positioning';
@@ -27,13 +27,15 @@ export default function DropBoxElement(props) {
27
27
  tabIndex,
28
28
  palette,
29
29
  subContainerRef,
30
+ getSubContainerRef,
30
31
  customStyle,
31
32
  animationStyle
32
33
  } = props;
33
34
  let isAbsolute = isAbsolutePositioningNeeded;
35
+ const internalSubContainerRef = useRef(null);
34
36
 
35
37
  const FireOnAnimationEnd = () => {
36
- let eleClassList = subContainerRef && subContainerRef.current.classList;
38
+ let eleClassList = internalSubContainerRef.current && internalSubContainerRef.current.classList;
37
39
  let animationStyles = animationStyle == 'default' ? style.fadeInScale : style[animationStyle];
38
40
  animationStyles.split(' ').map(rmStyle => {
39
41
  if (eleClassList && eleClassList.contains(rmStyle)) {
@@ -54,6 +56,16 @@ export default function DropBoxElement(props) {
54
56
  }
55
57
  };
56
58
 
59
+ const setSubContainerRef = useCallback(ele => {
60
+ internalSubContainerRef.current = ele; // Backward compatability: legacy `subContainerRef`.
61
+
62
+ if (subContainerRef) {
63
+ subContainerRef.current = ele;
64
+ }
65
+
66
+ getSubContainerRef && getSubContainerRef(ele);
67
+ }, [subContainerRef, getSubContainerRef]);
68
+
57
69
  if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
58
70
  isAbsolute = true;
59
71
  }
@@ -120,7 +132,7 @@ export default function DropBoxElement(props) {
120
132
  "data-id": `${dataId}_subcontainer`,
121
133
  "data-test-id": `${dataId}_subcontainer`,
122
134
  "data-selector-id": `${dataSelectorId}_subcontainer`,
123
- ref: subContainerRef
135
+ ref: setSubContainerRef
124
136
  }, isModel ? /*#__PURE__*/React.createElement("div", {
125
137
  className: style.closeBar
126
138
  }) : null, isArrow && !isModel && /*#__PURE__*/React.createElement("div", {
@@ -47,5 +47,6 @@ export const DropBoxElementPropTypes = {
47
47
  positionsOffset: PropTypes.object,
48
48
  targetOffset: PropTypes.object,
49
49
  zIndexStyle: PropTypes.object,
50
- subContainerRef: PropTypes.func
50
+ subContainerRef: PropTypes.func,
51
+ getSubContainerRef: PropTypes.func
51
52
  };
@@ -12,7 +12,8 @@ const LibraryContextProvider = ({
12
12
  shouldStrikeThroughDisabledButton,
13
13
  labelRequiredType,
14
14
  shouldHighlightRequiredLabel,
15
- children
15
+ children,
16
+ buttonComponentVersion
16
17
  }) => {
17
18
  const [value, setValue] = useState({
18
19
  isReducedMotion,
@@ -21,6 +22,7 @@ const LibraryContextProvider = ({
21
22
  hasTagColorInheritedToText,
22
23
  shouldIndicateSwitchState,
23
24
  shouldStrikeThroughDisabledButton,
25
+ buttonComponentVersion,
24
26
  labelRequiredType,
25
27
  shouldHighlightRequiredLabel
26
28
  });
@@ -48,6 +50,7 @@ LibraryContextProvider.propTypes = {
48
50
  direction: PropTypes.string,
49
51
  shouldIndicateSwitchState: PropTypes.bool,
50
52
  shouldStrikeThroughDisabledButton: PropTypes.bool,
53
+ buttonComponentVersion: PropTypes.oneOf(['default', 'v1']),
51
54
  labelRequiredType: PropTypes.oneOf(['asterisk', 'text']),
52
55
  shouldHighlightRequiredLabel: PropTypes.bool
53
56
  };
@@ -58,6 +61,7 @@ LibraryContextProvider.defaultProps = {
58
61
  hasTagColorInheritedToText: true,
59
62
  shouldIndicateSwitchState: false,
60
63
  shouldStrikeThroughDisabledButton: false,
64
+ buttonComponentVersion: 'v1',
61
65
  labelRequiredType: 'asterisk',
62
66
  shouldHighlightRequiredLabel: true
63
67
  };
@@ -47,7 +47,14 @@ function DropBox(props) {
47
47
  isRestrictScroll = props.isRestrictScroll,
48
48
  needFocusScope = props.needFocusScope,
49
49
  onClose = props.onClose,
50
- customProps = props.customProps;
50
+ customProps = props.customProps,
51
+ getSubContainerRef = props.getSubContainerRef;
52
+
53
+ var setDropBoxRef = function setDropBoxRef(ele) {
54
+ getSubContainerRef && getSubContainerRef(ele);
55
+ dropBoxRef.current = ele;
56
+ };
57
+
51
58
  var _customProps$focusSco = customProps.focusScopeProps,
52
59
  focusScopeProps = _customProps$focusSco === void 0 ? {} : _customProps$focusSco;
53
60
  var _focusScopeProps$need = focusScopeProps.needAutoFocus,
@@ -82,10 +89,10 @@ function DropBox(props) {
82
89
  direction: direction
83
90
  }, props, {
84
91
  zIndexStyle: zIndexStyle,
85
- subContainerRef: dropBoxRef
92
+ getSubContainerRef: setDropBoxRef
86
93
  }))) : /*#__PURE__*/_react["default"].createElement(_DropBoxElement["default"], _extends({
87
94
  isModel: isModel,
88
- subContainerRef: dropBoxRef,
95
+ getSubContainerRef: setDropBoxRef,
89
96
  direction: direction
90
97
  }, props, {
91
98
  zIndexStyle: zIndexStyle
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = DropBoxElement;
7
9
 
8
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
9
11
 
10
12
  var _useDropboxPosCalc2 = _interopRequireDefault(require("./useDropboxPosCalc"));
11
13
 
@@ -23,6 +25,10 @@ var _DropBoxElementModule = _interopRequireDefault(require("./css/DropBoxElement
23
25
 
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
27
 
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
26
32
  /* eslint-disable react/no-unknown-property */
27
33
  function DropBoxElement(props) {
28
34
  var children = props.children,
@@ -43,12 +49,14 @@ function DropBoxElement(props) {
43
49
  tabIndex = props.tabIndex,
44
50
  palette = props.palette,
45
51
  subContainerRef = props.subContainerRef,
52
+ getSubContainerRef = props.getSubContainerRef,
46
53
  customStyle = props.customStyle,
47
54
  animationStyle = props.animationStyle;
48
55
  var isAbsolute = isAbsolutePositioningNeeded;
56
+ var internalSubContainerRef = (0, _react.useRef)(null);
49
57
 
50
58
  var FireOnAnimationEnd = function FireOnAnimationEnd() {
51
- var eleClassList = subContainerRef && subContainerRef.current.classList;
59
+ var eleClassList = internalSubContainerRef.current && internalSubContainerRef.current.classList;
52
60
  var animationStyles = animationStyle == 'default' ? _DropBoxElementModule["default"].fadeInScale : _DropBoxElementModule["default"][animationStyle];
53
61
  animationStyles.split(' ').map(function (rmStyle) {
54
62
  if (eleClassList && eleClassList.contains(rmStyle)) {
@@ -67,6 +75,16 @@ function DropBoxElement(props) {
67
75
  }
68
76
  };
69
77
 
78
+ var setSubContainerRef = (0, _react.useCallback)(function (ele) {
79
+ internalSubContainerRef.current = ele; // Backward compatability: legacy `subContainerRef`.
80
+
81
+ if (subContainerRef) {
82
+ subContainerRef.current = ele;
83
+ }
84
+
85
+ getSubContainerRef && getSubContainerRef(ele);
86
+ }, [subContainerRef, getSubContainerRef]);
87
+
70
88
  if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
71
89
  isAbsolute = true;
72
90
  }
@@ -132,7 +150,7 @@ function DropBoxElement(props) {
132
150
  "data-id": "".concat(dataId, "_subcontainer"),
133
151
  "data-test-id": "".concat(dataId, "_subcontainer"),
134
152
  "data-selector-id": "".concat(dataSelectorId, "_subcontainer"),
135
- ref: subContainerRef
153
+ ref: setSubContainerRef
136
154
  }, isModel ? /*#__PURE__*/_react["default"].createElement("div", {
137
155
  className: _DropBoxElementModule["default"].closeBar
138
156
  }) : null, isArrow && !isModel && /*#__PURE__*/_react["default"].createElement("div", {
@@ -57,6 +57,7 @@ var DropBoxElementPropTypes = {
57
57
  positionsOffset: _propTypes["default"].object,
58
58
  targetOffset: _propTypes["default"].object,
59
59
  zIndexStyle: _propTypes["default"].object,
60
- subContainerRef: _propTypes["default"].func
60
+ subContainerRef: _propTypes["default"].func,
61
+ getSubContainerRef: _propTypes["default"].func
61
62
  };
62
63
  exports.DropBoxElementPropTypes = DropBoxElementPropTypes;
@@ -48,7 +48,8 @@ var LibraryContextProvider = function LibraryContextProvider(_ref) {
48
48
  shouldStrikeThroughDisabledButton = _ref.shouldStrikeThroughDisabledButton,
49
49
  labelRequiredType = _ref.labelRequiredType,
50
50
  shouldHighlightRequiredLabel = _ref.shouldHighlightRequiredLabel,
51
- children = _ref.children;
51
+ children = _ref.children,
52
+ buttonComponentVersion = _ref.buttonComponentVersion;
52
53
 
53
54
  var _useState = (0, _react.useState)({
54
55
  isReducedMotion: isReducedMotion,
@@ -57,6 +58,7 @@ var LibraryContextProvider = function LibraryContextProvider(_ref) {
57
58
  hasTagColorInheritedToText: hasTagColorInheritedToText,
58
59
  shouldIndicateSwitchState: shouldIndicateSwitchState,
59
60
  shouldStrikeThroughDisabledButton: shouldStrikeThroughDisabledButton,
61
+ buttonComponentVersion: buttonComponentVersion,
60
62
  labelRequiredType: labelRequiredType,
61
63
  shouldHighlightRequiredLabel: shouldHighlightRequiredLabel
62
64
  }),
@@ -85,6 +87,7 @@ LibraryContextProvider.propTypes = {
85
87
  direction: _propTypes["default"].string,
86
88
  shouldIndicateSwitchState: _propTypes["default"].bool,
87
89
  shouldStrikeThroughDisabledButton: _propTypes["default"].bool,
90
+ buttonComponentVersion: _propTypes["default"].oneOf(['default', 'v1']),
88
91
  labelRequiredType: _propTypes["default"].oneOf(['asterisk', 'text']),
89
92
  shouldHighlightRequiredLabel: _propTypes["default"].bool
90
93
  };
@@ -95,6 +98,7 @@ LibraryContextProvider.defaultProps = {
95
98
  hasTagColorInheritedToText: true,
96
99
  shouldIndicateSwitchState: false,
97
100
  shouldStrikeThroughDisabledButton: false,
101
+ buttonComponentVersion: 'v1',
98
102
  labelRequiredType: 'asterisk',
99
103
  shouldHighlightRequiredLabel: true
100
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.6.17",
3
+ "version": "1.6.19",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -76,15 +76,15 @@
76
76
  "@dot-system/css-audit-tool": "1.0.0",
77
77
  "@zohodesk-private/color-variable-preprocessor": "1.3.3",
78
78
  "@zohodesk-private/css-variable-migrator": "1.0.11",
79
- "@zohodesk-private/node-plugins": "1.1.14",
79
+ "@zohodesk-private/node-plugins": "1.1.15",
80
80
  "@zohodesk-private/react-prop-validator": "1.2.3",
81
81
  "@zohodesk/a11y": "2.3.9",
82
82
  "@zohodesk/docstool": "1.0.0-alpha-2",
83
- "@zohodesk/dotkit": "1.0.9",
83
+ "@zohodesk/dotkit": "1.0.10",
84
84
  "@zohodesk/hooks": "2.0.8",
85
- "@zohodesk/icons": "1.3.3",
85
+ "@zohodesk/icons": "1.3.6",
86
86
  "@zohodesk/layout": "3.2.0",
87
- "@zohodesk/svg": "1.3.6",
87
+ "@zohodesk/svg": "1.3.8",
88
88
  "@zohodesk/utils": "1.3.16",
89
89
  "@zohodesk/variables": "1.3.2",
90
90
  "@zohodesk/virtualizer": "1.0.13",
@@ -103,9 +103,9 @@
103
103
  "selectn": "1.1.2"
104
104
  },
105
105
  "peerDependencies": {
106
- "@zohodesk/icons": "1.3.3",
106
+ "@zohodesk/icons": "1.3.6",
107
107
  "@zohodesk/variables": "1.3.2",
108
- "@zohodesk/svg": "1.3.6",
108
+ "@zohodesk/svg": "1.3.8",
109
109
  "@zohodesk/virtualizer": "1.0.13",
110
110
  "velocity-react": "1.4.3",
111
111
  "react-sortable-hoc": "^0.8.3",
@@ -113,7 +113,7 @@
113
113
  "@zohodesk/utils": "1.3.16",
114
114
  "@zohodesk/a11y": "2.3.9",
115
115
  "@zohodesk/layout": "3.2.0",
116
- "@zohodesk/dotkit": "1.0.9",
116
+ "@zohodesk/dotkit": "1.0.10",
117
117
  "color": "4.2.3",
118
118
  "@dot-system/css-utility": "0.1.1"
119
119
  }