@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
|
@@ -4,32 +4,64 @@ unpredictable css rules order in build */
|
|
|
4
4
|
position: absolute;
|
|
5
5
|
bottom: 0;
|
|
6
6
|
}
|
|
7
|
+
.pc-CustomBarControls__wrapper_type_with-play-pause-button {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 20px;
|
|
12
|
+
}
|
|
7
13
|
.pc-CustomBarControls__button {
|
|
8
|
-
|
|
14
|
+
border: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
.pc-CustomBarControls__button_type_with-play-pause-button {
|
|
19
|
+
opacity: 0.9;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
transition: opacity 300ms ease 3s;
|
|
22
|
+
}
|
|
23
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:hover, .pc-CustomBarControls__button_type_with-play-pause-button:focus {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:focus {
|
|
27
|
+
outline: 1px solid var(--g-color-line-light);
|
|
28
|
+
outline-offset: 2px;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
}
|
|
31
|
+
.pc-CustomBarControls__button_type_with-play-pause-button:focus:not(:focus-visible) {
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
.pc-CustomBarControls__button_type_with-mute-button {
|
|
9
35
|
border-radius: 50%;
|
|
10
36
|
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
11
39
|
cursor: pointer;
|
|
12
40
|
position: relative;
|
|
13
41
|
width: 64px;
|
|
14
42
|
height: 64px;
|
|
15
43
|
background: var(--g-color-base-background);
|
|
16
44
|
transition: background-color 300ms;
|
|
45
|
+
margin: 12px;
|
|
17
46
|
}
|
|
18
|
-
.pc-
|
|
47
|
+
.pc-CustomBarControls__button_type_with-mute-button:hover, .pc-CustomBarControls__button_type_with-mute-button:focus {
|
|
19
48
|
background: #eff2f8;
|
|
20
49
|
}
|
|
21
|
-
.pc-
|
|
22
|
-
|
|
50
|
+
.pc-CustomBarControls__button_type_with-mute-button:focus {
|
|
51
|
+
outline: 2px solid var(--g-color-line-misc);
|
|
23
52
|
}
|
|
24
|
-
.pc-
|
|
25
|
-
|
|
53
|
+
.pc-CustomBarControls__button_type_with-mute-button:focus:not(:focus-visible) {
|
|
54
|
+
outline: none;
|
|
55
|
+
}
|
|
56
|
+
.pc-CustomBarControls__play-icon {
|
|
57
|
+
height: 24px;
|
|
58
|
+
width: 24px;
|
|
59
|
+
}
|
|
60
|
+
.pc-CustomBarControls__mute-icon_type_with-mute-button {
|
|
26
61
|
height: 22px;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
.pc-CustomBarControls__mute-button_muted {
|
|
34
|
-
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTcgNyA3LTdoMnYyMmgtMmwtNy03SDBWN2g3eiIgZmlsbD0iIzI2MjYyNiIvPgogICAgPHBhdGggZD0ibTIwIDcgNCA0bTAgMC00IDRtNC00IDQtNG0tNCA0IDQgNCIgc3Ryb2tlPSIjMjYyNjI2IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==");
|
|
62
|
+
width: 32px;
|
|
63
|
+
}
|
|
64
|
+
.pc-CustomBarControls__mute-icon_type_with-play-pause-button {
|
|
65
|
+
height: 24px;
|
|
66
|
+
width: 24px;
|
|
35
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ClassNameProps } from '../../models';
|
|
2
|
+
import { ClassNameProps, CustomControlsType } from '../../models';
|
|
3
3
|
import './CustomBarControls.css';
|
|
4
4
|
interface MuteConfigProps {
|
|
5
5
|
isMuted: boolean;
|
|
@@ -8,6 +8,9 @@ interface MuteConfigProps {
|
|
|
8
8
|
export interface CustomBarControlsProps extends ClassNameProps {
|
|
9
9
|
mute?: MuteConfigProps;
|
|
10
10
|
elapsedTimePercent?: number;
|
|
11
|
+
type?: CustomControlsType;
|
|
12
|
+
isPaused?: boolean;
|
|
13
|
+
onPlayClick?: () => void;
|
|
11
14
|
}
|
|
12
15
|
declare const CustomBarControls: (props: CustomBarControlsProps) => JSX.Element;
|
|
13
16
|
export default CustomBarControls;
|
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
3
|
+
import { Mute } from '../../icons/Mute';
|
|
4
|
+
import { MuteSmall } from '../../icons/MuteSmall';
|
|
5
|
+
import { Unmute } from '../../icons/Unmute';
|
|
6
|
+
import { UnmuteSmall } from '../../icons/UnmuteSmall';
|
|
7
|
+
import { VideoControlPause } from '../../icons/VideoControlPause';
|
|
8
|
+
import { VideoControlPlay } from '../../icons/VideoControlPlay';
|
|
9
|
+
import { CustomControlsType } from '../../models';
|
|
2
10
|
import { block } from '../../utils';
|
|
3
11
|
import CircleProgress from './CircleProgress';
|
|
12
|
+
import i18n from './i18n';
|
|
4
13
|
import './CustomBarControls.css';
|
|
5
14
|
const b = block('CustomBarControls');
|
|
6
15
|
const CustomBarControls = (props) => {
|
|
7
|
-
const { mute, elapsedTimePercent = 0, className } = props;
|
|
8
|
-
const
|
|
9
|
-
|
|
16
|
+
const { mute, elapsedTimePercent = 0, className, type = CustomControlsType.WithMuteButton, isPaused, onPlayClick, } = props;
|
|
17
|
+
const muteIcon = useMemo(() => {
|
|
18
|
+
return type === CustomControlsType.WithMuteButton ? Mute : MuteSmall;
|
|
19
|
+
}, [type]);
|
|
20
|
+
const unmuteIcon = useMemo(() => {
|
|
21
|
+
return type === CustomControlsType.WithMuteButton ? Unmute : UnmuteSmall;
|
|
22
|
+
}, [type]);
|
|
23
|
+
const muteButton = useMemo(() => {
|
|
24
|
+
if (!mute) {
|
|
10
25
|
return null;
|
|
11
26
|
}
|
|
12
|
-
const { isMuted, changeMute } =
|
|
13
|
-
return (React.createElement("
|
|
14
|
-
React.createElement(
|
|
15
|
-
!isMuted && React.createElement(CircleProgress, { elapsedTime:
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
27
|
+
const { isMuted, changeMute } = mute;
|
|
28
|
+
return (React.createElement("button", { className: b('button', { type }), onClick: changeMute, "aria-label": i18n(isMuted ? 'unmute' : 'mute') },
|
|
29
|
+
React.createElement(Icon, { data: isMuted ? unmuteIcon : muteIcon, className: b('mute-icon', { type }) }),
|
|
30
|
+
type === CustomControlsType.WithMuteButton && !isMuted && (React.createElement(CircleProgress, { elapsedTime: elapsedTimePercent, strokeWidth: 5 }))));
|
|
31
|
+
}, [elapsedTimePercent, mute, muteIcon, type, unmuteIcon]);
|
|
32
|
+
const playPauseButton = useMemo(() => {
|
|
33
|
+
if (type !== CustomControlsType.WithPlayPauseButton) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (React.createElement("button", { onClick: onPlayClick, className: b('button', { type }), "aria-label": i18n(isPaused ? 'play' : 'pause') },
|
|
37
|
+
React.createElement(Icon, { data: isPaused ? VideoControlPlay : VideoControlPause, className: b('play-icon') })));
|
|
38
|
+
}, [isPaused, onPlayClick, type]);
|
|
39
|
+
return (React.createElement("div", { className: b('wrapper', { type }, className) },
|
|
40
|
+
playPauseButton,
|
|
41
|
+
muteButton));
|
|
18
42
|
};
|
|
19
43
|
export default CustomBarControls;
|
|
@@ -50,6 +50,18 @@ unpredictable css rules order in build */
|
|
|
50
50
|
opacity: 1;
|
|
51
51
|
transition: opacity 300ms ease 0s;
|
|
52
52
|
}
|
|
53
|
+
.pc-ReactPlayer_started.pc-ReactPlayer_controls_custom.pc-ReactPlayer_hovered::before {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
.pc-ReactPlayer_started.pc-ReactPlayer_controls_custom::before {
|
|
57
|
+
position: absolute;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
content: "";
|
|
61
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 65.36%, rgba(0, 0, 0, 0.2) 100%);
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: opacity 300ms;
|
|
64
|
+
}
|
|
53
65
|
.pc-ReactPlayer__custom-bar-controls {
|
|
54
66
|
opacity: 0;
|
|
55
67
|
transition: opacity 300ms ease 3s;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
1
|
+
import React, { Fragment, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import ReactPlayer from 'react-player';
|
|
5
5
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import { VideoContext } from '../../context/videoContext';
|
|
8
|
-
import { useAnalytics } from '../../hooks';
|
|
8
|
+
import { useAnalytics, useMount } from '../../hooks';
|
|
9
9
|
import { PlayVideo } from '../../icons';
|
|
10
|
-
import { DefaultEventNames, MediaVideoControlsType, PlayButtonThemes, PlayButtonType, PredefinedEventTypes, } from '../../models';
|
|
10
|
+
import { CustomControlsType, DefaultEventNames, MediaVideoControlsType, PlayButtonThemes, PlayButtonType, PredefinedEventTypes, } from '../../models';
|
|
11
11
|
import { block } from '../../utils';
|
|
12
12
|
import CustomBarControls from './CustomBarControls';
|
|
13
13
|
import i18n from './i18n';
|
|
@@ -19,8 +19,9 @@ const FPS = 60;
|
|
|
19
19
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
20
20
|
const isMobile = useContext(MobileContext);
|
|
21
21
|
const { metrika } = useContext(MetrikaContext);
|
|
22
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, } = props;
|
|
22
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, customControlsOptions = {}, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, analyticsEvents, height, ariaLabel, } = props;
|
|
23
23
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
24
|
+
const { type: customControlsType = CustomControlsType.WithMuteButton } = customControlsOptions;
|
|
24
25
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
25
26
|
const mute = initiallyMuted || autoPlay;
|
|
26
27
|
const { playingVideoRef, setProps } = useContext(VideoContext);
|
|
@@ -32,8 +33,10 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
32
33
|
const [width, setWidth] = useState(0);
|
|
33
34
|
const [muted, setMuted] = useState(mute);
|
|
34
35
|
const [started, setStarted] = useState(autoPlay);
|
|
35
|
-
const [paused, setPaused] = useState(false);
|
|
36
36
|
const [ended, setEnded] = useState(false);
|
|
37
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
38
|
+
const [hovered, setHovered] = useState(false);
|
|
39
|
+
useMount(() => setIsMounted(true));
|
|
37
40
|
const videoSrc = useMemo(() => checkYoutubeVideos(src), [src]);
|
|
38
41
|
const eventsArray = useMemo(() => {
|
|
39
42
|
if (analyticsEvents) {
|
|
@@ -106,7 +109,9 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
106
109
|
return (React.createElement("button", { className: b('button', { theme, text: Boolean(text) }, buttonClassName), "aria-label": i18n('play') }, playButtonContent));
|
|
107
110
|
}, [type, theme, text, buttonClassName]);
|
|
108
111
|
const changeMute = useCallback((isMuted) => {
|
|
109
|
-
if (isMuted &&
|
|
112
|
+
if (isMuted &&
|
|
113
|
+
playerRef &&
|
|
114
|
+
customControlsType !== CustomControlsType.WithPlayPauseButton) {
|
|
110
115
|
playerRef.seekTo(0);
|
|
111
116
|
setPlayedPercent(0);
|
|
112
117
|
}
|
|
@@ -124,8 +129,16 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
124
129
|
}
|
|
125
130
|
// In order to the progress bar to update (equals 0) before displaying
|
|
126
131
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
127
|
-
}, [
|
|
128
|
-
|
|
132
|
+
}, [
|
|
133
|
+
playerRef,
|
|
134
|
+
customControlsType,
|
|
135
|
+
metrika,
|
|
136
|
+
videoMetrika,
|
|
137
|
+
playEvents,
|
|
138
|
+
stopEvents,
|
|
139
|
+
handleAnalytics,
|
|
140
|
+
setProps,
|
|
141
|
+
]);
|
|
129
142
|
const handleClickPreview = useCallback(() => {
|
|
130
143
|
setIsPlaying(true);
|
|
131
144
|
onClickPreview === null || onClickPreview === void 0 ? void 0 : onClickPreview();
|
|
@@ -139,12 +152,11 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
139
152
|
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
140
153
|
const onPause = useCallback(() => {
|
|
141
154
|
// For support correct state for youtube
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
setIsPlaying(true);
|
|
155
|
+
if (controls !== MediaVideoControlsType.Custom ||
|
|
156
|
+
customControlsType === CustomControlsType.WithPlayPauseButton) {
|
|
157
|
+
setIsPlaying(false);
|
|
146
158
|
}
|
|
147
|
-
}, [controls,
|
|
159
|
+
}, [controls, customControlsType]);
|
|
148
160
|
const onStart = useCallback(() => {
|
|
149
161
|
if (!autoPlay && !initiallyMuted) {
|
|
150
162
|
setMuted(false);
|
|
@@ -152,17 +164,17 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
152
164
|
}, [autoPlay, initiallyMuted]);
|
|
153
165
|
const onPlay = useCallback(() => {
|
|
154
166
|
setIsPlaying(true);
|
|
155
|
-
if (controls === MediaVideoControlsType.Custom
|
|
167
|
+
if (controls === MediaVideoControlsType.Custom &&
|
|
168
|
+
customControlsType === CustomControlsType.WithMuteButton) {
|
|
156
169
|
if (ended) {
|
|
157
170
|
changeMute(false);
|
|
158
171
|
}
|
|
159
|
-
else if (
|
|
172
|
+
else if (!isPlaying) {
|
|
160
173
|
changeMute(muted);
|
|
161
174
|
}
|
|
162
175
|
setEnded(false);
|
|
163
|
-
setPaused(false);
|
|
164
176
|
}
|
|
165
|
-
}, [changeMute, controls, ended,
|
|
177
|
+
}, [changeMute, controls, customControlsType, ended, isPlaying, muted]);
|
|
166
178
|
const onProgress = useCallback((progress) => {
|
|
167
179
|
setPlayedPercent(progress.played);
|
|
168
180
|
if (progress.played === 1) {
|
|
@@ -180,21 +192,33 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
180
192
|
}
|
|
181
193
|
setEnded(true);
|
|
182
194
|
}, [loop, playerRef]);
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
|
|
195
|
+
const onPlayClick = useCallback(() => {
|
|
196
|
+
if (isPlaying) {
|
|
197
|
+
onPause();
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
onPlay();
|
|
201
|
+
}
|
|
202
|
+
}, [isPlaying, onPlay, onPause]);
|
|
203
|
+
const handleClick = useCallback(() => {
|
|
204
|
+
if (customControlsType === CustomControlsType.WithMuteButton) {
|
|
205
|
+
changeMute(muted);
|
|
186
206
|
}
|
|
187
|
-
|
|
188
|
-
|
|
207
|
+
else {
|
|
208
|
+
onPlayClick();
|
|
209
|
+
}
|
|
210
|
+
}, [changeMute, customControlsType, muted, onPlayClick]);
|
|
211
|
+
const onFocusIn = useCallback(() => setHovered(true), []);
|
|
212
|
+
const onFocusOut = useCallback(() => setHovered(false), []);
|
|
213
|
+
return (React.createElement("div", { className: b({ wrapper: !currentHeight, controls, started, hovered }, className), ref: ref, onClick: handleClick, onMouseEnter: onFocusIn, onMouseLeave: onFocusOut, onFocus: onFocusIn, onBlur: onFocusOut }, isMounted ? (React.createElement(Fragment, null,
|
|
214
|
+
React.createElement(ReactPlayer, { className: b('player'), url: videoSrc, muted: muted, controls: controls === MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded, "aria-label": ariaLabel }),
|
|
215
|
+
controls === MediaVideoControlsType.Custom && started && (React.createElement(CustomBarControls, { className: b('custom-bar-controls', { muted }, customBarControlsClassName), mute: {
|
|
216
|
+
isMuted: muted,
|
|
189
217
|
changeMute: (event) => {
|
|
190
218
|
event.stopPropagation();
|
|
191
|
-
changeMute(
|
|
219
|
+
changeMute(muted);
|
|
192
220
|
},
|
|
193
|
-
}, elapsedTimePercent:
|
|
194
|
-
}, [controls, isPlaying, customBarControlsClassName, changeMute]);
|
|
195
|
-
return (React.createElement("div", { className: b({ wrapper: !currentHeight }, className), ref: ref, onClick: handleClick },
|
|
196
|
-
React.createElement(ReactPlayer, { className: b('player'), url: videoSrc, muted: muted, controls: controls === MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded, "aria-label": ariaLabel }),
|
|
197
|
-
renderCustomBarControls(muted, playedPercent)));
|
|
221
|
+
}, elapsedTimePercent: playedPercent, type: customControlsType, isPaused: !isPlaying, onPlayClick: onPlayClick })))) : null));
|
|
198
222
|
});
|
|
199
223
|
function getHeight(width) {
|
|
200
224
|
return (width / 16) * 9;
|
|
@@ -2,28 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { HTML, YFMWrapper } from '../';
|
|
3
3
|
import { block } from '../../utils';
|
|
4
4
|
import './Table.css';
|
|
5
|
+
function getMarkerId(index) {
|
|
6
|
+
if (isNaN(index)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return `marker-${index}`;
|
|
10
|
+
}
|
|
5
11
|
const b = block('table');
|
|
6
12
|
export default class Table extends React.Component {
|
|
7
13
|
render() {
|
|
8
|
-
const { content, legend, marker = 'disk', className } = this.props;
|
|
14
|
+
const { content, legend, marker = 'disk', className, caption } = this.props;
|
|
9
15
|
if (!content || !content.length || !content[0].length) {
|
|
10
16
|
return null;
|
|
11
17
|
}
|
|
12
|
-
return (React.createElement("div", { className: b(null, className) },
|
|
18
|
+
return (React.createElement("div", { className: b(null, className), role: 'table', "aria-label": caption },
|
|
13
19
|
this.renderTable(content, marker, legend),
|
|
14
20
|
legend && this.renderLegend(legend, marker)));
|
|
15
21
|
}
|
|
16
22
|
renderTable(content, marker, legend) {
|
|
17
23
|
const justify = this.getDefaultJustify(content, this.props.justify);
|
|
18
|
-
return (React.createElement("div", { className: b('table') }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row') }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }) }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
24
|
+
return (React.createElement("div", { className: b('table'), role: 'rowgroup' }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row'), role: 'row' }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }), role: 'cell' }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
19
25
|
}
|
|
20
26
|
renderMarker(type, cell) {
|
|
21
|
-
return React.createElement("div", { className: b('marker', { type, index: String(cell) }) });
|
|
27
|
+
return (React.createElement("div", { "aria-labelledby": getMarkerId(Number(cell)), className: b('marker', { type, index: String(cell) }) }));
|
|
22
28
|
}
|
|
23
29
|
renderLegend(legend, marker) {
|
|
24
30
|
return (React.createElement("div", { className: b('legend') }, legend.map((item, index) => (React.createElement("div", { key: item, className: b('legend-item') },
|
|
25
31
|
this.renderMarker(marker, String(index)),
|
|
26
|
-
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true } }))))));
|
|
32
|
+
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true }, id: getMarkerId(index) }))))));
|
|
27
33
|
}
|
|
28
34
|
getDefaultJustify(content, justify) {
|
|
29
35
|
return justify || new Array(content[0].length).fill('center');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
|
3
|
-
import
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
import { useAnalytics } from '../../hooks/useAnalytics';
|
|
6
6
|
import { PlayVideo } from '../../icons';
|
|
@@ -54,7 +54,7 @@ const VideoBlock = (props) => {
|
|
|
54
54
|
setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
|
|
55
55
|
}, [handleAnalytics, analyticsEvents, src, attributes]);
|
|
56
56
|
useEffect(() => {
|
|
57
|
-
const updateSize =
|
|
57
|
+
const updateSize = debounce(() => {
|
|
58
58
|
setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
|
|
59
59
|
}, 100);
|
|
60
60
|
updateSize();
|
|
@@ -67,11 +67,12 @@ const VideoBlock = (props) => {
|
|
|
67
67
|
if (norender) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const fullSrc = `${src}?${getPageSearchParams(attributes || {})}`;
|
|
71
70
|
if (ref.current && !iframeRef.current) {
|
|
72
71
|
const iframe = document.createElement('iframe');
|
|
73
72
|
iframe.id = fullId;
|
|
74
|
-
|
|
73
|
+
if (!previewImg) {
|
|
74
|
+
iframe.src = `${src}?${getPageSearchParams(attributes || {})}`;
|
|
75
|
+
}
|
|
75
76
|
iframe.width = '100%';
|
|
76
77
|
iframe.height = '100%';
|
|
77
78
|
iframe.title = i18n('iframe-title');
|
|
@@ -82,7 +83,7 @@ const VideoBlock = (props) => {
|
|
|
82
83
|
ref.current.appendChild(iframe);
|
|
83
84
|
iframeRef.current = iframe;
|
|
84
85
|
}
|
|
85
|
-
}, [stream, record, norender, src, fullId, attributes, iframeRef,
|
|
86
|
+
}, [stream, record, norender, src, fullId, attributes, iframeRef, previewImg]);
|
|
86
87
|
useEffect(() => {
|
|
87
88
|
setHidePreview(false);
|
|
88
89
|
}, [src, setHidePreview]);
|
|
@@ -91,7 +92,7 @@ const VideoBlock = (props) => {
|
|
|
91
92
|
}
|
|
92
93
|
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
93
94
|
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
94
|
-
playButton || (React.createElement("button", { className: b('button') },
|
|
95
|
+
playButton || (React.createElement("button", { title: "Play", className: b('button') },
|
|
95
96
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
96
97
|
};
|
|
97
98
|
export default VideoBlock;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ClassNameProps, Modifiers } from '../../models';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { QAProps } from '../../models/common';
|
|
3
|
+
export interface YFMWrapperProps extends ClassNameProps, QAProps {
|
|
4
4
|
content: string;
|
|
5
5
|
modifiers?: Modifiers;
|
|
6
6
|
itemProp?: string;
|
|
7
|
+
id?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const YFMWrapper: ({ content, modifiers, className, itemProp, }: YFMWrapperProps
|
|
9
|
+
declare const YFMWrapper: ({ content, modifiers, className, itemProp, id, qa }: YFMWrapperProps) => JSX.Element;
|
|
9
10
|
export default YFMWrapper;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* we won't use 'pc' class prefix here to let you opportunity to define yfm styles
|
|
2
2
|
in your project via global 'yfm' class */
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import block from 'bem-cn-lite';
|
|
5
4
|
import toSnakeCase from 'snakecase-keys';
|
|
6
5
|
import { HTML } from '../../components';
|
|
7
|
-
|
|
8
|
-
const
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
const yfm = cn('yfm');
|
|
8
|
+
const YFMWrapper = ({ content, modifiers, className, itemProp, id, qa }) => (React.createElement(HTML, { className: yfm(modifiers ? toSnakeCase(modifiers) : {}, className), itemProp: itemProp, id: id, qa: qa }, content));
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -21,11 +21,18 @@ export declare const blockMap: {
|
|
|
21
21
|
export declare const subBlockMap: {
|
|
22
22
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
23
23
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
24
|
-
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
24
|
+
"media-card": ({ border, analyticsEvents, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
25
25
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
26
|
-
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullscreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
26
|
+
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullscreen, className, analyticsEvents, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
27
27
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
28
28
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
29
|
-
content: (props: import("./
|
|
29
|
+
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
30
30
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
31
31
|
};
|
|
32
|
+
export declare const navItemMap: {
|
|
33
|
+
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
34
|
+
social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
|
|
35
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation/models").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
|
|
36
|
+
link: import("react").FC<import("./navigation/models").NavigationItemProps & import("./models").NavigationLinkItem>;
|
|
37
|
+
"github-button": ({ text, url, className, label, size, icon, }: import("./navigation/models").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
|
|
38
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
2
|
-
import { BlockType, SubBlockType } from './models';
|
|
2
|
+
import { BlockType, NavigationItemType, SubBlockType } from './models';
|
|
3
|
+
import { GithubButton, NavigationButton, NavigationDropdown, NavigationLink, } from './navigation/components/NavigationItem';
|
|
4
|
+
import SocialIcon from './navigation/components/SocialIcon/SocialIcon';
|
|
3
5
|
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
4
6
|
export const blockMap = {
|
|
5
7
|
[BlockType.SliderBlock]: SliderBlock,
|
|
@@ -32,3 +34,10 @@ export const subBlockMap = {
|
|
|
32
34
|
[SubBlockType.Content]: Content,
|
|
33
35
|
[SubBlockType.Quote]: Quote,
|
|
34
36
|
};
|
|
37
|
+
export const navItemMap = {
|
|
38
|
+
[NavigationItemType.Button]: NavigationButton,
|
|
39
|
+
[NavigationItemType.Social]: SocialIcon,
|
|
40
|
+
[NavigationItemType.Dropdown]: NavigationDropdown,
|
|
41
|
+
[NavigationItemType.Link]: NavigationLink,
|
|
42
|
+
[NavigationItemType.GithubButton]: GithubButton,
|
|
43
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { Spin } from '@gravity-ui/uikit';
|
|
3
|
-
import blockCn from 'bem-cn-lite';
|
|
4
3
|
import ErrorWrapper from '../../components/ErrorWrapper/ErrorWrapper';
|
|
4
|
+
import { block as blockCn } from '../../utils/cn';
|
|
5
5
|
import i18n from './i18n';
|
|
6
6
|
import './Loadable.css';
|
|
7
7
|
const b = blockCn('loadable-block');
|
|
@@ -84,6 +84,10 @@ unpredictable css rules order in build */
|
|
|
84
84
|
.yfm_constructor.yfm_constructor_notice p {
|
|
85
85
|
color: var(--g-color-text-secondary);
|
|
86
86
|
}
|
|
87
|
+
.yfm_constructor.yfm_constructor_meta_info p {
|
|
88
|
+
color: var(--pc-media-card-meta-info-color);
|
|
89
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
90
|
+
}
|
|
87
91
|
.yfm_constructor.yfm_constructor ul,
|
|
88
92
|
.yfm_constructor.yfm_constructor ol,
|
|
89
93
|
.yfm_constructor.yfm_constructor li,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@doc-tools/transform/dist/js/yfm';
|
|
3
|
-
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
3
|
+
import { blockMap, navItemMap, subBlockMap } from '../../constructor-items';
|
|
4
4
|
import { CustomConfig, CustomItems, NavigationData, PageContent, ShouldRenderBlock } from '../../models';
|
|
5
5
|
import './PageConstructor.css';
|
|
6
6
|
export type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
|
|
7
|
+
export type NavItemMap = typeof navItemMap & CustomItems;
|
|
7
8
|
export interface PageConstructorProps {
|
|
8
9
|
content?: PageContent;
|
|
9
10
|
shouldRenderBlock?: ShouldRenderBlock;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import '@doc-tools/transform/dist/js/yfm';
|
|
4
|
-
import blockOrigin from 'bem-cn-lite';
|
|
5
4
|
import BackgroundMedia from '../../components/BackgroundMedia/BackgroundMedia';
|
|
6
5
|
import { UIKIT_ROOT_CLASS } from '../../components/constants';
|
|
7
|
-
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
6
|
+
import { blockMap, navItemMap, subBlockMap } from '../../constructor-items';
|
|
8
7
|
import { AnimateContext } from '../../context/animateContext';
|
|
9
8
|
import { InnerContext } from '../../context/innerContext';
|
|
10
9
|
import { useTheme } from '../../context/theme';
|
|
11
10
|
import { Grid } from '../../grid';
|
|
12
|
-
import { BlockType, BlockTypes, HeaderBlockTypes, SubBlockTypes, } from '../../models';
|
|
11
|
+
import { BlockType, BlockTypes, HeaderBlockTypes, NavigationItemTypes, SubBlockTypes, } from '../../models';
|
|
13
12
|
import Layout from '../../navigation/containers/Layout/Layout';
|
|
14
|
-
import {
|
|
13
|
+
import { cn as blockOrigin, block as cnBlock, getCustomItems, getCustomTypes, getHeaderBlock, getOrderedBlocks, getThemedValue, } from '../../utils';
|
|
15
14
|
import { ConstructorBlocks } from './components/ConstructorBlocks';
|
|
16
15
|
import { ConstructorHeader } from './components/ConstructorItem';
|
|
17
16
|
import { ConstructorRow } from './components/ConstructorRow';
|
|
@@ -22,10 +21,15 @@ export const Constructor = (props) => {
|
|
|
22
21
|
const { content: { blocks = [], background = {} } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
|
|
23
22
|
const { context } = useMemo(() => ({
|
|
24
23
|
context: {
|
|
25
|
-
blockTypes: [...BlockTypes, ...
|
|
26
|
-
subBlockTypes: [...SubBlockTypes, ...
|
|
27
|
-
headerBlockTypes: [...HeaderBlockTypes, ...
|
|
28
|
-
|
|
24
|
+
blockTypes: [...BlockTypes, ...getCustomTypes(['blocks', 'headers'], custom)],
|
|
25
|
+
subBlockTypes: [...SubBlockTypes, ...getCustomTypes(['subBlocks'], custom)],
|
|
26
|
+
headerBlockTypes: [...HeaderBlockTypes, ...getCustomTypes(['headers'], custom)],
|
|
27
|
+
navigationBlockTypes: [
|
|
28
|
+
...NavigationItemTypes,
|
|
29
|
+
...getCustomTypes(['navigation'], custom),
|
|
30
|
+
],
|
|
31
|
+
itemMap: Object.assign(Object.assign(Object.assign({}, blockMap), subBlockMap), getCustomItems(['blocks', 'headers', 'subBlocks'], custom)),
|
|
32
|
+
navItemMap: Object.assign(Object.assign({}, navItemMap), getCustomItems(['navigation'], custom)),
|
|
29
33
|
loadables: custom === null || custom === void 0 ? void 0 : custom.loadable,
|
|
30
34
|
shouldRenderBlock,
|
|
31
35
|
customization: {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-constructor-block.pc-constructor-block_indentTop_0 {
|
|
4
|
+
margin-top: 0;
|
|
5
|
+
}
|
|
6
|
+
.pc-constructor-block.pc-constructor-block_indentTop_xs {
|
|
7
|
+
margin-top: 16px;
|
|
8
|
+
}
|
|
9
|
+
.pc-constructor-block.pc-constructor-block_indentTop_s {
|
|
10
|
+
margin-top: 24px;
|
|
11
|
+
}
|
|
12
|
+
.pc-constructor-block.pc-constructor-block_indentTop_m {
|
|
13
|
+
margin-top: 32px;
|
|
14
|
+
}
|
|
15
|
+
.pc-constructor-block.pc-constructor-block_indentTop_l {
|
|
16
|
+
margin-top: 48px;
|
|
17
|
+
}
|
|
18
|
+
.pc-constructor-block.pc-constructor-block_indentTop_xl {
|
|
19
|
+
margin-top: 64px;
|
|
20
|
+
}
|
|
21
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_0 {
|
|
22
|
+
padding-bottom: 0;
|
|
23
|
+
}
|
|
24
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_xs {
|
|
25
|
+
padding-bottom: 16px;
|
|
26
|
+
}
|
|
27
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_s {
|
|
28
|
+
padding-bottom: 24px;
|
|
29
|
+
}
|
|
30
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_m {
|
|
31
|
+
padding-bottom: 32px;
|
|
32
|
+
}
|
|
33
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_l {
|
|
34
|
+
padding-bottom: 48px;
|
|
35
|
+
}
|
|
36
|
+
.pc-constructor-block.pc-constructor-block_indentBottom_xl {
|
|
37
|
+
padding-bottom: 64px;
|
|
38
|
+
}
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BlockDecorationProps, ConstructorBlock as ConstructorBlockType, WithChildren } from '../../../../models';
|
|
3
|
+
import './ConstructorBlock.css';
|
|
3
4
|
interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
|
|
4
5
|
data: ConstructorBlockType;
|
|
5
6
|
}
|