@semcore/carousel 3.48.0-prerelease.0 → 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
- import M from "@babel/runtime/helpers/esm/extends";
2
- import I from "@babel/runtime/helpers/esm/objectSpread2";
1
+ import w from "@babel/runtime/helpers/esm/extends";
2
+ import C from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import N from "@babel/runtime/helpers/esm/toConsumableArray";
4
- import D from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import $ from "@babel/runtime/helpers/esm/classCallCheck";
5
5
  import O from "@babel/runtime/helpers/esm/createClass";
6
6
  import m from "@babel/runtime/helpers/esm/assertThisInitialized";
7
7
  import Z from "@babel/runtime/helpers/esm/inherits";
8
8
  import F from "@babel/runtime/helpers/esm/createSuper";
9
- import g from "@babel/runtime/helpers/esm/defineProperty";
10
- import { sstyled as U } from "@semcore/utils/lib/core/index";
11
- import V, { sstyled as C, assignProps as w, Component as A } from "@semcore/core";
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";
12
11
  import i from "react";
13
12
  import R from "@semcore/button";
14
- import X from "@semcore/modal";
15
- import { Flex as E, Box as p } from "@semcore/flex-box";
16
- import W from "@semcore/icon/ChevronRight/l";
17
- import q from "@semcore/icon/ChevronLeft/l";
18
- import Y from "@semcore/utils/lib/uniqueID";
19
- import G from "@semcore/utils/lib/enhances/i18nEnhance";
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";
20
19
  import { localizedMessages as H } from "./translations/__intergalactic-dynamic-locales.mjs";
21
- import z 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 K from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
25
- var Q = (
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
- (U.insert(
26
+ (g.insert(
28
27
  /*__inner_css_start__*/
29
- '.___SCarousel_wugsx_gg_{overflow:hidden;outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.___SContainer_wugsx_gg_{display:flex;transition:transform var(--duration_wugsx) ease-in-out}.___SContentBox_wugsx_gg_,.___SModalBox_wugsx_gg_{position:relative;overflow:hidden;border-radius:var(--intergalactic-surface-rounded, 6px)}.___SContentBox_wugsx_gg_:has(.___SItem_wugsx_gg_.__keyboardFocused_wugsx_gg_):after,.___SModalBox_wugsx_gg_:has(.___SItem_wugsx_gg_.__keyboardFocused_wugsx_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_wugsx_gg_{display:flex;transition:transform var(--duration_wugsx) ease-in-out}.___SItem_wugsx_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_wugsx);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden;outline:0}.___SItem_wugsx_gg_.__zoomIn_wugsx_gg_{cursor:zoom-in}.___SItem_wugsx_gg_.__zoomOut_wugsx_gg_{cursor:zoom-out}.___SIndicators_wugsx_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px);outline:0;position:relative}.___SIndicators_wugsx_gg_.__keyboardFocused_wugsx_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_wugsx_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_wugsx_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_wugsx_gg_.__active_wugsx_gg_{opacity:1}.___SIndicator_wugsx_gg_.__inverted_wugsx_gg_{background-color:var(--intergalactic-icon-primary-invert, #ffffff)}.___SNext_wugsx_gg_,.___SPrev_wugsx_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SNext_wugsx_gg_ .___SNextButton_wugsx_gg_ span:has(>svg:only-child),.___SNext_wugsx_gg_ .___SPrevButton_wugsx_gg_ span:has(>svg:only-child),.___SPrev_wugsx_gg_ .___SNextButton_wugsx_gg_ span:has(>svg:only-child),.___SPrev_wugsx_gg_ .___SPrevButton_wugsx_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_wugsx_gg_:focus-visible,.___SPrevButton_wugsx_gg_:focus-visible{box-shadow:none}.___SNextButton_wugsx_gg_:focus-visible:after,.___SPrevButton_wugsx_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_wugsx_gg_{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SNext_wugsx_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNext_wugsx_gg_.__disabled_wugsx_gg_,.___SPrev_wugsx_gg_.__disabled_wugsx_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_wugsx_gg_{transition:none}}',
30
- "wugsx_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_wugsx_gg_",
33
- __SContainer: "___SContainer_wugsx_gg_",
34
- "--duration": "--duration_wugsx",
35
- __SModalContainer: "___SModalContainer_wugsx_gg_",
36
- __SItem: "___SItem_wugsx_gg_",
37
- "--transform": "--transform_wugsx",
38
- _zoomIn: "__zoomIn_wugsx_gg_",
39
- _zoomOut: "__zoomOut_wugsx_gg_",
40
- __SIndicators: "___SIndicators_wugsx_gg_",
41
- _keyboardFocused: "__keyboardFocused_wugsx_gg_",
42
- __SIndicator: "___SIndicator_wugsx_gg_",
43
- _active: "__active_wugsx_gg_",
44
- _inverted: "__inverted_wugsx_gg_",
45
- __SPrev: "___SPrev_wugsx_gg_",
46
- __SNext: "___SNext_wugsx_gg_",
47
- _disabled: "__disabled_wugsx_gg_",
48
- __SContentBox: "___SContentBox_wugsx_gg_",
49
- __SModalBox: "___SModalBox_wugsx_gg_",
50
- __SPrevButton: "___SPrevButton_wugsx_gg_",
51
- __SNextButton: "___SNextButton_wugsx_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(H)], re = ["(min-width: 481px)", "(max-width: 480px)"], $ = 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(h) {
59
- Z(d, h);
60
- var c = F(d);
61
- function d(a) {
57
+ }, E = /* @__PURE__ */ function(p) {
58
+ Z(_, p);
59
+ var c = F(_);
60
+ function _(a) {
62
61
  var r, n, e;
63
- return D(this, d), e = c.call(this, a), g(m(e), "defaultItemsCount", 0), g(m(e), "refCarousel", /* @__PURE__ */ i.createRef()), g(m(e), "refContainer", /* @__PURE__ */ i.createRef()), g(m(e), "refModalContainer", /* @__PURE__ */ i.createRef()), g(m(e), "_touchStartCoord", -1), g(m(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,48 +77,48 @@ 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
- }), g(m(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
- var u = o ? s.items.filter(function(l) {
83
+ var d = o ? s.items.filter(function(l) {
85
84
  return l.node !== t.node;
86
85
  }) : [].concat(N(s.items), [t]);
87
86
  return {
88
- items: u
87
+ items: d
89
88
  };
90
89
  }), o || e.defaultItemsCount++;
91
- }), g(m(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
- }), g(m(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 u = e.state.items, l = u.map(function(P, x) {
97
+ var d = e.state.items, l = d.map(function(k, x) {
99
98
  return x;
100
- }), _ = N(l), v = _[0], S = _[_.length - 1];
101
- if (_.length === 2)
99
+ }), u = N(l), f = u[0], y = u[u.length - 1];
100
+ if (u.length === 2)
102
101
  return t < o ? "right" : "left";
103
- t === v && (_.unshift(S), _.pop()), t === S && (_.shift(), _.push(v));
104
- var y = _.indexOf(t), b = _.indexOf(o);
105
- return b - y < 0 ? "left" : "right";
106
- }), g(m(e), "slideToValue", function(t) {
107
- for (var o = e.state.selectedIndex, s = o < t ? "right" : "left", u = Math.abs(o - t); u > 0; )
108
- e.transformItem(s), u--;
109
- }), g(m(e), "transformItem", function(t) {
110
- var o = e.asProps.bounded, s = e.state, u = s.items, l = s.selectedIndex, _ = u.length - 1;
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) {
106
+ for (var o = e.state.selectedIndex, s = o < t ? "right" : "left", d = Math.abs(o - t); d > 0; )
107
+ e.transformItem(s), d--;
108
+ }), h(m(e), "transformItem", function(t) {
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
- if (o && l === _) {
113
- e.handlers.index(_);
111
+ if (o && l === u) {
112
+ e.handlers.index(u);
114
113
  return;
115
114
  }
116
115
  if (e.isControlled) {
117
- e.handlers.index(l === _ ? 0 : l + 1);
116
+ e.handlers.index(l === u ? 0 : l + 1);
118
117
  return;
119
118
  }
120
- e.setState(function(v) {
119
+ e.setState(function(f) {
121
120
  return {
122
- selectedIndex: v.selectedIndex + 1
121
+ selectedIndex: f.selectedIndex + 1
123
122
  };
124
123
  }, function() {
125
124
  e.transformContainer(), e.handlers.index(e.getIndex());
@@ -132,37 +131,37 @@ var Q = (
132
131
  return;
133
132
  }
134
133
  if (e.isControlled) {
135
- e.handlers.index(l === 0 ? _ : l - 1);
134
+ e.handlers.index(l === 0 ? u : l - 1);
136
135
  return;
137
136
  }
138
- e.setState(function(v) {
137
+ e.setState(function(f) {
139
138
  return {
140
- selectedIndex: v.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
- }), g(m(e), "bindHandlerClick", function(t) {
146
+ }), h(m(e), "bindHandlerClick", function(t) {
148
147
  return function() {
149
148
  e.transformItem(t);
150
149
  };
151
- }), g(m(e), "bindHandlerClickIndicator", function(t) {
150
+ }), h(m(e), "bindHandlerClickIndicator", function(t) {
152
151
  return function() {
153
- var o = e.state, s = o.selectedIndex, u = o.items;
152
+ var o = e.state, s = o.selectedIndex, d = o.items;
154
153
  if (!e.isControlled && t !== s) {
155
- var l = Math.floor(s / u.length) * u.length + t;
154
+ var l = Math.floor(s / d.length) * d.length + t;
156
155
  e.slideToValue(l);
157
156
  }
158
157
  e.handlers.index(t);
159
158
  };
160
- }), g(m(e), "handlerTouchStart", function(t) {
159
+ }), h(m(e), "handlerTouchStart", function(t) {
161
160
  e._touchStartCoord = t.changedTouches[0].clientX;
162
- }), g(m(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
- }), g(m(e), "handleToggleZoomModal", function() {
164
+ }), h(m(e), "handleToggleZoomModal", function() {
166
165
  e.setState(function(t) {
167
166
  return {
168
167
  isOpenZoom: !t.isOpenZoom
@@ -170,7 +169,7 @@ var Q = (
170
169
  }, function() {
171
170
  e.state.isOpenZoom && e.transformContainer();
172
171
  });
173
- }), g(m(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
  };
@@ -180,7 +179,7 @@ var Q = (
180
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 O(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 ? (z.warn(!0, "You couldn't use value for the `index` or `defaultIndex` not from `Item's` length range.", d.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
- z.warn(n.length > 0, "Please, try to remove `Prev`, `Next`, `Indicators` and other children components from your Carousel, except only `Item` elements.", d.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",
@@ -241,8 +240,8 @@ var Q = (
241
240
  }, {
242
241
  key: "getPrevProps",
243
242
  value: function() {
244
- var r = this.asProps, n = r.bounded, e = r.getI18nText, t = r.uid, o = this.state, s = o.items, u = o.selectedIndex, l = !1;
245
- return s.length && n && (l = u === 0), {
243
+ var r = this.asProps, n = r.bounded, e = r.getI18nText, t = r.uid, o = this.state, s = o.items, d = o.selectedIndex, l = !1;
244
+ return s.length && n && (l = d === 0), {
246
245
  onClick: this.bindHandlerClick("left"),
247
246
  onKeyDown: this.bindHandlerKeydownControl("left"),
248
247
  disabled: l,
@@ -253,8 +252,8 @@ var Q = (
253
252
  }, {
254
253
  key: "getNextProps",
255
254
  value: function() {
256
- var r = this.asProps, n = r.bounded, e = r.getI18nText, t = r.uid, o = this.state, s = o.items, u = o.selectedIndex, l = !1;
257
- return s.length && n && (l = u === s.length - 1), {
255
+ var r = this.asProps, n = r.bounded, e = r.getI18nText, t = r.uid, o = this.state, s = o.items, d = o.selectedIndex, l = !1;
256
+ return s.length && n && (l = d === s.length - 1), {
258
257
  onClick: this.bindHandlerClick("right"),
259
258
  onKeyDown: this.bindHandlerKeydownControl("right"),
260
259
  disabled: l,
@@ -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,26 +312,26 @@ var Q = (
312
312
  }, {
313
313
  key: "renderModal",
314
314
  value: function(r, n) {
315
- var e = this.asProps, t, o = this, s = p, u = p, l = this.asProps, _ = l.styles, v = l.uid, S = l.duration, y = l.zoomWidth, b = this.state.isOpenZoom;
316
- return t = C(_), /* @__PURE__ */ i.createElement(X, t.cn("Modal", {
317
- visible: b,
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__ */ i.createElement(E, t.cn("Flex", {
321
+ }), /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
322
322
  direction: r ? "column" : "row"
323
- }), !r && /* @__PURE__ */ i.createElement(f.Prev, {
323
+ }), !r && /* @__PURE__ */ i.createElement(v.Prev, {
324
324
  inverted: !0
325
- }), /* @__PURE__ */ i.createElement(u, t.cn("SModalBox", {}), /* @__PURE__ */ i.createElement(s, t.cn("SModalContainer", I({}, w({
325
+ }), /* @__PURE__ */ i.createElement(d, t.cn("SModalBox", {}), /* @__PURE__ */ i.createElement(s, t.cn("SModalContainer", C({}, S({
326
326
  "aria-live": "polite",
327
- "use:duration": "".concat(S, "ms"),
327
+ "use:duration": "".concat(y, "ms"),
328
328
  ref: this.refModalContainer,
329
329
  "use:w": void 0,
330
- wMax: y
331
- }, e))), n.map(function(P, x) {
332
- return /* @__PURE__ */ i.createElement(f.Item, M({}, P.props, {
333
- key: P.key,
334
- uid: v,
330
+ wMax: b
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
335
  index: x,
336
336
  current: o.isSelected(x),
337
337
  toggleItem: void 0,
@@ -339,24 +339,24 @@ var Q = (
339
339
  zoomOut: !0,
340
340
  transform: o.isSelected(x) ? o.getTransform() : void 0
341
341
  }));
342
- }))), r ? /* @__PURE__ */ i.createElement(E, t.cn("Flex", {
342
+ }))), r ? /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
343
343
  justifyContent: "center",
344
344
  mt: 2
345
- }), /* @__PURE__ */ i.createElement(f.Prev, {
345
+ }), /* @__PURE__ */ i.createElement(v.Prev, {
346
346
  inverted: !0
347
- }), /* @__PURE__ */ i.createElement(f.Next, {
347
+ }), /* @__PURE__ */ i.createElement(v.Next, {
348
348
  inverted: !0
349
- })) : /* @__PURE__ */ i.createElement(f.Next, {
349
+ })) : /* @__PURE__ */ i.createElement(v.Next, {
350
350
  inverted: !0
351
- })), !r && /* @__PURE__ */ i.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 = p, o = this.asProps, s = o.styles, u = o.Children, l = o.uid, _ = o.zoom, v = o["aria-label"], S = o["aria-roledescription"], y = o.indicators, b = T(u, ["Carousel.Item"]), P = T(u, ["Carousel.Prev", "Carousel.Next", "Carousel.Indicators"]);
359
- return n = C(s), /* @__PURE__ */ i.createElement(t, n.cn("SCarousel", I({}, w({
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,
@@ -364,12 +364,12 @@ var Q = (
364
364
  onTouchEnd: this.handlerTouchEnd,
365
365
  ref: this.refCarousel,
366
366
  id: "igc-".concat(l, "-carousel"),
367
- "aria-roledescription": S
368
- }, r))), P.length === 0 ? /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(E, n.cn("Flex", {}), /* @__PURE__ */ i.createElement(f.Prev, null), /* @__PURE__ */ i.createElement(f.ContentBox, null, /* @__PURE__ */ i.createElement(f.Container, {
369
- "aria-label": v
370
- }, /* @__PURE__ */ i.createElement(u, n.cn("Children", {})))), /* @__PURE__ */ i.createElement(f.Next, null)), y === "default" && /* @__PURE__ */ i.createElement(f.Indicators, null), y === "preview" && /* @__PURE__ */ i.createElement(f.Indicators, null, function() {
371
- return b.map(function(x, B) {
372
- return /* @__PURE__ */ i.createElement(f.Indicator, M({}, x.props, {
367
+ "aria-roledescription": y
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
373
  key: x.key,
374
374
  w: 100,
375
375
  h: 100,
@@ -378,14 +378,14 @@ var Q = (
378
378
  onClick: e.bindHandlerClickIndicator(B)
379
379
  }));
380
380
  });
381
- })) : /* @__PURE__ */ i.createElement(u, n.cn("Children", {})), _ && /* @__PURE__ */ i.createElement($, n.cn("BreakPoints", {}), /* @__PURE__ */ i.createElement($.Context.Consumer, null, function(x) {
382
- return e.renderModal(ne(x), b);
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
- }]), d;
385
+ }]), _;
386
386
  }(A);
387
- g(k, "displayName", "Carousel");
388
- g(k, "defaultProps", {
387
+ h(E, "displayName", "Carousel");
388
+ h(E, "defaultProps", {
389
389
  defaultIndex: 0,
390
390
  duration: 350,
391
391
  step: 100,
@@ -394,28 +394,28 @@ g(k, "defaultProps", {
394
394
  locale: "en",
395
395
  indicators: "default"
396
396
  });
397
- g(k, "style", Q);
398
- g(k, "enhance", te);
399
- var oe = function(c) {
400
- var d = arguments[0], a, r = p, n = c.styles, e = c.duration;
401
- return a = C(n), /* @__PURE__ */ i.createElement(r, a.cn("SContainer", I({}, w({
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
- }, d))));
405
- }, ae = function(c) {
406
- var d = arguments[0], a, r = p, n = c.styles;
407
- return a = C(n), /* @__PURE__ */ i.createElement(r, a.cn("SContentBox", I({}, w({}, d))));
408
- }, L = /* @__PURE__ */ function(h) {
409
- Z(d, h);
410
- var c = F(d);
411
- function d() {
404
+ }, _))));
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
+ function _() {
412
412
  var a;
413
- D(this, d);
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 a = c.call.apply(c, [this].concat(n)), g(m(a), "refItem", /* @__PURE__ */ i.createRef()), g(m(a), "keepFocusTimeout", void 0), a;
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 O(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,70 +448,70 @@ 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, u = e.current, l = e.zoomIn, _ = e.onToggleZoomModal, v = p;
452
- return n = C(t), /* @__PURE__ */ i.createElement(v, n.cn("SItem", I({}, w({
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"),
456
456
  id: "igc-".concat(s, "-carousel-item-").concat(o),
457
- "aria-current": u,
458
- "use:tabIndex": u ? 0 : -1,
459
- onClick: l ? _ : void 0,
457
+ "aria-current": d,
458
+ "use:tabIndex": d ? 0 : -1,
459
+ onClick: l ? u : void 0,
460
460
  zoomIn: l
461
461
  }, r))));
462
462
  }
463
- }]), d;
463
+ }]), _;
464
464
  }(A);
465
- g(L, "enhance", [K(!1)]);
466
- var ie = function(c) {
467
- var d = arguments[0], a, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, u = c.inverted, l = p, _ = R;
468
- return a = C(r), /* @__PURE__ */ i.createElement(l, a.cn("SPrev", I({}, w({
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
- }, d))), n ? /* @__PURE__ */ i.createElement(e, a.cn("Children", {})) : /* @__PURE__ */ i.createElement(_, a.cn("SPrevButton", {
471
- addonLeft: q,
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
- theme: u ? "invert" : "muted",
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 d = arguments[0], a, r = c.styles, n = c.children, e = c.Children, t = c.label, o = c.top, s = o === void 0 ? 0 : o, u = c.inverted, l = p, _ = R;
479
- return a = C(r), /* @__PURE__ */ i.createElement(l, a.cn("SNext", I({}, w({
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
- }, d))), n ? /* @__PURE__ */ i.createElement(e, a.cn("Children", {})) : /* @__PURE__ */ i.createElement(_, a.cn("SNextButton", {
482
- addonLeft: W,
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
- theme: u ? "invert" : "muted",
485
+ theme: d ? "invert" : "muted",
485
486
  use: "tertiary",
486
- size: "l"
487
+ size: "l",
488
+ innerOutline: !0
487
489
  })));
488
- }, j = function(c) {
489
- var d = arguments[0], a, r = c.items, n = c.styles, e = c.Children, t = c.inverted, o = p;
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__ */ i.createElement(o, s.cn("SIndicators", I({}, w({}, d))), /* @__PURE__ */ i.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 a = C(n), /* @__PURE__ */ i.createElement(o, a.cn("SIndicators", I({}, w({}, d))), r == null ? void 0 : r.map(function(u, l) {
495
- return /* @__PURE__ */ i.createElement(f.Indicator, M({
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
- }, u, {
499
+ }, d, {
498
500
  inverted: t
499
501
  }));
500
502
  }));
501
- };
502
- j.enhance = [K()];
503
- var le = function(c) {
504
- var d = arguments[0], a, r = c.styles, n = c.Children, e = p;
505
- return a = C(r), /* @__PURE__ */ i.createElement(e, a.cn("SIndicator", I({}, w({}, d))), /* @__PURE__ */ i.createElement(n, a.cn("Children", {})));
506
- }, f = V(k, {
507
- Container: oe,
508
- ContentBox: ae,
509
- Indicators: j,
510
- Indicator: le,
511
- Item: L,
512
- Prev: ie,
513
- Next: se
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
+ Item: K,
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.48.0-prerelease.0",
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.43.0-prerelease.0",
21
- "@semcore/modal": "4.55.0-prerelease.0",
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
  },