@zohodesk/components 1.5.7 → 1.5.8
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 +4 -0
- package/es/Modal/Portal/Portal.js +11 -10
- package/lib/Modal/Portal/Portal.js +17 -10
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.5.8
|
|
6
|
+
|
|
7
|
+
- Memoized **Portal** logic to improve performance.
|
|
8
|
+
|
|
5
9
|
# 1.5.7
|
|
6
10
|
|
|
7
11
|
- **ListContainer, ListItem, ListItemWithIcon**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
import BasePortal from '@zohodesk/dotkit/es/react/components/Portal/Portal';
|
|
3
3
|
import { getLibraryConfig } from "../../Provider/Config";
|
|
4
4
|
import { defaultProps } from "./props/defaultProps";
|
|
@@ -8,13 +8,11 @@ export default function Portal(_ref) {
|
|
|
8
8
|
children,
|
|
9
9
|
portalId
|
|
10
10
|
} = _ref;
|
|
11
|
-
const
|
|
11
|
+
const getPortalContainer = useCallback(() => {
|
|
12
|
+
const getConfigPortalContainer = getLibraryConfig('getPortalContainer');
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (getPortalContainer && typeof getPortalContainer === 'function') {
|
|
17
|
-
const portal = getPortalContainer();
|
|
14
|
+
if (getConfigPortalContainer && typeof getConfigPortalContainer === 'function') {
|
|
15
|
+
const portal = getConfigPortalContainer();
|
|
18
16
|
|
|
19
17
|
if (portal) {
|
|
20
18
|
return portal;
|
|
@@ -22,10 +20,13 @@ export default function Portal(_ref) {
|
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
return null;
|
|
25
|
-
};
|
|
26
|
-
|
|
23
|
+
}, []);
|
|
24
|
+
const memoizedPortalId = useMemo(() => {
|
|
25
|
+
const portalPrefix = getLibraryConfig("portalPrefix");
|
|
26
|
+
return `${portalPrefix ? `${portalPrefix}` : ''}${portalId}`;
|
|
27
|
+
}, [portalId]);
|
|
27
28
|
return /*#__PURE__*/React.createElement(BasePortal, {
|
|
28
|
-
portalId:
|
|
29
|
+
portalId: memoizedPortalId,
|
|
29
30
|
getFallbackElement: getPortalContainer
|
|
30
31
|
}, children);
|
|
31
32
|
}
|
|
@@ -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"] = Portal;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _Portal = _interopRequireDefault(require("@zohodesk/dotkit/es/react/components/Portal/Portal"));
|
|
11
13
|
|
|
@@ -17,16 +19,18 @@ var _propTypes = require("./props/propTypes");
|
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
20
26
|
function Portal(_ref) {
|
|
21
27
|
var children = _ref.children,
|
|
22
28
|
portalId = _ref.portalId;
|
|
23
|
-
var
|
|
29
|
+
var getPortalContainer = (0, _react.useCallback)(function () {
|
|
30
|
+
var getConfigPortalContainer = (0, _Config.getLibraryConfig)('getPortalContainer');
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (getPortalContainer && typeof getPortalContainer === 'function') {
|
|
29
|
-
var portal = getPortalContainer();
|
|
32
|
+
if (getConfigPortalContainer && typeof getConfigPortalContainer === 'function') {
|
|
33
|
+
var portal = getConfigPortalContainer();
|
|
30
34
|
|
|
31
35
|
if (portal) {
|
|
32
36
|
return portal;
|
|
@@ -34,10 +38,13 @@ function Portal(_ref) {
|
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
return null;
|
|
37
|
-
};
|
|
38
|
-
|
|
41
|
+
}, []);
|
|
42
|
+
var memoizedPortalId = (0, _react.useMemo)(function () {
|
|
43
|
+
var portalPrefix = (0, _Config.getLibraryConfig)("portalPrefix");
|
|
44
|
+
return "".concat(portalPrefix ? "".concat(portalPrefix) : '').concat(portalId);
|
|
45
|
+
}, [portalId]);
|
|
39
46
|
return /*#__PURE__*/_react["default"].createElement(_Portal["default"], {
|
|
40
|
-
portalId:
|
|
47
|
+
portalId: memoizedPortalId,
|
|
41
48
|
getFallbackElement: getPortalContainer
|
|
42
49
|
}, children);
|
|
43
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -67,20 +67,22 @@
|
|
|
67
67
|
"css:layer_generate_order": "node ./node_modules/@zohodesk-private/node-plugins/es/css_layer_generator/generate_layer_order.js css_layer_config.json ./src/components_layer.module.css",
|
|
68
68
|
"css:layer_config_validate": "node ./node_modules/@zohodesk-private/node-plugins/es/css_layer_generator/validate.js css_layer_config.json ./src/ ./assets",
|
|
69
69
|
"css:build": "npm run css:layer_config_validate && npm run css:layer_generate_order && npm run build && npm run rtl && npm run cssVariableConvert ",
|
|
70
|
-
"css:layer_remove": "node ./node_modules/@zohodesk-private/node-plugins/es/css_layer_generator/remove_layer.js ./es ./assets css_layer_config.json --rewrite=src=es --rewrite=assets=assets"
|
|
70
|
+
"css:layer_remove": "node ./node_modules/@zohodesk-private/node-plugins/es/css_layer_generator/remove_layer.js ./es ./assets css_layer_config.json --rewrite=src=es --rewrite=assets=assets",
|
|
71
|
+
"css:audit": " css-audit --report"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
74
|
"@testing-library/jest-dom": "^5.11.9",
|
|
74
75
|
"@testing-library/react": "^11.2.5",
|
|
75
76
|
"@testing-library/react-hooks": "^7.0.2",
|
|
76
77
|
"@testing-library/user-event": "^13.0.10",
|
|
78
|
+
"@zohodesk-private/css-audit-tool": "0.0.1",
|
|
77
79
|
"@zohodesk-private/color-variable-preprocessor": "1.2.0",
|
|
78
80
|
"@zohodesk-private/css-variable-migrator": "1.0.9",
|
|
79
81
|
"@zohodesk-private/node-plugins": "1.1.13",
|
|
80
82
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
81
83
|
"@zohodesk/a11y": "2.3.8",
|
|
82
84
|
"@zohodesk/docstool": "1.0.0-alpha-2",
|
|
83
|
-
"@zohodesk/dotkit": "1.0.
|
|
85
|
+
"@zohodesk/dotkit": "1.0.7",
|
|
84
86
|
"@zohodesk/hooks": "2.0.6",
|
|
85
87
|
"@zohodesk/icons": "1.1.6",
|
|
86
88
|
"@zohodesk/layout": "3.1.0",
|
|
@@ -110,7 +112,7 @@
|
|
|
110
112
|
"@zohodesk/utils": "1.3.16",
|
|
111
113
|
"@zohodesk/a11y": "2.3.8",
|
|
112
114
|
"@zohodesk/layout": "3.1.0",
|
|
113
|
-
"@zohodesk/dotkit": "1.0.
|
|
115
|
+
"@zohodesk/dotkit": "1.0.7",
|
|
114
116
|
"color": "4.2.3"
|
|
115
117
|
}
|
|
116
118
|
}
|