@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.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/Carousel.js +33 -33
- package/lib/cjs/Carousel.js.map +1 -1
- package/lib/cjs/style/carousel.shadow.css +1 -31
- package/lib/es6/Carousel.js +33 -31
- package/lib/es6/Carousel.js.map +1 -1
- package/lib/es6/style/carousel.shadow.css +1 -31
- package/lib/esm/Carousel.mjs +164 -164
- package/package.json +7 -11
- package/src/Carousel.tsx +11 -9
- package/src/style/carousel.shadow.css +1 -31
package/lib/esm/Carousel.mjs
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
1
|
import w from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { sstyled as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
|
|
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
|
-
(
|
|
26
|
+
(g.insert(
|
|
28
27
|
/*__inner_css_start__*/
|
|
29
|
-
'.
|
|
30
|
-
"
|
|
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: "
|
|
33
|
-
__SContainer: "
|
|
34
|
-
"--duration": "--
|
|
35
|
-
__SModalContainer: "
|
|
36
|
-
__SItem: "
|
|
37
|
-
"--transform": "--
|
|
38
|
-
_zoomIn: "
|
|
39
|
-
_zoomOut: "
|
|
40
|
-
__SIndicators: "
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
__SPrevButton: "
|
|
51
|
-
__SNextButton: "
|
|
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
|
-
),
|
|
52
|
+
), J = {
|
|
54
53
|
ArrowLeft: "left",
|
|
55
54
|
ArrowRight: "right"
|
|
56
|
-
},
|
|
55
|
+
}, Q = [X(), W(H)], ee = ["(min-width: 481px)", "(max-width: 480px)"], D = q(ee), te = function(c) {
|
|
57
56
|
return c === 1;
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
var c =
|
|
61
|
-
function _(
|
|
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,
|
|
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(
|
|
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(
|
|
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(
|
|
85
|
+
}) : [].concat(N(s.items), [t]);
|
|
87
86
|
return {
|
|
88
87
|
items: d
|
|
89
88
|
};
|
|
90
89
|
}), o || e.defaultItemsCount++;
|
|
91
|
-
}), m(
|
|
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(
|
|
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(
|
|
99
|
-
return
|
|
100
|
-
}), u =
|
|
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 ===
|
|
104
|
-
var b = u.indexOf(t),
|
|
105
|
-
return
|
|
106
|
-
}), m(
|
|
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(
|
|
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(
|
|
119
|
+
e.setState(function(f) {
|
|
121
120
|
return {
|
|
122
|
-
selectedIndex:
|
|
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(
|
|
137
|
+
e.setState(function(f) {
|
|
139
138
|
return {
|
|
140
|
-
selectedIndex:
|
|
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(
|
|
146
|
+
}), h(m(e), "bindHandlerClick", function(t) {
|
|
148
147
|
return function() {
|
|
149
148
|
e.transformItem(t);
|
|
150
149
|
};
|
|
151
|
-
}), m(
|
|
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(
|
|
159
|
+
}), h(m(e), "handlerTouchStart", function(t) {
|
|
161
160
|
e._touchStartCoord = t.changedTouches[0].clientX;
|
|
162
|
-
}), m(
|
|
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(
|
|
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(
|
|
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 =
|
|
176
|
+
}), e.isControlled = a.index !== void 0, e.state = {
|
|
178
177
|
items: [],
|
|
179
178
|
isOpenZoom: !1,
|
|
180
|
-
selectedIndex: (r = (n =
|
|
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
|
|
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 ? (
|
|
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 =
|
|
205
|
-
|
|
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 =
|
|
316
|
-
return t =
|
|
317
|
-
visible:
|
|
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__ */
|
|
321
|
+
}), /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
|
|
322
322
|
direction: r ? "column" : "row"
|
|
323
|
-
}), !r && /* @__PURE__ */
|
|
323
|
+
}), !r && /* @__PURE__ */ i.createElement(v.Prev, {
|
|
324
324
|
inverted: !0
|
|
325
|
-
}), /* @__PURE__ */
|
|
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(
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
key:
|
|
334
|
-
uid:
|
|
335
|
-
index:
|
|
336
|
-
current: o.isSelected(
|
|
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(
|
|
340
|
+
transform: o.isSelected(x) ? o.getTransform() : void 0
|
|
341
341
|
}));
|
|
342
|
-
}))), r ? /* @__PURE__ */
|
|
342
|
+
}))), r ? /* @__PURE__ */ i.createElement(T, t.cn("Flex", {
|
|
343
343
|
justifyContent: "center",
|
|
344
344
|
mt: 2
|
|
345
|
-
}), /* @__PURE__ */
|
|
345
|
+
}), /* @__PURE__ */ i.createElement(v.Prev, {
|
|
346
346
|
inverted: !0
|
|
347
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ i.createElement(v.Next, {
|
|
348
348
|
inverted: !0
|
|
349
|
-
})) : /* @__PURE__ */
|
|
349
|
+
})) : /* @__PURE__ */ i.createElement(v.Next, {
|
|
350
350
|
inverted: !0
|
|
351
|
-
})), !r && /* @__PURE__ */
|
|
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 =
|
|
359
|
-
return n =
|
|
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))),
|
|
369
|
-
"aria-label":
|
|
370
|
-
}, /* @__PURE__ */
|
|
371
|
-
return
|
|
372
|
-
return /* @__PURE__ */
|
|
373
|
-
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(
|
|
378
|
-
onClick: e.bindHandlerClickIndicator(
|
|
377
|
+
active: e.isSelected(B),
|
|
378
|
+
onClick: e.bindHandlerClickIndicator(B)
|
|
379
379
|
}));
|
|
380
380
|
});
|
|
381
|
-
})) : /* @__PURE__ */
|
|
382
|
-
return e.renderModal(
|
|
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
|
-
}(
|
|
387
|
-
|
|
388
|
-
|
|
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:
|
|
393
|
+
i18n: H,
|
|
394
394
|
locale: "en",
|
|
395
395
|
indicators: "default"
|
|
396
396
|
});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
var
|
|
400
|
-
var _ = arguments[0],
|
|
401
|
-
return
|
|
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
|
-
},
|
|
406
|
-
var _ = arguments[0],
|
|
407
|
-
return
|
|
408
|
-
}, K = /* @__PURE__ */ function(
|
|
409
|
-
|
|
410
|
-
var c =
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
452
|
-
return n =
|
|
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
|
-
}(
|
|
465
|
-
|
|
466
|
-
var
|
|
467
|
-
var _ = arguments[0],
|
|
468
|
-
return
|
|
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__ */
|
|
471
|
-
addonLeft:
|
|
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
|
-
},
|
|
478
|
-
var _ = arguments[0],
|
|
479
|
-
return
|
|
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__ */
|
|
482
|
-
addonLeft:
|
|
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
|
-
},
|
|
489
|
-
var _ = arguments[0],
|
|
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 =
|
|
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
|
|
495
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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:
|
|
513
|
-
Next:
|
|
512
|
+
Prev: oe,
|
|
513
|
+
Next: ae
|
|
514
514
|
});
|
|
515
515
|
export {
|
|
516
|
-
|
|
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": "
|
|
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/
|
|
18
|
-
"@semcore/
|
|
19
|
-
"@semcore/
|
|
20
|
-
"@semcore/
|
|
21
|
-
"@semcore/
|
|
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/
|
|
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
|
},
|