@rpg-engine/long-bow 0.5.74 → 0.5.76
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/Dropdown.d.ts +1 -0
- package/dist/components/ImageCarousel/SimpleImageCarousel.d.ts +2 -3
- package/dist/long-bow.cjs.development.js +42 -49
- 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 -49
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -2
- package/src/assets/images/backpack.png +0 -0
- package/src/assets/images/depot.png +0 -0
- package/src/components/Dropdown.tsx +14 -6
- package/src/components/ImageCarousel/SimpleImageCarousel.tsx +32 -48
- package/src/stories/Dropdown.stories.tsx +10 -2
- package/src/stories/SimpleImageCarousel.stories.tsx +3 -2
package/dist/long-bow.esm.js
CHANGED
|
@@ -10,7 +10,6 @@ import Draggable from 'react-draggable';
|
|
|
10
10
|
import ReactDOM from 'react-dom';
|
|
11
11
|
import { camelCase } from 'lodash-es';
|
|
12
12
|
import { observer } from 'mobx-react-lite';
|
|
13
|
-
import { Capacitor } from '@capacitor/core';
|
|
14
13
|
import { AiFillCaretRight } from 'react-icons/ai';
|
|
15
14
|
import 'rpgui/rpgui.css';
|
|
16
15
|
import 'rpgui/rpgui.min.js';
|
|
@@ -14887,7 +14886,9 @@ var ItemTypes = /*#__PURE__*/styled.div.withConfig({
|
|
|
14887
14886
|
var Dropdown = function Dropdown(_ref) {
|
|
14888
14887
|
var options = _ref.options,
|
|
14889
14888
|
width = _ref.width,
|
|
14890
|
-
onChange = _ref.onChange
|
|
14889
|
+
onChange = _ref.onChange,
|
|
14890
|
+
_ref$opensUp = _ref.opensUp,
|
|
14891
|
+
opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
|
|
14891
14892
|
var dropdownId = v4();
|
|
14892
14893
|
var _useState = useState(''),
|
|
14893
14894
|
selectedValue = _useState[0],
|
|
@@ -14907,10 +14908,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
14907
14908
|
return o.value === selectedValue;
|
|
14908
14909
|
}).length < 1;
|
|
14909
14910
|
}
|
|
14910
|
-
/**
|
|
14911
|
-
* make a selection if there is no selected value already present
|
|
14912
|
-
* or if there is a selected value but its not in new options
|
|
14913
|
-
*/
|
|
14914
14911
|
if (change) {
|
|
14915
14912
|
setSelectedValue(firstOption.value);
|
|
14916
14913
|
setSelectedOption(firstOption.option);
|
|
@@ -14937,7 +14934,8 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
14937
14934
|
}
|
|
14938
14935
|
}, React.createElement("label", null, "\u25BC"), " ", selectedOption), React.createElement(DropdownOptions$1, {
|
|
14939
14936
|
className: "rpgui-dropdown-imp",
|
|
14940
|
-
opened: opened
|
|
14937
|
+
opened: opened,
|
|
14938
|
+
opensUp: opensUp
|
|
14941
14939
|
}, options.map(function (option) {
|
|
14942
14940
|
return React.createElement("li", {
|
|
14943
14941
|
key: option.id,
|
|
@@ -14962,8 +14960,12 @@ var DropdownSelect$1 = /*#__PURE__*/styled.p.withConfig({
|
|
|
14962
14960
|
var DropdownOptions$1 = /*#__PURE__*/styled.ul.withConfig({
|
|
14963
14961
|
displayName: "Dropdown__DropdownOptions",
|
|
14964
14962
|
componentId: "sc-8arn65-2"
|
|
14965
|
-
})(["position:absolute;width:100%;max-height:300px;overflow-y:auto;display:", ";box-sizing:border-box;@media (max-width:768px){padding:8px 0;}"], function (props) {
|
|
14963
|
+
})(["position:absolute;width:100%;max-height:300px;overflow-y:auto;display:", ";box-sizing:border-box;bottom:", ";top:", ";margin:0;padding:0;@media (max-width:768px){padding:8px 0;}"], function (props) {
|
|
14966
14964
|
return props.opened ? 'block' : 'none';
|
|
14965
|
+
}, function (props) {
|
|
14966
|
+
return props.opensUp ? '100%' : 'auto';
|
|
14967
|
+
}, function (props) {
|
|
14968
|
+
return props.opensUp ? 'auto' : '100%';
|
|
14967
14969
|
});
|
|
14968
14970
|
|
|
14969
14971
|
var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
|
|
@@ -16011,15 +16013,8 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
16011
16013
|
componentId: "sc-jl6f8-4"
|
|
16012
16014
|
})(["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;}"]);
|
|
16013
16015
|
|
|
16014
|
-
var getTransformedBasePath = function getTransformedBasePath(basePath) {
|
|
16015
|
-
if (Capacitor.isNativePlatform()) {
|
|
16016
|
-
return Capacitor.convertFileSrc(basePath);
|
|
16017
|
-
}
|
|
16018
|
-
return basePath;
|
|
16019
|
-
};
|
|
16020
16016
|
var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
16021
|
-
var
|
|
16022
|
-
imagesSrc = _ref.imagesSrc,
|
|
16017
|
+
var images = _ref.images,
|
|
16023
16018
|
styles = _ref.styles,
|
|
16024
16019
|
_ref$autoCycle = _ref.autoCycle,
|
|
16025
16020
|
autoCycle = _ref$autoCycle === void 0 ? false : _ref$autoCycle,
|
|
@@ -16030,42 +16025,40 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16030
16025
|
var _useState = useState(0),
|
|
16031
16026
|
currentImage = _useState[0],
|
|
16032
16027
|
setCurrentImage = _useState[1];
|
|
16033
|
-
var
|
|
16028
|
+
var autoCycleId = useRef(null);
|
|
16029
|
+
var handleLeftClick = function handleLeftClick() {
|
|
16030
|
+
setCurrentImage(function (prevImage) {
|
|
16031
|
+
return (prevImage - 1 + (images == null ? void 0 : images.length)) % (images == null ? void 0 : images.length);
|
|
16032
|
+
});
|
|
16033
|
+
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16034
|
+
clearInterval(autoCycleId.current);
|
|
16035
|
+
autoCycleId.current = null;
|
|
16036
|
+
}
|
|
16037
|
+
};
|
|
16038
|
+
var handleRightClick = function handleRightClick() {
|
|
16039
|
+
setCurrentImage(function (prevImage) {
|
|
16040
|
+
return (prevImage + 1) % (images == null ? void 0 : images.length);
|
|
16041
|
+
});
|
|
16042
|
+
if (stopAutoCyclingOnInteraction && autoCycleId.current) {
|
|
16043
|
+
clearInterval(autoCycleId.current);
|
|
16044
|
+
autoCycleId.current = null;
|
|
16045
|
+
}
|
|
16046
|
+
};
|
|
16034
16047
|
useEffect(function () {
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
return;
|
|
16041
|
-
}
|
|
16042
|
-
handleRightClick(true);
|
|
16048
|
+
if (autoCycle) {
|
|
16049
|
+
autoCycleId.current = setInterval(function () {
|
|
16050
|
+
setCurrentImage(function (prevImage) {
|
|
16051
|
+
return (prevImage + 1) % (images == null ? void 0 : images.length);
|
|
16052
|
+
});
|
|
16043
16053
|
}, autoCycleDelay);
|
|
16044
16054
|
}
|
|
16045
16055
|
return function () {
|
|
16046
|
-
if (
|
|
16047
|
-
clearInterval(
|
|
16056
|
+
if (autoCycleId.current) {
|
|
16057
|
+
clearInterval(autoCycleId.current);
|
|
16048
16058
|
}
|
|
16049
16059
|
};
|
|
16050
|
-
}, [autoCycle, autoCycleDelay]);
|
|
16051
|
-
var
|
|
16052
|
-
isInteracted.current = true;
|
|
16053
|
-
setCurrentImage(function (oldImage) {
|
|
16054
|
-
return oldImage === 0 ? imagesSrc.length - 1 : oldImage - 1;
|
|
16055
|
-
});
|
|
16056
|
-
};
|
|
16057
|
-
var handleRightClick = function handleRightClick(isAutomatedClick) {
|
|
16058
|
-
if (isAutomatedClick === void 0) {
|
|
16059
|
-
isAutomatedClick = false;
|
|
16060
|
-
}
|
|
16061
|
-
if (!isAutomatedClick) {
|
|
16062
|
-
isInteracted.current = true;
|
|
16063
|
-
}
|
|
16064
|
-
setCurrentImage(function (oldImage) {
|
|
16065
|
-
return oldImage === imagesSrc.length - 1 ? 0 : oldImage + 1;
|
|
16066
|
-
});
|
|
16067
|
-
};
|
|
16068
|
-
var hasMoreThanOneImage = imagesSrc.length > 1;
|
|
16060
|
+
}, [autoCycle, autoCycleDelay, images == null ? void 0 : images.length]);
|
|
16061
|
+
var hasMoreThanOneImage = (images == null ? void 0 : images.length) > 1;
|
|
16069
16062
|
return React.createElement(ImageContainer, {
|
|
16070
16063
|
style: styles
|
|
16071
16064
|
}, hasMoreThanOneImage && React.createElement(CustomLeftArrow, {
|
|
@@ -16076,14 +16069,14 @@ var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
|
16076
16069
|
onPointerDown: handleRightClick
|
|
16077
16070
|
}), React.createElement(Carousel, null, React.createElement(FadeInCarouselImg, {
|
|
16078
16071
|
key: currentImage,
|
|
16079
|
-
src:
|
|
16080
|
-
alt:
|
|
16072
|
+
src: images == null ? void 0 : images[currentImage],
|
|
16073
|
+
alt: "Image " + currentImage
|
|
16081
16074
|
})));
|
|
16082
16075
|
};
|
|
16083
16076
|
var ImageContainer = /*#__PURE__*/styled.div.withConfig({
|
|
16084
16077
|
displayName: "SimpleImageCarousel__ImageContainer",
|
|
16085
16078
|
componentId: "sc-gdvbly-0"
|
|
16086
|
-
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;width:400px;
|
|
16079
|
+
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;width:400px;"]);
|
|
16087
16080
|
var CustomLeftArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
|
|
16088
16081
|
displayName: "SimpleImageCarousel__CustomLeftArrow",
|
|
16089
16082
|
componentId: "sc-gdvbly-1"
|