@semcore/carousel 2.2.29 → 2.2.31
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/CHANGELOG.md +12 -0
- package/lib/cjs/Carousel.js +43 -146
- package/lib/cjs/Carousel.js.map +1 -1
- package/lib/cjs/index.js +0 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/Carousel.js +43 -152
- package/lib/es6/Carousel.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Carousel.jsx +1 -2
package/lib/es6/Carousel.js
CHANGED
|
@@ -22,28 +22,19 @@ import { Box } from '@semcore/flex-box';
|
|
|
22
22
|
import ChevronRight from '@semcore/icon/ChevronRight/l';
|
|
23
23
|
import ChevronLeft from '@semcore/icon/ChevronLeft/l';
|
|
24
24
|
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
25
|
-
|
|
26
25
|
/*__reshadow-styles__:"./style/carousel.shadow.css"*/
|
|
27
|
-
var style = (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
,
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"__SItem": "___SItem_2lqk1_gg_",
|
|
40
|
-
"--transform": "--transform_2lqk1",
|
|
41
|
-
"__SIndicators": "___SIndicators_2lqk1_gg_",
|
|
42
|
-
"__SIndicator": "___SIndicator_2lqk1_gg_",
|
|
43
|
-
"_active": "__active_2lqk1_gg_",
|
|
44
|
-
"__SPrev": "___SPrev_2lqk1_gg_",
|
|
45
|
-
"__SNext": "___SNext_2lqk1_gg_",
|
|
46
|
-
"_disabled": "__disabled_2lqk1_gg_"
|
|
26
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SCarousel_1mkco_gg_{overflow:hidden;outline:0}.___SContainer_1mkco_gg_{display:flex;transition:transform var(--duration_1mkco) ease-in-out}.___SItem_1mkco_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_1mkco);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_1mkco_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_1mkco_gg_{margin:0 calc(.5*var(--intergalactic-spacing-3x, 12px));cursor:pointer;display:block;width:12px;height:12px;border-radius:var(--intergalactic-control-rounded, 6px);background-color:var(--intergalactic-icon-secondary-neutral, #a9abb6);opacity:var(--intergalactic-disabled-opacity, 0.3);-o-object-fit:cover;object-fit:cover;transition:ease-in-out opacity .1s}@media (hover:hover){.___SIndicator_1mkco_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_1mkco_gg_.__active_1mkco_gg_{opacity:1}.___SNext_1mkco_gg_,.___SPrev_1mkco_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.___SPrev_1mkco_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_1mkco_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_1mkco_gg_.__disabled_1mkco_gg_,.___SPrev_1mkco_gg_.__disabled_1mkco_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_1mkco_gg_{transition:none}}" /*__inner_css_end__*/, "1mkco_gg_") /*__reshadow_css_end__*/, {
|
|
27
|
+
"__SCarousel": "___SCarousel_1mkco_gg_",
|
|
28
|
+
"__SContainer": "___SContainer_1mkco_gg_",
|
|
29
|
+
"--duration": "--duration_1mkco",
|
|
30
|
+
"__SItem": "___SItem_1mkco_gg_",
|
|
31
|
+
"--transform": "--transform_1mkco",
|
|
32
|
+
"__SIndicators": "___SIndicators_1mkco_gg_",
|
|
33
|
+
"__SIndicator": "___SIndicator_1mkco_gg_",
|
|
34
|
+
"_active": "__active_1mkco_gg_",
|
|
35
|
+
"__SPrev": "___SPrev_1mkco_gg_",
|
|
36
|
+
"__SNext": "___SNext_1mkco_gg_",
|
|
37
|
+
"_disabled": "__disabled_1mkco_gg_"
|
|
47
38
|
});
|
|
48
39
|
var position = {
|
|
49
40
|
getItemMin: function getItemMin(items) {
|
|
@@ -75,46 +66,31 @@ var MAP_TRANSFORM = {
|
|
|
75
66
|
ArrowLeft: 'left',
|
|
76
67
|
ArrowRight: 'right'
|
|
77
68
|
};
|
|
78
|
-
|
|
79
69
|
var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
80
70
|
_inherits(CarouselRoot, _Component);
|
|
81
|
-
|
|
82
71
|
var _super = _createSuper(CarouselRoot);
|
|
83
|
-
|
|
84
72
|
function CarouselRoot(props) {
|
|
85
73
|
var _this;
|
|
86
|
-
|
|
87
74
|
_classCallCheck(this, CarouselRoot);
|
|
88
|
-
|
|
89
75
|
_this = _super.call(this, props);
|
|
90
|
-
|
|
91
76
|
_defineProperty(_assertThisInitialized(_this), "refContainer", /*#__PURE__*/React.createRef());
|
|
92
|
-
|
|
93
77
|
_defineProperty(_assertThisInitialized(_this), "transform", 0);
|
|
94
|
-
|
|
95
78
|
_defineProperty(_assertThisInitialized(_this), "positionLeftItem", 0);
|
|
96
|
-
|
|
97
79
|
_defineProperty(_assertThisInitialized(_this), "indexIndicator", 0);
|
|
98
|
-
|
|
99
80
|
_defineProperty(_assertThisInitialized(_this), "handlerKeyDown", function (e) {
|
|
100
81
|
switch (e.key) {
|
|
101
82
|
case 'ArrowLeft':
|
|
102
83
|
case 'ArrowRight':
|
|
103
84
|
e.preventDefault();
|
|
104
|
-
|
|
105
85
|
var _this$controlTransfor = _this.controlTransformItem(MAP_TRANSFORM[e.key]),
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
activeItemIndex = _this$controlTransfor.activeItemIndex;
|
|
108
87
|
_this.handlers.index(activeItemIndex);
|
|
109
|
-
|
|
110
88
|
}
|
|
111
89
|
});
|
|
112
|
-
|
|
113
90
|
_defineProperty(_assertThisInitialized(_this), "toggleItem", function (item) {
|
|
114
91
|
var removeItem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
115
92
|
var index = _this.asProps.index;
|
|
116
93
|
var items = _this.state.items;
|
|
117
|
-
|
|
118
94
|
if (removeItem) {
|
|
119
95
|
_this.updateItems(items.filter(function (element) {
|
|
120
96
|
return element.node !== item.node;
|
|
@@ -131,14 +107,12 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
131
107
|
};
|
|
132
108
|
}, function () {
|
|
133
109
|
var items = _this.state.items;
|
|
134
|
-
|
|
135
110
|
if (items.length < index && index !== 0) {
|
|
136
111
|
_this.slideToValue(_this.indexIndicator, index);
|
|
137
112
|
}
|
|
138
113
|
});
|
|
139
114
|
}
|
|
140
115
|
});
|
|
141
|
-
|
|
142
116
|
_defineProperty(_assertThisInitialized(_this), "updateItems", function (items) {
|
|
143
117
|
_this.setState(function () {
|
|
144
118
|
return {
|
|
@@ -146,69 +120,53 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
146
120
|
};
|
|
147
121
|
});
|
|
148
122
|
});
|
|
149
|
-
|
|
150
123
|
_defineProperty(_assertThisInitialized(_this), "transformContainer", function (transform) {
|
|
151
124
|
if (_this.refContainer.current) {
|
|
152
125
|
_this.refContainer.current.style.transform = "translateX(".concat(transform, "%)");
|
|
153
126
|
}
|
|
154
127
|
});
|
|
155
|
-
|
|
156
128
|
_defineProperty(_assertThisInitialized(_this), "getDirection", function (currentIndex, nextIndex, bounded) {
|
|
157
129
|
if (bounded) {
|
|
158
130
|
return currentIndex < nextIndex ? 'right' : 'left';
|
|
159
131
|
}
|
|
160
|
-
|
|
161
132
|
var items = _this.state.items;
|
|
162
133
|
var listIndex = items.map(function (_, ind) {
|
|
163
134
|
return ind;
|
|
164
135
|
});
|
|
165
|
-
|
|
166
136
|
var tmpArr = _toConsumableArray(listIndex);
|
|
167
|
-
|
|
168
137
|
var minTmpArr = tmpArr[0];
|
|
169
138
|
var maxTmpArr = tmpArr[tmpArr.length - 1];
|
|
170
|
-
|
|
171
139
|
if (tmpArr.length === 2) {
|
|
172
140
|
return currentIndex < nextIndex ? 'right' : 'left';
|
|
173
141
|
}
|
|
174
|
-
|
|
175
142
|
if (currentIndex === minTmpArr) {
|
|
176
143
|
tmpArr.unshift(maxTmpArr);
|
|
177
144
|
tmpArr.pop();
|
|
178
145
|
}
|
|
179
|
-
|
|
180
146
|
if (currentIndex === maxTmpArr) {
|
|
181
147
|
tmpArr.shift();
|
|
182
148
|
tmpArr.push(minTmpArr);
|
|
183
149
|
}
|
|
184
|
-
|
|
185
150
|
var tmpCurrentIndex = tmpArr.indexOf(currentIndex);
|
|
186
151
|
var left = tmpArr.indexOf(nextIndex);
|
|
187
152
|
return left - tmpCurrentIndex < 0 ? 'left' : 'right';
|
|
188
153
|
});
|
|
189
|
-
|
|
190
154
|
_defineProperty(_assertThisInitialized(_this), "slideToValue", function (currentIndex, nextIndexItem, bounded) {
|
|
191
155
|
if (currentIndex === nextIndexItem) return false;
|
|
192
|
-
|
|
193
156
|
var direction = _this.getDirection(currentIndex, nextIndexItem, bounded || _this.asProps.bounded);
|
|
194
|
-
|
|
195
157
|
var i = currentIndex;
|
|
196
|
-
|
|
197
158
|
while (nextIndexItem !== i) {
|
|
198
159
|
var _this$transformItem = _this.transformItem(direction),
|
|
199
|
-
|
|
200
|
-
|
|
160
|
+
activeItemIndex = _this$transformItem.activeItemIndex;
|
|
201
161
|
i = activeItemIndex;
|
|
202
162
|
}
|
|
203
163
|
});
|
|
204
|
-
|
|
205
164
|
_defineProperty(_assertThisInitialized(_this), "controlTransformItem", function (direction) {
|
|
206
165
|
var _this$asProps = _this.asProps,
|
|
207
|
-
|
|
208
|
-
|
|
166
|
+
bounded = _this$asProps.bounded,
|
|
167
|
+
index = _this$asProps.index;
|
|
209
168
|
var items = _this.state.items;
|
|
210
169
|
var maxIndexIndicator = items.length - 1;
|
|
211
|
-
|
|
212
170
|
if (_this.isControlled) {
|
|
213
171
|
if (direction === 'right') {
|
|
214
172
|
if (bounded && index === maxIndexIndicator) {
|
|
@@ -216,162 +174,125 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
216
174
|
activeItemIndex: maxIndexIndicator
|
|
217
175
|
};
|
|
218
176
|
}
|
|
219
|
-
|
|
220
177
|
return {
|
|
221
178
|
activeItemIndex: index === maxIndexIndicator ? 0 : index + 1
|
|
222
179
|
};
|
|
223
180
|
}
|
|
224
|
-
|
|
225
181
|
if (direction === 'left') {
|
|
226
182
|
if (bounded && index === 0) {
|
|
227
183
|
return {
|
|
228
184
|
activeItemIndex: 0
|
|
229
185
|
};
|
|
230
186
|
}
|
|
231
|
-
|
|
232
187
|
return {
|
|
233
188
|
activeItemIndex: index === 0 ? maxIndexIndicator : index - 1
|
|
234
189
|
};
|
|
235
190
|
}
|
|
236
191
|
}
|
|
237
|
-
|
|
238
192
|
return _this.transformItem(direction);
|
|
239
193
|
});
|
|
240
|
-
|
|
241
194
|
_defineProperty(_assertThisInitialized(_this), "transformItem", function (direction) {
|
|
242
195
|
var _this$asProps2 = _this.asProps,
|
|
243
|
-
|
|
244
|
-
|
|
196
|
+
bounded = _this$asProps2.bounded,
|
|
197
|
+
step = _this$asProps2.step;
|
|
245
198
|
var items = _this.state.items;
|
|
246
199
|
var maxIndexIndicator = items.length - 1;
|
|
247
200
|
var nextItemPosition = undefined;
|
|
248
|
-
|
|
249
201
|
if (direction === 'right') {
|
|
250
202
|
if (bounded && _this.positionLeftItem === maxIndexIndicator) {
|
|
251
203
|
return {
|
|
252
204
|
activeItemIndex: maxIndexIndicator
|
|
253
205
|
};
|
|
254
206
|
}
|
|
255
|
-
|
|
256
207
|
_this.positionLeftItem += 1;
|
|
257
208
|
var positionItemMax = position.getMax(items);
|
|
258
|
-
|
|
259
209
|
if (_this.positionLeftItem > positionItemMax) {
|
|
260
210
|
nextItemPosition = position.getItemMin(items);
|
|
261
211
|
items[nextItemPosition].position = positionItemMax + 1;
|
|
262
212
|
items[nextItemPosition].transform += items.length * step;
|
|
263
|
-
|
|
264
213
|
_this.updateItems(_toConsumableArray(items));
|
|
265
214
|
}
|
|
266
|
-
|
|
267
215
|
_this.indexIndicator += 1;
|
|
268
|
-
|
|
269
216
|
if (_this.indexIndicator > maxIndexIndicator) {
|
|
270
217
|
_this.indexIndicator = 0;
|
|
271
218
|
}
|
|
272
|
-
|
|
273
219
|
_this.transform -= step;
|
|
274
220
|
}
|
|
275
|
-
|
|
276
221
|
if (direction === 'left') {
|
|
277
222
|
if (bounded && _this.positionLeftItem === 0) {
|
|
278
223
|
return {
|
|
279
224
|
activeItemIndex: 0
|
|
280
225
|
};
|
|
281
226
|
}
|
|
282
|
-
|
|
283
227
|
_this.positionLeftItem -= 1;
|
|
284
228
|
var positionItemMin = position.getMin(items);
|
|
285
|
-
|
|
286
229
|
if (_this.positionLeftItem < positionItemMin) {
|
|
287
230
|
nextItemPosition = position.getItemMax(items);
|
|
288
231
|
items[nextItemPosition].position = positionItemMin - 1;
|
|
289
232
|
items[nextItemPosition].transform -= items.length * step;
|
|
290
|
-
|
|
291
233
|
_this.updateItems(_toConsumableArray(items));
|
|
292
234
|
}
|
|
293
|
-
|
|
294
235
|
_this.indexIndicator -= 1;
|
|
295
|
-
|
|
296
236
|
if (_this.indexIndicator < 0) {
|
|
297
237
|
_this.indexIndicator = maxIndexIndicator;
|
|
298
238
|
}
|
|
299
|
-
|
|
300
239
|
_this.transform += step;
|
|
301
240
|
}
|
|
302
|
-
|
|
303
241
|
var activeItemIndex = items.findIndex(function (item) {
|
|
304
242
|
return item.position === _this.positionLeftItem;
|
|
305
243
|
});
|
|
306
|
-
|
|
307
244
|
if (items[activeItemIndex]) {
|
|
308
245
|
items[activeItemIndex].node.style.transform = "translateX(".concat(items[activeItemIndex].transform, "%)");
|
|
309
246
|
}
|
|
310
|
-
|
|
311
247
|
_this.transformContainer(_this.transform);
|
|
312
|
-
|
|
313
248
|
return {
|
|
314
249
|
activeItemIndex: activeItemIndex
|
|
315
250
|
};
|
|
316
251
|
});
|
|
317
|
-
|
|
318
252
|
_defineProperty(_assertThisInitialized(_this), "bindHandlerClick", function (direction) {
|
|
319
253
|
return function () {
|
|
320
254
|
var _this$controlTransfor2 = _this.controlTransformItem(direction),
|
|
321
|
-
|
|
322
|
-
|
|
255
|
+
activeItemIndex = _this$controlTransfor2.activeItemIndex;
|
|
323
256
|
_this.handlers.index(activeItemIndex);
|
|
324
257
|
};
|
|
325
258
|
});
|
|
326
|
-
|
|
327
259
|
_defineProperty(_assertThisInitialized(_this), "bindHandlerClickIndicator", function (value) {
|
|
328
260
|
return function () {
|
|
329
261
|
!_this.isControlled && _this.slideToValue(_this.indexIndicator, value, true);
|
|
330
|
-
|
|
331
262
|
_this.handlers.index(value);
|
|
332
263
|
};
|
|
333
264
|
});
|
|
334
|
-
|
|
335
265
|
_defineProperty(_assertThisInitialized(_this), "handlerTouchStart", function (e) {
|
|
336
266
|
_this._touchStartCoord = e.changedTouches[0].clientX;
|
|
337
267
|
});
|
|
338
|
-
|
|
339
268
|
_defineProperty(_assertThisInitialized(_this), "handlerTouchEnd", function (e) {
|
|
340
269
|
var touchEndCoord = e.changedTouches[0].clientX;
|
|
341
270
|
var delta = touchEndCoord - _this._touchStartCoord;
|
|
342
|
-
|
|
343
271
|
if (delta > 50) {
|
|
344
272
|
var _this$controlTransfor3 = _this.controlTransformItem('left'),
|
|
345
|
-
|
|
346
|
-
|
|
273
|
+
activeItemIndex = _this$controlTransfor3.activeItemIndex;
|
|
347
274
|
_this.handlers.index(activeItemIndex);
|
|
348
275
|
} else if (delta < -50) {
|
|
349
276
|
var _this$controlTransfor4 = _this.controlTransformItem('right'),
|
|
350
|
-
|
|
351
|
-
|
|
277
|
+
_activeItemIndex = _this$controlTransfor4.activeItemIndex;
|
|
352
278
|
_this.handlers.index(_activeItemIndex);
|
|
353
279
|
}
|
|
354
280
|
});
|
|
355
|
-
|
|
356
281
|
_defineProperty(_assertThisInitialized(_this), "bindHandlerKeydownControl", function (direction) {
|
|
357
282
|
return function (e) {
|
|
358
283
|
var keyCode = e.keyCode;
|
|
359
|
-
|
|
360
284
|
if (keyCode === 13) {
|
|
361
285
|
e.preventDefault();
|
|
362
|
-
|
|
363
286
|
_this.bindHandlerClick(direction)();
|
|
364
287
|
}
|
|
365
288
|
};
|
|
366
289
|
});
|
|
367
|
-
|
|
368
290
|
_this.isControlled = props.index !== undefined;
|
|
369
291
|
_this.state = {
|
|
370
292
|
items: []
|
|
371
293
|
};
|
|
372
294
|
return _this;
|
|
373
295
|
}
|
|
374
|
-
|
|
375
296
|
_createClass(CarouselRoot, [{
|
|
376
297
|
key: "uncontrolledProps",
|
|
377
298
|
value: function uncontrolledProps() {
|
|
@@ -383,7 +304,6 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
383
304
|
key: "componentDidUpdate",
|
|
384
305
|
value: function componentDidUpdate(prevProps) {
|
|
385
306
|
var index = this.asProps.index;
|
|
386
|
-
|
|
387
307
|
if (prevProps.index !== index && this.isControlled) {
|
|
388
308
|
this.slideToValue(prevProps.index, index);
|
|
389
309
|
}
|
|
@@ -410,15 +330,13 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
410
330
|
key: "getPrevProps",
|
|
411
331
|
value: function getPrevProps() {
|
|
412
332
|
var _this$asProps3 = this.asProps,
|
|
413
|
-
|
|
414
|
-
|
|
333
|
+
index = _this$asProps3.index,
|
|
334
|
+
bounded = _this$asProps3.bounded;
|
|
415
335
|
var items = this.state.items;
|
|
416
336
|
var disabled = false;
|
|
417
|
-
|
|
418
337
|
if (items.length && bounded) {
|
|
419
338
|
disabled = index === 0;
|
|
420
339
|
}
|
|
421
|
-
|
|
422
340
|
return {
|
|
423
341
|
onClick: this.bindHandlerClick('left'),
|
|
424
342
|
onKeyDown: this.bindHandlerKeydownControl('left'),
|
|
@@ -429,15 +347,13 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
429
347
|
key: "getNextProps",
|
|
430
348
|
value: function getNextProps() {
|
|
431
349
|
var _this$asProps4 = this.asProps,
|
|
432
|
-
|
|
433
|
-
|
|
350
|
+
index = _this$asProps4.index,
|
|
351
|
+
bounded = _this$asProps4.bounded;
|
|
434
352
|
var items = this.state.items;
|
|
435
353
|
var disabled = false;
|
|
436
|
-
|
|
437
354
|
if (items.length && bounded) {
|
|
438
355
|
disabled = index === items.length - 1;
|
|
439
356
|
}
|
|
440
|
-
|
|
441
357
|
return {
|
|
442
358
|
onClick: this.bindHandlerClick('right'),
|
|
443
359
|
onKeyDown: this.bindHandlerKeydownControl('right'),
|
|
@@ -448,7 +364,6 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
448
364
|
key: "getIndicatorsProps",
|
|
449
365
|
value: function getIndicatorsProps() {
|
|
450
366
|
var _this2 = this;
|
|
451
|
-
|
|
452
367
|
var items = this.state.items;
|
|
453
368
|
var index = this.asProps.index;
|
|
454
369
|
return {
|
|
@@ -465,58 +380,48 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
|
|
|
465
380
|
key: "render",
|
|
466
381
|
value: function render() {
|
|
467
382
|
var _ref = this.asProps,
|
|
468
|
-
|
|
469
|
-
|
|
383
|
+
_ref8;
|
|
470
384
|
var SCarousel = Box;
|
|
471
385
|
var _this$asProps5 = this.asProps,
|
|
472
|
-
|
|
473
|
-
|
|
386
|
+
styles = _this$asProps5.styles,
|
|
387
|
+
Children = _this$asProps5.Children;
|
|
474
388
|
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SCarousel, _ref8.cn("SCarousel", _objectSpread({}, _assignProps({
|
|
475
389
|
"onKeyDown": this.handlerKeyDown,
|
|
476
390
|
"tabIndex": 0,
|
|
477
391
|
"onTouchStart": this.handlerTouchStart,
|
|
478
|
-
"onTouchEnd": this.handlerTouchEnd
|
|
479
|
-
"role": "list"
|
|
392
|
+
"onTouchEnd": this.handlerTouchEnd
|
|
480
393
|
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {})));
|
|
481
394
|
}
|
|
482
395
|
}]);
|
|
483
|
-
|
|
484
396
|
return CarouselRoot;
|
|
485
397
|
}(Component);
|
|
486
|
-
|
|
487
398
|
_defineProperty(CarouselRoot, "displayName", 'Carousel');
|
|
488
|
-
|
|
489
399
|
_defineProperty(CarouselRoot, "defaultProps", {
|
|
490
400
|
defaultIndex: 0,
|
|
491
401
|
duration: 350,
|
|
492
402
|
step: 100,
|
|
493
403
|
bounded: false
|
|
494
404
|
});
|
|
495
|
-
|
|
496
405
|
_defineProperty(CarouselRoot, "style", style);
|
|
497
|
-
|
|
498
406
|
_defineProperty(CarouselRoot, "enhance", [uniqueIDEnhancement()]);
|
|
499
|
-
|
|
500
407
|
var Container = function Container(props) {
|
|
501
408
|
var _ref2 = arguments[0],
|
|
502
|
-
|
|
503
|
-
|
|
409
|
+
_ref9;
|
|
504
410
|
var SContainer = Box;
|
|
505
411
|
var styles = props.styles,
|
|
506
|
-
|
|
412
|
+
duration = props.duration;
|
|
507
413
|
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SContainer, _ref9.cn("SContainer", _objectSpread({}, _assignProps2({
|
|
414
|
+
"role": "list",
|
|
508
415
|
"use:duration": "".concat(duration, "ms")
|
|
509
416
|
}, _ref2))));
|
|
510
417
|
};
|
|
511
|
-
|
|
512
418
|
var Item = function Item(props) {
|
|
513
419
|
var _ref3 = arguments[0],
|
|
514
|
-
|
|
515
|
-
|
|
420
|
+
_ref10;
|
|
516
421
|
var styles = props.styles,
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
422
|
+
toggleItem = props.toggleItem,
|
|
423
|
+
index = props.index,
|
|
424
|
+
uid = props.uid;
|
|
520
425
|
var SItem = Box;
|
|
521
426
|
var refItem = /*#__PURE__*/React.createRef();
|
|
522
427
|
useEffect(function () {
|
|
@@ -537,18 +442,15 @@ var Item = function Item(props) {
|
|
|
537
442
|
"id": "igc-".concat(uid, "-carousel-item-").concat(index)
|
|
538
443
|
}, _ref3))));
|
|
539
444
|
};
|
|
540
|
-
|
|
541
445
|
var Prev = function Prev(props) {
|
|
542
446
|
var _ref4 = arguments[0],
|
|
543
|
-
|
|
544
|
-
|
|
447
|
+
_ref11;
|
|
545
448
|
var styles = props.styles;
|
|
546
449
|
var SPrev = Box;
|
|
547
450
|
return _ref11 = sstyled(styles), /*#__PURE__*/React.createElement(SPrev, _ref11.cn("SPrev", _objectSpread({}, _assignProps4({
|
|
548
451
|
"aria-hidden": "true"
|
|
549
452
|
}, _ref4))));
|
|
550
453
|
};
|
|
551
|
-
|
|
552
454
|
Prev.defaultProps = function () {
|
|
553
455
|
return {
|
|
554
456
|
children: /*#__PURE__*/React.createElement(ChevronLeft, {
|
|
@@ -558,18 +460,15 @@ Prev.defaultProps = function () {
|
|
|
558
460
|
top: 0
|
|
559
461
|
};
|
|
560
462
|
};
|
|
561
|
-
|
|
562
463
|
var Next = function Next(props) {
|
|
563
464
|
var _ref5 = arguments[0],
|
|
564
|
-
|
|
565
|
-
|
|
465
|
+
_ref12;
|
|
566
466
|
var styles = props.styles;
|
|
567
467
|
var SNext = Box;
|
|
568
468
|
return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(SNext, _ref12.cn("SNext", _objectSpread({}, _assignProps5({
|
|
569
469
|
"aria-hidden": "true"
|
|
570
470
|
}, _ref5))));
|
|
571
471
|
};
|
|
572
|
-
|
|
573
472
|
Next.defaultProps = function () {
|
|
574
473
|
return {
|
|
575
474
|
children: /*#__PURE__*/React.createElement(ChevronRight, {
|
|
@@ -579,24 +478,19 @@ Next.defaultProps = function () {
|
|
|
579
478
|
top: 0
|
|
580
479
|
};
|
|
581
480
|
};
|
|
582
|
-
|
|
583
481
|
var Indicators = function Indicators(_ref16) {
|
|
584
482
|
var _ref6 = arguments[0],
|
|
585
|
-
|
|
586
|
-
|
|
483
|
+
_ref14;
|
|
587
484
|
var items = _ref16.items,
|
|
588
|
-
|
|
589
|
-
|
|
485
|
+
styles = _ref16.styles,
|
|
486
|
+
Children = _ref16.Children;
|
|
590
487
|
var SIndicators = Box;
|
|
591
|
-
|
|
592
488
|
if (Children.origin) {
|
|
593
489
|
var _ref13;
|
|
594
|
-
|
|
595
490
|
return _ref13 = sstyled(styles), /*#__PURE__*/React.createElement(SIndicators, _ref13.cn("SIndicators", _objectSpread({}, _assignProps6({
|
|
596
491
|
"aria-hidden": "true"
|
|
597
492
|
}, _ref6))), /*#__PURE__*/React.createElement(Children, _ref13.cn("Children", {})));
|
|
598
493
|
}
|
|
599
|
-
|
|
600
494
|
return _ref14 = sstyled(styles), /*#__PURE__*/React.createElement(SIndicators, _ref14.cn("SIndicators", _objectSpread({}, _assignProps7({
|
|
601
495
|
"aria-hidden": "true"
|
|
602
496
|
}, _ref6))), items.map(function (item, index) {
|
|
@@ -605,17 +499,14 @@ var Indicators = function Indicators(_ref16) {
|
|
|
605
499
|
}, item));
|
|
606
500
|
}));
|
|
607
501
|
};
|
|
608
|
-
|
|
609
502
|
var Indicator = function Indicator(_ref17) {
|
|
610
503
|
var _ref7 = arguments[0],
|
|
611
|
-
|
|
612
|
-
|
|
504
|
+
_ref15;
|
|
613
505
|
var styles = _ref17.styles,
|
|
614
|
-
|
|
506
|
+
Children = _ref17.Children;
|
|
615
507
|
var SIndicator = Box;
|
|
616
508
|
return _ref15 = sstyled(styles), /*#__PURE__*/React.createElement(SIndicator, _ref15.cn("SIndicator", _objectSpread({}, _assignProps8({}, _ref7))), /*#__PURE__*/React.createElement(Children, _ref15.cn("Children", {})));
|
|
617
509
|
};
|
|
618
|
-
|
|
619
510
|
var Carousel = createComponent(CarouselRoot, {
|
|
620
511
|
Container: Container,
|
|
621
512
|
Indicators: Indicators,
|