@gravity-ui/page-constructor 1.15.0-alpha.9 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +5 -75
- package/build/cjs/blocks/Banner/Banner.js +2 -3
- package/build/cjs/blocks/Banner/schema.d.ts +0 -243
- package/build/cjs/blocks/Banner/schema.js +1 -3
- package/build/cjs/blocks/CardLayout/schema.d.ts +0 -6
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +2 -3
- package/build/cjs/blocks/ContentLayout/schema.d.ts +0 -3
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -3
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +0 -3
- package/build/cjs/blocks/Header/Header.js +5 -6
- package/build/cjs/blocks/Header/schema.d.ts +0 -3
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +0 -3
- package/build/cjs/blocks/Icons/schema.d.ts +0 -6
- package/build/cjs/blocks/Info/Info.js +3 -4
- package/build/cjs/blocks/Info/schema.d.ts +0 -3
- package/build/cjs/blocks/Info/schema.js +0 -2
- package/build/cjs/blocks/LinkTable/schema.d.ts +0 -3
- package/build/cjs/blocks/Media/Media.js +2 -3
- package/build/cjs/blocks/Media/MediaContent.js +2 -3
- package/build/cjs/blocks/Media/schema.d.ts +0 -81
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +1 -2
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +2 -3
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -1
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +2 -3
- package/build/cjs/blocks/Preview/Preview.js +2 -3
- package/build/cjs/blocks/Preview/schema.d.ts +0 -3
- package/build/cjs/blocks/Preview/schema.js +1 -3
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +2 -3
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +0 -3
- package/build/cjs/blocks/Questions/Questions.js +2 -3
- package/build/cjs/blocks/Questions/schema.d.ts +0 -3
- package/build/cjs/blocks/Security/Security.js +2 -3
- package/build/cjs/blocks/Security/schema.d.ts +0 -3
- package/build/cjs/blocks/Security/schema.js +1 -3
- package/build/cjs/blocks/Share/Share.d.ts +1 -1
- package/build/cjs/blocks/Share/Share.js +2 -10
- package/build/cjs/blocks/Simple/schema.d.ts +0 -3
- package/build/cjs/blocks/Slider/schema.d.ts +0 -3
- package/build/cjs/blocks/Table/schema.d.ts +0 -3
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +4 -5
- package/build/cjs/blocks/Tabs/schema.d.ts +0 -3
- package/build/cjs/components/BackLink/BackLink.d.ts +0 -1
- package/build/cjs/components/BackLink/BackLink.js +2 -11
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +1 -2
- package/build/cjs/components/Button/Button.d.ts +0 -1
- package/build/cjs/components/Button/Button.js +2 -11
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +0 -1
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +2 -11
- package/build/cjs/components/CardBase/CardBase.d.ts +0 -3
- package/build/cjs/components/CardBase/CardBase.js +1 -10
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -10
- package/build/cjs/components/Link/Link.js +2 -11
- package/build/cjs/components/Media/Media.js +5 -7
- package/build/cjs/components/Media/Video/Video.js +3 -6
- package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
- package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
- package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
- package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
- package/build/cjs/components/MetaInfo/schema.js +10 -0
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +3 -15
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
- package/build/cjs/components/YandexForm/YandexForm.d.ts +0 -3
- package/build/cjs/components/YandexForm/YandexForm.js +2 -19
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/components/index.js +5 -1
- package/build/cjs/constructor-items.d.ts +9 -5
- package/build/cjs/constructor-items.js +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/cjs/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/cjs/containers/PageConstructor/Provider.js +1 -3
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/cjs/hooks/index.d.ts +0 -1
- package/build/cjs/hooks/index.js +0 -1
- package/build/cjs/hooks/useMetrika.d.ts +0 -6
- package/build/cjs/hooks/useMetrika.js +0 -8
- package/build/cjs/models/common.d.ts +0 -34
- package/build/cjs/models/common.js +1 -10
- package/build/cjs/models/constructor-items/blocks.d.ts +0 -11
- package/build/cjs/models/constructor-items/common.d.ts +2 -27
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +16 -6
- package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -3
- package/build/cjs/schema/index.js +1 -0
- package/build/cjs/schema/validators/common.d.ts +0 -171
- package/build/cjs/schema/validators/common.js +0 -12
- package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
- package/build/cjs/schema/validators/sub-blocks.js +1 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +0 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +0 -2
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +2 -3
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +2 -3
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +2 -3
- package/build/cjs/sub-blocks/Content/Content.js +3 -4
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/cjs/sub-blocks/HubspotForm/index.js +3 -18
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -0
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -3
- package/build/cjs/sub-blocks/Quote/Quote.js +2 -9
- package/build/cjs/sub-blocks/Quote/schema.d.ts +0 -3
- package/build/cjs/sub-blocks/Quote/schema.js +1 -3
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/cjs/text-transform/blocks.js +17 -0
- package/build/cjs/utils/hubspot.d.ts +2 -1
- package/build/cjs/utils/hubspot.js +5 -1
- package/build/esm/blocks/Banner/Banner.js +2 -3
- package/build/esm/blocks/Banner/schema.d.ts +0 -243
- package/build/esm/blocks/Banner/schema.js +1 -3
- package/build/esm/blocks/CardLayout/schema.d.ts +0 -6
- package/build/esm/blocks/ContentLayout/ContentLayout.js +2 -3
- package/build/esm/blocks/ContentLayout/schema.d.ts +0 -3
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -3
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +0 -3
- package/build/esm/blocks/Header/Header.js +5 -6
- package/build/esm/blocks/Header/schema.d.ts +0 -3
- package/build/esm/blocks/HeaderSlider/schema.d.ts +0 -3
- package/build/esm/blocks/Icons/schema.d.ts +0 -6
- package/build/esm/blocks/Info/Info.js +3 -4
- package/build/esm/blocks/Info/schema.d.ts +0 -3
- package/build/esm/blocks/Info/schema.js +0 -2
- package/build/esm/blocks/LinkTable/schema.d.ts +0 -3
- package/build/esm/blocks/Media/Media.js +2 -3
- package/build/esm/blocks/Media/MediaContent.js +2 -3
- package/build/esm/blocks/Media/schema.d.ts +0 -81
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +1 -2
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +2 -3
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -1
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +2 -3
- package/build/esm/blocks/Preview/Preview.js +2 -3
- package/build/esm/blocks/Preview/schema.d.ts +0 -3
- package/build/esm/blocks/Preview/schema.js +1 -3
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +2 -3
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +0 -3
- package/build/esm/blocks/Questions/Questions.js +2 -3
- package/build/esm/blocks/Questions/schema.d.ts +0 -3
- package/build/esm/blocks/Security/Security.js +2 -3
- package/build/esm/blocks/Security/schema.d.ts +0 -3
- package/build/esm/blocks/Security/schema.js +1 -3
- package/build/esm/blocks/Share/Share.d.ts +1 -1
- package/build/esm/blocks/Share/Share.js +3 -11
- package/build/esm/blocks/Simple/schema.d.ts +0 -3
- package/build/esm/blocks/Slider/schema.d.ts +0 -3
- package/build/esm/blocks/Table/schema.d.ts +0 -3
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +4 -5
- package/build/esm/blocks/Tabs/schema.d.ts +0 -3
- package/build/esm/components/BackLink/BackLink.d.ts +0 -1
- package/build/esm/components/BackLink/BackLink.js +2 -11
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +1 -2
- package/build/esm/components/Button/Button.d.ts +0 -1
- package/build/esm/components/Button/Button.js +2 -11
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +0 -1
- package/build/esm/components/ButtonTabs/ButtonTabs.js +2 -11
- package/build/esm/components/CardBase/CardBase.d.ts +0 -3
- package/build/esm/components/CardBase/CardBase.js +1 -10
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
- package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -10
- package/build/esm/components/Link/Link.js +2 -11
- package/build/esm/components/Media/Media.js +5 -7
- package/build/esm/components/Media/Video/Video.js +3 -6
- package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
- package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
- package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
- package/build/esm/components/MetaInfo/schema.d.ts +8 -0
- package/build/esm/components/MetaInfo/schema.js +8 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.js +4 -16
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
- package/build/esm/components/YandexForm/YandexForm.d.ts +0 -3
- package/build/esm/components/YandexForm/YandexForm.js +2 -19
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/components/index.js +2 -0
- package/build/esm/constructor-items.d.ts +9 -5
- package/build/esm/constructor-items.js +5 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/esm/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/esm/containers/PageConstructor/Provider.js +1 -3
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/esm/hooks/index.d.ts +0 -1
- package/build/esm/hooks/index.js +0 -1
- package/build/esm/hooks/useMetrika.d.ts +0 -6
- package/build/esm/hooks/useMetrika.js +0 -8
- package/build/esm/models/common.d.ts +0 -34
- package/build/esm/models/common.js +0 -9
- package/build/esm/models/constructor-items/blocks.d.ts +0 -11
- package/build/esm/models/constructor-items/common.d.ts +2 -27
- package/build/esm/models/constructor-items/sub-blocks.d.ts +16 -6
- package/build/esm/models/constructor-items/sub-blocks.js +4 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +2 -3
- package/build/esm/schema/index.js +1 -0
- package/build/esm/schema/validators/common.d.ts +0 -171
- package/build/esm/schema/validators/common.js +0 -12
- package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
- package/build/esm/schema/validators/sub-blocks.js +1 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +0 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.js +0 -2
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +2 -3
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +2 -3
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +2 -3
- package/build/esm/sub-blocks/Content/Content.js +3 -4
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/esm/sub-blocks/HubspotForm/index.js +4 -19
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/esm/sub-blocks/LayoutItem/utils.js +6 -0
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -3
- package/build/esm/sub-blocks/Quote/Quote.js +4 -11
- package/build/esm/sub-blocks/Quote/schema.d.ts +0 -3
- package/build/esm/sub-blocks/Quote/schema.js +1 -3
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/build/esm/text-transform/blocks.js +17 -0
- package/build/esm/utils/hubspot.d.ts +2 -1
- package/build/esm/utils/hubspot.js +5 -1
- package/package.json +4 -5
- package/server/models/common.d.ts +0 -34
- package/server/models/common.js +1 -10
- package/server/models/constructor-items/blocks.d.ts +0 -11
- package/server/models/constructor-items/common.d.ts +2 -27
- package/server/models/constructor-items/sub-blocks.d.ts +16 -6
- package/server/models/constructor-items/sub-blocks.js +4 -0
- package/server/text-transform/blocks.js +17 -0
- package/server/utils/hubspot.d.ts +2 -1
- package/server/utils/hubspot.js +5 -1
- package/styles/root.scss +1 -0
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/cjs/context/analyticsContext/analyticsContext.js +0 -6
- package/build/cjs/context/analyticsContext/index.d.ts +0 -1
- package/build/cjs/context/analyticsContext/index.js +0 -4
- package/build/cjs/hooks/useAnalytics.d.ts +0 -2
- package/build/cjs/hooks/useAnalytics.js +0 -23
- package/build/cjs/schema/validators/event.d.ts +0 -37
- package/build/cjs/schema/validators/event.js +0 -38
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/esm/context/analyticsContext/analyticsContext.js +0 -2
- package/build/esm/context/analyticsContext/index.d.ts +0 -1
- package/build/esm/context/analyticsContext/index.js +0 -1
- package/build/esm/hooks/useAnalytics.d.ts +0 -2
- package/build/esm/hooks/useAnalytics.js +0 -19
- package/build/esm/schema/validators/event.d.ts +0 -37
- package/build/esm/schema/validators/event.js +0 -35
|
@@ -4,31 +4,22 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const models_1 = require("../../models");
|
|
8
7
|
const utils_2 = require("./utils");
|
|
9
8
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
10
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
11
|
-
const hooks_1 = require("../../hooks");
|
|
12
10
|
const icons_1 = require("../../icons");
|
|
13
|
-
const COMPONENT_NAME = 'button';
|
|
14
11
|
const b = (0, utils_1.block)('button-block');
|
|
15
12
|
const Button = (props) => {
|
|
16
13
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
17
14
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
18
|
-
const { className, metrikaGoals, pixelEvents,
|
|
15
|
+
const { className, metrikaGoals, pixelEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
19
16
|
const defaultImgPosition = 'left';
|
|
20
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
21
|
-
name: 'button-click',
|
|
22
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
23
|
-
blockName: blockName,
|
|
24
|
-
});
|
|
25
17
|
const onClick = (0, react_1.useCallback)(() => {
|
|
26
18
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
27
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
28
19
|
if (onClickOrigin) {
|
|
29
20
|
onClickOrigin();
|
|
30
21
|
}
|
|
31
|
-
}, [handleMetrika, metrikaGoals, pixelEvents,
|
|
22
|
+
}, [handleMetrika, metrikaGoals, pixelEvents, onClickOrigin]);
|
|
32
23
|
const buttonImg = img instanceof Object
|
|
33
24
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
34
25
|
: { url: img, position: defaultImgPosition };
|
|
@@ -3,18 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const models_1 = require("../../models");
|
|
7
6
|
const index_1 = require("../index");
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
9
7
|
const b = (0, utils_1.block)('button-tabs');
|
|
10
|
-
const COMPONENT_NAME = 'button-tabs';
|
|
11
8
|
const ButtonTabs = (props) => {
|
|
12
|
-
const { className, items, activeTab, onSelectTab
|
|
13
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
14
|
-
name: 'button-tabs-click',
|
|
15
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
16
|
-
blockName: blockName,
|
|
17
|
-
});
|
|
9
|
+
const { className, items, activeTab, onSelectTab } = props;
|
|
18
10
|
const activeTabId = (0, react_1.useMemo)(() => {
|
|
19
11
|
if (activeTab) {
|
|
20
12
|
return activeTab;
|
|
@@ -22,11 +14,10 @@ const ButtonTabs = (props) => {
|
|
|
22
14
|
return items[0].id;
|
|
23
15
|
}, [activeTab, items]);
|
|
24
16
|
const handleClick = (0, react_1.useCallback)((tabId) => {
|
|
25
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics();
|
|
26
17
|
if (onSelectTab) {
|
|
27
18
|
onSelectTab(tabId);
|
|
28
19
|
}
|
|
29
|
-
}, [
|
|
20
|
+
}, [onSelectTab]);
|
|
30
21
|
return (react_1.default.createElement("div", { className: b(null, className) }, items.map((item) => {
|
|
31
22
|
const isActive = item.id === activeTabId;
|
|
32
23
|
return (react_1.default.createElement(index_1.Button, { text: item.title, className: b('item', { active: isActive }), key: item.title, size: 'l', onClick: () => handleClick(item.id), theme: isActive ? 'monochrome' : 'normal' }));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
|
|
2
2
|
import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
|
|
3
|
-
import { AnalyticsEvent } from '../../models/common';
|
|
4
3
|
export interface CardBaseProps extends CardBaseParams {
|
|
5
4
|
className?: string;
|
|
6
5
|
bodyClassName?: string;
|
|
@@ -10,8 +9,6 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
10
9
|
target?: HTMLAttributeAnchorTarget;
|
|
11
10
|
metrikaGoals?: MetrikaGoal;
|
|
12
11
|
pixelEvents?: ButtonPixel;
|
|
13
|
-
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
14
|
-
blockName?: string;
|
|
15
12
|
}
|
|
16
13
|
export interface CardHeaderBaseProps {
|
|
17
14
|
className?: string;
|
|
@@ -7,21 +7,13 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
|
|
8
8
|
const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
|
|
9
9
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
10
|
-
const common_1 = require("../../models/common");
|
|
11
|
-
const hooks_1 = require("../../hooks");
|
|
12
|
-
const COMPONENT_NAME = 'card-base';
|
|
13
10
|
const b = (0, utils_1.block)('card-base-block');
|
|
14
11
|
const Header = () => null;
|
|
15
12
|
const Content = () => null;
|
|
16
13
|
const Footer = () => null;
|
|
17
14
|
const Layout = (props) => {
|
|
18
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents,
|
|
15
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
19
16
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
20
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
21
|
-
name: 'card-base-click',
|
|
22
|
-
type: common_1.PredefinedEventTypes.Default,
|
|
23
|
-
blockName: blockName,
|
|
24
|
-
});
|
|
25
17
|
let header, content, footer, image, headerClass, footerClass;
|
|
26
18
|
function handleChild(child) {
|
|
27
19
|
switch (child.type) {
|
|
@@ -54,7 +46,6 @@ const Layout = (props) => {
|
|
|
54
46
|
const fullClassName = b({ border }, className);
|
|
55
47
|
const onClick = () => {
|
|
56
48
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
57
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
58
49
|
};
|
|
59
50
|
return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
|
|
60
51
|
react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -7,23 +7,25 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
8
8
|
const icons_1 = require("../../icons");
|
|
9
9
|
const b = (0, utils_1.block)('FullScreenImage');
|
|
10
|
+
const FULL_SCREEN_ICON_SIZE = 18;
|
|
11
|
+
const CLOSE_ICON_SIZE = 30;
|
|
10
12
|
const FullScreenImage = (props) => {
|
|
11
13
|
const { imageClassName, modalImageClass, imageStyle } = props;
|
|
12
14
|
const [isOpened, setIsOpened] = (0, react_1.useState)(false);
|
|
13
15
|
const [isMouseEnter, setIsMouseEnter] = (0, react_1.useState)(false);
|
|
14
|
-
const openModal = (
|
|
15
|
-
const closeModal = (
|
|
16
|
-
const showFullScreenIcon = (
|
|
17
|
-
const hideFullScreenIcon = (
|
|
16
|
+
const openModal = () => setIsOpened(true);
|
|
17
|
+
const closeModal = () => setIsOpened(false);
|
|
18
|
+
const showFullScreenIcon = () => setIsMouseEnter(true);
|
|
19
|
+
const hideFullScreenIcon = () => setIsMouseEnter(false);
|
|
18
20
|
return (react_1.default.createElement("div", { className: b() },
|
|
19
21
|
react_1.default.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
|
|
20
22
|
react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
|
|
21
23
|
react_1.default.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
|
|
22
|
-
react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width:
|
|
24
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
|
|
23
25
|
isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
24
26
|
react_1.default.createElement("div", { className: b('modal-content') },
|
|
25
27
|
react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
26
|
-
react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width:
|
|
28
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
27
29
|
react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
|
|
28
30
|
};
|
|
29
31
|
exports.default = FullScreenImage;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-full-screen-media__modal-media_type_youtube, .pc-full-screen-media__modal-media_type_video video, .pc-full-screen-media__modal-media_type_image {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
max-width: 1232px;
|
|
8
|
+
max-height: 70vh;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pc-full-screen-media__media {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
.pc-full-screen-media__media-wrapper {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
.pc-full-screen-media__modal-content {
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
.pc-full-screen-media__inline-media {
|
|
22
|
+
transform: translateZ(0);
|
|
23
|
+
}
|
|
24
|
+
.pc-full-screen-media__modal-media {
|
|
25
|
+
border-radius: var(--pc-border-radius);
|
|
26
|
+
}
|
|
27
|
+
.pc-full-screen-media__modal-media_type_youtube {
|
|
28
|
+
width: 70vw;
|
|
29
|
+
height: calc(70vw * 9 / 16);
|
|
30
|
+
}
|
|
31
|
+
.pc-full-screen-media__modal .yc-modal__content, .pc-full-screen-media__modal-image {
|
|
32
|
+
border-radius: var(--pc-border-radius);
|
|
33
|
+
}
|
|
34
|
+
.pc-full-screen-media__icon-wrapper {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: 16px;
|
|
40
|
+
top: 16px;
|
|
41
|
+
width: 36px;
|
|
42
|
+
height: 36px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
background-color: var(--yc-color-base-simple-hover-solid);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
z-index: 10;
|
|
47
|
+
}
|
|
48
|
+
.pc-full-screen-media__modal-content .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper .pc-full-screen-media__icon-wrapper {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transition: opacity 0.3s;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
.pc-full-screen-media__modal-content:hover .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper:hover .pc-full-screen-media__icon-wrapper {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
pointer-events: inherit;
|
|
56
|
+
}
|
|
57
|
+
.pc-full-screen-media__icon {
|
|
58
|
+
color: var(--yc-color-text-hint);
|
|
59
|
+
}
|
|
60
|
+
.pc-full-screen-media__icon_hover:hover {
|
|
61
|
+
color: var(--yc-color-text-secondary);
|
|
62
|
+
}
|
|
63
|
+
@media (max-width: 577px) {
|
|
64
|
+
.pc-full-screen-media__icon-wrapper {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
.pc-full-screen-media__modal {
|
|
68
|
+
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MediaAllProps } from '../Media/Media';
|
|
3
|
+
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
4
|
+
export interface FullScreenMediaProps {
|
|
5
|
+
showFullScreenIcon?: boolean;
|
|
6
|
+
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
7
|
+
}
|
|
8
|
+
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
9
|
+
export default FullScreenMedia;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const icons_1 = require("../../icons");
|
|
8
|
+
const mobileContext_1 = require("../../context/mobileContext");
|
|
9
|
+
const b = (0, utils_1.block)('full-screen-media');
|
|
10
|
+
const FULL_SCREEN_ICON_SIZE = 18;
|
|
11
|
+
const CLOSE_ICON_SIZE = 30;
|
|
12
|
+
const getMediaClass = (type) => b('modal-media', { type });
|
|
13
|
+
const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
14
|
+
const [isOpened, setIsOpened] = (0, react_1.useState)(false);
|
|
15
|
+
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
16
|
+
const openModal = (e) => {
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
setIsOpened(true);
|
|
19
|
+
};
|
|
20
|
+
const closeModal = () => setIsOpened(false);
|
|
21
|
+
if (isMobile) {
|
|
22
|
+
return children();
|
|
23
|
+
}
|
|
24
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
25
|
+
react_1.default.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
26
|
+
children({ className: b('inline-media') }),
|
|
27
|
+
showFullScreenIcon && (react_1.default.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
28
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
|
|
29
|
+
isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
30
|
+
react_1.default.createElement("div", { className: b('modal-content') },
|
|
31
|
+
react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
32
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
33
|
+
children({
|
|
34
|
+
imageClassName: getMediaClass('image'),
|
|
35
|
+
videoClassName: getMediaClass('video'),
|
|
36
|
+
youtubeClassName: getMediaClass('youtube'),
|
|
37
|
+
fullScreen: true,
|
|
38
|
+
}))))));
|
|
39
|
+
};
|
|
40
|
+
exports.default = FullScreenMedia;
|
|
@@ -3,22 +3,13 @@ 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 models_1 = require("../../models");
|
|
7
6
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
9
7
|
const b = (0, utils_1.block)('header-breadcrumbs');
|
|
10
|
-
const COMPONENT_NAME = 'header-breadcrumbs';
|
|
11
8
|
function HeaderBreadcrumbs(props) {
|
|
12
|
-
const { items, metrikaGoals, pixelEvents,
|
|
9
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
|
|
13
10
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
14
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
15
|
-
name: 'header-breadcrumbs-click',
|
|
16
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
17
|
-
blockName: blockName,
|
|
18
|
-
});
|
|
19
11
|
const onClick = () => {
|
|
20
12
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
21
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
22
13
|
};
|
|
23
14
|
return (react_1.default.createElement("div", { className: b({ theme }, className) }, items.map((item) => (react_1.default.createElement("div", { className: b('item'), key: item.url },
|
|
24
15
|
react_1.default.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -4,17 +4,14 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const models_1 = require("../../models");
|
|
8
7
|
const icons_1 = require("../../icons");
|
|
9
8
|
const FileLink_1 = tslib_1.__importDefault(require("../FileLink/FileLink"));
|
|
10
9
|
const BackLink_1 = tslib_1.__importDefault(require("../BackLink/BackLink"));
|
|
11
10
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
12
11
|
const locationContext_1 = require("../../context/locationContext/locationContext");
|
|
13
12
|
const useMetrika_1 = require("../../hooks/useMetrika");
|
|
14
|
-
const hooks_1 = require("../../hooks");
|
|
15
13
|
const b = (0, utils_1.block)('link-block');
|
|
16
14
|
const WORD_JOINER_SYM = '\u200b';
|
|
17
|
-
const COMPONENT_NAME = 'link';
|
|
18
15
|
function getArrowSize(size) {
|
|
19
16
|
switch (size) {
|
|
20
17
|
case 'l':
|
|
@@ -28,25 +25,19 @@ function getArrowSize(size) {
|
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
const LinkBlock = (props) => {
|
|
31
|
-
const { text, url, arrow, metrikaGoals, pixelEvents,
|
|
28
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
32
29
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
33
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
34
|
-
name: 'link-click',
|
|
35
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
36
|
-
blockName: blockName,
|
|
37
|
-
});
|
|
38
30
|
const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
39
31
|
const { tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
40
32
|
const href = (0, utils_1.setUrlTld)(props.url, tld);
|
|
41
33
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
42
34
|
const onClick = () => {
|
|
43
35
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
44
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
45
36
|
};
|
|
46
37
|
const getLinkByType = () => {
|
|
47
38
|
switch (theme) {
|
|
48
39
|
case 'back':
|
|
49
|
-
return
|
|
40
|
+
return react_1.default.createElement(BackLink_1.default, { title: children || text, url: href, onClick: onClick });
|
|
50
41
|
case 'file-link':
|
|
51
42
|
case 'underline':
|
|
52
43
|
return (react_1.default.createElement(FileLink_1.default, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick }));
|
|
@@ -9,10 +9,9 @@ const DataLens_1 = tslib_1.__importDefault(require("./DataLens/DataLens"));
|
|
|
9
9
|
const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
|
|
10
10
|
const VideoBlock_1 = tslib_1.__importDefault(require("../VideoBlock/VideoBlock"));
|
|
11
11
|
const b = (0, utils_1.block)('Media');
|
|
12
|
-
const COMPONENT_NAME = 'media-component';
|
|
13
12
|
const Media = (props) => {
|
|
14
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika,
|
|
15
|
-
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName,
|
|
13
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, } = props;
|
|
14
|
+
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
16
15
|
const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
|
|
17
16
|
const content = (0, react_1.useMemo)(() => {
|
|
18
17
|
let result = [];
|
|
@@ -20,10 +19,10 @@ const Media = (props) => {
|
|
|
20
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 }));
|
|
21
20
|
}
|
|
22
21
|
if (video) {
|
|
23
|
-
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika,
|
|
22
|
+
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
24
23
|
}
|
|
25
24
|
if (youtube) {
|
|
26
|
-
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
25
|
+
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullScreen: fullScreen }));
|
|
27
26
|
}
|
|
28
27
|
if (dataLens) {
|
|
29
28
|
result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
|
|
@@ -41,13 +40,12 @@ const Media = (props) => {
|
|
|
41
40
|
hasVideoFallback,
|
|
42
41
|
videoClassName,
|
|
43
42
|
metrika,
|
|
44
|
-
analyticsEvents,
|
|
45
43
|
playVideo,
|
|
46
44
|
previewImg,
|
|
47
45
|
playButton,
|
|
48
46
|
customBarControlsClassName,
|
|
49
|
-
blockName,
|
|
50
47
|
youtubeClassName,
|
|
48
|
+
fullScreen,
|
|
51
49
|
]);
|
|
52
50
|
return (react_1.default.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
53
51
|
};
|
|
@@ -7,9 +7,8 @@ const ReactPlayer_1 = tslib_1.__importDefault(require("../../ReactPlayer/ReactPl
|
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
const utils_2 = require("../../../utils");
|
|
9
9
|
const b = (0, utils_2.block)('media-component-video');
|
|
10
|
-
const COMPONENT_NAME = 'media-video';
|
|
11
10
|
const Video = (props) => {
|
|
12
|
-
const { video, height, metrika,
|
|
11
|
+
const { video, height, metrika, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
13
12
|
const ref = (0, react_1.useRef)(null);
|
|
14
13
|
(0, react_1.useEffect)(() => {
|
|
15
14
|
if (ref && ref.current) {
|
|
@@ -32,18 +31,16 @@ const Video = (props) => {
|
|
|
32
31
|
}, [playVideo, video, setHasVideoFallback]);
|
|
33
32
|
const reactPlayerBlock = (0, react_1.useMemo)(() => {
|
|
34
33
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = 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,
|
|
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, height: height }));
|
|
36
35
|
}, [
|
|
37
36
|
video,
|
|
37
|
+
height,
|
|
38
38
|
videoClassName,
|
|
39
39
|
previewImg,
|
|
40
40
|
playVideo,
|
|
41
41
|
commonPlayButton,
|
|
42
42
|
customBarControlsClassName,
|
|
43
43
|
metrika,
|
|
44
|
-
analyticsEvents,
|
|
45
|
-
height,
|
|
46
|
-
blockName,
|
|
47
44
|
]);
|
|
48
45
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
49
46
|
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-meta-info {
|
|
4
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
5
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
font-weight: 500;
|
|
9
|
+
color: var(--pc-media-card-meta-info-color);
|
|
10
|
+
}
|
|
11
|
+
.pc-meta-info__item:not(:first-child) {
|
|
12
|
+
margin-left: 16px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const b = (0, utils_1.block)('meta-info');
|
|
7
|
+
const MetaInfo = ({ items, className }) => (react_1.default.createElement("div", { className: b(null, className) }, items.map((metaInfoItem) => (react_1.default.createElement("div", { key: metaInfoItem, className: b('item') }, metaInfoItem)))));
|
|
8
|
+
exports.default = MetaInfo;
|
|
@@ -13,15 +13,13 @@ const videoContext_1 = require("../../context/videoContext");
|
|
|
13
13
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
14
14
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
15
15
|
const icons_1 = require("../../icons");
|
|
16
|
-
const hooks_1 = require("../../hooks");
|
|
17
16
|
const b = (0, utils_1.block)('ReactPlayer');
|
|
18
17
|
const FPS = 60;
|
|
19
|
-
const COMPONENT_NAME = 'react-player';
|
|
20
18
|
// eslint-disable-next-line react/display-name
|
|
21
19
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
22
20
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
23
21
|
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
24
|
-
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika,
|
|
22
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
25
23
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
26
24
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
27
25
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -36,11 +34,6 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
36
34
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
37
35
|
const [paused, setPaused] = (0, react_1.useState)(false);
|
|
38
36
|
const [ended, setEnded] = (0, react_1.useState)(false);
|
|
39
|
-
const handleAnalytics = (0, hooks_1.useAnalytics)({
|
|
40
|
-
name: 'react-player-controls-click',
|
|
41
|
-
type: models_1.PredefinedEventTypes.Default,
|
|
42
|
-
blockName: blockName,
|
|
43
|
-
});
|
|
44
37
|
(0, react_1.useImperativeHandle)(originRef, () => ({
|
|
45
38
|
pause: () => setIsPlaying(false),
|
|
46
39
|
}));
|
|
@@ -89,8 +82,6 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
89
82
|
window.removeEventListener('resize', updateSize);
|
|
90
83
|
};
|
|
91
84
|
}, []);
|
|
92
|
-
const playEvents = (0, react_1.useMemo)(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === models_1.PredefinedEventTypes.Play), [analyticsEvents]);
|
|
93
|
-
const stopEvents = (0, react_1.useMemo)(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === models_1.PredefinedEventTypes.Stop), [analyticsEvents]);
|
|
94
85
|
const playIcon = (0, react_1.useMemo)(() => {
|
|
95
86
|
let playButtonContent;
|
|
96
87
|
switch (type) {
|
|
@@ -116,14 +107,12 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
116
107
|
metrika.reachGoals(goal, counterName);
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
|
-
const events = isMuted ? playEvents : stopEvents;
|
|
120
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(events);
|
|
121
110
|
if (isMuted) {
|
|
122
111
|
setProps({ playingVideoRef: ref.current });
|
|
123
112
|
}
|
|
124
113
|
// In order to the progress bar to update (equals 0) before displaying
|
|
125
114
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
126
|
-
}, [playerRef,
|
|
115
|
+
}, [playerRef, setProps, videoMetrika, metrika]);
|
|
127
116
|
const handleClick = (0, react_1.useCallback)(() => changeMute(muted), [changeMute, muted]);
|
|
128
117
|
const handleClickPreview = (0, react_1.useCallback)(() => {
|
|
129
118
|
setIsPlaying(true);
|
|
@@ -134,8 +123,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
134
123
|
metrika.reachGoals(play, counterName);
|
|
135
124
|
}
|
|
136
125
|
}
|
|
137
|
-
|
|
138
|
-
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
126
|
+
}, [onClickPreview, setIsPlaying, videoMetrika, metrika]);
|
|
139
127
|
const onPause = (0, react_1.useCallback)(() => {
|
|
140
128
|
// For support correct state for youtube
|
|
141
129
|
setIsPlaying(false);
|
|
@@ -4,6 +4,7 @@ exports.getHeight = exports.AUTOPLAY_ATTRIBUTES = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
7
8
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
@@ -18,7 +19,6 @@ exports.AUTOPLAY_ATTRIBUTES = {
|
|
|
18
19
|
mute: 1,
|
|
19
20
|
};
|
|
20
21
|
const b = (0, utils_1.block)('VideoBlock');
|
|
21
|
-
const iframeId = 'video-block';
|
|
22
22
|
function getVideoSrc(stream, record) {
|
|
23
23
|
if (!stream && !record) {
|
|
24
24
|
return null;
|
|
@@ -38,14 +38,14 @@ function getHeight(width) {
|
|
|
38
38
|
}
|
|
39
39
|
exports.getHeight = getHeight;
|
|
40
40
|
const VideoBlock = (props) => {
|
|
41
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height } = props;
|
|
41
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
|
|
42
42
|
const src = getVideoSrc(stream, record);
|
|
43
43
|
const ref = (0, react_1.useRef)(null);
|
|
44
44
|
const iframeRef = (0, react_1.useRef)();
|
|
45
45
|
const [hidePreview, setHidePreview] = (0, react_1.useState)(false);
|
|
46
46
|
const norender = (!stream && !record) || !src;
|
|
47
47
|
const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height || undefined);
|
|
48
|
-
const fullId =
|
|
48
|
+
const fullId = id || (0, uuid_1.v4)();
|
|
49
49
|
const onPreviewClick = (0, react_1.useCallback)(() => {
|
|
50
50
|
if (iframeRef.current) {
|
|
51
51
|
iframeRef.current.src = `${src}?${(0, utils_1.getPageSearchParams)(Object.assign(Object.assign({}, exports.AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
|
|
@@ -66,12 +66,8 @@ const VideoBlock = (props) => {
|
|
|
66
66
|
if (norender) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const prevPageVideo = document.getElementById(fullId);
|
|
70
69
|
const fullSrc = `${src}?${(0, utils_1.getPageSearchParams)(attributes || {})}`;
|
|
71
|
-
if (
|
|
72
|
-
prevPageVideo.src = fullSrc;
|
|
73
|
-
}
|
|
74
|
-
else if (ref.current) {
|
|
70
|
+
if (ref.current && !iframeRef.current) {
|
|
75
71
|
const iframe = document.createElement('iframe');
|
|
76
72
|
iframe.id = fullId;
|
|
77
73
|
iframe.src = fullSrc;
|
|
@@ -83,14 +79,14 @@ const VideoBlock = (props) => {
|
|
|
83
79
|
ref.current.appendChild(iframe);
|
|
84
80
|
iframeRef.current = iframe;
|
|
85
81
|
}
|
|
86
|
-
}, [stream, record, norender, src, fullId, attributes, iframeRef]);
|
|
82
|
+
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
|
|
87
83
|
(0, react_1.useEffect)(() => {
|
|
88
84
|
setHidePreview(false);
|
|
89
85
|
}, [src, setHidePreview]);
|
|
90
86
|
if (norender) {
|
|
91
87
|
return null;
|
|
92
88
|
}
|
|
93
|
-
return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
89
|
+
return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
94
90
|
react_1.default.createElement(Image_1.default, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
95
91
|
playButton || (react_1.default.createElement("button", { className: b('button') },
|
|
96
92
|
react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.PlayVideo, size: 24 })))))));
|