@gravity-ui/page-constructor 4.15.1-alpha.0 → 4.15.1
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/build/cjs/blocks/HeaderSlider/schema.js +2 -2
- package/build/cjs/blocks/Info/schema.js +2 -2
- package/build/cjs/blocks/Media/schema.js +3 -2
- package/build/cjs/blocks/Questions/schema.js +2 -2
- package/build/cjs/blocks/Slider/Slider.js +6 -4
- package/build/cjs/blocks/Slider/utils.js +2 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -2
- package/build/cjs/components/BalancedMasonry/BalancedMasonry.js +6 -4
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +7 -6
- package/build/cjs/components/FullWidthBackground/FullWidthBackground.js +2 -2
- package/build/cjs/components/Image/Image.d.ts +5 -0
- package/build/cjs/components/Image/Image.js +7 -8
- package/build/cjs/components/Map/GoogleMap.js +2 -2
- package/build/cjs/components/Map/YMap/YandexMap.js +2 -2
- package/build/cjs/components/Media/Image/Image.js +2 -2
- package/build/cjs/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +2 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
- package/build/cjs/editor/components/BlockForm/BlockForm.js +4 -3
- package/build/cjs/editor/components/PagePropsForm/PagePropsForm.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/config.js +2 -2
- package/build/cjs/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
- package/build/cjs/editor/store/utils.js +2 -2
- package/build/cjs/editor/utils/index.js +2 -2
- package/build/cjs/hooks/useFocus.js +2 -2
- package/build/cjs/hooks/useHeightCalculator.js +2 -2
- package/build/cjs/hooks/useWindowBreakpoint.js +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -2
- package/build/cjs/navigation/schema.js +3 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/schema.js +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
- package/build/cjs/text-transform/config.js +2 -0
- package/build/cjs/text-transform/transformers.js +4 -3
- package/build/cjs/text-transform/utils.d.ts +0 -2
- package/build/cjs/text-transform/utils.js +26 -7
- package/build/cjs/utils/blocks.js +5 -3
- package/build/esm/blocks/HeaderSlider/schema.js +2 -2
- package/build/esm/blocks/Info/schema.js +2 -2
- package/build/esm/blocks/Media/schema.js +1 -1
- package/build/esm/blocks/Questions/schema.js +2 -2
- package/build/esm/blocks/Slider/Slider.js +6 -4
- package/build/esm/blocks/Slider/utils.js +2 -2
- package/build/esm/blocks/Tabs/schema.js +2 -2
- package/build/esm/components/BalancedMasonry/BalancedMasonry.js +6 -4
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +8 -7
- package/build/esm/components/FullWidthBackground/FullWidthBackground.js +2 -2
- package/build/esm/components/Image/Image.d.ts +5 -0
- package/build/esm/components/Image/Image.js +7 -8
- package/build/esm/components/Map/GoogleMap.js +2 -2
- package/build/esm/components/Map/YMap/YandexMap.js +2 -2
- package/build/esm/components/Media/Image/Image.js +2 -2
- package/build/esm/components/OverflowScroller/OverflowScroller.js +2 -2
- package/build/esm/components/ReactPlayer/ReactPlayer.js +2 -2
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +2 -2
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -2
- package/build/esm/editor/components/BlockForm/BlockForm.js +4 -3
- package/build/esm/editor/components/PagePropsForm/PagePropsForm.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/config.js +2 -2
- package/build/esm/editor/dynamic-forms-custom/hooks/useOneOf.js +5 -4
- package/build/esm/editor/store/utils.js +2 -2
- package/build/esm/editor/utils/index.js +2 -2
- package/build/esm/hooks/useFocus.js +2 -2
- package/build/esm/hooks/useHeightCalculator.js +2 -2
- package/build/esm/hooks/useWindowBreakpoint.js +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +2 -2
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -1
- package/build/esm/navigation/schema.js +1 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -2
- package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +4 -4
- package/build/esm/text-transform/config.js +2 -0
- package/build/esm/text-transform/transformers.js +4 -3
- package/build/esm/text-transform/utils.d.ts +0 -2
- package/build/esm/text-transform/utils.js +25 -5
- package/build/esm/utils/blocks.js +2 -1
- package/package.json +1 -1
- package/server/text-transform/config.js +2 -0
- package/server/text-transform/transformers.js +4 -3
- package/server/text-transform/utils.d.ts +0 -2
- package/server/text-transform/utils.js +26 -7
- package/server/utils/blocks.js +7 -3
- package/widget/index.js +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
function calculate(windowWidth) {
|
|
8
8
|
const breakpointsSorted = Object.values(constants_1.BREAKPOINTS).sort((b1, b2) => b1 - b2);
|
|
@@ -21,7 +21,7 @@ function useWindowBreakpoint() {
|
|
|
21
21
|
const [breakpoint, setBreakpoint] = (0, react_1.useState)(constants_1.BREAKPOINTS.sm);
|
|
22
22
|
(0, react_1.useEffect)(() => {
|
|
23
23
|
setBreakpoint(calculate(window.innerWidth));
|
|
24
|
-
const detect =
|
|
24
|
+
const detect = (0, debounce_1.default)(() => {
|
|
25
25
|
setBreakpoint(calculate(window.innerWidth));
|
|
26
26
|
}, 100);
|
|
27
27
|
detect();
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Navigation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
7
|
const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
|
|
8
8
|
const grid_1 = require("../../../grid");
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
@@ -29,7 +29,7 @@ const Navigation = ({ data, logo }) => {
|
|
|
29
29
|
setShowBorder(window.scrollY > 0);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const scrollHandler =
|
|
32
|
+
const scrollHandler = (0, debounce_1.default)(showBorderOnScroll, 20);
|
|
33
33
|
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
34
34
|
return () => window.removeEventListener('scroll', scrollHandler);
|
|
35
35
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const blockIdContext_1 = require("../../../context/blockIdContext");
|
|
7
7
|
const innerContext_1 = require("../../../context/innerContext");
|
|
8
8
|
const models_1 = require("../../../models");
|
|
@@ -17,7 +17,7 @@ const NavigationItem = (_a) => {
|
|
|
17
17
|
const componentProps = (0, react_1.useMemo)(() => {
|
|
18
18
|
const componentProperties = Object.assign(Object.assign({}, data), props);
|
|
19
19
|
if (type !== models_1.NavigationItemType.Dropdown) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, omit_1.default)(componentProperties, 'hidePopup', 'isActive');
|
|
21
21
|
}
|
|
22
22
|
return componentProperties;
|
|
23
23
|
}, [data, props, type]);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NavigationHeaderProps = exports.LogoProps = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
5
6
|
const schema_1 = require("../components/Image/schema");
|
|
6
7
|
const common_1 = require("../schema/validators/common");
|
|
7
8
|
const utils_1 = require("../schema/validators/utils");
|
|
@@ -40,7 +41,7 @@ const NavigationItemBaseProps = {
|
|
|
40
41
|
type: 'number',
|
|
41
42
|
},
|
|
42
43
|
};
|
|
43
|
-
const NavigationItemBaseLinkProps = (0,
|
|
44
|
+
const NavigationItemBaseLinkProps = (0, omit_1.default)(NavigationItemBaseProps, ['url']);
|
|
44
45
|
const NavigationLinkItemProps = {
|
|
45
46
|
type: 'object',
|
|
46
47
|
additionalProperties: false,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BackgroundCard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
const event_1 = require("../../schema/validators/event");
|
|
9
9
|
const schema_2 = require("../Content/schema");
|
|
10
|
-
const BackgroundCardContentProps =
|
|
10
|
+
const BackgroundCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size']);
|
|
11
11
|
exports.BackgroundCard = {
|
|
12
12
|
'background-card': {
|
|
13
13
|
additionalProperties: false,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BasicCard = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
const schema_2 = require("../Content/schema");
|
|
9
|
-
const BasicCardContentProps =
|
|
9
|
+
const BasicCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size', 'theme']);
|
|
10
10
|
exports.BasicCard = {
|
|
11
11
|
'basic-card': {
|
|
12
12
|
additionalProperties: false,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LayoutItem = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
6
|
const schema_1 = tslib_1.__importDefault(require("../../components/MetaInfo/schema"));
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
const event_1 = require("../../schema/validators/event");
|
|
@@ -11,7 +11,7 @@ exports.LayoutItem = {
|
|
|
11
11
|
type: 'object',
|
|
12
12
|
additionalProperties: false,
|
|
13
13
|
required: ['content', 'media'],
|
|
14
|
-
properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0,
|
|
14
|
+
properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0, omit_1.default)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
|
|
15
15
|
type: 'boolean',
|
|
16
16
|
}, fullscreen: {
|
|
17
17
|
type: 'boolean',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
5
|
+
const chunk_1 = tslib_1.__importDefault(require("lodash/chunk"));
|
|
6
6
|
const components_1 = require("../../../components");
|
|
7
7
|
const constants_1 = require("../../../constants");
|
|
8
8
|
const grid_1 = require("../../../grid");
|
|
@@ -50,11 +50,11 @@ const CombinedPriceDetailed = (props) => {
|
|
|
50
50
|
react_1.default.createElement("div", null, descriptionComponents),
|
|
51
51
|
react_1.default.createElement("div", { className: b('description', { delimiter: useMixedView }) }, detailsComponents)));
|
|
52
52
|
};
|
|
53
|
-
const chunkedItems =
|
|
53
|
+
const chunkedItems = (0, chunk_1.default)(items, groupItemsSize);
|
|
54
54
|
return (react_1.default.createElement(components_1.CardBase, { className: b(), border: border, analyticsEvents: analyticsEvents },
|
|
55
55
|
react_1.default.createElement(components_1.CardBase.Content, null,
|
|
56
|
-
react_1.default.createElement(grid_1.Grid, null, chunkedItems.map((
|
|
57
|
-
return (react_1.default.createElement(grid_1.Row, { key: id, className: b('row') }, getPrice(
|
|
56
|
+
react_1.default.createElement(grid_1.Grid, null, chunkedItems.map((item, id) => {
|
|
57
|
+
return (react_1.default.createElement(grid_1.Row, { key: id, className: b('row') }, getPrice(item)));
|
|
58
58
|
})))));
|
|
59
59
|
};
|
|
60
60
|
exports.default = CombinedPriceDetailed;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
5
|
exports.config = exports.blockHeaderTransformer = void 0;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.contentTransformer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
6
|
+
const shuffle_1 = tslib_1.__importDefault(require("lodash/shuffle"));
|
|
6
7
|
const config_1 = require("./config");
|
|
7
8
|
const filter_1 = require("./filter");
|
|
8
9
|
function transformBlocks(blocks, lang, customConfig = {}, options = {}) {
|
|
9
10
|
const fullConfig = Object.assign(Object.assign({}, config_1.config), customConfig);
|
|
10
11
|
const { plugins = [] } = options;
|
|
11
|
-
const clonedBlocks =
|
|
12
|
+
const clonedBlocks = (0, cloneDeep_1.default)(blocks);
|
|
12
13
|
return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block, plugins));
|
|
13
14
|
}
|
|
14
15
|
function transformBlock(lang, blocksConfig, block, plugins) {
|
|
15
16
|
const blockConfig = blocksConfig[block.type];
|
|
16
17
|
if (block) {
|
|
17
18
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
18
|
-
block.children =
|
|
19
|
+
block.children = (0, shuffle_1.default)(block.children);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
if (blockConfig) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Options, Output } from '@doc-tools/transform';
|
|
2
2
|
import sanitize from 'sanitize-html';
|
|
3
3
|
import { Lang } from '../utils/configure';
|
|
4
|
-
import AddRuleOptions = typograf.AddRuleOptions;
|
|
5
4
|
export declare enum TransformType {
|
|
6
5
|
Text = "text",
|
|
7
6
|
Html = "html"
|
|
@@ -15,7 +14,6 @@ export declare const typografConfig: {
|
|
|
15
14
|
disabled: string[];
|
|
16
15
|
};
|
|
17
16
|
export declare const sanitizeStripOptions: sanitize.IOptions;
|
|
18
|
-
export declare function addTypografRules(options: AddRuleOptions[]): void;
|
|
19
17
|
export declare function typograf(text: string, lang?: Lang): string;
|
|
20
18
|
export declare function sanitizeHtml(html: string, options?: sanitize.IOptions): string;
|
|
21
19
|
export declare function typografToHTML(text: string, lang: Lang, allowedTags?: string[]): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.
|
|
3
|
+
exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.sanitizeStripOptions = exports.typografConfig = exports.DEFAULT_ALLOWED_TAGS = exports.TransformType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const transform_1 = tslib_1.__importDefault(require("@doc-tools/transform"));
|
|
6
6
|
const sanitize_html_1 = tslib_1.__importDefault(require("sanitize-html"));
|
|
@@ -37,12 +37,31 @@ exports.sanitizeStripOptions = {
|
|
|
37
37
|
allowedTags: [],
|
|
38
38
|
allowedAttributes: {},
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
typograf_1.default.addRule({
|
|
41
|
+
name: 'common/html/sup',
|
|
42
|
+
queue: 'end',
|
|
43
|
+
/* TODO mange with it: in typograf types AddRuleOptions.handler takes only one param: text.
|
|
44
|
+
But in cloud-www was used this notation with 3 params */
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
handler: function (text, settings, context) {
|
|
47
|
+
const { prefs: { htmlEntity: { type = '' } = {} } = {} } = context;
|
|
48
|
+
let symbols;
|
|
49
|
+
switch (type) {
|
|
50
|
+
case 'digit':
|
|
51
|
+
symbols = '®|©|™';
|
|
52
|
+
break;
|
|
53
|
+
case 'name':
|
|
54
|
+
symbols = '®|©|™';
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
symbols = '®|©|™';
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const symbolsRegex = new RegExp(`(?<!<sup>\\s*)(${symbols})|(${symbols})(?!\\s*<\\/sup>)`, 'gi');
|
|
61
|
+
return text.replace(symbolsRegex, '<sup>$1</sup>');
|
|
62
|
+
},
|
|
63
|
+
htmlAttrs: false,
|
|
64
|
+
});
|
|
46
65
|
function enableRules(tp) {
|
|
47
66
|
const { disabled, enabled } = exports.typografConfig;
|
|
48
67
|
enabled.forEach((rule) => tp.enableRule(rule));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getQaAttrubutes = exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomTypes = exports.getCustomItems = exports.getBlockKey = exports.hasBlockTag = exports.getHeaderTag = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const camelCase_1 = tslib_1.__importDefault(require("lodash/camelCase"));
|
|
6
|
+
const flatten_1 = tslib_1.__importDefault(require("lodash/flatten"));
|
|
5
7
|
const models_1 = require("../models");
|
|
6
8
|
const BLOCK_ELEMENTS = [
|
|
7
9
|
'div',
|
|
@@ -125,9 +127,9 @@ exports.getShareLink = getShareLink;
|
|
|
125
127
|
const getQaAttrubutes = (qa, ...customKeys) => {
|
|
126
128
|
const attributes = {};
|
|
127
129
|
if (qa) {
|
|
128
|
-
const keys = QA_ATTRIBUTES_KEYS.concat((0,
|
|
130
|
+
const keys = QA_ATTRIBUTES_KEYS.concat((0, flatten_1.default)(customKeys));
|
|
129
131
|
keys.forEach((key) => {
|
|
130
|
-
attributes[(0,
|
|
132
|
+
attributes[(0, camelCase_1.default)(key)] = `${qa}-${key}`;
|
|
131
133
|
});
|
|
132
134
|
attributes.default = qa;
|
|
133
135
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
2
|
import { HeaderProperties, SliderProps } from '../../schema/validators/blocks';
|
|
3
3
|
import { BlockBaseProps } from '../../schema/validators/common';
|
|
4
4
|
export const HeaderSliderBlock = {
|
|
5
5
|
'header-slider-block': {
|
|
6
6
|
additionalProperties: false,
|
|
7
7
|
required: ['items'],
|
|
8
|
-
properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps),
|
|
8
|
+
properties: Object.assign(Object.assign(Object.assign({}, BlockBaseProps), omit(SliderProps, ['loadable', 'children'])), { items: {
|
|
9
9
|
type: 'array',
|
|
10
10
|
items: {
|
|
11
11
|
type: 'object',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
2
|
import { BaseProps, ButtonBlock, LinkProps, ThemeProps, withTheme, } from '../../schema/validators/common';
|
|
3
3
|
import { filteredArray } from '../../schema/validators/utils';
|
|
4
4
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
5
5
|
const ContentProps = {
|
|
6
6
|
additionalProperties: false,
|
|
7
|
-
properties:
|
|
7
|
+
properties: omit(ContentBase, ['size', 'colSizes', 'theme']),
|
|
8
8
|
};
|
|
9
9
|
export const InfoBlock = {
|
|
10
10
|
'info-block': {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
2
|
import { AnimatableProps, BlockBaseProps, ButtonBlock, MediaProps, mediaDirection, withTheme, } from '../../schema/validators/common';
|
|
3
3
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
4
4
|
export const Media = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
2
|
import { BlockBaseProps, LinkProps } from '../../schema/validators/common';
|
|
3
3
|
import { filteredArray } from '../../schema/validators/utils';
|
|
4
4
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
5
|
-
const QuestionsBlockContentProps =
|
|
5
|
+
const QuestionsBlockContentProps = omit(ContentBase, ['size', 'theme']);
|
|
6
6
|
export const QuestionsBlock = {
|
|
7
7
|
'questions-block': {
|
|
8
8
|
additionalProperties: false,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
|
+
import get from 'lodash/get';
|
|
4
|
+
import noop from 'lodash/noop';
|
|
3
5
|
import SlickSlider from 'react-slick';
|
|
4
6
|
import Anchor from '../../components/Anchor/Anchor';
|
|
5
7
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
@@ -40,11 +42,11 @@ export const SliderBlock = (props) => {
|
|
|
40
42
|
const autoplayTimeId = useRef();
|
|
41
43
|
const { hasFocus, unsetFocus } = useFocus((_a = slider === null || slider === void 0 ? void 0 : slider.innerSlider) === null || _a === void 0 ? void 0 : _a.list);
|
|
42
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
-
const onResize = useCallback(
|
|
45
|
+
const onResize = useCallback(debounce(() => {
|
|
44
46
|
if (!slider) {
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
|
-
const newBreakpoint =
|
|
49
|
+
const newBreakpoint = get(slider, 'state.breakpoint') || BREAKPOINTS.xl;
|
|
48
50
|
if (newBreakpoint !== breakpoint) {
|
|
49
51
|
setBreakpoint(newBreakpoint);
|
|
50
52
|
setCurrentIndex(0);
|
|
@@ -193,7 +195,7 @@ export const SliderBlock = (props) => {
|
|
|
193
195
|
prevArrow: React.createElement(Arrow, { type: "left", handleClick: handleArrowClick, size: arrowSize }),
|
|
194
196
|
lazyLoad,
|
|
195
197
|
};
|
|
196
|
-
return (React.createElement(OutsideClick, { onOutsideClick: isMobile ? unsetFocus :
|
|
198
|
+
return (React.createElement(OutsideClick, { onOutsideClick: isMobile ? unsetFocus : noop },
|
|
197
199
|
React.createElement(SlickSlider, Object.assign({}, settings), disclosedChildren),
|
|
198
200
|
React.createElement("div", { className: b('footer') },
|
|
199
201
|
renderDisclaimer(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pickBy from 'lodash/pickBy';
|
|
2
2
|
import { BREAKPOINTS } from '../../constants';
|
|
3
3
|
import { SliderBreakpointNames } from './models';
|
|
4
4
|
export const DEFAULT_SLIDE_BREAKPOINTS = {
|
|
@@ -16,7 +16,7 @@ export function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobile
|
|
|
16
16
|
else {
|
|
17
17
|
result = breakpoints || DEFAULT_SLIDE_BREAKPOINTS;
|
|
18
18
|
}
|
|
19
|
-
return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS),
|
|
19
|
+
return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS), pickBy(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
|
|
20
20
|
}
|
|
21
21
|
export function getSliderResponsiveParams(breakpoints) {
|
|
22
22
|
return Object.entries(breakpoints).map(([breakpointName, slidesToShow]) => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
2
|
import { ImageProps } from '../../components/Image/schema';
|
|
3
3
|
import { BlockBaseProps, BlockHeaderProps, LinkProps, MediaProps, containerSizesArray, contentSizes, mediaDirection, sizeNumber, withTheme, } from '../../schema/validators/common';
|
|
4
4
|
import { filteredArray } from '../../schema/validators/utils';
|
|
5
5
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
6
|
-
const TabsItemContentProps =
|
|
6
|
+
const TabsItemContentProps = omit(ContentBase, ['size', 'colSizes', 'centered', 'theme']);
|
|
7
7
|
export const tabsItem = {
|
|
8
8
|
type: 'object',
|
|
9
9
|
additionalProperties: false,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
|
+
import first from 'lodash/first';
|
|
4
|
+
import minBy from 'lodash/minBy';
|
|
3
5
|
import { SSRContext } from '../../context/ssrContext';
|
|
4
6
|
import { block, getQaAttrubutes } from '../../utils';
|
|
5
7
|
import './BalancedMasonry.css';
|
|
@@ -13,7 +15,7 @@ const BalancedMasonry = (props) => {
|
|
|
13
15
|
return Number(secondBreakpoint) - Number(firstBreakpoint);
|
|
14
16
|
});
|
|
15
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
-
let [, result] =
|
|
18
|
+
let [, result] = first(breakpoints);
|
|
17
19
|
if (isServer) {
|
|
18
20
|
return result;
|
|
19
21
|
}
|
|
@@ -29,7 +31,7 @@ const BalancedMasonry = (props) => {
|
|
|
29
31
|
const [columns, setColumns] = useState([]);
|
|
30
32
|
const containerRef = useRef(null);
|
|
31
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
-
const balanceColumns = useCallback(
|
|
34
|
+
const balanceColumns = useCallback(debounce(() => {
|
|
33
35
|
if (!containerRef.current) {
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
@@ -44,7 +46,7 @@ const BalancedMasonry = (props) => {
|
|
|
44
46
|
if (!node) {
|
|
45
47
|
continue;
|
|
46
48
|
}
|
|
47
|
-
const minColumn =
|
|
49
|
+
const minColumn = minBy(columnsMeta, 'height') || { id: 0, height: 0 };
|
|
48
50
|
const { id: columnId } = minColumn;
|
|
49
51
|
localColumns[columnId].push(children[i]);
|
|
50
52
|
minColumn.height += node.offsetHeight;
|
|
@@ -11,6 +11,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
|
|
|
11
11
|
target?: HTMLAttributeAnchorTarget;
|
|
12
12
|
metrikaGoals?: MetrikaGoal;
|
|
13
13
|
pixelEvents?: ButtonPixel;
|
|
14
|
+
qa?: string;
|
|
14
15
|
}
|
|
15
16
|
export interface CardHeaderBaseProps {
|
|
16
17
|
className?: string;
|
|
@@ -2,7 +2,7 @@ import React, { Children, Fragment } from 'react';
|
|
|
2
2
|
import { useAnalytics } from '../../hooks';
|
|
3
3
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
4
4
|
import { DefaultEventNames } from '../../models/common';
|
|
5
|
-
import { block } from '../../utils';
|
|
5
|
+
import { block, getQaAttrubutes } from '../../utils';
|
|
6
6
|
import BackgroundImage from '../BackgroundImage/BackgroundImage';
|
|
7
7
|
import RouterLink from '../RouterLink/RouterLink';
|
|
8
8
|
import './CardBase.css';
|
|
@@ -11,10 +11,11 @@ const Header = () => null;
|
|
|
11
11
|
const Content = () => null;
|
|
12
12
|
const Footer = () => null;
|
|
13
13
|
export const Layout = (props) => {
|
|
14
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
14
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', qa, } = props;
|
|
15
15
|
const handleMetrika = useMetrika();
|
|
16
16
|
const handleAnalytics = useAnalytics(DefaultEventNames.CardBase, url);
|
|
17
17
|
let header, content, footer, image, headerClass, footerClass;
|
|
18
|
+
const qaAttributes = getQaAttrubutes(qa, 'header', 'footer', 'body', 'content');
|
|
18
19
|
function handleChild(child) {
|
|
19
20
|
switch (child.type) {
|
|
20
21
|
case Header:
|
|
@@ -38,18 +39,18 @@ export const Layout = (props) => {
|
|
|
38
39
|
Children.forEach(children, handleChild);
|
|
39
40
|
}
|
|
40
41
|
const cardContent = (React.createElement(Fragment, null,
|
|
41
|
-
(header || image) && (React.createElement(BackgroundImage, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image)),
|
|
42
|
+
(header || image) && (React.createElement(BackgroundImage, Object.assign({ className: b('header', headerClass) }, (typeof image === 'string' ? { src: image } : image), { qa: qaAttributes.header }),
|
|
42
43
|
React.createElement("div", { className: b('header-content') }, header))),
|
|
43
|
-
React.createElement("div", { className: b('body', bodyClassName) },
|
|
44
|
-
React.createElement("div", { className: b('content', contentClassName) }, content),
|
|
45
|
-
footer && React.createElement("div", { className: b('footer', footerClass) }, footer))));
|
|
44
|
+
React.createElement("div", { className: b('body', bodyClassName), "data-qa": qaAttributes.body },
|
|
45
|
+
React.createElement("div", { className: b('content', contentClassName), "data-qa": qaAttributes.content }, content),
|
|
46
|
+
footer && (React.createElement("div", { className: b('footer', footerClass), "data-qa": qaAttributes.footer }, footer)))));
|
|
46
47
|
const fullClassName = b({ border }, className);
|
|
47
48
|
const onClick = () => {
|
|
48
49
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
49
50
|
handleAnalytics(analyticsEvents);
|
|
50
51
|
};
|
|
51
52
|
return url ? (React.createElement(RouterLink, { href: url },
|
|
52
|
-
React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (React.createElement("div", { className: fullClassName }, cardContent));
|
|
53
|
+
React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick, "data-qa": qa }, cardContent))) : (React.createElement("div", { className: fullClassName, "data-qa": qa }, cardContent));
|
|
53
54
|
};
|
|
54
55
|
Layout.Header = Header;
|
|
55
56
|
Layout.Content = Content;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Component, createRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
3
|
import { BREAKPOINTS } from '../../constants';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import './FullWidthBackground.css';
|
|
@@ -11,7 +11,7 @@ export default class FullWidthBackground extends Component {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.ref = createRef();
|
|
14
|
-
this.setBg =
|
|
14
|
+
this.setBg = debounce(() => {
|
|
15
15
|
var _a, _b;
|
|
16
16
|
if (this.ref && this.ref.current) {
|
|
17
17
|
const bg = this.ref.current;
|
|
@@ -6,5 +6,10 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
|
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
7
|
containerClassName?: string;
|
|
8
8
|
}
|
|
9
|
+
export interface DeviceSpecificFragmentProps extends QAProps {
|
|
10
|
+
disableWebp: boolean;
|
|
11
|
+
src: string;
|
|
12
|
+
breakpoint: number;
|
|
13
|
+
}
|
|
9
14
|
declare const Image: (props: ImageProps) => JSX.Element | null;
|
|
10
15
|
export default Image;
|
|
@@ -8,6 +8,9 @@ import i18n from './i18n';
|
|
|
8
8
|
const checkWebP = (src) => {
|
|
9
9
|
return src.endsWith('.webp') ? src : src + '.webp';
|
|
10
10
|
};
|
|
11
|
+
const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (React.createElement(Fragment, null,
|
|
12
|
+
!disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", media: `(max-width: ${breakpoint}px)`, "data-qa": `${qa}-compressed` })),
|
|
13
|
+
React.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
|
|
11
14
|
const Image = (props) => {
|
|
12
15
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
13
16
|
const { src: imageSrc, alt = i18n('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa, } = props;
|
|
@@ -16,19 +19,15 @@ const Image = (props) => {
|
|
|
16
19
|
if (!src) {
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
19
|
-
const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', '
|
|
22
|
+
const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'desktop-source-compressed');
|
|
20
23
|
const disableWebp = projectSettings.disableCompress ||
|
|
21
24
|
disableCompress ||
|
|
22
25
|
!isCompressible(src) ||
|
|
23
26
|
imgLoadingError;
|
|
24
27
|
return (React.createElement("picture", { className: containerClassName, "data-qa": qa },
|
|
25
|
-
mobile && (React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
tablet && (React.createElement(Fragment, null,
|
|
29
|
-
!disableWebp && (React.createElement("source", { srcSet: checkWebP(tablet), type: "image/webp", media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletWebpSource })),
|
|
30
|
-
React.createElement("source", { srcSet: tablet, media: `(max-width: ${BREAKPOINTS.md}px)`, "data-qa": qaAttributes.tabletSource }))),
|
|
31
|
-
src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.displaySource })),
|
|
28
|
+
mobile && (React.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
|
|
29
|
+
tablet && (React.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
|
|
30
|
+
src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })),
|
|
32
31
|
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
33
32
|
};
|
|
34
33
|
export default Image;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
3
|
import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
4
4
|
import { MapsContext } from '../../context/mapsContext/mapsContext';
|
|
5
5
|
import { MobileContext } from '../../context/mobileContext';
|
|
@@ -20,7 +20,7 @@ const GoogleMap = (props) => {
|
|
|
20
20
|
const ref = useRef(null);
|
|
21
21
|
const src = useMemo(() => getScriptSrc({ apiKey, scriptSrc, address, lang, zoom }), [apiKey, scriptSrc, address, lang, zoom]);
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
const updateSize =
|
|
23
|
+
const updateSize = debounce(() => {
|
|
24
24
|
if (ref.current) {
|
|
25
25
|
setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));
|
|
26
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Spin } from '@gravity-ui/uikit';
|
|
3
|
-
import
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
4
|
import { LocaleContext } from '../../../context/localeContext/localeContext';
|
|
5
5
|
import { MapsContext } from '../../../context/mapsContext/mapsContext';
|
|
6
6
|
import { MobileContext } from '../../../context/mobileContext';
|
|
@@ -47,7 +47,7 @@ const YandexMap = (props) => {
|
|
|
47
47
|
})();
|
|
48
48
|
}, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
|
|
49
49
|
useEffect(() => {
|
|
50
|
-
const updateSize =
|
|
50
|
+
const updateSize = debounce(() => {
|
|
51
51
|
if (ref.current) {
|
|
52
52
|
setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));
|
|
53
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
3
|
import { animated, config, useSpring } from 'react-spring';
|
|
4
4
|
import SliderBlock from '../../../blocks/Slider/Slider';
|
|
5
5
|
import { SliderType } from '../../../models';
|
|
@@ -23,7 +23,7 @@ const Image = (props) => {
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
if (parallax) {
|
|
25
25
|
const handleScroll = () => setScrollY(window.scrollY);
|
|
26
|
-
const debouncedHandler =
|
|
26
|
+
const debouncedHandler = debounce(handleScroll, 5);
|
|
27
27
|
window.addEventListener('scroll', debouncedHandler, { passive: true });
|
|
28
28
|
return () => window.removeEventListener('scroll', debouncedHandler);
|
|
29
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
3
|
import { ToggleArrow } from '..';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import './OverflowScroller.css';
|
|
@@ -17,7 +17,7 @@ export default class OverflowScroller extends React.Component {
|
|
|
17
17
|
this.containerRef = createRef();
|
|
18
18
|
this.wrapperRef = createRef();
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/member-ordering, react/sort-comp
|
|
20
|
-
this.checkOverflow =
|
|
20
|
+
this.checkOverflow = debounce(() => {
|
|
21
21
|
if (this.containerRef &&
|
|
22
22
|
this.containerRef.current &&
|
|
23
23
|
this.wrapperRef &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
|
3
|
-
import
|
|
3
|
+
import debounce from 'lodash/debounce';
|
|
4
4
|
import ReactPlayer from 'react-player';
|
|
5
5
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
@@ -75,7 +75,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
75
75
|
}
|
|
76
76
|
}, [elapsedTime, playerRef, started]);
|
|
77
77
|
useEffect(() => {
|
|
78
|
-
const updateSize =
|
|
78
|
+
const updateSize = debounce(() => {
|
|
79
79
|
if (ref.current) {
|
|
80
80
|
// We need to get parent's width does not equal 0
|
|
81
81
|
const parentElement = getParentElement(ref.current);
|