@rpg-engine/long-bow 0.2.62 → 0.2.64
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/DropdownSelectorContainer.d.ts +13 -0
- 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/itemSelector/ItemSelector.d.ts +14 -0
- package/dist/index.d.ts +5 -3
- package/dist/long-bow.cjs.development.js +134 -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 +133 -13
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/DropdownSelectorContainer.stories.d.ts +5 -0
- package/dist/stories/ItemSelector.stories.d.ts +4 -0
- package/dist/stories/RadioInput.stories.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/Dropdown.tsx +1 -1
- package/src/components/DropdownSelectorContainer.tsx +42 -0
- 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/TimeWidget/TimeWidget.tsx +1 -0
- package/src/components/itemSelector/ItemSelector.tsx +132 -0
- package/src/index.tsx +5 -3
- package/src/stories/DropdownSelectorContainer.stories.tsx +41 -0
- package/src/stories/ItemSelector.stories.tsx +77 -0
- package/src/stories/RadioInput.stories.tsx +35 -0
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/components/NPCDialog/img/.DS_Store +0 -0
- package/src/mocks/.DS_Store +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IDropdownSelectorOption {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IDropdownSelectorContainer {
|
|
7
|
+
onChange: (id: string) => void;
|
|
8
|
+
options: IDropdownSelectorOption[];
|
|
9
|
+
details?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DropdownSelectorContainer: React.FC<IDropdownSelectorContainer>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IRadioItems {
|
|
3
|
+
title: string;
|
|
4
|
+
subtitle: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IRadioInput {
|
|
7
|
+
title: string;
|
|
8
|
+
subtitle: string;
|
|
9
|
+
onSelect: (a: string) => void;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
items: IRadioItems[];
|
|
12
|
+
}
|
|
13
|
+
export declare const RadioInput: React.FC<IRadioInput>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IOptionsItemSelectorProps {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
imageKey: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IItemSelectorProps {
|
|
8
|
+
atlasJSON: any;
|
|
9
|
+
atlasIMG: any;
|
|
10
|
+
options: IOptionsItemSelectorProps[];
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onSelect: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const ItemSelector: React.FC<IItemSelectorProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './components/Chat/Chat';
|
|
|
4
4
|
export * from './components/CheckButton';
|
|
5
5
|
export * from './components/DraggableContainer';
|
|
6
6
|
export * from './components/Dropdown';
|
|
7
|
+
export * from './components/DropdownSelectorContainer';
|
|
7
8
|
export * from './components/Equipment/EquipmentSet';
|
|
8
9
|
export * from './components/HistoryDialog';
|
|
9
10
|
export * from './components/Input';
|
|
@@ -17,16 +18,17 @@ export * from './components/ProgressBar';
|
|
|
17
18
|
export * from './components/PropertySelect/PropertySelect';
|
|
18
19
|
export * from './components/QuestInfo/QuestInfo';
|
|
19
20
|
export * from './components/QuestList';
|
|
20
|
-
export * from './components/RadioButton';
|
|
21
|
-
export * from './components/RangeSlider';
|
|
22
21
|
export * from './components/RPGUIContainer';
|
|
23
22
|
export * from './components/RPGUIRoot';
|
|
24
|
-
export * from './components/
|
|
23
|
+
export * from './components/RadioButton';
|
|
24
|
+
export * from './components/RangeSlider';
|
|
25
25
|
export * from './components/SkillProgressBar';
|
|
26
26
|
export * from './components/SkillsContainer';
|
|
27
27
|
export * from './components/TextArea';
|
|
28
28
|
export * from './components/TimeWidget/TimeWidget';
|
|
29
29
|
export * from './components/TradingMenu/TradingMenu';
|
|
30
30
|
export * from './components/Truncate';
|
|
31
|
+
export * from './components/itemSelector/ItemSelector';
|
|
32
|
+
export * from './components/shared/SpriteFromAtlas';
|
|
31
33
|
export * from './components/typography/DynamicText';
|
|
32
34
|
export { useEventListener } from './hooks/useEventListener';
|
|
@@ -27269,7 +27269,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
27269
27269
|
setOpened = _useState3[1];
|
|
27270
27270
|
React.useEffect(function () {
|
|
27271
27271
|
var firstOption = options[0];
|
|
27272
|
-
if (firstOption) {
|
|
27272
|
+
if (firstOption && !selectedValue) {
|
|
27273
27273
|
setSelectedValue(firstOption.value);
|
|
27274
27274
|
setSelectedOption(firstOption.option);
|
|
27275
27275
|
}
|
|
@@ -27323,6 +27323,27 @@ var DropdownOptions = /*#__PURE__*/styled.ul.withConfig({
|
|
|
27323
27323
|
return props.opened ? 'block' : 'none';
|
|
27324
27324
|
});
|
|
27325
27325
|
|
|
27326
|
+
var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
|
|
27327
|
+
var title = _ref.title,
|
|
27328
|
+
onChange = _ref.onChange,
|
|
27329
|
+
options = _ref.options,
|
|
27330
|
+
details = _ref.details;
|
|
27331
|
+
return React__default.createElement("div", null, React__default.createElement("p", null, title), React__default.createElement(Dropdown, {
|
|
27332
|
+
options: options.map(function (option, index) {
|
|
27333
|
+
return {
|
|
27334
|
+
option: option.name,
|
|
27335
|
+
value: option.id,
|
|
27336
|
+
id: index
|
|
27337
|
+
};
|
|
27338
|
+
}),
|
|
27339
|
+
onChange: onChange
|
|
27340
|
+
}), React__default.createElement(Details, null, details));
|
|
27341
|
+
};
|
|
27342
|
+
var Details = /*#__PURE__*/styled.p.withConfig({
|
|
27343
|
+
displayName: "DropdownSelectorContainer__Details",
|
|
27344
|
+
componentId: "sc-kaa0h9-0"
|
|
27345
|
+
})(["font-size:", " !important;"], uiFonts.size.xsmall);
|
|
27346
|
+
|
|
27326
27347
|
var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
27327
27348
|
var options = _ref.options,
|
|
27328
27349
|
onSelected = _ref.onSelected,
|
|
@@ -27770,7 +27791,20 @@ var NPCDialogText = function NPCDialogText(_ref) {
|
|
|
27770
27791
|
onClose = _ref.onClose,
|
|
27771
27792
|
onEndStep = _ref.onEndStep,
|
|
27772
27793
|
onStartStep = _ref.onStartStep;
|
|
27773
|
-
var
|
|
27794
|
+
var windowSize = React.useRef([window.innerWidth, window.innerHeight]);
|
|
27795
|
+
function maxCharacters(width) {
|
|
27796
|
+
// Set the font size to 16 pixels
|
|
27797
|
+
var fontSize = 11.2;
|
|
27798
|
+
// Calculate the number of characters that can fit in one line
|
|
27799
|
+
var charactersPerLine = Math.floor(width / 2 / fontSize);
|
|
27800
|
+
// Calculate the number of lines that can fit in the div
|
|
27801
|
+
var linesPerDiv = Math.floor(180 / fontSize);
|
|
27802
|
+
// Calculate the maximum number of characters that can fit in the div
|
|
27803
|
+
var maxCharacters = charactersPerLine * linesPerDiv;
|
|
27804
|
+
// Return the maximum number of characters
|
|
27805
|
+
return Math.round(maxCharacters / 5);
|
|
27806
|
+
}
|
|
27807
|
+
var textChunks = chunkString(text, maxCharacters(windowSize.current[0]));
|
|
27774
27808
|
var _useState = React.useState(0),
|
|
27775
27809
|
chunkIndex = _useState[0],
|
|
27776
27810
|
setChunkIndex = _useState[1];
|
|
@@ -28568,6 +28602,15 @@ var NoQuestContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
28568
28602
|
componentId: "sc-1a2vx6q-3"
|
|
28569
28603
|
})(["text-align:center;p{margin-top:5px;}"]);
|
|
28570
28604
|
|
|
28605
|
+
//@ts-ignore
|
|
28606
|
+
var _RPGUI = RPGUI;
|
|
28607
|
+
var RPGUIRoot = function RPGUIRoot(_ref) {
|
|
28608
|
+
var children = _ref.children;
|
|
28609
|
+
return React__default.createElement("div", {
|
|
28610
|
+
className: "rpgui-content"
|
|
28611
|
+
}, children);
|
|
28612
|
+
};
|
|
28613
|
+
|
|
28571
28614
|
var InputRadio = function InputRadio(_ref) {
|
|
28572
28615
|
var name = _ref.name,
|
|
28573
28616
|
items = _ref.items,
|
|
@@ -28600,15 +28643,6 @@ var InputRadio = function InputRadio(_ref) {
|
|
|
28600
28643
|
}));
|
|
28601
28644
|
};
|
|
28602
28645
|
|
|
28603
|
-
//@ts-ignore
|
|
28604
|
-
var _RPGUI = RPGUI;
|
|
28605
|
-
var RPGUIRoot = function RPGUIRoot(_ref) {
|
|
28606
|
-
var children = _ref.children;
|
|
28607
|
-
return React__default.createElement("div", {
|
|
28608
|
-
className: "rpgui-content"
|
|
28609
|
-
}, children);
|
|
28610
|
-
};
|
|
28611
|
-
|
|
28612
28646
|
(function (RangeSliderType) {
|
|
28613
28647
|
RangeSliderType["Slider"] = "rpgui-slider";
|
|
28614
28648
|
RangeSliderType["GoldSlider"] = "rpgui-slider golden";
|
|
@@ -28886,7 +28920,7 @@ var TimeWidget = function TimeWidget(_ref) {
|
|
|
28886
28920
|
var WidgetContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28887
28921
|
displayName: "TimeWidget__WidgetContainer",
|
|
28888
28922
|
componentId: "sc-1ja236h-0"
|
|
28889
|
-
})(["background-image:url(", ");background-size:10rem;background-repeat:no-repeat;width:10rem;position:absolute;"], img$c);
|
|
28923
|
+
})(["background-image:url(", ");background-size:10rem;background-repeat:no-repeat;width:10rem;position:absolute;height:100px;"], img$c);
|
|
28890
28924
|
var Time = /*#__PURE__*/styled.div.withConfig({
|
|
28891
28925
|
displayName: "TimeWidget__Time",
|
|
28892
28926
|
componentId: "sc-1ja236h-1"
|
|
@@ -29114,18 +29148,106 @@ var Container$i = /*#__PURE__*/styled.div.withConfig({
|
|
|
29114
29148
|
return props.maxLines;
|
|
29115
29149
|
});
|
|
29116
29150
|
|
|
29151
|
+
var ItemSelector = function ItemSelector(_ref) {
|
|
29152
|
+
var atlasIMG = _ref.atlasIMG,
|
|
29153
|
+
atlasJSON = _ref.atlasJSON,
|
|
29154
|
+
options = _ref.options,
|
|
29155
|
+
onClose = _ref.onClose,
|
|
29156
|
+
onSelect = _ref.onSelect;
|
|
29157
|
+
var _useState = React.useState(),
|
|
29158
|
+
selectedValue = _useState[0],
|
|
29159
|
+
setSelectedValue = _useState[1];
|
|
29160
|
+
var handleClick = function handleClick() {
|
|
29161
|
+
var element = document.querySelector("input[name='test']:checked");
|
|
29162
|
+
var elementValue = element.value;
|
|
29163
|
+
setSelectedValue(elementValue);
|
|
29164
|
+
};
|
|
29165
|
+
React.useEffect(function () {
|
|
29166
|
+
if (selectedValue) {
|
|
29167
|
+
onSelect(selectedValue);
|
|
29168
|
+
}
|
|
29169
|
+
}, [selectedValue]);
|
|
29170
|
+
return React__default.createElement(DraggableContainer, {
|
|
29171
|
+
type: exports.RPGUIContainerTypes.Framed,
|
|
29172
|
+
width: "500px",
|
|
29173
|
+
cancelDrag: ".equipment-container-body .arrow-selector",
|
|
29174
|
+
onCloseButton: function onCloseButton() {
|
|
29175
|
+
if (onClose) {
|
|
29176
|
+
onClose();
|
|
29177
|
+
}
|
|
29178
|
+
}
|
|
29179
|
+
}, React__default.createElement("div", {
|
|
29180
|
+
style: {
|
|
29181
|
+
width: '100%'
|
|
29182
|
+
}
|
|
29183
|
+
}, React__default.createElement(Title$4, null, 'Harvesting instruments'), React__default.createElement(Subtitle, null, 'Use the tool, you need it'), React__default.createElement("hr", {
|
|
29184
|
+
className: "golden"
|
|
29185
|
+
})), React__default.createElement(RadioInputScroller, null, options == null ? void 0 : options.map(function (option, index) {
|
|
29186
|
+
return React__default.createElement(RadioOptionsWrapper, {
|
|
29187
|
+
key: index
|
|
29188
|
+
}, React__default.createElement(SpriteAtlasWrapper, null, React__default.createElement(SpriteFromAtlas, {
|
|
29189
|
+
atlasIMG: atlasIMG,
|
|
29190
|
+
atlasJSON: atlasJSON,
|
|
29191
|
+
spriteKey: option.imageKey,
|
|
29192
|
+
imgScale: 3
|
|
29193
|
+
})), React__default.createElement("div", null, React__default.createElement("input", {
|
|
29194
|
+
className: "rpgui-radio",
|
|
29195
|
+
type: "radio",
|
|
29196
|
+
value: option.name,
|
|
29197
|
+
name: "test"
|
|
29198
|
+
}), React__default.createElement("label", {
|
|
29199
|
+
onClick: handleClick,
|
|
29200
|
+
style: {
|
|
29201
|
+
display: 'flex',
|
|
29202
|
+
alignItems: 'center'
|
|
29203
|
+
}
|
|
29204
|
+
}, option.name, " ", React__default.createElement("br", null), option.description)));
|
|
29205
|
+
})), React__default.createElement(ButtonWrapper$1, null, React__default.createElement(Button, {
|
|
29206
|
+
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
29207
|
+
onClick: onClose
|
|
29208
|
+
}, "Cancel"), React__default.createElement(Button, {
|
|
29209
|
+
buttonType: exports.ButtonTypes.RPGUIButton
|
|
29210
|
+
}, "Select")));
|
|
29211
|
+
};
|
|
29212
|
+
var Title$4 = /*#__PURE__*/styled.h1.withConfig({
|
|
29213
|
+
displayName: "ItemSelector__Title",
|
|
29214
|
+
componentId: "sc-gptoxp-0"
|
|
29215
|
+
})(["font-size:0.6rem;color:yellow !important;"]);
|
|
29216
|
+
var Subtitle = /*#__PURE__*/styled.h1.withConfig({
|
|
29217
|
+
displayName: "ItemSelector__Subtitle",
|
|
29218
|
+
componentId: "sc-gptoxp-1"
|
|
29219
|
+
})(["font-size:0.4rem;color:yellow !important;"]);
|
|
29220
|
+
var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
|
|
29221
|
+
displayName: "ItemSelector__RadioInputScroller",
|
|
29222
|
+
componentId: "sc-gptoxp-2"
|
|
29223
|
+
})(["width:100%;margin-top:1rem;align-items:center;margin-left:20px;align-items:flex-start;overflow-y:scroll;height:360px;"]);
|
|
29224
|
+
var SpriteAtlasWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
29225
|
+
displayName: "ItemSelector__SpriteAtlasWrapper",
|
|
29226
|
+
componentId: "sc-gptoxp-3"
|
|
29227
|
+
})(["margin-right:40px;"]);
|
|
29228
|
+
var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
29229
|
+
displayName: "ItemSelector__RadioOptionsWrapper",
|
|
29230
|
+
componentId: "sc-gptoxp-4"
|
|
29231
|
+
})(["display:flex;align-items:stretch;margin-bottom:40px;"]);
|
|
29232
|
+
var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
29233
|
+
displayName: "ItemSelector__ButtonWrapper",
|
|
29234
|
+
componentId: "sc-gptoxp-5"
|
|
29235
|
+
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
|
|
29236
|
+
|
|
29117
29237
|
exports.Button = Button;
|
|
29118
29238
|
exports.CharacterSelection = CharacterSelection;
|
|
29119
29239
|
exports.Chat = Chat;
|
|
29120
29240
|
exports.CheckButton = CheckButton;
|
|
29121
29241
|
exports.DraggableContainer = DraggableContainer;
|
|
29122
29242
|
exports.Dropdown = Dropdown;
|
|
29243
|
+
exports.DropdownSelectorContainer = DropdownSelectorContainer;
|
|
29123
29244
|
exports.DynamicText = DynamicText;
|
|
29124
29245
|
exports.EquipmentSet = EquipmentSet;
|
|
29125
29246
|
exports.HistoryDialog = HistoryDialog;
|
|
29126
29247
|
exports.Input = Input;
|
|
29127
29248
|
exports.InputRadio = InputRadio;
|
|
29128
29249
|
exports.ItemContainer = ItemContainer;
|
|
29250
|
+
exports.ItemSelector = ItemSelector;
|
|
29129
29251
|
exports.ItemSlot = ItemSlot;
|
|
29130
29252
|
exports.ListMenu = ListMenu;
|
|
29131
29253
|
exports.NPCDialog = NPCDialog;
|