@gravity-ui/page-constructor 6.0.0-alpha.2 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Swiper } from 'swiper/react';
|
|
2
|
+
import { Swiper as SwiperReact } from 'swiper/react';
|
|
3
3
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
4
|
import 'swiper/swiper-bundle.css';
|
|
5
|
-
export
|
|
5
|
+
export type { Swiper, SwiperOptions } from 'swiper';
|
|
6
|
+
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
6
7
|
type?: string;
|
|
7
8
|
anchorId?: string;
|
|
8
9
|
dotsClassName?: string;
|
|
@@ -5,6 +5,7 @@ export { default as MediaBlock } from './Media/Media';
|
|
|
5
5
|
export { default as MapBlock } from './Map/Map';
|
|
6
6
|
export { default as SliderOldBlock } from './SliderOld/SliderOld';
|
|
7
7
|
export { default as SliderBlock } from './Slider/Slider';
|
|
8
|
+
export type { Swiper, SwiperOptions } from './Slider/Slider';
|
|
8
9
|
export { default as ExtendedFeaturesBlock } from './ExtendedFeatures/ExtendedFeatures';
|
|
9
10
|
export { default as PromoFeaturesBlock } from './PromoFeaturesBlock/PromoFeaturesBlock';
|
|
10
11
|
export { default as QuestionsBlock } from './Questions/Questions';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Swiper } from 'swiper/react';
|
|
2
|
+
import { Swiper as SwiperReact } from 'swiper/react';
|
|
3
3
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
4
|
import './Slider.css';
|
|
5
5
|
import 'swiper/swiper-bundle.css';
|
|
6
|
-
export
|
|
6
|
+
export type { Swiper, SwiperOptions } from 'swiper';
|
|
7
|
+
export interface SliderProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
7
8
|
type?: string;
|
|
8
9
|
anchorId?: string;
|
|
9
10
|
dotsClassName?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
2
|
+
import Swiper, { A11y, Autoplay, Pagination } from 'swiper';
|
|
3
|
+
import { Swiper as SwiperReact, SwiperSlide } from 'swiper/react';
|
|
4
4
|
import Anchor from '../../components/Anchor/Anchor';
|
|
5
5
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
6
6
|
import Title from '../../components/Title/Title';
|
|
@@ -13,7 +13,7 @@ import { useSliderPagination } from './useSliderPagination';
|
|
|
13
13
|
import './Slider.css';
|
|
14
14
|
import 'swiper/swiper-bundle.css';
|
|
15
15
|
const b = block('SliderBlock');
|
|
16
|
-
|
|
16
|
+
Swiper.use([Autoplay, A11y, Pagination]);
|
|
17
17
|
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, }) => {
|
|
18
18
|
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, onImagesReady, onPrev, onNext, setIsLocked, } = useSlider({
|
|
19
19
|
slidesToShow,
|
|
@@ -40,7 +40,7 @@ export const SliderBlock = ({ animated, title, description, type, anchorId, arro
|
|
|
40
40
|
anchorId && React.createElement(Anchor, { id: anchorId }),
|
|
41
41
|
React.createElement(Title, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
42
42
|
React.createElement(AnimateBlock, { className: b('animate-slides'), animate: animated },
|
|
43
|
-
React.createElement(
|
|
43
|
+
React.createElement(SwiperReact, Object.assign({ 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), onImagesReady: onImagesReady, watchSlidesVisibility: true, watchOverflow: true, a11y: {
|
|
44
44
|
slideLabelMessage: '',
|
|
45
45
|
paginationBulletMessage: i18n('dot-label', { index: '{{index}}' }),
|
|
46
46
|
} }, paginationProps), React.Children.map(children, (elem, index) => (React.createElement(SwiperSlide, { className: b('slide'), key: index }, ({ isVisible }) => (React.createElement("div", { className: b('slide-item'), "aria-hidden": !isA11yControlHidden && !isVisible }, elem)))))),
|
|
@@ -5,6 +5,7 @@ export { default as MediaBlock } from './Media/Media';
|
|
|
5
5
|
export { default as MapBlock } from './Map/Map';
|
|
6
6
|
export { default as SliderOldBlock } from './SliderOld/SliderOld';
|
|
7
7
|
export { default as SliderBlock } from './Slider/Slider';
|
|
8
|
+
export type { Swiper, SwiperOptions } from './Slider/Slider';
|
|
8
9
|
export { default as ExtendedFeaturesBlock } from './ExtendedFeatures/ExtendedFeatures';
|
|
9
10
|
export { default as PromoFeaturesBlock } from './PromoFeaturesBlock/PromoFeaturesBlock';
|
|
10
11
|
export { default as QuestionsBlock } from './Questions/Questions';
|