@gravity-ui/page-constructor 5.16.1 → 5.17.0
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/Arrow/Arrow.css +62 -0
- package/build/cjs/blocks/SliderNew/Arrow/Arrow.d.ts +9 -0
- package/build/cjs/blocks/SliderNew/Arrow/Arrow.js +13 -0
- package/build/cjs/blocks/SliderNew/Slider.css +819 -0
- package/build/cjs/blocks/SliderNew/Slider.d.ts +13 -0
- package/build/cjs/blocks/SliderNew/Slider.js +44 -0
- package/build/cjs/blocks/SliderNew/i18n/en.json +4 -0
- package/build/cjs/blocks/SliderNew/i18n/index.d.ts +1 -0
- package/build/cjs/blocks/SliderNew/i18n/index.js +9 -0
- package/build/cjs/blocks/SliderNew/i18n/ru.json +4 -0
- package/build/cjs/blocks/SliderNew/models.d.ts +8 -0
- package/build/cjs/blocks/SliderNew/models.js +10 -0
- package/build/cjs/blocks/SliderNew/schema.d.ts +253 -0
- package/build/cjs/blocks/SliderNew/schema.js +80 -0
- package/build/cjs/blocks/SliderNew/useSlider.d.ts +20 -0
- package/build/cjs/blocks/SliderNew/useSlider.js +65 -0
- package/build/cjs/blocks/SliderNew/utils.d.ts +14 -0
- package/build/cjs/blocks/SliderNew/utils.js +31 -0
- package/build/cjs/blocks/unstable.d.ts +1 -0
- package/build/cjs/blocks/unstable.js +8 -0
- package/build/cjs/components/CardBase/CardBase.css +3 -0
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +3 -0
- package/build/cjs/editor/data/templates/slider-new-block.json +46 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +20 -2
- package/build/cjs/models/constructor-items/blocks.js +2 -0
- package/build/cjs/schema/constants.d.ts +2 -1
- package/build/cjs/schema/constants.js +1 -1
- package/build/cjs/schema/validators/blocks.d.ts +1 -0
- package/build/cjs/schema/validators/blocks.js +1 -0
- package/build/cjs/sub-blocks/Quote/Quote.css +3 -0
- package/build/esm/blocks/SliderNew/Arrow/Arrow.css +62 -0
- package/build/esm/blocks/SliderNew/Arrow/Arrow.d.ts +10 -0
- package/build/esm/blocks/SliderNew/Arrow/Arrow.js +11 -0
- package/build/esm/blocks/SliderNew/Slider.css +819 -0
- package/build/esm/blocks/SliderNew/Slider.d.ts +14 -0
- package/build/esm/blocks/SliderNew/Slider.js +40 -0
- package/build/esm/blocks/SliderNew/i18n/en.json +4 -0
- package/build/esm/blocks/SliderNew/i18n/index.d.ts +1 -0
- package/build/esm/blocks/SliderNew/i18n/index.js +5 -0
- package/build/esm/blocks/SliderNew/i18n/ru.json +4 -0
- package/build/esm/blocks/SliderNew/models.d.ts +8 -0
- package/build/esm/blocks/SliderNew/models.js +7 -0
- package/build/esm/blocks/SliderNew/schema.d.ts +253 -0
- package/build/esm/blocks/SliderNew/schema.js +77 -0
- package/build/esm/blocks/SliderNew/useSlider.d.ts +20 -0
- package/build/esm/blocks/SliderNew/useSlider.js +60 -0
- package/build/esm/blocks/SliderNew/utils.d.ts +14 -0
- package/build/esm/blocks/SliderNew/utils.js +26 -0
- package/build/esm/blocks/unstable.d.ts +1 -0
- package/build/esm/blocks/unstable.js +1 -0
- package/build/esm/components/CardBase/CardBase.css +3 -0
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +3 -0
- package/build/esm/editor/data/templates/slider-new-block.json +46 -0
- package/build/esm/models/constructor-items/blocks.d.ts +20 -2
- package/build/esm/models/constructor-items/blocks.js +2 -0
- package/build/esm/schema/constants.d.ts +2 -1
- package/build/esm/schema/constants.js +2 -2
- package/build/esm/schema/validators/blocks.d.ts +1 -0
- package/build/esm/schema/validators/blocks.js +1 -0
- package/build/esm/sub-blocks/Quote/Quote.css +3 -0
- package/package.json +2 -1
- package/server/models/constructor-items/blocks.d.ts +20 -2
- package/server/models/constructor-items/blocks.js +2 -0
- package/styles/mixins.scss +5 -0
- package/widget/index.js +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { Swiper } from 'swiper/react';
|
|
3
|
+
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
|
+
import 'swiper/swiper-bundle.css';
|
|
5
|
+
export interface SliderNewProps extends Omit<SliderParams, 'children'>, Partial<Pick<Swiper, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
6
|
+
type?: string;
|
|
7
|
+
anchorId?: string;
|
|
8
|
+
dotsClassName?: string;
|
|
9
|
+
blockClassName?: string;
|
|
10
|
+
arrowSize?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const SliderNewBlock: ({ animated, title, description, type, anchorId, arrows, adaptive, autoplay: autoplayMs, dots, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }: PropsWithChildren<SliderNewProps>) => JSX.Element;
|
|
13
|
+
export default SliderNewBlock;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SliderNewBlock = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const swiper_1 = tslib_1.__importStar(require("swiper"));
|
|
7
|
+
const react_2 = require("swiper/react");
|
|
8
|
+
const Anchor_1 = tslib_1.__importDefault(require("../../components/Anchor/Anchor"));
|
|
9
|
+
const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
|
|
10
|
+
const Title_1 = tslib_1.__importDefault(require("../../components/Title/Title"));
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const Arrow_1 = tslib_1.__importDefault(require("./Arrow/Arrow"));
|
|
13
|
+
const useSlider_1 = require("./useSlider");
|
|
14
|
+
require("swiper/swiper-bundle.css");
|
|
15
|
+
const b = (0, utils_1.block)('SliderNewBlock');
|
|
16
|
+
swiper_1.default.use([swiper_1.Autoplay, swiper_1.A11y, swiper_1.Pagination]);
|
|
17
|
+
const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, dots = true, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
18
|
+
const { childrenCount, breakpoints, autoplay, onSwiper, onPrev, onNext, isLocked, setIsLocked } = (0, useSlider_1.useSlider)({
|
|
19
|
+
slidesToShow,
|
|
20
|
+
children,
|
|
21
|
+
type,
|
|
22
|
+
autoplayMs,
|
|
23
|
+
});
|
|
24
|
+
return (react_1.default.createElement("div", { className: b({
|
|
25
|
+
'one-slide': childrenCount === 1,
|
|
26
|
+
'only-arrows': !(title === null || title === void 0 ? void 0 : title.text) && !description && arrows,
|
|
27
|
+
'without-dots': !dots || isLocked,
|
|
28
|
+
type,
|
|
29
|
+
}, blockClassName) },
|
|
30
|
+
anchorId && react_1.default.createElement(Anchor_1.default, { id: anchorId }),
|
|
31
|
+
react_1.default.createElement(Title_1.default, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
32
|
+
react_1.default.createElement(AnimateBlock_1.default, { className: b('animate-slides'), animate: animated },
|
|
33
|
+
react_1.default.createElement(react_2.Swiper, { className: b('slider'), onSwiper: onSwiper, pagination: dots && {
|
|
34
|
+
clickable: true,
|
|
35
|
+
bulletClass: b('dot', dotsClassName),
|
|
36
|
+
bulletActiveClass: b('dot_active'),
|
|
37
|
+
}, speed: 1000, autoplay: autoplay, autoHeight: adaptive, initialSlide: 0, noSwiping: false, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false), watchSlidesVisibility: true, watchOverflow: true }, react_1.default.Children.map(children, (elem, index) => (react_1.default.createElement(react_2.SwiperSlide, { className: b('slide'), key: index }, elem)))),
|
|
38
|
+
arrows && !isLocked && (react_1.default.createElement(react_1.Fragment, null,
|
|
39
|
+
react_1.default.createElement(Arrow_1.default, { className: b('arrow', { prev: true }), type: "left", onClick: onPrev, size: arrowSize }),
|
|
40
|
+
react_1.default.createElement(Arrow_1.default, { className: b('arrow', { next: true }), type: "right", onClick: onNext, size: arrowSize }))),
|
|
41
|
+
react_1.default.createElement("div", { className: b('footer') }, disclaimer ? (react_1.default.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))));
|
|
42
|
+
};
|
|
43
|
+
exports.SliderNewBlock = SliderNewBlock;
|
|
44
|
+
exports.default = exports.SliderNewBlock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const i18n: (key: "arrow-right" | "arrow-left", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const cn_1 = require("../../../utils/cn");
|
|
7
|
+
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
|
+
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, `${cn_1.NAMESPACE}SliderNewBlock`);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SliderBreakpointNames = void 0;
|
|
4
|
+
var SliderBreakpointNames;
|
|
5
|
+
(function (SliderBreakpointNames) {
|
|
6
|
+
SliderBreakpointNames["Xs"] = "xs";
|
|
7
|
+
SliderBreakpointNames["Sm"] = "sm";
|
|
8
|
+
SliderBreakpointNames["Md"] = "md";
|
|
9
|
+
SliderBreakpointNames["Lg"] = "lg";
|
|
10
|
+
})(SliderBreakpointNames = exports.SliderBreakpointNames || (exports.SliderBreakpointNames = {}));
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
export declare const SliderNewProps: {
|
|
2
|
+
dots: {
|
|
3
|
+
type: string;
|
|
4
|
+
};
|
|
5
|
+
arrows: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
randomOrder: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
autoplay: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
type: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
adaptive: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
arrowSize: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
animated: {
|
|
24
|
+
animated: {
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
slidesToShow: {
|
|
29
|
+
oneOf: ({
|
|
30
|
+
type: string;
|
|
31
|
+
additionalProperties: boolean;
|
|
32
|
+
properties: {};
|
|
33
|
+
optionName: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: string;
|
|
36
|
+
optionName: string;
|
|
37
|
+
additionalProperties?: undefined;
|
|
38
|
+
properties?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
};
|
|
41
|
+
disclaimer: {
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
required: string[];
|
|
44
|
+
properties: {
|
|
45
|
+
text: {
|
|
46
|
+
type: string;
|
|
47
|
+
contentType: string;
|
|
48
|
+
};
|
|
49
|
+
size: {
|
|
50
|
+
type: string;
|
|
51
|
+
enum: string[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
loadable: {
|
|
56
|
+
additionalProperties: boolean;
|
|
57
|
+
required: string[];
|
|
58
|
+
properties: {
|
|
59
|
+
source: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated
|
|
64
|
+
*/
|
|
65
|
+
minCount: {
|
|
66
|
+
type: string;
|
|
67
|
+
};
|
|
68
|
+
params: {
|
|
69
|
+
type: string;
|
|
70
|
+
patternProperties: {
|
|
71
|
+
'.*': {
|
|
72
|
+
type: string[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
disabled: boolean;
|
|
78
|
+
};
|
|
79
|
+
children: {
|
|
80
|
+
type: string;
|
|
81
|
+
items: {
|
|
82
|
+
$ref: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare const SliderNewBlock: {
|
|
87
|
+
'slider-new-block': {
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
required: never[];
|
|
90
|
+
properties: {
|
|
91
|
+
title: {
|
|
92
|
+
oneOf: ({
|
|
93
|
+
type: string;
|
|
94
|
+
optionName: string;
|
|
95
|
+
} | {
|
|
96
|
+
optionName: string;
|
|
97
|
+
type: string;
|
|
98
|
+
additionalProperties: boolean;
|
|
99
|
+
required: string[];
|
|
100
|
+
properties: {
|
|
101
|
+
text: {
|
|
102
|
+
type: string;
|
|
103
|
+
contentType: string;
|
|
104
|
+
};
|
|
105
|
+
textSize: {
|
|
106
|
+
type: string;
|
|
107
|
+
enum: string[];
|
|
108
|
+
};
|
|
109
|
+
url: {
|
|
110
|
+
type: string;
|
|
111
|
+
};
|
|
112
|
+
urlTitle: {
|
|
113
|
+
type: string;
|
|
114
|
+
};
|
|
115
|
+
resetMargin: {
|
|
116
|
+
type: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
})[];
|
|
120
|
+
};
|
|
121
|
+
description: {
|
|
122
|
+
type: string;
|
|
123
|
+
contentType: string;
|
|
124
|
+
inputType: string;
|
|
125
|
+
};
|
|
126
|
+
dots: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
arrows: {
|
|
130
|
+
type: string;
|
|
131
|
+
};
|
|
132
|
+
randomOrder: {
|
|
133
|
+
type: string;
|
|
134
|
+
};
|
|
135
|
+
autoplay: {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
type: {
|
|
139
|
+
type: string;
|
|
140
|
+
};
|
|
141
|
+
adaptive: {
|
|
142
|
+
type: string;
|
|
143
|
+
};
|
|
144
|
+
arrowSize: {
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
147
|
+
animated: {
|
|
148
|
+
animated: {
|
|
149
|
+
type: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
slidesToShow: {
|
|
153
|
+
oneOf: ({
|
|
154
|
+
type: string;
|
|
155
|
+
additionalProperties: boolean;
|
|
156
|
+
properties: {};
|
|
157
|
+
optionName: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: string;
|
|
160
|
+
optionName: string;
|
|
161
|
+
additionalProperties?: undefined;
|
|
162
|
+
properties?: undefined;
|
|
163
|
+
})[];
|
|
164
|
+
};
|
|
165
|
+
disclaimer: {
|
|
166
|
+
additionalProperties: boolean;
|
|
167
|
+
required: string[];
|
|
168
|
+
properties: {
|
|
169
|
+
text: {
|
|
170
|
+
type: string;
|
|
171
|
+
contentType: string;
|
|
172
|
+
};
|
|
173
|
+
size: {
|
|
174
|
+
type: string;
|
|
175
|
+
enum: string[];
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
loadable: {
|
|
180
|
+
additionalProperties: boolean;
|
|
181
|
+
required: string[];
|
|
182
|
+
properties: {
|
|
183
|
+
source: {
|
|
184
|
+
type: string;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated
|
|
188
|
+
*/
|
|
189
|
+
minCount: {
|
|
190
|
+
type: string;
|
|
191
|
+
};
|
|
192
|
+
params: {
|
|
193
|
+
type: string;
|
|
194
|
+
patternProperties: {
|
|
195
|
+
'.*': {
|
|
196
|
+
type: string[];
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
disabled: boolean;
|
|
202
|
+
};
|
|
203
|
+
children: {
|
|
204
|
+
type: string;
|
|
205
|
+
items: {
|
|
206
|
+
$ref: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
anchor: {
|
|
210
|
+
type: string;
|
|
211
|
+
additionalProperties: boolean;
|
|
212
|
+
required: string[];
|
|
213
|
+
properties: {
|
|
214
|
+
text: {
|
|
215
|
+
type: string;
|
|
216
|
+
contentType: string;
|
|
217
|
+
};
|
|
218
|
+
url: {
|
|
219
|
+
type: string;
|
|
220
|
+
};
|
|
221
|
+
urlTitle: {
|
|
222
|
+
type: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
visible: {
|
|
227
|
+
type: string;
|
|
228
|
+
enum: string[];
|
|
229
|
+
};
|
|
230
|
+
resetPaddings: {
|
|
231
|
+
type: string;
|
|
232
|
+
};
|
|
233
|
+
context: {
|
|
234
|
+
type: string;
|
|
235
|
+
};
|
|
236
|
+
indent: {
|
|
237
|
+
type: string;
|
|
238
|
+
additionalProperties: boolean;
|
|
239
|
+
properties: {
|
|
240
|
+
top: {
|
|
241
|
+
enum: string[];
|
|
242
|
+
};
|
|
243
|
+
bottom: {
|
|
244
|
+
enum: string[];
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
when: {
|
|
249
|
+
type: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SliderNewBlock = exports.SliderNewProps = void 0;
|
|
4
|
+
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const LoadableProps = {
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
required: ['source'],
|
|
8
|
+
properties: {
|
|
9
|
+
source: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
// add loadable sources here if you use it in your project
|
|
12
|
+
// enum: ['my-loadable-source-1', 'my-loadable-source-1'],
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
minCount: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
},
|
|
20
|
+
params: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
patternProperties: {
|
|
23
|
+
'.*': {
|
|
24
|
+
type: ['string', 'number', 'boolean'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
// remove it in your custom validator schema if you use loadable
|
|
30
|
+
disabled: true,
|
|
31
|
+
};
|
|
32
|
+
const DisclaimerProps = {
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
required: ['text'],
|
|
35
|
+
properties: {
|
|
36
|
+
text: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
contentType: 'text',
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
enum: common_1.textSize,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
exports.SliderNewProps = {
|
|
47
|
+
dots: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
},
|
|
50
|
+
arrows: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
},
|
|
53
|
+
randomOrder: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
},
|
|
56
|
+
autoplay: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
},
|
|
62
|
+
adaptive: {
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
},
|
|
65
|
+
arrowSize: {
|
|
66
|
+
type: 'number',
|
|
67
|
+
},
|
|
68
|
+
animated: common_1.AnimatableProps,
|
|
69
|
+
slidesToShow: common_1.sliderSizesObject,
|
|
70
|
+
disclaimer: DisclaimerProps,
|
|
71
|
+
loadable: LoadableProps,
|
|
72
|
+
children: common_1.ChildrenCardsProps,
|
|
73
|
+
};
|
|
74
|
+
exports.SliderNewBlock = {
|
|
75
|
+
'slider-new-block': {
|
|
76
|
+
additionalProperties: false,
|
|
77
|
+
required: [],
|
|
78
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), exports.SliderNewProps), common_1.BlockHeaderProps),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import type { Swiper } from 'swiper';
|
|
3
|
+
import { SlidesToShow } from '../../models';
|
|
4
|
+
export declare const useSlider: ({ children, autoplayMs, type, slidesToShow, }: React.PropsWithChildren<{
|
|
5
|
+
autoplayMs?: number | undefined;
|
|
6
|
+
type?: string | undefined;
|
|
7
|
+
slidesToShow?: SlidesToShow | undefined;
|
|
8
|
+
}>) => {
|
|
9
|
+
slider: Swiper | undefined;
|
|
10
|
+
onSwiper: React.Dispatch<React.SetStateAction<Swiper | undefined>>;
|
|
11
|
+
onNext: () => void;
|
|
12
|
+
onPrev: () => void;
|
|
13
|
+
breakpoints: Record<number, import("swiper").SwiperOptions>;
|
|
14
|
+
childrenCount: number;
|
|
15
|
+
isLocked: boolean;
|
|
16
|
+
setIsLocked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
autoplay: false | {
|
|
18
|
+
delay: number | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSlider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const models_1 = require("../../models");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const useSlider = ({ children, autoplayMs, type, slidesToShow, }) => {
|
|
9
|
+
const [slider, setSlider] = (0, react_1.useState)();
|
|
10
|
+
const [isLocked, setIsLocked] = (0, react_1.useState)(false);
|
|
11
|
+
const childrenCount = react_1.default.Children.count(children);
|
|
12
|
+
const autoplayEnabled = (0, react_1.useMemo)(() => Boolean(autoplayMs), [autoplayMs]);
|
|
13
|
+
const breakpoints = (0, react_1.useMemo)(() => {
|
|
14
|
+
return (0, utils_1.getSliderResponsiveParams)({
|
|
15
|
+
contentLength: childrenCount,
|
|
16
|
+
slidesToShow,
|
|
17
|
+
mobileFullscreen: Boolean(type && Object.values(models_1.SliderType).includes(type)),
|
|
18
|
+
});
|
|
19
|
+
}, [slidesToShow, type, childrenCount]);
|
|
20
|
+
const handleNext = () => {
|
|
21
|
+
if (!slider) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (slider.isEnd) {
|
|
25
|
+
slider.slideTo(0);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
slider.slideNext();
|
|
29
|
+
};
|
|
30
|
+
const handlePrev = () => {
|
|
31
|
+
if (!slider) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (slider.isBeginning) {
|
|
35
|
+
slider.slideTo(childrenCount - 1);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
slider.slidePrev();
|
|
39
|
+
};
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
if (!slider) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (autoplayEnabled) {
|
|
45
|
+
slider.autoplay.start();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
slider.autoplay.stop();
|
|
49
|
+
}
|
|
50
|
+
}, [slider, autoplayEnabled]);
|
|
51
|
+
return {
|
|
52
|
+
slider,
|
|
53
|
+
onSwiper: setSlider,
|
|
54
|
+
onNext: handleNext,
|
|
55
|
+
onPrev: handlePrev,
|
|
56
|
+
breakpoints,
|
|
57
|
+
childrenCount,
|
|
58
|
+
isLocked,
|
|
59
|
+
setIsLocked,
|
|
60
|
+
autoplay: autoplayEnabled && {
|
|
61
|
+
delay: autoplayMs,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.useSlider = useSlider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SwiperOptions } from 'swiper/types/swiper-options';
|
|
2
|
+
import { SlidesToShow } from './models';
|
|
3
|
+
export declare const DEFAULT_SLIDE_BREAKPOINTS: {
|
|
4
|
+
lg: number;
|
|
5
|
+
md: number;
|
|
6
|
+
sm: number;
|
|
7
|
+
xs: number;
|
|
8
|
+
};
|
|
9
|
+
export interface GetSlidesToShowParams {
|
|
10
|
+
contentLength: number;
|
|
11
|
+
slidesToShow?: SlidesToShow;
|
|
12
|
+
mobileFullscreen?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function getSliderResponsiveParams({ contentLength, slidesToShow, mobileFullscreen, }: GetSlidesToShowParams): Record<number, SwiperOptions>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSliderResponsiveParams = exports.DEFAULT_SLIDE_BREAKPOINTS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pickBy_1 = tslib_1.__importDefault(require("lodash/pickBy"));
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const models_1 = require("./models");
|
|
8
|
+
exports.DEFAULT_SLIDE_BREAKPOINTS = {
|
|
9
|
+
[models_1.SliderBreakpointNames.Lg]: 3,
|
|
10
|
+
[models_1.SliderBreakpointNames.Md]: 2,
|
|
11
|
+
[models_1.SliderBreakpointNames.Sm]: 2,
|
|
12
|
+
[models_1.SliderBreakpointNames.Xs]: 1.15,
|
|
13
|
+
};
|
|
14
|
+
function getSliderResponsiveParams({ contentLength, slidesToShow, mobileFullscreen, }) {
|
|
15
|
+
let result;
|
|
16
|
+
if (typeof slidesToShow === 'number') {
|
|
17
|
+
result = Object.keys(exports.DEFAULT_SLIDE_BREAKPOINTS).reduce((acc, breakpointName) => (Object.assign(Object.assign({}, acc), { [breakpointName]: slidesToShow })), {});
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
result = slidesToShow || exports.DEFAULT_SLIDE_BREAKPOINTS;
|
|
21
|
+
}
|
|
22
|
+
const showCount = Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_SLIDE_BREAKPOINTS), (0, pickBy_1.default)(result, (value) => !isNaN(value))), { xs: !mobileFullscreen && contentLength > 1 ? exports.DEFAULT_SLIDE_BREAKPOINTS.xs : 1 });
|
|
23
|
+
return Object.entries(showCount).reduce((res, [breakpointName, value]) => {
|
|
24
|
+
// eslint-disable-next-line no-param-reassign
|
|
25
|
+
res[constants_1.BREAKPOINTS[breakpointName] + 1] = {
|
|
26
|
+
slidesPerView: value,
|
|
27
|
+
};
|
|
28
|
+
return res;
|
|
29
|
+
}, {});
|
|
30
|
+
}
|
|
31
|
+
exports.getSliderResponsiveParams = getSliderResponsiveParams;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SliderNewBlock } from './SliderNew/Slider';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SliderNewBlock = void 0;
|
|
7
|
+
var Slider_1 = require("./SliderNew/Slider");
|
|
8
|
+
Object.defineProperty(exports, "SliderNewBlock", { enumerable: true, get: function () { return __importDefault(Slider_1).default; } });
|
|
@@ -26,6 +26,9 @@ unpredictable css rules order in build */
|
|
|
26
26
|
.slick-slide:not(.slick-active) .pc-card-base-block {
|
|
27
27
|
box-shadow: none;
|
|
28
28
|
}
|
|
29
|
+
.swiper-slide:not(.swiper-slide-visible) .pc-card-base-block {
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
.pc-card-base-block__header {
|
|
31
34
|
position: relative;
|
|
@@ -18,6 +18,7 @@ export declare const blockMap: {
|
|
|
18
18
|
"map-block": ({ map, border, disableShadow, ...props }: import("./models").MapBlockProps) => JSX.Element;
|
|
19
19
|
"filter-block": import("react").FC<import("./models").FilterBlockProps>;
|
|
20
20
|
"form-block": import("react").FC<import("./models").FormBlockProps>;
|
|
21
|
+
"slider-new-block": ({ animated, title, description, type, anchorId, arrows, adaptive, autoplay: autoplayMs, dots, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }: import("react").PropsWithChildren<import("./blocks/SliderNew/Slider").SliderNewProps>) => JSX.Element;
|
|
21
22
|
};
|
|
22
23
|
export declare const subBlockMap: {
|
|
23
24
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.navItemMap = exports.subBlockMap = exports.blockMap = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const blocks_1 = require("./blocks");
|
|
6
|
+
const unstable_1 = require("./blocks/unstable");
|
|
6
7
|
const models_1 = require("./models");
|
|
7
8
|
const NavigationItem_1 = require("./navigation/components/NavigationItem");
|
|
8
9
|
const SocialIcon_1 = tslib_1.__importDefault(require("./navigation/components/SocialIcon/SocialIcon"));
|
|
@@ -27,6 +28,8 @@ exports.blockMap = {
|
|
|
27
28
|
[models_1.BlockType.MapBlock]: blocks_1.MapBlock,
|
|
28
29
|
[models_1.BlockType.FilterBlock]: blocks_1.FilterBlock,
|
|
29
30
|
[models_1.BlockType.FormBlock]: blocks_1.FormBlock,
|
|
31
|
+
// unstable
|
|
32
|
+
[models_1.BlockType.SliderNewBlock]: unstable_1.SliderNewBlock,
|
|
30
33
|
};
|
|
31
34
|
exports.subBlockMap = {
|
|
32
35
|
[models_1.SubBlockType.Divider]: sub_blocks_1.Divider,
|