@prom-ui/core 0.0.121 → 0.0.130
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/Avatar/cjs/index.development.js +9 -19
- package/Avatar/cjs/index.development.v2.js +9 -19
- package/Avatar/package.json +1 -1
- package/Body/package.json +1 -1
- package/BodyProvider/BodyContext.d.ts +5 -0
- package/BodyProvider/cjs/index.development.js +264 -0
- package/BodyProvider/cjs/index.development.v2.js +264 -0
- package/BodyProvider/cjs/index.production.js +1 -0
- package/BodyProvider/cjs/index.production.v2.js +1 -0
- package/BodyProvider/index.d.ts +9 -0
- package/BodyProvider/index.js +7 -0
- package/BodyProvider/index.v2.js +7 -0
- package/BodyProvider/package.json +12 -0
- package/BodyProvider/useBodyLocale.d.ts +2 -0
- package/Box/package.json +1 -1
- package/Button/cjs/index.development.js +3 -4
- package/Button/cjs/index.development.v2.js +3 -4
- package/Button/package.json +1 -1
- package/ButtonPageUp/cjs/index.development.js +16 -20
- package/ButtonPageUp/cjs/index.development.v2.js +16 -20
- package/ButtonPageUp/cjs/index.production.js +1 -1
- package/ButtonPageUp/cjs/index.production.v2.js +1 -1
- package/ButtonPageUp/package.json +2 -3
- package/Checkbox/cjs/index.development.js +5 -7
- package/Checkbox/cjs/index.development.v2.js +5 -7
- package/Checkbox/package.json +1 -1
- package/Flex/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Icon/package.json +1 -1
- package/Image/package.json +1 -1
- package/ImageEmoji/cjs/index.development.js +7 -8
- package/ImageEmoji/cjs/index.development.v2.js +7 -8
- package/ImageEmoji/package.json +1 -1
- package/Input/package.json +1 -1
- package/InputField/cjs/index.development.js +33 -44
- package/InputField/cjs/index.development.v2.js +33 -44
- package/InputField/cjs/index.production.js +1 -1
- package/InputField/cjs/index.production.v2.js +1 -1
- package/InputField/package.json +1 -1
- package/KeyPress/cjs/index.development.js +8 -11
- package/KeyPress/cjs/index.development.v2.js +8 -11
- package/KeyPress/package.json +1 -1
- package/Line/package.json +1 -1
- package/Link/cjs/index.development.js +0 -1
- package/Link/cjs/index.development.v2.js +0 -1
- package/Link/package.json +1 -1
- package/List/package.json +1 -1
- package/Media/cjs/index.development.js +12 -18
- package/Media/cjs/index.development.v2.js +12 -18
- package/Media/package.json +1 -1
- package/OutsideClick/cjs/index.development.js +4 -7
- package/OutsideClick/cjs/index.development.v2.js +4 -7
- package/OutsideClick/package.json +1 -1
- package/Overlay/cjs/index.development.js +67 -90
- package/Overlay/cjs/index.development.v2.js +67 -90
- package/Overlay/cjs/index.production.js +1 -1
- package/Overlay/cjs/index.production.v2.js +1 -1
- package/Overlay/package.json +2 -3
- package/Picture/package.json +1 -1
- package/PortableOverlay/cjs/index.development.js +19 -20
- package/PortableOverlay/cjs/index.development.v2.js +19 -20
- package/PortableOverlay/package.json +1 -1
- package/Portal/cjs/index.development.js +5 -10
- package/Portal/cjs/index.development.v2.js +5 -10
- package/Portal/package.json +1 -1
- package/QRCode/cjs/index.development.js +8 -8
- package/QRCode/cjs/index.development.v2.js +8 -8
- package/QRCode/package.json +1 -1
- package/Rating/cjs/index.development.js +8 -9
- package/Rating/cjs/index.development.v2.js +8 -9
- package/Rating/package.json +1 -1
- package/SafeQuery/cjs/index.development.js +19 -19
- package/SafeQuery/cjs/index.development.v2.js +19 -19
- package/SafeQuery/cjs/index.production.js +1 -1
- package/SafeQuery/cjs/index.production.v2.js +1 -1
- package/SafeQuery/package.json +1 -1
- package/Scroll/package.json +1 -1
- package/ScrollControls/cjs/index.development.js +37 -51
- package/ScrollControls/cjs/index.development.v2.js +37 -51
- package/ScrollControls/cjs/index.production.js +1 -1
- package/ScrollControls/cjs/index.production.v2.js +1 -1
- package/ScrollControls/package.json +2 -3
- package/SideOverlay/cjs/index.development.js +40 -41
- package/SideOverlay/cjs/index.development.v2.js +40 -41
- package/SideOverlay/cjs/index.production.js +1 -1
- package/SideOverlay/cjs/index.production.v2.js +1 -1
- package/SideOverlay/package.json +2 -3
- package/SimpleSlider/cjs/index.development.js +53 -89
- package/SimpleSlider/cjs/index.development.v2.js +53 -89
- package/SimpleSlider/cjs/index.production.js +1 -1
- package/SimpleSlider/cjs/index.production.v2.js +1 -1
- package/SimpleSlider/package.json +2 -3
- package/Skeleton/cjs/index.development.js +10 -11
- package/Skeleton/cjs/index.development.v2.js +10 -11
- package/Skeleton/package.json +1 -1
- package/Spinner/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextEmoji/cjs/index.development.js +5 -6
- package/TextEmoji/cjs/index.development.v2.js +5 -6
- package/TextEmoji/package.json +1 -1
- package/Tooltip/cjs/index.development.js +53 -55
- package/Tooltip/cjs/index.development.v2.js +53 -55
- package/Tooltip/package.json +1 -1
- package/Tumbler/cjs/index.development.js +5 -7
- package/Tumbler/cjs/index.development.v2.js +5 -7
- package/Tumbler/package.json +1 -1
- package/package.json +6 -3
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var ttag = require('ttag');
|
|
7
6
|
var Swipe = require('react-easy-swipe');
|
|
8
7
|
var classNames = require('classnames');
|
|
9
8
|
require('intersection-observer');
|
|
10
9
|
var Button = require('@prom-ui/core/Button');
|
|
10
|
+
var BodyProvider = require('@prom-ui/core/BodyProvider');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -78,16 +78,13 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
78
78
|
|
|
79
79
|
var useAutoPlay = function (callback, delay) {
|
|
80
80
|
var timeout = React.useRef(null);
|
|
81
|
-
|
|
82
81
|
var stop = function () {
|
|
83
82
|
clearTimeout(timeout.current);
|
|
84
83
|
};
|
|
85
|
-
|
|
86
84
|
var start = function () {
|
|
87
85
|
stop();
|
|
88
86
|
timeout.current = setTimeout(callback, delay);
|
|
89
87
|
};
|
|
90
|
-
|
|
91
88
|
return [start, stop];
|
|
92
89
|
};
|
|
93
90
|
|
|
@@ -104,9 +101,9 @@ var getRatioHolderStyle = function (ratio) {
|
|
|
104
101
|
};
|
|
105
102
|
var getRootStyle = function (_a) {
|
|
106
103
|
var width = _a.width,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
height = _a.height,
|
|
105
|
+
ratio = _a.ratio,
|
|
106
|
+
style = _a.style;
|
|
110
107
|
var hasRatio = isValidRatio(ratio);
|
|
111
108
|
return __assign({
|
|
112
109
|
width: width,
|
|
@@ -117,16 +114,16 @@ var getRootStyle = function (_a) {
|
|
|
117
114
|
};
|
|
118
115
|
var getTrackStyle = function (_a) {
|
|
119
116
|
var index = _a.index,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
childrenCount = _a.childrenCount,
|
|
118
|
+
duration = _a.duration,
|
|
119
|
+
offset = _a.offset;
|
|
123
120
|
var hasOffset = typeof offset === 'number';
|
|
124
121
|
var currentOffset = hasOffset ? offset : 0;
|
|
125
122
|
return {
|
|
126
123
|
transform: "translateX(calc(".concat(index * (100 / childrenCount) * -1, "% + ").concat(currentOffset, "px))"),
|
|
127
124
|
transition: hasOffset ? undefined : "transform ".concat(duration, "ms ease"),
|
|
128
|
-
width: "".concat(childrenCount * 100, "%")
|
|
129
|
-
|
|
125
|
+
width: "".concat(childrenCount * 100, "%")
|
|
126
|
+
// willChange: 'transform',
|
|
130
127
|
};
|
|
131
128
|
};
|
|
132
129
|
|
|
@@ -134,48 +131,44 @@ var css = {"root":"SimpleSlider__root___WuTIM","track":"SimpleSlider__track___G8
|
|
|
134
131
|
|
|
135
132
|
var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
136
133
|
var _b, _c;
|
|
137
|
-
|
|
138
134
|
var _d = _a.autoPlay,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
autoPlay = _d === void 0 ? 0 : _d,
|
|
136
|
+
children = _a.children,
|
|
137
|
+
className = _a.className,
|
|
138
|
+
_e = _a.duration,
|
|
139
|
+
duration = _e === void 0 ? 500 : _e,
|
|
140
|
+
height = _a.height,
|
|
141
|
+
_f = _a.infinite,
|
|
142
|
+
infinite = _f === void 0 ? false : _f,
|
|
143
|
+
ratio = _a.ratio,
|
|
144
|
+
style = _a.style,
|
|
145
|
+
width = _a.width,
|
|
146
|
+
onChangeIndex = _a.onChangeIndex,
|
|
147
|
+
onClickDot = _a.onClickDot,
|
|
148
|
+
onClickItem = _a.onClickItem,
|
|
149
|
+
onClickButtonNext = _a.onClickButtonNext,
|
|
150
|
+
onClickButtonPrev = _a.onClickButtonPrev,
|
|
151
|
+
onSwipeNext = _a.onSwipeNext,
|
|
152
|
+
onSwipePrev = _a.onSwipePrev,
|
|
153
|
+
_g = _a.showOnHoverButtons,
|
|
154
|
+
showOnHoverButtons = _g === void 0 ? false : _g,
|
|
155
|
+
_h = _a.showOnHoverDots,
|
|
156
|
+
showOnHoverDots = _h === void 0 ? false : _h,
|
|
157
|
+
_j = _a.isDotsTransparent,
|
|
158
|
+
isDotsTransparent = _j === void 0 ? false : _j,
|
|
159
|
+
props = __rest(_a, ["autoPlay", "children", "className", "duration", "height", "infinite", "ratio", "style", "width", "onChangeIndex", "onClickDot", "onClickItem", "onClickButtonNext", "onClickButtonPrev", "onSwipeNext", "onSwipePrev", "showOnHoverButtons", "showOnHoverDots", "isDotsTransparent"]);
|
|
160
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
165
161
|
var refTrack = React__namespace.useRef(null);
|
|
166
162
|
var transitionRunning = React__namespace.useRef(false);
|
|
167
|
-
|
|
168
163
|
var _k = React__namespace.useState(false),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
disableAutoPlay = _k[0],
|
|
165
|
+
setDisableAutoPlay = _k[1];
|
|
172
166
|
var _l = React__namespace.useState({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
167
|
+
index: 0,
|
|
168
|
+
offset: undefined
|
|
169
|
+
}),
|
|
170
|
+
position = _l[0],
|
|
171
|
+
setPosition = _l[1];
|
|
179
172
|
var childrenCount = React__namespace.Children.count(children);
|
|
180
173
|
var childrenArray = React__namespace.Children.toArray(children);
|
|
181
174
|
var isDisablePrev = !infinite && position.index === 0;
|
|
@@ -188,124 +181,98 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
188
181
|
var infiniteIndex = getInfiniteIndex(position.index, childrenCount);
|
|
189
182
|
var infinitePrevIndex = getInfiniteIndex(prevIndex, childrenCount);
|
|
190
183
|
var infiniteNextIndex = getInfiniteIndex(nextIndex, childrenCount);
|
|
191
|
-
|
|
192
184
|
var handleClickButtonNext = function () {
|
|
193
185
|
if (transitionRunning.current || isDisableNext) return;
|
|
194
|
-
|
|
195
186
|
if (typeof onClickButtonNext === 'function') {
|
|
196
187
|
onClickButtonNext(infiniteNextIndex);
|
|
197
188
|
}
|
|
198
|
-
|
|
199
189
|
setPosition({
|
|
200
190
|
index: nextIndex,
|
|
201
191
|
offset: undefined
|
|
202
192
|
});
|
|
203
193
|
};
|
|
204
|
-
|
|
205
194
|
var handleClickButtonPrev = function () {
|
|
206
195
|
if (transitionRunning.current || isDisablePrev) return;
|
|
207
|
-
|
|
208
196
|
if (typeof onClickButtonPrev === 'function') {
|
|
209
197
|
onClickButtonPrev(infinitePrevIndex);
|
|
210
198
|
}
|
|
211
|
-
|
|
212
199
|
setPosition({
|
|
213
200
|
index: prevIndex,
|
|
214
201
|
offset: undefined
|
|
215
202
|
});
|
|
216
203
|
};
|
|
217
|
-
|
|
218
204
|
var handleClickDot = function (i) {
|
|
219
205
|
if (transitionRunning.current) return;
|
|
220
|
-
|
|
221
206
|
if (typeof onClickDot === 'function') {
|
|
222
207
|
onClickDot(i);
|
|
223
208
|
}
|
|
224
|
-
|
|
225
209
|
setPosition({
|
|
226
210
|
index: i,
|
|
227
211
|
offset: undefined
|
|
228
212
|
});
|
|
229
213
|
};
|
|
230
|
-
|
|
231
214
|
var handleSwipeNext = function () {
|
|
232
215
|
if (transitionRunning.current || isDisableNext) return;
|
|
233
|
-
|
|
234
216
|
if (typeof onSwipeNext === 'function') {
|
|
235
217
|
onSwipeNext(infiniteNextIndex);
|
|
236
218
|
}
|
|
237
|
-
|
|
238
219
|
setPosition({
|
|
239
220
|
index: nextIndex,
|
|
240
221
|
offset: undefined
|
|
241
222
|
});
|
|
242
223
|
};
|
|
243
|
-
|
|
244
224
|
var handleSwipePrev = function () {
|
|
245
225
|
if (transitionRunning.current || isDisablePrev) return;
|
|
246
|
-
|
|
247
226
|
if (typeof onSwipePrev === 'function') {
|
|
248
227
|
onSwipePrev(infinitePrevIndex);
|
|
249
228
|
}
|
|
250
|
-
|
|
251
229
|
setPosition({
|
|
252
230
|
index: prevIndex,
|
|
253
231
|
offset: undefined
|
|
254
232
|
});
|
|
255
233
|
};
|
|
256
|
-
|
|
257
234
|
var handleSwipeMove = function (_a, event) {
|
|
258
235
|
var x = _a.x;
|
|
259
236
|
if (transitionRunning.current || event.touches && event.touches.length > 1) return;
|
|
260
237
|
var offset = x;
|
|
261
|
-
|
|
262
238
|
if (isDisablePrev && x > 0 || isDisableNext && x < 0) {
|
|
263
239
|
offset = 0;
|
|
264
240
|
}
|
|
265
|
-
|
|
266
241
|
setPosition({
|
|
267
242
|
index: position.index,
|
|
268
243
|
offset: offset
|
|
269
244
|
});
|
|
270
245
|
};
|
|
271
|
-
|
|
272
246
|
var _m = useAutoPlay(function () {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
247
|
+
if (transitionRunning.current || isDisableNext) return;
|
|
248
|
+
setPosition({
|
|
249
|
+
index: nextIndex,
|
|
250
|
+
offset: undefined
|
|
251
|
+
});
|
|
252
|
+
}, autoPlay),
|
|
253
|
+
startAutoPlay = _m[0],
|
|
254
|
+
stopAutoPlay = _m[1];
|
|
282
255
|
var handleTransitionStart = function () {
|
|
283
256
|
transitionRunning.current = true;
|
|
284
257
|
stopAutoPlay();
|
|
285
258
|
};
|
|
286
|
-
|
|
287
259
|
var handleTransitionEnd = function () {
|
|
288
260
|
transitionRunning.current = false;
|
|
289
|
-
|
|
290
261
|
if (isAutoPlay) {
|
|
291
262
|
startAutoPlay();
|
|
292
263
|
}
|
|
293
|
-
|
|
294
264
|
if (!(position.index in childrenArray)) {
|
|
295
265
|
setPosition({
|
|
296
266
|
index: infiniteIndex,
|
|
297
267
|
offset: 0
|
|
298
268
|
});
|
|
299
269
|
}
|
|
300
|
-
|
|
301
270
|
if (typeof onChangeIndex === 'function') {
|
|
302
271
|
onChangeIndex(infiniteIndex);
|
|
303
272
|
}
|
|
304
273
|
};
|
|
305
|
-
|
|
306
274
|
React__namespace.useEffect(function () {
|
|
307
275
|
var _a, _b;
|
|
308
|
-
|
|
309
276
|
var autoPlayObserver = new IntersectionObserver(function (entries) {
|
|
310
277
|
if (entries[0].isIntersecting) {
|
|
311
278
|
startAutoPlay();
|
|
@@ -315,14 +282,11 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
315
282
|
});
|
|
316
283
|
(_a = refTrack.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', handleTransitionStart);
|
|
317
284
|
(_b = refTrack.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', handleTransitionEnd);
|
|
318
|
-
|
|
319
285
|
if (isAutoPlay && refTrack.current) {
|
|
320
286
|
autoPlayObserver.observe(refTrack.current);
|
|
321
287
|
}
|
|
322
|
-
|
|
323
288
|
return function () {
|
|
324
289
|
var _a, _b;
|
|
325
|
-
|
|
326
290
|
(_a = refTrack.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionstart', handleTransitionStart);
|
|
327
291
|
(_b = refTrack.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', handleTransitionEnd);
|
|
328
292
|
stopAutoPlay();
|
|
@@ -384,7 +348,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
384
348
|
className: css.buttonPrev,
|
|
385
349
|
onClick: handleClickButtonPrev,
|
|
386
350
|
disabled: isDisablePrev,
|
|
387
|
-
"aria-label":
|
|
351
|
+
"aria-label": t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"]))),
|
|
388
352
|
"data-qaid": 'prev_image'
|
|
389
353
|
}, React__namespace.createElement("svg", {
|
|
390
354
|
className: css.buttonIcon,
|
|
@@ -399,7 +363,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
399
363
|
className: css.buttonNext,
|
|
400
364
|
onClick: handleClickButtonNext,
|
|
401
365
|
disabled: isDisableNext,
|
|
402
|
-
"aria-label":
|
|
366
|
+
"aria-label": t(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"]))),
|
|
403
367
|
"data-qaid": 'next_image'
|
|
404
368
|
}, React__namespace.createElement("svg", {
|
|
405
369
|
className: css.buttonIcon,
|
|
@@ -423,7 +387,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
423
387
|
return handleClickDot(index);
|
|
424
388
|
},
|
|
425
389
|
disabled: index === infiniteIndex,
|
|
426
|
-
"aria-label":
|
|
390
|
+
"aria-label": t(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u0430\u043D\u043D\u0435\u0440 \u043D\u043E\u043C\u0435\u0440 ", ""], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u0430\u043D\u043D\u0435\u0440 \u043D\u043E\u043C\u0435\u0440 ", ""])), viewIndex),
|
|
427
391
|
"data-qaid": "view_image_".concat(viewIndex)
|
|
428
392
|
}, viewIndex));
|
|
429
393
|
})));
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var ttag = require('ttag');
|
|
7
6
|
var Swipe = require('react-easy-swipe');
|
|
8
7
|
var classNames = require('classnames');
|
|
9
8
|
require('intersection-observer');
|
|
10
9
|
var Button = require('@prom-ui/core/Button');
|
|
10
|
+
var BodyProvider = require('@prom-ui/core/BodyProvider');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -78,16 +78,13 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
78
78
|
|
|
79
79
|
var useAutoPlay = function (callback, delay) {
|
|
80
80
|
var timeout = React.useRef(null);
|
|
81
|
-
|
|
82
81
|
var stop = function () {
|
|
83
82
|
clearTimeout(timeout.current);
|
|
84
83
|
};
|
|
85
|
-
|
|
86
84
|
var start = function () {
|
|
87
85
|
stop();
|
|
88
86
|
timeout.current = setTimeout(callback, delay);
|
|
89
87
|
};
|
|
90
|
-
|
|
91
88
|
return [start, stop];
|
|
92
89
|
};
|
|
93
90
|
|
|
@@ -104,9 +101,9 @@ var getRatioHolderStyle = function (ratio) {
|
|
|
104
101
|
};
|
|
105
102
|
var getRootStyle = function (_a) {
|
|
106
103
|
var width = _a.width,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
height = _a.height,
|
|
105
|
+
ratio = _a.ratio,
|
|
106
|
+
style = _a.style;
|
|
110
107
|
var hasRatio = isValidRatio(ratio);
|
|
111
108
|
return __assign({
|
|
112
109
|
width: width,
|
|
@@ -117,16 +114,16 @@ var getRootStyle = function (_a) {
|
|
|
117
114
|
};
|
|
118
115
|
var getTrackStyle = function (_a) {
|
|
119
116
|
var index = _a.index,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
childrenCount = _a.childrenCount,
|
|
118
|
+
duration = _a.duration,
|
|
119
|
+
offset = _a.offset;
|
|
123
120
|
var hasOffset = typeof offset === 'number';
|
|
124
121
|
var currentOffset = hasOffset ? offset : 0;
|
|
125
122
|
return {
|
|
126
123
|
transform: "translateX(calc(".concat(index * (100 / childrenCount) * -1, "% + ").concat(currentOffset, "px))"),
|
|
127
124
|
transition: hasOffset ? undefined : "transform ".concat(duration, "ms ease"),
|
|
128
|
-
width: "".concat(childrenCount * 100, "%")
|
|
129
|
-
|
|
125
|
+
width: "".concat(childrenCount * 100, "%")
|
|
126
|
+
// willChange: 'transform',
|
|
130
127
|
};
|
|
131
128
|
};
|
|
132
129
|
|
|
@@ -134,48 +131,44 @@ var css = {"root":"SimpleSlider__root___bXdCd","track":"SimpleSlider__track___ig
|
|
|
134
131
|
|
|
135
132
|
var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
136
133
|
var _b, _c;
|
|
137
|
-
|
|
138
134
|
var _d = _a.autoPlay,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
autoPlay = _d === void 0 ? 0 : _d,
|
|
136
|
+
children = _a.children,
|
|
137
|
+
className = _a.className,
|
|
138
|
+
_e = _a.duration,
|
|
139
|
+
duration = _e === void 0 ? 500 : _e,
|
|
140
|
+
height = _a.height,
|
|
141
|
+
_f = _a.infinite,
|
|
142
|
+
infinite = _f === void 0 ? false : _f,
|
|
143
|
+
ratio = _a.ratio,
|
|
144
|
+
style = _a.style,
|
|
145
|
+
width = _a.width,
|
|
146
|
+
onChangeIndex = _a.onChangeIndex,
|
|
147
|
+
onClickDot = _a.onClickDot,
|
|
148
|
+
onClickItem = _a.onClickItem,
|
|
149
|
+
onClickButtonNext = _a.onClickButtonNext,
|
|
150
|
+
onClickButtonPrev = _a.onClickButtonPrev,
|
|
151
|
+
onSwipeNext = _a.onSwipeNext,
|
|
152
|
+
onSwipePrev = _a.onSwipePrev,
|
|
153
|
+
_g = _a.showOnHoverButtons,
|
|
154
|
+
showOnHoverButtons = _g === void 0 ? false : _g,
|
|
155
|
+
_h = _a.showOnHoverDots,
|
|
156
|
+
showOnHoverDots = _h === void 0 ? false : _h,
|
|
157
|
+
_j = _a.isDotsTransparent,
|
|
158
|
+
isDotsTransparent = _j === void 0 ? false : _j,
|
|
159
|
+
props = __rest(_a, ["autoPlay", "children", "className", "duration", "height", "infinite", "ratio", "style", "width", "onChangeIndex", "onClickDot", "onClickItem", "onClickButtonNext", "onClickButtonPrev", "onSwipeNext", "onSwipePrev", "showOnHoverButtons", "showOnHoverDots", "isDotsTransparent"]);
|
|
160
|
+
var t = BodyProvider.useBodyLocale().t;
|
|
165
161
|
var refTrack = React__namespace.useRef(null);
|
|
166
162
|
var transitionRunning = React__namespace.useRef(false);
|
|
167
|
-
|
|
168
163
|
var _k = React__namespace.useState(false),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
disableAutoPlay = _k[0],
|
|
165
|
+
setDisableAutoPlay = _k[1];
|
|
172
166
|
var _l = React__namespace.useState({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
167
|
+
index: 0,
|
|
168
|
+
offset: undefined
|
|
169
|
+
}),
|
|
170
|
+
position = _l[0],
|
|
171
|
+
setPosition = _l[1];
|
|
179
172
|
var childrenCount = React__namespace.Children.count(children);
|
|
180
173
|
var childrenArray = React__namespace.Children.toArray(children);
|
|
181
174
|
var isDisablePrev = !infinite && position.index === 0;
|
|
@@ -188,124 +181,98 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
188
181
|
var infiniteIndex = getInfiniteIndex(position.index, childrenCount);
|
|
189
182
|
var infinitePrevIndex = getInfiniteIndex(prevIndex, childrenCount);
|
|
190
183
|
var infiniteNextIndex = getInfiniteIndex(nextIndex, childrenCount);
|
|
191
|
-
|
|
192
184
|
var handleClickButtonNext = function () {
|
|
193
185
|
if (transitionRunning.current || isDisableNext) return;
|
|
194
|
-
|
|
195
186
|
if (typeof onClickButtonNext === 'function') {
|
|
196
187
|
onClickButtonNext(infiniteNextIndex);
|
|
197
188
|
}
|
|
198
|
-
|
|
199
189
|
setPosition({
|
|
200
190
|
index: nextIndex,
|
|
201
191
|
offset: undefined
|
|
202
192
|
});
|
|
203
193
|
};
|
|
204
|
-
|
|
205
194
|
var handleClickButtonPrev = function () {
|
|
206
195
|
if (transitionRunning.current || isDisablePrev) return;
|
|
207
|
-
|
|
208
196
|
if (typeof onClickButtonPrev === 'function') {
|
|
209
197
|
onClickButtonPrev(infinitePrevIndex);
|
|
210
198
|
}
|
|
211
|
-
|
|
212
199
|
setPosition({
|
|
213
200
|
index: prevIndex,
|
|
214
201
|
offset: undefined
|
|
215
202
|
});
|
|
216
203
|
};
|
|
217
|
-
|
|
218
204
|
var handleClickDot = function (i) {
|
|
219
205
|
if (transitionRunning.current) return;
|
|
220
|
-
|
|
221
206
|
if (typeof onClickDot === 'function') {
|
|
222
207
|
onClickDot(i);
|
|
223
208
|
}
|
|
224
|
-
|
|
225
209
|
setPosition({
|
|
226
210
|
index: i,
|
|
227
211
|
offset: undefined
|
|
228
212
|
});
|
|
229
213
|
};
|
|
230
|
-
|
|
231
214
|
var handleSwipeNext = function () {
|
|
232
215
|
if (transitionRunning.current || isDisableNext) return;
|
|
233
|
-
|
|
234
216
|
if (typeof onSwipeNext === 'function') {
|
|
235
217
|
onSwipeNext(infiniteNextIndex);
|
|
236
218
|
}
|
|
237
|
-
|
|
238
219
|
setPosition({
|
|
239
220
|
index: nextIndex,
|
|
240
221
|
offset: undefined
|
|
241
222
|
});
|
|
242
223
|
};
|
|
243
|
-
|
|
244
224
|
var handleSwipePrev = function () {
|
|
245
225
|
if (transitionRunning.current || isDisablePrev) return;
|
|
246
|
-
|
|
247
226
|
if (typeof onSwipePrev === 'function') {
|
|
248
227
|
onSwipePrev(infinitePrevIndex);
|
|
249
228
|
}
|
|
250
|
-
|
|
251
229
|
setPosition({
|
|
252
230
|
index: prevIndex,
|
|
253
231
|
offset: undefined
|
|
254
232
|
});
|
|
255
233
|
};
|
|
256
|
-
|
|
257
234
|
var handleSwipeMove = function (_a, event) {
|
|
258
235
|
var x = _a.x;
|
|
259
236
|
if (transitionRunning.current || event.touches && event.touches.length > 1) return;
|
|
260
237
|
var offset = x;
|
|
261
|
-
|
|
262
238
|
if (isDisablePrev && x > 0 || isDisableNext && x < 0) {
|
|
263
239
|
offset = 0;
|
|
264
240
|
}
|
|
265
|
-
|
|
266
241
|
setPosition({
|
|
267
242
|
index: position.index,
|
|
268
243
|
offset: offset
|
|
269
244
|
});
|
|
270
245
|
};
|
|
271
|
-
|
|
272
246
|
var _m = useAutoPlay(function () {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
247
|
+
if (transitionRunning.current || isDisableNext) return;
|
|
248
|
+
setPosition({
|
|
249
|
+
index: nextIndex,
|
|
250
|
+
offset: undefined
|
|
251
|
+
});
|
|
252
|
+
}, autoPlay),
|
|
253
|
+
startAutoPlay = _m[0],
|
|
254
|
+
stopAutoPlay = _m[1];
|
|
282
255
|
var handleTransitionStart = function () {
|
|
283
256
|
transitionRunning.current = true;
|
|
284
257
|
stopAutoPlay();
|
|
285
258
|
};
|
|
286
|
-
|
|
287
259
|
var handleTransitionEnd = function () {
|
|
288
260
|
transitionRunning.current = false;
|
|
289
|
-
|
|
290
261
|
if (isAutoPlay) {
|
|
291
262
|
startAutoPlay();
|
|
292
263
|
}
|
|
293
|
-
|
|
294
264
|
if (!(position.index in childrenArray)) {
|
|
295
265
|
setPosition({
|
|
296
266
|
index: infiniteIndex,
|
|
297
267
|
offset: 0
|
|
298
268
|
});
|
|
299
269
|
}
|
|
300
|
-
|
|
301
270
|
if (typeof onChangeIndex === 'function') {
|
|
302
271
|
onChangeIndex(infiniteIndex);
|
|
303
272
|
}
|
|
304
273
|
};
|
|
305
|
-
|
|
306
274
|
React__namespace.useEffect(function () {
|
|
307
275
|
var _a, _b;
|
|
308
|
-
|
|
309
276
|
var autoPlayObserver = new IntersectionObserver(function (entries) {
|
|
310
277
|
if (entries[0].isIntersecting) {
|
|
311
278
|
startAutoPlay();
|
|
@@ -315,14 +282,11 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
315
282
|
});
|
|
316
283
|
(_a = refTrack.current) === null || _a === void 0 ? void 0 : _a.addEventListener('transitionstart', handleTransitionStart);
|
|
317
284
|
(_b = refTrack.current) === null || _b === void 0 ? void 0 : _b.addEventListener('transitionend', handleTransitionEnd);
|
|
318
|
-
|
|
319
285
|
if (isAutoPlay && refTrack.current) {
|
|
320
286
|
autoPlayObserver.observe(refTrack.current);
|
|
321
287
|
}
|
|
322
|
-
|
|
323
288
|
return function () {
|
|
324
289
|
var _a, _b;
|
|
325
|
-
|
|
326
290
|
(_a = refTrack.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('transitionstart', handleTransitionStart);
|
|
327
291
|
(_b = refTrack.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('transitionend', handleTransitionEnd);
|
|
328
292
|
stopAutoPlay();
|
|
@@ -384,7 +348,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
384
348
|
className: css.buttonPrev,
|
|
385
349
|
onClick: handleClickButtonPrev,
|
|
386
350
|
disabled: isDisablePrev,
|
|
387
|
-
"aria-label":
|
|
351
|
+
"aria-label": t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"]))),
|
|
388
352
|
"data-qaid": 'prev_image'
|
|
389
353
|
}, React__namespace.createElement("svg", {
|
|
390
354
|
className: css.buttonIcon,
|
|
@@ -399,7 +363,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
399
363
|
className: css.buttonNext,
|
|
400
364
|
onClick: handleClickButtonNext,
|
|
401
365
|
disabled: isDisableNext,
|
|
402
|
-
"aria-label":
|
|
366
|
+
"aria-label": t(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u0431\u0430\u043D\u043D\u0435\u0440"]))),
|
|
403
367
|
"data-qaid": 'next_image'
|
|
404
368
|
}, React__namespace.createElement("svg", {
|
|
405
369
|
className: css.buttonIcon,
|
|
@@ -423,7 +387,7 @@ var SimpleSlider = React__namespace.forwardRef(function (_a, ref) {
|
|
|
423
387
|
return handleClickDot(index);
|
|
424
388
|
},
|
|
425
389
|
disabled: index === infiniteIndex,
|
|
426
|
-
"aria-label":
|
|
390
|
+
"aria-label": t(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u0430\u043D\u043D\u0435\u0440 \u043D\u043E\u043C\u0435\u0440 ", ""], ["\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u0430\u043D\u043D\u0435\u0440 \u043D\u043E\u043C\u0435\u0440 ", ""])), viewIndex),
|
|
427
391
|
"data-qaid": "view_image_".concat(viewIndex)
|
|
428
392
|
}, viewIndex));
|
|
429
393
|
})));
|