@rpg-engine/long-bow 0.2.61 → 0.2.63
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/RadioInput/RadioButton.d.ts +8 -0
- package/dist/components/RadioInput/RadioInput.d.ts +13 -0
- package/dist/components/RadioInput/instruments.d.ts +4 -0
- package/dist/components/ServerSelection.d.ts +12 -0
- package/dist/components/itemSelector/ItemSelector.d.ts +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/long-bow.cjs.development.js +133 -12
- 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 +132 -13
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ItemSelector.stories.d.ts +4 -0
- package/dist/stories/RadioInput.stories.d.ts +5 -0
- package/dist/stories/ServerSelection.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/Dropdown.tsx +1 -1
- package/src/components/NPCDialog/NPCDialogText.tsx +20 -3
- package/src/components/RadioInput/RadioButton.tsx +98 -0
- package/src/components/RadioInput/RadioInput.tsx +99 -0
- package/src/components/RadioInput/instruments.ts +16 -0
- package/src/components/ServerSelection.tsx +40 -0
- package/src/components/TimeWidget/TimeWidget.tsx +1 -0
- package/src/components/itemSelector/ItemSelector.tsx +132 -0
- package/src/index.tsx +2 -0
- package/src/stories/ItemSelector.stories.tsx +77 -0
- package/src/stories/RadioInput.stories.tsx +35 -0
- package/src/stories/ServerSelection.stories.tsx +40 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -27264,7 +27264,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
27264
27264
|
setOpened = _useState3[1];
|
|
27265
27265
|
useEffect(function () {
|
|
27266
27266
|
var firstOption = options[0];
|
|
27267
|
-
if (firstOption) {
|
|
27267
|
+
if (firstOption && !selectedValue) {
|
|
27268
27268
|
setSelectedValue(firstOption.value);
|
|
27269
27269
|
setSelectedOption(firstOption.option);
|
|
27270
27270
|
}
|
|
@@ -27765,7 +27765,20 @@ var NPCDialogText = function NPCDialogText(_ref) {
|
|
|
27765
27765
|
onClose = _ref.onClose,
|
|
27766
27766
|
onEndStep = _ref.onEndStep,
|
|
27767
27767
|
onStartStep = _ref.onStartStep;
|
|
27768
|
-
var
|
|
27768
|
+
var windowSize = useRef([window.innerWidth, window.innerHeight]);
|
|
27769
|
+
function maxCharacters(width) {
|
|
27770
|
+
// Set the font size to 16 pixels
|
|
27771
|
+
var fontSize = 11.2;
|
|
27772
|
+
// Calculate the number of characters that can fit in one line
|
|
27773
|
+
var charactersPerLine = Math.floor(width / 2 / fontSize);
|
|
27774
|
+
// Calculate the number of lines that can fit in the div
|
|
27775
|
+
var linesPerDiv = Math.floor(180 / fontSize);
|
|
27776
|
+
// Calculate the maximum number of characters that can fit in the div
|
|
27777
|
+
var maxCharacters = charactersPerLine * linesPerDiv;
|
|
27778
|
+
// Return the maximum number of characters
|
|
27779
|
+
return Math.round(maxCharacters / 5);
|
|
27780
|
+
}
|
|
27781
|
+
var textChunks = chunkString(text, maxCharacters(windowSize.current[0]));
|
|
27769
27782
|
var _useState = useState(0),
|
|
27770
27783
|
chunkIndex = _useState[0],
|
|
27771
27784
|
setChunkIndex = _useState[1];
|
|
@@ -28308,6 +28321,92 @@ var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
28308
28321
|
componentId: "sc-15y5p9l-0"
|
|
28309
28322
|
})(["max-width:280px;display:flex;justify-content:center;flex-wrap:wrap;"]);
|
|
28310
28323
|
|
|
28324
|
+
var ItemSelector = function ItemSelector(_ref) {
|
|
28325
|
+
var atlasIMG = _ref.atlasIMG,
|
|
28326
|
+
atlasJSON = _ref.atlasJSON,
|
|
28327
|
+
options = _ref.options,
|
|
28328
|
+
onClose = _ref.onClose,
|
|
28329
|
+
onSelect = _ref.onSelect;
|
|
28330
|
+
var _useState = useState(),
|
|
28331
|
+
selectedValue = _useState[0],
|
|
28332
|
+
setSelectedValue = _useState[1];
|
|
28333
|
+
var handleClick = function handleClick() {
|
|
28334
|
+
var element = document.querySelector("input[name='test']:checked");
|
|
28335
|
+
var elementValue = element.value;
|
|
28336
|
+
setSelectedValue(elementValue);
|
|
28337
|
+
};
|
|
28338
|
+
useEffect(function () {
|
|
28339
|
+
if (selectedValue) {
|
|
28340
|
+
onSelect(selectedValue);
|
|
28341
|
+
}
|
|
28342
|
+
}, [selectedValue]);
|
|
28343
|
+
return React.createElement(DraggableContainer, {
|
|
28344
|
+
type: RPGUIContainerTypes.Framed,
|
|
28345
|
+
width: "500px",
|
|
28346
|
+
cancelDrag: ".equipment-container-body .arrow-selector",
|
|
28347
|
+
onCloseButton: function onCloseButton() {
|
|
28348
|
+
if (onClose) {
|
|
28349
|
+
onClose();
|
|
28350
|
+
}
|
|
28351
|
+
}
|
|
28352
|
+
}, React.createElement("div", {
|
|
28353
|
+
style: {
|
|
28354
|
+
width: '100%'
|
|
28355
|
+
}
|
|
28356
|
+
}, React.createElement(Title$1, null, 'Harvesting instruments'), React.createElement(Subtitle, null, 'Use the tool, you need it'), React.createElement("hr", {
|
|
28357
|
+
className: "golden"
|
|
28358
|
+
})), React.createElement(RadioInputScroller, null, options == null ? void 0 : options.map(function (option, index) {
|
|
28359
|
+
return React.createElement(RadioOptionsWrapper, {
|
|
28360
|
+
key: index
|
|
28361
|
+
}, React.createElement(SpriteAtlasWrapper, null, React.createElement(SpriteFromAtlas, {
|
|
28362
|
+
atlasIMG: atlasIMG,
|
|
28363
|
+
atlasJSON: atlasJSON,
|
|
28364
|
+
spriteKey: option.imageKey,
|
|
28365
|
+
imgScale: 3
|
|
28366
|
+
})), React.createElement("div", null, React.createElement("input", {
|
|
28367
|
+
className: "rpgui-radio",
|
|
28368
|
+
type: "radio",
|
|
28369
|
+
value: option.name,
|
|
28370
|
+
name: "test"
|
|
28371
|
+
}), React.createElement("label", {
|
|
28372
|
+
onClick: handleClick,
|
|
28373
|
+
style: {
|
|
28374
|
+
display: 'flex',
|
|
28375
|
+
alignItems: 'center'
|
|
28376
|
+
}
|
|
28377
|
+
}, option.name, " ", React.createElement("br", null), option.description)));
|
|
28378
|
+
})), React.createElement(ButtonWrapper, null, React.createElement(Button, {
|
|
28379
|
+
buttonType: ButtonTypes.RPGUIButton,
|
|
28380
|
+
onClick: onClose
|
|
28381
|
+
}, "Cancel"), React.createElement(Button, {
|
|
28382
|
+
buttonType: ButtonTypes.RPGUIButton
|
|
28383
|
+
}, "Select")));
|
|
28384
|
+
};
|
|
28385
|
+
var Title$1 = /*#__PURE__*/styled.h1.withConfig({
|
|
28386
|
+
displayName: "ItemSelector__Title",
|
|
28387
|
+
componentId: "sc-gptoxp-0"
|
|
28388
|
+
})(["font-size:0.6rem;color:yellow !important;"]);
|
|
28389
|
+
var Subtitle = /*#__PURE__*/styled.h1.withConfig({
|
|
28390
|
+
displayName: "ItemSelector__Subtitle",
|
|
28391
|
+
componentId: "sc-gptoxp-1"
|
|
28392
|
+
})(["font-size:0.4rem;color:yellow !important;"]);
|
|
28393
|
+
var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
|
|
28394
|
+
displayName: "ItemSelector__RadioInputScroller",
|
|
28395
|
+
componentId: "sc-gptoxp-2"
|
|
28396
|
+
})(["width:100%;margin-top:1rem;align-items:center;margin-left:20px;align-items:flex-start;overflow-y:scroll;height:360px;"]);
|
|
28397
|
+
var SpriteAtlasWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
28398
|
+
displayName: "ItemSelector__SpriteAtlasWrapper",
|
|
28399
|
+
componentId: "sc-gptoxp-3"
|
|
28400
|
+
})(["margin-right:40px;"]);
|
|
28401
|
+
var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
28402
|
+
displayName: "ItemSelector__RadioOptionsWrapper",
|
|
28403
|
+
componentId: "sc-gptoxp-4"
|
|
28404
|
+
})(["display:flex;align-items:stretch;margin-bottom:40px;"]);
|
|
28405
|
+
var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
28406
|
+
displayName: "ItemSelector__ButtonWrapper",
|
|
28407
|
+
componentId: "sc-gptoxp-5"
|
|
28408
|
+
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
|
|
28409
|
+
|
|
28311
28410
|
var ListMenu = function ListMenu(_ref) {
|
|
28312
28411
|
var options = _ref.options,
|
|
28313
28412
|
onSelected = _ref.onSelected,
|
|
@@ -28443,7 +28542,7 @@ var QuestInfo = function QuestInfo(_ref) {
|
|
|
28443
28542
|
onTouchStart: onRightClick
|
|
28444
28543
|
}), React.createElement(QuestContainer, null, React.createElement(TitleContainer$1, {
|
|
28445
28544
|
className: "drag-handler"
|
|
28446
|
-
}, React.createElement(Title$
|
|
28545
|
+
}, React.createElement(Title$2, null, React.createElement(Thumbnail, {
|
|
28447
28546
|
src: quests[currentIndex].thumbnail || img$8
|
|
28448
28547
|
}), quests[currentIndex].title), React.createElement(QuestSplitDiv, null, React.createElement("hr", {
|
|
28449
28548
|
className: "golden"
|
|
@@ -28462,7 +28561,7 @@ var QuestInfo = function QuestInfo(_ref) {
|
|
|
28462
28561
|
}, button.title);
|
|
28463
28562
|
})))) : React.createElement(QuestsContainer, null, React.createElement(QuestContainer, null, React.createElement(TitleContainer$1, {
|
|
28464
28563
|
className: "drag-handler"
|
|
28465
|
-
}, React.createElement(Title$
|
|
28564
|
+
}, React.createElement(Title$2, null, React.createElement(Thumbnail, {
|
|
28466
28565
|
src: quests[0].thumbnail || img$8
|
|
28467
28566
|
}), quests[0].title), React.createElement(QuestSplitDiv, null, React.createElement("hr", {
|
|
28468
28567
|
className: "golden"
|
|
@@ -28509,7 +28608,7 @@ var TitleContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
|
28509
28608
|
displayName: "QuestInfo__TitleContainer",
|
|
28510
28609
|
componentId: "sc-15s2boc-6"
|
|
28511
28610
|
})(["width:100%;display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;margin-top:1rem;"]);
|
|
28512
|
-
var Title$
|
|
28611
|
+
var Title$2 = /*#__PURE__*/styled.h1.withConfig({
|
|
28513
28612
|
displayName: "QuestInfo__Title",
|
|
28514
28613
|
componentId: "sc-15s2boc-7"
|
|
28515
28614
|
})(["color:white;z-index:22;font-size:", " !important;color:", " !important;"], uiFonts.size.medium, uiColors.yellow);
|
|
@@ -28531,7 +28630,7 @@ var QuestList = function QuestList(_ref) {
|
|
|
28531
28630
|
style: {
|
|
28532
28631
|
width: '100%'
|
|
28533
28632
|
}
|
|
28534
|
-
}, React.createElement(Title$
|
|
28633
|
+
}, React.createElement(Title$3, null, "Quests"), React.createElement("hr", {
|
|
28535
28634
|
className: "golden"
|
|
28536
28635
|
}), React.createElement(QuestListContainer, null, quests ? quests.map(function (quest, i) {
|
|
28537
28636
|
return React.createElement("div", {
|
|
@@ -28552,7 +28651,7 @@ var QuestDraggableContainer$1 = /*#__PURE__*/styled(DraggableContainer).withConf
|
|
|
28552
28651
|
displayName: "QuestList__QuestDraggableContainer",
|
|
28553
28652
|
componentId: "sc-1a2vx6q-0"
|
|
28554
28653
|
})([".container-close{top:10px;right:10px;}.quest-title{text-align:left;margin-left:44px;margin-top:20px;color:yellow;}.quest-desc{margin-top:12px;margin-left:44px;}.rpgui-progress{min-width:80%;margin:0 auto;}"]);
|
|
28555
|
-
var Title$
|
|
28654
|
+
var Title$3 = /*#__PURE__*/styled.h1.withConfig({
|
|
28556
28655
|
displayName: "QuestList__Title",
|
|
28557
28656
|
componentId: "sc-1a2vx6q-1"
|
|
28558
28657
|
})(["z-index:22;font-size:", " !important;color:yellow !important;"], uiFonts.size.medium);
|
|
@@ -28641,6 +28740,26 @@ var Input$1 = /*#__PURE__*/styled.input.withConfig({
|
|
|
28641
28740
|
componentId: "sc-v8mte9-0"
|
|
28642
28741
|
})(["opacity:0;"]);
|
|
28643
28742
|
|
|
28743
|
+
var ServerSelection = function ServerSelection(_ref) {
|
|
28744
|
+
var onChange = _ref.onChange,
|
|
28745
|
+
servers = _ref.servers,
|
|
28746
|
+
details = _ref.details;
|
|
28747
|
+
return React.createElement("div", null, React.createElement("p", null, "Select server"), React.createElement(Dropdown, {
|
|
28748
|
+
options: servers.map(function (server, index) {
|
|
28749
|
+
return {
|
|
28750
|
+
option: server.name,
|
|
28751
|
+
value: server.id,
|
|
28752
|
+
id: index
|
|
28753
|
+
};
|
|
28754
|
+
}),
|
|
28755
|
+
onChange: onChange
|
|
28756
|
+
}), React.createElement(Details, null, details));
|
|
28757
|
+
};
|
|
28758
|
+
var Details = /*#__PURE__*/styled.p.withConfig({
|
|
28759
|
+
displayName: "ServerSelection__Details",
|
|
28760
|
+
componentId: "sc-ee18vv-0"
|
|
28761
|
+
})(["font-size:", " !important;"], uiFonts.size.xsmall);
|
|
28762
|
+
|
|
28644
28763
|
var SimpleProgressBar = function SimpleProgressBar(_ref) {
|
|
28645
28764
|
var value = _ref.value,
|
|
28646
28765
|
_ref$bgColor = _ref.bgColor,
|
|
@@ -28884,7 +29003,7 @@ var TimeWidget = function TimeWidget(_ref) {
|
|
|
28884
29003
|
var WidgetContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28885
29004
|
displayName: "TimeWidget__WidgetContainer",
|
|
28886
29005
|
componentId: "sc-1ja236h-0"
|
|
28887
|
-
})(["background-image:url(", ");background-size:10rem;background-repeat:no-repeat;width:10rem;position:absolute;"], img$c);
|
|
29006
|
+
})(["background-image:url(", ");background-size:10rem;background-repeat:no-repeat;width:10rem;position:absolute;height:100px;"], img$c);
|
|
28888
29007
|
var Time = /*#__PURE__*/styled.div.withConfig({
|
|
28889
29008
|
displayName: "TimeWidget__Time",
|
|
28890
29009
|
componentId: "sc-1ja236h-1"
|
|
@@ -29041,7 +29160,7 @@ var TradingMenu = function TradingMenu(_ref) {
|
|
|
29041
29160
|
style: {
|
|
29042
29161
|
width: '100%'
|
|
29043
29162
|
}
|
|
29044
|
-
}, React.createElement(Title$
|
|
29163
|
+
}, React.createElement(Title$4, null, Capitalize(type), " Menu"), React.createElement("hr", {
|
|
29045
29164
|
className: "golden"
|
|
29046
29165
|
})), React.createElement(TradingComponentScrollWrapper, null, traderItems.map(function (tradeItem, index) {
|
|
29047
29166
|
var _qtyMap$get;
|
|
@@ -29054,7 +29173,7 @@ var TradingMenu = function TradingMenu(_ref) {
|
|
|
29054
29173
|
traderItem: tradeItem,
|
|
29055
29174
|
selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0
|
|
29056
29175
|
}));
|
|
29057
|
-
})), React.createElement(GoldWrapper, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold)), React.createElement(TotalWrapper, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertWrapper, null, React.createElement("p", null, " Sorry, not enough money.")) : React.createElement(GoldWrapper, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold())), React.createElement(ButtonWrapper, null, React.createElement(Button, {
|
|
29176
|
+
})), React.createElement(GoldWrapper, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold)), React.createElement(TotalWrapper, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertWrapper, null, React.createElement("p", null, " Sorry, not enough money.")) : React.createElement(GoldWrapper, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold())), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
|
|
29058
29177
|
buttonType: ButtonTypes.RPGUIButton,
|
|
29059
29178
|
disabled: !hasGoldForSale(),
|
|
29060
29179
|
onClick: function onClick() {
|
|
@@ -29067,7 +29186,7 @@ var TradingMenu = function TradingMenu(_ref) {
|
|
|
29067
29186
|
}
|
|
29068
29187
|
}, "Cancel"))));
|
|
29069
29188
|
};
|
|
29070
|
-
var Title$
|
|
29189
|
+
var Title$4 = /*#__PURE__*/styled.h1.withConfig({
|
|
29071
29190
|
displayName: "TradingMenu__Title",
|
|
29072
29191
|
componentId: "sc-1wjsz1l-0"
|
|
29073
29192
|
})(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
|
|
@@ -29091,7 +29210,7 @@ var AlertWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
29091
29210
|
displayName: "TradingMenu__AlertWrapper",
|
|
29092
29211
|
componentId: "sc-1wjsz1l-5"
|
|
29093
29212
|
})(["margin-top:1rem;display:flex;width:100%;justify-content:center;height:20px;p{color:red !important;}"]);
|
|
29094
|
-
var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
29213
|
+
var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
29095
29214
|
displayName: "TradingMenu__ButtonWrapper",
|
|
29096
29215
|
componentId: "sc-1wjsz1l-6"
|
|
29097
29216
|
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;"]);
|
|
@@ -29112,5 +29231,5 @@ var Container$i = /*#__PURE__*/styled.div.withConfig({
|
|
|
29112
29231
|
return props.maxLines;
|
|
29113
29232
|
});
|
|
29114
29233
|
|
|
29115
|
-
export { Button, ButtonTypes, CharacterSelection, Chat, CheckButton, DraggableContainer, Dropdown, DynamicText, EquipmentSet, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SkillProgressBar, SkillsContainer, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
|
|
29234
|
+
export { Button, ButtonTypes, CharacterSelection, Chat, CheckButton, DraggableContainer, Dropdown, DynamicText, EquipmentSet, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer, ItemSelector, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, ServerSelection, SkillProgressBar, SkillsContainer, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
|
|
29116
29235
|
//# sourceMappingURL=long-bow.esm.js.map
|