@plesk/ui-library 3.27.0 → 3.27.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/cjs/components/Drawer/DrawerProgress.js +15 -1
- package/cjs/components/FormFieldPassword/FormFieldPassword.js +39 -5
- package/cjs/components/FormFieldPassword/passwordScore.js +3 -2
- package/cjs/components/Icon/Icon.js +1 -1
- package/cjs/components/Rating/images/rating.svg +5 -5
- package/cjs/index.js +1 -1
- package/dist/images/rating.svg +5 -5
- 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 +60 -10
- 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/Drawer/DrawerProgress.js +16 -2
- package/esm/components/FormFieldPassword/FormFieldPassword.js +40 -5
- package/esm/components/FormFieldPassword/passwordScore.js +3 -2
- package/esm/components/Icon/Icon.js +1 -1
- package/esm/components/Rating/images/rating.svg +5 -5
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/styleguide/build/bundle.aabb094f.js +2 -0
- package/styleguide/build/{bundle.ff1f903a.js.LICENSE.txt → bundle.aabb094f.js.LICENSE.txt} +0 -0
- package/styleguide/images/rating.svg +5 -5
- package/styleguide/index.html +2 -2
- package/styleguide/build/bundle.ff1f903a.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
// Copyright 1999-2019. Plesk International GmbH. All rights reserved.
|
|
4
|
-
import React, { Component, Fragment } from 'react';
|
|
4
|
+
import React, { Component, Fragment, isValidElement, cloneElement } from 'react';
|
|
5
5
|
import Button from '../Button';
|
|
6
6
|
import Translate from '../Translate';
|
|
7
7
|
import Progress from '../Progress';
|
|
@@ -9,6 +9,20 @@ import ProgressStep, { STATUS_DONE, STATUS_ERROR, STATUS_NOT_STARTED } from '../
|
|
|
9
9
|
import { CLS_PREFIX } from '../../constants';
|
|
10
10
|
import { safeInvoke } from '../utils';
|
|
11
11
|
|
|
12
|
+
const renderAdditionalButtons = buttons => {
|
|
13
|
+
const buttonProcessing = button => {
|
|
14
|
+
if ( /*#__PURE__*/isValidElement(button) && button.type === Button) {
|
|
15
|
+
return /*#__PURE__*/cloneElement(button, {
|
|
16
|
+
size: 'lg'
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return button;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return Array.isArray(buttons) ? buttons.map(buttonProcessing) : buttonProcessing(buttons);
|
|
24
|
+
};
|
|
25
|
+
|
|
12
26
|
class DrawerProgress extends Component {
|
|
13
27
|
constructor(...args) {
|
|
14
28
|
super(...args);
|
|
@@ -125,7 +139,7 @@ class DrawerProgress extends Component {
|
|
|
125
139
|
}, step)))));
|
|
126
140
|
const footer = hasFooter ? /*#__PURE__*/React.createElement("div", {
|
|
127
141
|
className: `${baseClassName}__footer`
|
|
128
|
-
}, buttons, canCancel && /*#__PURE__*/React.createElement(Button, {
|
|
142
|
+
}, renderAdditionalButtons(buttons), canCancel && /*#__PURE__*/React.createElement(Button, {
|
|
129
143
|
onClick: this.handleCancel,
|
|
130
144
|
size: "lg"
|
|
131
145
|
}, /*#__PURE__*/React.createElement(Translate, {
|
|
@@ -33,9 +33,17 @@ class FormFieldPassword extends Component {
|
|
|
33
33
|
|
|
34
34
|
_defineProperty(this, "state", {
|
|
35
35
|
visible: false,
|
|
36
|
-
passwordMeterVisible: false
|
|
36
|
+
passwordMeterVisible: false,
|
|
37
|
+
scoreResult: {
|
|
38
|
+
password: null,
|
|
39
|
+
intent: null,
|
|
40
|
+
strength: null,
|
|
41
|
+
unusedRules: []
|
|
42
|
+
}
|
|
37
43
|
});
|
|
38
44
|
|
|
45
|
+
_defineProperty(this, "passwordOnScoring", null);
|
|
46
|
+
|
|
39
47
|
_defineProperty(this, "targetRef", /*#__PURE__*/createRef());
|
|
40
48
|
|
|
41
49
|
_defineProperty(this, "handleToggleClick", () => {
|
|
@@ -55,9 +63,10 @@ class FormFieldPassword extends Component {
|
|
|
55
63
|
_defineProperty(this, "handleBlur", this.handleClosePasswordMeter);
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
passwordScore(value) {
|
|
66
|
+
async passwordScore(value) {
|
|
59
67
|
if (!value) {
|
|
60
68
|
return {
|
|
69
|
+
password: null,
|
|
61
70
|
intent: null,
|
|
62
71
|
strength: null,
|
|
63
72
|
unusedRules: []
|
|
@@ -65,12 +74,15 @@ class FormFieldPassword extends Component {
|
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
const {
|
|
68
|
-
passwordScoreRules
|
|
77
|
+
passwordScoreRules,
|
|
78
|
+
customPasswordScore
|
|
69
79
|
} = this.props;
|
|
80
|
+
const passwordScoreFunc = customPasswordScore || passwordScore;
|
|
70
81
|
const {
|
|
82
|
+
password,
|
|
71
83
|
score,
|
|
72
84
|
unusedRules
|
|
73
|
-
} =
|
|
85
|
+
} = await passwordScoreFunc(value, passwordScoreRules);
|
|
74
86
|
let intent = 'success';
|
|
75
87
|
let strength = /*#__PURE__*/React.createElement(Translate, {
|
|
76
88
|
content: "FormFieldPassword.strengthVeryStrong",
|
|
@@ -104,6 +116,7 @@ class FormFieldPassword extends Component {
|
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
return {
|
|
119
|
+
password,
|
|
107
120
|
intent,
|
|
108
121
|
strength,
|
|
109
122
|
unusedRules
|
|
@@ -118,10 +131,24 @@ class FormFieldPassword extends Component {
|
|
|
118
131
|
passwordMeterProps
|
|
119
132
|
} = this.props;
|
|
120
133
|
const {
|
|
134
|
+
password,
|
|
121
135
|
intent,
|
|
122
136
|
strength,
|
|
123
137
|
unusedRules
|
|
124
|
-
} = this.
|
|
138
|
+
} = this.state.scoreResult;
|
|
139
|
+
|
|
140
|
+
if (!!value && value !== password && value !== this.passwordOnScoring) {
|
|
141
|
+
this.passwordOnScoring = value;
|
|
142
|
+
this.passwordScore(value).then(scoreResult => {
|
|
143
|
+
if (this.passwordOnScoring === scoreResult.password) {
|
|
144
|
+
this.passwordOnScoring = null;
|
|
145
|
+
this.setState({
|
|
146
|
+
scoreResult
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
125
152
|
return /*#__PURE__*/React.createElement(Popover, _extends({
|
|
126
153
|
visible: passwordMeterVisible && !!value,
|
|
127
154
|
target: target,
|
|
@@ -208,6 +235,7 @@ class FormFieldPassword extends Component {
|
|
|
208
235
|
hidePasswordMeter,
|
|
209
236
|
passwordMeterProps,
|
|
210
237
|
passwordScoreRules,
|
|
238
|
+
customPasswordScore,
|
|
211
239
|
size,
|
|
212
240
|
autoFocus,
|
|
213
241
|
autoComplete,
|
|
@@ -306,6 +334,12 @@ FormFieldPassword.propTypes = {
|
|
|
306
334
|
score: PropTypes.func.isRequired
|
|
307
335
|
})),
|
|
308
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Custom password score estimator
|
|
339
|
+
* @since 3.27.1
|
|
340
|
+
*/
|
|
341
|
+
customPasswordScore: PropTypes.func,
|
|
342
|
+
|
|
309
343
|
/**
|
|
310
344
|
* Size of the control
|
|
311
345
|
* @since 1.5.6
|
|
@@ -347,6 +381,7 @@ FormFieldPassword.defaultProps = {
|
|
|
347
381
|
hidePasswordMeter: false,
|
|
348
382
|
passwordMeterProps: {},
|
|
349
383
|
passwordScoreRules: undefined,
|
|
384
|
+
customPasswordScore: undefined,
|
|
350
385
|
size: 'md',
|
|
351
386
|
autoFocus: undefined,
|
|
352
387
|
autoComplete: undefined,
|
|
@@ -73,7 +73,7 @@ const Icon = ({
|
|
|
73
73
|
}, props), newName ? /*#__PURE__*/React.createElement("svg", {
|
|
74
74
|
focusable: "false"
|
|
75
75
|
}, /*#__PURE__*/React.createElement("use", {
|
|
76
|
-
|
|
76
|
+
href: getHref(newName, newSize)
|
|
77
77
|
})) : src && /*#__PURE__*/React.createElement("img", {
|
|
78
78
|
src: src,
|
|
79
79
|
alt: alt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="56" height="248" viewBox="0 0 51 248">
|
|
2
2
|
<defs><symbol id="star"><path stroke-width="3" d="m25,1 6,17h18l-14,11 5,17-15-10-15,10 5-17-14-11h18z"></path></symbol></defs>
|
|
3
|
-
<use x="0" y="0" fill="none" stroke="#ff9500"
|
|
4
|
-
<use x="0" y="100" fill="#ff9500" stroke="#ff9500"
|
|
5
|
-
<use x="0" y="200" fill="#848484" stroke="#848484"
|
|
6
|
-
</svg>
|
|
3
|
+
<use x="0" y="0" fill="none" stroke="#ff9500" href="#star"></use>
|
|
4
|
+
<use x="0" y="100" fill="#ff9500" stroke="#ff9500" href="#star"></use>
|
|
5
|
+
<use x="0" y="200" fill="#848484" stroke="#848484" href="#star"></use>
|
|
6
|
+
</svg>
|
package/esm/index.js
CHANGED