@zohodesk/components 1.5.6 → 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 CHANGED
@@ -2,6 +2,15 @@
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
+
9
+ # 1.5.7
10
+
11
+ - **ListContainer, ListItem, ListItemWithIcon**
12
+ - `danger` value supported for the **palette** prop.
13
+
5
14
  # 1.5.6
6
15
 
7
16
  - **ListItemWithRadio, ListItemWithCheckBox**
@@ -183,6 +183,8 @@
183
183
  --zdt_listitem_active_border: var(--zdt_cta_primary_border);
184
184
  --zdt_listitem_primary_bg: var(--dot_listItemActive);
185
185
  --zdt_listitem_secondary_bg: var(--zdtm_cta_primary_bg_default);
186
+ --zdt_listitem_danger_bg: rgba(255, 107, 107, 0.05);
187
+ --zdt_listitem_danger_text: hsla(0, 100.00%, calc(70.98% + var(--zdc_default_inverse_lower)), calc(1 + var(--zdc_alpha_low)));
186
188
  --zdt_listitem_secondary_text: hsla(0, 0.00%, calc(12.94% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
187
189
 
188
190
  /* ribbon */
@@ -183,6 +183,8 @@
183
183
  --zdt_listitem_active_border: var(--zdt_cta_primary_border);
184
184
  --zdt_listitem_primary_bg: var(--dot_listItemActive);
185
185
  --zdt_listitem_secondary_bg: var(--zdtm_cta_primary_bg_default);
186
+ --zdt_listitem_danger_bg: rgb(253,243,243);
187
+ --zdt_listitem_danger_text: hsla(0, 71.91%, calc(53.92% + var(--zdc_default_inverse_lower)), calc(1 + var(--zdc_alpha_low)));
186
188
  --zdt_listitem_secondary_text: hsla(0, 0.00%, calc(100.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
187
189
 
188
190
  /* ribbon */
@@ -183,6 +183,8 @@
183
183
  --zdt_listitem_active_border: var(--zdt_cta_primary_border);
184
184
  --zdt_listitem_primary_bg: var(--dot_listItemActive);
185
185
  --zdt_listitem_secondary_bg: var(--zdtm_cta_primary_bg_default);
186
+ --zdt_listitem_danger_bg: rgba(255, 107, 107, 0.05);
187
+ --zdt_listitem_danger_text: hsla(0, 100.00%, calc(70.98% + var(--zdc_default_inverse_lower)), calc(1 + var(--zdc_alpha_low)));
186
188
  --zdt_listitem_secondary_text: hsla(0, 0.00%, calc(12.94% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
187
189
 
188
190
  /* ribbon */
@@ -136,7 +136,7 @@
136
136
  .lhsBox_large {
137
137
  max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size15)); /* 15px = listitem min-height - (top + bottom padding) - doubleLine content height */
138
138
  }
139
- .defaultHover, .primaryHover, .secondaryHover, .darkHover {
139
+ .defaultHover, .primaryHover, .dangerHover, .secondaryHover, .darkHover {
140
140
  background-color: var(--listitem_highlight_bg_color);
141
141
  }
142
142
  .activewithBorder {
@@ -155,6 +155,13 @@
155
155
  {
156
156
  --listitem_bg_color: var(--zdt_listitem_highlight_bg);
157
157
  }
158
+ .activedanger,
159
+ .dangerHover,
160
+ .dangerEffect:hover {
161
+ --listitem_bg_color: var(--zdt_listitem_danger_bg);
162
+ --listitem_highlight_bg_color: var(--zdt_listitem_danger_bg);
163
+ --listitem_text_color: var(--zdt_listitem_danger_text)
164
+ }
158
165
  .primaryHover,
159
166
  .primaryEffect:hover
160
167
  /* .primaryEffect:focus */
@@ -177,7 +184,7 @@
177
184
  --listitem_bg_color: var(--zdt_listitem_dark_effect_bg);
178
185
  --listitem_highlight_bg_color: var(--zdt_listitem_dark_effect_bg);
179
186
  }
180
- .activedefault, .activeprimary, .activesecondary, .activedark {
187
+ .activedefault, .activeprimary, .activedanger, .activesecondary, .activedark {
181
188
  background-color: var(--listitem_active_bg_color);
182
189
  }
183
190
  .activedefault,
@@ -186,6 +193,10 @@
186
193
  .activeprimary:hover {
187
194
  --listitem_active_bg_color: var(--zdt_listitem_primary_bg);
188
195
  }
196
+ .activedanger,
197
+ .activedanger:hover {
198
+ --listitem_active_bg_color: var(--zdt_listitem_danger_bg);
199
+ }
189
200
  .activesecondary {
190
201
  --listitem_active_bg_color: var(--zdt_listitem_secondary_bg);
191
202
  --listitem_text_color: var(--zdt_listitem_secondary_text);
@@ -17,7 +17,7 @@ export const ListContainer_Props = {
17
17
  onClick: PropTypes.func,
18
18
  onMouseEnter: PropTypes.func,
19
19
  onMouseOver: PropTypes.func,
20
- palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'dark']),
20
+ palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
21
21
  size: PropTypes.oneOf(['small', 'medium', 'large']),
22
22
  target: PropTypes.oneOf(['blank', 'self']),
23
23
  title: PropTypes.string,
@@ -48,7 +48,7 @@ export const ListItem_Props = {
48
48
  needTick: PropTypes.bool,
49
49
  onClick: PropTypes.func,
50
50
  onMouseEnter: PropTypes.func,
51
- palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'dark']),
51
+ palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
52
52
  size: PropTypes.oneOf(['small', 'medium', 'large']),
53
53
  target: PropTypes.oneOf(['blank', 'self']),
54
54
  title: PropTypes.string,
@@ -172,7 +172,7 @@ export const ListItemWithIcon_Props = {
172
172
  needTick: PropTypes.bool,
173
173
  onClick: PropTypes.func,
174
174
  onMouseEnter: PropTypes.func,
175
- palette: PropTypes.string,
175
+ palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
176
176
  size: PropTypes.string,
177
177
  title: PropTypes.string,
178
178
  value: PropTypes.string,
@@ -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 portalPrefix = getLibraryConfig("portalPrefix");
11
+ const getPortalContainer = useCallback(() => {
12
+ const getConfigPortalContainer = getLibraryConfig('getPortalContainer');
12
13
 
13
- const getPortalContainer = () => {
14
- const getPortalContainer = getLibraryConfig('getPortalContainer');
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: `${portalPrefix ? `${portalPrefix}` : ''}${portalId}`,
29
+ portalId: memoizedPortalId,
29
30
  getFallbackElement: getPortalContainer
30
31
  }, children);
31
32
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import useDropboxPosCalc from "../../../DropBox/DropBoxElement/useDropboxPosCalc";
3
3
  import cssJSLogic from "../../../DropBox/DropBoxElement/css/cssJSLogic";
4
- import { positionMapping } from "../../../DropBox/DropBoxPositionMapping.js";
4
+ import { positionMapping } from '@zohodesk/dotkit/es/react/components/Popup/utils/positioning';
5
5
  import { DropBoxElementDefaultProps } from "./props/defaultProps";
6
6
  import { DropBoxElementPropTypes } from "./props/propTypes";
7
7
  import { mergeStyle } from '@zohodesk/utils';
@@ -136,7 +136,7 @@
136
136
  .lhsBox_large {
137
137
  max-height: calc(var(--listitem_doubleline_content_height) + var(--zd_size15)); /* 15px = listitem min-height - (top + bottom padding) - doubleLine content height */
138
138
  }
139
- .defaultHover, .primaryHover, .secondaryHover, .darkHover {
139
+ .defaultHover, .primaryHover, .dangerHover, .secondaryHover, .darkHover {
140
140
  background-color: var(--listitem_highlight_bg_color);
141
141
  }
142
142
  .activewithBorder {
@@ -155,6 +155,13 @@
155
155
  {
156
156
  --listitem_bg_color: var(--zdt_listitem_highlight_bg);
157
157
  }
158
+ .activedanger,
159
+ .dangerHover,
160
+ .dangerEffect:hover {
161
+ --listitem_bg_color: var(--zdt_listitem_danger_bg);
162
+ --listitem_highlight_bg_color: var(--zdt_listitem_danger_bg);
163
+ --listitem_text_color: var(--zdt_listitem_danger_text)
164
+ }
158
165
  .primaryHover,
159
166
  .primaryEffect:hover
160
167
  /* .primaryEffect:focus */
@@ -177,7 +184,7 @@
177
184
  --listitem_bg_color: var(--zdt_listitem_dark_effect_bg);
178
185
  --listitem_highlight_bg_color: var(--zdt_listitem_dark_effect_bg);
179
186
  }
180
- .activedefault, .activeprimary, .activesecondary, .activedark {
187
+ .activedefault, .activeprimary, .activedanger, .activesecondary, .activedark {
181
188
  background-color: var(--listitem_active_bg_color);
182
189
  }
183
190
  .activedefault,
@@ -186,6 +193,10 @@
186
193
  .activeprimary:hover {
187
194
  --listitem_active_bg_color: var(--zdt_listitem_primary_bg);
188
195
  }
196
+ .activedanger,
197
+ .activedanger:hover {
198
+ --listitem_active_bg_color: var(--zdt_listitem_danger_bg);
199
+ }
189
200
  .activesecondary {
190
201
  --listitem_active_bg_color: var(--zdt_listitem_secondary_bg);
191
202
  --listitem_text_color: var(--zdt_listitem_secondary_text);
@@ -33,7 +33,7 @@ var ListContainer_Props = {
33
33
  onClick: _propTypes["default"].func,
34
34
  onMouseEnter: _propTypes["default"].func,
35
35
  onMouseOver: _propTypes["default"].func,
36
- palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'dark']),
36
+ palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
37
37
  size: _propTypes["default"].oneOf(['small', 'medium', 'large']),
38
38
  target: _propTypes["default"].oneOf(['blank', 'self']),
39
39
  title: _propTypes["default"].string,
@@ -65,7 +65,7 @@ var ListItem_Props = {
65
65
  needTick: _propTypes["default"].bool,
66
66
  onClick: _propTypes["default"].func,
67
67
  onMouseEnter: _propTypes["default"].func,
68
- palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'dark']),
68
+ palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
69
69
  size: _propTypes["default"].oneOf(['small', 'medium', 'large']),
70
70
  target: _propTypes["default"].oneOf(['blank', 'self']),
71
71
  title: _propTypes["default"].string,
@@ -163,7 +163,7 @@ var ListItemWithIcon_Props = {
163
163
  needTick: _propTypes["default"].bool,
164
164
  onClick: _propTypes["default"].func,
165
165
  onMouseEnter: _propTypes["default"].func,
166
- palette: _propTypes["default"].string,
166
+ palette: _propTypes["default"].oneOf(['default', 'primary', 'secondary', 'dark', 'danger']),
167
167
  size: _propTypes["default"].string,
168
168
  title: _propTypes["default"].string,
169
169
  value: _propTypes["default"].string,
@@ -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 = _interopRequireDefault(require("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 portalPrefix = (0, _Config.getLibraryConfig)("portalPrefix");
29
+ var getPortalContainer = (0, _react.useCallback)(function () {
30
+ var getConfigPortalContainer = (0, _Config.getLibraryConfig)('getPortalContainer');
24
31
 
25
- var getPortalContainer = function getPortalContainer() {
26
- var getPortalContainer = (0, _Config.getLibraryConfig)('getPortalContainer');
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: "".concat(portalPrefix ? "".concat(portalPrefix) : '').concat(portalId),
47
+ portalId: memoizedPortalId,
41
48
  getFallbackElement: getPortalContainer
42
49
  }, children);
43
50
  }
@@ -11,7 +11,7 @@ var _useDropboxPosCalc2 = _interopRequireDefault(require("../../../DropBox/DropB
11
11
 
12
12
  var _cssJSLogic2 = _interopRequireDefault(require("../../../DropBox/DropBoxElement/css/cssJSLogic"));
13
13
 
14
- var _DropBoxPositionMapping = require("../../../DropBox/DropBoxPositionMapping.js");
14
+ var _positioning = require("@zohodesk/dotkit/es/react/components/Popup/utils/positioning");
15
15
 
16
16
  var _defaultProps = require("./props/defaultProps");
17
17
 
@@ -74,13 +74,13 @@ function DropBoxElement(props) {
74
74
  ariaMultiselectable = a11y.ariaMultiselectable,
75
75
  ariaLabelledby = a11y.ariaLabelledby;
76
76
  boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
77
- var boxDirection = _DropBoxPositionMapping.positionMapping[boxPosition].direction;
77
+ var boxDirection = _positioning.positionMapping[boxPosition].direction;
78
78
 
79
79
  if (isAbsolute) {
80
- arrowPosition = arrowPosition ? arrowPosition : _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
81
- boxPosition = _DropBoxPositionMapping.positionMapping[boxPosition].positionStyle;
80
+ arrowPosition = arrowPosition ? arrowPosition : _positioning.positionMapping[boxPosition].arrowPosition;
81
+ boxPosition = _positioning.positionMapping[boxPosition].positionStyle;
82
82
  } else {
83
- arrowPosition = _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
83
+ arrowPosition = _positioning.positionMapping[boxPosition].arrowPosition;
84
84
  }
85
85
 
86
86
  var _useDropboxPosCalc = (0, _useDropboxPosCalc2["default"])(props),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -67,22 +67,24 @@
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.5",
85
+ "@zohodesk/dotkit": "1.0.7",
84
86
  "@zohodesk/hooks": "2.0.6",
85
- "@zohodesk/icons": "1.1.5",
87
+ "@zohodesk/icons": "1.1.6",
86
88
  "@zohodesk/layout": "3.1.0",
87
89
  "@zohodesk/svg": "1.2.6",
88
90
  "@zohodesk/utils": "1.3.16",
@@ -100,7 +102,7 @@
100
102
  "selectn": "1.1.2"
101
103
  },
102
104
  "peerDependencies": {
103
- "@zohodesk/icons": "1.1.5",
105
+ "@zohodesk/icons": "1.1.6",
104
106
  "@zohodesk/variables": "1.2.0",
105
107
  "@zohodesk/svg": "1.2.6",
106
108
  "@zohodesk/virtualizer": "1.0.13",
@@ -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.5",
115
+ "@zohodesk/dotkit": "1.0.7",
114
116
  "color": "4.2.3"
115
117
  }
116
118
  }