@gravity-ui/page-constructor 4.1.2 → 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/ExtendedFeatures/ExtendedFeatures.js +7 -3
- 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/PromoFeaturesBlock/PromoFeaturesBlock.js +1 -1
- package/build/cjs/blocks/Questions/QuestionBlockItem/QuestionBlockItem.css +50 -0
- package/build/cjs/blocks/Questions/QuestionBlockItem/QuestionBlockItem.d.ts +2 -0
- package/build/cjs/blocks/Questions/QuestionBlockItem/QuestionBlockItem.js +27 -0
- package/build/cjs/blocks/Questions/Questions.css +0 -48
- package/build/cjs/blocks/Questions/Questions.js +7 -27
- package/build/cjs/blocks/Questions/models.d.ts +10 -0
- package/build/cjs/blocks/Questions/models.js +13 -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/BackLink/BackLink.d.ts +2 -1
- package/build/cjs/components/BackLink/BackLink.js +2 -2
- 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/FileLink/FileLink.js +2 -2
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +1 -1
- package/build/cjs/components/FullscreenImage/i18n/en.json +2 -1
- package/build/cjs/components/FullscreenImage/i18n/ru.json +2 -1
- 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/i18n/en.json +1 -1
- package/build/cjs/components/Image/i18n/ru.json +1 -1
- 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 +3 -2
- package/build/cjs/components/Link/Link.js +8 -6
- 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 -7
- 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 +52 -27
- package/build/cjs/components/ReactPlayer/i18n/en.json +6 -0
- package/build/cjs/components/ReactPlayer/i18n/index.d.ts +2 -0
- package/build/cjs/components/ReactPlayer/i18n/index.js +8 -0
- package/build/cjs/components/ReactPlayer/i18n/ru.json +6 -0
- 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/components/constants.d.ts +0 -4
- package/build/cjs/components/constants.js +1 -5
- 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 +3 -4
- package/build/cjs/grid/Col/Col.js +2 -2
- 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 +16 -5
- package/build/cjs/models/constructor-items/common.d.ts +22 -36
- 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 +17 -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/LayoutItem/utils.d.ts +1 -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 +4 -7
- package/build/cjs/utils/blocks.js +27 -18
- 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/ExtendedFeatures/ExtendedFeatures.js +7 -3
- 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/PromoFeaturesBlock/PromoFeaturesBlock.js +1 -1
- package/build/esm/blocks/Questions/QuestionBlockItem/QuestionBlockItem.css +50 -0
- package/build/esm/blocks/Questions/QuestionBlockItem/QuestionBlockItem.d.ts +3 -0
- package/build/esm/blocks/Questions/QuestionBlockItem/QuestionBlockItem.js +23 -0
- package/build/esm/blocks/Questions/Questions.css +0 -48
- package/build/esm/blocks/Questions/Questions.js +6 -26
- package/build/esm/blocks/Questions/models.d.ts +10 -0
- package/build/esm/blocks/Questions/models.js +10 -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/BackLink/BackLink.d.ts +2 -1
- package/build/esm/components/BackLink/BackLink.js +2 -2
- 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/FileLink/FileLink.js +2 -2
- package/build/esm/components/FullscreenImage/FullscreenImage.js +1 -1
- package/build/esm/components/FullscreenImage/i18n/en.json +2 -1
- package/build/esm/components/FullscreenImage/i18n/ru.json +2 -1
- 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/i18n/en.json +1 -1
- package/build/esm/components/Image/i18n/ru.json +1 -1
- 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 +3 -2
- package/build/esm/components/Link/Link.js +9 -7
- 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 -8
- 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 +55 -30
- package/build/esm/components/ReactPlayer/i18n/en.json +6 -0
- package/build/esm/components/ReactPlayer/i18n/index.d.ts +2 -0
- package/build/esm/components/ReactPlayer/i18n/index.js +5 -0
- package/build/esm/components/ReactPlayer/i18n/ru.json +6 -0
- 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/components/constants.d.ts +0 -4
- package/build/esm/components/constants.js +0 -4
- 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 +3 -4
- package/build/esm/grid/Col/Col.js +2 -2
- 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 +16 -5
- package/build/esm/models/constructor-items/common.d.ts +22 -36
- 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 +17 -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/LayoutItem/utils.d.ts +1 -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 +4 -7
- package/build/esm/utils/blocks.js +23 -13
- package/build/esm/utils/cn.d.ts +3 -3
- package/build/esm/utils/cn.js +3 -4
- package/package.json +7 -7
- package/server/components/constants.d.ts +0 -4
- package/server/components/constants.js +1 -5
- package/server/models/constructor-items/blocks.d.ts +16 -5
- package/server/models/constructor-items/common.d.ts +22 -36
- 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 +4 -7
- package/server/utils/blocks.js +27 -18
- 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
|
@@ -121,27 +121,53 @@ const SliderBlock = (props) => {
|
|
|
121
121
|
slider.slickGoTo(nextIndex);
|
|
122
122
|
}
|
|
123
123
|
}, [slider, currentIndex, slidesCountByBreakpoint]);
|
|
124
|
+
const barSlidesCount = childrenCount - slidesToShowCount + 1;
|
|
125
|
+
const barPosition = (DOT_GAP + DOT_WIDTH) * currentIndex;
|
|
126
|
+
const barWidth = DOT_WIDTH + (DOT_GAP + DOT_WIDTH) * (slidesCountByBreakpoint - 1);
|
|
124
127
|
const renderBar = () => {
|
|
125
|
-
const barPosition = (DOT_GAP + DOT_WIDTH) * currentIndex;
|
|
126
|
-
const barWidth = DOT_WIDTH + (DOT_GAP + DOT_WIDTH) * (slidesCountByBreakpoint - 1);
|
|
127
128
|
return (slidesCountByBreakpoint > 1 && (react_1.default.createElement("li", { className: b('bar'), style: {
|
|
128
129
|
left: barPosition,
|
|
129
130
|
width: barWidth,
|
|
130
131
|
} })));
|
|
131
132
|
};
|
|
133
|
+
// renders additional bar, not visible in the layout but visible for screenreaders
|
|
134
|
+
const renderAccessibleBar = (index) => {
|
|
135
|
+
return (
|
|
136
|
+
// To have this key differ from keys used in renderDot function, added `-accessible-bar` part
|
|
137
|
+
react_1.default.createElement(react_1.Fragment, { key: `${index}-accessible-bar` }, slidesCountByBreakpoint > 1 && (react_1.default.createElement("li", { className: b('accessible-bar'), "aria-current": true, "aria-label": `Slide ${currentIndex + 1} of ${barSlidesCount}`, style: {
|
|
138
|
+
left: barPosition,
|
|
139
|
+
width: barWidth,
|
|
140
|
+
} }))));
|
|
141
|
+
};
|
|
132
142
|
const renderDot = (index) => {
|
|
133
|
-
|
|
143
|
+
const currentIndexDiff = index - currentIndex;
|
|
144
|
+
let currentSlideNumber;
|
|
145
|
+
if (0 <= currentIndexDiff && currentIndexDiff < slidesToShowCount) {
|
|
146
|
+
currentSlideNumber = currentIndex + 1;
|
|
147
|
+
}
|
|
148
|
+
else if (currentIndexDiff >= slidesToShowCount) {
|
|
149
|
+
currentSlideNumber = index - slidesToShowCount + 2;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
currentSlideNumber = index + 1;
|
|
153
|
+
}
|
|
154
|
+
return (react_1.default.createElement("li", { key: index, className: b('dot', { active: index === currentIndex }), onClick: () => handleDotClick(index), "aria-hidden": (slidesCountByBreakpoint > 1 &&
|
|
155
|
+
0 <= currentIndexDiff &&
|
|
156
|
+
currentIndexDiff < slidesToShowCount) ||
|
|
157
|
+
undefined, "aria-label": `Slide ${currentSlideNumber} of ${barSlidesCount}` }));
|
|
134
158
|
};
|
|
135
159
|
const renderNavigation = () => {
|
|
136
160
|
if (childrenCount <= slidesCountByBreakpoint || !dots || childrenCount === 1) {
|
|
137
161
|
return null;
|
|
138
162
|
}
|
|
163
|
+
const dotsList = Array(childrenCount)
|
|
164
|
+
.fill(null)
|
|
165
|
+
.map((_item, index) => renderDot(index));
|
|
166
|
+
dotsList.splice(currentIndex, 0, renderAccessibleBar(currentIndex));
|
|
139
167
|
return (react_1.default.createElement("div", { className: b('dots', dotsClassName) },
|
|
140
168
|
react_1.default.createElement("ul", { className: b('dots-list') },
|
|
141
169
|
renderBar(),
|
|
142
|
-
|
|
143
|
-
.fill(null)
|
|
144
|
-
.map((_item, index) => renderDot(index)))));
|
|
170
|
+
dotsList)));
|
|
145
171
|
};
|
|
146
172
|
const renderDisclaimer = () => {
|
|
147
173
|
return disclaimer ? (react_1.default.createElement("div", { className: b('disclaimer', { size: disclaimer.size || 'm' }) }, disclaimer.text)) : null;
|
|
@@ -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 = 'SliderBlock';
|
|
8
|
+
exports.default = (0, registerKeyset_1.registerKeyset)({ en: en_json_1.default, ru: ru_json_1.default }, COMPONENT);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
|
+
import { Tabbable } from '../../models';
|
|
3
4
|
export type Theme = 'default' | 'special';
|
|
4
|
-
export interface BackLinkProps {
|
|
5
|
+
export interface BackLinkProps extends Tabbable {
|
|
5
6
|
url: string;
|
|
6
7
|
title: ReactNode;
|
|
7
8
|
theme?: Theme;
|
|
@@ -9,7 +9,7 @@ const icons_1 = require("../../icons");
|
|
|
9
9
|
const models_1 = require("../../models");
|
|
10
10
|
function BackLink(props) {
|
|
11
11
|
const { history } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
12
|
-
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, } = props;
|
|
12
|
+
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, tabIndex, } = props;
|
|
13
13
|
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.ShareButton, url);
|
|
14
14
|
const backActionHandler = (0, react_1.useCallback)(async () => {
|
|
15
15
|
handleAnalytics();
|
|
@@ -26,7 +26,7 @@ function BackLink(props) {
|
|
|
26
26
|
history.push({ pathname: url });
|
|
27
27
|
}
|
|
28
28
|
}, [handleAnalytics, history, onClick, url]);
|
|
29
|
-
return (react_1.default.createElement(uikit_1.Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
|
|
29
|
+
return (react_1.default.createElement(uikit_1.Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined, tabIndex: tabIndex },
|
|
30
30
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.ArrowSidebar, size: 24 }),
|
|
31
31
|
react_1.default.createElement("span", null, title)));
|
|
32
32
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.qaIdByDefault = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const utils_1 = require("../../utils");
|
|
6
7
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
8
|
+
exports.qaIdByDefault = 'background-image';
|
|
7
9
|
const b = (0, utils_1.block)('storage-background-image');
|
|
8
10
|
const BackgroundImage = (props) => {
|
|
9
11
|
const { children, src, desktop, className, imageClassName, style, hide, qa } = props;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa || exports.qaIdByDefault);
|
|
13
|
+
return (react_1.default.createElement("div", { className: b(null, className), style: style, "data-qa": qa || exports.qaIdByDefault },
|
|
14
|
+
(src || desktop) && !hide && (react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('img', imageClassName), qa: qaAttributes.image }))),
|
|
12
15
|
children && react_1.default.createElement("div", { className: b('container') }, children)));
|
|
13
16
|
};
|
|
14
17
|
exports.default = BackgroundImage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BackgroundMediaProps } from '../../models';
|
|
2
|
-
declare const BackgroundMedia: ({ className, color, animated, parallax, video, mediaClassName, fullWidthMedia, ...props }: BackgroundMediaProps) => JSX.Element;
|
|
2
|
+
declare const BackgroundMedia: ({ className, color, animated, parallax, video, mediaClassName, fullWidthMedia, qa, ...props }: BackgroundMediaProps) => JSX.Element;
|
|
3
3
|
export default BackgroundMedia;
|
|
@@ -8,10 +8,11 @@ const AnimateBlock_1 = tslib_1.__importDefault(require("../AnimateBlock/AnimateB
|
|
|
8
8
|
const Media_1 = tslib_1.__importDefault(require("../Media/Media"));
|
|
9
9
|
const b = (0, utils_1.block)('BackgroundMedia');
|
|
10
10
|
const BackgroundMedia = (_a) => {
|
|
11
|
-
var { className, color, animated, parallax = true, video, mediaClassName, fullWidthMedia } = _a, props = tslib_1.__rest(_a, ["className", "color", "animated", "parallax", "video", "mediaClassName", "fullWidthMedia"]);
|
|
11
|
+
var { className, color, animated, parallax = true, video, mediaClassName, fullWidthMedia, qa } = _a, props = tslib_1.__rest(_a, ["className", "color", "animated", "parallax", "video", "mediaClassName", "fullWidthMedia", "qa"]);
|
|
12
12
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'media');
|
|
14
|
+
return (react_1.default.createElement(AnimateBlock_1.default, { className: b(null, className), style: { backgroundColor: color }, animate: animated, qa: qaAttributes.animate },
|
|
15
|
+
react_1.default.createElement(Media_1.default, 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,
|
|
15
16
|
parallax, video: isMobile ? undefined : video }, props)))));
|
|
16
17
|
};
|
|
17
18
|
exports.default = BackgroundMedia;
|
|
@@ -17,6 +17,11 @@ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', q
|
|
|
17
17
|
onSelectTab(tabId, e);
|
|
18
18
|
}
|
|
19
19
|
}, [onSelectTab]);
|
|
20
|
-
return (react_1.default.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) =>
|
|
20
|
+
return (react_1.default.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) => {
|
|
21
|
+
const isActive = id === activeTabId;
|
|
22
|
+
return (react_1.default.createElement(index_1.Button, { text: title, className: b('item', { active: isActive }), key: title, size: tabSize, onClick: handleClick(id), extraProps: {
|
|
23
|
+
'aria-current': isActive,
|
|
24
|
+
} }));
|
|
25
|
+
})));
|
|
21
26
|
};
|
|
22
27
|
exports.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;
|
|
@@ -41,13 +41,13 @@ const LabelSizeMap = {
|
|
|
41
41
|
};
|
|
42
42
|
const FileLink = (props) => {
|
|
43
43
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
44
|
-
const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, } = props;
|
|
44
|
+
const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, } = props;
|
|
45
45
|
const fileExt = getFileExt(href);
|
|
46
46
|
const labelTheme = (FileExtensionThemes[fileExt] || 'unknown');
|
|
47
47
|
const labelSize = LabelSizeMap[textSize];
|
|
48
48
|
return (react_1.default.createElement("div", { className: b({ ext: fileExt, type, size: textSize, theme }, className) },
|
|
49
49
|
react_1.default.createElement(uikit_1.Label, { className: b('file-label'), size: labelSize, theme: labelTheme }, fileExt),
|
|
50
50
|
react_1.default.createElement("div", { className: b('link') },
|
|
51
|
-
react_1.default.createElement("a", Object.assign({ href: href }, (0, utils_1.getLinkProps)(href, hostname)
|
|
51
|
+
react_1.default.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex }, (0, utils_1.getLinkProps)(href, hostname)), text))));
|
|
52
52
|
};
|
|
53
53
|
exports.default = FileLink;
|
|
@@ -25,7 +25,7 @@ const FullscreenImage = (props) => {
|
|
|
25
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') }))),
|
|
26
26
|
isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
27
27
|
react_1.default.createElement("div", { className: b('modal-content') },
|
|
28
|
-
react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
28
|
+
react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal, "aria-label": (0, i18n_1.default)('close') },
|
|
29
29
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
30
30
|
react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
|
|
31
31
|
};
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@ 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 HTML = ({ children, block = false, className, itemProp }) => {
|
|
6
|
+
const HTML = ({ children, block = false, className, itemProp, id, qa, }) => {
|
|
7
7
|
if (!children) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
@@ -11,6 +11,8 @@ const HTML = ({ children, block = false, className, itemProp }) => {
|
|
|
11
11
|
dangerouslySetInnerHTML: { __html: children },
|
|
12
12
|
className,
|
|
13
13
|
itemProp,
|
|
14
|
+
id,
|
|
15
|
+
'data-qa': qa,
|
|
14
16
|
});
|
|
15
17
|
};
|
|
16
18
|
exports.default = HTML;
|
|
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
7
8
|
const imageCompress_1 = require("../../utils/imageCompress");
|
|
8
9
|
const ImageBase_1 = tslib_1.__importDefault(require("../ImageBase/ImageBase"));
|
|
9
10
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
@@ -18,18 +19,19 @@ const Image = (props) => {
|
|
|
18
19
|
if (!src) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
22
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'display-source');
|
|
21
23
|
const disableWebp = projectSettings.disableCompress ||
|
|
22
24
|
disableCompress ||
|
|
23
25
|
!(0, imageCompress_1.isCompressible)(src) ||
|
|
24
26
|
imgLoadingError;
|
|
25
27
|
return (react_1.default.createElement("picture", { className: containerClassName, "data-qa": qa },
|
|
26
28
|
mobile && (react_1.default.createElement(react_1.Fragment, null,
|
|
27
|
-
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)
|
|
28
|
-
react_1.default.createElement("source", { srcSet: mobile, media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)
|
|
29
|
+
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileWebpSource })),
|
|
30
|
+
react_1.default.createElement("source", { srcSet: mobile, media: `(max-width: ${constants_1.BREAKPOINTS.sm}px)`, "data-qa": qaAttributes.mobileSource }))),
|
|
29
31
|
tablet && (react_1.default.createElement(react_1.Fragment, null,
|
|
30
|
-
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.md}px)
|
|
31
|
-
react_1.default.createElement("source", { srcSet: tablet, media: `(max-width: ${constants_1.BREAKPOINTS.md}px)
|
|
32
|
-
src && !disableWebp && react_1.default.createElement("source", { srcSet: checkWebP(src), type: "image/webp" }),
|
|
32
|
+
!disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${constants_1.BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletWebpSource })),
|
|
33
|
+
react_1.default.createElement("source", { srcSet: tablet, media: `(max-width: ${constants_1.BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletSource }))),
|
|
34
|
+
src && !disableWebp && (react_1.default.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.displaySource })),
|
|
33
35
|
react_1.default.createElement(ImageBase_1.default, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
34
36
|
};
|
|
35
37
|
exports.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;
|
|
@@ -12,6 +12,17 @@ const ImageBase = {
|
|
|
12
12
|
type: 'boolean',
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
|
+
const StyleBase = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
required: [],
|
|
19
|
+
properties: {
|
|
20
|
+
backgroundColor: { type: 'string' },
|
|
21
|
+
height: { type: ['string', 'number'] },
|
|
22
|
+
width: { type: ['string', 'number'] },
|
|
23
|
+
color: { type: 'string' },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
15
26
|
exports.ImageDeviceProps = {
|
|
16
27
|
type: 'object',
|
|
17
28
|
additionalProperties: false,
|
|
@@ -31,7 +42,7 @@ exports.ImageObjectProps = {
|
|
|
31
42
|
properties: Object.assign(Object.assign({}, ImageBase), { src: {
|
|
32
43
|
type: 'string',
|
|
33
44
|
pattern: exports.imageUrlPattern,
|
|
34
|
-
} }),
|
|
45
|
+
}, style: StyleBase }),
|
|
35
46
|
};
|
|
36
47
|
exports.ImageProps = {
|
|
37
48
|
oneOf: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ClassNameProps, LinkProps, WithChildren } from '../../models';
|
|
2
|
-
|
|
1
|
+
import { ClassNameProps, LinkProps, Tabbable, WithChildren } from '../../models';
|
|
2
|
+
import { QAProps } from '../../models/common';
|
|
3
|
+
export type LinkFullProps = LinkProps & ClassNameProps & Tabbable & QAProps;
|
|
3
4
|
declare const LinkBlock: (props: WithChildren<LinkFullProps>) => JSX.Element;
|
|
4
5
|
export default LinkBlock;
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
-
const localeContext_1 = require("../../context/localeContext
|
|
7
|
-
const locationContext_1 = require("../../context/locationContext
|
|
6
|
+
const localeContext_1 = require("../../context/localeContext");
|
|
7
|
+
const locationContext_1 = require("../../context/locationContext");
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
10
|
const icons_1 = require("../../icons");
|
|
11
11
|
const models_1 = require("../../models");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
|
+
const index_1 = require("../../utils/index");
|
|
13
14
|
const BackLink_1 = tslib_1.__importDefault(require("../BackLink/BackLink"));
|
|
14
15
|
const FileLink_1 = tslib_1.__importDefault(require("../FileLink/FileLink"));
|
|
15
16
|
const b = (0, utils_1.block)('link-block');
|
|
@@ -27,7 +28,8 @@ function getArrowSize(size) {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
const LinkBlock = (props) => {
|
|
30
|
-
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
31
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, } = props;
|
|
32
|
+
const qaAttributes = (0, index_1.getQaAttrubutes)(qa, ['normal']);
|
|
31
33
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
32
34
|
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Link, url);
|
|
33
35
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
@@ -41,14 +43,14 @@ const LinkBlock = (props) => {
|
|
|
41
43
|
const getLinkByType = () => {
|
|
42
44
|
switch (theme) {
|
|
43
45
|
case 'back':
|
|
44
|
-
return react_1.default.createElement(BackLink_1.default, { title: children || text, url: href, onClick: onClick });
|
|
46
|
+
return (react_1.default.createElement(BackLink_1.default, { title: children || text, url: href, onClick: onClick, tabIndex: tabIndex }));
|
|
45
47
|
case 'file-link':
|
|
46
48
|
case 'underline':
|
|
47
|
-
return (react_1.default.createElement(FileLink_1.default, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick }));
|
|
49
|
+
return (react_1.default.createElement(FileLink_1.default, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick, tabIndex: tabIndex }));
|
|
48
50
|
case 'normal': {
|
|
49
51
|
const linkProps = (0, utils_1.getLinkProps)(url, hostname, target);
|
|
50
52
|
const content = children || text;
|
|
51
|
-
return (react_1.default.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick }, linkProps), arrow ? (react_1.default.createElement(react_1.Fragment, null,
|
|
53
|
+
return (react_1.default.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_1.default.createElement(react_1.Fragment, null,
|
|
52
54
|
react_1.default.createElement("span", { className: b('content') }, content),
|
|
53
55
|
WORD_JOINER_SYM,
|
|
54
56
|
react_1.default.createElement(uikit_1.Icon, { className: b('arrow'), data: icons_1.Chevron, size: getArrowSize(textSize) }))) : (content)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MediaComponentImageProps } from '../../../models';
|
|
1
|
+
import { MediaComponentImageProps, QAProps } from '../../../models';
|
|
2
2
|
export interface ImageAdditionProps {
|
|
3
3
|
imageClassName?: string;
|
|
4
4
|
isBackground?: boolean;
|
|
@@ -7,6 +7,7 @@ export interface ImageAdditionProps {
|
|
|
7
7
|
interface InnerImageProps {
|
|
8
8
|
hasVideoFallback: boolean;
|
|
9
9
|
}
|
|
10
|
-
type ImageAllProps = ImageAdditionProps & MediaComponentImageProps & InnerImageProps;
|
|
10
|
+
type ImageAllProps = ImageAdditionProps & MediaComponentImageProps & InnerImageProps & QAProps;
|
|
11
|
+
export declare const defaultAnimatedDivQa = "animated-div";
|
|
11
12
|
declare const Image: (props: ImageAllProps) => JSX.Element;
|
|
12
13
|
export default Image;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultAnimatedDivQa = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
@@ -12,8 +13,10 @@ const FullscreenImage_1 = tslib_1.__importDefault(require("../../FullscreenImage
|
|
|
12
13
|
const Image_1 = tslib_1.__importDefault(require("../../Image/Image"));
|
|
13
14
|
const utils_2 = require("./utils");
|
|
14
15
|
const b = (0, utils_1.block)('media-component-image');
|
|
16
|
+
exports.defaultAnimatedDivQa = 'animated-div';
|
|
15
17
|
const Image = (props) => {
|
|
16
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, } = props;
|
|
18
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa, } = props;
|
|
19
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'fullscreen-image', 'animate', 'background-image', 'image-view', 'slider-block');
|
|
17
20
|
const [scrollY, setScrollY] = (0, react_1.useState)(0);
|
|
18
21
|
const [{ springScrollY }, springSetScrollY] = (0, react_spring_1.useSpring)(() => ({
|
|
19
22
|
springScrollY: 0,
|
|
@@ -37,16 +40,16 @@ const Image = (props) => {
|
|
|
37
40
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
38
41
|
const renderFullscreenImage = (item) => {
|
|
39
42
|
const itemData = (0, utils_2.getMediaImage)(item);
|
|
40
|
-
return (react_1.default.createElement(FullscreenImage_1.default, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
43
|
+
return (react_1.default.createElement(FullscreenImage_1.default, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height }, qa: qaAttributes.fullscreenImage })));
|
|
41
44
|
};
|
|
42
45
|
const imageBackground = (oneImage) => {
|
|
43
46
|
const imageData = (0, utils_2.getMediaImage)(oneImage);
|
|
44
|
-
return (react_1.default.createElement(react_spring_1.animated.div, { style: { transform: parallaxInterpolate
|
|
45
|
-
react_1.default.createElement(BackgroundImage_1.default, Object.assign({}, imageData, { className: imageClass, style: { height } }))));
|
|
47
|
+
return (react_1.default.createElement(react_spring_1.animated.div, { style: { transform: parallaxInterpolate }, "data-qa": qaAttributes.animate },
|
|
48
|
+
react_1.default.createElement(BackgroundImage_1.default, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.backgroundImage }))));
|
|
46
49
|
};
|
|
47
50
|
const imageOnly = (oneImage) => {
|
|
48
51
|
const imageData = (0, utils_2.getMediaImage)(oneImage);
|
|
49
|
-
return react_1.default.createElement(Image_1.default, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
52
|
+
return (react_1.default.createElement(Image_1.default, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView })));
|
|
50
53
|
};
|
|
51
54
|
const imageSlider = (imageArray) => {
|
|
52
55
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export interface MediaAllProps extends MediaProps, VideoAdditionProps, ImageAdditionProps {
|
|
4
|
+
export interface MediaAllProps extends MediaProps, VideoAdditionProps, ImageAdditionProps, QAProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
youtubeClassName?: string;
|
|
7
7
|
}
|
|
@@ -11,13 +11,13 @@ const Image_1 = tslib_1.__importDefault(require("./Image/Image"));
|
|
|
11
11
|
const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
|
|
12
12
|
const b = (0, utils_1.block)('Media');
|
|
13
13
|
const Media = (props) => {
|
|
14
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, } = props;
|
|
15
|
-
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
14
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, } = props;
|
|
16
15
|
const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
|
|
16
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'video');
|
|
17
17
|
const content = (0, react_1.useMemo)(() => {
|
|
18
18
|
let result = [];
|
|
19
19
|
if (image) {
|
|
20
|
-
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen }));
|
|
20
|
+
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image }));
|
|
21
21
|
}
|
|
22
22
|
if (video) {
|
|
23
23
|
const videoProps = {
|
|
@@ -35,10 +35,10 @@ const Media = (props) => {
|
|
|
35
35
|
setHasVideoFallback,
|
|
36
36
|
};
|
|
37
37
|
if (fullscreen) {
|
|
38
|
-
result.push(react_1.default.createElement(FullscreenVideo_1.default, Object.assign({}, videoProps)));
|
|
38
|
+
result.push(react_1.default.createElement(FullscreenVideo_1.default, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
result.push(react_1.default.createElement(Video_1.default, Object.assign({}, videoProps)));
|
|
41
|
+
result.push(react_1.default.createElement(Video_1.default, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
if (youtube) {
|
|
@@ -58,6 +58,9 @@ const Media = (props) => {
|
|
|
58
58
|
imageClassName,
|
|
59
59
|
isBackground,
|
|
60
60
|
hasVideoFallback,
|
|
61
|
+
fullscreen,
|
|
62
|
+
qaAttributes.image,
|
|
63
|
+
qaAttributes.video,
|
|
61
64
|
videoClassName,
|
|
62
65
|
metrika,
|
|
63
66
|
analyticsEvents,
|
|
@@ -66,9 +69,8 @@ const Media = (props) => {
|
|
|
66
69
|
playButton,
|
|
67
70
|
customBarControlsClassName,
|
|
68
71
|
youtubeClassName,
|
|
69
|
-
fullscreen,
|
|
70
72
|
]);
|
|
71
|
-
return (react_1.default.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
73
|
+
return (react_1.default.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
|
|
72
74
|
};
|
|
73
75
|
exports.Media = Media;
|
|
74
76
|
exports.default = exports.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
|
export interface VideoAdditionProps {
|
|
4
4
|
playButton?: PlayButtonProps;
|
|
5
5
|
customBarControlsClassName?: string;
|
|
@@ -10,6 +10,6 @@ interface InnerVideoProps {
|
|
|
10
10
|
setHasVideoFallback: React.Dispatch<boolean>;
|
|
11
11
|
hasVideoFallback: boolean;
|
|
12
12
|
}
|
|
13
|
-
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
13
|
+
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps & QAProps;
|
|
14
14
|
declare const Video: (props: VideoAllProps) => JSX.Element | null;
|
|
15
15
|
export default Video;
|