@plesk/ui-library 3.29.0 → 3.29.1

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
@@ -33,3 +33,18 @@ function App() {
33
33
 
34
34
  export default App;
35
35
  ```
36
+
37
+ ## Development
38
+
39
+ Sometimes you need to fix UI Library bug that fires in your project using UI Library.
40
+
41
+ There is a way to test dev version of the UI Library with your project. You need to use `yarn link` command,
42
+ but there are some details.
43
+
44
+ * First, you need to run `yarn link` in your UI Library working copy root directory.
45
+ * Then, you need to run `yarn link @plesk/ui-library` in your project working copy root directory.
46
+ * Third. There is a bug with a React library that makes us to do additional steps. Run `yarn link` in your
47
+ project's `node_modules/react` and `node_modules/react-dom` directories.
48
+ * Then, run `yarn link react` and `yarn link react-dom` in your UI Library working copy root directory.
49
+
50
+ So, in this setup, your project will use the dev copy of UI Library. And UI Library will use React from your project.
@@ -21,10 +21,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  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; }
23
23
 
24
- // Copyright 1999-2020. Plesk International GmbH. All rights reserved.
24
+ // Copyright 1999-2022. Plesk International GmbH. All rights reserved.
25
25
  const DEFAULT_ICONS = ['clock', 'emoticon-smile', 'rocket', 'sand-clock', 'sleep', 'web', 'star'];
26
26
 
27
- const useIcon = (icons, initialCursor, isSync) => {
27
+ const useIconCursor = (icons, initialCursor, isSync) => {
28
28
  const targetRef = (0, _react.useRef)(null);
29
29
  const [cursor, setCursor] = (0, _react.useState)(initialCursor);
30
30
  (0, _react.useEffect)(() => {
@@ -46,50 +46,58 @@ const useIcon = (icons, initialCursor, isSync) => {
46
46
  }
47
47
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
48
48
  }, [icons]);
49
- return {
50
- name: icons[cursor],
51
- targetRef
52
- };
49
+ return [icons[cursor], targetRef];
53
50
  };
54
51
 
55
52
  const IconsLoader = ({
56
53
  baseClassName = `${_constants.CLS_PREFIX}icons-loader`,
57
54
  className,
58
55
  icons,
56
+ size,
57
+ style,
59
58
  ...props
60
59
  }) => {
61
- const syncRef = (0, _react.useRef)(0);
62
- icons = icons && icons.length > 0 ? icons : DEFAULT_ICONS;
63
- const icon1 = useIcon(icons, 0, () => {
64
- if (syncRef.current === 0) {
65
- syncRef.current += 1;
60
+ var _icons;
61
+
62
+ const syncRef = (0, _react.useRef)('icon1');
63
+
64
+ if (!((_icons = icons) !== null && _icons !== void 0 && _icons.length)) {
65
+ icons = DEFAULT_ICONS;
66
+ } else if (icons.length === 1) {
67
+ icons = [icons[0], icons[0]];
68
+ }
69
+
70
+ const [icon1, icon1Ref] = useIconCursor(icons, 0, () => {
71
+ if (syncRef.current === 'icon1') {
72
+ syncRef.current = 'icon2';
66
73
  return true;
67
74
  }
68
75
 
69
76
  return false;
70
77
  });
71
- const icon2 = useIcon(icons, 1, () => {
72
- if (syncRef.current === 1) {
73
- syncRef.current -= 1;
78
+ const [icon2, icon2Ref] = useIconCursor(icons, 1, () => {
79
+ if (syncRef.current === 'icon2') {
80
+ syncRef.current = 'icon1';
74
81
  return true;
75
82
  }
76
83
 
77
84
  return false;
78
85
  });
79
86
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
80
- className: (0, _classnames.default)(baseClassName, className)
87
+ className: (0, _classnames.default)(baseClassName, className),
88
+ style: { ...style,
89
+ ['--icons-loader-size']: size ? size : undefined
90
+ }
81
91
  }, props), /*#__PURE__*/_react.default.createElement("div", {
82
92
  className: (0, _classnames.default)(`${baseClassName}__icon`, `${baseClassName}__icon--1`),
83
- ref: icon1.targetRef
84
- }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
85
- name: icon1.name,
86
- size: "64"
93
+ ref: icon1Ref
94
+ }, _Icon.default.create(icon1, {
95
+ size: size ? size : '64'
87
96
  })), /*#__PURE__*/_react.default.createElement("div", {
88
97
  className: (0, _classnames.default)(`${baseClassName}__icon`, `${baseClassName}__icon--2`),
89
- ref: icon2.targetRef
90
- }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
91
- name: icon2.name,
92
- size: "64"
98
+ ref: icon2Ref
99
+ }, _Icon.default.create(icon2, {
100
+ size: size ? size : '64'
93
101
  })));
94
102
  };
95
103
 
@@ -225,7 +225,7 @@ class FormField extends _react.Component {
225
225
  multi
226
226
  } = this.props;
227
227
 
228
- if (!description || multi && this.fieldApi.getValue().length - 1 > index) {
228
+ if (!description || multi && getArrayHelper(this.fieldApi.getValue()).length - 1 > index) {
229
229
  return null;
230
230
  }
231
231
 
@@ -29,7 +29,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
29
 
30
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
31
 
32
- // Copyright 1999-2020. Plesk International GmbH. All rights reserved.
32
+ // Copyright 1999-2022. Plesk International GmbH. All rights reserved.
33
33
  const AUTOCLOSE_TIMEOUT = 6000;
34
34
 
35
35
  class Toast extends _react.Component {
package/cjs/index.js CHANGED
@@ -54,6 +54,6 @@ Object.keys(_components).forEach(function (key) {
54
54
  });
55
55
  });
56
56
  // Copyright 1999-2018. Plesk International GmbH. All rights reserved.
57
- const version = "3.29.0";
57
+ const version = "3.29.1";
58
58
  exports.version = version;
59
59
  (0, _svg4everybody.default)();