@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.
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- // Copyright 1999-2020. Plesk International GmbH. All rights reserved.
2
+ // Copyright 1999-2022. Plesk International GmbH. All rights reserved.
3
3
  import React, { useEffect, useRef, useState } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import Icon from '../Icon';
6
6
  import { CLS_PREFIX } from '../../constants';
7
7
  const DEFAULT_ICONS = ['clock', 'emoticon-smile', 'rocket', 'sand-clock', 'sleep', 'web', 'star'];
8
8
 
9
- const useIcon = (icons, initialCursor, isSync) => {
9
+ const useIconCursor = (icons, initialCursor, isSync) => {
10
10
  const targetRef = useRef(null);
11
11
  const [cursor, setCursor] = useState(initialCursor);
12
12
  useEffect(() => {
@@ -28,50 +28,58 @@ const useIcon = (icons, initialCursor, isSync) => {
28
28
  }
29
29
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
30
30
  }, [icons]);
31
- return {
32
- name: icons[cursor],
33
- targetRef
34
- };
31
+ return [icons[cursor], targetRef];
35
32
  };
36
33
 
37
34
  const IconsLoader = ({
38
35
  baseClassName = `${CLS_PREFIX}icons-loader`,
39
36
  className,
40
37
  icons,
38
+ size,
39
+ style,
41
40
  ...props
42
41
  }) => {
43
- const syncRef = useRef(0);
44
- icons = icons && icons.length > 0 ? icons : DEFAULT_ICONS;
45
- const icon1 = useIcon(icons, 0, () => {
46
- if (syncRef.current === 0) {
47
- syncRef.current += 1;
42
+ var _icons;
43
+
44
+ const syncRef = useRef('icon1');
45
+
46
+ if (!((_icons = icons) !== null && _icons !== void 0 && _icons.length)) {
47
+ icons = DEFAULT_ICONS;
48
+ } else if (icons.length === 1) {
49
+ icons = [icons[0], icons[0]];
50
+ }
51
+
52
+ const [icon1, icon1Ref] = useIconCursor(icons, 0, () => {
53
+ if (syncRef.current === 'icon1') {
54
+ syncRef.current = 'icon2';
48
55
  return true;
49
56
  }
50
57
 
51
58
  return false;
52
59
  });
53
- const icon2 = useIcon(icons, 1, () => {
54
- if (syncRef.current === 1) {
55
- syncRef.current -= 1;
60
+ const [icon2, icon2Ref] = useIconCursor(icons, 1, () => {
61
+ if (syncRef.current === 'icon2') {
62
+ syncRef.current = 'icon1';
56
63
  return true;
57
64
  }
58
65
 
59
66
  return false;
60
67
  });
61
68
  return /*#__PURE__*/React.createElement("div", _extends({
62
- className: classNames(baseClassName, className)
69
+ className: classNames(baseClassName, className),
70
+ style: { ...style,
71
+ ['--icons-loader-size']: size ? size : undefined
72
+ }
63
73
  }, props), /*#__PURE__*/React.createElement("div", {
64
74
  className: classNames(`${baseClassName}__icon`, `${baseClassName}__icon--1`),
65
- ref: icon1.targetRef
66
- }, /*#__PURE__*/React.createElement(Icon, {
67
- name: icon1.name,
68
- size: "64"
75
+ ref: icon1Ref
76
+ }, Icon.create(icon1, {
77
+ size: size ? size : '64'
69
78
  })), /*#__PURE__*/React.createElement("div", {
70
79
  className: classNames(`${baseClassName}__icon`, `${baseClassName}__icon--2`),
71
- ref: icon2.targetRef
72
- }, /*#__PURE__*/React.createElement(Icon, {
73
- name: icon2.name,
74
- size: "64"
80
+ ref: icon2Ref
81
+ }, Icon.create(icon2, {
82
+ size: size ? size : '64'
75
83
  })));
76
84
  };
77
85
 
@@ -199,7 +199,7 @@ class FormField extends Component {
199
199
  multi
200
200
  } = this.props;
201
201
 
202
- if (!description || multi && this.fieldApi.getValue().length - 1 > index) {
202
+ if (!description || multi && getArrayHelper(this.fieldApi.getValue()).length - 1 > index) {
203
203
  return null;
204
204
  }
205
205
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- // Copyright 1999-2020. Plesk International GmbH. All rights reserved.
3
+ // Copyright 1999-2022. Plesk International GmbH. All rights reserved.
4
4
  import React, { Component } from 'react';
5
5
  import classNames from 'classnames';
6
6
  import { CLS_PREFIX } from '../../constants';
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Copyright 1999-2018. Plesk International GmbH. All rights reserved.
2
2
  import svg4everybody from 'svg4everybody';
3
- const version = "3.29.0";
3
+ const version = "3.29.1";
4
4
  export * from './publicPath';
5
5
  export { version };
6
6
  export * from './utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plesk/ui-library",
3
- "version": "3.29.0",
3
+ "version": "3.29.1",
4
4
  "description": "Plesk UI Library",
5
5
  "main": "index.js",
6
6
  "module": "esm/index.js",