@gravity-ui/page-constructor 2.11.0 → 2.12.0

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 (76) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/cjs/blocks/Security/Security.js +2 -1
  3. package/build/cjs/blocks/Security/i18n/en.json +3 -0
  4. package/build/cjs/blocks/Security/i18n/index.d.ts +2 -0
  5. package/build/cjs/blocks/Security/i18n/index.js +8 -0
  6. package/build/cjs/blocks/Security/i18n/ru.json +3 -0
  7. package/build/cjs/components/Button/Button.js +2 -2
  8. package/build/cjs/components/Button/i18n/en.json +3 -0
  9. package/build/cjs/components/Button/i18n/index.d.ts +2 -0
  10. package/build/cjs/components/Button/i18n/index.js +8 -0
  11. package/build/cjs/components/Button/i18n/ru.json +3 -0
  12. package/build/cjs/components/Control/Control.js +2 -1
  13. package/build/cjs/components/Control/i18n/en.json +3 -0
  14. package/build/cjs/components/Control/i18n/index.d.ts +2 -0
  15. package/build/cjs/components/Control/i18n/index.js +8 -0
  16. package/build/cjs/components/Control/i18n/ru.json +3 -0
  17. package/build/cjs/components/FullscreenImage/FullscreenImage.js +3 -2
  18. package/build/cjs/components/FullscreenImage/i18n/en.json +3 -0
  19. package/build/cjs/components/FullscreenImage/i18n/index.d.ts +2 -0
  20. package/build/cjs/components/FullscreenImage/i18n/index.js +8 -0
  21. package/build/cjs/components/FullscreenImage/i18n/ru.json +3 -0
  22. package/build/cjs/components/Image/Image.js +2 -1
  23. package/build/cjs/components/Image/i18n/en.json +3 -0
  24. package/build/cjs/components/Image/i18n/index.d.ts +2 -0
  25. package/build/cjs/components/Image/i18n/index.js +8 -0
  26. package/build/cjs/components/Image/i18n/ru.json +3 -0
  27. package/build/cjs/components/Map/GoogleMap.js +1 -1
  28. package/build/cjs/components/Media/DataLens/DataLens.js +2 -1
  29. package/build/cjs/components/Media/DataLens/i18n/en.json +3 -0
  30. package/build/cjs/components/Media/DataLens/i18n/index.d.ts +2 -0
  31. package/build/cjs/components/Media/DataLens/i18n/index.js +8 -0
  32. package/build/cjs/components/Media/DataLens/i18n/ru.json +3 -0
  33. package/build/cjs/components/VideoBlock/VideoBlock.js +3 -0
  34. package/build/cjs/components/VideoBlock/i18n/en.json +3 -0
  35. package/build/cjs/components/VideoBlock/i18n/index.d.ts +2 -0
  36. package/build/cjs/components/VideoBlock/i18n/index.js +8 -0
  37. package/build/cjs/components/VideoBlock/i18n/ru.json +3 -0
  38. package/build/cjs/components/YandexForm/YandexForm.js +1 -0
  39. package/build/esm/blocks/Security/Security.js +2 -1
  40. package/build/esm/blocks/Security/i18n/en.json +3 -0
  41. package/build/esm/blocks/Security/i18n/index.d.ts +2 -0
  42. package/build/esm/blocks/Security/i18n/index.js +5 -0
  43. package/build/esm/blocks/Security/i18n/ru.json +3 -0
  44. package/build/esm/components/Button/Button.js +2 -2
  45. package/build/esm/components/Button/i18n/en.json +3 -0
  46. package/build/esm/components/Button/i18n/index.d.ts +2 -0
  47. package/build/esm/components/Button/i18n/index.js +5 -0
  48. package/build/esm/components/Button/i18n/ru.json +3 -0
  49. package/build/esm/components/Control/Control.js +2 -1
  50. package/build/esm/components/Control/i18n/en.json +3 -0
  51. package/build/esm/components/Control/i18n/index.d.ts +2 -0
  52. package/build/esm/components/Control/i18n/index.js +5 -0
  53. package/build/esm/components/Control/i18n/ru.json +3 -0
  54. package/build/esm/components/FullscreenImage/FullscreenImage.js +3 -2
  55. package/build/esm/components/FullscreenImage/i18n/en.json +3 -0
  56. package/build/esm/components/FullscreenImage/i18n/index.d.ts +2 -0
  57. package/build/esm/components/FullscreenImage/i18n/index.js +5 -0
  58. package/build/esm/components/FullscreenImage/i18n/ru.json +3 -0
  59. package/build/esm/components/Image/Image.js +2 -1
  60. package/build/esm/components/Image/i18n/en.json +3 -0
  61. package/build/esm/components/Image/i18n/index.d.ts +2 -0
  62. package/build/esm/components/Image/i18n/index.js +5 -0
  63. package/build/esm/components/Image/i18n/ru.json +3 -0
  64. package/build/esm/components/Map/GoogleMap.js +1 -1
  65. package/build/esm/components/Media/DataLens/DataLens.js +2 -1
  66. package/build/esm/components/Media/DataLens/i18n/en.json +3 -0
  67. package/build/esm/components/Media/DataLens/i18n/index.d.ts +2 -0
  68. package/build/esm/components/Media/DataLens/i18n/index.js +5 -0
  69. package/build/esm/components/Media/DataLens/i18n/ru.json +3 -0
  70. package/build/esm/components/VideoBlock/VideoBlock.js +3 -0
  71. package/build/esm/components/VideoBlock/i18n/en.json +3 -0
  72. package/build/esm/components/VideoBlock/i18n/index.d.ts +2 -0
  73. package/build/esm/components/VideoBlock/i18n/index.js +5 -0
  74. package/build/esm/components/VideoBlock/i18n/ru.json +3 -0
  75. package/build/esm/components/YandexForm/YandexForm.js +1 -0
  76. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.12.0](https://github.com/gravity-ui/page-constructor/compare/v2.11.0...v2.12.0) (2023-04-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * add alt to img ([#309](https://github.com/gravity-ui/page-constructor/issues/309)) ([a1e5587](https://github.com/gravity-ui/page-constructor/commit/a1e5587ada92b53097ac77f16c1cdad7a4899219))
9
+
3
10
  ## [2.11.0](https://github.com/gravity-ui/page-constructor/compare/v2.10.0...v2.11.0) (2023-04-25)
4
11
 
5
12
 
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const components_1 = require("../../components");
7
7
  const grid_1 = require("../../grid");
8
8
  const utils_1 = require("../../utils");
9
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
9
10
  const b = (0, utils_1.block)('SecurityBlock');
10
11
  const SecurityBlock = (props) => {
11
12
  const { backgroundColor, theme = 'dark', title, points, media, animated } = props;
@@ -17,7 +18,7 @@ const SecurityBlock = (props) => {
17
18
  react_1.default.createElement(grid_1.Col, null,
18
19
  react_1.default.createElement("h2", { className: b('title') }, title))),
19
20
  points && (react_1.default.createElement(grid_1.Row, { className: b('points') }, points.map(({ text, link, img }, index) => (react_1.default.createElement(grid_1.Col, { key: index, className: b('point'), sizes: { sm: 4, all: 12 } },
20
- react_1.default.createElement(components_1.ImageBase, { className: b('point-icon'), src: img }),
21
+ react_1.default.createElement(components_1.ImageBase, { className: b('point-icon'), src: img, alt: text || (0, i18n_1.default)('image-alt') }),
21
22
  react_1.default.createElement(components_1.HTML, { className: b('point-text'), block: true }, text),
22
23
  link && (react_1.default.createElement(components_1.Link, { className: b('point-link'), text: link.text, url: link.url, theme: 'normal', arrow: true }))))))),
23
24
  media && (react_1.default.createElement(grid_1.Row, { className: b('media') },
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Point icon"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'SecurityBlock';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка"
3
+ }
@@ -9,7 +9,7 @@ const useMetrika_1 = require("../../hooks/useMetrika");
9
9
  const icons_1 = require("../../icons");
10
10
  const models_1 = require("../../models");
11
11
  const utils_1 = require("../../utils");
12
- const ImageBase_1 = tslib_1.__importDefault(require("../ImageBase/ImageBase"));
12
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
13
13
  const utils_2 = require("./utils");
14
14
  const b = (0, utils_1.block)('button-block');
15
15
  const Button = (props) => {
@@ -37,7 +37,7 @@ const Button = (props) => {
37
37
  return react_1.default.createElement(uikit_1.StoreBadge, { className: buttonClass, platform: platform, lang: lang, url: url });
38
38
  }
39
39
  let icon;
40
- let image = img && react_1.default.createElement(ImageBase_1.default, { className: b('image'), src: buttonImg.url, alt: buttonImg.alt });
40
+ let image = img && (react_1.default.createElement("img", { className: b('image'), src: buttonImg.url, alt: buttonImg.alt || (0, i18n_1.default)('image-alt') }));
41
41
  if (theme === 'github') {
42
42
  icon = react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.Github, size: 24, qa: utils_2.ICON_QA });
43
43
  image = undefined;
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Button image"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'Button';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка кнопки"
3
+ }
@@ -4,10 +4,11 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importDefault(require("react"));
5
5
  const uikit_1 = require("@gravity-ui/uikit");
6
6
  const utils_1 = require("../../utils");
7
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
7
8
  const b = (0, utils_1.block)('control');
8
9
  const Control = (props) => {
9
10
  const { icon, theme = 'primary', size = 's', iconSize = 16, disabled = false, onClick, className, } = props;
10
- return (react_1.default.createElement("button", { type: "button", className: b({ size, theme, disabled }, className), onClick: disabled ? undefined : onClick, disabled: disabled },
11
+ return (react_1.default.createElement("button", { type: "button", "aria-label": (0, i18n_1.default)('aria-label'), className: b({ size, theme, disabled }, className), onClick: disabled ? undefined : onClick, disabled: disabled },
11
12
  react_1.default.createElement(uikit_1.Icon, { data: icon, size: iconSize })));
12
13
  };
13
14
  exports.default = Control;
@@ -0,0 +1,3 @@
1
+ {
2
+ "aria-label": "Button label"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'Control';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "aria-label": "Лейбл кнопки"
3
+ }
@@ -6,11 +6,12 @@ const uikit_1 = require("@gravity-ui/uikit");
6
6
  const icons_1 = require("../../icons");
7
7
  const utils_1 = require("../../utils");
8
8
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
9
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
9
10
  const b = (0, utils_1.block)('FullScreenImage');
10
11
  const FULL_SCREEN_ICON_SIZE = 18;
11
12
  const CLOSE_ICON_SIZE = 30;
12
13
  const FullScreenImage = (props) => {
13
- const { imageClassName, modalImageClass, imageStyle } = props;
14
+ const { imageClassName, modalImageClass, imageStyle, alt = (0, i18n_1.default)('img-alt') } = props;
14
15
  const [isOpened, setIsOpened] = (0, react_1.useState)(false);
15
16
  const [isMouseEnter, setIsMouseEnter] = (0, react_1.useState)(false);
16
17
  const openModal = () => setIsOpened(true);
@@ -19,7 +20,7 @@ const FullScreenImage = (props) => {
19
20
  const hideFullScreenIcon = () => setIsMouseEnter(false);
20
21
  return (react_1.default.createElement("div", { className: b() },
21
22
  react_1.default.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
22
- react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
23
+ react_1.default.createElement(Image_1.default, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
23
24
  react_1.default.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
24
25
  react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
25
26
  isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Full screen image"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'FullScreenImage';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Полноэкранное изображение"
3
+ }
@@ -6,12 +6,13 @@ const constants_1 = require("../../constants");
6
6
  const projectSettingsContext_1 = require("../../context/projectSettingsContext");
7
7
  const imageCompress_1 = require("../../utils/imageCompress");
8
8
  const ImageBase_1 = tslib_1.__importDefault(require("../ImageBase/ImageBase"));
9
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
9
10
  const checkWebP = (src) => {
10
11
  return src.endsWith('.webp') ? src : src + '.webp';
11
12
  };
12
13
  const Image = (props) => {
13
14
  const projectSettings = (0, react_1.useContext)(projectSettingsContext_1.ProjectSettingsContext);
14
- const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, } = props;
15
+ const { src: imageSrc, alt = (0, i18n_1.default)('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, } = props;
15
16
  const [imgLoadingError, setImgLoadingError] = (0, react_1.useState)(false);
16
17
  const src = imageSrc || desktop;
17
18
  if (!src) {
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Image alt"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'Image';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Альтернатива изображению"
3
+ }
@@ -39,6 +39,6 @@ const GoogleMap = (props) => {
39
39
  }
40
40
  return (react_1.default.createElement("iframe", { className: b(), ref: ref, style: {
41
41
  height,
42
- }, loading: "lazy", allowFullScreen: true, referrerPolicy: "no-referrer-when-downgrade", src: src }));
42
+ }, title: "Google Map", loading: "lazy", allowFullScreen: true, referrerPolicy: "no-referrer-when-downgrade", src: src }));
43
43
  };
44
44
  exports.default = GoogleMap;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importDefault(require("react"));
5
5
  const utils_1 = require("../../../utils");
6
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
6
7
  const utils_2 = require("./utils");
7
8
  const b = (0, utils_1.block)('media-component-data-lens');
8
9
  const DataLens = (props) => {
9
10
  const { dataLens } = props;
10
11
  const dataLensData = (0, utils_2.unifyDataLensToObject)(dataLens);
11
12
  return dataLens ? (react_1.default.createElement("div", { className: b('wrap') },
12
- react_1.default.createElement("iframe", { src: `https://datalens.yandex/${dataLensData.id}?_embedded=1&_theme=${dataLensData.theme}`, className: b('iframe'), frameBorder: 0 }))) : null;
13
+ react_1.default.createElement("iframe", { src: `https://datalens.yandex/${dataLensData.id}?_embedded=1&_theme=${dataLensData.theme}`, className: b('iframe'), loading: "lazy", title: (0, i18n_1.default)('iframe-title'), frameBorder: 0 }))) : null;
13
14
  };
14
15
  exports.default = DataLens;
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Datalens frame"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'DataLens';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Фрейм данных"
3
+ }
@@ -9,6 +9,7 @@ const uikit_1 = require("@gravity-ui/uikit");
9
9
  const icons_1 = require("../../icons");
10
10
  const utils_1 = require("../../utils");
11
11
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
12
+ const i18n_1 = tslib_1.__importDefault(require("./i18n"));
12
13
  const RECORD_URL = 'https://www.youtube.com/embed/';
13
14
  const STREAM_URL = 'https://www.youtube.com/embed/live_stream?channel=';
14
15
  const RECORD_RE = /[0-9A-Za-z_-]{11}/;
@@ -73,9 +74,11 @@ const VideoBlock = (props) => {
73
74
  iframe.src = fullSrc;
74
75
  iframe.width = '100%';
75
76
  iframe.height = '100%';
77
+ iframe.title = (0, i18n_1.default)('iframe-title');
76
78
  iframe.frameBorder = '0';
77
79
  iframe.setAttribute('allowfullscreen', 'true');
78
80
  iframe.setAttribute('allow', 'autoplay');
81
+ iframe.setAttribute('loading', 'lazy');
79
82
  ref.current.appendChild(iframe);
80
83
  iframeRef.current = iframe;
81
84
  }
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Video frame"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const registerKeyset_1 = require("../../../utils/registerKeyset");
5
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
6
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
7
+ const COMPONENT = 'VideoBlock';
8
+ exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Фрейм видеоблока"
3
+ }
@@ -48,6 +48,7 @@ const YandexForm = (props) => {
48
48
  iframeRef.current.src = src;
49
49
  iframeRef.current.id = containerId;
50
50
  iframeRef.current.name = `form${id}`;
51
+ iframeRef.current.setAttribute('loading', 'lazy');
51
52
  iframeRef.current.frameBorder = '0';
52
53
  iframeRef.current.scrolling = 'no';
53
54
  iframeRef.current.width = '100%';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { AnimateBlock, FullWidthBackground, HTML, ImageBase, Link, Media } from '../../components';
3
3
  import { Col, Grid, Row } from '../../grid';
4
4
  import { block } from '../../utils';
5
+ import i18n from './i18n';
5
6
  import './Security.css';
6
7
  const b = block('SecurityBlock');
7
8
  export const SecurityBlock = (props) => {
@@ -14,7 +15,7 @@ export const SecurityBlock = (props) => {
14
15
  React.createElement(Col, null,
15
16
  React.createElement("h2", { className: b('title') }, title))),
16
17
  points && (React.createElement(Row, { className: b('points') }, points.map(({ text, link, img }, index) => (React.createElement(Col, { key: index, className: b('point'), sizes: { sm: 4, all: 12 } },
17
- React.createElement(ImageBase, { className: b('point-icon'), src: img }),
18
+ React.createElement(ImageBase, { className: b('point-icon'), src: img, alt: text || i18n('image-alt') }),
18
19
  React.createElement(HTML, { className: b('point-text'), block: true }, text),
19
20
  link && (React.createElement(Link, { className: b('point-link'), text: link.text, url: link.url, theme: 'normal', arrow: true }))))))),
20
21
  media && (React.createElement(Row, { className: b('media') },
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Point icon"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'SecurityBlock';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка"
3
+ }
@@ -7,7 +7,7 @@ import { useMetrika } from '../../hooks/useMetrika';
7
7
  import { Github } from '../../icons';
8
8
  import { DefaultEventNames } from '../../models';
9
9
  import { block, setUrlTld } from '../../utils';
10
- import ImageBase from '../ImageBase/ImageBase';
10
+ import i18n from './i18n';
11
11
  import { ICON_QA, toCommonSize, toCommonView } from './utils';
12
12
  import './Button.css';
13
13
  const b = block('button-block');
@@ -36,7 +36,7 @@ const Button = (props) => {
36
36
  return React.createElement(StoreBadge, { className: buttonClass, platform: platform, lang: lang, url: url });
37
37
  }
38
38
  let icon;
39
- let image = img && React.createElement(ImageBase, { className: b('image'), src: buttonImg.url, alt: buttonImg.alt });
39
+ let image = img && (React.createElement("img", { className: b('image'), src: buttonImg.url, alt: buttonImg.alt || i18n('image-alt') }));
40
40
  if (theme === 'github') {
41
41
  icon = React.createElement(Icon, { className: b('icon'), data: Github, size: 24, qa: ICON_QA });
42
42
  image = undefined;
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Button image"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'Button';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка кнопки"
3
+ }
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
3
  import { block } from '../../utils';
4
+ import i18n from './i18n';
4
5
  import './Control.css';
5
6
  const b = block('control');
6
7
  const Control = (props) => {
7
8
  const { icon, theme = 'primary', size = 's', iconSize = 16, disabled = false, onClick, className, } = props;
8
- return (React.createElement("button", { type: "button", className: b({ size, theme, disabled }, className), onClick: disabled ? undefined : onClick, disabled: disabled },
9
+ return (React.createElement("button", { type: "button", "aria-label": i18n('aria-label'), className: b({ size, theme, disabled }, className), onClick: disabled ? undefined : onClick, disabled: disabled },
9
10
  React.createElement(Icon, { data: icon, size: iconSize })));
10
11
  };
11
12
  export default Control;
@@ -0,0 +1,3 @@
1
+ {
2
+ "aria-label": "Button label"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'Control';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "aria-label": "Лейбл кнопки"
3
+ }
@@ -3,12 +3,13 @@ import { Icon, Modal } from '@gravity-ui/uikit';
3
3
  import { FullScreen, PreviewClose } from '../../icons';
4
4
  import { block } from '../../utils';
5
5
  import Image from '../Image/Image';
6
+ import i18n from './i18n';
6
7
  import './FullScreenImage.css';
7
8
  const b = block('FullScreenImage');
8
9
  const FULL_SCREEN_ICON_SIZE = 18;
9
10
  const CLOSE_ICON_SIZE = 30;
10
11
  const FullScreenImage = (props) => {
11
- const { imageClassName, modalImageClass, imageStyle } = props;
12
+ const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt') } = props;
12
13
  const [isOpened, setIsOpened] = useState(false);
13
14
  const [isMouseEnter, setIsMouseEnter] = useState(false);
14
15
  const openModal = () => setIsOpened(true);
@@ -17,7 +18,7 @@ const FullScreenImage = (props) => {
17
18
  const hideFullScreenIcon = () => setIsMouseEnter(false);
18
19
  return (React.createElement("div", { className: b() },
19
20
  React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
20
- React.createElement(Image, Object.assign({}, props, { className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
21
+ React.createElement(Image, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
21
22
  React.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
22
23
  React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
23
24
  isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Full screen image"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'FullScreenImage';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Полноэкранное изображение"
3
+ }
@@ -3,12 +3,13 @@ import { BREAKPOINTS } from '../../constants';
3
3
  import { ProjectSettingsContext } from '../../context/projectSettingsContext';
4
4
  import { isCompressible } from '../../utils/imageCompress';
5
5
  import ImageBase from '../ImageBase/ImageBase';
6
+ import i18n from './i18n';
6
7
  const checkWebP = (src) => {
7
8
  return src.endsWith('.webp') ? src : src + '.webp';
8
9
  };
9
10
  const Image = (props) => {
10
11
  const projectSettings = useContext(ProjectSettingsContext);
11
- const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, } = props;
12
+ const { src: imageSrc, alt = i18n('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, } = props;
12
13
  const [imgLoadingError, setImgLoadingError] = useState(false);
13
14
  const src = imageSrc || desktop;
14
15
  if (!src) {
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Image alt"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'Image';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "img-alt": "Альтернатива изображению"
3
+ }
@@ -36,6 +36,6 @@ const GoogleMap = (props) => {
36
36
  }
37
37
  return (React.createElement("iframe", { className: b(), ref: ref, style: {
38
38
  height,
39
- }, loading: "lazy", allowFullScreen: true, referrerPolicy: "no-referrer-when-downgrade", src: src }));
39
+ }, title: "Google Map", loading: "lazy", allowFullScreen: true, referrerPolicy: "no-referrer-when-downgrade", src: src }));
40
40
  };
41
41
  export default GoogleMap;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { block } from '../../../utils';
3
+ import i18n from './i18n';
3
4
  import { unifyDataLensToObject } from './utils';
4
5
  import './DataLens.css';
5
6
  const b = block('media-component-data-lens');
@@ -7,6 +8,6 @@ const DataLens = (props) => {
7
8
  const { dataLens } = props;
8
9
  const dataLensData = unifyDataLensToObject(dataLens);
9
10
  return dataLens ? (React.createElement("div", { className: b('wrap') },
10
- React.createElement("iframe", { src: `https://datalens.yandex/${dataLensData.id}?_embedded=1&_theme=${dataLensData.theme}`, className: b('iframe'), frameBorder: 0 }))) : null;
11
+ React.createElement("iframe", { src: `https://datalens.yandex/${dataLensData.id}?_embedded=1&_theme=${dataLensData.theme}`, className: b('iframe'), loading: "lazy", title: i18n('iframe-title'), frameBorder: 0 }))) : null;
11
12
  };
12
13
  export default DataLens;
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Datalens frame"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'DataLens';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Фрейм данных"
3
+ }
@@ -5,6 +5,7 @@ import { Icon } from '@gravity-ui/uikit';
5
5
  import { PlayVideo } from '../../icons';
6
6
  import { block, getPageSearchParams } from '../../utils';
7
7
  import Image from '../Image/Image';
8
+ import i18n from './i18n';
8
9
  import './VideoBlock.css';
9
10
  const RECORD_URL = 'https://www.youtube.com/embed/';
10
11
  const STREAM_URL = 'https://www.youtube.com/embed/live_stream?channel=';
@@ -69,9 +70,11 @@ const VideoBlock = (props) => {
69
70
  iframe.src = fullSrc;
70
71
  iframe.width = '100%';
71
72
  iframe.height = '100%';
73
+ iframe.title = i18n('iframe-title');
72
74
  iframe.frameBorder = '0';
73
75
  iframe.setAttribute('allowfullscreen', 'true');
74
76
  iframe.setAttribute('allow', 'autoplay');
77
+ iframe.setAttribute('loading', 'lazy');
75
78
  ref.current.appendChild(iframe);
76
79
  iframeRef.current = iframe;
77
80
  }
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Video frame"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'VideoBlock';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Фрейм видеоблока"
3
+ }
@@ -44,6 +44,7 @@ const YandexForm = (props) => {
44
44
  iframeRef.current.src = src;
45
45
  iframeRef.current.id = containerId;
46
46
  iframeRef.current.name = `form${id}`;
47
+ iframeRef.current.setAttribute('loading', 'lazy');
47
48
  iframeRef.current.frameBorder = '0';
48
49
  iframeRef.current.scrolling = 'no';
49
50
  iframeRef.current.width = '100%';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {