@plesk/ui-library 3.27.0 → 3.27.3

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.
Files changed (46) hide show
  1. package/cjs/components/Dialog/Dialog.js +11 -2
  2. package/cjs/components/Drawer/DrawerProgress.js +15 -1
  3. package/cjs/components/FormFieldPassword/FormFieldPassword.js +24 -214
  4. package/cjs/components/FormFieldPassword/PasswordMeter.js +81 -0
  5. package/cjs/components/FormFieldPassword/estimatePassword.js +203 -0
  6. package/cjs/components/FormFieldPassword/generatePassword.js +21 -0
  7. package/cjs/components/FormFieldPassword/index.js +5 -5
  8. package/cjs/components/Icon/Icon.js +1 -1
  9. package/cjs/components/List/List.js +1 -1
  10. package/cjs/components/ProgressDialog/ProgressDialog.js +2 -1
  11. package/cjs/components/Rating/images/rating.svg +5 -5
  12. package/cjs/index.js +1 -1
  13. package/dist/images/rating.svg +5 -5
  14. package/dist/plesk-ui-library-rtl.css +1 -1
  15. package/dist/plesk-ui-library-rtl.css.map +1 -1
  16. package/dist/plesk-ui-library.css +1 -1
  17. package/dist/plesk-ui-library.css.map +1 -1
  18. package/dist/plesk-ui-library.js +336 -309
  19. package/dist/plesk-ui-library.js.map +1 -1
  20. package/dist/plesk-ui-library.min.js +5 -5
  21. package/dist/plesk-ui-library.min.js.map +1 -1
  22. package/esm/components/Dialog/Dialog.js +11 -2
  23. package/esm/components/Drawer/DrawerProgress.js +16 -2
  24. package/esm/components/FormFieldPassword/FormFieldPassword.js +22 -206
  25. package/esm/components/FormFieldPassword/PasswordMeter.js +61 -0
  26. package/esm/components/FormFieldPassword/estimatePassword.js +187 -0
  27. package/esm/components/FormFieldPassword/generatePassword.js +14 -0
  28. package/esm/components/FormFieldPassword/index.js +3 -2
  29. package/esm/components/Icon/Icon.js +1 -1
  30. package/esm/components/List/List.js +1 -1
  31. package/esm/components/ProgressDialog/ProgressDialog.js +2 -1
  32. package/esm/components/Rating/images/rating.svg +5 -5
  33. package/esm/index.js +1 -1
  34. package/package.json +13 -8
  35. package/styleguide/build/bundle.f38c467d.js +2 -0
  36. package/styleguide/build/{bundle.ff1f903a.js.LICENSE.txt → bundle.f38c467d.js.LICENSE.txt} +0 -0
  37. package/styleguide/images/rating.svg +5 -5
  38. package/styleguide/index.html +2 -2
  39. package/types/package.d.ts +5 -0
  40. package/types/src/components/FormFieldPassword/FormFieldPassword.d.ts +91 -0
  41. package/types/src/components/FormFieldPassword/PasswordMeter.d.ts +9 -0
  42. package/types/src/components/FormFieldPassword/estimatePassword.d.ts +13 -0
  43. package/types/src/components/FormFieldPassword/index.d.ts +2 -0
  44. package/cjs/components/FormFieldPassword/passwordScore.js +0 -131
  45. package/esm/components/FormFieldPassword/passwordScore.js +0 -122
  46. package/styleguide/build/bundle.ff1f903a.js +0 -2
@@ -1,6 +1,6 @@
1
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="56" height="248" viewBox="0 0 51 248">
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" xlink:href="#star"></use>
4
- <use x="0" y="100" fill="#ff9500" stroke="#ff9500" xlink:href="#star"></use>
5
- <use x="0" y="200" fill="#848484" stroke="#848484" xlink:href="#star"></use>
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>
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
- <title>Plesk UI Library 3.27.0</title>
7
+ <title>Plesk UI Library 3.27.3</title>
8
8
  <meta name="msapplication-TileColor" content="#da532c">
9
9
  <meta name="theme-color" content="#ffffff">
10
10
  <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
@@ -40,6 +40,6 @@
40
40
  </script>
41
41
  <noscript><div><img src="https://mc.yandex.ru/watch/56446840" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
42
42
  <!-- /Yandex.Metrika counter -->
43
- <script src="build/bundle.ff1f903a.js"></script>
43
+ <script src="build/bundle.f38c467d.js"></script>
44
44
  </body>
45
45
  </html>
@@ -93,6 +93,7 @@ declare const _exports: {
93
93
  "less-loader": string;
94
94
  "mini-css-extract-plugin": string;
95
95
  "postcss": string;
96
+ "postcss-less": string;
96
97
  "postcss-loader": string;
97
98
  "postcss-logical": string;
98
99
  "prettier": string;
@@ -104,8 +105,12 @@ declare const _exports: {
104
105
  "rimraf": string;
105
106
  "rtlcss": string;
106
107
  "style-loader": string;
108
+ "stylelint": string;
107
109
  "stylelint-config-prettier": string;
110
+ "stylelint-declaration-block-no-ignored-properties": string;
111
+ "stylelint-no-unsupported-browser-features": string;
108
112
  "stylelint-prettier": string;
113
+ "stylelint-use-logical-spec": string;
109
114
  "svg-mixer": string;
110
115
  "terser-webpack-plugin": string;
111
116
  "typescript": string;
@@ -0,0 +1,91 @@
1
+ import { Component, ComponentProps, ReactElement, RefObject } from 'react';
2
+ import Button from '../Button';
3
+ import FormField from '../FormField';
4
+ import { PasswordMeterProps } from './PasswordMeter';
5
+ import './FormFieldPassword.less';
6
+ export declare type FormFieldPasswordProps = {
7
+ /**
8
+ * Is show button hidden?
9
+ * @since 0.0.59
10
+ */
11
+ hideShowButton?: boolean;
12
+ /**
13
+ * Is generate button hidden?
14
+ * @since 0.0.59
15
+ */
16
+ hideGenerateButton?: boolean;
17
+ /**
18
+ * Is password meter hidden?
19
+ * @since 0.0.59
20
+ */
21
+ hidePasswordMeter?: boolean;
22
+ /**
23
+ * Additional props for password meter. See [Popover](#!/Popover) for more information.
24
+ * @since 1.5.6
25
+ */
26
+ passwordMeterProps?: PasswordMeterProps;
27
+ /**
28
+ * Size of the control
29
+ * @since 1.5.6
30
+ */
31
+ size: 'md' | 'lg' | 'xl' | 'fill';
32
+ /**
33
+ * The browser will automatically focus on the component upon rendering the screen
34
+ * @since 1.9.0
35
+ */
36
+ autoFocus?: boolean;
37
+ /**
38
+ * Prevent password autocompletion.
39
+ * @since 2.5.1
40
+ */
41
+ autoComplete?: 'new-password';
42
+ /**
43
+ * A render function for customizing the password generation button.
44
+ * @since 3.13.0
45
+ */
46
+ generateButton?: (generateButtonProps: ComponentProps<typeof Button>) => ReactElement;
47
+ /**
48
+ * @ignore
49
+ */
50
+ className?: string;
51
+ /**
52
+ * @ignore
53
+ */
54
+ baseClassName?: string;
55
+ } & ComponentProps<typeof FormField>;
56
+ declare type FormFieldPasswordState = {
57
+ visible: boolean;
58
+ passwordMeterVisible: boolean;
59
+ };
60
+ /**
61
+ * `FormFieldPassword` component provides secure way to enter a password.
62
+ * @since 0.0.58
63
+ */
64
+ declare class FormFieldPassword extends Component<FormFieldPasswordProps, FormFieldPasswordState> {
65
+ static defaultProps: {
66
+ hideShowButton: boolean;
67
+ generateButton: undefined;
68
+ hideGenerateButton: boolean;
69
+ hidePasswordMeter: boolean;
70
+ passwordMeterProps: {};
71
+ size: string;
72
+ autoFocus: undefined;
73
+ autoComplete: undefined;
74
+ className: undefined;
75
+ baseClassName: string;
76
+ };
77
+ state: {
78
+ visible: boolean;
79
+ passwordMeterVisible: boolean;
80
+ };
81
+ targetRef: RefObject<HTMLSpanElement>;
82
+ handleToggleClick: () => void;
83
+ handleClosePasswordMeter: () => void;
84
+ handleBlur: () => void;
85
+ renderGenerateButton({ setValue, isDisabled, }: {
86
+ setValue: (value: any) => void;
87
+ isDisabled: () => boolean;
88
+ }): JSX.Element;
89
+ render(): JSX.Element;
90
+ }
91
+ export default FormFieldPassword;
@@ -0,0 +1,9 @@
1
+ import { ComponentProps, FunctionComponent } from 'react';
2
+ import Popover from '../Popover';
3
+ import estimatePassword, { EstimateResult, EstimateRule } from './estimatePassword';
4
+ export declare type PasswordMeterProps = {
5
+ value: string;
6
+ onEstimate?: (password: string, defaultEstimateFn: typeof estimatePassword, defaultEstimateRules: EstimateRule[]) => EstimateResult;
7
+ } & ComponentProps<typeof Popover>;
8
+ declare const PasswordMeter: FunctionComponent<PasswordMeterProps>;
9
+ export default PasswordMeter;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type EstimateRule = {
3
+ name: string;
4
+ suggestion?: ReactNode;
5
+ score: (password: string) => number;
6
+ };
7
+ export declare type EstimateResult = {
8
+ strength: 'VeryWeak' | 'Weak' | 'Medium' | 'Strong' | 'VeryStrong';
9
+ suggestions: ReactNode[];
10
+ };
11
+ export declare const DEFAULT_RULES: EstimateRule[];
12
+ declare const _default: (password: string, rules?: EstimateRule[]) => EstimateResult;
13
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default } from './FormFieldPassword';
2
+ export { default as generatePassword } from './generatePassword';
@@ -1,131 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.PASSWORD_SCORE_RULES = void 0;
7
-
8
- // Copyright 1999-2021. Plesk International GmbH. All rights reserved.
9
- const passwordScore = (password, rules = PASSWORD_SCORE_RULES) => {
10
- const unusedRules = [];
11
- let score = 0;
12
- rules.forEach(rule => {
13
- const mark = rule.score(password);
14
-
15
- if (mark < 0) {
16
- unusedRules.push({
17
- rule,
18
- value: -mark
19
- });
20
- } else {
21
- score += mark;
22
- }
23
- });
24
- return {
25
- score,
26
- unusedRules
27
- };
28
- };
29
-
30
- const PASSWORD_SCORE_RULES = [{
31
- name: 'passwordTooShort',
32
-
33
- score(passwd) {
34
- return passwd.length < 5 ? -1 : 0;
35
- }
36
-
37
- }, {
38
- name: 'passwordLength',
39
-
40
- score(passwd) {
41
- if (passwd.length < 5) {
42
- return 3;
43
- }
44
-
45
- if (passwd.length > 4 && passwd.length < 8) {
46
- return 6;
47
- }
48
-
49
- if (passwd.length > 7 && passwd.length < 16) {
50
- return 12;
51
- }
52
-
53
- return 18;
54
- }
55
-
56
- }, {
57
- name: 'lettersLowerCase',
58
-
59
- score(passwd) {
60
- // [verified] at least one lower case letter
61
- return passwd.match(/[a-z]/) ? 1 : -1;
62
- }
63
-
64
- }, {
65
- name: 'lettersUpperCase',
66
-
67
- score(passwd) {
68
- // [verified] at least one upper case letter
69
- return passwd.match(/[A-Z]/) ? 5 : -1;
70
- }
71
-
72
- }, {
73
- name: 'numbers1',
74
-
75
- score(passwd) {
76
- // [verified] at least one number
77
- return passwd.match(/\d+/) ? 5 : -1;
78
- }
79
-
80
- }, {
81
- name: 'numbers3',
82
-
83
- score(passwd) {
84
- // [verified] at least three numbers
85
- return passwd.match(/(.*[0-9].*[0-9].*[0-9])/) ? 5 : -1;
86
- }
87
-
88
- }, {
89
- name: 'specialChar1',
90
-
91
- score(passwd) {
92
- // [verified] at least one special character
93
- return passwd.match(/[!@#$%^&*?_~]/) ? 5 : -1;
94
- }
95
-
96
- }, {
97
- name: 'specialChar2',
98
-
99
- score(passwd) {
100
- // [verified] at least two special characters
101
- return passwd.match(/(.*[!@#$%^&*?_~].*[!@#$%^&*?_~])/) ? 5 : -1;
102
- }
103
-
104
- }, {
105
- name: 'comboUpperAndLower',
106
-
107
- score(passwd) {
108
- // [verified] both upper and lower case
109
- return passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) ? 2 : -1;
110
- }
111
-
112
- }, {
113
- name: 'comboLettersAndNumbers',
114
-
115
- score(passwd) {
116
- // [verified] both letters and numbers
117
- return passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/) ? 2 : -1;
118
- }
119
-
120
- }, {
121
- name: 'comboLettersNumbersSpecial',
122
-
123
- score(passwd) {
124
- // [verified] letters, numbers, and special characters
125
- return passwd.match(/([a-zA-Z0-9].*[!@#$%^&*?_~])|([!@#$%^&*?_~].*[a-zA-Z0-9])/) ? 2 : -1;
126
- }
127
-
128
- }];
129
- exports.PASSWORD_SCORE_RULES = PASSWORD_SCORE_RULES;
130
- var _default = passwordScore;
131
- exports.default = _default;
@@ -1,122 +0,0 @@
1
- // Copyright 1999-2021. Plesk International GmbH. All rights reserved.
2
- const passwordScore = (password, rules = PASSWORD_SCORE_RULES) => {
3
- const unusedRules = [];
4
- let score = 0;
5
- rules.forEach(rule => {
6
- const mark = rule.score(password);
7
-
8
- if (mark < 0) {
9
- unusedRules.push({
10
- rule,
11
- value: -mark
12
- });
13
- } else {
14
- score += mark;
15
- }
16
- });
17
- return {
18
- score,
19
- unusedRules
20
- };
21
- };
22
-
23
- export const PASSWORD_SCORE_RULES = [{
24
- name: 'passwordTooShort',
25
-
26
- score(passwd) {
27
- return passwd.length < 5 ? -1 : 0;
28
- }
29
-
30
- }, {
31
- name: 'passwordLength',
32
-
33
- score(passwd) {
34
- if (passwd.length < 5) {
35
- return 3;
36
- }
37
-
38
- if (passwd.length > 4 && passwd.length < 8) {
39
- return 6;
40
- }
41
-
42
- if (passwd.length > 7 && passwd.length < 16) {
43
- return 12;
44
- }
45
-
46
- return 18;
47
- }
48
-
49
- }, {
50
- name: 'lettersLowerCase',
51
-
52
- score(passwd) {
53
- // [verified] at least one lower case letter
54
- return passwd.match(/[a-z]/) ? 1 : -1;
55
- }
56
-
57
- }, {
58
- name: 'lettersUpperCase',
59
-
60
- score(passwd) {
61
- // [verified] at least one upper case letter
62
- return passwd.match(/[A-Z]/) ? 5 : -1;
63
- }
64
-
65
- }, {
66
- name: 'numbers1',
67
-
68
- score(passwd) {
69
- // [verified] at least one number
70
- return passwd.match(/\d+/) ? 5 : -1;
71
- }
72
-
73
- }, {
74
- name: 'numbers3',
75
-
76
- score(passwd) {
77
- // [verified] at least three numbers
78
- return passwd.match(/(.*[0-9].*[0-9].*[0-9])/) ? 5 : -1;
79
- }
80
-
81
- }, {
82
- name: 'specialChar1',
83
-
84
- score(passwd) {
85
- // [verified] at least one special character
86
- return passwd.match(/[!@#$%^&*?_~]/) ? 5 : -1;
87
- }
88
-
89
- }, {
90
- name: 'specialChar2',
91
-
92
- score(passwd) {
93
- // [verified] at least two special characters
94
- return passwd.match(/(.*[!@#$%^&*?_~].*[!@#$%^&*?_~])/) ? 5 : -1;
95
- }
96
-
97
- }, {
98
- name: 'comboUpperAndLower',
99
-
100
- score(passwd) {
101
- // [verified] both upper and lower case
102
- return passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) ? 2 : -1;
103
- }
104
-
105
- }, {
106
- name: 'comboLettersAndNumbers',
107
-
108
- score(passwd) {
109
- // [verified] both letters and numbers
110
- return passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/) ? 2 : -1;
111
- }
112
-
113
- }, {
114
- name: 'comboLettersNumbersSpecial',
115
-
116
- score(passwd) {
117
- // [verified] letters, numbers, and special characters
118
- return passwd.match(/([a-zA-Z0-9].*[!@#$%^&*?_~])|([!@#$%^&*?_~].*[a-zA-Z0-9])/) ? 2 : -1;
119
- }
120
-
121
- }];
122
- export default passwordScore;