@gravity-ui/page-constructor 4.3.0 → 4.3.12-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/cjs/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/cjs/blocks/Header/Header.css +0 -6
- package/build/cjs/blocks/Icons/Icons.js +7 -1
- package/build/cjs/blocks/Icons/schema.d.ts +162 -0
- package/build/cjs/blocks/Icons/schema.js +11 -0
- package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -1
- package/build/cjs/blocks/Slider/Slider.css +4 -1
- package/build/cjs/blocks/Slider/Slider.js +32 -6
- package/build/cjs/blocks/Slider/i18n/en.json +4 -0
- package/build/cjs/blocks/Slider/i18n/index.d.ts +2 -0
- package/build/cjs/blocks/Slider/i18n/index.js +8 -0
- package/build/cjs/blocks/Slider/i18n/ru.json +4 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.d.ts +1 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +5 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +4 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/cjs/components/CardBase/CardBase.css +4 -4
- package/build/cjs/components/HTML/HTML.d.ts +5 -1
- package/build/cjs/components/HTML/HTML.js +3 -1
- package/build/cjs/components/Image/Image.js +7 -5
- package/build/cjs/components/Image/schema.d.ts +19 -0
- package/build/cjs/components/Image/schema.js +12 -1
- package/build/cjs/components/Link/Link.d.ts +2 -1
- package/build/cjs/components/Link/Link.js +4 -2
- package/build/cjs/components/Media/Image/Image.d.ts +3 -2
- package/build/cjs/components/Media/Image/Image.js +8 -5
- package/build/cjs/components/Media/Media.d.ts +2 -2
- package/build/cjs/components/Media/Media.js +9 -6
- package/build/cjs/components/Media/Video/Video.d.ts +2 -2
- package/build/cjs/components/Media/Video/Video.js +15 -6
- package/build/cjs/components/MetaInfo/MetaInfo.css +0 -2
- package/build/cjs/components/MetaInfo/MetaInfo.js +2 -1
- package/build/cjs/components/ReactPlayer/CustomBarControls.css +46 -14
- package/build/cjs/components/ReactPlayer/CustomBarControls.d.ts +4 -1
- package/build/cjs/components/ReactPlayer/CustomBarControls.js +33 -9
- package/build/cjs/components/ReactPlayer/ReactPlayer.css +12 -0
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +49 -25
- package/build/cjs/components/ReactPlayer/i18n/en.json +4 -1
- package/build/cjs/components/ReactPlayer/i18n/ru.json +4 -1
- package/build/cjs/components/Table/Table.js +11 -5
- package/build/cjs/components/VideoBlock/VideoBlock.js +7 -6
- package/build/cjs/components/YFMWrapper/YFMWrapper.d.ts +4 -3
- package/build/cjs/components/YFMWrapper/YFMWrapper.js +3 -3
- package/build/cjs/constructor-items.d.ts +10 -3
- package/build/cjs/constructor-items.js +11 -1
- package/build/cjs/containers/Loadable/Loadable.js +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.css +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/cjs/containers/PageConstructor/PageConstructor.js +10 -6
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -2
- package/build/cjs/context/innerContext/InnerContext.d.ts +3 -1
- package/build/cjs/context/innerContext/InnerContext.js +2 -0
- package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/cjs/editor/components/EditBlock/EditBlock.css +1 -0
- package/build/cjs/editor/components/Layout/Layout.css +2 -1
- package/build/cjs/editor/containers/Form/Form.css +14 -35
- package/build/cjs/editor/store/index.js +1 -1
- package/build/cjs/editor/styles/root.css +2 -1
- package/build/cjs/editor/utils/index.d.ts +1 -0
- package/build/cjs/grid/Col/Col.d.ts +2 -4
- package/build/cjs/icons/Mute.d.ts +2 -0
- package/build/cjs/icons/Mute.js +12 -0
- package/build/cjs/icons/MuteSmall.d.ts +2 -0
- package/build/cjs/icons/MuteSmall.js +15 -0
- package/build/cjs/icons/Unmute.d.ts +2 -0
- package/build/cjs/icons/Unmute.js +12 -0
- package/build/cjs/icons/UnmuteSmall.d.ts +2 -0
- package/build/cjs/icons/UnmuteSmall.js +17 -0
- package/build/cjs/icons/VideoControlPause.d.ts +2 -0
- package/build/cjs/icons/VideoControlPause.js +16 -0
- package/build/cjs/icons/VideoControlPlay.d.ts +2 -0
- package/build/cjs/icons/VideoControlPlay.js +12 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +12 -5
- package/build/cjs/models/constructor-items/common.d.ts +16 -34
- package/build/cjs/models/constructor-items/common.js +6 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/cjs/models/constructor.d.ts +7 -1
- package/build/cjs/models/navigation.d.ts +1 -0
- package/build/cjs/models/navigation.js +2 -1
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +1 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +4 -16
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
- package/build/cjs/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/cjs/navigation/components/NavigationItem/index.js +14 -0
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/cjs/navigation/components/SocialIcon/SocialIcon.js +2 -1
- package/build/cjs/schema/constants.d.ts +181 -78
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/cjs/sub-blocks/Content/Content.d.ts +3 -1
- package/build/cjs/sub-blocks/Content/Content.js +7 -5
- package/build/cjs/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
- package/build/cjs/sub-blocks/Content/ContentList/ContentList.js +7 -5
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/cjs/sub-blocks/MediaCard/schema.js +11 -1
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +7 -4
- package/build/cjs/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/cjs/sub-blocks/Quote/Quote.css +0 -3
- package/build/cjs/text-transform/common.d.ts +7 -2
- package/build/cjs/text-transform/common.js +8 -2
- package/build/cjs/text-transform/config.js +1 -1
- package/build/cjs/text-transform/transformers.d.ts +2 -0
- package/build/cjs/text-transform/transformers.js +11 -8
- package/build/cjs/utils/blocks.d.ts +3 -6
- package/build/cjs/utils/blocks.js +25 -16
- package/build/cjs/utils/cn.d.ts +3 -3
- package/build/cjs/utils/cn.js +4 -7
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/esm/blocks/Header/Header.css +0 -6
- package/build/esm/blocks/Icons/Icons.js +8 -2
- package/build/esm/blocks/Icons/schema.d.ts +162 -0
- package/build/esm/blocks/Icons/schema.js +11 -0
- package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -1
- package/build/esm/blocks/Slider/Slider.css +4 -1
- package/build/esm/blocks/Slider/Slider.js +33 -7
- package/build/esm/blocks/Slider/i18n/en.json +4 -0
- package/build/esm/blocks/Slider/i18n/index.d.ts +2 -0
- package/build/esm/blocks/Slider/i18n/index.js +5 -0
- package/build/esm/blocks/Slider/i18n/ru.json +4 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.d.ts +1 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +5 -3
- package/build/esm/components/BackgroundMedia/BackgroundMedia.d.ts +1 -1
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +5 -4
- package/build/esm/components/ButtonTabs/ButtonTabs.js +6 -1
- package/build/esm/components/CardBase/CardBase.css +4 -4
- package/build/esm/components/HTML/HTML.d.ts +5 -1
- package/build/esm/components/HTML/HTML.js +3 -1
- package/build/esm/components/Image/Image.js +7 -5
- package/build/esm/components/Image/schema.d.ts +19 -0
- package/build/esm/components/Image/schema.js +12 -1
- package/build/esm/components/Link/Link.d.ts +2 -1
- package/build/esm/components/Link/Link.js +4 -2
- package/build/esm/components/Media/Image/Image.d.ts +3 -2
- package/build/esm/components/Media/Image/Image.js +8 -6
- package/build/esm/components/Media/Media.d.ts +2 -2
- package/build/esm/components/Media/Media.js +10 -7
- package/build/esm/components/Media/Video/Video.d.ts +2 -2
- package/build/esm/components/Media/Video/Video.js +16 -7
- package/build/esm/components/MetaInfo/MetaInfo.css +0 -2
- package/build/esm/components/MetaInfo/MetaInfo.js +2 -1
- package/build/esm/components/ReactPlayer/CustomBarControls.css +46 -14
- package/build/esm/components/ReactPlayer/CustomBarControls.d.ts +4 -1
- package/build/esm/components/ReactPlayer/CustomBarControls.js +34 -10
- package/build/esm/components/ReactPlayer/ReactPlayer.css +12 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.js +52 -28
- package/build/esm/components/ReactPlayer/i18n/en.json +4 -1
- package/build/esm/components/ReactPlayer/i18n/ru.json +4 -1
- package/build/esm/components/Table/Table.js +11 -5
- package/build/esm/components/VideoBlock/VideoBlock.js +7 -6
- package/build/esm/components/YFMWrapper/YFMWrapper.d.ts +4 -3
- package/build/esm/components/YFMWrapper/YFMWrapper.js +3 -3
- package/build/esm/constructor-items.d.ts +10 -3
- package/build/esm/constructor-items.js +10 -1
- package/build/esm/containers/Loadable/Loadable.js +1 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +4 -0
- package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -1
- package/build/esm/containers/PageConstructor/PageConstructor.js +12 -8
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +1 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +4 -2
- package/build/esm/context/innerContext/InnerContext.d.ts +3 -1
- package/build/esm/context/innerContext/InnerContext.js +2 -0
- package/build/esm/editor/components/AddBlock/AddBlock.css +1 -1
- package/build/esm/editor/components/EditBlock/EditBlock.css +1 -0
- package/build/esm/editor/components/Layout/Layout.css +2 -1
- package/build/esm/editor/containers/Form/Form.css +14 -35
- package/build/esm/editor/store/index.js +2 -2
- package/build/esm/editor/styles/root.css +2 -1
- package/build/esm/editor/utils/index.d.ts +1 -0
- package/build/esm/grid/Col/Col.d.ts +2 -4
- package/build/esm/icons/Mute.d.ts +2 -0
- package/build/esm/icons/Mute.js +7 -0
- package/build/esm/icons/MuteSmall.d.ts +2 -0
- package/build/esm/icons/MuteSmall.js +10 -0
- package/build/esm/icons/Unmute.d.ts +2 -0
- package/build/esm/icons/Unmute.js +7 -0
- package/build/esm/icons/UnmuteSmall.d.ts +2 -0
- package/build/esm/icons/UnmuteSmall.js +12 -0
- package/build/esm/icons/VideoControlPause.d.ts +2 -0
- package/build/esm/icons/VideoControlPause.js +11 -0
- package/build/esm/icons/VideoControlPlay.d.ts +2 -0
- package/build/esm/icons/VideoControlPlay.js +7 -0
- package/build/esm/models/constructor-items/blocks.d.ts +12 -5
- package/build/esm/models/constructor-items/common.d.ts +16 -34
- package/build/esm/models/constructor-items/common.js +5 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/esm/models/constructor.d.ts +7 -1
- package/build/esm/models/navigation.d.ts +1 -0
- package/build/esm/models/navigation.js +1 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.js +1 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +1 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -17
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +1 -1
- package/build/esm/navigation/components/NavigationItem/index.d.ts +6 -0
- package/build/esm/navigation/components/NavigationItem/index.js +6 -0
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +1 -1
- package/build/esm/navigation/components/SocialIcon/SocialIcon.js +2 -1
- package/build/esm/schema/constants.d.ts +181 -78
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/esm/sub-blocks/Content/Content.d.ts +3 -1
- package/build/esm/sub-blocks/Content/Content.js +7 -5
- package/build/esm/sub-blocks/Content/ContentList/ContentList.d.ts +2 -1
- package/build/esm/sub-blocks/Content/ContentList/ContentList.js +7 -5
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/esm/sub-blocks/MediaCard/schema.js +11 -1
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +8 -4
- package/build/esm/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/esm/sub-blocks/Quote/Quote.css +0 -3
- package/build/esm/text-transform/common.d.ts +7 -2
- package/build/esm/text-transform/common.js +7 -2
- package/build/esm/text-transform/config.js +1 -1
- package/build/esm/text-transform/transformers.d.ts +2 -0
- package/build/esm/text-transform/transformers.js +11 -8
- package/build/esm/utils/blocks.d.ts +3 -6
- package/build/esm/utils/blocks.js +21 -11
- package/build/esm/utils/cn.d.ts +3 -3
- package/build/esm/utils/cn.js +3 -4
- package/package.json +6 -6
- package/server/models/constructor-items/blocks.d.ts +12 -5
- package/server/models/constructor-items/common.d.ts +16 -34
- package/server/models/constructor-items/common.js +6 -1
- package/server/models/constructor-items/sub-blocks.d.ts +4 -4
- package/server/models/constructor.d.ts +7 -1
- package/server/models/navigation.d.ts +1 -0
- package/server/models/navigation.js +2 -1
- package/server/text-transform/common.d.ts +7 -2
- package/server/text-transform/common.js +10 -2
- package/server/text-transform/config.js +1 -1
- package/server/text-transform/transformers.d.ts +2 -0
- package/server/text-transform/transformers.js +11 -8
- package/server/utils/blocks.d.ts +3 -6
- package/server/utils/blocks.js +25 -16
- package/server/utils/cn.d.ts +3 -3
- package/server/utils/cn.js +4 -9
- package/styles/mixins.scss +4 -1
- package/styles/storybook/common.scss +2 -0
- package/styles/styles.css +4 -0
- package/styles/yfm.scss +7 -0
- package/widget/index.js +1 -1
|
@@ -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
1
|
import { ClassNameProps, LinkProps, Tabbable, WithChildren } from '../../models';
|
|
2
|
-
|
|
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;
|
|
@@ -10,6 +10,7 @@ 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, tabIndex, } = 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);
|
|
@@ -48,7 +50,7 @@ const LinkBlock = (props) => {
|
|
|
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, tabIndex: tabIndex }, 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,12 +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, 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;
|
|
15
15
|
const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
|
|
16
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'video');
|
|
16
17
|
const content = (0, react_1.useMemo)(() => {
|
|
17
18
|
let result = [];
|
|
18
19
|
if (image) {
|
|
19
|
-
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 }));
|
|
20
21
|
}
|
|
21
22
|
if (video) {
|
|
22
23
|
const videoProps = {
|
|
@@ -34,10 +35,10 @@ const Media = (props) => {
|
|
|
34
35
|
setHasVideoFallback,
|
|
35
36
|
};
|
|
36
37
|
if (fullscreen) {
|
|
37
|
-
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 })));
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
|
-
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 })));
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
if (youtube) {
|
|
@@ -57,6 +58,9 @@ const Media = (props) => {
|
|
|
57
58
|
imageClassName,
|
|
58
59
|
isBackground,
|
|
59
60
|
hasVideoFallback,
|
|
61
|
+
fullscreen,
|
|
62
|
+
qaAttributes.image,
|
|
63
|
+
qaAttributes.video,
|
|
60
64
|
videoClassName,
|
|
61
65
|
metrika,
|
|
62
66
|
analyticsEvents,
|
|
@@ -65,9 +69,8 @@ const Media = (props) => {
|
|
|
65
69
|
playButton,
|
|
66
70
|
customBarControlsClassName,
|
|
67
71
|
youtubeClassName,
|
|
68
|
-
fullscreen,
|
|
69
72
|
]);
|
|
70
|
-
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));
|
|
71
74
|
};
|
|
72
75
|
exports.Media = Media;
|
|
73
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;
|
|
@@ -8,7 +8,8 @@ const ReactPlayer_1 = tslib_1.__importDefault(require("../../ReactPlayer/ReactPl
|
|
|
8
8
|
const utils_2 = require("./utils");
|
|
9
9
|
const b = (0, utils_1.block)('media-component-video');
|
|
10
10
|
const Video = (props) => {
|
|
11
|
-
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
11
|
+
const { video, height, metrika, analyticsEvents, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, qa, } = props;
|
|
12
|
+
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa, 'source');
|
|
12
13
|
const ref = (0, react_1.useRef)(null);
|
|
13
14
|
(0, react_1.useEffect)(() => {
|
|
14
15
|
if (ref && ref.current) {
|
|
@@ -30,8 +31,8 @@ const Video = (props) => {
|
|
|
30
31
|
}
|
|
31
32
|
}, [playVideo, video, setHasVideoFallback]);
|
|
32
33
|
const reactPlayerBlock = (0, react_1.useMemo)(() => {
|
|
33
|
-
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, } = video;
|
|
34
|
-
return (react_1.default.createElement(ReactPlayer_1.default, { 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 }));
|
|
34
|
+
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton, ariaLabel, customControlsOptions, } = video;
|
|
35
|
+
return (react_1.default.createElement(ReactPlayer_1.default, { 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 }));
|
|
35
36
|
}, [
|
|
36
37
|
video,
|
|
37
38
|
height,
|
|
@@ -44,12 +45,20 @@ const Video = (props) => {
|
|
|
44
45
|
analyticsEvents,
|
|
45
46
|
]);
|
|
46
47
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
47
|
-
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
48
|
+
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height }, "data-qa": qaAttributes.default },
|
|
48
49
|
react_1.default.createElement("video", { disablePictureInPicture: true, playsInline: true,
|
|
49
50
|
// @ts-ignore
|
|
50
51
|
// eslint-disable-next-line react/no-unknown-property
|
|
51
|
-
pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, (0, utils_2.getVideoTypesWithPriority)(video.src).map(({ src, type }, index) => (react_1.default.createElement("source", { key: index, src: src, type: type })))))) : null;
|
|
52
|
-
}, [
|
|
52
|
+
pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, (0, utils_2.getVideoTypesWithPriority)(video.src).map(({ src, type }, index) => (react_1.default.createElement("source", { key: index, src: src, type: type, "data-qa": qaAttributes.source })))))) : null;
|
|
53
|
+
}, [
|
|
54
|
+
video.src,
|
|
55
|
+
video.ariaLabel,
|
|
56
|
+
hasVideoFallback,
|
|
57
|
+
videoClassName,
|
|
58
|
+
height,
|
|
59
|
+
qaAttributes.default,
|
|
60
|
+
qaAttributes.source,
|
|
61
|
+
]);
|
|
53
62
|
switch (video.type) {
|
|
54
63
|
case models_1.MediaVideoType.Player:
|
|
55
64
|
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;
|
|
@@ -3,6 +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 index_1 = require("../index");
|
|
6
7
|
const b = (0, utils_1.block)('meta-info');
|
|
7
|
-
const MetaInfo = ({ items, className }) => (react_1.default.createElement("h4", { className: b(null, className) }, items.map((metaInfoItem) => (react_1.default.createElement(
|
|
8
|
+
const MetaInfo = ({ items, className }) => (react_1.default.createElement("h4", { className: b(null, className) }, items.map((metaInfoItem) => (react_1.default.createElement(index_1.YFMWrapper, { content: metaInfoItem, key: metaInfoItem, className: b('item'), modifiers: { constructor: true, constructorMetaInfo: true } })))));
|
|
8
9
|
exports.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
|
interface MuteConfigProps {
|
|
4
4
|
isMuted: boolean;
|
|
5
5
|
changeMute: (event: React.MouseEvent) => void;
|
|
@@ -7,6 +7,9 @@ interface MuteConfigProps {
|
|
|
7
7
|
export interface CustomBarControlsProps extends ClassNameProps {
|
|
8
8
|
mute?: MuteConfigProps;
|
|
9
9
|
elapsedTimePercent?: number;
|
|
10
|
+
type?: CustomControlsType;
|
|
11
|
+
isPaused?: boolean;
|
|
12
|
+
onPlayClick?: () => void;
|
|
10
13
|
}
|
|
11
14
|
declare const CustomBarControls: (props: CustomBarControlsProps) => JSX.Element;
|
|
12
15
|
export default CustomBarControls;
|
|
@@ -2,20 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const Mute_1 = require("../../icons/Mute");
|
|
7
|
+
const MuteSmall_1 = require("../../icons/MuteSmall");
|
|
8
|
+
const Unmute_1 = require("../../icons/Unmute");
|
|
9
|
+
const UnmuteSmall_1 = require("../../icons/UnmuteSmall");
|
|
10
|
+
const VideoControlPause_1 = require("../../icons/VideoControlPause");
|
|
11
|
+
const VideoControlPlay_1 = require("../../icons/VideoControlPlay");
|
|
12
|
+
const models_1 = require("../../models");
|
|
5
13
|
const utils_1 = require("../../utils");
|
|
6
14
|
const CircleProgress_1 = tslib_1.__importDefault(require("./CircleProgress"));
|
|
15
|
+
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
7
16
|
const b = (0, utils_1.block)('CustomBarControls');
|
|
8
17
|
const CustomBarControls = (props) => {
|
|
9
|
-
const { mute, elapsedTimePercent = 0, className } = props;
|
|
10
|
-
const
|
|
11
|
-
|
|
18
|
+
const { mute, elapsedTimePercent = 0, className, type = models_1.CustomControlsType.WithMuteButton, isPaused, onPlayClick, } = props;
|
|
19
|
+
const muteIcon = (0, react_1.useMemo)(() => {
|
|
20
|
+
return type === models_1.CustomControlsType.WithMuteButton ? Mute_1.Mute : MuteSmall_1.MuteSmall;
|
|
21
|
+
}, [type]);
|
|
22
|
+
const unmuteIcon = (0, react_1.useMemo)(() => {
|
|
23
|
+
return type === models_1.CustomControlsType.WithMuteButton ? Unmute_1.Unmute : UnmuteSmall_1.UnmuteSmall;
|
|
24
|
+
}, [type]);
|
|
25
|
+
const muteButton = (0, react_1.useMemo)(() => {
|
|
26
|
+
if (!mute) {
|
|
12
27
|
return null;
|
|
13
28
|
}
|
|
14
|
-
const { isMuted, changeMute } =
|
|
15
|
-
return (react_1.default.createElement("
|
|
16
|
-
react_1.default.createElement(
|
|
17
|
-
!isMuted && react_1.default.createElement(CircleProgress_1.default, { elapsedTime:
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
29
|
+
const { isMuted, changeMute } = mute;
|
|
30
|
+
return (react_1.default.createElement("button", { className: b('button', { type }), onClick: changeMute, "aria-label": (0, i18n_1.default)(isMuted ? 'unmute' : 'mute') },
|
|
31
|
+
react_1.default.createElement(uikit_1.Icon, { data: isMuted ? unmuteIcon : muteIcon, className: b('mute-icon', { type }) }),
|
|
32
|
+
type === models_1.CustomControlsType.WithMuteButton && !isMuted && (react_1.default.createElement(CircleProgress_1.default, { elapsedTime: elapsedTimePercent, strokeWidth: 5 }))));
|
|
33
|
+
}, [elapsedTimePercent, mute, muteIcon, type, unmuteIcon]);
|
|
34
|
+
const playPauseButton = (0, react_1.useMemo)(() => {
|
|
35
|
+
if (type !== models_1.CustomControlsType.WithPlayPauseButton) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (react_1.default.createElement("button", { onClick: onPlayClick, className: b('button', { type }), "aria-label": (0, i18n_1.default)(isPaused ? 'play' : 'pause') },
|
|
39
|
+
react_1.default.createElement(uikit_1.Icon, { data: isPaused ? VideoControlPlay_1.VideoControlPlay : VideoControlPause_1.VideoControlPause, className: b('play-icon') })));
|
|
40
|
+
}, [isPaused, onPlayClick, type]);
|
|
41
|
+
return (react_1.default.createElement("div", { className: b('wrapper', { type }, className) },
|
|
42
|
+
playPauseButton,
|
|
43
|
+
muteButton));
|
|
20
44
|
};
|
|
21
45
|
exports.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;
|
|
@@ -22,8 +22,9 @@ const FPS = 60;
|
|
|
22
22
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
23
23
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
24
24
|
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
25
|
-
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, } = props;
|
|
25
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, customControlsOptions = {}, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, } = props;
|
|
26
26
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
27
|
+
const { type: customControlsType = models_1.CustomControlsType.WithMuteButton } = customControlsOptions;
|
|
27
28
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
28
29
|
const mute = initiallyMuted || autoPlay;
|
|
29
30
|
const { playingVideoRef, setProps } = (0, react_1.useContext)(videoContext_1.VideoContext);
|
|
@@ -35,8 +36,10 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
35
36
|
const [width, setWidth] = (0, react_1.useState)(0);
|
|
36
37
|
const [muted, setMuted] = (0, react_1.useState)(mute);
|
|
37
38
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
38
|
-
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
39
39
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
40
|
+
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
41
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
42
|
+
(0, hooks_1.useMount)(() => setIsMounted(true));
|
|
40
43
|
const videoSrc = (0, react_1.useMemo)(() => (0, utils_2.checkYoutubeVideos)(src), [src]);
|
|
41
44
|
const eventsArray = (0, react_1.useMemo)(() => {
|
|
42
45
|
if (analyticsEvents) {
|
|
@@ -109,7 +112,9 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
109
112
|
return (react_1.default.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": (0, i18n_1.default)('play') }, playButtonContent));
|
|
110
113
|
}, [type, theme, text, buttonClassName]);
|
|
111
114
|
const changeMute = (0, react_1.useCallback)((isMuted) => {
|
|
112
|
-
if (isMuted &&
|
|
115
|
+
if (isMuted &&
|
|
116
|
+
playerRef &&
|
|
117
|
+
customControlsType !== models_1.CustomControlsType.WithPlayPauseButton) {
|
|
113
118
|
playerRef.seekTo(0);
|
|
114
119
|
setPlayedPercent(0);
|
|
115
120
|
}
|
|
@@ -127,8 +132,16 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
127
132
|
}
|
|
128
133
|
// In order to the progress bar to update (equals 0) before displaying
|
|
129
134
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
130
|
-
}, [
|
|
131
|
-
|
|
135
|
+
}, [
|
|
136
|
+
playerRef,
|
|
137
|
+
customControlsType,
|
|
138
|
+
metrika,
|
|
139
|
+
videoMetrika,
|
|
140
|
+
playEvents,
|
|
141
|
+
stopEvents,
|
|
142
|
+
handleAnalytics,
|
|
143
|
+
setProps,
|
|
144
|
+
]);
|
|
132
145
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
133
146
|
setIsPlaying(true);
|
|
134
147
|
onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview();
|
|
@@ -142,12 +155,11 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
142
155
|
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
143
156
|
const onPause = (0, react_1.useCallback)(() => {
|
|
144
157
|
// For support correct state for youtube
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
setIsPlaying(true);
|
|
158
|
+
if (controls !== models_1.MediaVideoControlsType.Custom ||
|
|
159
|
+
customControlsType === models_1.CustomControlsType.WithPlayPauseButton) {
|
|
160
|
+
setIsPlaying(false);
|
|
149
161
|
}
|
|
150
|
-
}, [controls,
|
|
162
|
+
}, [controls, customControlsType]);
|
|
151
163
|
const onStart = (0, react_1.useCallback)(() => {
|
|
152
164
|
if (!autoPlay && !initiallyMuted) {
|
|
153
165
|
setMuted(false);
|
|
@@ -155,17 +167,17 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
155
167
|
}, [autoPlay, initiallyMuted]);
|
|
156
168
|
const onPlay = (0, react_1.useCallback)(() => {
|
|
157
169
|
setIsPlaying(true);
|
|
158
|
-
if (controls === models_1.MediaVideoControlsType.Custom
|
|
170
|
+
if (controls === models_1.MediaVideoControlsType.Custom &&
|
|
171
|
+
customControlsType === models_1.CustomControlsType.WithMuteButton) {
|
|
159
172
|
if (ended) {
|
|
160
173
|
changeMute(false);
|
|
161
174
|
}
|
|
162
|
-
else if (
|
|
175
|
+
else if (!isPlaying) {
|
|
163
176
|
changeMute(muted);
|
|
164
177
|
}
|
|
165
178
|
setEnded(false);
|
|
166
|
-
setPaused(false);
|
|
167
179
|
}
|
|
168
|
-
}, [changeMute, controls, ended,
|
|
180
|
+
}, [changeMute, controls, customControlsType, ended, isPlaying, muted]);
|
|
169
181
|
const onProgress = (0, react_1.useCallback)((progress) => {
|
|
170
182
|
setPlayedPercent(progress.played);
|
|
171
183
|
if (progress.played === 1) {
|
|
@@ -183,21 +195,33 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
183
195
|
}
|
|
184
196
|
setEnded(true);
|
|
185
197
|
}, [loop, playerRef]);
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
|
|
198
|
+
const onPlayClick = (0, react_1.useCallback)(() => {
|
|
199
|
+
if (isPlaying) {
|
|
200
|
+
onPause();
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
onPlay();
|
|
204
|
+
}
|
|
205
|
+
}, [isPlaying, onPlay, onPause]);
|
|
206
|
+
const handleClick = (0, react_1.useCallback)(() => {
|
|
207
|
+
if (customControlsType === models_1.CustomControlsType.WithMuteButton) {
|
|
208
|
+
changeMute(muted);
|
|
189
209
|
}
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
else {
|
|
211
|
+
onPlayClick();
|
|
212
|
+
}
|
|
213
|
+
}, [changeMute, customControlsType, muted, onPlayClick]);
|
|
214
|
+
const onFocusIn = (0, react_1.useCallback)(() => setHovered(true), []);
|
|
215
|
+
const onFocusOut = (0, react_1.useCallback)(() => setHovered(false), []);
|
|
216
|
+
return (react_1.default.createElement("div", { className: b({ wrapper: !currentHeight, controls, started, hovered }, className), ref: ref, onClick: handleClick, onMouseEnter: onFocusIn, onMouseLeave: onFocusOut, onFocus: onFocusIn, onBlur: onFocusOut }, isMounted ? (react_1.default.createElement(react_1.Fragment, null,
|
|
217
|
+
react_1.default.createElement(react_player_1.default, { className: b('player'), url: videoSrc, muted: muted, controls: controls === models_1.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 }),
|
|
218
|
+
controls === models_1.MediaVideoControlsType.Custom && started && (react_1.default.createElement(CustomBarControls_1.default, { className: b('custom-bar-controls', { muted }, customBarControlsClassName), mute: {
|
|
219
|
+
isMuted: muted,
|
|
192
220
|
changeMute: (event) => {
|
|
193
221
|
event.stopPropagation();
|
|
194
|
-
changeMute(
|
|
222
|
+
changeMute(muted);
|
|
195
223
|
},
|
|
196
|
-
}, elapsedTimePercent:
|
|
197
|
-
}, [controls, isPlaying, customBarControlsClassName, changeMute]);
|
|
198
|
-
return (react_1.default.createElement("div", { className: b({ wrapper: !currentHeight }, className), ref: ref, onClick: handleClick },
|
|
199
|
-
react_1.default.createElement(react_player_1.default, { className: b('player'), url: videoSrc, muted: muted, controls: controls === models_1.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 }),
|
|
200
|
-
renderCustomBarControls(muted, playedPercent)));
|
|
224
|
+
}, elapsedTimePercent: playedPercent, type: customControlsType, isPaused: !isPlaying, onPlayClick: onPlayClick })))) : null));
|
|
201
225
|
});
|
|
202
226
|
function getHeight(width) {
|
|
203
227
|
return (width / 16) * 9;
|
|
@@ -4,28 +4,34 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const __1 = require("../");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
function getMarkerId(index) {
|
|
8
|
+
if (isNaN(index)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return `marker-${index}`;
|
|
12
|
+
}
|
|
7
13
|
const b = (0, utils_1.block)('table');
|
|
8
14
|
class Table extends react_1.default.Component {
|
|
9
15
|
render() {
|
|
10
|
-
const { content, legend, marker = 'disk', className } = this.props;
|
|
16
|
+
const { content, legend, marker = 'disk', className, caption } = this.props;
|
|
11
17
|
if (!content || !content.length || !content[0].length) {
|
|
12
18
|
return null;
|
|
13
19
|
}
|
|
14
|
-
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
20
|
+
return (react_1.default.createElement("div", { className: b(null, className), role: 'table', "aria-label": caption },
|
|
15
21
|
this.renderTable(content, marker, legend),
|
|
16
22
|
legend && this.renderLegend(legend, marker)));
|
|
17
23
|
}
|
|
18
24
|
renderTable(content, marker, legend) {
|
|
19
25
|
const justify = this.getDefaultJustify(content, this.props.justify);
|
|
20
|
-
return (react_1.default.createElement("div", { className: b('table') }, content.map((row, i) => (react_1.default.createElement("div", { key: i, className: b('row') }, row.map((cell, j) => (react_1.default.createElement("div", { key: j, className: b('cell', { justify: justify[j] }) }, legend && i && j ? (this.renderMarker(marker, cell)) : (react_1.default.createElement(__1.HTML, null, cell))))))))));
|
|
26
|
+
return (react_1.default.createElement("div", { className: b('table'), role: 'rowgroup' }, content.map((row, i) => (react_1.default.createElement("div", { key: i, className: b('row'), role: 'row' }, row.map((cell, j) => (react_1.default.createElement("div", { key: j, className: b('cell', { justify: justify[j] }), role: 'cell' }, legend && i && j ? (this.renderMarker(marker, cell)) : (react_1.default.createElement(__1.HTML, null, cell))))))))));
|
|
21
27
|
}
|
|
22
28
|
renderMarker(type, cell) {
|
|
23
|
-
return react_1.default.createElement("div", { className: b('marker', { type, index: String(cell) }) });
|
|
29
|
+
return (react_1.default.createElement("div", { "aria-labelledby": getMarkerId(Number(cell)), className: b('marker', { type, index: String(cell) }) }));
|
|
24
30
|
}
|
|
25
31
|
renderLegend(legend, marker) {
|
|
26
32
|
return (react_1.default.createElement("div", { className: b('legend') }, legend.map((item, index) => (react_1.default.createElement("div", { key: item, className: b('legend-item') },
|
|
27
33
|
this.renderMarker(marker, String(index)),
|
|
28
|
-
react_1.default.createElement(__1.YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true } }))))));
|
|
34
|
+
react_1.default.createElement(__1.YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true }, id: getMarkerId(index) }))))));
|
|
29
35
|
}
|
|
30
36
|
getDefaultJustify(content, justify) {
|
|
31
37
|
return justify || new Array(content[0].length).fill('center');
|