@salutejs/plasma-new-hope 0.322.0-canary.1944.14662885061.0 → 0.322.0-canary.1947.14664713311.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.
Files changed (91) hide show
  1. package/emotion/cjs/components/PaginationDots/PaginationDots.js +321 -0
  2. package/emotion/cjs/components/PaginationDots/PaginationDots.styles.js +44 -0
  3. package/emotion/cjs/components/PaginationDots/PaginationDots.template-doc.mdx +95 -0
  4. package/emotion/cjs/components/PaginationDots/PaginationDots.tokens.js +30 -0
  5. package/emotion/cjs/components/PaginationDots/PaginationDots.types.js +5 -0
  6. package/emotion/cjs/components/PaginationDots/hooks/useAnimation.js +108 -0
  7. package/emotion/cjs/components/PaginationDots/index.js +31 -0
  8. package/emotion/cjs/components/PaginationDots/utils/getDotSize.js +46 -0
  9. package/emotion/cjs/components/PaginationDots/variations/_size/base.js +8 -0
  10. package/emotion/cjs/components/PaginationDots/variations/_size/tokens.json +1 -0
  11. package/emotion/cjs/components/PaginationDots/variations/_view/base.js +8 -0
  12. package/emotion/cjs/components/PaginationDots/variations/_view/tokens.json +1 -0
  13. package/emotion/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.config.js +23 -0
  14. package/emotion/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.js +11 -0
  15. package/emotion/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.stories.tsx +87 -0
  16. package/emotion/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.config.js +24 -0
  17. package/emotion/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.js +11 -0
  18. package/emotion/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.stories.tsx +68 -0
  19. package/emotion/es/components/PaginationDots/PaginationDots.js +311 -0
  20. package/emotion/es/components/PaginationDots/PaginationDots.styles.js +37 -0
  21. package/emotion/es/components/PaginationDots/PaginationDots.template-doc.mdx +95 -0
  22. package/emotion/es/components/PaginationDots/PaginationDots.tokens.js +24 -0
  23. package/emotion/es/components/PaginationDots/PaginationDots.types.js +1 -0
  24. package/emotion/es/components/PaginationDots/hooks/useAnimation.js +102 -0
  25. package/emotion/es/components/PaginationDots/index.js +2 -0
  26. package/emotion/es/components/PaginationDots/utils/getDotSize.js +40 -0
  27. package/emotion/es/components/PaginationDots/variations/_size/base.js +2 -0
  28. package/emotion/es/components/PaginationDots/variations/_size/tokens.json +1 -0
  29. package/emotion/es/components/PaginationDots/variations/_view/base.js +2 -0
  30. package/emotion/es/components/PaginationDots/variations/_view/tokens.json +1 -0
  31. package/emotion/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.config.js +17 -0
  32. package/emotion/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.js +5 -0
  33. package/emotion/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.stories.tsx +87 -0
  34. package/emotion/es/examples/plasma_web/components/PaginationDots/PaginationDots.config.js +18 -0
  35. package/emotion/es/examples/plasma_web/components/PaginationDots/PaginationDots.js +5 -0
  36. package/emotion/es/examples/plasma_web/components/PaginationDots/PaginationDots.stories.tsx +68 -0
  37. package/package.json +4 -4
  38. package/styled-components/cjs/components/PaginationDots/PaginationDots.js +321 -0
  39. package/styled-components/cjs/components/PaginationDots/PaginationDots.styles.js +26 -0
  40. package/styled-components/cjs/components/PaginationDots/PaginationDots.template-doc.mdx +95 -0
  41. package/styled-components/cjs/components/PaginationDots/PaginationDots.tokens.js +30 -0
  42. package/styled-components/cjs/components/PaginationDots/PaginationDots.types.js +5 -0
  43. package/styled-components/cjs/components/PaginationDots/hooks/useAnimation.js +108 -0
  44. package/styled-components/cjs/components/PaginationDots/index.js +31 -0
  45. package/styled-components/cjs/components/PaginationDots/utils/getDotSize.js +46 -0
  46. package/styled-components/cjs/components/PaginationDots/variations/_size/base.js +8 -0
  47. package/styled-components/cjs/components/PaginationDots/variations/_size/tokens.json +1 -0
  48. package/styled-components/cjs/components/PaginationDots/variations/_view/base.js +8 -0
  49. package/styled-components/cjs/components/PaginationDots/variations/_view/tokens.json +1 -0
  50. package/styled-components/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.config.js +23 -0
  51. package/styled-components/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.js +11 -0
  52. package/styled-components/cjs/examples/plasma_b2c/components/PaginationDots/PaginationDots.stories.tsx +87 -0
  53. package/styled-components/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.config.js +24 -0
  54. package/styled-components/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.js +11 -0
  55. package/styled-components/cjs/examples/plasma_web/components/PaginationDots/PaginationDots.stories.tsx +68 -0
  56. package/styled-components/es/components/PaginationDots/PaginationDots.js +311 -0
  57. package/styled-components/es/components/PaginationDots/PaginationDots.styles.js +18 -0
  58. package/styled-components/es/components/PaginationDots/PaginationDots.template-doc.mdx +95 -0
  59. package/styled-components/es/components/PaginationDots/PaginationDots.tokens.js +24 -0
  60. package/styled-components/es/components/PaginationDots/PaginationDots.types.js +1 -0
  61. package/styled-components/es/components/PaginationDots/hooks/useAnimation.js +102 -0
  62. package/styled-components/es/components/PaginationDots/index.js +2 -0
  63. package/styled-components/es/components/PaginationDots/utils/getDotSize.js +40 -0
  64. package/styled-components/es/components/PaginationDots/variations/_size/base.js +2 -0
  65. package/styled-components/es/components/PaginationDots/variations/_size/tokens.json +1 -0
  66. package/styled-components/es/components/PaginationDots/variations/_view/base.js +2 -0
  67. package/styled-components/es/components/PaginationDots/variations/_view/tokens.json +1 -0
  68. package/styled-components/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.config.js +17 -0
  69. package/styled-components/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.js +5 -0
  70. package/styled-components/es/examples/plasma_b2c/components/PaginationDots/PaginationDots.stories.tsx +87 -0
  71. package/styled-components/es/examples/plasma_web/components/PaginationDots/PaginationDots.config.js +18 -0
  72. package/styled-components/es/examples/plasma_web/components/PaginationDots/PaginationDots.js +5 -0
  73. package/styled-components/es/examples/plasma_web/components/PaginationDots/PaginationDots.stories.tsx +68 -0
  74. package/types/components/PaginationDots/PaginationDots.d.ts +31 -0
  75. package/types/components/PaginationDots/PaginationDots.d.ts.map +1 -0
  76. package/types/components/PaginationDots/PaginationDots.styles.d.ts +9 -0
  77. package/types/components/PaginationDots/PaginationDots.styles.d.ts.map +1 -0
  78. package/types/components/PaginationDots/PaginationDots.tokens.d.ts +25 -0
  79. package/types/components/PaginationDots/PaginationDots.tokens.d.ts.map +1 -0
  80. package/types/components/PaginationDots/PaginationDots.types.d.ts +46 -0
  81. package/types/components/PaginationDots/PaginationDots.types.d.ts.map +1 -0
  82. package/types/components/PaginationDots/hooks/useAnimation.d.ts +23 -0
  83. package/types/components/PaginationDots/hooks/useAnimation.d.ts.map +1 -0
  84. package/types/components/PaginationDots/index.d.ts +4 -0
  85. package/types/components/PaginationDots/index.d.ts.map +1 -0
  86. package/types/components/PaginationDots/utils/getDotSize.d.ts +2 -0
  87. package/types/components/PaginationDots/utils/getDotSize.d.ts.map +1 -0
  88. package/types/components/PaginationDots/variations/_size/base.d.ts +2 -0
  89. package/types/components/PaginationDots/variations/_size/base.d.ts.map +1 -0
  90. package/types/components/PaginationDots/variations/_view/base.d.ts +2 -0
  91. package/types/components/PaginationDots/variations/_view/base.d.ts.map +1 -0
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.paginationDotsRoot = exports.paginationDotsConfig = exports.getVisualOffsets = void 0;
8
+ var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
9
+ var _classnames = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("classnames"));
10
+ var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
11
+ var _hooks = /*#__PURE__*/require("../../hooks");
12
+ var _base = /*#__PURE__*/require("../PaginationDots/variations/_view/base");
13
+ var _base2 = /*#__PURE__*/require("../PaginationDots/variations/_size/base");
14
+ var _PaginationDots = /*#__PURE__*/require("./PaginationDots.styles");
15
+ var _PaginationDots2 = /*#__PURE__*/require("./PaginationDots.tokens");
16
+ var _getDotSize = /*#__PURE__*/require("./utils/getDotSize");
17
+ var _useAnimation2 = /*#__PURE__*/require("./hooks/useAnimation");
18
+ var _excluded = ["view", "size", "activeElementView", "orientation", "centered", "value", "count", "visibleCount", "onChange"];
19
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
22
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
23
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
24
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
26
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
27
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
28
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
30
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
31
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
32
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
33
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
34
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
35
+ var sizesMap = {
36
+ xs: 18,
37
+ s: 20,
38
+ m: 24
39
+ };
40
+ var getInitialOffset = function getInitialOffset(value, visibleCount, count) {
41
+ var middle = Math.floor(visibleCount / 2);
42
+ if (value < middle) {
43
+ return 0;
44
+ }
45
+ if (count - value <= middle) {
46
+ return count - visibleCount;
47
+ }
48
+ return value - middle;
49
+ };
50
+ var getVisualOffsets = exports.getVisualOffsets = function getVisualOffsets(dots, innerViewValue) {
51
+ var before = dots.slice(0, innerViewValue).reduce(function (acc, size) {
52
+ return acc + sizesMap[size];
53
+ }, 0);
54
+ var after = dots.slice(innerViewValue + 1).reduce(function (acc, size) {
55
+ return acc + sizesMap[size];
56
+ }, 0);
57
+ return (after - before) / 2;
58
+ };
59
+ var getFirstAnimatedDotsOffset = function getFirstAnimatedDotsOffset(dots, prevDots) {
60
+ var sizeBefore = sizesMap[prevDots[0]];
61
+ var sizeAfter = sizesMap[dots[0]];
62
+ return sizeBefore - sizeAfter;
63
+ };
64
+ var getLastAnimatedDotsOffset = function getLastAnimatedDotsOffset(dots, prevDots) {
65
+ var sizeBefore = sizesMap[prevDots[prevDots.length - 1]];
66
+ var sizeAfter = sizesMap[dots[dots.length - 1]];
67
+ return sizeBefore - sizeAfter;
68
+ };
69
+
70
+ /*
71
+ (m) m m s xs value: 0, offset: 0
72
+ m (m) m s xs value: 1, offset: 0
73
+ m m (m) s xs value: 2, offset: 0
74
+ s m (m) s xs value: 3, offset: 1
75
+ xs s (m) s xs value: 4, offset: 2
76
+
77
+ */
78
+
79
+ var isDebug = false;
80
+ var paginationDotsRoot = exports.paginationDotsRoot = function paginationDotsRoot(Root) {
81
+ return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRef) {
82
+ var view = _ref.view,
83
+ size = _ref.size,
84
+ _ref$activeElementVie = _ref.activeElementView,
85
+ activeElementView = _ref$activeElementVie === void 0 ? 'dot' : _ref$activeElementVie,
86
+ _ref$orientation = _ref.orientation,
87
+ orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation,
88
+ _ref$centered = _ref.centered,
89
+ centered = _ref$centered === void 0 ? false : _ref$centered,
90
+ _ref$value = _ref.value,
91
+ value = _ref$value === void 0 ? 0 : _ref$value,
92
+ _ref$count = _ref.count,
93
+ count = _ref$count === void 0 ? 0 : _ref$count,
94
+ visibleCount = _ref.visibleCount,
95
+ onChange = _ref.onChange,
96
+ rest = _objectWithoutProperties(_ref, _excluded);
97
+ var innerRef = (0, _react.useRef)(null);
98
+ var wrapperRef = (0, _react.useRef)(null);
99
+ var activeElementRef = (0, _react.useRef)(null);
100
+ var animatedDotsWrapperRef = (0, _react.useRef)(null);
101
+ (0, _plasmaCore.useForkRef)(outerRef, innerRef);
102
+ var innerValue = Math.min(value, count - 1);
103
+ var innerVisibleCount = Math.min(visibleCount || count, count);
104
+ var isLineView = activeElementView === 'line';
105
+ var isVertical = orientation === 'vertical';
106
+ var hasScroll = innerVisibleCount < count;
107
+ var _useState = (0, _react.useState)(innerValue),
108
+ _useState2 = _slicedToArray(_useState, 2),
109
+ currentValue = _useState2[0],
110
+ setCurrentValue = _useState2[1];
111
+ var _useState3 = (0, _react.useState)(),
112
+ _useState4 = _slicedToArray(_useState3, 2),
113
+ prevValue = _useState4[0],
114
+ setPrevValue = _useState4[1];
115
+ var _useState5 = (0, _react.useState)(function () {
116
+ return getInitialOffset(innerValue, innerVisibleCount, count);
117
+ }),
118
+ _useState6 = _slicedToArray(_useState5, 2),
119
+ offset = _useState6[0],
120
+ setOffset = _useState6[1];
121
+ var prevOffset = (0, _hooks.usePreviousValue)(offset);
122
+ var prevDotsRef = (0, _react.useRef)([]);
123
+ var dots = new Array(innerVisibleCount).fill(null).map(function (_, index) {
124
+ return (0, _getDotSize.getDotSize)(size, index + offset, offset, count, innerVisibleCount);
125
+ });
126
+ var setVisualOffset = function setVisualOffset(currentValueNew, newOffset) {
127
+ var innerViewValue = currentValueNew - newOffset;
128
+
129
+ // canScrollBackward || canScrollForward
130
+ var withAnimation = centered ? true : newOffset !== offset;
131
+ if (!animatedDotsWrapperRef.current || !withAnimation) {
132
+ if (wrapperRef.current) {
133
+ wrapperRef.current.style.transform = 'none';
134
+ }
135
+ return;
136
+ }
137
+ var visualOffset = getVisualOffsets(dots, innerViewValue);
138
+ if (wrapperRef.current) {
139
+ wrapperRef.current.style.transform = isVertical ? "translateY(".concat(visualOffset, "px)") : "translateX(".concat(visualOffset, "px)");
140
+ }
141
+ };
142
+ if (isDebug) {
143
+ console.log('!!!', JSON.stringify({
144
+ prevValue: prevValue,
145
+ prevOffset: prevOffset,
146
+ value: innerValue,
147
+ offset: offset
148
+ }));
149
+ }
150
+ var canScrollForward = prevValue !== undefined ? !!offset && count - innerVisibleCount > prevOffset : false;
151
+ var canScrollBackward = Boolean(prevOffset && offset + innerVisibleCount !== count);
152
+ var _useAnimation = (0, _useAnimation2.useAnimation)({
153
+ innerViewIndex: currentValue - offset,
154
+ dots: dots,
155
+ prevDots: prevDotsRef.current,
156
+ canScrollBackward: canScrollBackward,
157
+ canScrollForward: canScrollForward,
158
+ isVertical: isVertical,
159
+ activeElementRef: activeElementRef,
160
+ animatedDotsWrapperRef: animatedDotsWrapperRef,
161
+ onAnimationEnd: function onAnimationEnd() {
162
+ console.log('!!! onAnimationEnd');
163
+ var newOffset = getInitialOffset(innerValue, innerVisibleCount, count);
164
+ setOffset(newOffset);
165
+ setPrevValue(undefined);
166
+ setSkipAnimation(true);
167
+ }
168
+ }),
169
+ skipAnimation = _useAnimation.skipAnimation,
170
+ hasAnimation = _useAnimation.hasAnimation,
171
+ hasForwardAnimation = _useAnimation.hasForwardAnimation,
172
+ hasBackwardAnimation = _useAnimation.hasBackwardAnimation,
173
+ setSkipAnimation = _useAnimation.setSkipAnimation,
174
+ setHasForwardAnimation = _useAnimation.setHasForwardAnimation,
175
+ setHasBackwardAnimation = _useAnimation.setHasBackwardAnimation,
176
+ handleAnimationEnd = _useAnimation.handleAnimationEnd;
177
+ var hasAnimatedDot = hasAnimation && innerVisibleCount > 2 && (hasBackwardAnimation && canScrollBackward || hasForwardAnimation && canScrollForward);
178
+ var calcOffset = function calcOffset(currentValue, prevValue) {
179
+ if (prevValue === undefined || centered && !hasScroll) {
180
+ return;
181
+ }
182
+ var toFront = currentValue > prevValue;
183
+ var toBack = currentValue < prevValue;
184
+ var newOffset = getInitialOffset(currentValue, innerVisibleCount, count);
185
+ var withAnimation = centered ? true : newOffset !== offset;
186
+ if (toFront) {
187
+ if (withAnimation) {
188
+ setHasForwardAnimation(true);
189
+ prevDotsRef.current = _toConsumableArray(dots);
190
+ setOffset(newOffset);
191
+ } else {
192
+ setOffset(newOffset);
193
+ }
194
+ } else if (toBack) {
195
+ if (withAnimation) {
196
+ setHasBackwardAnimation(true);
197
+ prevDotsRef.current = _toConsumableArray(dots);
198
+ setOffset(newOffset);
199
+ } else {
200
+ setOffset(newOffset);
201
+ }
202
+ }
203
+ };
204
+ (0, _react.useLayoutEffect)(function () {
205
+ setVisualOffset(innerValue, offset);
206
+ }, [isVertical, centered]);
207
+ (0, _react.useLayoutEffect)(function () {
208
+ if (prevValue === undefined) {
209
+ setVisualOffset(innerValue, offset);
210
+ if (animatedDotsWrapperRef.current) {
211
+ animatedDotsWrapperRef.current.style.transition = 'none';
212
+ animatedDotsWrapperRef.current.style.transform = 'none';
213
+ }
214
+ }
215
+ }, [innerValue, offset, prevValue]);
216
+ (0, _react.useLayoutEffect)(function () {
217
+ setSkipAnimation(true);
218
+ setPrevValue(undefined);
219
+ }, [count, innerVisibleCount, isVertical, isLineView, hasScroll]);
220
+ (0, _react.useEffect)(function () {
221
+ // setSkipAnimation(true);
222
+ // setPrevValue(undefined);
223
+ }, []);
224
+ var onMove = function onMove(newValue) {
225
+ setSkipAnimation(false);
226
+ calcOffset(newValue, currentValue);
227
+ setCurrentValue(newValue);
228
+ setPrevValue(currentValue);
229
+ onChange === null || onChange === void 0 || onChange(newValue);
230
+ };
231
+ if (!innerVisibleCount || innerVisibleCount <= 0) {
232
+ return null;
233
+ }
234
+ var dotsNodes = dots.map(function (dotSize, viewIndex) {
235
+ var dotIndex = viewIndex + offset;
236
+ var isCurrent = dotIndex === currentValue;
237
+ var isClickable = dotIndex === currentValue - 1 || dotIndex === currentValue + 1;
238
+ var onClick = isClickable && !hasAnimation ? function () {
239
+ return onMove(dotIndex);
240
+ } : undefined;
241
+ if (isCurrent) {
242
+ var ActiveElement = activeElementView === 'dot' ? _PaginationDots.Dot : _PaginationDots.Line;
243
+ return /*#__PURE__*/_react["default"].createElement(ActiveElement, {
244
+ key: viewIndex,
245
+ ref: activeElementRef,
246
+ "data-size": size,
247
+ "data-view": activeElementView,
248
+ className: (0, _classnames["default"])(_PaginationDots2.classes.active, isVertical && _PaginationDots2.classes.vertical, skipAnimation && _PaginationDots2.classes.skipAnimation)
249
+ }, isDebug ? dotIndex : null);
250
+ }
251
+ var isPrevActive = prevValue === dotIndex;
252
+ var innerViewValue = dotIndex - offset;
253
+ var isFirst = innerViewValue === 0;
254
+ var isLast = innerViewValue === innerVisibleCount - 1;
255
+ return /*#__PURE__*/_react["default"].createElement(_PaginationDots.Dot, {
256
+ key: viewIndex,
257
+ className: (0, _classnames["default"])(isVertical && _PaginationDots2.classes.vertical, isClickable && _PaginationDots2.classes.clickable, isPrevActive && _PaginationDots2.classes.prevActive, skipAnimation && _PaginationDots2.classes.skipAnimation),
258
+ style: {
259
+ visibility: isLast && hasForwardAnimation && canScrollForward || isFirst && hasBackwardAnimation && canScrollBackward ? 'hidden' : 'visible'
260
+ },
261
+ "data-size": dotSize,
262
+ "data-view": activeElementView,
263
+ onClick: onClick
264
+ }, isDebug ? dotIndex : null);
265
+ });
266
+ return /*#__PURE__*/_react["default"].createElement(Root, _extends({
267
+ size: size,
268
+ view: view,
269
+ className: (0, _classnames["default"])(centered && _PaginationDots2.classes.centered, isVertical && _PaginationDots2.classes.vertical),
270
+ ref: innerRef
271
+ }, rest), /*#__PURE__*/_react["default"].createElement(_PaginationDots.Wrapper, {
272
+ ref: wrapperRef,
273
+ "data-size": size
274
+ }, hasAnimatedDot && /*#__PURE__*/_react["default"].createElement(_PaginationDots.Dot, {
275
+ className: (0, _classnames["default"])(isVertical && _PaginationDots2.classes.vertical, {
276
+ hidden: hasForwardAnimation,
277
+ showed: hasBackwardAnimation
278
+ }),
279
+ "data-view": activeElementView,
280
+ "data-size": dots[0],
281
+ style: isVertical ? {
282
+ top: "".concat(getFirstAnimatedDotsOffset(dots, prevDotsRef.current), "px")
283
+ } : {
284
+ left: "".concat(getFirstAnimatedDotsOffset(dots, prevDotsRef.current), "px")
285
+ }
286
+ }, isDebug ? offset + (hasForwardAnimation ? -1 : 0) : null), /*#__PURE__*/_react["default"].createElement(_PaginationDots.AnimatedDotsWrapper, {
287
+ ref: animatedDotsWrapperRef,
288
+ onTransitionEnd: handleAnimationEnd
289
+ }, dotsNodes), hasAnimatedDot && /*#__PURE__*/_react["default"].createElement(_PaginationDots.Dot, {
290
+ className: (0, _classnames["default"])(isVertical && _PaginationDots2.classes.vertical, {
291
+ hidden: hasBackwardAnimation,
292
+ showed: hasForwardAnimation
293
+ }),
294
+ "data-view": activeElementView,
295
+ "data-size": dots[dots.length - 1],
296
+ style: isVertical ? {
297
+ bottom: "".concat(getLastAnimatedDotsOffset(dots, prevDotsRef.current), "px")
298
+ } : {
299
+ right: "".concat(getLastAnimatedDotsOffset(dots, prevDotsRef.current), "px")
300
+ }
301
+ }, isDebug ? offset + innerVisibleCount + (hasForwardAnimation ? -1 : 0) : null)));
302
+ });
303
+ };
304
+ var paginationDotsConfig = exports.paginationDotsConfig = {
305
+ name: 'PaginationDots',
306
+ tag: 'div',
307
+ layout: paginationDotsRoot,
308
+ base: _PaginationDots.base,
309
+ variations: {
310
+ view: {
311
+ css: _base.base
312
+ },
313
+ size: {
314
+ css: _base2.base
315
+ }
316
+ },
317
+ defaults: {
318
+ view: 'default',
319
+ size: 'm'
320
+ }
321
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.base = exports.Wrapper = exports.Line = exports.Dot = exports.AnimatedDotsWrapper = void 0;
8
+ var _styledComponents = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("styled-components"));
9
+ var _PaginationDots = /*#__PURE__*/require("./PaginationDots.tokens");
10
+ var _templateObject;
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
+ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
14
+ var Wrapper = exports.Wrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
15
+ componentId: "plasma-new-hope__sc-b6xerq-0"
16
+ })(["position:relative;display:flex;align-items:center;justify-content:center;"]);
17
+ var AnimatedDotsWrapper = exports.AnimatedDotsWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
18
+ componentId: "plasma-new-hope__sc-b6xerq-1"
19
+ })(["display:flex;align-items:center;justify-content:center;"]);
20
+ var Dot = exports.Dot = /*#__PURE__*/_styledComponents["default"].div.withConfig({
21
+ componentId: "plasma-new-hope__sc-b6xerq-2"
22
+ })(["box-sizing:border-box;padding:var(", ");&:before{content:'';display:block;border-radius:var(", ");background-color:var(", ");transition:width 0.3s linear,height 0.3s linear;}&.", "{&:before{background-color:var(", ");}}&[data-size='xs']{&:before{--plasma-private-dot-size:var(", ");width:var(", ");height:var(", ");}}&[data-size='s']{&:before{--plasma-private-dot-size:var(", ");width:var(", ");height:var(", ");}}&[data-size='m']{&:before{--plasma-private-dot-size:var(", ");width:var(", ");height:var(", ");}}&.", "{cursor:pointer;}@keyframes showAnimation{from{transform:scale(0);opacity:0;}to{transform:scale(1);opacity:1;}}@keyframes showWithColor{from{background-color:var(", ");}to{background-color:var(", ");}}@keyframes hideWithColor{from{background-color:var(", ");}to{background-color:var(", ");}}@keyframes hideAnimation{from{transform:scale(1);opacity:1;}to{transform:scale(0);opacity:0;}}@keyframes reversedWidthAnimation{from{width:var(", ");height:var(", ");border-radius:var(", ");background-color:var(", ");}to{width:var(--plasma-private-dot-size);height:var(--plasma-private-dot-size);border-radius:var(", ");background-color:var(", ");}}@keyframes reversedHeightAnimation{from{width:var(", ");height:var(", ");border-radius:var(", ");}to{width:var(--plasma-private-dot-size);height:var(--plasma-private-dot-size);border-radius:var(", ");}}&.", "{&[data-view='line']{&:before{animation-name:reversedWidthAnimation;animation-duration:0.3s;animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;}&.", "{&:before{animation-name:reversedHeightAnimation;}}}&[data-view='dot']{&:before{animation-name:hideWithColor;animation-duration:0.3s;animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;animation-timing-function:ease-out;}}}&.hidden{position:absolute;animation-name:hideAnimation;animation-duration:calc(0.3s + 0.1s);animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;}&.showed{position:absolute;animation-name:showAnimation;animation-duration:0.3s;animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;}&.", "{&[data-view='dot']{&:before{animation-name:showWithColor;animation-duration:0.3s;animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;animation-timing-function:ease-in;}}}&.", "{transition:none;animation-name:none !important;&:before{transition:none;animation-name:none !important;}}"], _PaginationDots.tokens.dotPadding, _PaginationDots.tokens.dotBorderRadius, _PaginationDots.tokens.itemBackground, _PaginationDots.classes.active, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.dotSizeXS, _PaginationDots.tokens.dotSizeXS, _PaginationDots.tokens.dotSizeXS, _PaginationDots.tokens.dotSizeS, _PaginationDots.tokens.dotSizeS, _PaginationDots.tokens.dotSizeS, _PaginationDots.tokens.dotSizeM, _PaginationDots.tokens.dotSizeM, _PaginationDots.tokens.dotSizeM, _PaginationDots.classes.clickable, _PaginationDots.tokens.itemBackground, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.itemBackground, _PaginationDots.tokens.lineWidth, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.tokens.itemBackground, _PaginationDots.tokens.verticalLineWidth, _PaginationDots.tokens.verticalLineHeight, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.classes.prevActive, _PaginationDots.classes.vertical, _PaginationDots.classes.active, _PaginationDots.classes.skipAnimation);
23
+ var Line = exports.Line = /*#__PURE__*/(0, _styledComponents["default"])(Dot).withConfig({
24
+ componentId: "plasma-new-hope__sc-b6xerq-3"
25
+ })(["@keyframes widthAnimation{from{width:var(", ");height:var(", ");background-color:var(", ");}to{width:var(", ");height:var(", ");background-color:var(", ");}}@keyframes heightAnimation{from{width:var(", ");height:var(", ");background-color:var(", ");}to{width:var(", ");height:var(", ");background-color:var(", ");}}&[data-size='s']{&:before{width:var(", ");height:var(", ");border-radius:var(", ");}}&[data-size='m']{&:before{width:var(", ");height:var(", ");border-radius:var(", ");}}&.", "{&[data-size='s']{&:before{width:var(", ");height:var(", ");}}&[data-size='m']{&:before{width:var(", ");height:var(", ");}}}&.", "{&:before{animation-name:widthAnimation;animation-duration:0.3s;animation-iteration-count:1;animation-play-state:running;animation-timing-function:linear;}&.", "{&:before{animation-name:heightAnimation;}}}&.", "{animation-name:none !important;&:before{animation-name:none !important;}}"], _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.itemBackground, _PaginationDots.tokens.lineWidth, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.itemBackground, _PaginationDots.tokens.verticalLineWidth, _PaginationDots.tokens.verticalLineHeight, _PaginationDots.tokens.activeItemBackground, _PaginationDots.tokens.lineWidth, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.tokens.lineWidth, _PaginationDots.tokens.lineHeight, _PaginationDots.tokens.lineBorderRadius, _PaginationDots.classes.vertical, _PaginationDots.tokens.verticalLineWidth, _PaginationDots.tokens.verticalLineHeight, _PaginationDots.tokens.verticalLineWidth, _PaginationDots.tokens.verticalLineHeight, _PaginationDots.classes.active, _PaginationDots.classes.vertical, _PaginationDots.classes.skipAnimation);
26
+ var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n &.", " {\n width: 100%;\n justify-content: center;\n }\n\n &.", " {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n\n ", " {\n padding: var(", ");\n }\n\n ", " {\n flex-direction: column;\n }\n\n &.", " {\n width: auto;\n height: 100%;\n\n position: relative;\n }\n }\n"])), _PaginationDots.classes.centered, _PaginationDots.classes.vertical, Dot, _PaginationDots.tokens.verticalDotPadding, AnimatedDotsWrapper, _PaginationDots.classes.centered);
@@ -0,0 +1,95 @@
1
+ ---
2
+ id: segment
3
+ title: Segment
4
+ ---
5
+
6
+ import { PropsTable, Description } from '@site/src/components';
7
+
8
+ # PaginationDots
9
+ Элементы переключения. Oтображают возможность перемещения между небольшим количеством однородных элементов контента.
10
+
11
+ ## PaginationDots
12
+
13
+ <Description name="PaginationDots" />
14
+ <PropsTable name="PaginationDots" exclude={['css']} />
15
+
16
+ ```tsx live
17
+ import React from 'react';
18
+ import { SegmentGroup, SegmentItem, SegmentProvider, useSegment } from '@salutejs/{{ package }}';
19
+
20
+ export function App() {
21
+ const items = Array(8).fill(0);
22
+
23
+ const SegmentTemplate = () => {
24
+ const {selectedSegmentItems} = useSegment();
25
+
26
+ return (
27
+ <>
28
+ <div>Выбранный элемент: {selectedSegmentItems.join(', ')}</div>
29
+ <br />
30
+ <SegmentGroup hasBackground pilled clip={false}>
31
+ {items.map((_, i) => (
32
+ <SegmentItem
33
+ label={`Label ${i}`}
34
+ value={`label_${i}`}
35
+ key={`label_${i}`}
36
+ view='default'
37
+ pilled
38
+ />
39
+ ))}
40
+ </SegmentGroup>
41
+ </>
42
+ )
43
+ }
44
+
45
+ return (
46
+ <div style={{ display: "block" }} >
47
+ <SegmentProvider defaultSelected={['label_1']}>
48
+ <SegmentTemplate/>
49
+ </SegmentProvider>
50
+ </div>
51
+ );
52
+ }
53
+ ```
54
+
55
+ ### Вертикальное отображение
56
+
57
+ Для смены ориентации передаем `orientation: 'vertical'`
58
+
59
+ ```tsx live
60
+ import React from 'react';
61
+ import { SegmentGroup, SegmentItem, SegmentProvider, useSegment } from '@salutejs/{{ package }}';
62
+
63
+ export function App() {
64
+ const items = Array(8).fill(0);
65
+
66
+ const SegmentTemplate = () => {
67
+ const {selectedSegmentItems} = useSegment();
68
+
69
+ return (
70
+ <>
71
+ <div>Выбранный элемент: {selectedSegmentItems.join(', ')}</div>
72
+ <br />
73
+ <SegmentGroup hasBackground clip={false}>
74
+ {items.map((_, i) => (
75
+ <SegmentItem
76
+ label={`Label ${i}`}
77
+ value={`label_${i}`}
78
+ key={`label_${i}`}
79
+ view='secondary'
80
+ />
81
+ ))}
82
+ </SegmentGroup>
83
+ </>
84
+ )
85
+ }
86
+
87
+ return (
88
+ <div style={{ display: "block" }} >
89
+ <SegmentProvider defaultSelected={['label_1']}>
90
+ <SegmentTemplate/>
91
+ </SegmentProvider>
92
+ </div>
93
+ );
94
+ }
95
+ ```
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tokens = exports.classes = void 0;
7
+ var classes = exports.classes = {
8
+ active: 'active',
9
+ prevActive: 'prevActive',
10
+ centered: 'centered',
11
+ vertical: 'vertical',
12
+ clickable: 'clickable',
13
+ skipAnimation: 'skipAnimation'
14
+ };
15
+ var tokens = exports.tokens = {
16
+ paginationWidth: '--plasma-pagination-width',
17
+ dotPadding: '--plasma-pagination-dots-dot-padding',
18
+ verticalDotPadding: '--plasma-pagination-dots-vertical-dot-padding',
19
+ dotSizeM: '--plasma-pagination-dots-dot-size-m',
20
+ dotSizeS: '--plasma-pagination-dots-dot-size-s',
21
+ dotSizeXS: '--plasma-pagination-dots-dot-size-xs',
22
+ dotBorderRadius: '--plasma-pagination-dots-dot-border-radius',
23
+ lineWidth: '--plasma-pagination-dots-line-width',
24
+ lineHeight: '--plasma-pagination-dots-line-height',
25
+ lineBorderRadius: '--plasma-pagination-dots-line-border-radius',
26
+ verticalLineWidth: '--plasma-pagination-dots-vertical-line-width',
27
+ verticalLineHeight: '--plasma-pagination-dots-vertical-line-height',
28
+ itemBackground: '--plasma-pagination-dots-item-background',
29
+ activeItemBackground: '--plasma-pagination-dots-active-item-background'
30
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useAnimation = void 0;
7
+ var _react = /*#__PURE__*/require("react");
8
+ var _PaginationDots = /*#__PURE__*/require("../PaginationDots");
9
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ var useAnimation = exports.useAnimation = function useAnimation(_ref) {
16
+ var isVertical = _ref.isVertical,
17
+ onAnimationEnd = _ref.onAnimationEnd,
18
+ activeElementRef = _ref.activeElementRef,
19
+ animatedDotsWrapperRef = _ref.animatedDotsWrapperRef,
20
+ canScrollForward = _ref.canScrollForward,
21
+ canScrollBackward = _ref.canScrollBackward,
22
+ dots = _ref.dots,
23
+ prevDots = _ref.prevDots,
24
+ innerViewIndex = _ref.innerViewIndex;
25
+ var isAnimationRunningRef = (0, _react.useRef)(false);
26
+ var _useState = (0, _react.useState)(true),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ skipAnimation = _useState2[0],
29
+ setSkipAnimation = _useState2[1];
30
+ var _useState3 = (0, _react.useState)(false),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ hasForwardAnimation = _useState4[0],
33
+ setHasForwardAnimation = _useState4[1];
34
+ var _useState5 = (0, _react.useState)(false),
35
+ _useState6 = _slicedToArray(_useState5, 2),
36
+ hasBackwardAnimation = _useState6[0],
37
+ setHasBackwardAnimation = _useState6[1];
38
+ var hasAnimation = hasForwardAnimation || hasBackwardAnimation;
39
+ var handleAnimationEnd = function handleAnimationEnd() {
40
+ if (isAnimationRunningRef.current) {
41
+ isAnimationRunningRef.current = false;
42
+ onAnimationEnd();
43
+ }
44
+ setHasForwardAnimation(false);
45
+ setHasBackwardAnimation(false);
46
+ };
47
+ (0, _react.useLayoutEffect)(function () {
48
+ var _activeElementRef$cur, _activeElementRef$cur2;
49
+ var animatedEl = animatedDotsWrapperRef.current;
50
+ if (!animatedEl || !hasForwardAnimation && !hasBackwardAnimation) {
51
+ return;
52
+ }
53
+ var before = (0, _PaginationDots.getVisualOffsets)(prevDots, innerViewIndex);
54
+ var after = (0, _PaginationDots.getVisualOffsets)(dots, innerViewIndex);
55
+ var diff = before - after;
56
+ var _ref2 = activeElementRef.current,
57
+ activeWidth = _ref2.offsetWidth,
58
+ activeHeight = _ref2.offsetHeight;
59
+ var _ref3 = (hasBackwardAnimation ? (_activeElementRef$cur = activeElementRef.current) === null || _activeElementRef$cur === void 0 ? void 0 : _activeElementRef$cur.previousSibling : (_activeElementRef$cur2 = activeElementRef.current) === null || _activeElementRef$cur2 === void 0 ? void 0 : _activeElementRef$cur2.nextSibling) || {},
60
+ width = _ref3.offsetWidth,
61
+ height = _ref3.offsetHeight;
62
+ animatedEl.style.transition = 'none';
63
+ if (hasForwardAnimation) {
64
+ if (canScrollForward) {
65
+ animatedEl.style.transform = isVertical ? "translateY(".concat(height, "px)") : "translateX(".concat(width, "px)");
66
+ } else {
67
+ animatedEl.style.transform = isVertical ? "translateY(".concat(height - activeHeight, "px)") : "translateX(".concat(width - activeWidth, "px)");
68
+ }
69
+ requestAnimationFrame(function () {
70
+ animatedEl.style.transition = 'transform 0.3s linear';
71
+ if (canScrollForward) {
72
+ animatedEl.style.transform = isVertical ? "translateY(".concat(-diff, "px)") : "translateX(".concat(-diff, "px)");
73
+ } else {
74
+ animatedEl.style.transform = isVertical ? "translateY(-".concat(activeHeight, "px)") : "translateX(-".concat(activeWidth, "px)");
75
+ }
76
+ isAnimationRunningRef.current = true;
77
+ });
78
+ }
79
+ if (hasBackwardAnimation) {
80
+ if (canScrollBackward) {
81
+ animatedEl.style.transform = isVertical ? "translateY(".concat(-height, "px)") : "translateX(".concat(-width, "px)");
82
+ } else {
83
+ animatedEl.style.transform = isVertical ? "translateY(".concat(-height + activeHeight, "px)") : "translateX(".concat(-width + activeWidth, "px)");
84
+ }
85
+ requestAnimationFrame(function () {
86
+ if (animatedEl) {
87
+ animatedEl.style.transition = 'transform 0.3s linear';
88
+ if (canScrollBackward) {
89
+ animatedEl.style.transform = isVertical ? "translateY(".concat(-diff, "px)") : "translateX(".concat(-diff, "px)");
90
+ } else {
91
+ animatedEl.style.transform = isVertical ? "translateY(".concat(activeHeight, "px)") : "translateX(".concat(activeWidth, "px)");
92
+ }
93
+ isAnimationRunningRef.current = true;
94
+ }
95
+ });
96
+ }
97
+ }, [isVertical, innerViewIndex, hasForwardAnimation, hasBackwardAnimation]);
98
+ return {
99
+ skipAnimation: skipAnimation,
100
+ hasAnimation: hasAnimation,
101
+ hasBackwardAnimation: hasBackwardAnimation,
102
+ hasForwardAnimation: hasForwardAnimation,
103
+ setSkipAnimation: setSkipAnimation,
104
+ setHasForwardAnimation: setHasForwardAnimation,
105
+ setHasBackwardAnimation: setHasBackwardAnimation,
106
+ handleAnimationEnd: handleAnimationEnd
107
+ };
108
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "paginationDotsClasses", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _PaginationDots2.classes;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "paginationDotsConfig", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _PaginationDots.paginationDotsConfig;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "paginationDotsRoot", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _PaginationDots.paginationDotsRoot;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "paginationDotsTokens", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _PaginationDots2.tokens;
28
+ }
29
+ });
30
+ var _PaginationDots = /*#__PURE__*/require("./PaginationDots");
31
+ var _PaginationDots2 = /*#__PURE__*/require("./PaginationDots.tokens");