@gravity-ui/page-constructor 4.3.0 → 4.3.12-alpha.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.
- package/README.md +4 -0
- package/build/cjs/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/cjs/blocks/Header/Header.css +0 -6
- package/build/cjs/blocks/Icons/Icons.js +7 -1
- package/build/cjs/blocks/Icons/schema.d.ts +162 -0
- package/build/cjs/blocks/Icons/schema.js +11 -0
- package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -1
- package/build/cjs/blocks/Slider/Slider.css +4 -1
- package/build/cjs/blocks/Slider/Slider.js +32 -6
- package/build/cjs/blocks/Slider/i18n/en.json +4 -0
- package/build/cjs/blocks/Slider/i18n/index.d.ts +2 -0
- package/build/cjs/blocks/Slider/i18n/index.js +8 -0
- package/build/cjs/blocks/Slider/i18n/ru.json +4 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.d.ts +1 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +5 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +4 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/cjs/components/CardBase/CardBase.css +4 -4
- package/build/cjs/components/HTML/HTML.d.ts +5 -1
- package/build/cjs/components/HTML/HTML.js +3 -1
- package/build/cjs/components/Image/Image.js +7 -5
- package/build/cjs/components/Image/schema.d.ts +19 -0
- package/build/cjs/components/Image/schema.js +12 -1
- package/build/cjs/components/Link/Link.d.ts +2 -1
- package/build/cjs/components/Link/Link.js +4 -2
- package/build/cjs/components/Media/Image/Image.d.ts +3 -2
- package/build/cjs/components/Media/Image/Image.js +8 -5
- package/build/cjs/components/Media/Media.d.ts +2 -2
- package/build/cjs/components/Media/Media.js +9 -6
- package/build/cjs/components/Media/Video/Video.d.ts +2 -2
- package/build/cjs/components/Media/Video/Video.js +15 -6
- package/build/cjs/components/MetaInfo/MetaInfo.css +0 -2
- package/build/cjs/components/MetaInfo/MetaInfo.js +2 -1
- package/build/cjs/components/ReactPlayer/CustomBarControls.css +46 -14
- package/build/cjs/components/ReactPlayer/CustomBarControls.d.ts +4 -1
- package/build/cjs/components/ReactPlayer/CustomBarControls.js +33 -9
- package/build/cjs/components/ReactPlayer/ReactPlayer.css +12 -0
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +49 -25
- package/build/cjs/components/ReactPlayer/i18n/en.json +4 -1
- package/build/cjs/components/ReactPlayer/i18n/ru.json +4 -1
- package/build/cjs/components/Table/Table.js +11 -5
- package/build/cjs/components/VideoBlock/VideoBlock.js +7 -6
- package/build/cjs/components/YFMWrapper/YFMWrapper.d.ts +4 -3
- package/build/cjs/components/YFMWrapper/YFMWrapper.js +3 -3
- package/build/cjs/constructor-items.d.ts +10 -3
- package/build/cjs/constructor-items.js +11 -1
- package/build/cjs/containers/Loadable/Loadable.js +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.css +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.js +10 -6
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -2
- package/build/cjs/context/innerContext/InnerContext.d.ts +3 -1
- package/build/cjs/context/innerContext/InnerContext.js +2 -0
- package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/cjs/editor/components/EditBlock/EditBlock.css +1 -0
- package/build/cjs/editor/components/Layout/Layout.css +2 -1
- package/build/cjs/editor/containers/Form/Form.css +14 -35
- package/build/cjs/editor/store/index.js +1 -1
- package/build/cjs/editor/styles/root.css +2 -1
- package/build/cjs/editor/utils/index.d.ts +1 -0
- package/build/cjs/grid/Col/Col.d.ts +2 -4
- package/build/cjs/icons/Mute.d.ts +2 -0
- package/build/cjs/icons/Mute.js +12 -0
- package/build/cjs/icons/MuteSmall.d.ts +2 -0
- package/build/cjs/icons/MuteSmall.js +15 -0
- package/build/cjs/icons/Unmute.d.ts +2 -0
- package/build/cjs/icons/Unmute.js +12 -0
- package/build/cjs/icons/UnmuteSmall.d.ts +2 -0
- package/build/cjs/icons/UnmuteSmall.js +17 -0
- package/build/cjs/icons/VideoControlPause.d.ts +2 -0
- package/build/cjs/icons/VideoControlPause.js +16 -0
- package/build/cjs/icons/VideoControlPlay.d.ts +2 -0
- package/build/cjs/icons/VideoControlPlay.js +12 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +12 -5
- package/build/cjs/models/constructor-items/common.d.ts +16 -34
- package/build/cjs/models/constructor-items/common.js +6 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/cjs/models/constructor.d.ts +7 -1
- package/build/cjs/models/navigation.d.ts +1 -0
- package/build/cjs/models/navigation.js +2 -1
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +4 -16
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
- package/build/cjs/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/cjs/navigation/components/NavigationItem/index.js +14 -0
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/cjs/navigation/components/SocialIcon/SocialIcon.js +2 -1
- package/build/cjs/schema/constants.d.ts +181 -78
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/cjs/sub-blocks/Content/Content.d.ts +3 -1
- package/build/cjs/sub-blocks/Content/Content.js +7 -5
- package/build/cjs/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
- package/build/cjs/sub-blocks/Content/ContentList/ContentList.js +7 -5
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/cjs/sub-blocks/MediaCard/schema.js +11 -1
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +7 -4
- package/build/cjs/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/cjs/sub-blocks/Quote/Quote.css +0 -3
- package/build/cjs/text-transform/common.d.ts +7 -2
- package/build/cjs/text-transform/common.js +8 -2
- package/build/cjs/text-transform/config.js +1 -1
- package/build/cjs/text-transform/transformers.d.ts +2 -0
- package/build/cjs/text-transform/transformers.js +11 -8
- package/build/cjs/utils/blocks.d.ts +3 -6
- package/build/cjs/utils/blocks.js +25 -16
- package/build/cjs/utils/cn.d.ts +3 -3
- package/build/cjs/utils/cn.js +4 -7
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/esm/blocks/Header/Header.css +0 -6
- package/build/esm/blocks/Icons/Icons.js +8 -2
- package/build/esm/blocks/Icons/schema.d.ts +162 -0
- package/build/esm/blocks/Icons/schema.js +11 -0
- package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -1
- package/build/esm/blocks/Slider/Slider.css +4 -1
- package/build/esm/blocks/Slider/Slider.js +33 -7
- package/build/esm/blocks/Slider/i18n/en.json +4 -0
- package/build/esm/blocks/Slider/i18n/index.d.ts +2 -0
- package/build/esm/blocks/Slider/i18n/index.js +5 -0
- package/build/esm/blocks/Slider/i18n/ru.json +4 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.d.ts +1 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +5 -3
- package/build/esm/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +5 -4
- package/build/esm/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/esm/components/CardBase/CardBase.css +4 -4
- package/build/esm/components/HTML/HTML.d.ts +5 -1
- package/build/esm/components/HTML/HTML.js +3 -1
- package/build/esm/components/Image/Image.js +7 -5
- package/build/esm/components/Image/schema.d.ts +19 -0
- package/build/esm/components/Image/schema.js +12 -1
- package/build/esm/components/Link/Link.d.ts +2 -1
- package/build/esm/components/Link/Link.js +4 -2
- package/build/esm/components/Media/Image/Image.d.ts +3 -2
- package/build/esm/components/Media/Image/Image.js +8 -6
- package/build/esm/components/Media/Media.d.ts +2 -2
- package/build/esm/components/Media/Media.js +10 -7
- package/build/esm/components/Media/Video/Video.d.ts +2 -2
- package/build/esm/components/Media/Video/Video.js +16 -7
- package/build/esm/components/MetaInfo/MetaInfo.css +0 -2
- package/build/esm/components/MetaInfo/MetaInfo.js +2 -1
- package/build/esm/components/ReactPlayer/CustomBarControls.css +46 -14
- package/build/esm/components/ReactPlayer/CustomBarControls.d.ts +4 -1
- package/build/esm/components/ReactPlayer/CustomBarControls.js +34 -10
- package/build/esm/components/ReactPlayer/ReactPlayer.css +12 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.js +52 -28
- package/build/esm/components/ReactPlayer/i18n/en.json +4 -1
- package/build/esm/components/ReactPlayer/i18n/ru.json +4 -1
- package/build/esm/components/Table/Table.js +11 -5
- package/build/esm/components/VideoBlock/VideoBlock.js +7 -6
- package/build/esm/components/YFMWrapper/YFMWrapper.d.ts +4 -3
- package/build/esm/components/YFMWrapper/YFMWrapper.js +3 -3
- package/build/esm/constructor-items.d.ts +10 -3
- package/build/esm/constructor-items.js +10 -1
- package/build/esm/containers/Loadable/Loadable.js +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +4 -0
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/esm/containers/PageConstructor/PageConstructor.js +12 -8
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +1 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +4 -2
- package/build/esm/context/innerContext/InnerContext.d.ts +3 -1
- package/build/esm/context/innerContext/InnerContext.js +2 -0
- package/build/esm/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/esm/editor/components/EditBlock/EditBlock.css +1 -0
- package/build/esm/editor/components/Layout/Layout.css +2 -1
- package/build/esm/editor/containers/Form/Form.css +14 -35
- package/build/esm/editor/store/index.js +2 -2
- package/build/esm/editor/styles/root.css +2 -1
- package/build/esm/editor/utils/index.d.ts +1 -0
- package/build/esm/grid/Col/Col.d.ts +2 -4
- package/build/esm/icons/Mute.d.ts +2 -0
- package/build/esm/icons/Mute.js +7 -0
- package/build/esm/icons/MuteSmall.d.ts +2 -0
- package/build/esm/icons/MuteSmall.js +10 -0
- package/build/esm/icons/Unmute.d.ts +2 -0
- package/build/esm/icons/Unmute.js +7 -0
- package/build/esm/icons/UnmuteSmall.d.ts +2 -0
- package/build/esm/icons/UnmuteSmall.js +12 -0
- package/build/esm/icons/VideoControlPause.d.ts +2 -0
- package/build/esm/icons/VideoControlPause.js +11 -0
- package/build/esm/icons/VideoControlPlay.d.ts +2 -0
- package/build/esm/icons/VideoControlPlay.js +7 -0
- package/build/esm/models/constructor-items/blocks.d.ts +12 -5
- package/build/esm/models/constructor-items/common.d.ts +16 -34
- package/build/esm/models/constructor-items/common.js +5 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/esm/models/constructor.d.ts +7 -1
- package/build/esm/models/navigation.d.ts +1 -0
- package/build/esm/models/navigation.js +1 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -17
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
- package/build/esm/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/esm/navigation/components/NavigationItem/index.js +6 -0
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/esm/navigation/components/SocialIcon/SocialIcon.js +2 -1
- package/build/esm/schema/constants.d.ts +181 -78
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/esm/sub-blocks/Content/Content.d.ts +3 -1
- package/build/esm/sub-blocks/Content/Content.js +7 -5
- package/build/esm/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
- package/build/esm/sub-blocks/Content/ContentList/ContentList.js +7 -5
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/esm/sub-blocks/MediaCard/schema.js +11 -1
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +8 -4
- package/build/esm/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/esm/sub-blocks/Quote/Quote.css +0 -3
- package/build/esm/text-transform/common.d.ts +7 -2
- package/build/esm/text-transform/common.js +7 -2
- package/build/esm/text-transform/config.js +1 -1
- package/build/esm/text-transform/transformers.d.ts +2 -0
- package/build/esm/text-transform/transformers.js +11 -8
- package/build/esm/utils/blocks.d.ts +3 -6
- package/build/esm/utils/blocks.js +21 -11
- package/build/esm/utils/cn.d.ts +3 -3
- package/build/esm/utils/cn.js +3 -4
- package/package.json +6 -6
- package/server/models/constructor-items/blocks.d.ts +12 -5
- package/server/models/constructor-items/common.d.ts +16 -34
- package/server/models/constructor-items/common.js +6 -1
- package/server/models/constructor-items/sub-blocks.d.ts +4 -4
- package/server/models/constructor.d.ts +7 -1
- package/server/models/navigation.d.ts +1 -0
- package/server/models/navigation.js +2 -1
- package/server/text-transform/common.d.ts +7 -2
- package/server/text-transform/common.js +10 -2
- package/server/text-transform/config.js +1 -1
- package/server/text-transform/transformers.d.ts +2 -0
- package/server/text-transform/transformers.js +11 -8
- package/server/utils/blocks.d.ts +3 -6
- package/server/utils/blocks.js +25 -16
- package/server/utils/cn.d.ts +3 -3
- package/server/utils/cn.js +4 -9
- package/styles/mixins.scss +4 -1
- package/styles/storybook/common.scss +2 -0
- package/styles/styles.css +4 -0
- package/styles/yfm.scss +7 -0
- package/widget/index.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import React, { Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import SlickSlider from 'react-slick';
|
|
4
4
|
import Anchor from '../../components/Anchor/Anchor';
|
|
@@ -118,27 +118,53 @@ export const SliderBlock = (props) => {
|
|
|
118
118
|
slider.slickGoTo(nextIndex);
|
|
119
119
|
}
|
|
120
120
|
}, [slider, currentIndex, slidesCountByBreakpoint]);
|
|
121
|
+
const barSlidesCount = childrenCount - slidesToShowCount + 1;
|
|
122
|
+
const barPosition = (DOT_GAP + DOT_WIDTH) * currentIndex;
|
|
123
|
+
const barWidth = DOT_WIDTH + (DOT_GAP + DOT_WIDTH) * (slidesCountByBreakpoint - 1);
|
|
121
124
|
const renderBar = () => {
|
|
122
|
-
const barPosition = (DOT_GAP + DOT_WIDTH) * currentIndex;
|
|
123
|
-
const barWidth = DOT_WIDTH + (DOT_GAP + DOT_WIDTH) * (slidesCountByBreakpoint - 1);
|
|
124
125
|
return (slidesCountByBreakpoint > 1 && (React.createElement("li", { className: b('bar'), style: {
|
|
125
126
|
left: barPosition,
|
|
126
127
|
width: barWidth,
|
|
127
128
|
} })));
|
|
128
129
|
};
|
|
130
|
+
// renders additional bar, not visible in the layout but visible for screenreaders
|
|
131
|
+
const renderAccessibleBar = (index) => {
|
|
132
|
+
return (
|
|
133
|
+
// To have this key differ from keys used in renderDot function, added `-accessible-bar` part
|
|
134
|
+
React.createElement(Fragment, { key: `${index}-accessible-bar` }, slidesCountByBreakpoint > 1 && (React.createElement("li", { className: b('accessible-bar'), "aria-current": true, "aria-label": `Slide ${currentIndex + 1} of ${barSlidesCount}`, style: {
|
|
135
|
+
left: barPosition,
|
|
136
|
+
width: barWidth,
|
|
137
|
+
} }))));
|
|
138
|
+
};
|
|
129
139
|
const renderDot = (index) => {
|
|
130
|
-
|
|
140
|
+
const currentIndexDiff = index - currentIndex;
|
|
141
|
+
let currentSlideNumber;
|
|
142
|
+
if (0 <= currentIndexDiff && currentIndexDiff < slidesToShowCount) {
|
|
143
|
+
currentSlideNumber = currentIndex + 1;
|
|
144
|
+
}
|
|
145
|
+
else if (currentIndexDiff >= slidesToShowCount) {
|
|
146
|
+
currentSlideNumber = index - slidesToShowCount + 2;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
currentSlideNumber = index + 1;
|
|
150
|
+
}
|
|
151
|
+
return (React.createElement("li", { key: index, className: b('dot', { active: index === currentIndex }), onClick: () => handleDotClick(index), "aria-hidden": (slidesCountByBreakpoint > 1 &&
|
|
152
|
+
0 <= currentIndexDiff &&
|
|
153
|
+
currentIndexDiff < slidesToShowCount) ||
|
|
154
|
+
undefined, "aria-label": `Slide ${currentSlideNumber} of ${barSlidesCount}` }));
|
|
131
155
|
};
|
|
132
156
|
const renderNavigation = () => {
|
|
133
157
|
if (childrenCount <= slidesCountByBreakpoint || !dots || childrenCount === 1) {
|
|
134
158
|
return null;
|
|
135
159
|
}
|
|
160
|
+
const dotsList = Array(childrenCount)
|
|
161
|
+
.fill(null)
|
|
162
|
+
.map((_item, index) => renderDot(index));
|
|
163
|
+
dotsList.splice(currentIndex, 0, renderAccessibleBar(currentIndex));
|
|
136
164
|
return (React.createElement("div", { className: b('dots', dotsClassName) },
|
|
137
165
|
React.createElement("ul", { className: b('dots-list') },
|
|
138
166
|
renderBar(),
|
|
139
|
-
|
|
140
|
-
.fill(null)
|
|
141
|
-
.map((_item, index) => renderDot(index)))));
|
|
167
|
+
dotsList)));
|
|
142
168
|
};
|
|
143
169
|
const renderDisclaimer = () => {
|
|
144
170
|
return disclaimer ? (React.createElement("div", { className: b('disclaimer', { size: disclaimer.size || 'm' }) }, disclaimer.text)) : null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BackgroundImageProps, WithChildren } from '../../models';
|
|
2
2
|
import './BackgroundImage.css';
|
|
3
|
+
export declare const qaIdByDefault = "background-image";
|
|
3
4
|
declare const BackgroundImage: (props: WithChildren<BackgroundImageProps>) => JSX.Element;
|
|
4
5
|
export default BackgroundImage;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { block } from '../../utils';
|
|
2
|
+
import { block, getQaAttrubutes } from '../../utils';
|
|
3
3
|
import Image from '../Image/Image';
|
|
4
4
|
import './BackgroundImage.css';
|
|
5
|
+
export const qaIdByDefault = 'background-image';
|
|
5
6
|
const b = block('storage-background-image');
|
|
6
7
|
const BackgroundImage = (props) => {
|
|
7
8
|
const { children, src, desktop, className, imageClassName, style, hide, qa } = props;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const qaAttributes = getQaAttrubutes(qa || qaIdByDefault);
|
|
10
|
+
return (React.createElement("div", { className: b(null, className), style: style, "data-qa": qa || qaIdByDefault },
|
|
11
|
+
(src || desktop) && !hide && (React.createElement(Image, Object.assign({}, props, { className: b('img', imageClassName), qa: qaAttributes.image }))),
|
|
10
12
|
children && React.createElement("div", { className: b('container') }, children)));
|
|
11
13
|
};
|
|
12
14
|
export default BackgroundImage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BackgroundMediaProps } from '../../models';
|
|
2
2
|
import './BackgroundMedia.css';
|
|
3
|
-
declare const BackgroundMedia: ({ className, color, animated, parallax, video, mediaClassName, fullWidthMedia, ...props }: BackgroundMediaProps) => JSX.Element;
|
|
3
|
+
declare const BackgroundMedia: ({ className, color, animated, parallax, video, mediaClassName, fullWidthMedia, qa, ...props }: BackgroundMediaProps) => JSX.Element;
|
|
4
4
|
export default BackgroundMedia;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
|
-
import { block } from '../../utils';
|
|
4
|
+
import { block, getQaAttrubutes } from '../../utils';
|
|
5
5
|
import AnimateBlock from '../AnimateBlock/AnimateBlock';
|
|
6
6
|
import Media from '../Media/Media';
|
|
7
7
|
import './BackgroundMedia.css';
|
|
8
8
|
const b = block('BackgroundMedia');
|
|
9
9
|
const BackgroundMedia = (_a) => {
|
|
10
|
-
var { className, color, animated, parallax = true, video, mediaClassName, fullWidthMedia } = _a, props = __rest(_a, ["className", "color", "animated", "parallax", "video", "mediaClassName", "fullWidthMedia"]);
|
|
10
|
+
var { className, color, animated, parallax = true, video, mediaClassName, fullWidthMedia, qa } = _a, props = __rest(_a, ["className", "color", "animated", "parallax", "video", "mediaClassName", "fullWidthMedia", "qa"]);
|
|
11
11
|
const isMobile = useContext(MobileContext);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const qaAttributes = getQaAttrubutes(qa, 'media');
|
|
13
|
+
return (React.createElement(AnimateBlock, { className: b(null, className), style: { backgroundColor: color }, animate: animated, qa: qaAttributes.animate },
|
|
14
|
+
React.createElement(Media, Object.assign({ className: b('media', { 'full-width-media': fullWidthMedia }, mediaClassName), imageClassName: b('image'), videoClassName: b('video'), isBackground: true, qa: qaAttributes.media }, Object.assign({ height: 720, color,
|
|
14
15
|
parallax, video: isMobile ? undefined : video }, props)))));
|
|
15
16
|
};
|
|
16
17
|
export default BackgroundMedia;
|
|
@@ -15,6 +15,11 @@ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', q
|
|
|
15
15
|
onSelectTab(tabId, e);
|
|
16
16
|
}
|
|
17
17
|
}, [onSelectTab]);
|
|
18
|
-
return (React.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) =>
|
|
18
|
+
return (React.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) => {
|
|
19
|
+
const isActive = id === activeTabId;
|
|
20
|
+
return (React.createElement(Button, { text: title, className: b('item', { active: isActive }), key: title, size: tabSize, onClick: handleClick(id), extraProps: {
|
|
21
|
+
'aria-current': isActive,
|
|
22
|
+
} }));
|
|
23
|
+
})));
|
|
19
24
|
};
|
|
20
25
|
export default ButtonTabs;
|
|
@@ -22,9 +22,6 @@ unpredictable css rules order in build */
|
|
|
22
22
|
.pc-card-base-block_border_line {
|
|
23
23
|
border: 1px solid var(--g-color-line-generic);
|
|
24
24
|
}
|
|
25
|
-
.pc-card-base-block_border_line, .pc-card-base-block_border_none {
|
|
26
|
-
cursor: default;
|
|
27
|
-
}
|
|
28
25
|
@media (min-width: 577px) {
|
|
29
26
|
.slick-slide:not(.slick-active) .pc-card-base-block {
|
|
30
27
|
box-shadow: none;
|
|
@@ -80,7 +77,10 @@ a.pc-card-base-block_border_line {
|
|
|
80
77
|
border: 1px solid var(--g-color-line-generic);
|
|
81
78
|
}
|
|
82
79
|
a.pc-card-base-block_border_line, a.pc-card-base-block_border_none {
|
|
83
|
-
|
|
80
|
+
transition: transform 0.3s ease-out;
|
|
81
|
+
}
|
|
82
|
+
a.pc-card-base-block_border_line:hover, a.pc-card-base-block_border_none:hover {
|
|
83
|
+
transform: translateY(-8px);
|
|
84
84
|
}
|
|
85
85
|
a.pc-card-base-block_border_shadow {
|
|
86
86
|
transition: transform 0.3s ease-out;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithChildren } from '../../models';
|
|
3
|
+
import { QAProps } from '../../models/common';
|
|
3
4
|
export interface HTMLProps {
|
|
4
5
|
children?: string;
|
|
5
6
|
block?: boolean;
|
|
6
7
|
className?: string;
|
|
7
8
|
itemProp?: string;
|
|
9
|
+
id?: string;
|
|
8
10
|
}
|
|
9
|
-
declare const HTML: ({ children, block, className, itemProp }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
11
|
+
declare const HTML: ({ children, block, className, itemProp, id, qa, }: WithChildren<HTMLProps & QAProps>) => React.DetailedReactHTMLElement<{
|
|
10
12
|
dangerouslySetInnerHTML: {
|
|
11
13
|
__html: string | (string & React.ReactElement<any, string | React.JSXElementConstructor<any>>) | (string & React.ReactFragment) | (string & React.ReactPortal);
|
|
12
14
|
};
|
|
13
15
|
className: string | undefined;
|
|
14
16
|
itemProp: string | undefined;
|
|
17
|
+
id: string | undefined;
|
|
18
|
+
'data-qa': string | undefined;
|
|
15
19
|
}, HTMLElement> | null;
|
|
16
20
|
export default HTML;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { hasBlockTag } from '../../utils';
|
|
3
|
-
const HTML = ({ children, block = false, className, itemProp }) => {
|
|
3
|
+
const HTML = ({ children, block = false, className, itemProp, id, qa, }) => {
|
|
4
4
|
if (!children) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
@@ -8,6 +8,8 @@ const HTML = ({ children, block = false, className, itemProp }) => {
|
|
|
8
8
|
dangerouslySetInnerHTML: { __html: children },
|
|
9
9
|
className,
|
|
10
10
|
itemProp,
|
|
11
|
+
id,
|
|
12
|
+
'data-qa': qa,
|
|
11
13
|
});
|
|
12
14
|
};
|
|
13
15
|
export default HTML;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useState } from 'react';
|
|
2
2
|
import { BREAKPOINTS } from '../../constants';
|
|
3
3
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
4
|
+
import { getQaAttrubutes } from '../../utils';
|
|
4
5
|
import { isCompressible } from '../../utils/imageCompress';
|
|
5
6
|
import ImageBase from '../ImageBase/ImageBase';
|
|
6
7
|
import i18n from './i18n';
|
|
@@ -15,18 +16,19 @@ const Image = (props) => {
|
|
|
15
16
|
if (!src) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
19
|
+
const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'display-source');
|
|
18
20
|
const disableWebp = projectSettings.disableCompress ||
|
|
19
21
|
disableCompress ||
|
|
20
22
|
!isCompressible(src) ||
|
|
21
23
|
imgLoadingError;
|
|
22
24
|
return (React.createElement("picture", { className: containerClassName, "data-qa": qa },
|
|
23
25
|
mobile && (React.createElement(Fragment, null,
|
|
24
|
-
!disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)
|
|
25
|
-
React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)
|
|
26
|
+
!disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileWebpSource })),
|
|
27
|
+
React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileSource }))),
|
|
26
28
|
tablet && (React.createElement(Fragment, null,
|
|
27
|
-
!disableWebp && (React.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${BREAKPOINTS.md}px)
|
|
28
|
-
React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)
|
|
29
|
-
src && !disableWebp && React.createElement("source", { srcSet: checkWebP(src), type: "image/webp" }),
|
|
29
|
+
!disableWebp && (React.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletWebpSource })),
|
|
30
|
+
React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletSource }))),
|
|
31
|
+
src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.displaySource })),
|
|
30
32
|
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
31
33
|
};
|
|
32
34
|
export default Image;
|
|
@@ -34,6 +34,25 @@ export declare const ImageObjectProps: {
|
|
|
34
34
|
type: string;
|
|
35
35
|
pattern: string;
|
|
36
36
|
};
|
|
37
|
+
style: {
|
|
38
|
+
type: string;
|
|
39
|
+
additionalProperties: boolean;
|
|
40
|
+
required: never[];
|
|
41
|
+
properties: {
|
|
42
|
+
backgroundColor: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
height: {
|
|
46
|
+
type: string[];
|
|
47
|
+
};
|
|
48
|
+
width: {
|
|
49
|
+
type: string[];
|
|
50
|
+
};
|
|
51
|
+
color: {
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
37
56
|
alt: {
|
|
38
57
|
type: string;
|
|
39
58
|
contentType: string;
|
|
@@ -9,6 +9,17 @@ const ImageBase = {
|
|
|
9
9
|
type: 'boolean',
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
|
+
const StyleBase = {
|
|
13
|
+
type: 'object',
|
|
14
|
+
additionalProperties: false,
|
|
15
|
+
required: [],
|
|
16
|
+
properties: {
|
|
17
|
+
backgroundColor: { type: 'string' },
|
|
18
|
+
height: { type: ['string', 'number'] },
|
|
19
|
+
width: { type: ['string', 'number'] },
|
|
20
|
+
color: { type: 'string' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
12
23
|
export const ImageDeviceProps = {
|
|
13
24
|
type: 'object',
|
|
14
25
|
additionalProperties: false,
|
|
@@ -28,7 +39,7 @@ export const ImageObjectProps = {
|
|
|
28
39
|
properties: Object.assign(Object.assign({}, ImageBase), { src: {
|
|
29
40
|
type: 'string',
|
|
30
41
|
pattern: imageUrlPattern,
|
|
31
|
-
} }),
|
|
42
|
+
}, style: StyleBase }),
|
|
32
43
|
};
|
|
33
44
|
export const ImageProps = {
|
|
34
45
|
oneOf: [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassNameProps, LinkProps, Tabbable, WithChildren } from '../../models';
|
|
2
|
+
import { QAProps } from '../../models/common';
|
|
2
3
|
import './Link.css';
|
|
3
|
-
export type LinkFullProps = LinkProps & ClassNameProps & Tabbable;
|
|
4
|
+
export type LinkFullProps = LinkProps & ClassNameProps & Tabbable & QAProps;
|
|
4
5
|
declare const LinkBlock: (props: WithChildren<LinkFullProps>) => JSX.Element;
|
|
5
6
|
export default LinkBlock;
|
|
@@ -7,6 +7,7 @@ import { useMetrika } from '../../hooks/useMetrika';
|
|
|
7
7
|
import { Chevron } from '../../icons';
|
|
8
8
|
import { DefaultEventNames, } from '../../models';
|
|
9
9
|
import { block, getLinkProps, setUrlTld } from '../../utils';
|
|
10
|
+
import { getQaAttrubutes } from '../../utils/index';
|
|
10
11
|
import BackLink from '../BackLink/BackLink';
|
|
11
12
|
import FileLink from '../FileLink/FileLink';
|
|
12
13
|
import './Link.css';
|
|
@@ -25,7 +26,8 @@ function getArrowSize(size) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const LinkBlock = (props) => {
|
|
28
|
-
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, } = props;
|
|
29
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, } = props;
|
|
30
|
+
const qaAttributes = getQaAttrubutes(qa, ['normal']);
|
|
29
31
|
const handleMetrika = useMetrika();
|
|
30
32
|
const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);
|
|
31
33
|
const { hostname } = useContext(LocationContext);
|
|
@@ -46,7 +48,7 @@ const LinkBlock = (props) => {
|
|
|
46
48
|
case 'normal': {
|
|
47
49
|
const linkProps = getLinkProps(url, hostname, target);
|
|
48
50
|
const content = children || text;
|
|
49
|
-
return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex }, linkProps), arrow ? (React.createElement(Fragment, null,
|
|
51
|
+
return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (React.createElement(Fragment, null,
|
|
50
52
|
React.createElement("span", { className: b('content') }, content),
|
|
51
53
|
WORD_JOINER_SYM,
|
|
52
54
|
React.createElement(Icon, { className: b('arrow'), data: Chevron, size: getArrowSize(textSize) }))) : (content)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MediaComponentImageProps } from '../../../models';
|
|
1
|
+
import { MediaComponentImageProps, QAProps } from '../../../models';
|
|
2
2
|
import './Image.css';
|
|
3
3
|
export interface ImageAdditionProps {
|
|
4
4
|
imageClassName?: string;
|
|
@@ -8,6 +8,7 @@ export interface ImageAdditionProps {
|
|
|
8
8
|
interface InnerImageProps {
|
|
9
9
|
hasVideoFallback: boolean;
|
|
10
10
|
}
|
|
11
|
-
type ImageAllProps = ImageAdditionProps & MediaComponentImageProps & InnerImageProps;
|
|
11
|
+
type ImageAllProps = ImageAdditionProps & MediaComponentImageProps & InnerImageProps & QAProps;
|
|
12
|
+
export declare const defaultAnimatedDivQa = "animated-div";
|
|
12
13
|
declare const Image: (props: ImageAllProps) => JSX.Element;
|
|
13
14
|
export default Image;
|
|
@@ -3,15 +3,17 @@ import _ from 'lodash';
|
|
|
3
3
|
import { animated, config, useSpring } from 'react-spring';
|
|
4
4
|
import SliderBlock from '../../../blocks/Slider/Slider';
|
|
5
5
|
import { SliderType } from '../../../models';
|
|
6
|
-
import { block } from '../../../utils';
|
|
6
|
+
import { block, getQaAttrubutes } from '../../../utils';
|
|
7
7
|
import BackgroundImage from '../../BackgroundImage/BackgroundImage';
|
|
8
8
|
import FullscreenImage from '../../FullscreenImage/FullscreenImage';
|
|
9
9
|
import ImageView from '../../Image/Image';
|
|
10
10
|
import { getMediaImage } from './utils';
|
|
11
11
|
import './Image.css';
|
|
12
12
|
const b = block('media-component-image');
|
|
13
|
+
export const defaultAnimatedDivQa = 'animated-div';
|
|
13
14
|
const Image = (props) => {
|
|
14
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, } = props;
|
|
15
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa, } = props;
|
|
16
|
+
const qaAttributes = getQaAttrubutes(qa, 'fullscreen-image', 'animate', 'background-image', 'image-view', 'slider-block');
|
|
15
17
|
const [scrollY, setScrollY] = useState(0);
|
|
16
18
|
const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
|
|
17
19
|
springScrollY: 0,
|
|
@@ -35,16 +37,16 @@ const Image = (props) => {
|
|
|
35
37
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
36
38
|
const renderFullscreenImage = (item) => {
|
|
37
39
|
const itemData = getMediaImage(item);
|
|
38
|
-
return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
40
|
+
return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height }, qa: qaAttributes.fullscreenImage })));
|
|
39
41
|
};
|
|
40
42
|
const imageBackground = (oneImage) => {
|
|
41
43
|
const imageData = getMediaImage(oneImage);
|
|
42
|
-
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate
|
|
43
|
-
React.createElement(BackgroundImage, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
|
|
44
|
+
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate }, "data-qa": qaAttributes.animate },
|
|
45
|
+
React.createElement(BackgroundImage, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.backgroundImage }))));
|
|
44
46
|
};
|
|
45
47
|
const imageOnly = (oneImage) => {
|
|
46
48
|
const imageData = getMediaImage(oneImage);
|
|
47
|
-
return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
49
|
+
return (React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView })));
|
|
48
50
|
};
|
|
49
51
|
const imageSlider = (imageArray) => {
|
|
50
52
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MediaProps } from '../../models';
|
|
1
|
+
import { MediaProps, QAProps } from '../../models';
|
|
2
2
|
import { ImageAdditionProps } from './Image/Image';
|
|
3
3
|
import { VideoAdditionProps } from './Video/Video';
|
|
4
4
|
import './Media.css';
|
|
5
|
-
export interface MediaAllProps extends MediaProps, VideoAdditionProps, ImageAdditionProps {
|
|
5
|
+
export interface MediaAllProps extends MediaProps, VideoAdditionProps, ImageAdditionProps, QAProps {
|
|
6
6
|
className?: string;
|
|
7
7
|
youtubeClassName?: string;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { block } from '../../utils';
|
|
2
|
+
import { block, getQaAttrubutes } from '../../utils';
|
|
3
3
|
import YoutubeBlock from '../VideoBlock/VideoBlock';
|
|
4
4
|
import DataLens from './DataLens/DataLens';
|
|
5
5
|
import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
|
|
@@ -8,12 +8,13 @@ import Video from './Video/Video';
|
|
|
8
8
|
import './Media.css';
|
|
9
9
|
const b = block('Media');
|
|
10
10
|
export const Media = (props) => {
|
|
11
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
11
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, } = props;
|
|
12
12
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
|
+
const qaAttributes = getQaAttrubutes(qa, 'video');
|
|
13
14
|
const content = useMemo(() => {
|
|
14
15
|
let result = [];
|
|
15
16
|
if (image) {
|
|
16
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen }));
|
|
17
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image }));
|
|
17
18
|
}
|
|
18
19
|
if (video) {
|
|
19
20
|
const videoProps = {
|
|
@@ -31,10 +32,10 @@ export const Media = (props) => {
|
|
|
31
32
|
setHasVideoFallback,
|
|
32
33
|
};
|
|
33
34
|
if (fullscreen) {
|
|
34
|
-
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
|
|
35
|
+
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
result.push(React.createElement(Video, Object.assign({}, videoProps)));
|
|
38
|
+
result.push(React.createElement(Video, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
if (youtube) {
|
|
@@ -54,6 +55,9 @@ export const Media = (props) => {
|
|
|
54
55
|
imageClassName,
|
|
55
56
|
isBackground,
|
|
56
57
|
hasVideoFallback,
|
|
58
|
+
fullscreen,
|
|
59
|
+
qaAttributes.image,
|
|
60
|
+
qaAttributes.video,
|
|
57
61
|
videoClassName,
|
|
58
62
|
metrika,
|
|
59
63
|
analyticsEvents,
|
|
@@ -62,8 +66,7 @@ export const Media = (props) => {
|
|
|
62
66
|
playButton,
|
|
63
67
|
customBarControlsClassName,
|
|
64
68
|
youtubeClassName,
|
|
65
|
-
fullscreen,
|
|
66
69
|
]);
|
|
67
|
-
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
70
|
+
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
|
|
68
71
|
};
|
|
69
72
|
export default Media;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MediaComponentVideoProps, PlayButtonProps } from '../../../models';
|
|
2
|
+
import { MediaComponentVideoProps, PlayButtonProps, QAProps } from '../../../models';
|
|
3
3
|
import './Video.css';
|
|
4
4
|
export interface VideoAdditionProps {
|
|
5
5
|
playButton?: PlayButtonProps;
|
|
@@ -11,6 +11,6 @@ interface InnerVideoProps {
|
|
|
11
11
|
setHasVideoFallback: React.Dispatch<boolean>;
|
|
12
12
|
hasVideoFallback: boolean;
|
|
13
13
|
}
|
|
14
|
-
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
14
|
+
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps & QAProps;
|
|
15
15
|
declare const Video: (props: VideoAllProps) => JSX.Element | null;
|
|
16
16
|
export default Video;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { MediaVideoType } from '../../../models';
|
|
3
|
-
import { block } from '../../../utils';
|
|
3
|
+
import { block, getQaAttrubutes } from '../../../utils';
|
|
4
4
|
import ReactPlayerBlock from '../../ReactPlayer/ReactPlayer';
|
|
5
5
|
import { getVideoTypesWithPriority } from './utils';
|
|
6
6
|
import './Video.css';
|
|
7
7
|
const b = block('media-component-video');
|
|
8
8
|
const Video = (props) => {
|
|
9
|
-
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
9
|
+
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, qa, } = props;
|
|
10
|
+
const qaAttributes = getQaAttrubutes(qa, 'source');
|
|
10
11
|
const ref = useRef(null);
|
|
11
12
|
useEffect(() => {
|
|
12
13
|
if (ref && ref.current) {
|
|
@@ -28,8 +29,8 @@ const Video = (props) => {
|
|
|
28
29
|
}
|
|
29
30
|
}, [playVideo, video, setHasVideoFallback]);
|
|
30
31
|
const reactPlayerBlock = useMemo(() => {
|
|
31
|
-
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, } = video;
|
|
32
|
-
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel }));
|
|
32
|
+
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, customControlsOptions, } = video;
|
|
33
|
+
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, analyticsEvents: analyticsEvents, height: height, ariaLabel: ariaLabel, customControlsOptions: customControlsOptions }));
|
|
33
34
|
}, [
|
|
34
35
|
video,
|
|
35
36
|
height,
|
|
@@ -42,12 +43,20 @@ const Video = (props) => {
|
|
|
42
43
|
analyticsEvents,
|
|
43
44
|
]);
|
|
44
45
|
const defaultVideoBlock = useMemo(() => {
|
|
45
|
-
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
46
|
+
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height }, "data-qa": qaAttributes.default },
|
|
46
47
|
React.createElement("video", { disablePictureInPicture: true, playsInline: true,
|
|
47
48
|
// @ts-ignore
|
|
48
49
|
// eslint-disable-next-line react/no-unknown-property
|
|
49
|
-
pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type })))))) : null;
|
|
50
|
-
}, [
|
|
50
|
+
pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type, "data-qa": qaAttributes.source })))))) : null;
|
|
51
|
+
}, [
|
|
52
|
+
video.src,
|
|
53
|
+
video.ariaLabel,
|
|
54
|
+
hasVideoFallback,
|
|
55
|
+
videoClassName,
|
|
56
|
+
height,
|
|
57
|
+
qaAttributes.default,
|
|
58
|
+
qaAttributes.source,
|
|
59
|
+
]);
|
|
51
60
|
switch (video.type) {
|
|
52
61
|
case MediaVideoType.Player:
|
|
53
62
|
return reactPlayerBlock;
|
|
@@ -5,8 +5,6 @@ unpredictable css rules order in build */
|
|
|
5
5
|
line-height: var(--g-text-body-2-line-height);
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
|
-
font-weight: 500;
|
|
9
|
-
color: var(--pc-media-card-meta-info-color);
|
|
10
8
|
}
|
|
11
9
|
.pc-meta-info__item:not(:first-child) {
|
|
12
10
|
margin-left: 16px;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
|
+
import { YFMWrapper } from '../index';
|
|
3
4
|
import './MetaInfo.css';
|
|
4
5
|
const b = block('meta-info');
|
|
5
|
-
const MetaInfo = ({ items, className }) => (React.createElement("h4", { className: b(null, className) }, items.map((metaInfoItem) => (React.createElement(
|
|
6
|
+
const MetaInfo = ({ items, className }) => (React.createElement("h4", { className: b(null, className) }, items.map((metaInfoItem) => (React.createElement(YFMWrapper, { content: metaInfoItem, key: metaInfoItem, className: b('item'), modifiers: { constructor: true, constructorMetaInfo: true } })))));
|
|
6
7
|
export default MetaInfo;
|