@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
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-
|
|
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
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
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 =
|
|
72
|
-
if (syncRef.current ===
|
|
73
|
-
syncRef.current
|
|
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:
|
|
84
|
-
},
|
|
85
|
-
|
|
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:
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
size: "64"
|
|
98
|
+
ref: icon2Ref
|
|
99
|
+
}, _Icon.default.create(icon2, {
|
|
100
|
+
size: size ? size : '64'
|
|
93
101
|
})));
|
|
94
102
|
};
|
|
95
103
|
|
|
@@ -103,7 +103,9 @@ const propTypes = {
|
|
|
103
103
|
closingConfirmation: _propTypes.default.bool,
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* Wraps children into [Form](#!/Form) if not empty
|
|
106
|
+
* Wraps children into [Form](#!/Form) if not empty.<br>
|
|
107
|
+
* **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
|
|
108
|
+
*
|
|
107
109
|
* @since 0.0.66
|
|
108
110
|
*/
|
|
109
111
|
form: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.element]),
|
|
@@ -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
|
|
|
@@ -137,10 +137,12 @@ FormFieldText.propTypes = {
|
|
|
137
137
|
autoComplete: _propTypes.default.oneOf(['on', 'off']),
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
|
-
* If 'true', a field will be multiple
|
|
140
|
+
* If 'true', a field will be multiple. You can also limit the number of fields with a value like { max: 5 }.
|
|
141
141
|
* @since 1.12.0
|
|
142
142
|
*/
|
|
143
|
-
multi: _propTypes.default.bool,
|
|
143
|
+
multi: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
|
|
144
|
+
max: _propTypes.default.number.isRequired
|
|
145
|
+
})]),
|
|
144
146
|
|
|
145
147
|
/**
|
|
146
148
|
* @ignore
|
|
@@ -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-
|
|
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