@rpg-engine/long-bow 0.5.49 → 0.5.51
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 +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +384 -298
- 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 +86 -2
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/SimpleImageCarousel.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/ImageCarousel/SimpleImageCarousel.tsx +132 -0
- package/src/index.tsx +1 -0
- package/src/stories/ImageCarousel.stories.tsx +1 -1
- package/src/stories/SimpleImageCarousel.stories.tsx +44 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Component, useState, useEffect, useRef, useContext, createContext, useMemo, useCallback, Fragment } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
3
|
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
@@ -15917,6 +15917,90 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
15917
15917
|
componentId: "sc-jl6f8-4"
|
|
15918
15918
|
})(["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;}"]);
|
|
15919
15919
|
|
|
15920
|
+
var SimpleImageCarousel = function SimpleImageCarousel(_ref) {
|
|
15921
|
+
var basePath = _ref.basePath,
|
|
15922
|
+
imagesSrc = _ref.imagesSrc,
|
|
15923
|
+
styles = _ref.styles,
|
|
15924
|
+
_ref$autoCycle = _ref.autoCycle,
|
|
15925
|
+
autoCycle = _ref$autoCycle === void 0 ? false : _ref$autoCycle,
|
|
15926
|
+
_ref$autoCycleDelay = _ref.autoCycleDelay,
|
|
15927
|
+
autoCycleDelay = _ref$autoCycleDelay === void 0 ? 3000 : _ref$autoCycleDelay,
|
|
15928
|
+
_ref$stopAutoCyclingO = _ref.stopAutoCyclingOnInteraction,
|
|
15929
|
+
stopAutoCyclingOnInteraction = _ref$stopAutoCyclingO === void 0 ? false : _ref$stopAutoCyclingO;
|
|
15930
|
+
var _useState = useState(0),
|
|
15931
|
+
currentImage = _useState[0],
|
|
15932
|
+
setCurrentImage = _useState[1];
|
|
15933
|
+
var isInteracted = useRef(false);
|
|
15934
|
+
useEffect(function () {
|
|
15935
|
+
var timer = null;
|
|
15936
|
+
if (autoCycle && !isInteracted.current) {
|
|
15937
|
+
timer = setInterval(function () {
|
|
15938
|
+
if (stopAutoCyclingOnInteraction && isInteracted.current) {
|
|
15939
|
+
clearInterval(timer);
|
|
15940
|
+
return;
|
|
15941
|
+
}
|
|
15942
|
+
handleRightClick();
|
|
15943
|
+
}, autoCycleDelay);
|
|
15944
|
+
}
|
|
15945
|
+
return function () {
|
|
15946
|
+
if (timer) {
|
|
15947
|
+
clearInterval(timer);
|
|
15948
|
+
}
|
|
15949
|
+
};
|
|
15950
|
+
}, [autoCycle, autoCycleDelay]);
|
|
15951
|
+
var handleLeftClick = function handleLeftClick() {
|
|
15952
|
+
isInteracted.current = true;
|
|
15953
|
+
setCurrentImage(function (oldImage) {
|
|
15954
|
+
return oldImage === 0 ? imagesSrc.length - 1 : oldImage - 1;
|
|
15955
|
+
});
|
|
15956
|
+
};
|
|
15957
|
+
var handleRightClick = function handleRightClick() {
|
|
15958
|
+
isInteracted.current = true;
|
|
15959
|
+
setCurrentImage(function (oldImage) {
|
|
15960
|
+
return oldImage === imagesSrc.length - 1 ? 0 : oldImage + 1;
|
|
15961
|
+
});
|
|
15962
|
+
};
|
|
15963
|
+
var hasMoreThanOneImage = imagesSrc.length > 1;
|
|
15964
|
+
return React.createElement(ImageContainer, {
|
|
15965
|
+
style: styles
|
|
15966
|
+
}, hasMoreThanOneImage && React.createElement(CustomLeftArrow, {
|
|
15967
|
+
direction: "left",
|
|
15968
|
+
onPointerDown: handleLeftClick
|
|
15969
|
+
}), hasMoreThanOneImage && React.createElement(CustomRightArrow, {
|
|
15970
|
+
direction: "right",
|
|
15971
|
+
onPointerDown: handleRightClick
|
|
15972
|
+
}), React.createElement(Carousel, null, React.createElement(FadeInCarouselImg, {
|
|
15973
|
+
key: currentImage,
|
|
15974
|
+
src: basePath + "/" + imagesSrc[currentImage],
|
|
15975
|
+
alt: imagesSrc[currentImage]
|
|
15976
|
+
})));
|
|
15977
|
+
};
|
|
15978
|
+
var ImageContainer = /*#__PURE__*/styled.div.withConfig({
|
|
15979
|
+
displayName: "SimpleImageCarousel__ImageContainer",
|
|
15980
|
+
componentId: "sc-gdvbly-0"
|
|
15981
|
+
})(["flex:1;display:flex;justify-content:center;align-items:center;height:100%;margin-right:0.5rem;max-width:400px;position:relative;"]);
|
|
15982
|
+
var CustomLeftArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
|
|
15983
|
+
displayName: "SimpleImageCarousel__CustomLeftArrow",
|
|
15984
|
+
componentId: "sc-gdvbly-1"
|
|
15985
|
+
})(["position:absolute;left:-0.5rem;top:50%;transform:translateY(-50%);"]);
|
|
15986
|
+
var CustomRightArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
|
|
15987
|
+
displayName: "SimpleImageCarousel__CustomRightArrow",
|
|
15988
|
+
componentId: "sc-gdvbly-2"
|
|
15989
|
+
})(["position:absolute;right:-2.5rem;top:50%;transform:translateY(-50%);"]);
|
|
15990
|
+
var Carousel = /*#__PURE__*/styled.div.withConfig({
|
|
15991
|
+
displayName: "SimpleImageCarousel__Carousel",
|
|
15992
|
+
componentId: "sc-gdvbly-3"
|
|
15993
|
+
})(["display:flex;"]);
|
|
15994
|
+
var CarouselImg = /*#__PURE__*/styled.img.withConfig({
|
|
15995
|
+
displayName: "SimpleImageCarousel__CarouselImg",
|
|
15996
|
+
componentId: "sc-gdvbly-4"
|
|
15997
|
+
})(["flex:0 0 auto;width:100%;height:auto;margin:0 1rem;border-radius:5px;box-shadow:0 0 10px 0 rgba(0,0,0,0.2);scroll-snap-align:start;margin-right:3rem;"]);
|
|
15998
|
+
var fadeIn = /*#__PURE__*/keyframes(["from{opacity:0;}to{opacity:1;}"]);
|
|
15999
|
+
var FadeInCarouselImg = /*#__PURE__*/styled(CarouselImg).withConfig({
|
|
16000
|
+
displayName: "SimpleImageCarousel__FadeInCarouselImg",
|
|
16001
|
+
componentId: "sc-gdvbly-5"
|
|
16002
|
+
})(["animation:", " 0.5s;"], fadeIn);
|
|
16003
|
+
|
|
15920
16004
|
var SlotsContainer = function SlotsContainer(_ref) {
|
|
15921
16005
|
var children = _ref.children,
|
|
15922
16006
|
title = _ref.title,
|
|
@@ -19114,5 +19198,5 @@ var ButtonWrapper$3 = /*#__PURE__*/styled.div.withConfig({
|
|
|
19114
19198
|
componentId: "sc-gptoxp-5"
|
|
19115
19199
|
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
|
|
19116
19200
|
|
|
19117
|
-
export { Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio$1 as InputRadio, ItemContainer$1 as ItemContainer, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, Shortcuts, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
|
|
19201
|
+
export { Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio$1 as InputRadio, ItemContainer$1 as ItemContainer, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, Shortcuts, SimpleImageCarousel, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
|
|
19118
19202
|
//# sourceMappingURL=long-bow.esm.js.map
|