@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.
@@ -6521,6 +6521,20 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
6521
6521
 
6522
6522
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6523
6523
 
6524
+ const renderAdditionalButtons = buttons => {
6525
+ const buttonProcessing = button => {
6526
+ if ( /*#__PURE__*/(0, _react.isValidElement)(button) && button.type === _Button.default) {
6527
+ return /*#__PURE__*/(0, _react.cloneElement)(button, {
6528
+ size: 'lg'
6529
+ });
6530
+ }
6531
+
6532
+ return button;
6533
+ };
6534
+
6535
+ return Array.isArray(buttons) ? buttons.map(buttonProcessing) : buttonProcessing(buttons);
6536
+ };
6537
+
6524
6538
  class DrawerProgress extends _react.Component {
6525
6539
  constructor(...args) {
6526
6540
  super(...args);
@@ -6639,7 +6653,7 @@ class DrawerProgress extends _react.Component {
6639
6653
 
6640
6654
  const footer = hasFooter ? /*#__PURE__*/_react.default.createElement("div", {
6641
6655
  className: `${baseClassName}__footer`
6642
- }, buttons, canCancel && /*#__PURE__*/_react.default.createElement(_Button.default, {
6656
+ }, renderAdditionalButtons(buttons), canCancel && /*#__PURE__*/_react.default.createElement(_Button.default, {
6643
6657
  onClick: this.handleCancel,
6644
6658
  size: "lg"
6645
6659
  }, /*#__PURE__*/_react.default.createElement(_Translate.default, {
@@ -8107,9 +8121,17 @@ class FormFieldPassword extends _react.Component {
8107
8121
 
8108
8122
  _defineProperty(this, "state", {
8109
8123
  visible: false,
8110
- passwordMeterVisible: false
8124
+ passwordMeterVisible: false,
8125
+ scoreResult: {
8126
+ password: null,
8127
+ intent: null,
8128
+ strength: null,
8129
+ unusedRules: []
8130
+ }
8111
8131
  });
8112
8132
 
8133
+ _defineProperty(this, "passwordOnScoring", null);
8134
+
8113
8135
  _defineProperty(this, "targetRef", /*#__PURE__*/(0, _react.createRef)());
8114
8136
 
8115
8137
  _defineProperty(this, "handleToggleClick", () => {
@@ -8129,9 +8151,10 @@ class FormFieldPassword extends _react.Component {
8129
8151
  _defineProperty(this, "handleBlur", this.handleClosePasswordMeter);
8130
8152
  }
8131
8153
 
8132
- passwordScore(value) {
8154
+ async passwordScore(value) {
8133
8155
  if (!value) {
8134
8156
  return {
8157
+ password: null,
8135
8158
  intent: null,
8136
8159
  strength: null,
8137
8160
  unusedRules: []
@@ -8139,12 +8162,15 @@ class FormFieldPassword extends _react.Component {
8139
8162
  }
8140
8163
 
8141
8164
  const {
8142
- passwordScoreRules
8165
+ passwordScoreRules,
8166
+ customPasswordScore
8143
8167
  } = this.props;
8168
+ const passwordScoreFunc = customPasswordScore || _passwordScore.default;
8144
8169
  const {
8170
+ password,
8145
8171
  score,
8146
8172
  unusedRules
8147
- } = (0, _passwordScore.default)(value, passwordScoreRules);
8173
+ } = await passwordScoreFunc(value, passwordScoreRules);
8148
8174
  let intent = 'success';
8149
8175
 
8150
8176
  let strength = /*#__PURE__*/_react.default.createElement(_Translate.default, {
@@ -8179,6 +8205,7 @@ class FormFieldPassword extends _react.Component {
8179
8205
  }
8180
8206
 
8181
8207
  return {
8208
+ password,
8182
8209
  intent,
8183
8210
  strength,
8184
8211
  unusedRules
@@ -8193,10 +8220,24 @@ class FormFieldPassword extends _react.Component {
8193
8220
  passwordMeterProps
8194
8221
  } = this.props;
8195
8222
  const {
8223
+ password,
8196
8224
  intent,
8197
8225
  strength,
8198
8226
  unusedRules
8199
- } = this.passwordScore(value);
8227
+ } = this.state.scoreResult;
8228
+
8229
+ if (!!value && value !== password && value !== this.passwordOnScoring) {
8230
+ this.passwordOnScoring = value;
8231
+ this.passwordScore(value).then(scoreResult => {
8232
+ if (this.passwordOnScoring === scoreResult.password) {
8233
+ this.passwordOnScoring = null;
8234
+ this.setState({
8235
+ scoreResult
8236
+ });
8237
+ }
8238
+ });
8239
+ }
8240
+
8200
8241
  return /*#__PURE__*/_react.default.createElement(_Popover.default, _extends({
8201
8242
  visible: passwordMeterVisible && !!value,
8202
8243
  target: target,
@@ -8283,6 +8324,7 @@ class FormFieldPassword extends _react.Component {
8283
8324
  hidePasswordMeter,
8284
8325
  passwordMeterProps,
8285
8326
  passwordScoreRules,
8327
+ customPasswordScore,
8286
8328
  size,
8287
8329
  autoFocus,
8288
8330
  autoComplete,
@@ -8382,6 +8424,12 @@ FormFieldPassword.propTypes = {
8382
8424
  score: _propTypes.default.func.isRequired
8383
8425
  })),
8384
8426
 
8427
+ /**
8428
+ * Custom password score estimator
8429
+ * @since 3.27.1
8430
+ */
8431
+ customPasswordScore: _propTypes.default.func,
8432
+
8385
8433
  /**
8386
8434
  * Size of the control
8387
8435
  * @since 1.5.6
@@ -8423,6 +8471,7 @@ FormFieldPassword.defaultProps = {
8423
8471
  hidePasswordMeter: false,
8424
8472
  passwordMeterProps: {},
8425
8473
  passwordScoreRules: undefined,
8474
+ customPasswordScore: undefined,
8426
8475
  size: 'md',
8427
8476
  autoFocus: undefined,
8428
8477
  autoComplete: undefined,
@@ -8540,10 +8589,11 @@ const passwordScore = (password, rules = PASSWORD_SCORE_RULES) => {
8540
8589
  score += mark;
8541
8590
  }
8542
8591
  });
8543
- return {
8592
+ return Promise.resolve({
8593
+ password,
8544
8594
  score,
8545
8595
  unusedRules
8546
- };
8596
+ });
8547
8597
  };
8548
8598
 
8549
8599
  const PASSWORD_SCORE_RULES = [{
@@ -11234,7 +11284,7 @@ const Icon = ({
11234
11284
  }, props), newName ? /*#__PURE__*/_react.default.createElement("svg", {
11235
11285
  focusable: "false"
11236
11286
  }, /*#__PURE__*/_react.default.createElement("use", {
11237
- xlinkHref: getHref(newName, newSize)
11287
+ href: getHref(newName, newSize)
11238
11288
  })) : src && /*#__PURE__*/_react.default.createElement("img", {
11239
11289
  src: src,
11240
11290
  alt: alt
@@ -92252,7 +92302,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
92252
92302
  /***/ ((module) => {
92253
92303
 
92254
92304
  "use strict";
92255
- module.exports = JSON.parse('{"name":"@plesk/ui-library","version":"3.27.0","description":"Plesk UI Library","main":"index.js","module":"esm/index.js","types":"./types/src","sideEffects":["cjs/index.js","esm/index.js","dist/*.js","dist/*.css"],"scripts":{"pretest":"yarn lint","test":"jest --ci --coverage --coverageReporters text-summary","test:vr":"cross-env VISUAL_REGRESSION=true jest","build":"yarn build:types && yarn build:umd && yarn build:esm && yarn build:cjs","build:umd":"webpack --config ./configs/build.config.js","build:esm":"cross-env NODE_ENV=esm node ./scripts/build.js","build:cjs":"cross-env NODE_ENV=cjs node ./scripts/build.js","build:types":"rimraf ./types && tsc --project ./configs/types-generator.config.json","create-svg-sprite":"node ./scripts/create-svg-sprite.js","lint":"yarn lint:es && yarn lint:types && yarn lint:style","lint:es":"eslint --ext js,md,tsx src configs scripts styleguidist","lint:types":"tsc","lint:style":"stylelint \\"src/**/*.less\\"","styleguide":"styleguidist server --config ./configs/styleguide.config.js","styleguide:build":"styleguidist build --config ./configs/styleguide.config.js","create-component":"node scripts/create-component.js","prepublishOnly":"yarn install && yarn test && yarn build && yarn styleguide:build","storybook":"webpack serve --config ./configs/storybook.config.js","postinstall":"node ./scripts/postinstall.js"},"files":["esm","cjs","dist","styleguide","types","/scripts/postinstall.js","/index.js"],"dependencies":{"@babel/runtime":"^7.15.4","@plesk/react-movable":"^2.6.0","@types/classnames":"2.2.7","@types/react":"16.8.13","@types/react-dom":"16.8.4","@types/react-measure":"2.0.8","@types/react-transition-group":"^4.4.4","@types/svg4everybody":"2.1.0","classnames":"^2.3.1","codemirror":"5.48.0","marked":"0.3.19","memoize-one":"^5.1.1","popper.js":"1.14.3","prop-types":"^15.7.2","react-measure":"2.3.0","react-sortable-hoc":"0.6.8","react-transition-group":"^4.4.2","scroll-into-view-if-needed":"^2.2.20","svg4everybody":"2.1.9","use-focus-visible":"^1.0.0"},"devDependencies":{"@babel/core":"^7.15.8","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-runtime":"^7.15.8","@babel/preset-env":"^7.15.8","@babel/preset-react":"^7.14.5","@babel/preset-typescript":"^7.15.0","@plesk/eslint-config":"^1.1.0","@plesk/stylelint-config":"^0.0.6","@types/buble":"^0.19.2","@types/cheerio":"^0.22.30","@types/doctrine":"^0.0.3","@types/enzyme":"^3.10.9","@types/jest":"^23.3.12","@types/webpack-dev-server":"^3.10.1","@typescript-eslint/eslint-plugin":"^2.7.0","@typescript-eslint/parser":"^2.7.0","autoprefixer":"^10.3.7","babel-loader":"^8.2.3","babel-plugin-dynamic-import-node":"^2.3.3","babel-plugin-transform-require-ignore":"^0.1.1","clean-webpack-plugin":"^4.0.0","cross-env":"^5.2.0","css-loader":"^6.4.0","css-minimizer-webpack-plugin":"^3.1.1","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.6","enzyme-to-json":"^3.6.2","eslint-config-prettier":"^6.11.0","eslint-plugin-markdown":"^1.0.2","eslint-plugin-prettier":"^3.1.3","expect-puppeteer":"^4.4.0","fs-extra":"^7.0.0","html-webpack-plugin":"^5.5.0","inquirer":"^3.2.1","jest":"^24.9.0","jest-dev-server":"^4.4.0","jest-image-snapshot":"^4.0.2","less":"^4.1.2","less-loader":"^10.2.0","mini-css-extract-plugin":"^2.4.3","postcss":"^8.3.11","postcss-loader":"^6.2.0","postcss-logical":"^5.0.0","prettier":"^2.0.5","puppeteer-core":"^5.2.1","react":"^16.8.6","react-dom":"^16.8.6","react-styleguidist":"^11.1.7","react-test-renderer":"^16.8.6","rimraf":"^3.0.1","rtlcss":"^3.4.0","style-loader":"^3.3.1","stylelint-config-prettier":"^8.0.1","stylelint-prettier":"^1.1.2","svg-mixer":"^2.3.14","terser-webpack-plugin":"^5.2.4","typescript":"^3.7.2","webpack":"^5.60.0","webpack-cli":"^4.9.1"},"peerDependencies":{"react":"^16.8.6","react-dom":"^16.8.6"},"resolutions":{"@babel/types":"^7.15.6","@types/node":"^12.12.8","**/caniuse-lite":"1.0.30001274"},"browserslist":["last 2 versions",">1%","not op_mini all","not dead","not ie 11"],"author":"Plesk Developers <plesk-dev-leads@plesk.com> (https://www.plesk.com/)","license":"Apache-2.0"}');
92305
+ module.exports = JSON.parse('{"name":"@plesk/ui-library","version":"3.27.1","description":"Plesk UI Library","main":"index.js","module":"esm/index.js","types":"./types/src","sideEffects":["cjs/index.js","esm/index.js","dist/*.js","dist/*.css"],"scripts":{"pretest":"yarn lint","test":"jest --ci --coverage --coverageReporters text-summary","test:vr":"cross-env VISUAL_REGRESSION=true jest","build":"yarn build:types && yarn build:umd && yarn build:esm && yarn build:cjs","build:umd":"webpack --config ./configs/build.config.js","build:esm":"cross-env NODE_ENV=esm node ./scripts/build.js","build:cjs":"cross-env NODE_ENV=cjs node ./scripts/build.js","build:types":"rimraf ./types && tsc --project ./configs/types-generator.config.json","create-svg-sprite":"node ./scripts/create-svg-sprite.js","lint":"yarn lint:es && yarn lint:types && yarn lint:style","lint:es":"eslint --ext js,md,tsx src configs scripts styleguidist","lint:types":"tsc","lint:style":"stylelint \\"src/**/*.less\\"","styleguide":"styleguidist server --config ./configs/styleguide.config.js","styleguide:build":"styleguidist build --config ./configs/styleguide.config.js","create-component":"node scripts/create-component.js","prepublishOnly":"yarn install && yarn test && yarn build && yarn styleguide:build","storybook":"webpack serve --config ./configs/storybook.config.js","postinstall":"node ./scripts/postinstall.js"},"files":["esm","cjs","dist","styleguide","types","/scripts/postinstall.js","/index.js"],"dependencies":{"@babel/runtime":"^7.15.4","@plesk/react-movable":"^2.6.0","@types/classnames":"2.2.7","@types/react":"16.8.13","@types/react-dom":"16.8.4","@types/react-measure":"2.0.8","@types/react-transition-group":"^4.4.4","@types/svg4everybody":"2.1.0","classnames":"^2.3.1","codemirror":"5.48.0","marked":"0.3.19","memoize-one":"^5.1.1","popper.js":"1.14.3","prop-types":"^15.7.2","react-measure":"2.3.0","react-sortable-hoc":"0.6.8","react-transition-group":"^4.4.2","scroll-into-view-if-needed":"^2.2.20","svg4everybody":"2.1.9","use-focus-visible":"^1.0.0"},"devDependencies":{"@babel/core":"^7.15.8","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-runtime":"^7.15.8","@babel/preset-env":"^7.15.8","@babel/preset-react":"^7.14.5","@babel/preset-typescript":"^7.15.0","@plesk/eslint-config":"^1.1.0","@plesk/stylelint-config":"^0.0.6","@types/buble":"^0.19.2","@types/cheerio":"^0.22.30","@types/doctrine":"^0.0.3","@types/enzyme":"^3.10.9","@types/jest":"^23.3.12","@types/webpack-dev-server":"^3.10.1","@typescript-eslint/eslint-plugin":"^2.7.0","@typescript-eslint/parser":"^2.7.0","autoprefixer":"^10.3.7","babel-loader":"^8.2.3","babel-plugin-dynamic-import-node":"^2.3.3","babel-plugin-transform-require-ignore":"^0.1.1","clean-webpack-plugin":"^4.0.0","cross-env":"^5.2.0","css-loader":"^6.4.0","css-minimizer-webpack-plugin":"^3.1.1","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.6","enzyme-to-json":"^3.6.2","eslint-config-prettier":"^6.11.0","eslint-plugin-markdown":"^1.0.2","eslint-plugin-prettier":"^3.1.3","expect-puppeteer":"^4.4.0","fs-extra":"^7.0.0","html-webpack-plugin":"^5.5.0","inquirer":"^3.2.1","jest":"^24.9.0","jest-dev-server":"^4.4.0","jest-image-snapshot":"^4.0.2","less":"^4.1.2","less-loader":"^10.2.0","mini-css-extract-plugin":"^2.4.3","postcss":"^8.3.11","postcss-loader":"^6.2.0","postcss-logical":"^5.0.0","prettier":"^2.0.5","puppeteer-core":"^5.2.1","react":"^16.8.6","react-dom":"^16.8.6","react-styleguidist":"^11.1.7","react-test-renderer":"^16.8.6","rimraf":"^3.0.1","rtlcss":"^3.4.0","style-loader":"^3.3.1","stylelint-config-prettier":"^8.0.1","stylelint-prettier":"^1.1.2","svg-mixer":"^2.3.14","terser-webpack-plugin":"^5.2.4","typescript":"^3.7.2","webpack":"^5.60.0","webpack-cli":"^4.9.1"},"peerDependencies":{"react":"^16.8.6","react-dom":"^16.8.6"},"resolutions":{"@babel/types":"^7.15.6","@types/node":"^12.12.8","**/caniuse-lite":"1.0.30001274"},"browserslist":["last 2 versions",">1%","not op_mini all","not dead","not ie 11"],"author":"Plesk Developers <plesk-dev-leads@plesk.com> (https://www.plesk.com/)","license":"Apache-2.0"}');
92256
92306
 
92257
92307
  /***/ }),
92258
92308