@gravity-ui/page-constructor 7.22.0 → 8.0.0-alpha.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/_vendor/swiper-modules.js +1309 -0
- package/build/cjs/_vendor/swiper-modules.js.map +7 -0
- package/build/cjs/_vendor/swiper-react.js +4651 -0
- package/build/cjs/_vendor/swiper-react.js.map +7 -0
- package/build/cjs/_vendor/swiper.js +3822 -0
- package/build/cjs/_vendor/swiper.js.map +7 -0
- package/build/cjs/blocks/CardLayout/CardLayout.css +6 -0
- package/build/cjs/blocks/CardLayout/CardLayout.d.ts +1 -1
- package/build/cjs/blocks/CardLayout/CardLayout.js +2 -2
- package/build/cjs/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/cjs/blocks/Slider/Slider.d.ts +6 -4
- package/build/cjs/blocks/Slider/Slider.js +7 -7
- package/build/cjs/blocks/Slider/Slider.js.map +1 -1
- package/build/cjs/blocks/Slider/useSlider.d.ts +1 -2
- package/build/cjs/blocks/Slider/useSlider.js +3 -7
- package/build/cjs/blocks/Slider/useSlider.js.map +1 -1
- package/build/cjs/blocks/Slider/useSliderPagination.d.ts +1 -1
- package/build/cjs/blocks/Slider/useSliderPagination.js.map +1 -1
- package/build/cjs/blocks/Slider/utils.d.ts +1 -1
- package/build/cjs/blocks/Slider/utils.js.map +1 -1
- package/build/cjs/components/Title/Title.d.ts +3 -2
- package/build/cjs/components/Title/Title.js +2 -2
- package/build/cjs/components/Title/Title.js.map +1 -1
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/node_modules/swiper/modules/a11y.css +9 -0
- package/build/cjs/node_modules/swiper/modules/autoplay.css +0 -0
- package/build/cjs/node_modules/swiper/modules/index.js +1309 -0
- package/build/cjs/node_modules/swiper/modules/pagination.css +181 -0
- package/build/cjs/node_modules/swiper/package.json +14 -0
- package/build/cjs/node_modules/swiper/swiper-react.d.ts +497 -0
- package/build/cjs/node_modules/swiper/swiper-react.js +4651 -0
- package/build/cjs/node_modules/swiper/swiper.css +229 -0
- package/build/cjs/node_modules/swiper/swiper.d.ts +5 -0
- package/build/cjs/node_modules/swiper/swiper.js +3822 -0
- package/build/cjs/node_modules/swiper/types/index.d.ts +6 -0
- package/build/cjs/node_modules/swiper/types/modules/index.d.ts +53 -0
- package/build/esm/blocks/CardLayout/CardLayout.css +6 -0
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +1 -1
- package/build/esm/blocks/CardLayout/CardLayout.js +3 -3
- package/build/esm/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/esm/blocks/Slider/Slider.d.ts +6 -4
- package/build/esm/blocks/Slider/Slider.js +7 -7
- package/build/esm/blocks/Slider/Slider.js.map +1 -1
- package/build/esm/blocks/Slider/useSlider.d.ts +2 -3
- package/build/esm/blocks/Slider/useSlider.js +3 -7
- package/build/esm/blocks/Slider/useSlider.js.map +1 -1
- package/build/esm/blocks/Slider/useSliderPagination.d.ts +1 -1
- package/build/esm/blocks/Slider/useSliderPagination.js.map +1 -1
- package/build/esm/blocks/Slider/utils.d.ts +1 -1
- package/build/esm/blocks/Slider/utils.js.map +1 -1
- package/build/esm/components/Title/Title.d.ts +3 -2
- package/build/esm/components/Title/Title.js +2 -2
- package/build/esm/components/Title/Title.js.map +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +1 -0
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/package.json +4 -2
- package/server/models/constructor-items/blocks.d.ts +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SwiperModule } from '../shared.d.ts';
|
|
2
|
+
|
|
3
|
+
declare const A11y: SwiperModule;
|
|
4
|
+
declare const Autoplay: SwiperModule;
|
|
5
|
+
declare const Controller: SwiperModule;
|
|
6
|
+
declare const EffectCoverflow: SwiperModule;
|
|
7
|
+
declare const EffectCube: SwiperModule;
|
|
8
|
+
declare const EffectFade: SwiperModule;
|
|
9
|
+
declare const EffectFlip: SwiperModule;
|
|
10
|
+
declare const EffectCreative: SwiperModule;
|
|
11
|
+
declare const EffectCards: SwiperModule;
|
|
12
|
+
declare const HashNavigation: SwiperModule;
|
|
13
|
+
declare const History: SwiperModule;
|
|
14
|
+
declare const Keyboard: SwiperModule;
|
|
15
|
+
declare const Lazy: SwiperModule;
|
|
16
|
+
declare const Mousewheel: SwiperModule;
|
|
17
|
+
declare const Navigation: SwiperModule;
|
|
18
|
+
declare const Pagination: SwiperModule;
|
|
19
|
+
declare const Parallax: SwiperModule;
|
|
20
|
+
declare const Scrollbar: SwiperModule;
|
|
21
|
+
declare const Thumbs: SwiperModule;
|
|
22
|
+
declare const Virtual: SwiperModule;
|
|
23
|
+
declare const Zoom: SwiperModule;
|
|
24
|
+
declare const FreeMode: SwiperModule;
|
|
25
|
+
declare const Grid: SwiperModule;
|
|
26
|
+
declare const Manipulation: SwiperModule;
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
A11y,
|
|
30
|
+
Autoplay,
|
|
31
|
+
Controller,
|
|
32
|
+
EffectCoverflow,
|
|
33
|
+
EffectCube,
|
|
34
|
+
EffectFade,
|
|
35
|
+
EffectFlip,
|
|
36
|
+
EffectCreative,
|
|
37
|
+
EffectCards,
|
|
38
|
+
HashNavigation,
|
|
39
|
+
History,
|
|
40
|
+
Keyboard,
|
|
41
|
+
Lazy,
|
|
42
|
+
Mousewheel,
|
|
43
|
+
Navigation,
|
|
44
|
+
Pagination,
|
|
45
|
+
Parallax,
|
|
46
|
+
Scrollbar,
|
|
47
|
+
Thumbs,
|
|
48
|
+
Virtual,
|
|
49
|
+
Zoom,
|
|
50
|
+
FreeMode,
|
|
51
|
+
Grid,
|
|
52
|
+
Manipulation,
|
|
53
|
+
};
|
|
@@ -14,6 +14,12 @@ unpredictable css rules order in build */
|
|
|
14
14
|
padding: 8px 32px 48px;
|
|
15
15
|
margin-top: 24px;
|
|
16
16
|
}
|
|
17
|
+
.pc-card-layout-block__title_centered {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
17
23
|
.pc-card-layout-block__image {
|
|
18
24
|
position: absolute;
|
|
19
25
|
top: 0;
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
import { CardLayoutBlockProps as CardLayoutBlockParams, ClassNameProps } from "../../models/index.js";
|
|
3
3
|
import './CardLayout.css';
|
|
4
4
|
export type CardLayoutBlockProps = React.PropsWithChildren<Omit<CardLayoutBlockParams, 'children'>> & ClassNameProps;
|
|
5
|
-
declare const CardLayout: ({ title, description, animated, colSizes, children, className, titleClassName, background, }: CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const CardLayout: ({ title, description, animated, colSizes, children, className, titleClassName, background, centered, }: CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default CardLayout;
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import isEmpty from "lodash/isEmpty.js";
|
|
4
4
|
import { AnimateBlock, BackgroundImage, Title } from "../../components/index.js";
|
|
5
5
|
import { useTheme } from "../../context/theme/index.js";
|
|
6
|
-
import { Col, Row } from "../../grid/index.js";
|
|
6
|
+
import { Col, GridJustifyContent, Row } from "../../grid/index.js";
|
|
7
7
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
8
8
|
import './CardLayout.css';
|
|
9
9
|
const DEFAULT_SIZES = {
|
|
@@ -12,10 +12,10 @@ const DEFAULT_SIZES = {
|
|
|
12
12
|
md: 4,
|
|
13
13
|
};
|
|
14
14
|
const b = block('card-layout-block');
|
|
15
|
-
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, background, }) => {
|
|
15
|
+
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, background, centered = false, }) => {
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const { border, ...backgroundImageProps } = getThemedValue(background || {}, theme);
|
|
18
|
-
return (_jsxs(AnimateBlock, { className: b(null, className), animate: animated, children: [(title || description) && (_jsx(Title, { title: title, subtitle: description, className: titleClassName })), _jsxs("div", { className: b('content', {
|
|
18
|
+
return (_jsxs(AnimateBlock, { className: b(null, className), animate: animated, children: [(title || description) && (_jsx(Title, { title: title, subtitle: description, className: b('title', { centered }, titleClassName), colJustifyContent: centered ? GridJustifyContent.Center : GridJustifyContent.Start })), _jsxs("div", { className: b('content', {
|
|
19
19
|
'with-background': !isEmpty(background),
|
|
20
20
|
}), children: [_jsx(BackgroundImage, { className: b('image', { border }), ...backgroundImageProps }), _jsx(Row, { children: React.Children.map(children, (child, index) => (_jsx(Col, { sizes: colSizes, className: b('item'), children: child }, index))) })] })] }));
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardLayout.js","sourceRoot":"../../../../src","sources":["blocks/CardLayout/CardLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,OAAO,0BAAuB;AAErC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACtE,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAuB,GAAG,EAAC,4BAAmB;
|
|
1
|
+
{"version":3,"file":"CardLayout.js","sourceRoot":"../../../../src","sources":["blocks/CardLayout/CardLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,OAAO,0BAAuB;AAErC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACtE,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAuB,k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EAC9E,KAAC,GAAG,cACC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,KAAC,GAAG,IAAa,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YACjD,KAAK,IADA,KAAK,CAET,CACT,CAAC,GACA,IACJ,IACK,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport {AnimateBlock, BackgroundImage, Title} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col, GridColumnSizesType, GridJustifyContent, Row} from '../../grid';\nimport {CardLayoutBlockProps as CardLayoutBlockParams, ClassNameProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\n\nimport './CardLayout.scss';\n\nconst DEFAULT_SIZES: GridColumnSizesType = {\n all: 12,\n sm: 6,\n md: 4,\n};\n\nexport type CardLayoutBlockProps = React.PropsWithChildren<\n Omit<CardLayoutBlockParams, 'children'>\n> &\n ClassNameProps;\n\nconst b = block('card-layout-block');\n\nconst CardLayout = ({\n title,\n description,\n animated,\n colSizes = DEFAULT_SIZES,\n children,\n className,\n titleClassName,\n background,\n centered = false,\n}: CardLayoutBlockProps) => {\n const theme = useTheme();\n const {border, ...backgroundImageProps} = getThemedValue(background || {}, theme);\n return (\n <AnimateBlock className={b(null, className)} animate={animated}>\n {(title || description) && (\n <Title\n title={title}\n subtitle={description}\n className={b('title', {centered}, titleClassName)}\n colJustifyContent={\n centered ? GridJustifyContent.Center : GridJustifyContent.Start\n }\n />\n )}\n <div\n className={b('content', {\n 'with-background': !isEmpty(background),\n })}\n >\n <BackgroundImage className={b('image', {border})} {...backgroundImageProps} />\n <Row>\n {React.Children.map(children, (child, index) => (\n <Col key={index} sizes={colSizes} className={b('item')}>\n {child}\n </Col>\n ))}\n </Row>\n </div>\n </AnimateBlock>\n );\n};\n\nexport default CardLayout;\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import 'swiper/css';
|
|
3
|
+
import 'swiper/css/a11y';
|
|
4
|
+
import 'swiper/css/pagination';
|
|
5
|
+
import { Swiper as SwiperReact } from 'swiper/react';
|
|
3
6
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from "../../models/index.js";
|
|
4
7
|
import './Slider.css';
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
8
|
+
export type { Swiper, SwiperOptions } from 'swiper/types';
|
|
9
|
+
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<React.ComponentProps<typeof SwiperReact>, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
8
10
|
type?: string;
|
|
9
11
|
anchorId?: string;
|
|
10
12
|
dotsClassName?: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import 'swiper/css';
|
|
4
|
+
import 'swiper/css/a11y';
|
|
5
|
+
import 'swiper/css/pagination';
|
|
6
|
+
import { A11y, Autoplay, Pagination } from 'swiper/modules';
|
|
7
|
+
import { Swiper as SwiperReact, SwiperSlide } from 'swiper/react';
|
|
5
8
|
import Anchor from "../../components/Anchor/Anchor.js";
|
|
6
9
|
import AnimateBlock from "../../components/AnimateBlock/AnimateBlock.js";
|
|
7
10
|
import Title from "../../components/Title/Title.js";
|
|
@@ -12,12 +15,9 @@ import { i18n } from "./i18n/index.js";
|
|
|
12
15
|
import { useSlider } from "./useSlider.js";
|
|
13
16
|
import { useSliderPagination } from "./useSliderPagination.js";
|
|
14
17
|
import './Slider.css';
|
|
15
|
-
import 'swiper/swiper-bundle.css';
|
|
16
18
|
const b = block('SliderBlock');
|
|
17
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
18
|
-
Swiper.use([Autoplay, A11y, Pagination]);
|
|
19
19
|
export const SliderBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, dots = true, initialSlide = 0, className, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
20
|
-
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper,
|
|
20
|
+
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, onPrev, onNext, setIsLocked } = useSlider({
|
|
21
21
|
slidesToShow,
|
|
22
22
|
children,
|
|
23
23
|
type,
|
|
@@ -40,7 +40,7 @@ export const SliderBlock = ({ animated, title, description, type, anchorId, arro
|
|
|
40
40
|
arrows,
|
|
41
41
|
'without-dots': !dots || isLocked,
|
|
42
42
|
type,
|
|
43
|
-
}, blockClassName), children: [anchorId && _jsx(Anchor, { id: anchorId }), _jsx(Title, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }), _jsxs(AnimateBlock, { className: b('animate-slides'), animate: animated, children: [_jsx(SwiperReact, { className: b('slider', className), onSwiper: onSwiper, speed: 1000, autoplay: autoplay, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false),
|
|
43
|
+
}, blockClassName), children: [anchorId && _jsx(Anchor, { id: anchorId }), _jsx(Title, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }), _jsxs(AnimateBlock, { className: b('animate-slides'), animate: animated, children: [_jsx(SwiperReact, { modules: [Autoplay, A11y, Pagination], className: b('slider', className), onSwiper: onSwiper, speed: 1000, autoplay: autoplay, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false), watchOverflow: true, watchSlidesProgress: true, a11y: {
|
|
44
44
|
slideLabelMessage: '',
|
|
45
45
|
paginationBulletMessage: i18n('dot-label', { index: '{{index}}' }),
|
|
46
46
|
}, ...paginationProps, children: React.Children.map(children, (elem, index) => (_jsx(SwiperSlide, { className: b('slide'), children: ({ isVisible }) => (_jsx("div", { className: b('slide-item'), "aria-hidden": !isA11yControlHidden && !isVisible, children: elem })) }, index))) }), arrows && !isLocked && (_jsx(React.Fragment, { children: _jsxs("div", { "aria-hidden": isA11yControlHidden, children: [_jsx(Arrow, { className: b('arrow', { prev: true }), type: "left", transparent: type === SliderType.HeaderCard, onClick: onPrev, size: arrowSize, extraProps: { tabIndex: controlTabIndex } }), _jsx(Arrow, { className: b('arrow', { next: true }), type: "right", transparent: type === SliderType.HeaderCard, onClick: onNext, size: arrowSize, extraProps: { tabIndex: controlTabIndex } })] }) })), _jsx("div", { className: b('footer'), children: disclaimer ? (_jsx("div", { className: b('disclaimer', { size: disclaimer?.size || 'm' }), children: disclaimer?.text })) : null })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sourceRoot":"../../../../src","sources":["blocks/Slider/Slider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM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C,KAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,EACnC,IAAI,EAAC,OAAO,EACZ,WAAW,EAAE,IAAI,KAAK,UAAU,CAAC,UAAU,EAC3C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,EAAC,QAAQ,EAAE,eAAe,EAAC,GACzC,IACA,GACO,CACpB,EACD,cAAK,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,YACtB,UAAU,CAAC,CAAC,CAAC,CACV,cAAK,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,GAAG,EAAC,CAAC,YAC3D,UAAU,EAAE,IAAI,GACf,CACT,CAAC,CAAC,CAAC,IAAI,GACN,IACK,IACb,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport Swiper, {A11y, Autoplay, Pagination} from 'swiper';\nimport {Swiper as SwiperReact, SwiperSlide} from 'swiper/react';\n\nimport Anchor from '../../components/Anchor/Anchor';\nimport AnimateBlock from '../../components/AnimateBlock/AnimateBlock';\nimport Title from '../../components/Title/Title';\nimport {ClassNameProps, Refable, SliderProps as SliderParams, SliderType} from '../../models';\nimport {block} from '../../utils';\n\nimport Arrow from './Arrow/Arrow';\nimport {i18n} from './i18n';\nimport {useSlider} from './useSlider';\nimport {useSliderPagination} from './useSliderPagination';\n\nimport './Slider.scss';\nimport 'swiper/swiper-bundle.css';\n\nexport type {Swiper, SwiperOptions} from 'swiper';\n\nconst b = block('SliderBlock');\n\nexport interface SliderProps\n extends Omit<SliderParams, 'children'>,\n Partial<\n Pick<\n SwiperReact,\n | 'onSlideChange'\n | 'onSlideChangeTransitionStart'\n | 'onSlideChangeTransitionEnd'\n | 'onActiveIndexChange'\n | 'onBreakpoint'\n >\n >,\n Refable<HTMLDivElement>,\n ClassNameProps {\n type?: string;\n anchorId?: string;\n dotsClassName?: string;\n blockClassName?: string;\n arrowSize?: number;\n initialSlide?: number;\n}\n\n// eslint-disable-next-line react-hooks/rules-of-hooks\nSwiper.use([Autoplay, A11y, Pagination]);\n\nexport const SliderBlock = ({\n animated,\n title,\n description,\n type,\n anchorId,\n arrows = true,\n adaptive,\n autoplay: autoplayMs,\n dots = true,\n initialSlide = 0,\n className,\n dotsClassName,\n disclaimer,\n children,\n blockClassName,\n arrowSize,\n slidesToShow,\n onSlideChange,\n onSlideChangeTransitionStart,\n onSlideChangeTransitionEnd,\n onActiveIndexChange,\n onBreakpoint,\n}: React.PropsWithChildren<SliderProps>) => {\n const {\n autoplay,\n isLocked,\n childrenCount,\n breakpoints,\n onSwiper,\n onImagesReady,\n onPrev,\n onNext,\n setIsLocked,\n } = useSlider({\n slidesToShow,\n children,\n type,\n autoplayMs,\n });\n\n const isA11yControlHidden = Boolean(autoplay);\n const controlTabIndex = isA11yControlHidden ? -1 : 0;\n\n const paginationProps = useSliderPagination({\n enabled: dots,\n isA11yControlHidden,\n controlTabIndex,\n bulletClass: b('dot', dotsClassName),\n bulletActiveClass: b('dot_active'),\n paginationLabel: i18n('pagination-label'),\n });\n\n return (\n <div\n className={b(\n {\n 'one-slide': childrenCount === 1,\n 'only-arrows':\n (!title || (typeof title !== 'string' && !title?.text)) &&\n !description &&\n arrows,\n 'without-dots': !dots || isLocked,\n type,\n },\n blockClassName,\n )}\n >\n {anchorId && <Anchor id={anchorId} />}\n <Title\n title={title}\n subtitle={description}\n className={b('header', {'no-description': !description})}\n />\n <AnimateBlock className={b('animate-slides')} animate={animated}>\n <SwiperReact\n className={b('slider', className)}\n onSwiper={onSwiper}\n speed={1000}\n autoplay={autoplay}\n autoHeight={adaptive}\n initialSlide={initialSlide}\n noSwiping={false}\n breakpoints={breakpoints}\n onSlideChange={onSlideChange}\n onSlideChangeTransitionStart={onSlideChangeTransitionStart}\n onSlideChangeTransitionEnd={onSlideChangeTransitionEnd}\n onActiveIndexChange={onActiveIndexChange}\n onBreakpoint={onBreakpoint}\n onLock={() => setIsLocked(true)}\n onUnlock={() => setIsLocked(false)}\n onImagesReady={onImagesReady}\n watchSlidesVisibility\n watchOverflow\n a11y={{\n slideLabelMessage: '',\n paginationBulletMessage: i18n('dot-label', {index: '{{index}}'}),\n }}\n {...paginationProps}\n >\n {React.Children.map(children, (elem, index) => (\n <SwiperSlide className={b('slide')} key={index}>\n {({isVisible}) => (\n <div\n className={b('slide-item')}\n aria-hidden={!isA11yControlHidden && !isVisible}\n >\n {elem}\n </div>\n )}\n </SwiperSlide>\n ))}\n </SwiperReact>\n {arrows && !isLocked && (\n <React.Fragment>\n <div aria-hidden={isA11yControlHidden}>\n <Arrow\n className={b('arrow', {prev: true})}\n type=\"left\"\n transparent={type === SliderType.HeaderCard}\n onClick={onPrev}\n size={arrowSize}\n extraProps={{tabIndex: controlTabIndex}}\n />\n <Arrow\n className={b('arrow', {next: true})}\n type=\"right\"\n transparent={type === SliderType.HeaderCard}\n onClick={onNext}\n size={arrowSize}\n extraProps={{tabIndex: controlTabIndex}}\n />\n </div>\n </React.Fragment>\n )}\n <div className={b('footer')}>\n {disclaimer ? (\n <div className={b('disclaimer', {size: disclaimer?.size || 'm'})}>\n {disclaimer?.text}\n </div>\n ) : null}\n </div>\n </AnimateBlock>\n </div>\n );\n};\n\nexport default SliderBlock;\n"]}
|
|
1
|
+
{"version":3,"file":"Slider.js","sourceRoot":"../../../../src","sources":["blocks/Slider/Slider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,YAAY,CAAC;AACpB,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,MAAM,IAAI,WAAW,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAEhE,OAAO,M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AAK,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,YACtB,UAAU,CAAC,CAAC,CAAC,CACV,cAAK,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,GAAG,EAAC,CAAC,YAC3D,UAAU,EAAE,IAAI,GACf,CACT,CAAC,CAAC,CAAC,IAAI,GACN,IACK,IACb,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport 'swiper/css';\nimport 'swiper/css/a11y';\nimport 'swiper/css/pagination';\nimport {A11y, Autoplay, Pagination} from 'swiper/modules';\nimport {Swiper as SwiperReact, SwiperSlide} from 'swiper/react';\n\nimport Anchor from '../../components/Anchor/Anchor';\nimport AnimateBlock from '../../components/AnimateBlock/AnimateBlock';\nimport Title from '../../components/Title/Title';\nimport {ClassNameProps, Refable, SliderProps as SliderParams, SliderType} from '../../models';\nimport {block} from '../../utils';\n\nimport Arrow from './Arrow/Arrow';\nimport {i18n} from './i18n';\nimport {useSlider} from './useSlider';\nimport {useSliderPagination} from './useSliderPagination';\n\nimport './Slider.scss';\n\nexport type {Swiper, SwiperOptions} from 'swiper/types';\n\nconst b = block('SliderBlock');\n\nexport interface SliderProps\n extends Omit<SliderParams, 'children'>,\n Partial<\n Pick<\n React.ComponentProps<typeof SwiperReact>,\n | 'onSlideChange'\n | 'onSlideChangeTransitionStart'\n | 'onSlideChangeTransitionEnd'\n | 'onActiveIndexChange'\n | 'onBreakpoint'\n >\n >,\n Refable<HTMLDivElement>,\n ClassNameProps {\n type?: string;\n anchorId?: string;\n dotsClassName?: string;\n blockClassName?: string;\n arrowSize?: number;\n initialSlide?: number;\n}\n\nexport const SliderBlock = ({\n animated,\n title,\n description,\n type,\n anchorId,\n arrows = true,\n adaptive,\n autoplay: autoplayMs,\n dots = true,\n initialSlide = 0,\n className,\n dotsClassName,\n disclaimer,\n children,\n blockClassName,\n arrowSize,\n slidesToShow,\n onSlideChange,\n onSlideChangeTransitionStart,\n onSlideChangeTransitionEnd,\n onActiveIndexChange,\n onBreakpoint,\n}: React.PropsWithChildren<SliderProps>) => {\n const {autoplay, isLocked, childrenCount, breakpoints, onSwiper, onPrev, onNext, setIsLocked} =\n useSlider({\n slidesToShow,\n children,\n type,\n autoplayMs,\n });\n\n const isA11yControlHidden = Boolean(autoplay);\n const controlTabIndex = isA11yControlHidden ? -1 : 0;\n\n const paginationProps = useSliderPagination({\n enabled: dots,\n isA11yControlHidden,\n controlTabIndex,\n bulletClass: b('dot', dotsClassName),\n bulletActiveClass: b('dot_active'),\n paginationLabel: i18n('pagination-label'),\n });\n\n return (\n <div\n className={b(\n {\n 'one-slide': childrenCount === 1,\n 'only-arrows':\n (!title || (typeof title !== 'string' && !title?.text)) &&\n !description &&\n arrows,\n 'without-dots': !dots || isLocked,\n type,\n },\n blockClassName,\n )}\n >\n {anchorId && <Anchor id={anchorId} />}\n <Title\n title={title}\n subtitle={description}\n className={b('header', {'no-description': !description})}\n />\n <AnimateBlock className={b('animate-slides')} animate={animated}>\n <SwiperReact\n modules={[Autoplay, A11y, Pagination]}\n className={b('slider', className)}\n onSwiper={onSwiper}\n speed={1000}\n autoplay={autoplay}\n autoHeight={adaptive}\n initialSlide={initialSlide}\n noSwiping={false}\n breakpoints={breakpoints}\n onSlideChange={onSlideChange}\n onSlideChangeTransitionStart={onSlideChangeTransitionStart}\n onSlideChangeTransitionEnd={onSlideChangeTransitionEnd}\n onActiveIndexChange={onActiveIndexChange}\n onBreakpoint={onBreakpoint}\n onLock={() => setIsLocked(true)}\n onUnlock={() => setIsLocked(false)}\n watchOverflow\n watchSlidesProgress\n a11y={{\n slideLabelMessage: '',\n paginationBulletMessage: i18n('dot-label', {index: '{{index}}'}),\n }}\n {...paginationProps}\n >\n {React.Children.map(children, (elem, index) => (\n <SwiperSlide className={b('slide')} key={index}>\n {({isVisible}) => (\n <div\n className={b('slide-item')}\n aria-hidden={!isA11yControlHidden && !isVisible}\n >\n {elem}\n </div>\n )}\n </SwiperSlide>\n ))}\n </SwiperReact>\n {arrows && !isLocked && (\n <React.Fragment>\n <div aria-hidden={isA11yControlHidden}>\n <Arrow\n className={b('arrow', {prev: true})}\n type=\"left\"\n transparent={type === SliderType.HeaderCard}\n onClick={onPrev}\n size={arrowSize}\n extraProps={{tabIndex: controlTabIndex}}\n />\n <Arrow\n className={b('arrow', {next: true})}\n type=\"right\"\n transparent={type === SliderType.HeaderCard}\n onClick={onNext}\n size={arrowSize}\n extraProps={{tabIndex: controlTabIndex}}\n />\n </div>\n </React.Fragment>\n )}\n <div className={b('footer')}>\n {disclaimer ? (\n <div className={b('disclaimer', {size: disclaimer?.size || 'm'})}>\n {disclaimer?.text}\n </div>\n ) : null}\n </div>\n </AnimateBlock>\n </div>\n );\n};\n\nexport default SliderBlock;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { Swiper } from 'swiper
|
|
2
|
+
import type { Swiper } from 'swiper';
|
|
3
3
|
import { SlidesToShow } from "../../models/index.js";
|
|
4
4
|
type UseSliderProps = React.PropsWithChildren<{
|
|
5
5
|
autoplayMs?: number;
|
|
@@ -11,8 +11,7 @@ export declare const useSlider: ({ children, autoplayMs, type, ...props }: UseSl
|
|
|
11
11
|
onSwiper: React.Dispatch<React.SetStateAction<Swiper | undefined>>;
|
|
12
12
|
onNext: () => void;
|
|
13
13
|
onPrev: () => void;
|
|
14
|
-
|
|
15
|
-
breakpoints: Record<number, import("swiper").SwiperOptions>;
|
|
14
|
+
breakpoints: Record<number, import("swiper/types").SwiperOptions>;
|
|
16
15
|
childrenCount: number;
|
|
17
16
|
isLocked: boolean;
|
|
18
17
|
setIsLocked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -34,18 +34,15 @@ export const useSlider = ({ children, autoplayMs, type, ...props }) => {
|
|
|
34
34
|
}
|
|
35
35
|
slider.slidePrev();
|
|
36
36
|
};
|
|
37
|
-
const handleImagesReady = React.useCallback((localSlider) => {
|
|
38
|
-
setTimeout(() => localSlider.update(), 100);
|
|
39
|
-
}, []);
|
|
40
37
|
React.useEffect(() => {
|
|
41
|
-
if (!slider) {
|
|
38
|
+
if (!slider || !slider.autoplay) {
|
|
42
39
|
return;
|
|
43
40
|
}
|
|
44
41
|
if (autoplayEnabled) {
|
|
45
|
-
slider
|
|
42
|
+
slider?.autoplay?.start();
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
|
-
slider
|
|
45
|
+
slider?.autoplay?.stop();
|
|
49
46
|
}
|
|
50
47
|
}, [slider, autoplayEnabled]);
|
|
51
48
|
return {
|
|
@@ -53,7 +50,6 @@ export const useSlider = ({ children, autoplayMs, type, ...props }) => {
|
|
|
53
50
|
onSwiper: setSlider,
|
|
54
51
|
onNext: handleNext,
|
|
55
52
|
onPrev: handlePrev,
|
|
56
|
-
onImagesReady: handleImagesReady,
|
|
57
53
|
breakpoints,
|
|
58
54
|
childrenCount,
|
|
59
55
|
isLocked,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSlider.js","sourceRoot":"../../../../src","sources":["blocks/Slider/useSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,UAAU,EAAe,8BAAqB;AAEtD,OAAO,EAAC,yBAAyB,EAAE,WAAW,EAAC,mBAAgB;AAQ/D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE;IAChF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACrD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CA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MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;YAClC,OAAO;QACX,CAAC;QAED,MAAM,CAAC,SAAS,EAAE,CAAC;IACvB,CAAC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC9B,OAAO;QACX,CAAC;QAED,IAAI,eAAe,EAAE,CAAC;YAClB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACJ,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE9B,OAAO;QACH,MAAM;QACN,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,UAAU;QAClB,WAAW;QACX,aAAa;QACb,QAAQ;QACR,WAAW;QACX,QAAQ,EAAE,eAAe,IAAI;YACzB,KAAK,EAAE,UAAU;YACjB,oBAAoB,EAAE,KAAK;SAC9B;KACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport type {Swiper} from 'swiper';\n\nimport {SliderType, SlidesToShow} from '../../models';\n\nimport {getSliderResponsiveParams, useMemoized} from './utils';\n\ntype UseSliderProps = React.PropsWithChildren<{\n autoplayMs?: number;\n type?: string;\n slidesToShow?: SlidesToShow;\n}>;\n\nexport const useSlider = ({children, autoplayMs, type, ...props}: UseSliderProps) => {\n const [slider, setSlider] = React.useState<Swiper>();\n const [isLocked, setIsLocked] = React.useState(false);\n const slidesToShow = useMemoized(props.slidesToShow);\n\n const childrenCount = React.Children.count(children);\n\n const autoplayEnabled = autoplayMs !== undefined && autoplayMs > 0;\n\n const breakpoints = React.useMemo(() => {\n return getSliderResponsiveParams({\n contentLength: childrenCount,\n slidesToShow,\n mobileFullscreen: Boolean(\n type && Object.values(SliderType).includes(type as SliderType),\n ),\n });\n }, [slidesToShow, type, childrenCount]);\n\n const handleNext = () => {\n if (!slider) {\n return;\n }\n\n if (slider.isEnd) {\n slider.slideTo(0);\n return;\n }\n\n slider.slideNext();\n };\n\n const handlePrev = () => {\n if (!slider) {\n return;\n }\n\n if (slider.isBeginning) {\n slider.slideTo(childrenCount - 1);\n return;\n }\n\n slider.slidePrev();\n };\n\n React.useEffect(() => {\n if (!slider || !slider.autoplay) {\n return;\n }\n\n if (autoplayEnabled) {\n slider?.autoplay?.start();\n } else {\n slider?.autoplay?.stop();\n }\n }, [slider, autoplayEnabled]);\n\n return {\n slider,\n onSwiper: setSlider,\n onNext: handleNext,\n onPrev: handlePrev,\n breakpoints,\n childrenCount,\n isLocked,\n setIsLocked,\n autoplay: autoplayEnabled && {\n delay: autoplayMs,\n disableOnInteraction: false,\n },\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSliderPagination.js","sourceRoot":"../../../../src","sources":["blocks/Slider/useSliderPagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,mBAAgB;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAOnC,EAAsE,EAAE;IACrE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,EAAC,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAC,GACzF,KAAK,CAAC;IAEV,OAAO;QACH,UAAU,EAAE;YACR,SAAS,EAAE,IAAI;YACf,WAAW;YACX,iBAAiB;SACpB;QACD,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE;YAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAExC,oBAAoB,CAAC,UAAU,EAAE;gBAC7B,IAAI,EAAE,MAAM;gBACZ,aAAa,EAAE,mBAAmB;gBAClC,YAAY,EAAE,eAAe;aAChC,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;YAE/D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;gBAE9D,oBAAoB,CAAC,MAAM,EAAE;oBACzB,IAAI,EAAE,eAAe;oBACrB,aAAa,EAAE,mBAAmB;oBAClC,cAAc,EAAE,QAAQ;oBACxB,QAAQ,EAAE,eAAe;iBAC5B,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useSliderPagination.js","sourceRoot":"../../../../src","sources":["blocks/Slider/useSliderPagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAC,mBAAgB;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAOnC,EAAsE,EAAE;IACrE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,EAAC,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAC,GACzF,KAAK,CAAC;IAEV,OAAO;QACH,UAAU,EAAE;YACR,SAAS,EAAE,IAAI;YACf,WAAW;YACX,iBAAiB;SACpB;QACD,kBAAkB,EAAE,CAAC,MAAM,EAAE,EAAE;YAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YAExC,oBAAoB,CAAC,UAAU,EAAE;gBAC7B,IAAI,EAAE,MAAM;gBACZ,aAAa,EAAE,mBAAmB;gBAClC,YAAY,EAAE,eAAe;aAChC,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;YAE/D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;gBAE9D,oBAAoB,CAAC,MAAM,EAAE;oBACzB,IAAI,EAAE,eAAe;oBACrB,aAAa,EAAE,mBAAmB;oBAClC,cAAc,EAAE,QAAQ;oBACxB,QAAQ,EAAE,eAAe;iBAC5B,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type {SwiperProps} from 'swiper/react';\n\nimport {setElementAtrributes} from './utils';\n\nexport const useSliderPagination = (props: {\n enabled: boolean;\n isA11yControlHidden: boolean;\n controlTabIndex: number;\n bulletClass: string;\n bulletActiveClass: string;\n paginationLabel: string;\n}): Pick<SwiperProps, 'pagination' | 'onPaginationUpdate'> | undefined => {\n if (!props.enabled) {\n return undefined;\n }\n\n const {isA11yControlHidden, controlTabIndex, bulletClass, bulletActiveClass, paginationLabel} =\n props;\n\n return {\n pagination: {\n clickable: true,\n bulletClass,\n bulletActiveClass,\n },\n onPaginationUpdate: (slider) => {\n const pagination = slider.pagination.el;\n\n setElementAtrributes(pagination, {\n role: 'menu',\n 'aria-hidden': isA11yControlHidden,\n 'aria-label': paginationLabel,\n });\n\n const bullets = pagination.querySelectorAll(`.${bulletClass}`);\n\n bullets.forEach((bullet) => {\n const isActive = bullet.classList.contains(bulletActiveClass);\n\n setElementAtrributes(bullet, {\n role: 'menuitemradio',\n 'aria-hidden': isA11yControlHidden,\n 'aria-checked': isActive,\n tabindex: controlTabIndex,\n });\n });\n },\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"../../../../src","sources":["blocks/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AC,MAAM,CACnC,CAAC,GAAG,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,EAAE;QAC7B,6CAA6C;QAC7C,GAAG,CAAC,WAAW,CAAC,cAAuC,CAAC,GAAG,CAAC,CAAC,GAAG;YAC5D,aAAa,EAAE,KAAK;SACvB,CAAC;QACF,OAAO,GAAG,CAAC;IACf,CAAC,EACD,EAAmC,CACtC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC1C,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1B,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CACpF,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,UAAmC,EAAE,EAAE,CAC1F,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,CACtD,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CACjD,CAAC","sourcesContent":["import * as React from 'react';\n\nimport isEqual from 'lodash/isEqual';\nimport pickBy from 'lodash/pickBy';\nimport type {SwiperOptions} from 'swiper/types
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"../../../../src","sources":["blocks/Slider/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,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K,CAAC,EAAE,EAAE;QAC7B,6CAA6C;QAC7C,GAAG,CAAC,WAAW,CAAC,cAAuC,CAAC,GAAG,CAAC,CAAC,GAAG;YAC5D,aAAa,EAAE,KAAK;SACvB,CAAC;QACF,OAAO,GAAG,CAAC;IACf,CAAC,EACD,EAAmC,CACtC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC1C,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC1B,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CACpF,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,UAAmC,EAAE,EAAE,CAC1F,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,CACtD,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CACjD,CAAC","sourcesContent":["import * as React from 'react';\n\nimport isEqual from 'lodash/isEqual';\nimport pickBy from 'lodash/pickBy';\nimport type {SwiperOptions} from 'swiper/types';\n\nimport {BREAKPOINTS} from '../../constants';\n\nimport {SliderBreakpointNames, SliderBreakpointParams, SlidesToShow} from './models';\n\nexport const DEFAULT_SLIDE_BREAKPOINTS = {\n [SliderBreakpointNames.Lg]: 3,\n [SliderBreakpointNames.Md]: 2,\n [SliderBreakpointNames.Sm]: 2,\n [SliderBreakpointNames.Xs]: 1.15,\n};\n\nexport interface GetSlidesToShowParams {\n contentLength: number;\n slidesToShow?: SlidesToShow;\n mobileFullscreen?: boolean;\n}\n\nexport function getSliderResponsiveParams({\n contentLength,\n slidesToShow,\n mobileFullscreen,\n}: GetSlidesToShowParams) {\n let result;\n\n if (typeof slidesToShow === 'number') {\n result = Object.keys(DEFAULT_SLIDE_BREAKPOINTS).reduce(\n (acc, breakpointName) => ({...acc, [breakpointName]: slidesToShow}),\n {} as SliderBreakpointParams,\n );\n } else {\n result = slidesToShow || DEFAULT_SLIDE_BREAKPOINTS;\n }\n\n const showCount = {\n ...DEFAULT_SLIDE_BREAKPOINTS,\n ...pickBy(result, (value) => !isNaN(value)),\n xs: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.xs : 1,\n };\n\n return Object.entries(showCount).reduce(\n (res, [breakpointName, value]) => {\n // eslint-disable-next-line no-param-reassign\n res[BREAKPOINTS[breakpointName as SliderBreakpointNames] + 1] = {\n slidesPerView: value,\n };\n return res;\n },\n {} as Record<number, SwiperOptions>,\n );\n}\n\nexport const useMemoized = <T>(value: T): T => {\n const [memoizedValue, setMemoizedValue] = React.useState(value);\n\n React.useEffect(() => {\n setMemoizedValue((memoized) =>\n value && typeof value === 'object' && isEqual(memoized, value) ? memoized : value,\n );\n }, [value]);\n\n return memoizedValue;\n};\n\nexport const setElementAtrributes = (element: Element, attributes: Record<string, unknown>) =>\n Object.entries(attributes).forEach(([attribute, value]) =>\n element.setAttribute(attribute, String(value)),\n );\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { GridColumnSizesType } from "../../grid/index.js";
|
|
1
|
+
import { GridColumnSizesType, GridJustifyContent } from "../../grid/index.js";
|
|
2
2
|
import { ClassNameProps, TitleProps as TitleParams } from "../../models/index.js";
|
|
3
3
|
import './Title.css';
|
|
4
4
|
export interface TitleProps extends TitleParams {
|
|
5
5
|
colSizes?: GridColumnSizesType;
|
|
6
|
+
colJustifyContent?: GridJustifyContent;
|
|
6
7
|
id?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const Title: ({ title, subtitle, className, colSizes, id, }: TitleProps & ClassNameProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
declare const Title: ({ title, subtitle, className, colSizes, colJustifyContent, id, }: TitleProps & ClassNameProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
10
|
export default Title;
|
|
@@ -5,12 +5,12 @@ import YFMWrapper from "../YFMWrapper/YFMWrapper.js";
|
|
|
5
5
|
import TitleItem from "./TitleItem.js";
|
|
6
6
|
import './Title.css';
|
|
7
7
|
const b = block('title');
|
|
8
|
-
const Title = ({ title, subtitle, className, colSizes = { all: 12, sm: 8 }, id, }) => {
|
|
8
|
+
const Title = ({ title, subtitle, className, colSizes = { all: 12, sm: 8 }, colJustifyContent, id, }) => {
|
|
9
9
|
if (!title && !subtitle) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
const { text, ...titleProps } = !title || typeof title === 'string' ? { text: title } : title;
|
|
13
|
-
return (_jsxs("div", { className: b(null, className), id: id, children: [text && (_jsx(Col, { reset: true, sizes: colSizes, children: _jsx(TitleItem, { text: text, ...titleProps }) })), subtitle && (_jsx(Col, { reset: true, sizes: colSizes, children: _jsx("div", { className: b('description', { titleSize: titleProps?.textSize }), children: _jsx(YFMWrapper, { content: subtitle, modifiers: { constructor: true } }) }) }))] }));
|
|
13
|
+
return (_jsxs("div", { className: b(null, className), id: id, children: [text && (_jsx(Col, { reset: true, sizes: colSizes, ...(colJustifyContent && { justifyContent: colJustifyContent }), children: _jsx(TitleItem, { text: text, ...titleProps }) })), subtitle && (_jsx(Col, { reset: true, sizes: colSizes, ...(colJustifyContent && { justifyContent: colJustifyContent }), children: _jsx("div", { className: b('description', { titleSize: titleProps?.textSize }), children: _jsx(YFMWrapper, { content: subtitle, modifiers: { constructor: true } }) }) }))] }));
|
|
14
14
|
};
|
|
15
15
|
export default Title;
|
|
16
16
|
//# sourceMappingURL=Title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","sourceRoot":"../../../../src","sources":["components/Title/Title.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"Title.js","sourceRoot":"../../../../src","sources":["components/Title/Title.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,GAAG,EAA0C,4BAAmB;AAExE,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,UAAU,oCAAiC;AAElD,OAAO,SAAS,uBAAoB;AAEpC,OAAO,aAAa,CAAC;AAErB,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAQzB,MAAM,KAAK,GAAG,CAAC,EACX,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,GAAG,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAC,EAC3B,iBAAiB,EACjB,EAAE,GACwB,EAAE,EAAE;IAC9B,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,EAAC,IAAI,EAAE,GAAG,UAAU,EAAC,GACvB,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAC,IAAI,EAAE,KAAK,EAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpF,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,aACrC,IAAI,IAAI,CACL,KAAC,GAAG,IACA,KAAK,QACL,KAAK,EAAE,QAAQ,KACX,CAAC,iBAAiB,IAAI,EAAC,cAAc,EAAE,iBAAiB,EAAC,CAAC,YAE9D,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,KAAM,UAAU,GAAI,GACvC,CACT,EACA,QAAQ,IAAI,CACT,KAAC,GAAG,IACA,KAAK,QACL,KAAK,EAAE,QAAQ,KACX,CAAC,iBAAiB,IAAI,EAAC,cAAc,EAAE,iBAAiB,EAAC,CAAC,YAE9D,cAAK,SAAS,EAAE,CAAC,CAAC,aAAa,EAAE,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAC,CAAC,YAC/D,KAAC,UAAU,IAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,GAAI,GAC/D,GACJ,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {Col, GridColumnSizesType, GridJustifyContent} from '../../grid';\nimport {ClassNameProps, TitleItemProps, TitleProps as TitleParams} from '../../models';\nimport {block} from '../../utils';\nimport YFMWrapper from '../YFMWrapper/YFMWrapper';\n\nimport TitleItem from './TitleItem';\n\nimport './Title.scss';\n\nconst b = block('title');\n\nexport interface TitleProps extends TitleParams {\n colSizes?: GridColumnSizesType;\n colJustifyContent?: GridJustifyContent;\n id?: string;\n}\n\nconst Title = ({\n title,\n subtitle,\n className,\n colSizes = {all: 12, sm: 8},\n colJustifyContent,\n id,\n}: TitleProps & ClassNameProps) => {\n if (!title && !subtitle) {\n return null;\n }\n\n const {text, ...titleProps} =\n !title || typeof title === 'string' ? ({text: title} as TitleItemProps) : title;\n\n return (\n <div className={b(null, className)} id={id}>\n {text && (\n <Col\n reset\n sizes={colSizes}\n {...(colJustifyContent && {justifyContent: colJustifyContent})}\n >\n <TitleItem text={text} {...titleProps} />\n </Col>\n )}\n {subtitle && (\n <Col\n reset\n sizes={colSizes}\n {...(colJustifyContent && {justifyContent: colJustifyContent})}\n >\n <div className={b('description', {titleSize: titleProps?.textSize})}>\n <YFMWrapper content={subtitle} modifiers={{constructor: true}} />\n </div>\n </Col>\n )}\n </div>\n );\n};\n\nexport default Title;\n"]}
|
|
@@ -13,7 +13,7 @@ export declare const blockMap: {
|
|
|
13
13
|
"header-block": (props: React.PropsWithChildren<import("./blocks/Header/Header.js").HeaderBlockFullProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
"icons-block": ({ title, description, size, colSizes, items }: import("./models/index.js").IconsBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
"header-slider-block": ({ items, arrows, ...props }: import("./models/index.js").HeaderSliderBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
"card-layout-block": ({ title, description, animated, colSizes, children, className, titleClassName, background, }: import("./blocks/CardLayout/CardLayout.js").CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
"card-layout-block": ({ title, description, animated, colSizes, children, className, titleClassName, background, centered, }: import("./blocks/CardLayout/CardLayout.js").CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
"content-layout-block": (props: import("./models/index.js").ContentLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
"share-block": ({ items, title }: import("./models/index.js").ShareBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
"map-block": ({ map, border, disableShadow, ...props }: import("./models/index.js").MapBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -271,6 +271,7 @@ export interface TabsBlockProps extends Animatable {
|
|
|
271
271
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
272
272
|
title?: TitleItemProps | string;
|
|
273
273
|
titleClassName?: string;
|
|
274
|
+
centered?: boolean;
|
|
274
275
|
description?: string;
|
|
275
276
|
colSizes?: GridColumnSizesType;
|
|
276
277
|
background?: ThemeSupporting<BackgroundImageProps & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":"AA6CA,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;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CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {DeviceSupporting} from '../../utils/breakpoint';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<\n ContentBlockProps,\n 'theme' | 'centered' | 'colSizes' | 'size' | 'title' | 'labels'\n > {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered' | 'labels'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: Omit<MapProps, 'forceAspectRatio' | 'areaMargin' | 'copyrightPosition'>;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme' | 'labels'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable {\n tags: FilterTag[];\n items: FilterItem[];\n title?: TitleItemProps | string;\n description?: string;\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: Omit<ContentBlockProps, 'labels'>;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentLabelProps {\n text: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentLabelsProps {\n labels: ContentLabelProps[];\n size?: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n labels?: ContentLabelProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockBackgroundProps extends Omit<BackgroundImageProps, 'style'> {\n style?: DeviceSupporting<React.CSSProperties>;\n}\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<FormBlockBackgroundProps>;\n customFormNode?: React.ReactNode;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":"AA6CA,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IA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/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {DeviceSupporting} from '../../utils/breakpoint';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<\n ContentBlockProps,\n 'theme' | 'centered' | 'colSizes' | 'size' | 'title' | 'labels'\n > {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered' | 'labels'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: Omit<MapProps, 'forceAspectRatio' | 'areaMargin' | 'copyrightPosition'>;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme' | 'labels'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n centered?: boolean;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable {\n tags: FilterTag[];\n items: FilterItem[];\n title?: TitleItemProps | string;\n description?: string;\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: Omit<ContentBlockProps, 'labels'>;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentLabelProps {\n text: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentLabelsProps {\n labels: ContentLabelProps[];\n size?: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n labels?: ContentLabelProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockBackgroundProps extends Omit<BackgroundImageProps, 'style'> {\n style?: DeviceSupporting<React.CSSProperties>;\n}\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<FormBlockBackgroundProps>;\n customFormNode?: React.ReactNode;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"react-waypoint": "^10.1.0",
|
|
117
117
|
"sanitize-html": "2.12.1",
|
|
118
118
|
"snakecase-keys": "^5.1.0",
|
|
119
|
-
"swiper": "^
|
|
119
|
+
"swiper": "^10.2.0",
|
|
120
120
|
"typograf": "^7.4.1",
|
|
121
121
|
"utility-types": "^3.10.0",
|
|
122
122
|
"uuid": "^9.0.0"
|
|
@@ -170,9 +170,11 @@
|
|
|
170
170
|
"@types/webpack-env": "^1.18.1",
|
|
171
171
|
"@types/youtube-player": "^5.5.11",
|
|
172
172
|
"autoprefixer": "^10.4.14",
|
|
173
|
+
"babel-jest": "^30.2.0",
|
|
173
174
|
"babel-loader": "^8.3.0",
|
|
174
175
|
"css-loader": "^5.2.7",
|
|
175
176
|
"es5-ext": "0.10.53",
|
|
177
|
+
"esbuild": "^0.25.11",
|
|
176
178
|
"eslint": "^8.57.1",
|
|
177
179
|
"eslint-plugin-no-not-accumulator-reassign": "^0.1.0",
|
|
178
180
|
"eslint-plugin-react": "^7.37.4",
|
|
@@ -271,6 +271,7 @@ export interface TabsBlockProps extends Animatable {
|
|
|
271
271
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
272
272
|
title?: TitleItemProps | string;
|
|
273
273
|
titleClassName?: string;
|
|
274
|
+
centered?: boolean;
|
|
274
275
|
description?: string;
|
|
275
276
|
colSizes?: GridColumnSizesType;
|
|
276
277
|
background?: ThemeSupporting<BackgroundImageProps & {
|