@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
|
@@ -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,13 +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, } = props;
|
|
12
|
-
const { 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;
|
|
13
12
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
|
+
const qaAttributes = getQaAttrubutes(qa, 'video');
|
|
14
14
|
const content = useMemo(() => {
|
|
15
15
|
let result = [];
|
|
16
16
|
if (image) {
|
|
17
|
-
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 }));
|
|
18
18
|
}
|
|
19
19
|
if (video) {
|
|
20
20
|
const videoProps = {
|
|
@@ -32,10 +32,10 @@ export const Media = (props) => {
|
|
|
32
32
|
setHasVideoFallback,
|
|
33
33
|
};
|
|
34
34
|
if (fullscreen) {
|
|
35
|
-
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
|
|
35
|
+
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
result.push(React.createElement(Video, Object.assign({}, videoProps)));
|
|
38
|
+
result.push(React.createElement(Video, Object.assign({}, videoProps, { qa: qaAttributes.video })));
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (youtube) {
|
|
@@ -55,6 +55,9 @@ export const Media = (props) => {
|
|
|
55
55
|
imageClassName,
|
|
56
56
|
isBackground,
|
|
57
57
|
hasVideoFallback,
|
|
58
|
+
fullscreen,
|
|
59
|
+
qaAttributes.image,
|
|
60
|
+
qaAttributes.video,
|
|
58
61
|
videoClassName,
|
|
59
62
|
metrika,
|
|
60
63
|
analyticsEvents,
|
|
@@ -63,8 +66,7 @@ export const Media = (props) => {
|
|
|
63
66
|
playButton,
|
|
64
67
|
customBarControlsClassName,
|
|
65
68
|
youtubeClassName,
|
|
66
|
-
fullscreen,
|
|
67
69
|
]);
|
|
68
|
-
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));
|
|
69
71
|
};
|
|
70
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 } = 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 }));
|
|
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 }, 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;
|
|
@@ -4,32 +4,64 @@ unpredictable css rules order in build */
|
|
|
4
4
|
position: absolute;
|
|
5
5
|
bottom: 0;
|
|
6
6
|
}
|
|
7
|
+
.pc-CustomBarControls__wrapper_type_with-play-pause-button {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 20px;
|
|
12
|
+
}
|
|
7
13
|
.pc-CustomBarControls__button {
|
|
8
|
-
|
|
14
|
+
border: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
.pc-CustomBarControls__button_type_with-play-pause-button {
|
|
19
|
+
opacity: 0.9;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
transition: opacity 300ms ease 3s;
|
|
22
|
+
}
|
|
23
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:hover, .pc-CustomBarControls__button_type_with-play-pause-button:focus {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:focus {
|
|
27
|
+
outline: 1px solid var(--g-color-line-light);
|
|
28
|
+
outline-offset: 2px;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
}
|
|
31
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:focus:not(:focus-visible) {
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
.pc-CustomBarControls__button_type_with-mute-button {
|
|
9
35
|
border-radius: 50%;
|
|
10
36
|
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
11
39
|
cursor: pointer;
|
|
12
40
|
position: relative;
|
|
13
41
|
width: 64px;
|
|
14
42
|
height: 64px;
|
|
15
43
|
background: var(--g-color-base-background);
|
|
16
44
|
transition: background-color 300ms;
|
|
45
|
+
margin: 12px;
|
|
17
46
|
}
|
|
18
|
-
.pc-
|
|
47
|
+
.pc-CustomBarControls__button_type_with-mute-button:hover, .pc-CustomBarControls__button_type_with-mute-button:focus {
|
|
19
48
|
background: #eff2f8;
|
|
20
49
|
}
|
|
21
|
-
.pc-
|
|
22
|
-
|
|
50
|
+
.pc-CustomBarControls__button_type_with-mute-button:focus {
|
|
51
|
+
outline: 2px solid var(--g-color-line-misc);
|
|
23
52
|
}
|
|
24
|
-
.pc-
|
|
25
|
-
|
|
53
|
+
.pc-CustomBarControls__button_type_with-mute-button:focus:not(:focus-visible) {
|
|
54
|
+
outline: none;
|
|
55
|
+
}
|
|
56
|
+
.pc-CustomBarControls__play-icon {
|
|
57
|
+
height: 24px;
|
|
58
|
+
width: 24px;
|
|
59
|
+
}
|
|
60
|
+
.pc-CustomBarControls__mute-icon_type_with-mute-button {
|
|
26
61
|
height: 22px;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
.pc-CustomBarControls__mute-button_muted {
|
|
34
|
-
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTcgNyA3LTdoMnYyMmgtMmwtNy03SDBWN2g3eiIgZmlsbD0iIzI2MjYyNiIvPgogICAgPHBhdGggZD0ibTIwIDcgNCA0bTAgMC00IDRtNC00IDQtNG0tNCA0IDQgNCIgc3Ryb2tlPSIjMjYyNjI2IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==");
|
|
62
|
+
width: 32px;
|
|
63
|
+
}
|
|
64
|
+
.pc-CustomBarControls__mute-icon_type_with-play-pause-button {
|
|
65
|
+
height: 24px;
|
|
66
|
+
width: 24px;
|
|
35
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ClassNameProps } from '../../models';
|
|
2
|
+
import { ClassNameProps, CustomControlsType } from '../../models';
|
|
3
3
|
import './CustomBarControls.css';
|
|
4
4
|
interface MuteConfigProps {
|
|
5
5
|
isMuted: boolean;
|
|
@@ -8,6 +8,9 @@ interface MuteConfigProps {
|
|
|
8
8
|
export interface CustomBarControlsProps extends ClassNameProps {
|
|
9
9
|
mute?: MuteConfigProps;
|
|
10
10
|
elapsedTimePercent?: number;
|
|
11
|
+
type?: CustomControlsType;
|
|
12
|
+
isPaused?: boolean;
|
|
13
|
+
onPlayClick?: () => void;
|
|
11
14
|
}
|
|
12
15
|
declare const CustomBarControls: (props: CustomBarControlsProps) => JSX.Element;
|
|
13
16
|
export default CustomBarControls;
|
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
3
|
+
import { Mute } from '../../icons/Mute';
|
|
4
|
+
import { MuteSmall } from '../../icons/MuteSmall';
|
|
5
|
+
import { Unmute } from '../../icons/Unmute';
|
|
6
|
+
import { UnmuteSmall } from '../../icons/UnmuteSmall';
|
|
7
|
+
import { VideoControlPause } from '../../icons/VideoControlPause';
|
|
8
|
+
import { VideoControlPlay } from '../../icons/VideoControlPlay';
|
|
9
|
+
import { CustomControlsType } from '../../models';
|
|
2
10
|
import { block } from '../../utils';
|
|
3
11
|
import CircleProgress from './CircleProgress';
|
|
12
|
+
import i18n from './i18n';
|
|
4
13
|
import './CustomBarControls.css';
|
|
5
14
|
const b = block('CustomBarControls');
|
|
6
15
|
const CustomBarControls = (props) => {
|
|
7
|
-
const { mute, elapsedTimePercent = 0, className } = props;
|
|
8
|
-
const
|
|
9
|
-
|
|
16
|
+
const { mute, elapsedTimePercent = 0, className, type = CustomControlsType.WithMuteButton, isPaused, onPlayClick, } = props;
|
|
17
|
+
const muteIcon = useMemo(() => {
|
|
18
|
+
return type === CustomControlsType.WithMuteButton ? Mute : MuteSmall;
|
|
19
|
+
}, [type]);
|
|
20
|
+
const unmuteIcon = useMemo(() => {
|
|
21
|
+
return type === CustomControlsType.WithMuteButton ? Unmute : UnmuteSmall;
|
|
22
|
+
}, [type]);
|
|
23
|
+
const muteButton = useMemo(() => {
|
|
24
|
+
if (!mute) {
|
|
10
25
|
return null;
|
|
11
26
|
}
|
|
12
|
-
const { isMuted, changeMute } =
|
|
13
|
-
return (React.createElement("
|
|
14
|
-
React.createElement(
|
|
15
|
-
!isMuted && React.createElement(CircleProgress, { elapsedTime:
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
27
|
+
const { isMuted, changeMute } = mute;
|
|
28
|
+
return (React.createElement("button", { className: b('button', { type }), onClick: changeMute, "aria-label": i18n(isMuted ? 'unmute' : 'mute') },
|
|
29
|
+
React.createElement(Icon, { data: isMuted ? unmuteIcon : muteIcon, className: b('mute-icon', { type }) }),
|
|
30
|
+
type === CustomControlsType.WithMuteButton && !isMuted && (React.createElement(CircleProgress, { elapsedTime: elapsedTimePercent, strokeWidth: 5 }))));
|
|
31
|
+
}, [elapsedTimePercent, mute, muteIcon, type, unmuteIcon]);
|
|
32
|
+
const playPauseButton = useMemo(() => {
|
|
33
|
+
if (type !== CustomControlsType.WithPlayPauseButton) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (React.createElement("button", { onClick: onPlayClick, className: b('button', { type }), "aria-label": i18n(isPaused ? 'play' : 'pause') },
|
|
37
|
+
React.createElement(Icon, { data: isPaused ? VideoControlPlay : VideoControlPause, className: b('play-icon') })));
|
|
38
|
+
}, [isPaused, onPlayClick, type]);
|
|
39
|
+
return (React.createElement("div", { className: b('wrapper', { type }, className) },
|
|
40
|
+
playPauseButton,
|
|
41
|
+
muteButton));
|
|
18
42
|
};
|
|
19
43
|
export default CustomBarControls;
|
|
@@ -50,6 +50,18 @@ unpredictable css rules order in build */
|
|
|
50
50
|
opacity: 1;
|
|
51
51
|
transition: opacity 300ms ease 0s;
|
|
52
52
|
}
|
|
53
|
+
.pc-ReactPlayer_started.pc-ReactPlayer_controls_custom.pc-ReactPlayer_hovered::before {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
.pc-ReactPlayer_started.pc-ReactPlayer_controls_custom::before {
|
|
57
|
+
position: absolute;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
content: "";
|
|
61
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 65.36%, rgba(0, 0, 0, 0.2) 100%);
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: opacity 300ms;
|
|
64
|
+
}
|
|
53
65
|
.pc-ReactPlayer__custom-bar-controls {
|
|
54
66
|
opacity: 0;
|
|
55
67
|
transition: opacity 300ms ease 3s;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
1
|
+
import React, { Fragment, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import ReactPlayer from 'react-player';
|
|
5
5
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import { VideoContext } from '../../context/videoContext';
|
|
8
|
-
import { useAnalytics } from '../../hooks';
|
|
8
|
+
import { useAnalytics, useMount } from '../../hooks';
|
|
9
9
|
import { PlayVideo } from '../../icons';
|
|
10
|
-
import { DefaultEventNames, MediaVideoControlsType, PlayButtonThemes, PlayButtonType, PredefinedEventTypes, } from '../../models';
|
|
10
|
+
import { CustomControlsType, DefaultEventNames, MediaVideoControlsType, PlayButtonThemes, PlayButtonType, PredefinedEventTypes, } from '../../models';
|
|
11
11
|
import { block } from '../../utils';
|
|
12
12
|
import CustomBarControls from './CustomBarControls';
|
|
13
|
+
import i18n from './i18n';
|
|
13
14
|
import { checkYoutubeVideos } from './utils';
|
|
14
15
|
import './ReactPlayer.css';
|
|
15
16
|
const b = block('ReactPlayer');
|
|
@@ -18,8 +19,9 @@ const FPS = 60;
|
|
|
18
19
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
19
20
|
const isMobile = useContext(MobileContext);
|
|
20
21
|
const { metrika } = useContext(MetrikaContext);
|
|
21
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, } = props;
|
|
22
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, customControlsOptions = {}, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, } = props;
|
|
22
23
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
24
|
+
const { type: customControlsType = CustomControlsType.WithMuteButton } = customControlsOptions;
|
|
23
25
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
24
26
|
const mute = initiallyMuted || autoPlay;
|
|
25
27
|
const { playingVideoRef, setProps } = useContext(VideoContext);
|
|
@@ -31,8 +33,10 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
31
33
|
const [width, setWidth] = useState(0);
|
|
32
34
|
const [muted, setMuted] = useState(mute);
|
|
33
35
|
const [started, setStarted] = useState(autoPlay);
|
|
34
|
-
const [paused, setPaused] = useState(false);
|
|
35
36
|
const [ended, setEnded] = useState(false);
|
|
37
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
38
|
+
const [hovered, setHovered] = useState(false);
|
|
39
|
+
useMount(() => setIsMounted(true));
|
|
36
40
|
const videoSrc = useMemo(() => checkYoutubeVideos(src), [src]);
|
|
37
41
|
const eventsArray = useMemo(() => {
|
|
38
42
|
if (analyticsEvents) {
|
|
@@ -102,10 +106,12 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
102
106
|
playButtonContent = React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 });
|
|
103
107
|
break;
|
|
104
108
|
}
|
|
105
|
-
return (React.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName) }, playButtonContent));
|
|
109
|
+
return (React.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": i18n('play') }, playButtonContent));
|
|
106
110
|
}, [type, theme, text, buttonClassName]);
|
|
107
111
|
const changeMute = useCallback((isMuted) => {
|
|
108
|
-
if (isMuted &&
|
|
112
|
+
if (isMuted &&
|
|
113
|
+
playerRef &&
|
|
114
|
+
customControlsType !== CustomControlsType.WithPlayPauseButton) {
|
|
109
115
|
playerRef.seekTo(0);
|
|
110
116
|
setPlayedPercent(0);
|
|
111
117
|
}
|
|
@@ -123,8 +129,16 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
123
129
|
}
|
|
124
130
|
// In order to the progress bar to update (equals 0) before displaying
|
|
125
131
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
126
|
-
}, [
|
|
127
|
-
|
|
132
|
+
}, [
|
|
133
|
+
playerRef,
|
|
134
|
+
customControlsType,
|
|
135
|
+
metrika,
|
|
136
|
+
videoMetrika,
|
|
137
|
+
playEvents,
|
|
138
|
+
stopEvents,
|
|
139
|
+
handleAnalytics,
|
|
140
|
+
setProps,
|
|
141
|
+
]);
|
|
128
142
|
const handleClickPreview = useCallback(() => {
|
|
129
143
|
setIsPlaying(true);
|
|
130
144
|
onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview();
|
|
@@ -138,12 +152,11 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
138
152
|
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
139
153
|
const onPause = useCallback(() => {
|
|
140
154
|
// For support correct state for youtube
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
setIsPlaying(true);
|
|
155
|
+
if (controls !== MediaVideoControlsType.Custom ||
|
|
156
|
+
customControlsType === CustomControlsType.WithPlayPauseButton) {
|
|
157
|
+
setIsPlaying(false);
|
|
145
158
|
}
|
|
146
|
-
}, [controls,
|
|
159
|
+
}, [controls, customControlsType]);
|
|
147
160
|
const onStart = useCallback(() => {
|
|
148
161
|
if (!autoPlay && !initiallyMuted) {
|
|
149
162
|
setMuted(false);
|
|
@@ -151,17 +164,17 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
151
164
|
}, [autoPlay, initiallyMuted]);
|
|
152
165
|
const onPlay = useCallback(() => {
|
|
153
166
|
setIsPlaying(true);
|
|
154
|
-
if (controls === MediaVideoControlsType.Custom
|
|
167
|
+
if (controls === MediaVideoControlsType.Custom &&
|
|
168
|
+
customControlsType === CustomControlsType.WithMuteButton) {
|
|
155
169
|
if (ended) {
|
|
156
170
|
changeMute(false);
|
|
157
171
|
}
|
|
158
|
-
else if (
|
|
172
|
+
else if (!isPlaying) {
|
|
159
173
|
changeMute(muted);
|
|
160
174
|
}
|
|
161
175
|
setEnded(false);
|
|
162
|
-
setPaused(false);
|
|
163
176
|
}
|
|
164
|
-
}, [changeMute, controls, ended,
|
|
177
|
+
}, [changeMute, controls, customControlsType, ended, isPlaying, muted]);
|
|
165
178
|
const onProgress = useCallback((progress) => {
|
|
166
179
|
setPlayedPercent(progress.played);
|
|
167
180
|
if (progress.played === 1) {
|
|
@@ -179,21 +192,33 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
179
192
|
}
|
|
180
193
|
setEnded(true);
|
|
181
194
|
}, [loop, playerRef]);
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
195
|
+
const onPlayClick = useCallback(() => {
|
|
196
|
+
if (isPlaying) {
|
|
197
|
+
onPause();
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
onPlay();
|
|
201
|
+
}
|
|
202
|
+
}, [isPlaying, onPlay, onPause]);
|
|
203
|
+
const handleClick = useCallback(() => {
|
|
204
|
+
if (customControlsType === CustomControlsType.WithMuteButton) {
|
|
205
|
+
changeMute(muted);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
onPlayClick();
|
|
209
|
+
}
|
|
210
|
+
}, [changeMute, customControlsType, muted, onPlayClick]);
|
|
211
|
+
const onFocusIn = useCallback(() => setHovered(true), []);
|
|
212
|
+
const onFocusOut = useCallback(() => setHovered(false), []);
|
|
213
|
+
return (React.createElement("div", { className: b({ wrapper: !currentHeight, controls, started, hovered }, className), ref: ref, onClick: handleClick, onMouseEnter: onFocusIn, onMouseLeave: onFocusOut, onFocus: onFocusIn, onBlur: onFocusOut }, isMounted ? (React.createElement(Fragment, null,
|
|
214
|
+
React.createElement(ReactPlayer, { className: b('player'), url: videoSrc, muted: muted, controls: controls === MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded, "aria-label": ariaLabel }),
|
|
215
|
+
controls === MediaVideoControlsType.Custom && started && (React.createElement(CustomBarControls, { className: b('custom-bar-controls', { muted }, customBarControlsClassName), mute: {
|
|
216
|
+
isMuted: muted,
|
|
188
217
|
changeMute: (event) => {
|
|
189
218
|
event.stopPropagation();
|
|
190
|
-
changeMute(
|
|
219
|
+
changeMute(muted);
|
|
191
220
|
},
|
|
192
|
-
}, elapsedTimePercent:
|
|
193
|
-
}, [controls, isPlaying, customBarControlsClassName, changeMute]);
|
|
194
|
-
return (React.createElement("div", { className: b({ wrapper: !currentHeight }, className), ref: ref, onClick: handleClick },
|
|
195
|
-
React.createElement(ReactPlayer, { className: b('player'), url: videoSrc, muted: muted, controls: controls === MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded }),
|
|
196
|
-
renderCustomBarControls(muted, playedPercent)));
|
|
221
|
+
}, elapsedTimePercent: playedPercent, type: customControlsType, isPaused: !isPlaying, onPlayClick: onPlayClick })))) : null));
|
|
197
222
|
});
|
|
198
223
|
function getHeight(width) {
|
|
199
224
|
return (width / 16) * 9;
|
|
@@ -2,28 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { HTML, YFMWrapper } from '../';
|
|
3
3
|
import { block } from '../../utils';
|
|
4
4
|
import './Table.css';
|
|
5
|
+
function getMarkerId(index) {
|
|
6
|
+
if (isNaN(index)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return `marker-${index}`;
|
|
10
|
+
}
|
|
5
11
|
const b = block('table');
|
|
6
12
|
export default class Table extends React.Component {
|
|
7
13
|
render() {
|
|
8
|
-
const { content, legend, marker = 'disk', className } = this.props;
|
|
14
|
+
const { content, legend, marker = 'disk', className, caption } = this.props;
|
|
9
15
|
if (!content || !content.length || !content[0].length) {
|
|
10
16
|
return null;
|
|
11
17
|
}
|
|
12
|
-
return (React.createElement("div", { className: b(null, className) },
|
|
18
|
+
return (React.createElement("div", { className: b(null, className), role: 'table', "aria-label": caption },
|
|
13
19
|
this.renderTable(content, marker, legend),
|
|
14
20
|
legend && this.renderLegend(legend, marker)));
|
|
15
21
|
}
|
|
16
22
|
renderTable(content, marker, legend) {
|
|
17
23
|
const justify = this.getDefaultJustify(content, this.props.justify);
|
|
18
|
-
return (React.createElement("div", { className: b('table') }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row') }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }) }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
24
|
+
return (React.createElement("div", { className: b('table'), role: 'rowgroup' }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row'), role: 'row' }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }), role: 'cell' }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
19
25
|
}
|
|
20
26
|
renderMarker(type, cell) {
|
|
21
|
-
return React.createElement("div", { className: b('marker', { type, index: String(cell) }) });
|
|
27
|
+
return (React.createElement("div", { "aria-labelledby": getMarkerId(Number(cell)), className: b('marker', { type, index: String(cell) }) }));
|
|
22
28
|
}
|
|
23
29
|
renderLegend(legend, marker) {
|
|
24
30
|
return (React.createElement("div", { className: b('legend') }, legend.map((item, index) => (React.createElement("div", { key: item, className: b('legend-item') },
|
|
25
31
|
this.renderMarker(marker, String(index)),
|
|
26
|
-
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true } }))))));
|
|
32
|
+
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true }, id: getMarkerId(index) }))))));
|
|
27
33
|
}
|
|
28
34
|
getDefaultJustify(content, justify) {
|
|
29
35
|
return justify || new Array(content[0].length).fill('center');
|