@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 +15 -0
- package/cjs/components/ContentLoader/IconsLoader.js +31 -23
- package/cjs/components/FormField/FormField.js +1 -1
- package/cjs/components/Toast/Toast.js +1 -1
- package/cjs/index.js +1 -1
- package/dist/plesk-ui-library-rtl.css +1 -1
- package/dist/plesk-ui-library-rtl.css.map +1 -1
- package/dist/plesk-ui-library.css +1 -1
- package/dist/plesk-ui-library.css.map +1 -1
- package/dist/plesk-ui-library.js +32 -24
- package/dist/plesk-ui-library.js.map +1 -1
- package/dist/plesk-ui-library.min.js +2 -2
- package/dist/plesk-ui-library.min.js.map +1 -1
- package/esm/components/ContentLoader/IconsLoader.js +31 -23
- package/esm/components/FormField/FormField.js +1 -1
- package/esm/components/Toast/Toast.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/styleguide/build/{bundle.2a86713c.js → bundle.73fec982.js} +2 -2
- package/styleguide/build/{bundle.2a86713c.js.LICENSE.txt → bundle.73fec982.js.LICENSE.txt} +0 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/ContentLoader/IconsLoader.d.ts +6 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
// Copyright 1999-
|
|
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
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
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 =
|
|
54
|
-
if (syncRef.current ===
|
|
55
|
-
syncRef.current
|
|
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:
|
|
66
|
-
},
|
|
67
|
-
|
|
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:
|
|
72
|
-
},
|
|
73
|
-
|
|
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-
|
|
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