@plesk/ui-library 3.29.0 → 3.29.2
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/Drawer/Drawer.js +3 -1
- package/cjs/components/FormField/FormField.js +1 -1
- package/cjs/components/FormFieldText/FormFieldText.js +4 -2
- 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 +39 -27
- 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/Drawer/Drawer.js +3 -1
- package/esm/components/FormField/FormField.js +1 -1
- package/esm/components/FormFieldText/FormFieldText.js +4 -2
- package/esm/components/Toast/Toast.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/styleguide/build/bundle.50b6043f.js +2 -0
- package/styleguide/build/{bundle.2a86713c.js.LICENSE.txt → bundle.50b6043f.js.LICENSE.txt} +0 -0
- package/styleguide/index.html +2 -2
- package/types/src/components/ContentLoader/IconsLoader.d.ts +6 -4
- package/types/src/components/Form/Form.d.ts +168 -2
- package/types/src/components/Form/types.d.ts +1 -97
- package/styleguide/build/bundle.2a86713c.js +0 -2
|
@@ -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
|
|
|
@@ -76,7 +76,9 @@ const propTypes = {
|
|
|
76
76
|
closingConfirmation: PropTypes.bool,
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Wraps children into [Form](#!/Form) if not empty
|
|
79
|
+
* Wraps children into [Form](#!/Form) if not empty.<br>
|
|
80
|
+
* **Note:** in case of *element* you should take care of providing additional form props from [Drawer](#!/Drawer) through your custom component. See example below for more details
|
|
81
|
+
*
|
|
80
82
|
* @since 0.0.66
|
|
81
83
|
*/
|
|
82
84
|
form: PropTypes.oneOfType([PropTypes.object, PropTypes.element]),
|
|
@@ -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
|
|
|
@@ -116,10 +116,12 @@ FormFieldText.propTypes = {
|
|
|
116
116
|
autoComplete: PropTypes.oneOf(['on', 'off']),
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* If 'true', a field will be multiple
|
|
119
|
+
* If 'true', a field will be multiple. You can also limit the number of fields with a value like { max: 5 }.
|
|
120
120
|
* @since 1.12.0
|
|
121
121
|
*/
|
|
122
|
-
multi: PropTypes.bool,
|
|
122
|
+
multi: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
|
123
|
+
max: PropTypes.number.isRequired
|
|
124
|
+
})]),
|
|
123
125
|
|
|
124
126
|
/**
|
|
125
127
|
* @ignore
|
|
@@ -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