@doyourjob/gravity-ui-page-constructor 5.31.39 → 5.31.40-b

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.
@@ -1,10 +1,10 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
3
  .pc-quotes-block {
4
- position: relative;
4
+ overflow-x: hidden;
5
5
  }
6
6
  .pc-quotes-block__wrap {
7
- overflow-x: hidden;
7
+ position: relative;
8
8
  }
9
9
  .pc-quotes-block .pc-SliderBlock_only-arrows {
10
10
  padding: 0;
@@ -4,31 +4,22 @@ exports.QuotesBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const theme_1 = require("../../context/theme");
7
+ const grid_1 = require("../../grid");
7
8
  const utils_1 = require("../../utils");
8
9
  const Slider_1 = require("../Slider/Slider");
9
10
  const QuotesItem_1 = tslib_1.__importDefault(require("./QuotesItem/QuotesItem"));
10
11
  const b = (0, utils_1.block)('quotes-block');
11
12
  const QuotesBlock = ({ theme: localTheme, items, background, backgroundColor, }) => {
12
13
  const divRef = (0, react_1.useRef)(null);
13
- const wrapRef = (0, react_1.useRef)(null);
14
14
  const globalTheme = (0, theme_1.useTheme)();
15
15
  const theme = localTheme || globalTheme;
16
16
  (0, react_1.useEffect)(() => {
17
17
  if (!divRef.current)
18
18
  return () => { };
19
19
  const resizeObserver = new ResizeObserver(() => {
20
- var _a, _b, _c, _d, _e, _f, _g, _h;
20
+ var _a, _b, _c;
21
21
  (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.style.removeProperty('--quotes-block-width');
22
- const divWidth = (_b = divRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth;
23
- (_c = divRef.current) === null || _c === void 0 ? void 0 : _c.style.setProperty('--quotes-block-width', `${divWidth}px`);
24
- if (divWidth) {
25
- (_d = wrapRef.current) === null || _d === void 0 ? void 0 : _d.style.setProperty('width', `${window.innerWidth}px`);
26
- const space = (window.innerWidth - divWidth) / 2;
27
- (_e = wrapRef.current) === null || _e === void 0 ? void 0 : _e.style.setProperty('padding-left', `${space}px`);
28
- (_f = wrapRef.current) === null || _f === void 0 ? void 0 : _f.style.setProperty('padding-right', `${space}px`);
29
- (_g = wrapRef.current) === null || _g === void 0 ? void 0 : _g.style.setProperty('margin-left', `-${space}px`);
30
- (_h = wrapRef.current) === null || _h === void 0 ? void 0 : _h.style.setProperty('margin-right', `-${space}px`);
31
- }
22
+ (_b = divRef.current) === null || _b === void 0 ? void 0 : _b.style.setProperty('--quotes-block-width', `${(_c = divRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth}px`);
32
23
  });
33
24
  resizeObserver.observe(divRef.current);
34
25
  return () => {
@@ -44,10 +35,11 @@ const QuotesBlock = ({ theme: localTheme, items, background, backgroundColor, })
44
35
  }
45
36
  return undefined;
46
37
  }, [background, backgroundColor]);
47
- return (react_1.default.createElement("div", { ref: divRef, className: b({ theme }) },
48
- react_1.default.createElement("div", { ref: wrapRef, className: b('wrap') },
49
- react_1.default.createElement(Slider_1.SliderBlock, { slidesToShow: 1, lazyLoad: "progressive", adaptive: false }, items.map((item, index) => (react_1.default.createElement(QuotesItem_1.default, Object.assign({ key: index, theme: theme }, item)))))),
50
- react_1.default.createElement("div", { className: b('bg'), style: backgroundStyle })));
38
+ return (react_1.default.createElement(grid_1.Grid, { className: b({ theme }) },
39
+ react_1.default.createElement(grid_1.Row, null,
40
+ react_1.default.createElement("div", { ref: divRef, className: b('wrap') },
41
+ react_1.default.createElement(Slider_1.SliderBlock, { slidesToShow: 1, lazyLoad: "progressive", adaptive: false }, items.map((item, index) => (react_1.default.createElement(QuotesItem_1.default, Object.assign({ key: index, theme: theme }, item))))),
42
+ react_1.default.createElement("div", { className: b('bg'), style: backgroundStyle })))));
51
43
  };
52
44
  exports.QuotesBlock = QuotesBlock;
53
45
  exports.default = exports.QuotesBlock;
@@ -1,5 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, ClassNameProps, QAProps } from '../../models';
3
- export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren & QAProps;
3
+ export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren & QAProps & {
4
+ withoutGrid?: boolean;
5
+ };
4
6
  declare const BlockBase: (props: BlockBaseFullProps) => JSX.Element;
5
7
  export default BlockBase;
@@ -1,21 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importDefault(require("react"));
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const grid_1 = require("../../grid");
6
6
  const utils_1 = require("../../utils");
7
7
  const Anchor_1 = tslib_1.__importDefault(require("../Anchor/Anchor"));
8
8
  const b = (0, utils_1.block)('block-base');
9
9
  const BlockBase = (props) => {
10
- const { anchor, visibility, indent, backgroundFull, visible, hidden, children, className, resetPaddings, qa, } = props;
10
+ const { anchor, visibility, indent, backgroundFull, visible, hidden, children, className, resetPaddings, qa, withoutGrid, } = props;
11
11
  const { top, bottom } = indent || (resetPaddings ? { top: '0', bottom: '0' } : { top: 'l', bottom: 'l' });
12
12
  const isBackgroundUrl = /^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(backgroundFull || '');
13
13
  const visibilityClasses = (0, utils_1.getBlockVisibilityClasses)(visibility);
14
- return (react_1.default.createElement(grid_1.Col, { className: b(Object.assign({ ['reset-paddings']: resetPaddings, indentTop: top, indentBottom: bottom }, visibilityClasses), className), hidden: hidden, visible: visible, reset: true, qa: qa },
14
+ const render = (0, react_1.useMemo)(() => (react_1.default.createElement(grid_1.Col, { className: b(Object.assign({ ['reset-paddings']: resetPaddings, indentTop: top, indentBottom: bottom }, visibilityClasses), className), hidden: hidden, visible: visible, reset: true, qa: qa },
15
15
  anchor && react_1.default.createElement(Anchor_1.default, { id: anchor.url, className: b('anchor') }),
16
16
  backgroundFull && (react_1.default.createElement("div", { className: b('background-full', { top }), style: isBackgroundUrl
17
17
  ? { backgroundImage: `url(${backgroundFull})` }
18
18
  : { backgroundColor: backgroundFull } })),
19
- children));
19
+ children)), [
20
+ anchor,
21
+ backgroundFull,
22
+ bottom,
23
+ children,
24
+ className,
25
+ hidden,
26
+ isBackgroundUrl,
27
+ qa,
28
+ resetPaddings,
29
+ top,
30
+ visibilityClasses,
31
+ visible,
32
+ ]);
33
+ if (withoutGrid) {
34
+ return render;
35
+ }
36
+ return (react_1.default.createElement(grid_1.Grid, null,
37
+ react_1.default.createElement(grid_1.Row, null, render)));
20
38
  };
21
39
  exports.default = BlockBase;
@@ -12,13 +12,11 @@ const animateContext_1 = require("../../context/animateContext");
12
12
  const innerContext_1 = require("../../context/innerContext");
13
13
  const projectSettingsContext_1 = require("../../context/projectSettingsContext");
14
14
  const theme_1 = require("../../context/theme");
15
- const grid_1 = require("../../grid");
16
15
  const models_1 = require("../../models");
17
16
  const Layout_1 = tslib_1.__importDefault(require("../../navigation/containers/Layout/Layout"));
18
17
  const utils_1 = require("../../utils");
19
18
  const ConstructorBlocks_1 = require("./components/ConstructorBlocks");
20
19
  const ConstructorItem_1 = require("./components/ConstructorItem");
21
- const ConstructorRow_1 = require("./components/ConstructorRow");
22
20
  const b = (0, utils_1.block)('page-constructor');
23
21
  const Constructor = (props) => {
24
22
  const { content: { blocks = [], background } = {}, renderMenu, shouldRenderBlock, navigation, custom, isBranded, microdata, } = props;
@@ -52,8 +50,7 @@ const Constructor = (props) => {
52
50
  react_1.default.createElement(Layout_1.default, { navigation: navigation },
53
51
  renderMenu && renderMenu(),
54
52
  header && (react_1.default.createElement(ConstructorItem_1.ConstructorHeader, { data: header, blockKey: models_1.BlockType.HeaderBlock })),
55
- react_1.default.createElement(grid_1.Grid, null, restBlocks && (react_1.default.createElement(ConstructorRow_1.ConstructorRow, null,
56
- react_1.default.createElement(ConstructorBlocks_1.ConstructorBlocks, { items: restBlocks }))))),
53
+ restBlocks && react_1.default.createElement(ConstructorBlocks_1.ConstructorBlocks, { items: restBlocks })),
57
54
  isBranded && react_1.default.createElement(BrandFooter_1.default, null)))));
58
55
  };
59
56
  exports.Constructor = Constructor;
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
7
7
  const BlockBase_1 = tslib_1.__importDefault(require("../../../../components/BlockBase/BlockBase"));
8
8
  const BlockDecoration_1 = require("../../../../customization/BlockDecoration");
9
+ const models_1 = require("../../../../models");
9
10
  const utils_1 = require("../../../../utils");
10
11
  const b = (0, utils_1.block)('constructor-block');
11
12
  const ConstructorBlock = ({ index = 0, data, children, }) => {
@@ -19,7 +20,8 @@ const ConstructorBlock = ({ index = 0, data, children, }) => {
19
20
  'indent',
20
21
  'backgroundFull',
21
22
  ]), [data]);
23
+ const withoutGrid = data.type === models_1.BlockType.QuotesBlock;
22
24
  return (react_1.default.createElement(BlockDecoration_1.BlockDecoration, Object.assign({ type: type, index: index }, blockBaseProps),
23
- react_1.default.createElement(BlockBase_1.default, Object.assign({ className: b({ type }) }, blockBaseProps), children)));
25
+ react_1.default.createElement(BlockBase_1.default, Object.assign({ className: b({ type }) }, blockBaseProps, { withoutGrid: withoutGrid }), children)));
24
26
  };
25
27
  exports.ConstructorBlock = ConstructorBlock;
@@ -1,10 +1,10 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
3
  .pc-quotes-block {
4
- position: relative;
4
+ overflow-x: hidden;
5
5
  }
6
6
  .pc-quotes-block__wrap {
7
- overflow-x: hidden;
7
+ position: relative;
8
8
  }
9
9
  .pc-quotes-block .pc-SliderBlock_only-arrows {
10
10
  padding: 0;
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useMemo, useRef } from 'react';
2
2
  import { useTheme } from '../../context/theme';
3
+ import { Grid, Row } from '../../grid';
3
4
  import { block } from '../../utils';
4
5
  import { SliderBlock } from '../Slider/Slider';
5
6
  import QuotesItem from './QuotesItem/QuotesItem';
@@ -7,25 +8,15 @@ import './Quotes.css';
7
8
  const b = block('quotes-block');
8
9
  export const QuotesBlock = ({ theme: localTheme, items, background, backgroundColor, }) => {
9
10
  const divRef = useRef(null);
10
- const wrapRef = useRef(null);
11
11
  const globalTheme = useTheme();
12
12
  const theme = localTheme || globalTheme;
13
13
  useEffect(() => {
14
14
  if (!divRef.current)
15
15
  return () => { };
16
16
  const resizeObserver = new ResizeObserver(() => {
17
- var _a, _b, _c, _d, _e, _f, _g, _h;
17
+ var _a, _b, _c;
18
18
  (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.style.removeProperty('--quotes-block-width');
19
- const divWidth = (_b = divRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth;
20
- (_c = divRef.current) === null || _c === void 0 ? void 0 : _c.style.setProperty('--quotes-block-width', `${divWidth}px`);
21
- if (divWidth) {
22
- (_d = wrapRef.current) === null || _d === void 0 ? void 0 : _d.style.setProperty('width', `${window.innerWidth}px`);
23
- const space = (window.innerWidth - divWidth) / 2;
24
- (_e = wrapRef.current) === null || _e === void 0 ? void 0 : _e.style.setProperty('padding-left', `${space}px`);
25
- (_f = wrapRef.current) === null || _f === void 0 ? void 0 : _f.style.setProperty('padding-right', `${space}px`);
26
- (_g = wrapRef.current) === null || _g === void 0 ? void 0 : _g.style.setProperty('margin-left', `-${space}px`);
27
- (_h = wrapRef.current) === null || _h === void 0 ? void 0 : _h.style.setProperty('margin-right', `-${space}px`);
28
- }
19
+ (_b = divRef.current) === null || _b === void 0 ? void 0 : _b.style.setProperty('--quotes-block-width', `${(_c = divRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth}px`);
29
20
  });
30
21
  resizeObserver.observe(divRef.current);
31
22
  return () => {
@@ -41,9 +32,10 @@ export const QuotesBlock = ({ theme: localTheme, items, background, backgroundCo
41
32
  }
42
33
  return undefined;
43
34
  }, [background, backgroundColor]);
44
- return (React.createElement("div", { ref: divRef, className: b({ theme }) },
45
- React.createElement("div", { ref: wrapRef, className: b('wrap') },
46
- React.createElement(SliderBlock, { slidesToShow: 1, lazyLoad: "progressive", adaptive: false }, items.map((item, index) => (React.createElement(QuotesItem, Object.assign({ key: index, theme: theme }, item)))))),
47
- React.createElement("div", { className: b('bg'), style: backgroundStyle })));
35
+ return (React.createElement(Grid, { className: b({ theme }) },
36
+ React.createElement(Row, null,
37
+ React.createElement("div", { ref: divRef, className: b('wrap') },
38
+ React.createElement(SliderBlock, { slidesToShow: 1, lazyLoad: "progressive", adaptive: false }, items.map((item, index) => (React.createElement(QuotesItem, Object.assign({ key: index, theme: theme }, item))))),
39
+ React.createElement("div", { className: b('bg'), style: backgroundStyle })))));
48
40
  };
49
41
  export default QuotesBlock;
@@ -1,6 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, ClassNameProps, QAProps } from '../../models';
3
3
  import './BlockBase.css';
4
- export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren & QAProps;
4
+ export type BlockBaseFullProps = BlockBaseProps & ClassNameProps & PropsWithChildren & QAProps & {
5
+ withoutGrid?: boolean;
6
+ };
5
7
  declare const BlockBase: (props: BlockBaseFullProps) => JSX.Element;
6
8
  export default BlockBase;
@@ -1,19 +1,37 @@
1
- import React from 'react';
2
- import { Col } from '../../grid';
1
+ import React, { useMemo } from 'react';
2
+ import { Col, Grid, Row } from '../../grid';
3
3
  import { block, getBlockVisibilityClasses } from '../../utils';
4
4
  import Anchor from '../Anchor/Anchor';
5
5
  import './BlockBase.css';
6
6
  const b = block('block-base');
7
7
  const BlockBase = (props) => {
8
- const { anchor, visibility, indent, backgroundFull, visible, hidden, children, className, resetPaddings, qa, } = props;
8
+ const { anchor, visibility, indent, backgroundFull, visible, hidden, children, className, resetPaddings, qa, withoutGrid, } = props;
9
9
  const { top, bottom } = indent || (resetPaddings ? { top: '0', bottom: '0' } : { top: 'l', bottom: 'l' });
10
10
  const isBackgroundUrl = /^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(backgroundFull || '');
11
11
  const visibilityClasses = getBlockVisibilityClasses(visibility);
12
- return (React.createElement(Col, { className: b(Object.assign({ ['reset-paddings']: resetPaddings, indentTop: top, indentBottom: bottom }, visibilityClasses), className), hidden: hidden, visible: visible, reset: true, qa: qa },
12
+ const render = useMemo(() => (React.createElement(Col, { className: b(Object.assign({ ['reset-paddings']: resetPaddings, indentTop: top, indentBottom: bottom }, visibilityClasses), className), hidden: hidden, visible: visible, reset: true, qa: qa },
13
13
  anchor && React.createElement(Anchor, { id: anchor.url, className: b('anchor') }),
14
14
  backgroundFull && (React.createElement("div", { className: b('background-full', { top }), style: isBackgroundUrl
15
15
  ? { backgroundImage: `url(${backgroundFull})` }
16
16
  : { backgroundColor: backgroundFull } })),
17
- children));
17
+ children)), [
18
+ anchor,
19
+ backgroundFull,
20
+ bottom,
21
+ children,
22
+ className,
23
+ hidden,
24
+ isBackgroundUrl,
25
+ qa,
26
+ resetPaddings,
27
+ top,
28
+ visibilityClasses,
29
+ visible,
30
+ ]);
31
+ if (withoutGrid) {
32
+ return render;
33
+ }
34
+ return (React.createElement(Grid, null,
35
+ React.createElement(Row, null, render)));
18
36
  };
19
37
  export default BlockBase;
@@ -9,13 +9,11 @@ import { AnimateContext } from '../../context/animateContext';
9
9
  import { InnerContext } from '../../context/innerContext';
10
10
  import { ProjectSettingsContext } from '../../context/projectSettingsContext';
11
11
  import { useTheme } from '../../context/theme';
12
- import { Grid } from '../../grid';
13
12
  import { BlockType, BlockTypes, HeaderBlockTypes, NavigationItemTypes, SubBlockTypes, } from '../../models';
14
13
  import Layout from '../../navigation/containers/Layout/Layout';
15
14
  import { block as cnBlock, getCustomItems, getCustomTypes, getHeaderBlock, getOrderedBlocks, getThemedValue, } from '../../utils';
16
15
  import { ConstructorBlocks } from './components/ConstructorBlocks';
17
16
  import { ConstructorHeader } from './components/ConstructorItem';
18
- import { ConstructorRow } from './components/ConstructorRow';
19
17
  import './PageConstructor.css';
20
18
  const b = cnBlock('page-constructor');
21
19
  export const Constructor = (props) => {
@@ -50,8 +48,7 @@ export const Constructor = (props) => {
50
48
  React.createElement(Layout, { navigation: navigation },
51
49
  renderMenu && renderMenu(),
52
50
  header && (React.createElement(ConstructorHeader, { data: header, blockKey: BlockType.HeaderBlock })),
53
- React.createElement(Grid, null, restBlocks && (React.createElement(ConstructorRow, null,
54
- React.createElement(ConstructorBlocks, { items: restBlocks }))))),
51
+ restBlocks && React.createElement(ConstructorBlocks, { items: restBlocks })),
55
52
  isBranded && React.createElement(BrandFooter, null)))));
56
53
  };
57
54
  export const PageConstructor = (props) => {
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import pick from 'lodash/pick';
3
3
  import BlockBase from '../../../../components/BlockBase/BlockBase';
4
4
  import { BlockDecoration } from '../../../../customization/BlockDecoration';
5
+ import { BlockType, } from '../../../../models';
5
6
  import { block } from '../../../../utils';
6
7
  import './ConstructorBlock.css';
7
8
  const b = block('constructor-block');
@@ -16,6 +17,7 @@ export const ConstructorBlock = ({ index = 0, data, children, }) => {
16
17
  'indent',
17
18
  'backgroundFull',
18
19
  ]), [data]);
20
+ const withoutGrid = data.type === BlockType.QuotesBlock;
19
21
  return (React.createElement(BlockDecoration, Object.assign({ type: type, index: index }, blockBaseProps),
20
- React.createElement(BlockBase, Object.assign({ className: b({ type }) }, blockBaseProps), children)));
22
+ React.createElement(BlockBase, Object.assign({ className: b({ type }) }, blockBaseProps, { withoutGrid: withoutGrid }), children)));
21
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doyourjob/gravity-ui-page-constructor",
3
- "version": "5.31.39",
3
+ "version": "5.31.40-b",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {