@doyourjob/gravity-ui-page-constructor 5.31.101 → 5.31.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/SliderNew/Slider.d.ts +3 -2
- package/build/cjs/blocks/SliderNew/Slider.js +9 -6
- package/build/cjs/blocks/SliderNew/useSlider.d.ts +5 -4
- package/build/cjs/blocks/SliderNew/useSlider.js +5 -6
- package/build/cjs/blocks/SliderNew/useSliderPagination.d.ts +1 -1
- package/build/esm/blocks/SliderNew/Slider.d.ts +3 -2
- package/build/esm/blocks/SliderNew/Slider.js +9 -6
- package/build/esm/blocks/SliderNew/useSlider.d.ts +5 -4
- package/build/esm/blocks/SliderNew/useSlider.js +5 -6
- package/build/esm/blocks/SliderNew/useSliderPagination.d.ts +1 -1
- package/package.json +2 -3
- package/widget/index.js +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
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 SliderNewProps 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;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SliderNewBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const swiper_1 = tslib_1.__importStar(require("swiper"));
|
|
7
7
|
const react_1 = require("swiper/react");
|
|
8
8
|
const Anchor_1 = tslib_1.__importDefault(require("../../components/Anchor/Anchor"));
|
|
9
9
|
const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
|
|
@@ -16,8 +16,10 @@ const useSlider_1 = require("./useSlider");
|
|
|
16
16
|
const useSliderPagination_1 = require("./useSliderPagination");
|
|
17
17
|
require("swiper/swiper-bundle.css");
|
|
18
18
|
const b = (0, utils_1.block)('slider-new-block');
|
|
19
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
+
swiper_1.default.use([swiper_1.Autoplay, swiper_1.A11y, swiper_1.Pagination]);
|
|
19
21
|
const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, infinite = false, dots = true, initialSlide = 0, className, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
20
|
-
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper,
|
|
22
|
+
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, onImagesReady, onPrev, onNext, setIsLocked, } = (0, useSlider_1.useSlider)({
|
|
21
23
|
slidesToShow,
|
|
22
24
|
children,
|
|
23
25
|
type,
|
|
@@ -44,13 +46,14 @@ const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows =
|
|
|
44
46
|
anchorId && React.createElement(Anchor_1.default, { id: anchorId }),
|
|
45
47
|
React.createElement(Title_1.default, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
46
48
|
React.createElement(AnimateBlock_1.default, { className: b('animate-slides'), animate: animated },
|
|
47
|
-
React.createElement(react_1.Swiper, Object.assign({
|
|
49
|
+
React.createElement(react_1.Swiper, Object.assign({ className: b('slider', className), onSwiper: onSwiper, speed: 700, autoplay: autoplay, loop: infinite, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, slidesOffsetBefore: 24, slidesOffsetAfter: 24, 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: {
|
|
48
50
|
slideLabelMessage: '',
|
|
49
51
|
paginationBulletMessage: (0, i18n_1.i18n)('dot-label', { index: '{{index}}' }),
|
|
50
52
|
} }, paginationProps), React.Children.map(children, (elem, index) => (React.createElement(react_1.SwiperSlide, { className: b('slide'), key: index }, ({ isVisible }) => (React.createElement("div", { className: b('slide-item'), "aria-hidden": !isA11yControlHidden && !isVisible }, elem)))))),
|
|
51
|
-
arrows && !isLocked && (React.createElement(
|
|
52
|
-
React.createElement(
|
|
53
|
-
|
|
53
|
+
arrows && !isLocked && (React.createElement(React.Fragment, null,
|
|
54
|
+
React.createElement("div", { "aria-hidden": isA11yControlHidden },
|
|
55
|
+
React.createElement(Arrow_1.default, { className: b('arrow', { prev: true }), type: "left", transparent: type === models_1.SliderType.HeaderCard, onClick: onPrev, size: arrowSize, extraProps: { tabIndex: controlTabIndex } }),
|
|
56
|
+
React.createElement(Arrow_1.default, { className: b('arrow', { next: true }), type: "right", transparent: type === models_1.SliderType.HeaderCard, onClick: onNext, size: arrowSize, extraProps: { tabIndex: controlTabIndex } })))),
|
|
54
57
|
React.createElement("div", { className: b('footer') }, disclaimer ? (React.createElement("div", { className: b('disclaimer', { size: (disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.size) || 'm' }) }, disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.text)) : null))));
|
|
55
58
|
};
|
|
56
59
|
exports.SliderNewBlock = SliderNewBlock;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { Swiper } from 'swiper';
|
|
2
3
|
import { SlidesToShow } from '../../models';
|
|
3
4
|
type UseSliderProps = React.PropsWithChildren<{
|
|
4
5
|
autoplayMs?: number;
|
|
@@ -6,12 +7,12 @@ type UseSliderProps = React.PropsWithChildren<{
|
|
|
6
7
|
slidesToShow?: SlidesToShow;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const useSlider: ({ children, autoplayMs, type, ...props }: UseSliderProps) => {
|
|
9
|
-
slider:
|
|
10
|
-
onSwiper: React.Dispatch<
|
|
10
|
+
slider: Swiper | undefined;
|
|
11
|
+
onSwiper: React.Dispatch<React.SetStateAction<Swiper | undefined>>;
|
|
11
12
|
onNext: () => void;
|
|
12
13
|
onPrev: () => void;
|
|
13
|
-
|
|
14
|
-
breakpoints: Record<number, import("swiper
|
|
14
|
+
onImagesReady: (localSlider: Swiper) => void;
|
|
15
|
+
breakpoints: Record<number, import("swiper").SwiperOptions>;
|
|
15
16
|
childrenCount: number;
|
|
16
17
|
isLocked: boolean;
|
|
17
18
|
setIsLocked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -39,12 +39,11 @@ const useSlider = (_a) => {
|
|
|
39
39
|
}
|
|
40
40
|
slider.slidePrev();
|
|
41
41
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
42
|
+
const handleImagesReady = React.useCallback((localSlider) => {
|
|
43
|
+
setTimeout(() => localSlider.update(), 100);
|
|
44
|
+
}, []);
|
|
46
45
|
React.useEffect(() => {
|
|
47
|
-
if (!slider
|
|
46
|
+
if (!slider) {
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
if (autoplayEnabled) {
|
|
@@ -59,7 +58,7 @@ const useSlider = (_a) => {
|
|
|
59
58
|
onSwiper: setSlider,
|
|
60
59
|
onNext: handleNext,
|
|
61
60
|
onPrev: handlePrev,
|
|
62
|
-
|
|
61
|
+
onImagesReady: handleImagesReady,
|
|
63
62
|
breakpoints,
|
|
64
63
|
childrenCount,
|
|
65
64
|
isLocked,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
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 SliderNewProps 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,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { A11y, Autoplay, Pagination } from 'swiper
|
|
2
|
+
import Swiper, { A11y, Autoplay, Pagination } from 'swiper';
|
|
3
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';
|
|
@@ -13,8 +13,10 @@ import { useSliderPagination } from './useSliderPagination';
|
|
|
13
13
|
import './Slider.css';
|
|
14
14
|
import 'swiper/swiper-bundle.css';
|
|
15
15
|
const b = block('slider-new-block');
|
|
16
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
17
|
+
Swiper.use([Autoplay, A11y, Pagination]);
|
|
16
18
|
export const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, infinite = false, dots = true, initialSlide = 0, className, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
17
|
-
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper,
|
|
19
|
+
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, onImagesReady, onPrev, onNext, setIsLocked, } = useSlider({
|
|
18
20
|
slidesToShow,
|
|
19
21
|
children,
|
|
20
22
|
type,
|
|
@@ -41,13 +43,14 @@ export const SliderNewBlock = ({ animated, title, description, type, anchorId, a
|
|
|
41
43
|
anchorId && React.createElement(Anchor, { id: anchorId }),
|
|
42
44
|
React.createElement(Title, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
43
45
|
React.createElement(AnimateBlock, { className: b('animate-slides'), animate: animated },
|
|
44
|
-
React.createElement(SwiperReact, Object.assign({
|
|
46
|
+
React.createElement(SwiperReact, Object.assign({ className: b('slider', className), onSwiper: onSwiper, speed: 700, autoplay: autoplay, loop: infinite, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, slidesOffsetBefore: 24, slidesOffsetAfter: 24, 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: {
|
|
45
47
|
slideLabelMessage: '',
|
|
46
48
|
paginationBulletMessage: i18n('dot-label', { index: '{{index}}' }),
|
|
47
49
|
} }, 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)))))),
|
|
48
|
-
arrows && !isLocked && (React.createElement(
|
|
49
|
-
React.createElement(
|
|
50
|
-
|
|
50
|
+
arrows && !isLocked && (React.createElement(React.Fragment, null,
|
|
51
|
+
React.createElement("div", { "aria-hidden": isA11yControlHidden },
|
|
52
|
+
React.createElement(Arrow, { className: b('arrow', { prev: true }), type: "left", transparent: type === SliderType.HeaderCard, onClick: onPrev, size: arrowSize, extraProps: { tabIndex: controlTabIndex } }),
|
|
53
|
+
React.createElement(Arrow, { className: b('arrow', { next: true }), type: "right", transparent: type === SliderType.HeaderCard, onClick: onNext, size: arrowSize, extraProps: { tabIndex: controlTabIndex } })))),
|
|
51
54
|
React.createElement("div", { className: b('footer') }, disclaimer ? (React.createElement("div", { className: b('disclaimer', { size: (disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.size) || 'm' }) }, disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.text)) : null))));
|
|
52
55
|
};
|
|
53
56
|
export default SliderNewBlock;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { Swiper } from 'swiper';
|
|
2
3
|
import { SlidesToShow } from '../../models';
|
|
3
4
|
type UseSliderProps = React.PropsWithChildren<{
|
|
4
5
|
autoplayMs?: number;
|
|
@@ -6,12 +7,12 @@ type UseSliderProps = React.PropsWithChildren<{
|
|
|
6
7
|
slidesToShow?: SlidesToShow;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const useSlider: ({ children, autoplayMs, type, ...props }: UseSliderProps) => {
|
|
9
|
-
slider:
|
|
10
|
-
onSwiper: React.Dispatch<
|
|
10
|
+
slider: Swiper | undefined;
|
|
11
|
+
onSwiper: React.Dispatch<React.SetStateAction<Swiper | undefined>>;
|
|
11
12
|
onNext: () => void;
|
|
12
13
|
onPrev: () => void;
|
|
13
|
-
|
|
14
|
-
breakpoints: Record<number, import("swiper
|
|
14
|
+
onImagesReady: (localSlider: Swiper) => void;
|
|
15
|
+
breakpoints: Record<number, import("swiper").SwiperOptions>;
|
|
15
16
|
childrenCount: number;
|
|
16
17
|
isLocked: boolean;
|
|
17
18
|
setIsLocked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -36,12 +36,11 @@ export const useSlider = (_a) => {
|
|
|
36
36
|
}
|
|
37
37
|
slider.slidePrev();
|
|
38
38
|
};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
39
|
+
const handleImagesReady = React.useCallback((localSlider) => {
|
|
40
|
+
setTimeout(() => localSlider.update(), 100);
|
|
41
|
+
}, []);
|
|
43
42
|
React.useEffect(() => {
|
|
44
|
-
if (!slider
|
|
43
|
+
if (!slider) {
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
47
46
|
if (autoplayEnabled) {
|
|
@@ -56,7 +55,7 @@ export const useSlider = (_a) => {
|
|
|
56
55
|
onSwiper: setSlider,
|
|
57
56
|
onNext: handleNext,
|
|
58
57
|
onPrev: handlePrev,
|
|
59
|
-
|
|
58
|
+
onImagesReady: handleImagesReady,
|
|
60
59
|
breakpoints,
|
|
61
60
|
childrenCount,
|
|
62
61
|
isLocked,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doyourjob/gravity-ui-page-constructor",
|
|
3
|
-
"version": "5.31.
|
|
3
|
+
"version": "5.31.103",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"react-waypoint": "^10.1.0",
|
|
114
114
|
"sanitize-html": "2.12.1",
|
|
115
115
|
"snakecase-keys": "^5.1.0",
|
|
116
|
-
"swiper": "
|
|
116
|
+
"swiper": "^6.8.4",
|
|
117
117
|
"typograf": "^6.14.0",
|
|
118
118
|
"utility-types": "^3.10.0",
|
|
119
119
|
"uuid": "^9.0.0"
|
|
@@ -183,7 +183,6 @@
|
|
|
183
183
|
"jest": "^29.3.1",
|
|
184
184
|
"jest-environment-jsdom": "^29.3.1",
|
|
185
185
|
"jest-transform-css": "^6.0.0",
|
|
186
|
-
"jest-transform-stub": "^2.0.0",
|
|
187
186
|
"js-yaml": "^4.1.0",
|
|
188
187
|
"lint-staged": "^11.2.6",
|
|
189
188
|
"markdown-loader": "^6.0.0",
|