@semcore/carousel 3.47.1 → 16.0.0-prerelease.2

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.
@@ -1,71 +1,70 @@
1
1
  import w from "@babel/runtime/helpers/esm/extends";
2
- import I from "@babel/runtime/helpers/esm/objectSpread2";
3
- import B from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import C from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import N from "@babel/runtime/helpers/esm/toConsumableArray";
4
4
  import $ from "@babel/runtime/helpers/esm/classCallCheck";
5
- import D from "@babel/runtime/helpers/esm/createClass";
6
- import g from "@babel/runtime/helpers/esm/assertThisInitialized";
7
- import O from "@babel/runtime/helpers/esm/inherits";
8
- import Z from "@babel/runtime/helpers/esm/createSuper";
9
- import m from "@babel/runtime/helpers/esm/defineProperty";
10
- import { sstyled as j } from "@semcore/utils/lib/core/index";
11
- import U, { sstyled as C, assignProps as S, Component as F } from "@semcore/core";
12
- import a from "react";
13
- import A from "@semcore/button";
14
- import V from "@semcore/modal";
15
- import { Flex as E, Box as x } from "@semcore/flex-box";
16
- import X from "@semcore/icon/ChevronRight/l";
17
- import W from "@semcore/icon/ChevronLeft/l";
18
- import Y from "@semcore/utils/lib/uniqueID";
19
- import G from "@semcore/utils/lib/enhances/i18nEnhance";
20
- import { localizedMessages as R } from "./translations/__intergalactic-dynamic-locales.mjs";
21
- import N from "@semcore/utils/lib/logger";
22
- import { findAllComponents as T } from "@semcore/utils/lib/findComponent";
23
- import { createBreakpoints as J } from "@semcore/breakpoints";
24
- import H from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
25
- var Q = (
5
+ import O from "@babel/runtime/helpers/esm/createClass";
6
+ import m from "@babel/runtime/helpers/esm/assertThisInitialized";
7
+ import Z from "@babel/runtime/helpers/esm/inherits";
8
+ import F from "@babel/runtime/helpers/esm/createSuper";
9
+ import h from "@babel/runtime/helpers/esm/defineProperty";
10
+ import { sstyled as g, createComponent as L, assignProps as S, Component as A } from "@semcore/core";
11
+ import i from "react";
12
+ import R from "@semcore/button";
13
+ import j from "@semcore/modal";
14
+ import { Flex as T, Box as I } from "@semcore/flex-box";
15
+ import U from "@semcore/icon/ChevronRight/l";
16
+ import V from "@semcore/icon/ChevronLeft/l";
17
+ import X from "@semcore/core/lib/utils/uniqueID";
18
+ import W from "@semcore/core/lib/utils/enhances/i18nEnhance";
19
+ import { localizedMessages as H } from "./translations/__intergalactic-dynamic-locales.mjs";
20
+ import z from "@semcore/core/lib/utils/logger";
21
+ import { findAllComponents as M } from "@semcore/core/lib/utils/findComponent";
22
+ import { createBreakpoints as q } from "@semcore/breakpoints";
23
+ import Y from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
24
+ var G = (
26
25
  /*__reshadow_css_start__*/
27
- (j.insert(
26
+ (g.insert(
28
27
  /*__inner_css_start__*/
29
- '.___SCarousel_6q0pi_gg_{overflow:hidden;outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SContainer_6q0pi_gg_{display:flex;transition:transform var(--duration_6q0pi) ease-in-out}.___SContentBox_6q0pi_gg_,.___SModalBox_6q0pi_gg_{position:relative;overflow:hidden;border-radius:var(--intergalactic-surface-rounded, 6px)}.___SContentBox_6q0pi_gg_:has(.___SItem_6q0pi_gg_.__keyboardFocused_6q0pi_gg_):after,.___SModalBox_6q0pi_gg_:has(.___SItem_6q0pi_gg_.__keyboardFocused_6q0pi_gg_):after{content:"";display:block;position:absolute;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1;width:calc(100% - 3px*2);height:calc(100% - 3px*2);top:3px;left:3px}.___SModalContainer_6q0pi_gg_{display:flex;transition:transform var(--duration_6q0pi) ease-in-out}.___SItem_6q0pi_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_6q0pi);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden;outline:0}.___SItem_6q0pi_gg_.__zoomIn_6q0pi_gg_{cursor:zoom-in}.___SItem_6q0pi_gg_.__zoomOut_6q0pi_gg_{cursor:zoom-out}.___SIndicators_6q0pi_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px);outline:0;position:relative}.___SIndicators_6q0pi_gg_.__keyboardFocused_6q0pi_gg_:after{content:"";display:block;position:absolute;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1;width:calc(100% - 3px*2);height:calc(100% - 3px);top:0;left:3px}.___SIndicator_6q0pi_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_6q0pi_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_6q0pi_gg_.__active_6q0pi_gg_{opacity:1}.___SIndicator_6q0pi_gg_.__inverted_6q0pi_gg_{background-color:var(--intergalactic-icon-primary-invert, #ffffff)}.___SNext_6q0pi_gg_,.___SPrev_6q0pi_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SNext_6q0pi_gg_ .___SNextButton_6q0pi_gg_ span:has(>svg:only-child),.___SNext_6q0pi_gg_ .___SPrevButton_6q0pi_gg_ span:has(>svg:only-child),.___SPrev_6q0pi_gg_ .___SNextButton_6q0pi_gg_ span:has(>svg:only-child),.___SPrev_6q0pi_gg_ .___SPrevButton_6q0pi_gg_ span:has(>svg:only-child){margin-left:calc(2*var(--intergalactic-spacing-1x, 4px) - 1px);margin-right:calc(2*var(--intergalactic-spacing-1x, 4px) - 1px)}.___SNextButton_6q0pi_gg_:focus-visible,.___SPrevButton_6q0pi_gg_:focus-visible{box-shadow:none}.___SNextButton_6q0pi_gg_:focus-visible:after,.___SPrevButton_6q0pi_gg_:focus-visible:after{content:"";display:block;position:absolute;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1;width:calc(100% - 3px*2);height:calc(100% - 3px*2);top:3px;left:3px;border-radius:var(--intergalactic-control-rounded, 6px)}.___SPrev_6q0pi_gg_{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SNext_6q0pi_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNext_6q0pi_gg_.__disabled_6q0pi_gg_,.___SPrev_6q0pi_gg_.__disabled_6q0pi_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_6q0pi_gg_{transition:none}}',
30
- "6q0pi_gg_"
28
+ '.___SCarousel_vh2eh_gg_{overflow:hidden;outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SContainer_vh2eh_gg_{display:flex;transition:transform var(--duration_vh2eh) ease-in-out}.___SContentBox_vh2eh_gg_,.___SModalBox_vh2eh_gg_{position:relative;overflow:hidden;border-radius:var(--intergalactic-surface-rounded, 6px)}.___SContentBox_vh2eh_gg_:has(.___SItem_vh2eh_gg_.__keyboardFocused_vh2eh_gg_):after,.___SModalBox_vh2eh_gg_:has(.___SItem_vh2eh_gg_.__keyboardFocused_vh2eh_gg_):after{content:"";display:block;position:absolute;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));z-index:1;width:calc(100% - 3px*2);height:calc(100% - 3px*2);top:3px;left:3px}.___SModalContainer_vh2eh_gg_{display:flex;transition:transform var(--duration_vh2eh) ease-in-out}.___SItem_vh2eh_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_vh2eh);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden;outline:0}.___SItem_vh2eh_gg_.__zoomIn_vh2eh_gg_{cursor:zoom-in}.___SItem_vh2eh_gg_.__zoomOut_vh2eh_gg_{cursor:zoom-out}.___SIndicators_vh2eh_gg_{display:flex;justify-content:center;margin:var(--intergalactic-spacing-4x, 16px) 3px 3px 3px;outline:0;position:relative}.___SIndicator_vh2eh_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_vh2eh_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_vh2eh_gg_.__active_vh2eh_gg_{opacity:1}.___SIndicator_vh2eh_gg_.__inverted_vh2eh_gg_{background-color:var(--intergalactic-icon-primary-invert, #ffffff)}.___SNext_vh2eh_gg_,.___SPrev_vh2eh_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SNext_vh2eh_gg_ .___SNextButton_vh2eh_gg_ span:has(>svg:only-child),.___SNext_vh2eh_gg_ .___SPrevButton_vh2eh_gg_ span:has(>svg:only-child),.___SPrev_vh2eh_gg_ .___SNextButton_vh2eh_gg_ span:has(>svg:only-child),.___SPrev_vh2eh_gg_ .___SPrevButton_vh2eh_gg_ span:has(>svg:only-child){margin-left:calc(2*var(--intergalactic-spacing-1x, 4px) - 1px);margin-right:calc(2*var(--intergalactic-spacing-1x, 4px) - 1px)}.___SPrev_vh2eh_gg_{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SNext_vh2eh_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNext_vh2eh_gg_.__disabled_vh2eh_gg_,.___SPrev_vh2eh_gg_.__disabled_vh2eh_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_vh2eh_gg_{transition:none}}',
29
+ "vh2eh_gg_"
31
30
  ), {
32
- __SCarousel: "___SCarousel_6q0pi_gg_",
33
- __SContainer: "___SContainer_6q0pi_gg_",
34
- "--duration": "--duration_6q0pi",
35
- __SModalContainer: "___SModalContainer_6q0pi_gg_",
36
- __SItem: "___SItem_6q0pi_gg_",
37
- "--transform": "--transform_6q0pi",
38
- _zoomIn: "__zoomIn_6q0pi_gg_",
39
- _zoomOut: "__zoomOut_6q0pi_gg_",
40
- __SIndicators: "___SIndicators_6q0pi_gg_",
41
- _keyboardFocused: "__keyboardFocused_6q0pi_gg_",
42
- __SIndicator: "___SIndicator_6q0pi_gg_",
43
- _active: "__active_6q0pi_gg_",
44
- _inverted: "__inverted_6q0pi_gg_",
45
- __SPrev: "___SPrev_6q0pi_gg_",
46
- __SNext: "___SNext_6q0pi_gg_",
47
- _disabled: "__disabled_6q0pi_gg_",
48
- __SContentBox: "___SContentBox_6q0pi_gg_",
49
- __SModalBox: "___SModalBox_6q0pi_gg_",
50
- __SPrevButton: "___SPrevButton_6q0pi_gg_",
51
- __SNextButton: "___SNextButton_6q0pi_gg_"
31
+ __SCarousel: "___SCarousel_vh2eh_gg_",
32
+ __SContainer: "___SContainer_vh2eh_gg_",
33
+ "--duration": "--duration_vh2eh",
34
+ __SModalContainer: "___SModalContainer_vh2eh_gg_",
35
+ __SItem: "___SItem_vh2eh_gg_",
36
+ "--transform": "--transform_vh2eh",
37
+ _zoomIn: "__zoomIn_vh2eh_gg_",
38
+ _zoomOut: "__zoomOut_vh2eh_gg_",
39
+ __SIndicators: "___SIndicators_vh2eh_gg_",
40
+ __SIndicator: "___SIndicator_vh2eh_gg_",
41
+ _active: "__active_vh2eh_gg_",
42
+ _inverted: "__inverted_vh2eh_gg_",
43
+ __SPrev: "___SPrev_vh2eh_gg_",
44
+ __SNext: "___SNext_vh2eh_gg_",
45
+ _disabled: "__disabled_vh2eh_gg_",
46
+ __SContentBox: "___SContentBox_vh2eh_gg_",
47
+ __SModalBox: "___SModalBox_vh2eh_gg_",
48
+ _keyboardFocused: "__keyboardFocused_vh2eh_gg_",
49
+ __SPrevButton: "___SPrevButton_vh2eh_gg_",
50
+ __SNextButton: "___SNextButton_vh2eh_gg_"
52
51
  })
53
- ), ee = {
52
+ ), J = {
54
53
  ArrowLeft: "left",
55
54
  ArrowRight: "right"
56
- }, te = [Y(), G(R)], re = ["(min-width: 481px)", "(max-width: 480px)"], z = J(re), ne = function(c) {
55
+ }, Q = [X(), W(H)], ee = ["(min-width: 481px)", "(max-width: 480px)"], D = q(ee), te = function(c) {
57
56
  return c === 1;
58
- }, k = /* @__PURE__ */ function(v) {
59
- O(_, v);
60
- var c = Z(_);
61
- function _(i) {
57
+ }, E = /* @__PURE__ */ function(p) {
58
+ Z(_, p);
59
+ var c = F(_);
60
+ function _(a) {
62
61
  var r, n, e;
63
- return $(this, _), e = c.call(this, i), m(g(e), "defaultItemsCount", 0), m(g(e), "refCarousel", /* @__PURE__ */ a.createRef()), m(g(e), "refContainer", /* @__PURE__ */ a.createRef()), m(g(e), "refModalContainer", /* @__PURE__ */ a.createRef()), m(g(e), "_touchStartCoord", -1), m(g(e), "handlerKeyDown", function(t) {
62
+ return $(this, _), e = c.call(this, a), h(m(e), "defaultItemsCount", 0), h(m(e), "refCarousel", /* @__PURE__ */ i.createRef()), h(m(e), "refContainer", /* @__PURE__ */ i.createRef()), h(m(e), "refModalContainer", /* @__PURE__ */ i.createRef()), h(m(e), "_touchStartCoord", -1), h(m(e), "handlerKeyDown", function(t) {
64
63
  var o = 1, s = e.state.items.length + 1;
65
64
  switch (t.key) {
66
65
  case "ArrowLeft":
67
66
  case "ArrowRight": {
68
- t.preventDefault(), e.transformItem(ee[t.key]);
67
+ t.preventDefault(), e.transformItem(J[t.key]);
69
68
  break;
70
69
  }
71
70
  case "Home": {
@@ -78,35 +77,35 @@ var Q = (
78
77
  }
79
78
  }
80
79
  t.metaKey && (t.key === "ArrowLeft" ? (t.preventDefault(), e.slideToValue(o)) : t.key === "ArrowRight" && (t.preventDefault(), e.slideToValue(s))), (t.key === "Enter" || t.key === " ") && t.target instanceof HTMLDivElement && t.target.role === "tabpanel" && e.handleToggleZoomModal();
81
- }), m(g(e), "toggleItem", function(t) {
80
+ }), h(m(e), "toggleItem", function(t) {
82
81
  var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
83
82
  e.setState(function(s) {
84
83
  var d = o ? s.items.filter(function(l) {
85
84
  return l.node !== t.node;
86
- }) : [].concat(B(s.items), [t]);
85
+ }) : [].concat(N(s.items), [t]);
87
86
  return {
88
87
  items: d
89
88
  };
90
89
  }), o || e.defaultItemsCount++;
91
- }), m(g(e), "transformContainer", function() {
90
+ }), h(m(e), "transformContainer", function() {
92
91
  var t = e.state.selectedIndex * -1 * 100;
93
92
  e.refContainer.current && (e.refContainer.current.style.transform = "translateX(".concat(t, "%)")), e.refModalContainer.current && (e.refModalContainer.current.style.transform = "translateX(".concat(t, "%)"));
94
- }), m(g(e), "getDirection", function(t, o) {
93
+ }), h(m(e), "getDirection", function(t, o) {
95
94
  var s = e.asProps.bounded;
96
95
  if (s)
97
96
  return t < o ? "right" : "left";
98
- var d = e.state.items, l = d.map(function(P, h) {
99
- return h;
100
- }), u = B(l), p = u[0], y = u[u.length - 1];
97
+ var d = e.state.items, l = d.map(function(k, x) {
98
+ return x;
99
+ }), u = N(l), f = u[0], y = u[u.length - 1];
101
100
  if (u.length === 2)
102
101
  return t < o ? "right" : "left";
103
- t === p && (u.unshift(y), u.pop()), t === y && (u.shift(), u.push(p));
104
- var b = u.indexOf(t), q = u.indexOf(o);
105
- return q - b < 0 ? "left" : "right";
106
- }), m(g(e), "slideToValue", function(t) {
102
+ t === f && (u.unshift(y), u.pop()), t === y && (u.shift(), u.push(f));
103
+ var b = u.indexOf(t), P = u.indexOf(o);
104
+ return P - b < 0 ? "left" : "right";
105
+ }), h(m(e), "slideToValue", function(t) {
107
106
  for (var o = e.state.selectedIndex, s = o < t ? "right" : "left", d = Math.abs(o - t); d > 0; )
108
107
  e.transformItem(s), d--;
109
- }), m(g(e), "transformItem", function(t) {
108
+ }), h(m(e), "transformItem", function(t) {
110
109
  var o = e.asProps.bounded, s = e.state, d = s.items, l = s.selectedIndex, u = d.length - 1;
111
110
  if (t === "right") {
112
111
  if (o && l === u) {
@@ -117,9 +116,9 @@ var Q = (
117
116
  e.handlers.index(l === u ? 0 : l + 1);
118
117
  return;
119
118
  }
120
- e.setState(function(p) {
119
+ e.setState(function(f) {
121
120
  return {
122
- selectedIndex: p.selectedIndex + 1
121
+ selectedIndex: f.selectedIndex + 1
123
122
  };
124
123
  }, function() {
125
124
  e.transformContainer(), e.handlers.index(e.getIndex());
@@ -135,20 +134,20 @@ var Q = (
135
134
  e.handlers.index(l === 0 ? u : l - 1);
136
135
  return;
137
136
  }
138
- e.setState(function(p) {
137
+ e.setState(function(f) {
139
138
  return {
140
- selectedIndex: p.selectedIndex - 1
139
+ selectedIndex: f.selectedIndex - 1
141
140
  };
142
141
  }, function() {
143
142
  e.transformContainer(), e.handlers.index(e.getIndex());
144
143
  });
145
144
  return;
146
145
  }
147
- }), m(g(e), "bindHandlerClick", function(t) {
146
+ }), h(m(e), "bindHandlerClick", function(t) {
148
147
  return function() {
149
148
  e.transformItem(t);
150
149
  };
151
- }), m(g(e), "bindHandlerClickIndicator", function(t) {
150
+ }), h(m(e), "bindHandlerClickIndicator", function(t) {
152
151
  return function() {
153
152
  var o = e.state, s = o.selectedIndex, d = o.items;
154
153
  if (!e.isControlled && t !== s) {
@@ -157,12 +156,12 @@ var Q = (
157
156
  }
158
157
  e.handlers.index(t);
159
158
  };
160
- }), m(g(e), "handlerTouchStart", function(t) {
159
+ }), h(m(e), "handlerTouchStart", function(t) {
161
160
  e._touchStartCoord = t.changedTouches[0].clientX;
162
- }), m(g(e), "handlerTouchEnd", function(t) {
161
+ }), h(m(e), "handlerTouchEnd", function(t) {
163
162
  var o = t.changedTouches[0].clientX, s = o - e._touchStartCoord;
164
163
  s > 50 ? e.transformItem("left") : s < -50 && e.transformItem("right");
165
- }), m(g(e), "handleToggleZoomModal", function() {
164
+ }), h(m(e), "handleToggleZoomModal", function() {
166
165
  e.setState(function(t) {
167
166
  return {
168
167
  isOpenZoom: !t.isOpenZoom
@@ -170,17 +169,17 @@ var Q = (
170
169
  }, function() {
171
170
  e.state.isOpenZoom && e.transformContainer();
172
171
  });
173
- }), m(g(e), "bindHandlerKeydownControl", function(t) {
172
+ }), h(m(e), "bindHandlerKeydownControl", function(t) {
174
173
  return function(o) {
175
174
  (o.key === "Enter" || o.key === " ") && (o.preventDefault(), e.bindHandlerClick(t)());
176
175
  };
177
- }), e.isControlled = i.index !== void 0, e.state = {
176
+ }), e.isControlled = a.index !== void 0, e.state = {
178
177
  items: [],
179
178
  isOpenZoom: !1,
180
- selectedIndex: (r = (n = i.index) !== null && n !== void 0 ? n : i.defaultIndex) !== null && r !== void 0 ? r : 0
179
+ selectedIndex: (r = (n = a.index) !== null && n !== void 0 ? n : a.defaultIndex) !== null && r !== void 0 ? r : 0
181
180
  }, e;
182
181
  }
183
- return D(_, [{
182
+ return O(_, [{
184
183
  key: "uncontrolledProps",
185
184
  value: function() {
186
185
  var r = this;
@@ -198,11 +197,11 @@ var Q = (
198
197
  key: "componentDidMount",
199
198
  value: function() {
200
199
  var r = this.state.selectedIndex;
201
- r !== 0 && (r < 0 || r >= this.defaultItemsCount ? (N.warn(!0, "You couldn't use value for the `index` or `defaultIndex` not from `Item's` length range.", _.displayName), this.setState({
200
+ r !== 0 && (r < 0 || r >= this.defaultItemsCount ? (z.warn(!0, "You couldn't use value for the `index` or `defaultIndex` not from `Item's` length range.", _.displayName), this.setState({
202
201
  selectedIndex: 0
203
202
  })) : this.transformContainer());
204
- var n = T(this.asProps.Children, ["Carousel.Prev", "Carousel.Next", "Carousel.Indicators"]);
205
- N.warn(n.length > 0, "Please, try to remove `Prev`, `Next`, `Indicators` and other children components from your Carousel, except only `Item` elements.", _.displayName);
203
+ var n = M(this.asProps.Children, ["Carousel.Prev", "Carousel.Next", "Carousel.Indicators"]);
204
+ z.warn(n.length > 0, "Please, try to remove `Prev`, `Next`, `Indicators` and other children components from your Carousel, except only `Item` elements.", _.displayName);
206
205
  }
207
206
  }, {
208
207
  key: "componentDidUpdate",
@@ -275,6 +274,7 @@ var Q = (
275
274
  };
276
275
  }),
277
276
  role: "tablist",
277
+ tabIndex: 0,
278
278
  "aria-label": e("slides")
279
279
  };
280
280
  }
@@ -312,51 +312,51 @@ var Q = (
312
312
  }, {
313
313
  key: "renderModal",
314
314
  value: function(r, n) {
315
- var e = this.asProps, t, o = this, s = x, d = x, l = this.asProps, u = l.styles, p = l.uid, y = l.duration, b = l.zoomWidth, q = this.state.isOpenZoom;
316
- return t = C(u), /* @__PURE__ */ a.createElement(V, t.cn("Modal", {
317
- visible: q,
315
+ var e = this.asProps, t, o = this, s = I, d = I, l = this.asProps, u = l.styles, f = l.uid, y = l.duration, b = l.zoomWidth, P = this.state.isOpenZoom;
316
+ return t = g(u), /* @__PURE__ */ i.createElement(j, t.cn("Modal", {
317
+ visible: P,
318
318
  onClose: this.handleToggleZoomModal,
319
319
  ghost: !0,
320
320
  closable: !r
321
- }), /* @__PURE__ */ a.createElement(E, t.cn("Flex", {
321
+ }), /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
322
322
  direction: r ? "column" : "row"
323
- }), !r && /* @__PURE__ */ a.createElement(f.Prev, {
323
+ }), !r && /* @__PURE__ */ i.createElement(v.Prev, {
324
324
  inverted: !0
325
- }), /* @__PURE__ */ a.createElement(d, t.cn("SModalBox", {}), /* @__PURE__ */ a.createElement(s, t.cn("SModalContainer", I({}, S({
325
+ }), /* @__PURE__ */ i.createElement(d, t.cn("SModalBox", {}), /* @__PURE__ */ i.createElement(s, t.cn("SModalContainer", C({}, S({
326
326
  "aria-live": "polite",
327
327
  "use:duration": "".concat(y, "ms"),
328
328
  ref: this.refModalContainer,
329
329
  "use:w": void 0,
330
330
  wMax: b
331
- }, e))), n.map(function(P, h) {
332
- return /* @__PURE__ */ a.createElement(f.Item, w({}, P.props, {
333
- key: P.key,
334
- uid: p,
335
- index: h,
336
- current: o.isSelected(h),
331
+ }, e))), n.map(function(k, x) {
332
+ return /* @__PURE__ */ i.createElement(v.Item, w({}, k.props, {
333
+ key: k.key,
334
+ uid: f,
335
+ index: x,
336
+ current: o.isSelected(x),
337
337
  toggleItem: void 0,
338
338
  zoom: !0,
339
339
  zoomOut: !0,
340
- transform: o.isSelected(h) ? o.getTransform() : void 0
340
+ transform: o.isSelected(x) ? o.getTransform() : void 0
341
341
  }));
342
- }))), r ? /* @__PURE__ */ a.createElement(E, t.cn("Flex", {
342
+ }))), r ? /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
343
343
  justifyContent: "center",
344
344
  mt: 2
345
- }), /* @__PURE__ */ a.createElement(f.Prev, {
345
+ }), /* @__PURE__ */ i.createElement(v.Prev, {
346
346
  inverted: !0
347
- }), /* @__PURE__ */ a.createElement(f.Next, {
347
+ }), /* @__PURE__ */ i.createElement(v.Next, {
348
348
  inverted: !0
349
- })) : /* @__PURE__ */ a.createElement(f.Next, {
349
+ })) : /* @__PURE__ */ i.createElement(v.Next, {
350
350
  inverted: !0
351
- })), !r && /* @__PURE__ */ a.createElement(f.Indicators, {
351
+ })), !r && /* @__PURE__ */ i.createElement(v.Indicators, {
352
352
  inverted: !0
353
353
  }));
354
354
  }
355
355
  }, {
356
356
  key: "render",
357
357
  value: function() {
358
- var r = this.asProps, n, e = this, t = x, o = this.asProps, s = o.styles, d = o.Children, l = o.uid, u = o.zoom, p = o["aria-label"], y = o["aria-roledescription"], b = o.indicators, q = T(d, ["Carousel.Item"]), P = T(d, ["Carousel.Prev", "Carousel.Next", "Carousel.Indicators"]);
359
- return n = C(s), /* @__PURE__ */ a.createElement(t, n.cn("SCarousel", I({}, S({
358
+ var r = this.asProps, n, e = this, t = I, o = this.asProps, s = o.styles, d = o.Children, l = o.uid, u = o.zoom, f = o["aria-label"], y = o["aria-roledescription"], b = o.indicators, P = M(d, ["Carousel.Item"]), k = M(d, ["Carousel.Prev", "Carousel.Next", "Carousel.Indicators"]);
359
+ return n = g(s), /* @__PURE__ */ i.createElement(t, n.cn("SCarousel", C({}, S({
360
360
  role: "region",
361
361
  roledescription: "carousel",
362
362
  onKeyDown: this.handlerKeyDown,
@@ -365,57 +365,57 @@ var Q = (
365
365
  ref: this.refCarousel,
366
366
  id: "igc-".concat(l, "-carousel"),
367
367
  "aria-roledescription": y
368
- }, r))), P.length === 0 ? /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(E, n.cn("Flex", {}), /* @__PURE__ */ a.createElement(f.Prev, null), /* @__PURE__ */ a.createElement(f.ContentBox, null, /* @__PURE__ */ a.createElement(f.Container, {
369
- "aria-label": p
370
- }, /* @__PURE__ */ a.createElement(d, n.cn("Children", {})))), /* @__PURE__ */ a.createElement(f.Next, null)), b === "default" && /* @__PURE__ */ a.createElement(f.Indicators, null), b === "preview" && /* @__PURE__ */ a.createElement(f.Indicators, null, function() {
371
- return q.map(function(h, M) {
372
- return /* @__PURE__ */ a.createElement(f.Indicator, w({}, h.props, {
373
- key: h.key,
368
+ }, r))), k.length === 0 ? /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(T, n.cn("Flex", {}), /* @__PURE__ */ i.createElement(v.Prev, null), /* @__PURE__ */ i.createElement(v.ContentBox, null, /* @__PURE__ */ i.createElement(v.Container, {
369
+ "aria-label": f
370
+ }, /* @__PURE__ */ i.createElement(d, n.cn("Children", {})))), /* @__PURE__ */ i.createElement(v.Next, null)), b === "default" && /* @__PURE__ */ i.createElement(v.Indicators, null), b === "preview" && /* @__PURE__ */ i.createElement(v.Indicators, null, function() {
371
+ return P.map(function(x, B) {
372
+ return /* @__PURE__ */ i.createElement(v.Indicator, w({}, x.props, {
373
+ key: x.key,
374
374
  w: 100,
375
375
  h: 100,
376
376
  "aria-roledescription": "slide",
377
- active: e.isSelected(M),
378
- onClick: e.bindHandlerClickIndicator(M)
377
+ active: e.isSelected(B),
378
+ onClick: e.bindHandlerClickIndicator(B)
379
379
  }));
380
380
  });
381
- })) : /* @__PURE__ */ a.createElement(d, n.cn("Children", {})), u && /* @__PURE__ */ a.createElement(z, n.cn("BreakPoints", {}), /* @__PURE__ */ a.createElement(z.Context.Consumer, null, function(h) {
382
- return e.renderModal(ne(h), q);
381
+ })) : /* @__PURE__ */ i.createElement(d, n.cn("Children", {})), u && /* @__PURE__ */ i.createElement(D, n.cn("BreakPoints", {}), /* @__PURE__ */ i.createElement(D.Context.Consumer, null, function(x) {
382
+ return e.renderModal(te(x), P);
383
383
  })));
384
384
  }
385
385
  }]), _;
386
- }(F);
387
- m(k, "displayName", "Carousel");
388
- m(k, "defaultProps", {
386
+ }(A);
387
+ h(E, "displayName", "Carousel");
388
+ h(E, "defaultProps", {
389
389
  defaultIndex: 0,
390
390
  duration: 350,
391
391
  step: 100,
392
392
  bounded: !1,
393
- i18n: R,
393
+ i18n: H,
394
394
  locale: "en",
395
395
  indicators: "default"
396
396
  });
397
- m(k, "style", Q);
398
- m(k, "enhance", te);
399
- var oe = function(c) {
400
- var _ = arguments[0], i, r = x, n = c.styles, e = c.duration;
401
- return i = C(n), /* @__PURE__ */ a.createElement(r, i.cn("SContainer", I({}, S({
397
+ h(E, "style", G);
398
+ h(E, "enhance", Q);
399
+ var re = function(c) {
400
+ var _ = arguments[0], a, r = I, n = c.styles, e = c.duration;
401
+ return a = g(n), /* @__PURE__ */ i.createElement(r, a.cn("SContainer", C({}, S({
402
402
  "use:duration": "".concat(e, "ms"),
403
403
  "aria-live": "polite"
404
404
  }, _))));
405
- }, ie = function(c) {
406
- var _ = arguments[0], i, r = x, n = c.styles;
407
- return i = C(n), /* @__PURE__ */ a.createElement(r, i.cn("SContentBox", I({}, S({}, _))));
408
- }, K = /* @__PURE__ */ function(v) {
409
- O(_, v);
410
- var c = Z(_);
405
+ }, ne = function(c) {
406
+ var _ = arguments[0], a, r = I, n = c.styles;
407
+ return a = g(n), /* @__PURE__ */ i.createElement(r, a.cn("SContentBox", C({}, S({}, _))));
408
+ }, K = /* @__PURE__ */ function(p) {
409
+ Z(_, p);
410
+ var c = F(_);
411
411
  function _() {
412
- var i;
412
+ var a;
413
413
  $(this, _);
414
414
  for (var r = arguments.length, n = new Array(r), e = 0; e < r; e++)
415
415
  n[e] = arguments[e];
416
- return i = c.call.apply(c, [this].concat(n)), m(g(i), "refItem", /* @__PURE__ */ a.createRef()), m(g(i), "keepFocusTimeout", void 0), i;
416
+ return a = c.call.apply(c, [this].concat(n)), h(m(a), "refItem", /* @__PURE__ */ i.createRef()), h(m(a), "keepFocusTimeout", void 0), a;
417
417
  }
418
- return D(_, [{
418
+ return O(_, [{
419
419
  key: "componentDidMount",
420
420
  value: function() {
421
421
  var r = this.props, n = r.toggleItem, e = r.transform, t = this.refItem.current;
@@ -448,8 +448,8 @@ var oe = function(c) {
448
448
  }, {
449
449
  key: "render",
450
450
  value: function() {
451
- var r = this.asProps, n, e = this.props, t = e.styles, o = e.index, s = e.uid, d = e.current, l = e.zoomIn, u = e.onToggleZoomModal, p = x;
452
- return n = C(t), /* @__PURE__ */ a.createElement(p, n.cn("SItem", I({}, S({
451
+ var r = this.asProps, n, e = this.props, t = e.styles, o = e.index, s = e.uid, d = e.current, l = e.zoomIn, u = e.onToggleZoomModal, f = I;
452
+ return n = g(t), /* @__PURE__ */ i.createElement(f, n.cn("SItem", C({}, S({
453
453
  ref: this.refItem,
454
454
  role: "tabpanel",
455
455
  "data-carousel": "igc-".concat(s, "-carousel"),
@@ -461,57 +461,57 @@ var oe = function(c) {
461
461
  }, r))));
462
462
  }
463
463
  }]), _;
464
- }(F);
465
- m(K, "enhance", [H(!1)]);
466
- var ae = function(c) {
467
- var _ = arguments[0], i, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, d = c.inverted, l = x, u = A;
468
- return i = C(r), /* @__PURE__ */ a.createElement(l, i.cn("SPrev", I({}, S({
464
+ }(A);
465
+ h(K, "enhance", [Y(!1)]);
466
+ var oe = function(c) {
467
+ var _ = arguments[0], a, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, d = c.inverted, l = I, u = R;
468
+ return a = g(r), /* @__PURE__ */ i.createElement(l, a.cn("SPrev", C({}, S({
469
469
  top: s
470
- }, _))), n ? /* @__PURE__ */ a.createElement(e, i.cn("Children", {})) : /* @__PURE__ */ a.createElement(u, i.cn("SPrevButton", {
471
- addonLeft: W,
470
+ }, _))), n ? /* @__PURE__ */ i.createElement(e, a.cn("Children", {})) : /* @__PURE__ */ i.createElement(u, a.cn("SPrevButton", {
471
+ addonLeft: V,
472
472
  "aria-label": t,
473
473
  theme: d ? "invert" : "muted",
474
474
  use: "tertiary",
475
- size: "l"
475
+ size: "l",
476
+ innerOutline: !0
476
477
  })));
477
- }, se = function(c) {
478
- var _ = arguments[0], i, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, d = c.inverted, l = x, u = A;
479
- return i = C(r), /* @__PURE__ */ a.createElement(l, i.cn("SNext", I({}, S({
478
+ }, ae = function(c) {
479
+ var _ = arguments[0], a, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, d = c.inverted, l = I, u = R;
480
+ return a = g(r), /* @__PURE__ */ i.createElement(l, a.cn("SNext", C({}, S({
480
481
  top: s
481
- }, _))), n ? /* @__PURE__ */ a.createElement(e, i.cn("Children", {})) : /* @__PURE__ */ a.createElement(u, i.cn("SNextButton", {
482
- addonLeft: X,
482
+ }, _))), n ? /* @__PURE__ */ i.createElement(e, a.cn("Children", {})) : /* @__PURE__ */ i.createElement(u, a.cn("SNextButton", {
483
+ addonLeft: U,
483
484
  "aria-label": t,
484
485
  theme: d ? "invert" : "muted",
485
486
  use: "tertiary",
486
- size: "l"
487
+ size: "l",
488
+ innerOutline: !0
487
489
  })));
488
- }, L = function(c) {
489
- var _ = arguments[0], i, r = c.items, n = c.styles, e = c.Children, t = c.inverted, o = x;
490
+ }, ie = function(c) {
491
+ var _ = arguments[0], a, r = c.items, n = c.styles, e = c.Children, t = c.inverted, o = I;
490
492
  if (e.origin) {
491
493
  var s;
492
- return s = C(n), /* @__PURE__ */ a.createElement(o, s.cn("SIndicators", I({}, S({}, _))), /* @__PURE__ */ a.createElement(e, s.cn("Children", {})));
494
+ return s = g(n), /* @__PURE__ */ i.createElement(o, s.cn("SIndicators", C({}, S({}, _))), /* @__PURE__ */ i.createElement(e, s.cn("Children", {})));
493
495
  }
494
- return i = C(n), /* @__PURE__ */ a.createElement(o, i.cn("SIndicators", I({}, S({}, _))), r == null ? void 0 : r.map(function(d, l) {
495
- return /* @__PURE__ */ a.createElement(f.Indicator, w({
496
+ return a = g(n), /* @__PURE__ */ i.createElement(o, a.cn("SIndicators", C({}, S({}, _))), r == null ? void 0 : r.map(function(d, l) {
497
+ return /* @__PURE__ */ i.createElement(v.Indicator, w({
496
498
  key: l
497
499
  }, d, {
498
500
  inverted: t
499
501
  }));
500
502
  }));
501
- };
502
- L.enhance = [H()];
503
- var le = function(c) {
504
- var _ = arguments[0], i, r = c.styles, n = c.Children, e = x;
505
- return i = C(r), /* @__PURE__ */ a.createElement(e, i.cn("SIndicator", I({}, S({}, _))), /* @__PURE__ */ a.createElement(n, i.cn("Children", {})));
506
- }, f = U(k, {
507
- Container: oe,
508
- ContentBox: ie,
509
- Indicators: L,
510
- Indicator: le,
503
+ }, se = function(c) {
504
+ var _ = arguments[0], a, r = c.styles, n = c.Children, e = I;
505
+ return a = g(r), /* @__PURE__ */ i.createElement(e, a.cn("SIndicator", C({}, S({}, _))), /* @__PURE__ */ i.createElement(n, a.cn("Children", {})));
506
+ }, v = L(E, {
507
+ Container: re,
508
+ ContentBox: ne,
509
+ Indicators: ie,
510
+ Indicator: se,
511
511
  Item: K,
512
- Prev: ae,
513
- Next: se
512
+ Prev: oe,
513
+ Next: ae
514
514
  });
515
515
  export {
516
- f as default
516
+ v as default
517
517
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/carousel",
3
3
  "description": "Semrush Carousel Component",
4
- "version": "3.47.1",
4
+ "version": "16.0.0-prerelease.2",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,17 +14,14 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/flex-box": "5.41.1",
18
- "@semcore/icon": "4.60.1",
19
- "@semcore/utils": "4.48.1",
20
- "@semcore/button": "5.42.1",
21
- "@semcore/modal": "4.54.1",
22
- "@semcore/breakpoints": "1.41.1"
17
+ "@semcore/icon": "16.0.0-prerelease.2",
18
+ "@semcore/button": "16.0.0-prerelease.2",
19
+ "@semcore/modal": "16.0.0-prerelease.2",
20
+ "@semcore/flex-box": "16.0.0-prerelease.2",
21
+ "@semcore/breakpoints": "16.0.0-prerelease.2"
23
22
  },
24
23
  "peerDependencies": {
25
- "@semcore/core": "^2.17.5",
26
- "react": "16.8 - 18",
27
- "react-dom": "16.8 - 18"
24
+ "@semcore/base-components": "^16.0.0-prerelease.2"
28
25
  },
29
26
  "repository": {
30
27
  "type": "git",
@@ -32,7 +29,6 @@
32
29
  "directory": "semcore/carousel"
33
30
  },
34
31
  "devDependencies": {
35
- "@semcore/flex-box": "*",
36
32
  "@semcore/testing-utils": "1.0.0",
37
33
  "@types/react": "18.0.21"
38
34
  },