@rpg-engine/long-bow 0.2.15 → 0.2.17
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/HistoryDialog.d.ts +14 -0
- package/dist/components/NPCDialog/NPCMultiDialog.d.ts +15 -0
- package/dist/components/QuestList.d.ts +3 -7
- package/dist/index.d.ts +3 -0
- package/dist/long-bow.cjs.development.js +200 -0
- 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 +200 -1
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/HistoryDialog.stories.d.ts +5 -0
- package/dist/stories/NPCMultiDialog.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/HistoryDialog.tsx +87 -0
- package/src/components/NPCDialog/NPCMultiDialog.tsx +159 -0
- package/src/components/NPCDialog/img/background.png +0 -0
- package/src/components/QuestList.tsx +12 -26
- package/src/index.tsx +3 -0
- package/src/mocks/itemContainer.mocks.ts +1 -1
- package/src/stories/HistoryDialog.stories.tsx +59 -0
- package/src/stories/NPCMultiDialog.stories.tsx +71 -0
- package/src/stories/QuestList.stories.tsx +62 -34
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NPCMultiDialogType } from './NPCDialog/NPCMultiDialog';
|
|
3
|
+
import { IQuestionDialog, IQuestionDialogAnswer } from './NPCDialog/QuestionDialog/QuestionDialog';
|
|
4
|
+
export interface IHistoryDialogProps {
|
|
5
|
+
backgroundImgPath: string;
|
|
6
|
+
fullCoverBackground: boolean;
|
|
7
|
+
questions?: IQuestionDialog[];
|
|
8
|
+
answers?: IQuestionDialogAnswer[];
|
|
9
|
+
text?: string;
|
|
10
|
+
imagePath?: string;
|
|
11
|
+
textAndTypeArray?: NPCMultiDialogType[];
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const HistoryDialog: React.FC<IHistoryDialogProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum ImgSide {
|
|
3
|
+
right = "right",
|
|
4
|
+
left = "left"
|
|
5
|
+
}
|
|
6
|
+
export interface NPCMultiDialogType {
|
|
7
|
+
text: string;
|
|
8
|
+
imagePath?: string;
|
|
9
|
+
imageSide: ImgSide;
|
|
10
|
+
}
|
|
11
|
+
export interface INPCMultiDialogProps {
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
textAndTypeArray: NPCMultiDialogType[];
|
|
14
|
+
}
|
|
15
|
+
export declare const NPCMultiDialog: React.FC<INPCMultiDialogProps>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import { IQuest } from '@rpg-engine/shared';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
export interface IQuestListProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
quests: {
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
completed: boolean;
|
|
9
|
-
}[];
|
|
4
|
+
quests: IQuest[];
|
|
5
|
+
onClose: () => void;
|
|
10
6
|
}
|
|
11
7
|
export declare const QuestList: React.FC<IQuestListProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
|
|
|
14
14
|
export * from './components/ProgressBar';
|
|
15
15
|
export * from './components/PropertySelect/PropertySelect';
|
|
16
16
|
export * from './components/QuestInfo/QuestInfo';
|
|
17
|
+
export * from './components/QuestList';
|
|
17
18
|
export * from './components/RadioButton';
|
|
18
19
|
export * from './components/RangeSlider';
|
|
19
20
|
export * from './components/RPGUIContainer';
|
|
@@ -24,4 +25,6 @@ export * from './components/SkillsContainer';
|
|
|
24
25
|
export * from './components/TextArea';
|
|
25
26
|
export * from './components/Truncate';
|
|
26
27
|
export * from './components/typography/DynamicText';
|
|
28
|
+
export * from './components/NPCDialog/NPCMultiDialog';
|
|
29
|
+
export * from './components/HistoryDialog';
|
|
27
30
|
export { useEventListener } from './hooks/useEventListener';
|
|
@@ -28366,6 +28366,49 @@ var RightArrow$1 = /*#__PURE__*/styled.div.withConfig({
|
|
|
28366
28366
|
componentId: "sc-15s2boc-10"
|
|
28367
28367
|
})(["background-image:url(", ");right:0;position:absolute;width:40px;background-size:100% 100%;height:42px;:active{background-image:url(", ");}"], img$4, img$3);
|
|
28368
28368
|
|
|
28369
|
+
var QuestList = function QuestList(_ref) {
|
|
28370
|
+
var quests = _ref.quests,
|
|
28371
|
+
onClose = _ref.onClose;
|
|
28372
|
+
return React__default.createElement(QuestDraggableContainer$1, {
|
|
28373
|
+
type: exports.RPGUIContainerTypes.Framed,
|
|
28374
|
+
onCloseButton: function onCloseButton() {
|
|
28375
|
+
if (onClose) onClose();
|
|
28376
|
+
},
|
|
28377
|
+
width: "520px"
|
|
28378
|
+
}, React__default.createElement("div", {
|
|
28379
|
+
style: {
|
|
28380
|
+
width: '100%'
|
|
28381
|
+
}
|
|
28382
|
+
}, React__default.createElement(Title$2, null, "Quests"), React__default.createElement("hr", {
|
|
28383
|
+
className: "golden"
|
|
28384
|
+
}), React__default.createElement(QuestListContainer, null, quests.map(function (quest, i) {
|
|
28385
|
+
return React__default.createElement("div", {
|
|
28386
|
+
className: "quest-item",
|
|
28387
|
+
key: i
|
|
28388
|
+
}, React__default.createElement("span", {
|
|
28389
|
+
className: "quest-number"
|
|
28390
|
+
}, i + 1), React__default.createElement("div", {
|
|
28391
|
+
className: "quest-detail"
|
|
28392
|
+
}, React__default.createElement("p", {
|
|
28393
|
+
className: "quest-detail__title"
|
|
28394
|
+
}, quest.title), React__default.createElement("p", {
|
|
28395
|
+
className: "quest-detail__description"
|
|
28396
|
+
}, quest.description)));
|
|
28397
|
+
}))));
|
|
28398
|
+
};
|
|
28399
|
+
var QuestDraggableContainer$1 = /*#__PURE__*/styled(DraggableContainer).withConfig({
|
|
28400
|
+
displayName: "QuestList__QuestDraggableContainer",
|
|
28401
|
+
componentId: "sc-1a2vx6q-0"
|
|
28402
|
+
})([".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;}"]);
|
|
28403
|
+
var Title$2 = /*#__PURE__*/styled.h1.withConfig({
|
|
28404
|
+
displayName: "QuestList__Title",
|
|
28405
|
+
componentId: "sc-1a2vx6q-1"
|
|
28406
|
+
})(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
|
|
28407
|
+
var QuestListContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28408
|
+
displayName: "QuestList__QuestListContainer",
|
|
28409
|
+
componentId: "sc-1a2vx6q-2"
|
|
28410
|
+
})(["margin-top:20px;margin-bottom:40px;overflow-y:auto;max-height:400px;.quest-item{display:flex;align-items:flex-start;margin-bottom:12px;}.quest-number{border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;margin-right:16px;background-color:brown;flex-shrink:0;}.quest-number.completed{background-color:yellow;}p{margin:0;}.quest-detail__title{color:yellow;}.quest-detail__description{margin-top:5px;}"]);
|
|
28411
|
+
|
|
28369
28412
|
var InputRadio = function InputRadio(_ref) {
|
|
28370
28413
|
var name = _ref.name,
|
|
28371
28414
|
items = _ref.items,
|
|
@@ -28673,6 +28716,160 @@ var Container$f = /*#__PURE__*/styled.div.withConfig({
|
|
|
28673
28716
|
return props.maxLines;
|
|
28674
28717
|
});
|
|
28675
28718
|
|
|
28719
|
+
(function (ImgSide) {
|
|
28720
|
+
ImgSide["right"] = "right";
|
|
28721
|
+
ImgSide["left"] = "left";
|
|
28722
|
+
})(exports.ImgSide || (exports.ImgSide = {}));
|
|
28723
|
+
|
|
28724
|
+
var NPCMultiDialog = function NPCMultiDialog(_ref) {
|
|
28725
|
+
var _textAndTypeArray$sli;
|
|
28726
|
+
|
|
28727
|
+
var _onClose = _ref.onClose,
|
|
28728
|
+
textAndTypeArray = _ref.textAndTypeArray;
|
|
28729
|
+
|
|
28730
|
+
var _useState = React.useState(false),
|
|
28731
|
+
showGoNextIndicator = _useState[0],
|
|
28732
|
+
setShowGoNextIndicator = _useState[1];
|
|
28733
|
+
|
|
28734
|
+
var _useState2 = React.useState(0),
|
|
28735
|
+
slide = _useState2[0],
|
|
28736
|
+
setSlide = _useState2[1];
|
|
28737
|
+
|
|
28738
|
+
var onHandleSpacePress = function onHandleSpacePress(event) {
|
|
28739
|
+
if (event.code === 'Space') {
|
|
28740
|
+
if (slide < (textAndTypeArray == null ? void 0 : textAndTypeArray.length) - 1) {
|
|
28741
|
+
setSlide(function (prev) {
|
|
28742
|
+
return prev + 1;
|
|
28743
|
+
});
|
|
28744
|
+
} else {
|
|
28745
|
+
// if there's no more text chunks, close the dialog
|
|
28746
|
+
_onClose();
|
|
28747
|
+
}
|
|
28748
|
+
}
|
|
28749
|
+
};
|
|
28750
|
+
|
|
28751
|
+
React.useEffect(function () {
|
|
28752
|
+
document.addEventListener('keydown', onHandleSpacePress);
|
|
28753
|
+
return function () {
|
|
28754
|
+
return document.removeEventListener('keydown', onHandleSpacePress);
|
|
28755
|
+
};
|
|
28756
|
+
}, [slide]);
|
|
28757
|
+
return React__default.createElement(RPGUIContainer, {
|
|
28758
|
+
type: exports.RPGUIContainerTypes.FramedGold,
|
|
28759
|
+
width: '50%',
|
|
28760
|
+
height: '180px'
|
|
28761
|
+
}, React__default.createElement(React__default.Fragment, null, React__default.createElement(Container$g, null, ((_textAndTypeArray$sli = textAndTypeArray[slide]) == null ? void 0 : _textAndTypeArray$sli.imageSide) === 'right' && React__default.createElement(React__default.Fragment, null, React__default.createElement(TextContainer$2, {
|
|
28762
|
+
flex: '70%'
|
|
28763
|
+
}, React__default.createElement(NPCDialogText, {
|
|
28764
|
+
onStartStep: function onStartStep() {
|
|
28765
|
+
return setShowGoNextIndicator(false);
|
|
28766
|
+
},
|
|
28767
|
+
onEndStep: function onEndStep() {
|
|
28768
|
+
return setShowGoNextIndicator(true);
|
|
28769
|
+
},
|
|
28770
|
+
text: textAndTypeArray[slide].text || 'No text provided.',
|
|
28771
|
+
onClose: function onClose() {
|
|
28772
|
+
if (_onClose) {
|
|
28773
|
+
_onClose();
|
|
28774
|
+
}
|
|
28775
|
+
}
|
|
28776
|
+
})), React__default.createElement(ThumbnailContainer$1, null, React__default.createElement(NPCThumbnail$1, {
|
|
28777
|
+
src: textAndTypeArray[slide].imagePath || img$6
|
|
28778
|
+
})), showGoNextIndicator && React__default.createElement(PressSpaceIndicator$1, {
|
|
28779
|
+
right: '10.5rem',
|
|
28780
|
+
src: img$7
|
|
28781
|
+
})), textAndTypeArray[slide].imageSide === 'left' && React__default.createElement(React__default.Fragment, null, React__default.createElement(ThumbnailContainer$1, null, React__default.createElement(NPCThumbnail$1, {
|
|
28782
|
+
src: textAndTypeArray[slide].imagePath || img$6
|
|
28783
|
+
})), React__default.createElement(TextContainer$2, {
|
|
28784
|
+
flex: '70%'
|
|
28785
|
+
}, React__default.createElement(NPCDialogText, {
|
|
28786
|
+
onStartStep: function onStartStep() {
|
|
28787
|
+
return setShowGoNextIndicator(false);
|
|
28788
|
+
},
|
|
28789
|
+
onEndStep: function onEndStep() {
|
|
28790
|
+
return setShowGoNextIndicator(true);
|
|
28791
|
+
},
|
|
28792
|
+
text: textAndTypeArray[slide].text || 'No text provided.',
|
|
28793
|
+
onClose: function onClose() {
|
|
28794
|
+
if (_onClose) {
|
|
28795
|
+
_onClose();
|
|
28796
|
+
}
|
|
28797
|
+
}
|
|
28798
|
+
})), showGoNextIndicator && React__default.createElement(PressSpaceIndicator$1, {
|
|
28799
|
+
right: '1rem',
|
|
28800
|
+
src: img$7
|
|
28801
|
+
}))), ")"));
|
|
28802
|
+
};
|
|
28803
|
+
var Container$g = /*#__PURE__*/styled.div.withConfig({
|
|
28804
|
+
displayName: "NPCMultiDialog__Container",
|
|
28805
|
+
componentId: "sc-rvu5wg-0"
|
|
28806
|
+
})(["display:flex;width:100%;height:100%;box-sizing:border-box;justify-content:center;align-items:flex-start;position:relative;"]);
|
|
28807
|
+
var TextContainer$2 = /*#__PURE__*/styled.div.withConfig({
|
|
28808
|
+
displayName: "NPCMultiDialog__TextContainer",
|
|
28809
|
+
componentId: "sc-rvu5wg-1"
|
|
28810
|
+
})(["flex:", " 0 0;width:355px;"], function (_ref2) {
|
|
28811
|
+
var flex = _ref2.flex;
|
|
28812
|
+
return flex;
|
|
28813
|
+
});
|
|
28814
|
+
var ThumbnailContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
28815
|
+
displayName: "NPCMultiDialog__ThumbnailContainer",
|
|
28816
|
+
componentId: "sc-rvu5wg-2"
|
|
28817
|
+
})(["flex:30% 0 0;display:flex;justify-content:flex-end;"]);
|
|
28818
|
+
var NPCThumbnail$1 = /*#__PURE__*/styled.img.withConfig({
|
|
28819
|
+
displayName: "NPCMultiDialog__NPCThumbnail",
|
|
28820
|
+
componentId: "sc-rvu5wg-3"
|
|
28821
|
+
})(["image-rendering:pixelated;height:128px;width:128px;"]);
|
|
28822
|
+
var PressSpaceIndicator$1 = /*#__PURE__*/styled.img.withConfig({
|
|
28823
|
+
displayName: "NPCMultiDialog__PressSpaceIndicator",
|
|
28824
|
+
componentId: "sc-rvu5wg-4"
|
|
28825
|
+
})(["position:absolute;right:", ";bottom:1rem;height:20.7px;image-rendering:-webkit-optimize-contrast;"], function (_ref3) {
|
|
28826
|
+
var right = _ref3.right;
|
|
28827
|
+
return right;
|
|
28828
|
+
});
|
|
28829
|
+
|
|
28830
|
+
var HistoryDialog = function HistoryDialog(_ref) {
|
|
28831
|
+
var backgroundImgPath = _ref.backgroundImgPath,
|
|
28832
|
+
fullCoverBackground = _ref.fullCoverBackground,
|
|
28833
|
+
questions = _ref.questions,
|
|
28834
|
+
answers = _ref.answers,
|
|
28835
|
+
text = _ref.text,
|
|
28836
|
+
imagePath = _ref.imagePath,
|
|
28837
|
+
textAndTypeArray = _ref.textAndTypeArray,
|
|
28838
|
+
onClose = _ref.onClose;
|
|
28839
|
+
return React__default.createElement(BackgroundContainer, {
|
|
28840
|
+
imgPath: backgroundImgPath,
|
|
28841
|
+
fullImg: fullCoverBackground
|
|
28842
|
+
}, React__default.createElement(DialogContainer, null, textAndTypeArray ? React__default.createElement(NPCMultiDialog, {
|
|
28843
|
+
textAndTypeArray: textAndTypeArray,
|
|
28844
|
+
onClose: onClose
|
|
28845
|
+
}) : questions && answers ? React__default.createElement(QuestionDialog, {
|
|
28846
|
+
questions: questions,
|
|
28847
|
+
answers: answers,
|
|
28848
|
+
onClose: onClose
|
|
28849
|
+
}) : text && imagePath ? React__default.createElement(NPCDialog, {
|
|
28850
|
+
text: text,
|
|
28851
|
+
imagePath: imagePath,
|
|
28852
|
+
onClose: onClose,
|
|
28853
|
+
type: exports.NPCDialogType.TextAndThumbnail
|
|
28854
|
+
}) : React__default.createElement(NPCDialog, {
|
|
28855
|
+
text: text,
|
|
28856
|
+
onClose: onClose,
|
|
28857
|
+
type: exports.NPCDialogType.TextOnly
|
|
28858
|
+
})));
|
|
28859
|
+
};
|
|
28860
|
+
var BackgroundContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28861
|
+
displayName: "HistoryDialog__BackgroundContainer",
|
|
28862
|
+
componentId: "sc-u6oe75-0"
|
|
28863
|
+
})(["width:100%;height:100%;background-image:url(", ");background-size:", ";display:flex;justify-content:space-evenly;align-items:center;"], function (props) {
|
|
28864
|
+
return props.imgPath;
|
|
28865
|
+
}, function (props) {
|
|
28866
|
+
return props.imgPath ? 'cover' : 'auto';
|
|
28867
|
+
});
|
|
28868
|
+
var DialogContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28869
|
+
displayName: "HistoryDialog__DialogContainer",
|
|
28870
|
+
componentId: "sc-u6oe75-1"
|
|
28871
|
+
})(["display:flex;justify-content:center;padding-top:200px;"]);
|
|
28872
|
+
|
|
28676
28873
|
exports.Button = Button;
|
|
28677
28874
|
exports.CharacterSelection = CharacterSelection;
|
|
28678
28875
|
exports.Chat = Chat;
|
|
@@ -28681,15 +28878,18 @@ exports.DraggableContainer = DraggableContainer;
|
|
|
28681
28878
|
exports.Dropdown = Dropdown;
|
|
28682
28879
|
exports.DynamicText = DynamicText;
|
|
28683
28880
|
exports.EquipmentSet = EquipmentSet;
|
|
28881
|
+
exports.HistoryDialog = HistoryDialog;
|
|
28684
28882
|
exports.Input = Input;
|
|
28685
28883
|
exports.InputRadio = InputRadio;
|
|
28686
28884
|
exports.ItemContainer = ItemContainer;
|
|
28687
28885
|
exports.ItemSlot = ItemSlot;
|
|
28688
28886
|
exports.ListMenu = ListMenu;
|
|
28689
28887
|
exports.NPCDialog = NPCDialog;
|
|
28888
|
+
exports.NPCMultiDialog = NPCMultiDialog;
|
|
28690
28889
|
exports.ProgressBar = ProgressBar;
|
|
28691
28890
|
exports.PropertySelect = PropertySelect;
|
|
28692
28891
|
exports.QuestInfo = QuestInfo;
|
|
28892
|
+
exports.QuestList = QuestList;
|
|
28693
28893
|
exports.QuestionDialog = QuestionDialog;
|
|
28694
28894
|
exports.RPGUIContainer = RPGUIContainer;
|
|
28695
28895
|
exports.RPGUIRoot = RPGUIRoot;
|