@prom-ui/core 0.0.121 → 0.0.131

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.
Files changed (116) hide show
  1. package/Avatar/cjs/index.development.js +9 -19
  2. package/Avatar/cjs/index.development.v2.js +9 -19
  3. package/Avatar/package.json +1 -1
  4. package/Body/package.json +1 -1
  5. package/BodyProvider/BodyContext.d.ts +5 -0
  6. package/BodyProvider/cjs/index.development.js +264 -0
  7. package/BodyProvider/cjs/index.development.v2.js +264 -0
  8. package/BodyProvider/cjs/index.production.js +1 -0
  9. package/BodyProvider/cjs/index.production.v2.js +1 -0
  10. package/BodyProvider/index.d.ts +9 -0
  11. package/BodyProvider/index.js +7 -0
  12. package/BodyProvider/index.v2.js +7 -0
  13. package/BodyProvider/package.json +12 -0
  14. package/BodyProvider/useBodyLocale.d.ts +2 -0
  15. package/Box/package.json +1 -1
  16. package/Button/cjs/index.development.js +3 -4
  17. package/Button/cjs/index.development.v2.js +3 -4
  18. package/Button/package.json +1 -1
  19. package/ButtonPageUp/cjs/index.development.js +16 -20
  20. package/ButtonPageUp/cjs/index.development.v2.js +16 -20
  21. package/ButtonPageUp/cjs/index.production.js +1 -1
  22. package/ButtonPageUp/cjs/index.production.v2.js +1 -1
  23. package/ButtonPageUp/package.json +2 -3
  24. package/Checkbox/cjs/index.development.js +5 -7
  25. package/Checkbox/cjs/index.development.v2.js +5 -7
  26. package/Checkbox/package.json +1 -1
  27. package/Flex/package.json +1 -1
  28. package/Grid/package.json +1 -1
  29. package/Icon/cjs/index.development.js +1 -1
  30. package/Icon/cjs/index.development.v2.js +1 -1
  31. package/Icon/cjs/index.production.js +1 -1
  32. package/Icon/cjs/index.production.v2.js +1 -1
  33. package/Icon/cjs/style.development.css +1 -1
  34. package/Icon/cjs/style.development.v2.css +1 -1
  35. package/Icon/cjs/style.production.css +1 -1
  36. package/Icon/cjs/style.production.v2.css +1 -1
  37. package/Icon/index.d.ts +1 -1
  38. package/Icon/package.json +1 -1
  39. package/Image/package.json +1 -1
  40. package/ImageEmoji/cjs/index.development.js +7 -8
  41. package/ImageEmoji/cjs/index.development.v2.js +7 -8
  42. package/ImageEmoji/package.json +1 -1
  43. package/Input/package.json +1 -1
  44. package/InputField/cjs/index.development.js +33 -44
  45. package/InputField/cjs/index.development.v2.js +33 -44
  46. package/InputField/cjs/index.production.js +1 -1
  47. package/InputField/cjs/index.production.v2.js +1 -1
  48. package/InputField/package.json +1 -1
  49. package/KeyPress/cjs/index.development.js +8 -11
  50. package/KeyPress/cjs/index.development.v2.js +8 -11
  51. package/KeyPress/package.json +1 -1
  52. package/Line/package.json +1 -1
  53. package/Link/cjs/index.development.js +0 -1
  54. package/Link/cjs/index.development.v2.js +0 -1
  55. package/Link/package.json +1 -1
  56. package/List/package.json +1 -1
  57. package/Media/cjs/index.development.js +12 -18
  58. package/Media/cjs/index.development.v2.js +12 -18
  59. package/Media/package.json +1 -1
  60. package/OutsideClick/cjs/index.development.js +4 -7
  61. package/OutsideClick/cjs/index.development.v2.js +4 -7
  62. package/OutsideClick/package.json +1 -1
  63. package/Overlay/cjs/index.development.js +67 -90
  64. package/Overlay/cjs/index.development.v2.js +67 -90
  65. package/Overlay/cjs/index.production.js +1 -1
  66. package/Overlay/cjs/index.production.v2.js +1 -1
  67. package/Overlay/package.json +2 -3
  68. package/Picture/package.json +1 -1
  69. package/PortableOverlay/cjs/index.development.js +19 -20
  70. package/PortableOverlay/cjs/index.development.v2.js +19 -20
  71. package/PortableOverlay/package.json +1 -1
  72. package/Portal/cjs/index.development.js +5 -10
  73. package/Portal/cjs/index.development.v2.js +5 -10
  74. package/Portal/package.json +1 -1
  75. package/QRCode/cjs/index.development.js +8 -8
  76. package/QRCode/cjs/index.development.v2.js +8 -8
  77. package/QRCode/package.json +1 -1
  78. package/Rating/cjs/index.development.js +8 -9
  79. package/Rating/cjs/index.development.v2.js +8 -9
  80. package/Rating/package.json +1 -1
  81. package/SafeQuery/cjs/index.development.js +19 -19
  82. package/SafeQuery/cjs/index.development.v2.js +19 -19
  83. package/SafeQuery/cjs/index.production.js +1 -1
  84. package/SafeQuery/cjs/index.production.v2.js +1 -1
  85. package/SafeQuery/package.json +1 -1
  86. package/Scroll/package.json +1 -1
  87. package/ScrollControls/cjs/index.development.js +37 -51
  88. package/ScrollControls/cjs/index.development.v2.js +37 -51
  89. package/ScrollControls/cjs/index.production.js +1 -1
  90. package/ScrollControls/cjs/index.production.v2.js +1 -1
  91. package/ScrollControls/package.json +2 -3
  92. package/SideOverlay/cjs/index.development.js +40 -41
  93. package/SideOverlay/cjs/index.development.v2.js +40 -41
  94. package/SideOverlay/cjs/index.production.js +1 -1
  95. package/SideOverlay/cjs/index.production.v2.js +1 -1
  96. package/SideOverlay/package.json +2 -3
  97. package/SimpleSlider/cjs/index.development.js +53 -89
  98. package/SimpleSlider/cjs/index.development.v2.js +53 -89
  99. package/SimpleSlider/cjs/index.production.js +1 -1
  100. package/SimpleSlider/cjs/index.production.v2.js +1 -1
  101. package/SimpleSlider/package.json +2 -3
  102. package/Skeleton/cjs/index.development.js +10 -11
  103. package/Skeleton/cjs/index.development.v2.js +10 -11
  104. package/Skeleton/package.json +1 -1
  105. package/Spinner/package.json +1 -1
  106. package/Text/package.json +1 -1
  107. package/TextEmoji/cjs/index.development.js +5 -6
  108. package/TextEmoji/cjs/index.development.v2.js +5 -6
  109. package/TextEmoji/package.json +1 -1
  110. package/Tooltip/cjs/index.development.js +53 -55
  111. package/Tooltip/cjs/index.development.v2.js +53 -55
  112. package/Tooltip/package.json +1 -1
  113. package/Tumbler/cjs/index.development.js +5 -7
  114. package/Tumbler/cjs/index.development.v2.js +5 -7
  115. package/Tumbler/package.json +1 -1
  116. 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
- height = _a.height,
108
- ratio = _a.ratio,
109
- style = _a.style;
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
- childrenCount = _a.childrenCount,
121
- duration = _a.duration,
122
- offset = _a.offset;
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, "%") // willChange: 'transform',
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
- autoPlay = _d === void 0 ? 0 : _d,
140
- children = _a.children,
141
- className = _a.className,
142
- _e = _a.duration,
143
- duration = _e === void 0 ? 500 : _e,
144
- height = _a.height,
145
- _f = _a.infinite,
146
- infinite = _f === void 0 ? false : _f,
147
- ratio = _a.ratio,
148
- style = _a.style,
149
- width = _a.width,
150
- onChangeIndex = _a.onChangeIndex,
151
- onClickDot = _a.onClickDot,
152
- onClickItem = _a.onClickItem,
153
- onClickButtonNext = _a.onClickButtonNext,
154
- onClickButtonPrev = _a.onClickButtonPrev,
155
- onSwipeNext = _a.onSwipeNext,
156
- onSwipePrev = _a.onSwipePrev,
157
- _g = _a.showOnHoverButtons,
158
- showOnHoverButtons = _g === void 0 ? false : _g,
159
- _h = _a.showOnHoverDots,
160
- showOnHoverDots = _h === void 0 ? false : _h,
161
- _j = _a.isDotsTransparent,
162
- isDotsTransparent = _j === void 0 ? false : _j,
163
- props = __rest(_a, ["autoPlay", "children", "className", "duration", "height", "infinite", "ratio", "style", "width", "onChangeIndex", "onClickDot", "onClickItem", "onClickButtonNext", "onClickButtonPrev", "onSwipeNext", "onSwipePrev", "showOnHoverButtons", "showOnHoverDots", "isDotsTransparent"]);
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
- disableAutoPlay = _k[0],
170
- setDisableAutoPlay = _k[1];
171
-
164
+ disableAutoPlay = _k[0],
165
+ setDisableAutoPlay = _k[1];
172
166
  var _l = React__namespace.useState({
173
- index: 0,
174
- offset: undefined
175
- }),
176
- position = _l[0],
177
- setPosition = _l[1];
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
- if (transitionRunning.current || isDisableNext) return;
274
- setPosition({
275
- index: nextIndex,
276
- offset: undefined
277
- });
278
- }, autoPlay),
279
- startAutoPlay = _m[0],
280
- stopAutoPlay = _m[1];
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": ttag.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"]))),
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": ttag.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"]))),
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": ttag.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),
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
- height = _a.height,
108
- ratio = _a.ratio,
109
- style = _a.style;
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
- childrenCount = _a.childrenCount,
121
- duration = _a.duration,
122
- offset = _a.offset;
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, "%") // willChange: 'transform',
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
- autoPlay = _d === void 0 ? 0 : _d,
140
- children = _a.children,
141
- className = _a.className,
142
- _e = _a.duration,
143
- duration = _e === void 0 ? 500 : _e,
144
- height = _a.height,
145
- _f = _a.infinite,
146
- infinite = _f === void 0 ? false : _f,
147
- ratio = _a.ratio,
148
- style = _a.style,
149
- width = _a.width,
150
- onChangeIndex = _a.onChangeIndex,
151
- onClickDot = _a.onClickDot,
152
- onClickItem = _a.onClickItem,
153
- onClickButtonNext = _a.onClickButtonNext,
154
- onClickButtonPrev = _a.onClickButtonPrev,
155
- onSwipeNext = _a.onSwipeNext,
156
- onSwipePrev = _a.onSwipePrev,
157
- _g = _a.showOnHoverButtons,
158
- showOnHoverButtons = _g === void 0 ? false : _g,
159
- _h = _a.showOnHoverDots,
160
- showOnHoverDots = _h === void 0 ? false : _h,
161
- _j = _a.isDotsTransparent,
162
- isDotsTransparent = _j === void 0 ? false : _j,
163
- props = __rest(_a, ["autoPlay", "children", "className", "duration", "height", "infinite", "ratio", "style", "width", "onChangeIndex", "onClickDot", "onClickItem", "onClickButtonNext", "onClickButtonPrev", "onSwipeNext", "onSwipePrev", "showOnHoverButtons", "showOnHoverDots", "isDotsTransparent"]);
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
- disableAutoPlay = _k[0],
170
- setDisableAutoPlay = _k[1];
171
-
164
+ disableAutoPlay = _k[0],
165
+ setDisableAutoPlay = _k[1];
172
166
  var _l = React__namespace.useState({
173
- index: 0,
174
- offset: undefined
175
- }),
176
- position = _l[0],
177
- setPosition = _l[1];
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
- if (transitionRunning.current || isDisableNext) return;
274
- setPosition({
275
- index: nextIndex,
276
- offset: undefined
277
- });
278
- }, autoPlay),
279
- startAutoPlay = _m[0],
280
- stopAutoPlay = _m[1];
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": ttag.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"]))),
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": ttag.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"]))),
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": ttag.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),
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
  })));