@rpg-engine/long-bow 0.5.71 → 0.5.73
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 +42 -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 +42 -32
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/components/ImageCarousel/SimpleImageCarousel.tsx +47 -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
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface ISimpleImageCarousel {
|
|
3
|
-
|
|
3
|
+
basePath: string;
|
|
4
|
+
imagesSrc: string[];
|
|
4
5
|
styles?: React.CSSProperties;
|
|
5
6
|
autoCycle?: boolean;
|
|
6
7
|
autoCycleDelay?: number;
|
|
7
8
|
stopAutoCyclingOnInteraction?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const SimpleImageCarousel:
|
|
10
|
+
export declare const SimpleImageCarousel: ({ basePath, imagesSrc, styles, autoCycle, autoCycleDelay, stopAutoCyclingOnInteraction, }: ISimpleImageCarousel) => JSX.Element;
|
|
@@ -18,6 +18,7 @@ var Draggable = _interopDefault(require('react-draggable'));
|
|
|
18
18
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
19
19
|
var lodash = require('lodash');
|
|
20
20
|
var mobxReactLite = require('mobx-react-lite');
|
|
21
|
+
var core = require('@capacitor/core');
|
|
21
22
|
var ai = require('react-icons/ai');
|
|
22
23
|
require('rpgui/rpgui.css');
|
|
23
24
|
require('rpgui/rpgui.min.js');
|
|
@@ -16014,8 +16015,15 @@ var CloseButton$3 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
16014
16015
|
componentId: "sc-jl6f8-4"
|
|
16015
16016
|
})(["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;}"]);
|
|
16016
16017
|
|
|
16018
|
+
var getTransformedBasePath = function getTransformedBasePath(basePath) {
|
|
16019
|
+
if (core.Capacitor.isNativePlatform()) {
|
|
16020
|
+
return core.Capacitor.convertFileSrc(basePath);
|
|
16021
|
+
}
|
|
16022
|
+
return basePath;
|
|
16023
|
+
};
|
|
16017
16024
|
var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
16018
|
-
var
|
|
16025
|
+
var basePath = _ref.basePath,
|
|
16026
|
+
imagesSrc = _ref.imagesSrc,
|
|
16019
16027
|
styles = _ref.styles,
|
|
16020
16028
|
_ref$autoCycle = _ref.autoCycle,
|
|
16021
16029
|
autoCycle = _ref$autoCycle === void 0 ? false : _ref$autoCycle,
|
|
@@ -16026,40 +16034,42 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16026
16034
|
var _useState = React.useState(0),
|
|
16027
16035
|
currentImage = _useState[0],
|
|
16028
16036
|
setCurrentImage = _useState[1];
|
|
16029
|
-
var
|
|
16030
|
-
var handleLeftClick = function handleLeftClick() {
|
|
16031
|
-
setCurrentImage(function (prevImage) {
|
|
16032
|
-
return (prevImage - 1 + (images == null ? void 0 : images.length)) % (images == null ? void 0 : images.length);
|
|
16033
|
-
});
|
|
16034
|
-
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16035
|
-
clearInterval(autoCycleId.current);
|
|
16036
|
-
autoCycleId.current = null;
|
|
16037
|
-
}
|
|
16038
|
-
};
|
|
16039
|
-
var handleRightClick = function handleRightClick() {
|
|
16040
|
-
setCurrentImage(function (prevImage) {
|
|
16041
|
-
return (prevImage + 1) % (images == null ? void 0 : images.length);
|
|
16042
|
-
});
|
|
16043
|
-
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16044
|
-
clearInterval(autoCycleId.current);
|
|
16045
|
-
autoCycleId.current = null;
|
|
16046
|
-
}
|
|
16047
|
-
};
|
|
16037
|
+
var isInteracted = React.useRef(false);
|
|
16048
16038
|
React.useEffect(function () {
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16039
|
+
var timer = null;
|
|
16040
|
+
if (autoCycle && !isInteracted.current) {
|
|
16041
|
+
timer = setInterval(function () {
|
|
16042
|
+
if (stopAutoCyclingOnInteraction && isInteracted.current) {
|
|
16043
|
+
clearInterval(timer);
|
|
16044
|
+
return;
|
|
16045
|
+
}
|
|
16046
|
+
handleRightClick(true);
|
|
16054
16047
|
}, autoCycleDelay);
|
|
16055
16048
|
}
|
|
16056
16049
|
return function () {
|
|
16057
|
-
if (
|
|
16058
|
-
clearInterval(
|
|
16050
|
+
if (timer) {
|
|
16051
|
+
clearInterval(timer);
|
|
16059
16052
|
}
|
|
16060
16053
|
};
|
|
16061
|
-
}, [autoCycle, autoCycleDelay
|
|
16062
|
-
var
|
|
16054
|
+
}, [autoCycle, autoCycleDelay]);
|
|
16055
|
+
var handleLeftClick = function handleLeftClick() {
|
|
16056
|
+
isInteracted.current = true;
|
|
16057
|
+
setCurrentImage(function (oldImage) {
|
|
16058
|
+
return oldImage === 0 ? imagesSrc.length - 1 : oldImage - 1;
|
|
16059
|
+
});
|
|
16060
|
+
};
|
|
16061
|
+
var handleRightClick = function handleRightClick(isAutomatedClick) {
|
|
16062
|
+
if (isAutomatedClick === void 0) {
|
|
16063
|
+
isAutomatedClick = false;
|
|
16064
|
+
}
|
|
16065
|
+
if (!isAutomatedClick) {
|
|
16066
|
+
isInteracted.current = true;
|
|
16067
|
+
}
|
|
16068
|
+
setCurrentImage(function (oldImage) {
|
|
16069
|
+
return oldImage === imagesSrc.length - 1 ? 0 : oldImage + 1;
|
|
16070
|
+
});
|
|
16071
|
+
};
|
|
16072
|
+
var hasMoreThanOneImage = imagesSrc.length > 1;
|
|
16063
16073
|
return React__default.createElement(ImageContainer, {
|
|
16064
16074
|
style: styles
|
|
16065
16075
|
}, hasMoreThanOneImage && React__default.createElement(CustomLeftArrow, {
|
|
@@ -16070,14 +16080,14 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16070
16080
|
onPointerDown: handleRightClick
|
|
16071
16081
|
}), React__default.createElement(Carousel, null, React__default.createElement(FadeInCarouselImg, {
|
|
16072
16082
|
key: currentImage,
|
|
16073
|
-
src:
|
|
16074
|
-
alt:
|
|
16083
|
+
src: getTransformedBasePath(basePath) + "/" + imagesSrc[currentImage],
|
|
16084
|
+
alt: imagesSrc[currentImage]
|
|
16075
16085
|
})));
|
|
16076
16086
|
};
|
|
16077
16087
|
var ImageContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
16078
16088
|
displayName: "SimpleImageCarousel__ImageContainer",
|
|
16079
16089
|
componentId: "sc-gdvbly-0"
|
|
16080
|
-
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;
|
|
16090
|
+
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;"]);
|
|
16081
16091
|
var CustomLeftArrow = /*#__PURE__*/styled__default(SelectArrow).withConfig({
|
|
16082
16092
|
displayName: "SimpleImageCarousel__CustomLeftArrow",
|
|
16083
16093
|
componentId: "sc-gdvbly-1"
|