@rpg-engine/long-bow 0.7.85 → 0.7.86
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/QuantitySelector/QuantitySelector.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +54 -43
- 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 +54 -44
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemQuantitySelector.tsx +9 -126
- package/src/components/QuantitySelector/QuantitySelector.tsx +143 -0
- package/src/index.tsx +1 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -30497,71 +30497,68 @@ var Input$1 = /*#__PURE__*/styled.input.withConfig({
|
|
|
30497
30497
|
componentId: "sc-v8mte9-0"
|
|
30498
30498
|
})(["opacity:0;position:absolute;width:100%;height:100%;top:0;left:0;margin-top:-5px;"]);
|
|
30499
30499
|
|
|
30500
|
-
var
|
|
30501
|
-
var
|
|
30500
|
+
var QuantitySelector = function QuantitySelector(_ref) {
|
|
30501
|
+
var maxQuantity = _ref.maxQuantity,
|
|
30502
|
+
initialQuantity = _ref.initialQuantity,
|
|
30503
|
+
_ref$title = _ref.title,
|
|
30504
|
+
title = _ref$title === void 0 ? 'Select quantity' : _ref$title,
|
|
30502
30505
|
onConfirm = _ref.onConfirm,
|
|
30503
30506
|
onClose = _ref.onClose;
|
|
30504
|
-
var _useState = useState(
|
|
30507
|
+
var _useState = useState(initialQuantity != null ? initialQuantity : maxQuantity),
|
|
30505
30508
|
value = _useState[0],
|
|
30506
30509
|
setValue = _useState[1];
|
|
30507
30510
|
var inputRef = useRef(null);
|
|
30508
30511
|
useEffect(function () {
|
|
30512
|
+
var closeSelector = function closeSelector(e) {
|
|
30513
|
+
if (e.key === 'Escape') {
|
|
30514
|
+
onClose();
|
|
30515
|
+
}
|
|
30516
|
+
};
|
|
30509
30517
|
if (inputRef.current) {
|
|
30510
30518
|
inputRef.current.focus();
|
|
30511
30519
|
inputRef.current.select();
|
|
30512
|
-
var closeSelector = function closeSelector(e) {
|
|
30513
|
-
if (e.key === 'Escape') {
|
|
30514
|
-
onClose();
|
|
30515
|
-
}
|
|
30516
|
-
};
|
|
30517
|
-
document.addEventListener('keydown', closeSelector);
|
|
30518
|
-
return function () {
|
|
30519
|
-
document.removeEventListener('keydown', closeSelector);
|
|
30520
|
-
};
|
|
30521
30520
|
}
|
|
30522
|
-
|
|
30523
|
-
|
|
30521
|
+
document.addEventListener('keydown', closeSelector);
|
|
30522
|
+
return function () {
|
|
30523
|
+
return document.removeEventListener('keydown', closeSelector);
|
|
30524
|
+
};
|
|
30525
|
+
}, [onClose]);
|
|
30524
30526
|
return React.createElement(StyledContainer, {
|
|
30525
30527
|
type: RPGUIContainerTypes.Framed,
|
|
30526
30528
|
width: "25rem"
|
|
30527
30529
|
}, React.createElement(CloseButton$5, {
|
|
30528
30530
|
className: "container-close",
|
|
30529
30531
|
onPointerDown: onClose
|
|
30530
|
-
}, "X"), React.createElement("h2", null,
|
|
30531
|
-
style: {
|
|
30532
|
-
width: '100%'
|
|
30533
|
-
},
|
|
30532
|
+
}, "X"), React.createElement("h2", null, title), React.createElement(StyledForm, {
|
|
30534
30533
|
onSubmit: function onSubmit(e) {
|
|
30535
30534
|
e.preventDefault();
|
|
30536
30535
|
var numberValue = Number(value);
|
|
30537
|
-
if (Number.isNaN(numberValue)) {
|
|
30538
|
-
|
|
30536
|
+
if (!Number.isNaN(numberValue)) {
|
|
30537
|
+
onConfirm(Math.max(1, Math.min(maxQuantity, numberValue)));
|
|
30539
30538
|
}
|
|
30540
|
-
onConfirm(Math.max(1, Math.min(quantity, numberValue)));
|
|
30541
30539
|
},
|
|
30542
30540
|
noValidate: true
|
|
30543
30541
|
}, React.createElement(StyledInput, {
|
|
30544
|
-
|
|
30542
|
+
ref: inputRef,
|
|
30545
30543
|
placeholder: "Enter quantity",
|
|
30546
30544
|
type: "number",
|
|
30547
30545
|
min: 1,
|
|
30548
|
-
max:
|
|
30546
|
+
max: maxQuantity,
|
|
30549
30547
|
value: value,
|
|
30550
30548
|
onChange: function onChange(e) {
|
|
30551
|
-
if (Number(e.target.value) >=
|
|
30552
|
-
setValue(
|
|
30549
|
+
if (Number(e.target.value) >= maxQuantity) {
|
|
30550
|
+
setValue(maxQuantity);
|
|
30553
30551
|
return;
|
|
30554
30552
|
}
|
|
30555
|
-
setValue(e.target.value);
|
|
30553
|
+
setValue(Number(e.target.value));
|
|
30556
30554
|
},
|
|
30557
30555
|
onBlur: function onBlur(e) {
|
|
30558
|
-
|
|
30559
|
-
setValue(newValue);
|
|
30556
|
+
setValue(Math.max(1, Math.min(maxQuantity, Number(e.target.value))));
|
|
30560
30557
|
}
|
|
30561
30558
|
}), React.createElement(RangeSlider, {
|
|
30562
30559
|
type: RangeSliderType.Slider,
|
|
30563
30560
|
valueMin: 1,
|
|
30564
|
-
valueMax:
|
|
30561
|
+
valueMax: maxQuantity,
|
|
30565
30562
|
width: "100%",
|
|
30566
30563
|
onChange: setValue,
|
|
30567
30564
|
value: value
|
|
@@ -30571,21 +30568,34 @@ var ItemQuantitySelector = function ItemQuantitySelector(_ref) {
|
|
|
30571
30568
|
}, "Confirm")));
|
|
30572
30569
|
};
|
|
30573
30570
|
var StyledContainer = /*#__PURE__*/styled(RPGUIContainer).withConfig({
|
|
30574
|
-
displayName: "
|
|
30575
|
-
componentId: "sc-
|
|
30576
|
-
})(["display:flex;flex-direction:column;align-items:center;"]);
|
|
30577
|
-
var StyledForm = /*#__PURE__*/styled.form.withConfig({
|
|
30578
|
-
displayName: "ItemQuantitySelector__StyledForm",
|
|
30579
|
-
componentId: "sc-yfdtpn-1"
|
|
30580
|
-
})(["display:flex;flex-direction:column;align-items:center;width:100%;"]);
|
|
30581
|
-
var StyledInput = /*#__PURE__*/styled(Input).withConfig({
|
|
30582
|
-
displayName: "ItemQuantitySelector__StyledInput",
|
|
30583
|
-
componentId: "sc-yfdtpn-2"
|
|
30584
|
-
})(["text-align:center;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}"]);
|
|
30571
|
+
displayName: "QuantitySelector__StyledContainer",
|
|
30572
|
+
componentId: "sc-z4ut57-0"
|
|
30573
|
+
})(["position:relative;display:flex;flex-direction:column;align-items:center;padding:1rem;h2{margin:0;margin-bottom:1rem;font-size:1rem;}"]);
|
|
30585
30574
|
var CloseButton$5 = /*#__PURE__*/styled.div.withConfig({
|
|
30586
|
-
displayName: "
|
|
30587
|
-
componentId: "sc-
|
|
30588
|
-
})(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:
|
|
30575
|
+
displayName: "QuantitySelector__CloseButton",
|
|
30576
|
+
componentId: "sc-z4ut57-1"
|
|
30577
|
+
})(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.5rem;cursor:pointer;"]);
|
|
30578
|
+
var StyledForm = /*#__PURE__*/styled.form.withConfig({
|
|
30579
|
+
displayName: "QuantitySelector__StyledForm",
|
|
30580
|
+
componentId: "sc-z4ut57-2"
|
|
30581
|
+
})(["display:flex;flex-direction:column;align-items:center;gap:1rem;width:100%;"]);
|
|
30582
|
+
var StyledInput = /*#__PURE__*/styled.input.withConfig({
|
|
30583
|
+
displayName: "QuantitySelector__StyledInput",
|
|
30584
|
+
componentId: "sc-z4ut57-3"
|
|
30585
|
+
})(["width:100%;padding:0.5rem;background-color:rgba(0,0,0,0.25);border:none;color:white;font-size:1rem;text-align:center;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}"]);
|
|
30586
|
+
|
|
30587
|
+
var ItemQuantitySelector = function ItemQuantitySelector(_ref) {
|
|
30588
|
+
var quantity = _ref.quantity,
|
|
30589
|
+
onConfirm = _ref.onConfirm,
|
|
30590
|
+
onClose = _ref.onClose;
|
|
30591
|
+
return React.createElement(QuantitySelector, {
|
|
30592
|
+
maxQuantity: quantity,
|
|
30593
|
+
initialQuantity: quantity,
|
|
30594
|
+
title: "Select quantity to move",
|
|
30595
|
+
onConfirm: onConfirm,
|
|
30596
|
+
onClose: onClose
|
|
30597
|
+
});
|
|
30598
|
+
};
|
|
30589
30599
|
|
|
30590
30600
|
var ItemQuantitySelectorModal = function ItemQuantitySelectorModal(_ref) {
|
|
30591
30601
|
var quantitySelect = _ref.quantitySelect,
|
|
@@ -34071,5 +34081,5 @@ var LessonContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
34071
34081
|
componentId: "sc-7tgzv2-6"
|
|
34072
34082
|
})(["display:flex;flex-direction:column;justify-content:space-between;min-height:200px;p{font-size:0.7rem !important;}"]);
|
|
34073
34083
|
|
|
34074
|
-
export { ActionButtons, AsyncDropdown, Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CheckItem, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio$1 as InputRadio, InternalTabs, ItemContainer$1 as ItemContainer, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, MultitabType, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SelectArrow, Shortcuts, SimpleImageCarousel, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, Stepper, TabBody, Table, TableCell, TableHeader, TableRow, TabsContainer, TextArea, TimeWidget, Tooltip, TradingMenu, Truncate, TutorialStepper, UserActionLink, _RPGUI, formatQuestStatus, formatQuestText, getMockedPlayersRowsLeader, getMockedPlayersRowsNotLeader, getQuestStatusColor, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
|
|
34084
|
+
export { ActionButtons, AsyncDropdown, Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CheckItem, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio$1 as InputRadio, InternalTabs, ItemContainer$1 as ItemContainer, ItemQuantitySelectorModal, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, MultitabType, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SelectArrow, Shortcuts, SimpleImageCarousel, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, Stepper, TabBody, Table, TableCell, TableHeader, TableRow, TabsContainer, TextArea, TimeWidget, Tooltip, TradingMenu, Truncate, TutorialStepper, UserActionLink, _RPGUI, formatQuestStatus, formatQuestText, getMockedPlayersRowsLeader, getMockedPlayersRowsNotLeader, getQuestStatusColor, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
|
|
34075
34085
|
//# sourceMappingURL=long-bow.esm.js.map
|