@rpg-engine/long-bow 0.5.71 → 0.5.72
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/dist/components/ImageCarousel/SimpleImageCarousel.d.ts +3 -2
- package/dist/long-bow.cjs.development.js +35 -32
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +35 -32
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ImageCarousel/SimpleImageCarousel.tsx +39 -32
- package/src/stories/SimpleImageCarousel.stories.tsx +2 -3
- package/src/assets/images/backpack.png +0 -0
- package/src/assets/images/depot.png +0 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -16011,7 +16011,8 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
16011
16011
|
})(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.5rem;@media (max-width:950px){font-size:1.7rem;padding:12px;}"]);
|
|
16012
16012
|
|
|
16013
16013
|
var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
16014
|
-
var
|
|
16014
|
+
var basePath = _ref.basePath,
|
|
16015
|
+
imagesSrc = _ref.imagesSrc,
|
|
16015
16016
|
styles = _ref.styles,
|
|
16016
16017
|
_ref$autoCycle = _ref.autoCycle,
|
|
16017
16018
|
autoCycle = _ref$autoCycle === void 0 ? false : _ref$autoCycle,
|
|
@@ -16022,40 +16023,42 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16022
16023
|
var _useState = useState(0),
|
|
16023
16024
|
currentImage = _useState[0],
|
|
16024
16025
|
setCurrentImage = _useState[1];
|
|
16025
|
-
var
|
|
16026
|
-
var handleLeftClick = function handleLeftClick() {
|
|
16027
|
-
setCurrentImage(function (prevImage) {
|
|
16028
|
-
return (prevImage - 1 + (images == null ? void 0 : images.length)) % (images == null ? void 0 : images.length);
|
|
16029
|
-
});
|
|
16030
|
-
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16031
|
-
clearInterval(autoCycleId.current);
|
|
16032
|
-
autoCycleId.current = null;
|
|
16033
|
-
}
|
|
16034
|
-
};
|
|
16035
|
-
var handleRightClick = function handleRightClick() {
|
|
16036
|
-
setCurrentImage(function (prevImage) {
|
|
16037
|
-
return (prevImage + 1) % (images == null ? void 0 : images.length);
|
|
16038
|
-
});
|
|
16039
|
-
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16040
|
-
clearInterval(autoCycleId.current);
|
|
16041
|
-
autoCycleId.current = null;
|
|
16042
|
-
}
|
|
16043
|
-
};
|
|
16026
|
+
var isInteracted = useRef(false);
|
|
16044
16027
|
useEffect(function () {
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16028
|
+
var timer = null;
|
|
16029
|
+
if (autoCycle && !isInteracted.current) {
|
|
16030
|
+
timer = setInterval(function () {
|
|
16031
|
+
if (stopAutoCyclingOnInteraction && isInteracted.current) {
|
|
16032
|
+
clearInterval(timer);
|
|
16033
|
+
return;
|
|
16034
|
+
}
|
|
16035
|
+
handleRightClick(true);
|
|
16050
16036
|
}, autoCycleDelay);
|
|
16051
16037
|
}
|
|
16052
16038
|
return function () {
|
|
16053
|
-
if (
|
|
16054
|
-
clearInterval(
|
|
16039
|
+
if (timer) {
|
|
16040
|
+
clearInterval(timer);
|
|
16055
16041
|
}
|
|
16056
16042
|
};
|
|
16057
|
-
}, [autoCycle, autoCycleDelay
|
|
16058
|
-
var
|
|
16043
|
+
}, [autoCycle, autoCycleDelay]);
|
|
16044
|
+
var handleLeftClick = function handleLeftClick() {
|
|
16045
|
+
isInteracted.current = true;
|
|
16046
|
+
setCurrentImage(function (oldImage) {
|
|
16047
|
+
return oldImage === 0 ? imagesSrc.length - 1 : oldImage - 1;
|
|
16048
|
+
});
|
|
16049
|
+
};
|
|
16050
|
+
var handleRightClick = function handleRightClick(isAutomatedClick) {
|
|
16051
|
+
if (isAutomatedClick === void 0) {
|
|
16052
|
+
isAutomatedClick = false;
|
|
16053
|
+
}
|
|
16054
|
+
if (!isAutomatedClick) {
|
|
16055
|
+
isInteracted.current = true;
|
|
16056
|
+
}
|
|
16057
|
+
setCurrentImage(function (oldImage) {
|
|
16058
|
+
return oldImage === imagesSrc.length - 1 ? 0 : oldImage + 1;
|
|
16059
|
+
});
|
|
16060
|
+
};
|
|
16061
|
+
var hasMoreThanOneImage = imagesSrc.length > 1;
|
|
16059
16062
|
return React.createElement(ImageContainer, {
|
|
16060
16063
|
style: styles
|
|
16061
16064
|
}, hasMoreThanOneImage && React.createElement(CustomLeftArrow, {
|
|
@@ -16066,14 +16069,14 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16066
16069
|
onPointerDown: handleRightClick
|
|
16067
16070
|
}), React.createElement(Carousel, null, React.createElement(FadeInCarouselImg, {
|
|
16068
16071
|
key: currentImage,
|
|
16069
|
-
src:
|
|
16070
|
-
alt:
|
|
16072
|
+
src: basePath + "/" + imagesSrc[currentImage],
|
|
16073
|
+
alt: imagesSrc[currentImage]
|
|
16071
16074
|
})));
|
|
16072
16075
|
};
|
|
16073
16076
|
var ImageContainer = /*#__PURE__*/styled.div.withConfig({
|
|
16074
16077
|
displayName: "SimpleImageCarousel__ImageContainer",
|
|
16075
16078
|
componentId: "sc-gdvbly-0"
|
|
16076
|
-
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;
|
|
16079
|
+
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;"]);
|
|
16077
16080
|
var CustomLeftArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
|
|
16078
16081
|
displayName: "SimpleImageCarousel__CustomLeftArrow",
|
|
16079
16082
|
componentId: "sc-gdvbly-1"
|