@gravity-ui/page-constructor 5.18.0 → 5.18.1-alpha.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 (47) hide show
  1. package/build/cjs/blocks/HeaderSlider/HeaderSlider.js +2 -2
  2. package/build/cjs/blocks/Questions/QuestionBlockItem/QuestionBlockItem.js +4 -1
  3. package/build/cjs/components/DefaultVideo/DefaultVideo.js +2 -0
  4. package/build/cjs/components/ImageBase/ImageBase.js +1 -0
  5. package/build/cjs/components/Media/Image/Image.js +2 -2
  6. package/build/cjs/components/OutsideClick/OutsideClick.js +3 -0
  7. package/build/cjs/components/ReactPlayer/ReactPlayer.js +3 -0
  8. package/build/cjs/components/Title/TitleItem.js +3 -0
  9. package/build/cjs/components/VideoBlock/VideoBlock.js +3 -0
  10. package/build/cjs/editor/components/AddBlock/AddBlock.js +3 -0
  11. package/build/cjs/editor/components/EditBlock/EditBlock.js +3 -0
  12. package/build/cjs/models/navigation.d.ts +1 -0
  13. package/build/cjs/navigation/components/Logo/Logo.d.ts +1 -0
  14. package/build/cjs/navigation/components/Logo/Logo.js +5 -1
  15. package/build/cjs/navigation/components/Logo/i18n/en.json +3 -0
  16. package/build/cjs/navigation/components/Logo/i18n/index.d.ts +1 -0
  17. package/build/cjs/navigation/components/Logo/i18n/index.js +9 -0
  18. package/build/cjs/navigation/components/Logo/i18n/ru.json +3 -0
  19. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.css +16 -0
  20. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
  21. package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.css +7 -0
  22. package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/List.js +1 -1
  23. package/build/esm/blocks/HeaderSlider/HeaderSlider.js +1 -1
  24. package/build/esm/blocks/Questions/QuestionBlockItem/QuestionBlockItem.js +4 -1
  25. package/build/esm/components/DefaultVideo/DefaultVideo.js +2 -0
  26. package/build/esm/components/ImageBase/ImageBase.js +1 -0
  27. package/build/esm/components/Media/Image/Image.js +1 -1
  28. package/build/esm/components/OutsideClick/OutsideClick.js +3 -0
  29. package/build/esm/components/ReactPlayer/ReactPlayer.js +3 -0
  30. package/build/esm/components/Title/TitleItem.js +3 -0
  31. package/build/esm/components/VideoBlock/VideoBlock.js +3 -0
  32. package/build/esm/editor/components/AddBlock/AddBlock.js +3 -0
  33. package/build/esm/editor/components/EditBlock/EditBlock.js +3 -0
  34. package/build/esm/models/navigation.d.ts +1 -0
  35. package/build/esm/navigation/components/Logo/Logo.d.ts +1 -0
  36. package/build/esm/navigation/components/Logo/Logo.js +6 -1
  37. package/build/esm/navigation/components/Logo/i18n/en.json +3 -0
  38. package/build/esm/navigation/components/Logo/i18n/index.d.ts +1 -0
  39. package/build/esm/navigation/components/Logo/i18n/index.js +5 -0
  40. package/build/esm/navigation/components/Logo/i18n/ru.json +3 -0
  41. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.css +16 -0
  42. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
  43. package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.css +7 -0
  44. package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/List.js +1 -1
  45. package/package.json +2 -2
  46. package/server/models/navigation.d.ts +1 -0
  47. package/widget/index.js +1 -1
@@ -7,14 +7,14 @@ const mobileContext_1 = require("../../context/mobileContext");
7
7
  const models_1 = require("../../models");
8
8
  const utils_1 = require("../../utils");
9
9
  const Header_1 = tslib_1.__importDefault(require("../Header/Header"));
10
- const index_1 = require("../index");
10
+ const unstable_1 = require("../unstable");
11
11
  const b = (0, utils_1.block)('header-slider-block');
12
12
  const HeaderSliderBlock = (_a) => {
13
13
  var { items, arrows } = _a, props = tslib_1.__rest(_a, ["items", "arrows"]);
14
14
  const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
15
15
  const showArrows = isMobile ? false : arrows;
16
16
  return (react_1.default.createElement("div", { className: b('wrapper'), "data-qa": "header-slider" },
17
- react_1.default.createElement(index_1.SliderBlock, Object.assign({}, props, { arrows: showArrows, slidesToShow: 1, type: models_1.SliderType.HeaderCard, animated: false, blockClassName: b(), arrowSize: 20 }), items.map((item, index) => (react_1.default.createElement("div", { key: index, className: b('item'), "data-qa": `header-slider-item-${index + 1}` },
17
+ react_1.default.createElement(unstable_1.SliderNewBlock, Object.assign({}, props, { arrows: showArrows, slidesToShow: 1, type: models_1.SliderType.HeaderCard, animated: false, blockClassName: b(), arrowSize: 20 }), items.map((item, index) => (react_1.default.createElement("div", { key: index, className: b('item'), "data-qa": `header-slider-item-${index + 1}` },
18
18
  react_1.default.createElement(Header_1.default, Object.assign({}, item, { className: b('item-content') }))))))));
19
19
  };
20
20
  exports.HeaderSliderBlock = HeaderSliderBlock;
@@ -12,7 +12,10 @@ const b = (0, utils_1.block)('QuestionsBlockItem');
12
12
  const QuestionBlockItem = ({ title: itemTitle, text: itemText, link, listStyle = 'dash', isOpened, onClick, }) => {
13
13
  const { onKeyDown } = (0, uikit_1.useActionHandlers)(onClick);
14
14
  return (react_1.default.createElement("div", { className: b(), itemScope: true, itemProp: models_1.FaqMicrodataValues.QuestionProp, itemType: models_1.FaqMicrodataValues.QuestionType, role: 'listitem' },
15
- react_1.default.createElement("h3", { className: b('title'), onClick: onClick, "aria-expanded": isOpened, role: 'button', tabIndex: 0, onKeyDown: onKeyDown },
15
+ react_1.default.createElement("h3", { className: b('title'), onClick: onClick, "aria-expanded": isOpened,
16
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/966
17
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
18
+ role: 'button', tabIndex: 0, onKeyDown: onKeyDown },
16
19
  react_1.default.createElement(components_1.HTML, { itemProp: models_1.FaqMicrodataValues.QuestionNameProp }, itemTitle),
17
20
  react_1.default.createElement(components_1.ToggleArrow, { open: isOpened, size: 16, type: 'vertical', iconType: "navigation", className: b('arrow') })),
18
21
  react_1.default.createElement(components_1.Foldable, { isOpened: isOpened },
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultVideo = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ /* eslint-disable jsx-a11y/media-has-caption */
6
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/967
5
7
  const react_1 = tslib_1.__importStar(require("react"));
6
8
  const models_1 = require("../../models");
7
9
  const utils_1 = require("../../utils");
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const imageContext_1 = require("../../context/imageContext/imageContext");
7
7
  const ImageBase = (props) => {
8
8
  const { Image } = react_1.default.useContext(imageContext_1.ImageContext);
9
+ // eslint-disable-next-line jsx-a11y/alt-text
9
10
  return Image ? react_1.default.createElement(Image, Object.assign({}, props)) : react_1.default.createElement("img", Object.assign({}, props));
10
11
  };
11
12
  exports.ImageBase = ImageBase;
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const web_1 = require("@react-spring/web");
7
7
  const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
8
- const Slider_1 = tslib_1.__importDefault(require("../../../blocks/Slider/Slider"));
8
+ const unstable_1 = require("../../../blocks/unstable");
9
9
  const models_1 = require("../../../models");
10
10
  const utils_1 = require("../../../utils");
11
11
  const BackgroundImage_1 = tslib_1.__importDefault(require("../../BackgroundImage/BackgroundImage"));
@@ -56,7 +56,7 @@ const Image = (props) => {
56
56
  };
57
57
  const imageSlider = (imageArray) => {
58
58
  const fullscreenItem = fullscreen === undefined || fullscreen;
59
- return (react_1.default.createElement(Slider_1.default, { slidesToShow: 1, type: models_1.SliderType.MediaCard }, imageArray.map((item, index) => (react_1.default.createElement(react_1.Fragment, { key: index }, fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))))));
59
+ return (react_1.default.createElement(unstable_1.SliderNewBlock, { slidesToShow: 1, type: models_1.SliderType.MediaCard }, imageArray.map((item, index) => (react_1.default.createElement(react_1.Fragment, { key: index }, fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))))));
60
60
  };
61
61
  if (Array.isArray(image)) {
62
62
  return imageSlider(image);
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
7
  //TODO move into cloud components?
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ReactPlayerBlock = void 0;
4
7
  const tslib_1 = require("tslib");
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getArrowSize = void 0;
4
7
  const tslib_1 = require("tslib");
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getHeight = exports.AUTOPLAY_ATTRIBUTES = void 0;
4
7
  const tslib_1 = require("tslib");
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
7
  const react_1 = tslib_1.__importStar(require("react"));
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
3
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
4
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.EditBlockControls = void 0;
4
7
  const tslib_1 = require("tslib");
@@ -63,6 +63,7 @@ export interface NavigationLogoData {
63
63
  text?: string;
64
64
  url?: string;
65
65
  urlTitle?: string;
66
+ alt?: string;
66
67
  }
67
68
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
68
69
  export interface HeaderData {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ThemedNavigationLogoData } from '../../../models';
3
3
  export type LogoProps = ThemedNavigationLogoData & {
4
4
  className?: string;
5
+ alt?: string;
5
6
  };
6
7
  declare const Logo: React.FC<LogoProps>;
7
8
  export default Logo;
@@ -8,12 +8,16 @@ const RouterLink_1 = tslib_1.__importDefault(require("../../../components/Router
8
8
  const locationContext_1 = require("../../../context/locationContext");
9
9
  const theme_1 = require("../../../context/theme");
10
10
  const utils_2 = require("../../../utils");
11
+ const i18n_1 = require("./i18n");
11
12
  const b = (0, utils_2.block)('logo');
12
- const Logo = (props) => {
13
+ const Logo = (_a) => {
14
+ var { alt = (0, i18n_1.i18n)('image-alt') } = _a, restProps = tslib_1.__rest(_a, ["alt"]);
15
+ const props = Object.assign(Object.assign({}, restProps), { alt });
13
16
  const { hostname, Link } = (0, react_1.useContext)(locationContext_1.LocationContext);
14
17
  const theme = (0, theme_1.useTheme)();
15
18
  const themedLogoProps = (0, utils_2.getThemedValue)(props, theme) || props;
16
19
  const imageData = (0, utils_1.getMediaImage)(themedLogoProps.icon || props.icon);
20
+ imageData.alt = alt;
17
21
  const textData = themedLogoProps.text || props.text;
18
22
  const url = themedLogoProps.url || props.url || '/';
19
23
  const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Logo icon"
3
+ }
@@ -0,0 +1 @@
1
+ export declare const i18n: (key: "image-alt", params?: import("@gravity-ui/i18n").Params | undefined) => string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.i18n = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const i18n_1 = require("@gravity-ui/uikit/i18n");
6
+ const cn_1 = require("../../../../utils/cn");
7
+ const en_json_1 = tslib_1.__importDefault(require("./en.json"));
8
+ const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
9
+ exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}Logo`);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка лого"
3
+ }
@@ -1,8 +1,24 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
1
3
  .pc-navigation-dropdown {
2
4
  position: relative;
3
5
  display: flex;
4
6
  align-items: center;
5
7
  white-space: nowrap;
8
+ display: flex;
9
+ align-items: center;
10
+ height: 100%;
11
+ background: inherit;
12
+ font: inherit;
13
+ color: var(--g-color-text-primary);
14
+ border: none;
15
+ }
16
+ .pc-navigation-dropdown:focus {
17
+ outline: 2px solid var(--g-color-line-focus);
18
+ outline-offset: 0;
19
+ }
20
+ .pc-navigation-dropdown:focus:not(:focus-visible) {
21
+ outline: 0;
6
22
  }
7
23
  .pc-navigation-dropdown__arrow {
8
24
  margin-left: 7px;
@@ -15,8 +15,8 @@ const NavigationDropdown = (_a) => {
15
15
  const iconData = icon && (0, utils_1.getMediaImage)(icon);
16
16
  const anchorRef = (0, react_1.useRef)(null);
17
17
  return (react_1.default.createElement(react_1.Fragment, null,
18
- react_1.default.createElement("span", Object.assign({ ref: anchorRef }, props, { className: b(null, className) }),
19
- react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
18
+ react_1.default.createElement("button", Object.assign({ ref: anchorRef }, props, { type: "button", className: b(null, className), "aria-expanded": isActive }),
19
+ react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize, "aria-expanded": isActive }),
20
20
  react_1.default.createElement(components_1.ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isActive })),
21
21
  react_1.default.createElement(NavigationPopup_1.default, { open: isActive, onClose: hidePopup, items: items, anchorRef: anchorRef })));
22
22
  };
@@ -16,6 +16,13 @@ unpredictable css rules order in build */
16
16
  .pc-navigation-link:hover, .pc-navigation-link_active {
17
17
  color: var(--g-color-text-link);
18
18
  }
19
+ .pc-navigation-link:focus {
20
+ outline: 2px solid var(--g-color-line-focus);
21
+ outline-offset: 0;
22
+ }
23
+ .pc-navigation-link:focus:not(:focus-visible) {
24
+ outline: 0;
25
+ }
19
26
  .pc-navigation-link__arrow {
20
27
  position: relative;
21
28
  top: -2px;
@@ -8,7 +8,7 @@ const b = (0, utils_1.block)('marked-list');
8
8
  const List = (props) => {
9
9
  const { items = [], titleSize = 's' } = props;
10
10
  return (react_1.default.createElement(react_1.Fragment, null, items.map((item, id) => (react_1.default.createElement("div", { key: id, className: b('list-item') },
11
- react_1.default.createElement("img", { className: b('img') }),
11
+ react_1.default.createElement("img", { className: b('img'), alt: "" }),
12
12
  react_1.default.createElement("div", { className: b('text', { size: titleSize }) },
13
13
  react_1.default.createElement(components_1.YFMWrapper, { content: item.text, modifiers: { constructor: true } })))))));
14
14
  };
@@ -4,7 +4,7 @@ import { MobileContext } from '../../context/mobileContext';
4
4
  import { SliderType } from '../../models';
5
5
  import { block } from '../../utils';
6
6
  import Header from '../Header/Header';
7
- import { SliderBlock } from '../index';
7
+ import { SliderNewBlock as SliderBlock } from '../unstable';
8
8
  import './HeaderSlider.css';
9
9
  const b = block('header-slider-block');
10
10
  export const HeaderSliderBlock = (_a) => {
@@ -9,7 +9,10 @@ const b = block('QuestionsBlockItem');
9
9
  export const QuestionBlockItem = ({ title: itemTitle, text: itemText, link, listStyle = 'dash', isOpened, onClick, }) => {
10
10
  const { onKeyDown } = useActionHandlers(onClick);
11
11
  return (React.createElement("div", { className: b(), itemScope: true, itemProp: FaqMicrodataValues.QuestionProp, itemType: FaqMicrodataValues.QuestionType, role: 'listitem' },
12
- React.createElement("h3", { className: b('title'), onClick: onClick, "aria-expanded": isOpened, role: 'button', tabIndex: 0, onKeyDown: onKeyDown },
12
+ React.createElement("h3", { className: b('title'), onClick: onClick, "aria-expanded": isOpened,
13
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/966
14
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
15
+ role: 'button', tabIndex: 0, onKeyDown: onKeyDown },
13
16
  React.createElement(HTML, { itemProp: FaqMicrodataValues.QuestionNameProp }, itemTitle),
14
17
  React.createElement(ToggleArrow, { open: isOpened, size: 16, type: 'vertical', iconType: "navigation", className: b('arrow') })),
15
18
  React.createElement(Foldable, { isOpened: isOpened },
@@ -1,3 +1,5 @@
1
+ /* eslint-disable jsx-a11y/media-has-caption */
2
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/967
1
3
  import React, { Fragment, useCallback, useImperativeHandle, useRef, useState } from 'react';
2
4
  import { CustomControlsType, MediaVideoControlsType } from '../../models';
3
5
  import { block } from '../../utils';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ImageContext } from '../../context/imageContext/imageContext';
3
3
  export const ImageBase = (props) => {
4
4
  const { Image } = React.useContext(ImageContext);
5
+ // eslint-disable-next-line jsx-a11y/alt-text
5
6
  return Image ? React.createElement(Image, Object.assign({}, props)) : React.createElement("img", Object.assign({}, props));
6
7
  };
7
8
  export default ImageBase;
@@ -1,7 +1,7 @@
1
1
  import React, { Fragment, useEffect, useState } from 'react';
2
2
  import { animated, config, useSpring } from '@react-spring/web';
3
3
  import debounce from 'lodash/debounce';
4
- import SliderBlock from '../../../blocks/Slider/Slider';
4
+ import { SliderNewBlock as SliderBlock } from '../../../blocks/unstable';
5
5
  import { SliderType } from '../../../models';
6
6
  import { block, getQaAttrubutes } from '../../../utils';
7
7
  import BackgroundImage from '../../BackgroundImage/BackgroundImage';
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  //TODO move into cloud components?
2
5
  import React, { createRef } from 'react';
3
6
  export default class OutsideClick extends React.Component {
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  import React, { Fragment, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
2
5
  import { PlayFill } from '@gravity-ui/icons';
3
6
  import { Icon } from '@gravity-ui/uikit';
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  import React, { Fragment, useContext } from 'react';
2
5
  import { HTML, ToggleArrow } from '../';
3
6
  import { LocationContext } from '../../context/locationContext';
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
5
  import { PlayFill } from '@gravity-ui/icons';
3
6
  import { Icon } from '@gravity-ui/uikit';
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  import React, { useMemo, useRef, useState } from 'react';
2
5
  import { Plus } from '@gravity-ui/icons';
3
6
  import { Popup, TextInput } from '@gravity-ui/uikit';
@@ -1,3 +1,6 @@
1
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ // TODO fix in https://github.com/gravity-ui/page-constructor/issues/965
1
4
  import React, { useEffect, useRef } from 'react';
2
5
  import { ChevronDown, ChevronUp, Copy as CopyIcon, TrashBin } from '@gravity-ui/icons';
3
6
  import { block } from '../../../utils';
@@ -63,6 +63,7 @@ export interface NavigationLogoData {
63
63
  text?: string;
64
64
  url?: string;
65
65
  urlTitle?: string;
66
+ alt?: string;
66
67
  }
67
68
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
68
69
  export interface HeaderData {
@@ -3,6 +3,7 @@ import { ThemedNavigationLogoData } from '../../../models';
3
3
  import './Logo.css';
4
4
  export type LogoProps = ThemedNavigationLogoData & {
5
5
  className?: string;
6
+ alt?: string;
6
7
  };
7
8
  declare const Logo: React.FC<LogoProps>;
8
9
  export default Logo;
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  import React, { Fragment, useContext } from 'react';
2
3
  import { Image } from '../../../components';
3
4
  import { getMediaImage } from '../../../components/Media/Image/utils';
@@ -5,13 +6,17 @@ import RouterLink from '../../../components/RouterLink/RouterLink';
5
6
  import { LocationContext } from '../../../context/locationContext';
6
7
  import { useTheme } from '../../../context/theme';
7
8
  import { block, getLinkProps, getThemedValue } from '../../../utils';
9
+ import { i18n } from './i18n';
8
10
  import './Logo.css';
9
11
  const b = block('logo');
10
- const Logo = (props) => {
12
+ const Logo = (_a) => {
13
+ var { alt = i18n('image-alt') } = _a, restProps = __rest(_a, ["alt"]);
14
+ const props = Object.assign(Object.assign({}, restProps), { alt });
11
15
  const { hostname, Link } = useContext(LocationContext);
12
16
  const theme = useTheme();
13
17
  const themedLogoProps = getThemedValue(props, theme) || props;
14
18
  const imageData = getMediaImage(themedLogoProps.icon || props.icon);
19
+ imageData.alt = alt;
15
20
  const textData = themedLogoProps.text || props.text;
16
21
  const url = themedLogoProps.url || props.url || '/';
17
22
  const urlTitle = themedLogoProps.urlTitle || props.urlTitle || textData;
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Logo icon"
3
+ }
@@ -0,0 +1 @@
1
+ export declare const i18n: (key: "image-alt", params?: import("@gravity-ui/i18n").Params | undefined) => string;
@@ -0,0 +1,5 @@
1
+ import { addComponentKeysets } from '@gravity-ui/uikit/i18n';
2
+ import { NAMESPACE } from '../../../../utils/cn';
3
+ import en from './en.json';
4
+ import ru from './ru.json';
5
+ export const i18n = addComponentKeysets({ en, ru }, `${NAMESPACE}Logo`);
@@ -0,0 +1,3 @@
1
+ {
2
+ "image-alt": "Иконка лого"
3
+ }
@@ -1,8 +1,24 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
1
3
  .pc-navigation-dropdown {
2
4
  position: relative;
3
5
  display: flex;
4
6
  align-items: center;
5
7
  white-space: nowrap;
8
+ display: flex;
9
+ align-items: center;
10
+ height: 100%;
11
+ background: inherit;
12
+ font: inherit;
13
+ color: var(--g-color-text-primary);
14
+ border: none;
15
+ }
16
+ .pc-navigation-dropdown:focus {
17
+ outline: 2px solid var(--g-color-line-focus);
18
+ outline-offset: 0;
19
+ }
20
+ .pc-navigation-dropdown:focus:not(:focus-visible) {
21
+ outline: 0;
6
22
  }
7
23
  .pc-navigation-dropdown__arrow {
8
24
  margin-left: 7px;
@@ -13,8 +13,8 @@ export const NavigationDropdown = (_a) => {
13
13
  const iconData = icon && getMediaImage(icon);
14
14
  const anchorRef = useRef(null);
15
15
  return (React.createElement(Fragment, null,
16
- React.createElement("span", Object.assign({ ref: anchorRef }, props, { className: b(null, className) }),
17
- React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
16
+ React.createElement("button", Object.assign({ ref: anchorRef }, props, { type: "button", className: b(null, className), "aria-expanded": isActive }),
17
+ React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize, "aria-expanded": isActive }),
18
18
  React.createElement(ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isActive })),
19
19
  React.createElement(NavigationPopup, { open: isActive, onClose: hidePopup, items: items, anchorRef: anchorRef })));
20
20
  };
@@ -16,6 +16,13 @@ unpredictable css rules order in build */
16
16
  .pc-navigation-link:hover, .pc-navigation-link_active {
17
17
  color: var(--g-color-text-link);
18
18
  }
19
+ .pc-navigation-link:focus {
20
+ outline: 2px solid var(--g-color-line-focus);
21
+ outline-offset: 0;
22
+ }
23
+ .pc-navigation-link:focus:not(:focus-visible) {
24
+ outline: 0;
25
+ }
19
26
  .pc-navigation-link__arrow {
20
27
  position: relative;
21
28
  top: -2px;
@@ -6,7 +6,7 @@ const b = block('marked-list');
6
6
  const List = (props) => {
7
7
  const { items = [], titleSize = 's' } = props;
8
8
  return (React.createElement(Fragment, null, items.map((item, id) => (React.createElement("div", { key: id, className: b('list-item') },
9
- React.createElement("img", { className: b('img') }),
9
+ React.createElement("img", { className: b('img'), alt: "" }),
10
10
  React.createElement("div", { className: b('text', { size: titleSize }) },
11
11
  React.createElement(YFMWrapper, { content: item.text, modifiers: { constructor: true } })))))));
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "5.18.0",
3
+ "version": "5.18.1-alpha.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -124,7 +124,7 @@
124
124
  "@commitlint/cli": "^17.1.2",
125
125
  "@commitlint/config-conventional": "^17.1.0",
126
126
  "@diplodoc/transform": "^4.10.8",
127
- "@gravity-ui/eslint-config": "^2.0.0",
127
+ "@gravity-ui/eslint-config": "^2.2.0",
128
128
  "@gravity-ui/icons": "^2.8.1",
129
129
  "@gravity-ui/prettier-config": "^1.0.1",
130
130
  "@gravity-ui/stylelint-config": "^1.0.0",
@@ -63,6 +63,7 @@ export interface NavigationLogoData {
63
63
  text?: string;
64
64
  url?: string;
65
65
  urlTitle?: string;
66
+ alt?: string;
66
67
  }
67
68
  export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;
68
69
  export interface HeaderData {