@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.
@@ -5432,7 +5432,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
5432
5432
 
5433
5433
  const DEFAULT_ICONS = ['clock', 'emoticon-smile', 'rocket', 'sand-clock', 'sleep', 'web', 'star'];
5434
5434
 
5435
- const useIcon = (icons, initialCursor, isSync) => {
5435
+ const useIconCursor = (icons, initialCursor, isSync) => {
5436
5436
  const targetRef = (0, _react.useRef)(null);
5437
5437
  const [cursor, setCursor] = (0, _react.useState)(initialCursor);
5438
5438
  (0, _react.useEffect)(() => {
@@ -5454,50 +5454,58 @@ const useIcon = (icons, initialCursor, isSync) => {
5454
5454
  }
5455
5455
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
5456
5456
  }, [icons]);
5457
- return {
5458
- name: icons[cursor],
5459
- targetRef
5460
- };
5457
+ return [icons[cursor], targetRef];
5461
5458
  };
5462
5459
 
5463
5460
  const IconsLoader = ({
5464
5461
  baseClassName = `${_constants.CLS_PREFIX}icons-loader`,
5465
5462
  className,
5466
5463
  icons,
5464
+ size,
5465
+ style,
5467
5466
  ...props
5468
5467
  }) => {
5469
- const syncRef = (0, _react.useRef)(0);
5470
- icons = icons && icons.length > 0 ? icons : DEFAULT_ICONS;
5471
- const icon1 = useIcon(icons, 0, () => {
5472
- if (syncRef.current === 0) {
5473
- syncRef.current += 1;
5468
+ var _icons;
5469
+
5470
+ const syncRef = (0, _react.useRef)('icon1');
5471
+
5472
+ if (!((_icons = icons) !== null && _icons !== void 0 && _icons.length)) {
5473
+ icons = DEFAULT_ICONS;
5474
+ } else if (icons.length === 1) {
5475
+ icons = [icons[0], icons[0]];
5476
+ }
5477
+
5478
+ const [icon1, icon1Ref] = useIconCursor(icons, 0, () => {
5479
+ if (syncRef.current === 'icon1') {
5480
+ syncRef.current = 'icon2';
5474
5481
  return true;
5475
5482
  }
5476
5483
 
5477
5484
  return false;
5478
5485
  });
5479
- const icon2 = useIcon(icons, 1, () => {
5480
- if (syncRef.current === 1) {
5481
- syncRef.current -= 1;
5486
+ const [icon2, icon2Ref] = useIconCursor(icons, 1, () => {
5487
+ if (syncRef.current === 'icon2') {
5488
+ syncRef.current = 'icon1';
5482
5489
  return true;
5483
5490
  }
5484
5491
 
5485
5492
  return false;
5486
5493
  });
5487
5494
  return /*#__PURE__*/_react.default.createElement("div", _extends({
5488
- className: (0, _classnames.default)(baseClassName, className)
5495
+ className: (0, _classnames.default)(baseClassName, className),
5496
+ style: { ...style,
5497
+ ['--icons-loader-size']: size ? size : undefined
5498
+ }
5489
5499
  }, props), /*#__PURE__*/_react.default.createElement("div", {
5490
5500
  className: (0, _classnames.default)(`${baseClassName}__icon`, `${baseClassName}__icon--1`),
5491
- ref: icon1.targetRef
5492
- }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
5493
- name: icon1.name,
5494
- size: "64"
5501
+ ref: icon1Ref
5502
+ }, _Icon.default.create(icon1, {
5503
+ size: size ? size : '64'
5495
5504
  })), /*#__PURE__*/_react.default.createElement("div", {
5496
5505
  className: (0, _classnames.default)(`${baseClassName}__icon`, `${baseClassName}__icon--2`),
5497
- ref: icon2.targetRef
5498
- }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
5499
- name: icon2.name,
5500
- size: "64"
5506
+ ref: icon2Ref
5507
+ }, _Icon.default.create(icon2, {
5508
+ size: size ? size : '64'
5501
5509
  })));
5502
5510
  };
5503
5511
 
@@ -6255,7 +6263,9 @@ const propTypes = {
6255
6263
  closingConfirmation: _propTypes.default.bool,
6256
6264
 
6257
6265
  /**
6258
- * Wraps children into [Form](#!/Form) if not empty.
6266
+ * Wraps children into [Form](#!/Form) if not empty.<br>
6267
+ * **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
6268
+ *
6259
6269
  * @since 0.0.66
6260
6270
  */
6261
6271
  form: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.element]),
@@ -8810,7 +8820,7 @@ class FormField extends _react.Component {
8810
8820
  multi
8811
8821
  } = this.props;
8812
8822
 
8813
- if (!description || multi && this.fieldApi.getValue().length - 1 > index) {
8823
+ if (!description || multi && getArrayHelper(this.fieldApi.getValue()).length - 1 > index) {
8814
8824
  return null;
8815
8825
  }
8816
8826
 
@@ -10514,10 +10524,12 @@ FormFieldText.propTypes = {
10514
10524
  autoComplete: _propTypes.default.oneOf(['on', 'off']),
10515
10525
 
10516
10526
  /**
10517
- * If 'true', a field will be multiple
10527
+ * If 'true', a field will be multiple. You can also limit the number of fields with a value like { max: 5 }.
10518
10528
  * @since 1.12.0
10519
10529
  */
10520
- multi: _propTypes.default.bool,
10530
+ multi: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
10531
+ max: _propTypes.default.number.isRequired
10532
+ })]),
10521
10533
 
10522
10534
  /**
10523
10535
  * @ignore
@@ -92606,7 +92618,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
92606
92618
  /***/ ((module) => {
92607
92619
 
92608
92620
  "use strict";
92609
- module.exports = JSON.parse('{"name":"@plesk/ui-library","version":"3.29.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 --disable-host-check","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":"^1.0.0","@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.4.6","postcss-less":"^6.0.0","postcss-loader":"^6.2.1","postcss-logical":"^5.0.3","prettier":"^2.0.5","puppeteer-core":"13.1.3","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":"^14.3.0","stylelint-config-prettier":"^9.0.3","stylelint-declaration-block-no-ignored-properties":"^2.5.0","stylelint-no-unsupported-browser-features":"^5.0.2","stylelint-prettier":"^2.0.0","stylelint-use-logical-spec":"^3.2.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.30001390"},"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"}');
92621
+ module.exports = JSON.parse('{"name":"@plesk/ui-library","version":"3.29.2","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 --disable-host-check","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":"^1.0.0","@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.4.6","postcss-less":"^6.0.0","postcss-loader":"^6.2.1","postcss-logical":"^5.0.3","prettier":"^2.0.5","puppeteer-core":"13.1.3","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":"^14.3.0","stylelint-config-prettier":"^9.0.3","stylelint-declaration-block-no-ignored-properties":"^2.5.0","stylelint-no-unsupported-browser-features":"^5.0.2","stylelint-prettier":"^2.0.0","stylelint-use-logical-spec":"^3.2.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.30001390"},"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"}');
92610
92622
 
92611
92623
  /***/ }),
92612
92624