@semcore/carousel 3.17.0 → 3.18.0-prerelease.1

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -17,118 +18,95 @@ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
17
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
19
  var _core = _interopRequireWildcard(require("@semcore/core"));
19
20
  var _react = _interopRequireDefault(require("react"));
21
+ var _button = _interopRequireDefault(require("@semcore/button"));
22
+ var _modal = _interopRequireDefault(require("@semcore/modal"));
20
23
  var _flexBox = require("@semcore/flex-box");
21
24
  var _l = _interopRequireDefault(require("@semcore/icon/ChevronRight/l"));
22
25
  var _l2 = _interopRequireDefault(require("@semcore/icon/ChevronLeft/l"));
23
26
  var _uniqueID = _interopRequireDefault(require("@semcore/utils/lib/uniqueID"));
24
27
  var _i18nEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/i18nEnhance"));
25
28
  var _intergalacticDynamicLocales = require("./translations/__intergalactic-dynamic-locales");
29
+ var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
30
+ var _findComponent = require("@semcore/utils/lib/findComponent");
31
+ var _breakpoints = require("@semcore/breakpoints");
26
32
  /*__reshadow-styles__:"./style/carousel.shadow.css"*/
27
- var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SCarousel_p51lk_gg_{overflow:hidden;outline:0}.___SContainer_p51lk_gg_{display:flex;transition:transform var(--duration_p51lk) ease-in-out}.___SItem_p51lk_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_p51lk);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_p51lk_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_p51lk_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_p51lk_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_p51lk_gg_.__active_p51lk_gg_{opacity:1}.___SNext_p51lk_gg_,.___SPrev_p51lk_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_p51lk_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_p51lk_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_p51lk_gg_.__disabled_p51lk_gg_,.___SPrev_p51lk_gg_.__disabled_p51lk_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_p51lk_gg_{transition:none}}" /*__inner_css_end__*/, "p51lk_gg_") /*__reshadow_css_end__*/, {
28
- "__SCarousel": "___SCarousel_p51lk_gg_",
29
- "__SContainer": "___SContainer_p51lk_gg_",
30
- "--duration": "--duration_p51lk",
31
- "__SItem": "___SItem_p51lk_gg_",
32
- "--transform": "--transform_p51lk",
33
- "__SIndicators": "___SIndicators_p51lk_gg_",
34
- "__SIndicator": "___SIndicator_p51lk_gg_",
35
- "_active": "__active_p51lk_gg_",
36
- "__SPrev": "___SPrev_p51lk_gg_",
37
- "__SNext": "___SNext_p51lk_gg_",
38
- "_disabled": "__disabled_p51lk_gg_"
33
+ var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SCarousel_6hx6h_gg_{overflow:hidden;outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SContainer_6hx6h_gg_,.___SModalContainer_6hx6h_gg_{display:flex;transition:transform var(--duration_6hx6h) ease-in-out}.___SItem_6hx6h_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_6hx6h);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SItem_6hx6h_gg_.__zoomIn_6hx6h_gg_{cursor:zoom-in}.___SItem_6hx6h_gg_.__zoomOut_6hx6h_gg_{cursor:zoom-out}.___SIndicators_6hx6h_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_6hx6h_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_6hx6h_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_6hx6h_gg_.__active_6hx6h_gg_{opacity:1}.___SIndicator_6hx6h_gg_.__inverted_6hx6h_gg_{background-color:var(--intergalactic-icon-primary-invert, #ffffff)}.___SNext_6hx6h_gg_,.___SPrev_6hx6h_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_6hx6h_gg_{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SNext_6hx6h_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNext_6hx6h_gg_.__disabled_6hx6h_gg_,.___SPrev_6hx6h_gg_.__disabled_6hx6h_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_6hx6h_gg_{transition:none}}" /*__inner_css_end__*/, "6hx6h_gg_") /*__reshadow_css_end__*/, {
34
+ "__SCarousel": "___SCarousel_6hx6h_gg_",
35
+ "__SContainer": "___SContainer_6hx6h_gg_",
36
+ "--duration": "--duration_6hx6h",
37
+ "__SModalContainer": "___SModalContainer_6hx6h_gg_",
38
+ "__SItem": "___SItem_6hx6h_gg_",
39
+ "--transform": "--transform_6hx6h",
40
+ "_zoomIn": "__zoomIn_6hx6h_gg_",
41
+ "_zoomOut": "__zoomOut_6hx6h_gg_",
42
+ "__SIndicators": "___SIndicators_6hx6h_gg_",
43
+ "__SIndicator": "___SIndicator_6hx6h_gg_",
44
+ "_active": "__active_6hx6h_gg_",
45
+ "_inverted": "__inverted_6hx6h_gg_",
46
+ "__SPrev": "___SPrev_6hx6h_gg_",
47
+ "__SNext": "___SNext_6hx6h_gg_",
48
+ "_disabled": "__disabled_6hx6h_gg_"
39
49
  });
40
- var position = {
41
- getItemMin: function getItemMin(items) {
42
- var indexItem = 0;
43
- items.forEach(function (item, index) {
44
- if (item.position < items[indexItem].position) {
45
- indexItem = index;
46
- }
47
- });
48
- return indexItem;
49
- },
50
- getItemMax: function getItemMax(items) {
51
- var indexItem = 0;
52
- items.forEach(function (item, index) {
53
- if (item.position > items[indexItem].position) {
54
- indexItem = index;
55
- }
56
- });
57
- return indexItem;
58
- },
59
- getMin: function getMin(items) {
60
- return items[position.getItemMin(items)].position;
61
- },
62
- getMax: function getMax(items) {
63
- return items[position.getItemMax(items)].position;
64
- }
65
- };
66
50
  var MAP_TRANSFORM = {
67
51
  ArrowLeft: 'left',
68
52
  ArrowRight: 'right'
69
53
  };
54
+ var enhance = {
55
+ uid: (0, _uniqueID["default"])(),
56
+ getI18nText: (0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages)
57
+ };
58
+ var media = ['(min-width: 481px)', '(max-width: 480px)'];
59
+ var BreakPoints = (0, _breakpoints.createBreakpoints)(media);
60
+ var isSmallScreen = function isSmallScreen(index) {
61
+ return index === 1;
62
+ };
70
63
  var CarouselRoot = /*#__PURE__*/function (_Component) {
71
64
  (0, _inherits2["default"])(CarouselRoot, _Component);
72
65
  var _super = (0, _createSuper2["default"])(CarouselRoot);
73
66
  function CarouselRoot(props) {
67
+ var _ref18, _props$index;
74
68
  var _this;
75
69
  (0, _classCallCheck2["default"])(this, CarouselRoot);
76
70
  _this = _super.call(this, props);
71
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "defaultItemsCount", 0);
77
72
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "refContainer", /*#__PURE__*/_react["default"].createRef());
78
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "transform", 0);
79
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "positionLeftItem", 0);
80
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "indexIndicator", 0);
73
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "refModalContainer", /*#__PURE__*/_react["default"].createRef());
74
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_touchStartCoord", -1);
81
75
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlerKeyDown", function (e) {
82
76
  switch (e.key) {
83
77
  case 'ArrowLeft':
84
78
  case 'ArrowRight':
85
79
  {
86
80
  e.preventDefault();
87
- var _this$controlTransfor = _this.controlTransformItem(MAP_TRANSFORM[e.key]),
88
- activeItemIndex = _this$controlTransfor.activeItemIndex;
89
- _this.handlers.index(activeItemIndex);
81
+ _this.transformItem(MAP_TRANSFORM[e.key]);
90
82
  }
91
83
  }
92
84
  });
93
85
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleItem", function (item) {
94
86
  var removeItem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
95
- var index = _this.asProps.index;
96
- var items = _this.state.items;
97
- if (removeItem) {
98
- _this.updateItems(items.filter(function (element) {
87
+ _this.setState(function (prevState) {
88
+ var newItems = removeItem ? prevState.items.filter(function (element) {
99
89
  return element.node !== item.node;
100
- }));
101
- } else {
102
- _this.setState(function (state) {
103
- return {
104
- items: [].concat((0, _toConsumableArray2["default"])(state.items), [item]).map(function (element, position) {
105
- return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, element), {}, {
106
- position: position,
107
- transform: 0
108
- });
109
- })
110
- };
111
- }, function () {
112
- var items = _this.state.items;
113
- if (items.length > index && index >= 0) {
114
- _this.slideToValue(_this.indexIndicator, index);
115
- }
116
- });
117
- }
118
- });
119
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateItems", function (items) {
120
- _this.setState(function () {
90
+ }) : [].concat((0, _toConsumableArray2["default"])(prevState.items), [item]);
121
91
  return {
122
- items: items
92
+ items: newItems
123
93
  };
124
94
  });
95
+ if (!removeItem) {
96
+ _this.defaultItemsCount++;
97
+ }
125
98
  });
126
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "transformContainer", function (transform) {
99
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "transformContainer", function () {
100
+ var transform = _this.state.selectedIndex * -1 * 100;
127
101
  if (_this.refContainer.current) {
128
102
  _this.refContainer.current.style.transform = "translateX(".concat(transform, "%)");
129
103
  }
104
+ if (_this.refModalContainer.current) {
105
+ _this.refModalContainer.current.style.transform = "translateX(".concat(transform, "%)");
106
+ }
130
107
  });
131
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDirection", function (currentIndex, nextIndex, bounded) {
108
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDirection", function (currentIndex, nextIndex) {
109
+ var bounded = _this.asProps.bounded;
132
110
  if (bounded) {
133
111
  return currentIndex < nextIndex ? 'right' : 'left';
134
112
  }
@@ -154,114 +132,74 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
154
132
  var left = tmpArr.indexOf(nextIndex);
155
133
  return left - tmpCurrentIndex < 0 ? 'left' : 'right';
156
134
  });
157
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "slideToValue", function (currentIndex, nextIndexItem, bounded) {
158
- if (currentIndex === nextIndexItem) return false;
159
- var direction = _this.getDirection(currentIndex, nextIndexItem, bounded || _this.asProps.bounded);
160
- var i = currentIndex;
161
- while (nextIndexItem !== i) {
162
- var _this$transformItem = _this.transformItem(direction),
163
- activeItemIndex = _this$transformItem.activeItemIndex;
164
- i = activeItemIndex;
165
- }
166
- });
167
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "controlTransformItem", function (direction) {
168
- var _this$asProps = _this.asProps,
169
- bounded = _this$asProps.bounded,
170
- index = _this$asProps.index;
171
- var items = _this.state.items;
172
- var maxIndexIndicator = items.length - 1;
173
- if (_this.isControlled) {
174
- if (direction === 'right') {
175
- if (bounded && index === maxIndexIndicator) {
176
- return {
177
- activeItemIndex: maxIndexIndicator
178
- };
179
- }
180
- return {
181
- activeItemIndex: index === maxIndexIndicator ? 0 : index + 1
182
- };
183
- }
184
- if (direction === 'left') {
185
- if (bounded && index === 0) {
186
- return {
187
- activeItemIndex: 0
188
- };
189
- }
190
- return {
191
- activeItemIndex: index === 0 ? maxIndexIndicator : index - 1
192
- };
193
- }
135
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "slideToValue", function (nextIndex) {
136
+ var selectedIndex = _this.state.selectedIndex;
137
+ var direction = selectedIndex < nextIndex ? 'right' : 'left';
138
+ var diff = Math.abs(selectedIndex - nextIndex);
139
+ while (diff > 0) {
140
+ _this.transformItem(direction);
141
+ diff--;
194
142
  }
195
- return _this.transformItem(direction);
196
143
  });
197
144
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "transformItem", function (direction) {
198
- var _this$asProps2 = _this.asProps,
199
- bounded = _this$asProps2.bounded,
200
- step = _this$asProps2.step;
201
- var items = _this.state.items;
145
+ var bounded = _this.asProps.bounded;
146
+ var _this$state = _this.state,
147
+ items = _this$state.items,
148
+ selectedIndex = _this$state.selectedIndex;
202
149
  var maxIndexIndicator = items.length - 1;
203
- var nextItemPosition = undefined;
204
150
  if (direction === 'right') {
205
- if (bounded && _this.positionLeftItem === maxIndexIndicator) {
206
- return {
207
- activeItemIndex: maxIndexIndicator
208
- };
151
+ if (bounded && selectedIndex === maxIndexIndicator) {
152
+ _this.handlers.index(maxIndexIndicator);
153
+ return;
209
154
  }
210
- _this.positionLeftItem += 1;
211
- var positionItemMax = position.getMax(items);
212
- if (_this.positionLeftItem > positionItemMax) {
213
- nextItemPosition = position.getItemMin(items);
214
- items[nextItemPosition].position = positionItemMax + 1;
215
- items[nextItemPosition].transform += items.length * step;
216
- _this.updateItems((0, _toConsumableArray2["default"])(items));
155
+ if (_this.isControlled) {
156
+ _this.handlers.index(selectedIndex === maxIndexIndicator ? 0 : selectedIndex + 1);
157
+ return;
217
158
  }
218
- _this.indexIndicator += 1;
219
- if (_this.indexIndicator > maxIndexIndicator) {
220
- _this.indexIndicator = 0;
221
- }
222
- _this.transform -= step;
223
- }
224
- if (direction === 'left') {
225
- if (bounded && _this.positionLeftItem === 0) {
159
+ _this.setState(function (prevState) {
226
160
  return {
227
- activeItemIndex: 0
161
+ selectedIndex: prevState.selectedIndex + 1
228
162
  };
163
+ }, function () {
164
+ _this.transformContainer();
165
+ _this.handlers.index(_this.state.selectedIndex);
166
+ });
167
+ return;
168
+ }
169
+ if (direction === 'left') {
170
+ if (bounded && selectedIndex === 0) {
171
+ _this.handlers.index(0);
172
+ return;
229
173
  }
230
- _this.positionLeftItem -= 1;
231
- var positionItemMin = position.getMin(items);
232
- if (_this.positionLeftItem < positionItemMin) {
233
- nextItemPosition = position.getItemMax(items);
234
- items[nextItemPosition].position = positionItemMin - 1;
235
- items[nextItemPosition].transform -= items.length * step;
236
- _this.updateItems((0, _toConsumableArray2["default"])(items));
237
- }
238
- _this.indexIndicator -= 1;
239
- if (_this.indexIndicator < 0) {
240
- _this.indexIndicator = maxIndexIndicator;
174
+ if (_this.isControlled) {
175
+ _this.handlers.index(selectedIndex === 0 ? maxIndexIndicator : selectedIndex - 1);
176
+ return;
241
177
  }
242
- _this.transform += step;
243
- }
244
- var activeItemIndex = items.findIndex(function (item) {
245
- return item.position === _this.positionLeftItem;
246
- });
247
- if (items[activeItemIndex]) {
248
- items[activeItemIndex].node.style.transform = "translateX(".concat(items[activeItemIndex].transform, "%)");
178
+ _this.setState(function (prevState) {
179
+ return {
180
+ selectedIndex: prevState.selectedIndex - 1
181
+ };
182
+ }, function () {
183
+ _this.transformContainer();
184
+ _this.handlers.index(_this.state.selectedIndex);
185
+ });
186
+ return;
249
187
  }
250
- _this.transformContainer(_this.transform);
251
- return {
252
- activeItemIndex: activeItemIndex
253
- };
254
188
  });
255
189
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindHandlerClick", function (direction) {
256
190
  return function () {
257
- var _this$controlTransfor2 = _this.controlTransformItem(direction),
258
- activeItemIndex = _this$controlTransfor2.activeItemIndex;
259
- _this.handlers.index(activeItemIndex);
191
+ _this.transformItem(direction);
260
192
  };
261
193
  });
262
194
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindHandlerClickIndicator", function (value) {
263
195
  return function () {
264
- !_this.isControlled && _this.slideToValue(_this.indexIndicator, value, true);
196
+ var _this$state2 = _this.state,
197
+ selectedIndex = _this$state2.selectedIndex,
198
+ items = _this$state2.items;
199
+ if (!_this.isControlled && value !== selectedIndex) {
200
+ var newValueIndex = Math.floor(selectedIndex / items.length) * items.length + value;
201
+ _this.slideToValue(newValueIndex);
202
+ }
265
203
  _this.handlers.index(value);
266
204
  };
267
205
  });
@@ -272,15 +210,20 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
272
210
  var touchEndCoord = e.changedTouches[0].clientX;
273
211
  var delta = touchEndCoord - _this._touchStartCoord;
274
212
  if (delta > 50) {
275
- var _this$controlTransfor3 = _this.controlTransformItem('left'),
276
- activeItemIndex = _this$controlTransfor3.activeItemIndex;
277
- _this.handlers.index(activeItemIndex);
213
+ _this.transformItem('left');
278
214
  } else if (delta < -50) {
279
- var _this$controlTransfor4 = _this.controlTransformItem('right'),
280
- _activeItemIndex = _this$controlTransfor4.activeItemIndex;
281
- _this.handlers.index(_activeItemIndex);
215
+ _this.transformItem('right');
282
216
  }
283
217
  });
218
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleToggleZoomModal", function () {
219
+ _this.setState(function (prevState) {
220
+ return {
221
+ isOpenZoom: !prevState.isOpenZoom
222
+ };
223
+ }, function () {
224
+ _this.state.isOpenZoom && _this.transformContainer();
225
+ });
226
+ });
284
227
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bindHandlerKeydownControl", function (direction) {
285
228
  return function (e) {
286
229
  var key = e.key;
@@ -292,7 +235,9 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
292
235
  });
293
236
  _this.isControlled = props.index !== undefined;
294
237
  _this.state = {
295
- items: []
238
+ items: [],
239
+ isOpenZoom: false,
240
+ selectedIndex: (_ref18 = (_props$index = props.index) !== null && _props$index !== void 0 ? _props$index : props.defaultIndex) !== null && _ref18 !== void 0 ? _ref18 : 0
296
241
  };
297
242
  return _this;
298
243
  }
@@ -303,12 +248,34 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
303
248
  index: null
304
249
  };
305
250
  }
251
+ }, {
252
+ key: "componentDidMount",
253
+ value: function componentDidMount() {
254
+ var selectedIndex = this.state.selectedIndex;
255
+ if (selectedIndex !== 0) {
256
+ if (selectedIndex < 0 || selectedIndex >= this.defaultItemsCount) {
257
+ _logger["default"].warn(true, "You couldn't use value for the `index` or `defaultIndex` not from `Item's` length range.", CarouselRoot.displayName);
258
+ this.setState({
259
+ selectedIndex: 0
260
+ });
261
+ } else {
262
+ this.transformContainer();
263
+ }
264
+ }
265
+ var deprecatedComponents = (0, _findComponent.findAllComponents)(this.asProps.Children, ['Carousel.Prev', 'Carousel.Next', 'Carousel.Indicators']);
266
+ _logger["default"].warn(deprecatedComponents.length > 0, 'Please, try to remove `Prev`, `Next`, `Indicators` and other children components from your Carousel, except only `Item` elements.', CarouselRoot.displayName);
267
+ }
306
268
  }, {
307
269
  key: "componentDidUpdate",
308
270
  value: function componentDidUpdate(prevProps) {
271
+ var _this2 = this;
309
272
  var index = this.asProps.index;
310
- if (prevProps.index !== index && this.isControlled) {
311
- this.slideToValue(prevProps.index, index);
273
+ if (prevProps.index !== index && this.isControlled && index !== undefined) {
274
+ this.setState({
275
+ selectedIndex: index
276
+ }, function () {
277
+ return _this2.transformContainer();
278
+ });
312
279
  }
313
280
  }
314
281
  }, {
@@ -322,25 +289,31 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
322
289
  }
323
290
  }, {
324
291
  key: "getItemProps",
325
- value: function getItemProps(_, index) {
292
+ value: function getItemProps(props, index) {
293
+ var zoom = this.asProps.zoom;
294
+ var isCurrent = this.isSelected(index);
326
295
  return {
327
296
  toggleItem: this.toggleItem,
328
297
  uid: this.asProps.uid,
329
298
  index: index,
330
- current: index === this.asProps.index
299
+ current: isCurrent,
300
+ zoomIn: zoom,
301
+ onToggleZoomModal: this.handleToggleZoomModal,
302
+ transform: isCurrent ? this.getTransform() : undefined
331
303
  };
332
304
  }
333
305
  }, {
334
306
  key: "getPrevProps",
335
307
  value: function getPrevProps() {
336
- var _this$asProps3 = this.asProps,
337
- index = _this$asProps3.index,
338
- bounded = _this$asProps3.bounded,
339
- getI18nText = _this$asProps3.getI18nText;
340
- var items = this.state.items;
308
+ var _this$asProps = this.asProps,
309
+ bounded = _this$asProps.bounded,
310
+ getI18nText = _this$asProps.getI18nText;
311
+ var _this$state3 = this.state,
312
+ items = _this$state3.items,
313
+ selectedIndex = _this$state3.selectedIndex;
341
314
  var disabled = false;
342
315
  if (items.length && bounded) {
343
- disabled = index === 0;
316
+ disabled = selectedIndex === 0;
344
317
  }
345
318
  return {
346
319
  onClick: this.bindHandlerClick('left'),
@@ -352,14 +325,15 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
352
325
  }, {
353
326
  key: "getNextProps",
354
327
  value: function getNextProps() {
355
- var _this$asProps4 = this.asProps,
356
- index = _this$asProps4.index,
357
- bounded = _this$asProps4.bounded,
358
- getI18nText = _this$asProps4.getI18nText;
359
- var items = this.state.items;
328
+ var _this$asProps2 = this.asProps,
329
+ bounded = _this$asProps2.bounded,
330
+ getI18nText = _this$asProps2.getI18nText;
331
+ var _this$state4 = this.state,
332
+ items = _this$state4.items,
333
+ selectedIndex = _this$state4.selectedIndex;
360
334
  var disabled = false;
361
335
  if (items.length && bounded) {
362
- disabled = index === items.length - 1;
336
+ disabled = selectedIndex === items.length - 1;
363
337
  }
364
338
  return {
365
339
  onClick: this.bindHandlerClick('right'),
@@ -371,35 +345,147 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
371
345
  }, {
372
346
  key: "getIndicatorsProps",
373
347
  value: function getIndicatorsProps() {
374
- var _this2 = this;
348
+ var _this3 = this;
375
349
  var items = this.state.items;
376
- var index = this.asProps.index;
377
350
  return {
378
351
  items: items.map(function (item, key) {
379
352
  return {
380
- active: key === index,
381
- onClick: _this2.bindHandlerClickIndicator(key),
353
+ active: _this3.isSelected(key),
354
+ onClick: _this3.bindHandlerClickIndicator(key),
382
355
  key: key
383
356
  };
384
357
  })
385
358
  };
386
359
  }
360
+ }, {
361
+ key: "getTransform",
362
+ value: function getTransform() {
363
+ var _this$state5 = this.state,
364
+ items = _this$state5.items,
365
+ selectedIndex = _this$state5.selectedIndex;
366
+ var direction = selectedIndex > 0 ? 1 : -1;
367
+ var count = items.length === 0 ? 0 : Math.floor(selectedIndex / items.length) * direction;
368
+ var transform = selectedIndex > 0 && selectedIndex < items.length ? 0 : 100 * direction * count * items.length;
369
+ return transform;
370
+ }
371
+ }, {
372
+ key: "isSelected",
373
+ value: function isSelected(index) {
374
+ var _this$state6 = this.state,
375
+ items = _this$state6.items,
376
+ selectedIndex = _this$state6.selectedIndex;
377
+ if (items.length === 0) {
378
+ return true;
379
+ }
380
+ if (selectedIndex >= 0) {
381
+ return index === selectedIndex % items.length;
382
+ }
383
+ return index === (items.length + selectedIndex % items.length) % items.length;
384
+ }
385
+ }, {
386
+ key: "renderModal",
387
+ value: function renderModal(isSmall, ComponentItems) {
388
+ var _ref = this.asProps,
389
+ _ref9,
390
+ _this4 = this;
391
+ var SModalContainer = _flexBox.Box;
392
+ var _this$asProps3 = this.asProps,
393
+ styles = _this$asProps3.styles,
394
+ uid = _this$asProps3.uid,
395
+ duration = _this$asProps3.duration,
396
+ hasZoom = _this$asProps3.zoom,
397
+ zoomWidth = _this$asProps3.zoomWidth,
398
+ ariaLabel = _this$asProps3['aria-label'],
399
+ ariaRoledescription = _this$asProps3['aria-roledescription'];
400
+ var isOpenZoom = this.state.isOpenZoom;
401
+ return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_modal["default"], _ref9.cn("Modal", {
402
+ "visible": isOpenZoom,
403
+ "onClose": this.handleToggleZoomModal,
404
+ "ghost": true,
405
+ "closable": !isSmall
406
+ }), /*#__PURE__*/_react["default"].createElement(_flexBox.Flex, _ref9.cn("Flex", {
407
+ "direction": isSmall ? 'column' : 'row'
408
+ }), !isSmall && /*#__PURE__*/_react["default"].createElement(Carousel.Prev, {
409
+ inverted: true
410
+ }), /*#__PURE__*/_react["default"].createElement(_flexBox.Box, _ref9.cn("Box", {
411
+ "style": {
412
+ overflow: 'hidden',
413
+ borderRadius: 6
414
+ }
415
+ }), /*#__PURE__*/_react["default"].createElement(SModalContainer, _ref9.cn("SModalContainer", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
416
+ "role": 'list',
417
+ "use:duration": "".concat(duration, "ms"),
418
+ "ref": this.refModalContainer,
419
+ "use:w": undefined,
420
+ "wMax": zoomWidth
421
+ }, _ref))), ComponentItems.map(function (item, i) {
422
+ return /*#__PURE__*/_react["default"].createElement(Carousel.Item, (0, _extends2["default"])({}, item.props, {
423
+ key: item.key,
424
+ uid: uid,
425
+ index: i,
426
+ current: _this4.isSelected(i),
427
+ toggleItem: undefined,
428
+ zoom: true,
429
+ zoomOut: true,
430
+ transform: _this4.isSelected(i) ? _this4.getTransform() : undefined
431
+ }));
432
+ }))), isSmall ? /*#__PURE__*/_react["default"].createElement(_flexBox.Flex, _ref9.cn("Flex", {
433
+ "justifyContent": 'center',
434
+ "mt": 2
435
+ }), /*#__PURE__*/_react["default"].createElement(Carousel.Prev, {
436
+ inverted: true
437
+ }), /*#__PURE__*/_react["default"].createElement(Carousel.Next, {
438
+ inverted: true
439
+ })) : /*#__PURE__*/_react["default"].createElement(Carousel.Next, {
440
+ inverted: true
441
+ })), !isSmall && /*#__PURE__*/_react["default"].createElement(Carousel.Indicators, {
442
+ inverted: true
443
+ }));
444
+ }
387
445
  }, {
388
446
  key: "render",
389
447
  value: function render() {
390
- var _ref = this.asProps,
391
- _ref8;
448
+ var _ref2 = this.asProps,
449
+ _ref10,
450
+ _this5 = this;
392
451
  var SCarousel = _flexBox.Box;
393
- var _this$asProps5 = this.asProps,
394
- styles = _this$asProps5.styles,
395
- Children = _this$asProps5.Children;
396
- return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCarousel, _ref8.cn("SCarousel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
452
+ var _this$asProps4 = this.asProps,
453
+ styles = _this$asProps4.styles,
454
+ Children = _this$asProps4.Children,
455
+ hasZoom = _this$asProps4.zoom,
456
+ ariaLabel = _this$asProps4['aria-label'],
457
+ ariaRoledescription = _this$asProps4['aria-roledescription'],
458
+ indicators = _this$asProps4.indicators;
459
+ var ComponentItems = (0, _findComponent.findAllComponents)(Children, ['Carousel.Item']);
460
+ var Controls = (0, _findComponent.findAllComponents)(Children, ['Carousel.Prev', 'Carousel.Next', 'Carousel.Indicators']);
461
+ return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCarousel, _ref10.cn("SCarousel", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
397
462
  "role": 'group',
398
463
  "onKeyDown": this.handlerKeyDown,
399
464
  "tabIndex": 0,
400
465
  "onTouchStart": this.handlerTouchStart,
401
466
  "onTouchEnd": this.handlerTouchEnd
402
- }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref8.cn("Children", {})));
467
+ }, _ref2))), Controls.length === 0 ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_flexBox.Flex, _ref10.cn("Flex", {}), /*#__PURE__*/_react["default"].createElement(Carousel.Prev, null), /*#__PURE__*/_react["default"].createElement(_flexBox.Box, _ref10.cn("Box", {
468
+ "style": {
469
+ overflow: 'hidden',
470
+ borderRadius: 6
471
+ }
472
+ }), /*#__PURE__*/_react["default"].createElement(Carousel.Container, {
473
+ "aria-roledescription": ariaRoledescription,
474
+ "aria-label": ariaLabel
475
+ }, /*#__PURE__*/_react["default"].createElement(Children, _ref10.cn("Children", {})))), /*#__PURE__*/_react["default"].createElement(Carousel.Next, null)), indicators === 'default' && /*#__PURE__*/_react["default"].createElement(Carousel.Indicators, null), indicators === 'preview' && /*#__PURE__*/_react["default"].createElement(Carousel.Indicators, null, function () {
476
+ return ComponentItems.map(function (item, index) {
477
+ return /*#__PURE__*/_react["default"].createElement(Carousel.Indicator, (0, _extends2["default"])({}, item.props, {
478
+ key: item.key,
479
+ w: 100,
480
+ h: 100,
481
+ "aria-roledescription": "slide",
482
+ active: _this5.isSelected(index),
483
+ onClick: _this5.bindHandlerClickIndicator(index)
484
+ }));
485
+ });
486
+ })) : /*#__PURE__*/_react["default"].createElement(Children, _ref10.cn("Children", {})), hasZoom && /*#__PURE__*/_react["default"].createElement(BreakPoints, _ref10.cn("BreakPoints", {}), /*#__PURE__*/_react["default"].createElement(BreakPoints.Context.Consumer, null, function (mediaIndex) {
487
+ return _this5.renderModal(isSmallScreen(mediaIndex), ComponentItems);
488
+ })));
403
489
  }
404
490
  }]);
405
491
  return CarouselRoot;
@@ -411,112 +497,187 @@ var CarouselRoot = /*#__PURE__*/function (_Component) {
411
497
  step: 100,
412
498
  bounded: false,
413
499
  i18n: _intergalacticDynamicLocales.localizedMessages,
414
- locale: 'en'
500
+ locale: 'en',
501
+ indicators: 'default'
415
502
  });
416
503
  (0, _defineProperty2["default"])(CarouselRoot, "style", style);
417
- (0, _defineProperty2["default"])(CarouselRoot, "enhance", [(0, _uniqueID["default"])(), (0, _i18nEnhance["default"])(_intergalacticDynamicLocales.localizedMessages)]);
504
+ (0, _defineProperty2["default"])(CarouselRoot, "enhance", Object.values(enhance));
418
505
  var Container = function Container(props) {
419
- var _ref2 = arguments[0],
420
- _ref9;
506
+ var _ref3 = arguments[0],
507
+ _ref11;
421
508
  var SContainer = _flexBox.Box;
422
509
  var styles = props.styles,
423
510
  duration = props.duration;
424
- return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContainer, _ref9.cn("SContainer", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
511
+ return _ref11 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContainer, _ref11.cn("SContainer", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
425
512
  "role": 'list',
426
513
  "use:duration": "".concat(duration, "ms")
427
- }, _ref2))));
428
- };
429
- var Item = function Item(props) {
430
- var _ref3 = arguments[0],
431
- _ref10;
432
- var styles = props.styles,
433
- toggleItem = props.toggleItem,
434
- index = props.index,
435
- uid = props.uid,
436
- current = props.current;
437
- var SItem = _flexBox.Box;
438
- var refItem = /*#__PURE__*/_react["default"].createRef();
439
- _react["default"].useEffect(function () {
440
- // add item
441
- toggleItem({
442
- node: refItem.current
443
- });
444
- return function () {
445
- // remove item
446
- toggleItem({
447
- node: refItem.current
448
- }, true);
449
- };
450
- }, []);
451
- return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SItem, _ref10.cn("SItem", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
452
- "ref": refItem,
453
- "role": 'listitem',
454
- "id": "igc-".concat(uid, "-carousel-item-").concat(index),
455
- "aria-current": current
456
514
  }, _ref3))));
457
515
  };
516
+ var Item = /*#__PURE__*/function (_Component2) {
517
+ (0, _inherits2["default"])(Item, _Component2);
518
+ var _super2 = (0, _createSuper2["default"])(Item);
519
+ function Item() {
520
+ var _this6;
521
+ (0, _classCallCheck2["default"])(this, Item);
522
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
523
+ args[_key] = arguments[_key];
524
+ }
525
+ _this6 = _super2.call.apply(_super2, [this].concat(args));
526
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this6), "refItem", /*#__PURE__*/_react["default"].createRef());
527
+ return _this6;
528
+ }
529
+ (0, _createClass2["default"])(Item, [{
530
+ key: "componentDidMount",
531
+ value: function componentDidMount() {
532
+ var toggleItem = this.props.toggleItem;
533
+ var refItem = this.refItem.current;
534
+ toggleItem && refItem && toggleItem({
535
+ node: refItem
536
+ });
537
+ }
538
+ }, {
539
+ key: "componentWillUnmount",
540
+ value: function componentWillUnmount() {
541
+ var toggleItem = this.props.toggleItem;
542
+ var refItem = this.refItem.current;
543
+ toggleItem && refItem && toggleItem({
544
+ node: refItem
545
+ }, true);
546
+ }
547
+ }, {
548
+ key: "componentDidUpdate",
549
+ value: function componentDidUpdate(prevProps) {
550
+ var transform = this.props.transform;
551
+ var refItem = this.refItem.current;
552
+ if (prevProps.transform !== transform && refItem) {
553
+ refItem.style.transform = "translateX(".concat(transform, "%)");
554
+ }
555
+ }
556
+ }, {
557
+ key: "render",
558
+ value: function render() {
559
+ var _ref4 = this.asProps,
560
+ _ref12;
561
+ var _this$props = this.props,
562
+ styles = _this$props.styles,
563
+ index = _this$props.index,
564
+ uid = _this$props.uid,
565
+ current = _this$props.current,
566
+ zoomIn = _this$props.zoomIn,
567
+ onToggleZoomModal = _this$props.onToggleZoomModal,
568
+ transform = _this$props.transform;
569
+ var SItem = _flexBox.Box;
570
+ return _ref12 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SItem, _ref12.cn("SItem", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
571
+ "ref": this.refItem,
572
+ "role": 'listitem',
573
+ "id": "igc-".concat(uid, "-carousel-item-").concat(index),
574
+ "aria-current": current,
575
+ "onClick": zoomIn ? onToggleZoomModal : undefined,
576
+ "zoomIn": zoomIn
577
+ }, _ref4))));
578
+ }
579
+ }]);
580
+ return Item;
581
+ }(_core.Component);
458
582
  var Prev = function Prev(props) {
459
- var _ref4 = arguments[0],
460
- _ref11;
583
+ var _ref5 = arguments[0],
584
+ _ref13;
461
585
  var styles = props.styles,
462
586
  children = props.children,
463
587
  Children = props.Children,
464
588
  label = props.label,
465
589
  _props$top = props.top,
466
- top = _props$top === void 0 ? 0 : _props$top;
590
+ top = _props$top === void 0 ? 0 : _props$top,
591
+ inverted = props.inverted;
467
592
  var SPrev = _flexBox.Box;
468
- return _ref11 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SPrev, _ref11.cn("SPrev", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
469
- "top": top
470
- }, _ref4))), children ? /*#__PURE__*/_react["default"].createElement(Children, _ref11.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(_l2["default"], _ref11.cn("ChevronLeft", {
471
- "interactive": true,
472
- "aria-label": label
593
+ var _React$useState = _react["default"].useState(false),
594
+ _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
595
+ isActive = _React$useState2[0],
596
+ setIsActive = _React$useState2[1];
597
+ var handleMouseEnter = _react["default"].useCallback(function () {
598
+ setIsActive(true);
599
+ }, []);
600
+ var handleMouseLeave = _react["default"].useCallback(function () {
601
+ setIsActive(false);
602
+ }, []);
603
+ return _ref13 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SPrev, _ref13.cn("SPrev", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
604
+ "top": top,
605
+ "onMouseEnter": handleMouseEnter,
606
+ "onMouseLeave": handleMouseLeave
607
+ }, _ref5))), children ? /*#__PURE__*/_react["default"].createElement(Children, _ref13.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(_button["default"], _ref13.cn("Button", {
608
+ "addonLeft": _l2["default"],
609
+ "aria-label": label,
610
+ "theme": inverted ? 'invert' : 'muted',
611
+ "use": 'tertiary',
612
+ "active": isActive,
613
+ "size": 'l'
473
614
  })));
474
615
  };
475
616
  var Next = function Next(props) {
476
- var _ref5 = arguments[0],
477
- _ref12;
617
+ var _ref6 = arguments[0],
618
+ _ref14;
478
619
  var styles = props.styles,
479
620
  children = props.children,
480
621
  Children = props.Children,
481
622
  label = props.label,
482
623
  _props$top2 = props.top,
483
- top = _props$top2 === void 0 ? 0 : _props$top2;
624
+ top = _props$top2 === void 0 ? 0 : _props$top2,
625
+ inverted = props.inverted;
484
626
  var SNext = _flexBox.Box;
485
- return _ref12 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNext, _ref12.cn("SNext", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
486
- "top": top
487
- }, _ref5))), children ? /*#__PURE__*/_react["default"].createElement(Children, _ref12.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(_l["default"], _ref12.cn("ChevronRight", {
488
- "interactive": true,
489
- "aria-label": label
627
+ var _React$useState3 = _react["default"].useState(false),
628
+ _React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
629
+ isActive = _React$useState4[0],
630
+ setIsActive = _React$useState4[1];
631
+ var handleMouseEnter = _react["default"].useCallback(function () {
632
+ setIsActive(true);
633
+ }, []);
634
+ var handleMouseLeave = _react["default"].useCallback(function () {
635
+ setIsActive(false);
636
+ }, []);
637
+ return _ref14 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNext, _ref14.cn("SNext", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
638
+ "top": top,
639
+ "onMouseEnter": handleMouseEnter,
640
+ "onMouseLeave": handleMouseLeave
641
+ }, _ref6))), children ? /*#__PURE__*/_react["default"].createElement(Children, _ref14.cn("Children", {})) : /*#__PURE__*/_react["default"].createElement(_button["default"], _ref14.cn("Button", {
642
+ "addonLeft": _l["default"],
643
+ "aria-label": label,
644
+ "theme": inverted ? 'invert' : 'muted',
645
+ "use": 'tertiary',
646
+ "active": isActive,
647
+ "size": 'l'
490
648
  })));
491
649
  };
492
- var Indicators = function Indicators(_ref16) {
493
- var _ref6 = arguments[0],
494
- _ref14;
495
- var items = _ref16.items,
496
- styles = _ref16.styles,
497
- Children = _ref16.Children;
650
+ var Indicators = function Indicators(_ref19) {
651
+ var _ref7 = arguments[0],
652
+ _ref16;
653
+ var items = _ref19.items,
654
+ styles = _ref19.styles,
655
+ Children = _ref19.Children,
656
+ inverted = _ref19.inverted;
498
657
  var SIndicators = _flexBox.Box;
499
658
  if (Children.origin) {
500
- var _ref13;
501
- return _ref13 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicators, _ref13.cn("SIndicators", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
659
+ var _ref15;
660
+ return _ref15 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicators, _ref15.cn("SIndicators", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
502
661
  "aria-hidden": 'true'
503
- }, _ref6))), /*#__PURE__*/_react["default"].createElement(Children, _ref13.cn("Children", {})));
662
+ }, _ref7))), /*#__PURE__*/_react["default"].createElement(Children, _ref15.cn("Children", {})));
504
663
  }
505
- return _ref14 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicators, _ref14.cn("SIndicators", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
664
+ return _ref16 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicators, _ref16.cn("SIndicators", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
506
665
  "aria-hidden": 'true'
507
- }, _ref6))), items.map(function (item, index) {
666
+ }, _ref7))), items === null || items === void 0 ? void 0 : items.map(function (item, index) {
508
667
  return /*#__PURE__*/_react["default"].createElement(Carousel.Indicator, (0, _extends2["default"])({
509
668
  key: index
510
- }, item));
669
+ }, item, {
670
+ inverted: inverted
671
+ }));
511
672
  }));
512
673
  };
513
- var Indicator = function Indicator(_ref17) {
514
- var _ref7 = arguments[0],
515
- _ref15;
516
- var styles = _ref17.styles,
517
- Children = _ref17.Children;
674
+ var Indicator = function Indicator(_ref20) {
675
+ var _ref8 = arguments[0],
676
+ _ref17;
677
+ var styles = _ref20.styles,
678
+ Children = _ref20.Children;
518
679
  var SIndicator = _flexBox.Box;
519
- return _ref15 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicator, _ref15.cn("SIndicator", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref7))), /*#__PURE__*/_react["default"].createElement(Children, _ref15.cn("Children", {})));
680
+ return _ref17 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SIndicator, _ref17.cn("SIndicator", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref8))), /*#__PURE__*/_react["default"].createElement(Children, _ref17.cn("Children", {})));
520
681
  };
521
682
  var Carousel = (0, _core["default"])(CarouselRoot, {
522
683
  Container: Container,