@rpg-engine/long-bow 0.1.92 → 0.1.96

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.
Files changed (90) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/Item/Inventory/ItemContainer.d.ts +1 -1
  4. package/dist/components/Item/Inventory/ItemSlot.d.ts +1 -1
  5. package/dist/components/Item/Inventory/itemContainerHelper.d.ts +1 -0
  6. package/dist/long-bow.cjs.development.js +13 -41
  7. package/dist/long-bow.cjs.development.js.map +1 -1
  8. package/dist/long-bow.cjs.production.min.js +1 -1
  9. package/dist/long-bow.cjs.production.min.js.map +1 -1
  10. package/dist/long-bow.esm.js +13 -41
  11. package/dist/long-bow.esm.js.map +1 -1
  12. package/package.json +98 -98
  13. package/src/components/Abstractions/SlotsContainer.tsx +42 -42
  14. package/src/components/Button.tsx +30 -30
  15. package/src/components/Chat/Chat.tsx +193 -193
  16. package/src/components/CheckButton.tsx +65 -65
  17. package/src/components/DraggableContainer.tsx +150 -150
  18. package/src/components/Dropdown.tsx +57 -57
  19. package/src/components/Equipment/EquipmentSet.tsx +134 -134
  20. package/src/components/Input.tsx +11 -11
  21. package/src/components/Item/Cards/ItemTooltip.tsx +32 -32
  22. package/src/components/Item/Inventory/ItemContainer.tsx +65 -65
  23. package/src/components/Item/Inventory/ItemContainerTypes.ts +4 -4
  24. package/src/components/Item/Inventory/ItemSlot.tsx +198 -199
  25. package/src/components/Item/Inventory/itemContainerHelper.ts +86 -94
  26. package/src/components/ListMenu.tsx +65 -65
  27. package/src/components/Multitab/Tab.tsx +57 -57
  28. package/src/components/Multitab/TabBody.tsx +13 -13
  29. package/src/components/Multitab/TabsContainer.tsx +97 -97
  30. package/src/components/NPCDialog/NPCDialog.tsx +145 -145
  31. package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
  32. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +239 -239
  33. package/src/components/ProgressBar.tsx +91 -91
  34. package/src/components/PropertySelect/PropertySelect.tsx +101 -101
  35. package/src/components/PropertySelect/img/ui-arrows/arrow01-left-clicked.png +0 -0
  36. package/src/components/PropertySelect/img/ui-arrows/arrow01-left.png +0 -0
  37. package/src/components/PropertySelect/img/ui-arrows/arrow01-right-clicked.png +0 -0
  38. package/src/components/PropertySelect/img/ui-arrows/arrow01-right.png +0 -0
  39. package/src/components/PropertySelect/img/ui-arrows/arrow02-left-clicked.png +0 -0
  40. package/src/components/PropertySelect/img/ui-arrows/arrow02-left.png +0 -0
  41. package/src/components/PropertySelect/img/ui-arrows/arrow02-right-clicked.png +0 -0
  42. package/src/components/PropertySelect/img/ui-arrows/arrow02-right.png +0 -0
  43. package/src/components/QuestInfo/QuestInfo.tsx +143 -143
  44. package/src/components/RPGUIContainer.tsx +47 -47
  45. package/src/components/RPGUIRoot.tsx +14 -14
  46. package/src/components/RadioButton.tsx +53 -53
  47. package/src/components/RangeSlider.tsx +68 -68
  48. package/src/components/RelativeListMenu.tsx +83 -83
  49. package/src/components/ScrollList.tsx +77 -77
  50. package/src/components/SimpleProgressBar.tsx +62 -62
  51. package/src/components/SkillProgressBar.tsx +123 -123
  52. package/src/components/SkillsContainer.tsx +196 -196
  53. package/src/components/TextArea.tsx +11 -11
  54. package/src/components/Truncate.tsx +25 -25
  55. package/src/components/shared/Column.tsx +16 -16
  56. package/src/components/shared/SpriteFromAtlas.tsx +99 -99
  57. package/src/components/typography/DynamicText.tsx +49 -49
  58. package/src/constants/uiColors.ts +10 -10
  59. package/src/hooks/useEventListener.ts +21 -21
  60. package/src/hooks/useOutsideAlerter.ts +25 -25
  61. package/src/index.tsx +25 -25
  62. package/src/libs/StringHelpers.ts +3 -3
  63. package/src/mocks/atlas/icons/icons.json +735 -735
  64. package/src/mocks/atlas/items/items.json +5215 -5215
  65. package/src/mocks/equipmentSet.mocks.ts +347 -347
  66. package/src/mocks/itemContainer.mocks.ts +249 -249
  67. package/src/mocks/skills.mocks.ts +122 -122
  68. package/src/stories/Button.stories.tsx +36 -36
  69. package/src/stories/Chat.stories.tsx +170 -170
  70. package/src/stories/CheckButton.stories.tsx +48 -48
  71. package/src/stories/DraggableContainer.stories.tsx +28 -28
  72. package/src/stories/Dropdown.stories.tsx +46 -46
  73. package/src/stories/EquipmentSet.stories.tsx +50 -50
  74. package/src/stories/ItemContainer.stories.tsx +50 -50
  75. package/src/stories/ListMenu.stories.tsx +56 -56
  76. package/src/stories/Multitab.stories.tsx +51 -51
  77. package/src/stories/NPCDialog.stories.tsx +130 -130
  78. package/src/stories/ProgressBar.stories.tsx +23 -23
  79. package/src/stories/PropertySelect.stories.tsx +41 -41
  80. package/src/stories/QuestInfo.stories.tsx +76 -76
  81. package/src/stories/RPGUIContainers.stories.tsx +42 -42
  82. package/src/stories/RadioButton.stories.tsx +49 -49
  83. package/src/stories/RangeSlider.stories.tsx +60 -60
  84. package/src/stories/ScrollList.stories.tsx +85 -85
  85. package/src/stories/SimpleProgressBar.stories.tsx +22 -22
  86. package/src/stories/SkillProgressBar.stories.tsx +30 -30
  87. package/src/stories/SkillsContainer.stories.tsx +31 -31
  88. package/src/stories/Text.stories.tsx +42 -42
  89. package/src/types/eventTypes.ts +4 -4
  90. package/src/types/index.d.ts +2 -2
@@ -1,145 +1,145 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';
4
- import aliceDefaultThumbnail from './img/npcDialog/npcThumbnails/alice.png';
5
- import pressSpaceGif from './img/space.gif';
6
- import { NPCDialogText } from './NPCDialogText';
7
- import {
8
- IQuestionDialog,
9
- IQuestionDialogAnswer,
10
- QuestionDialog,
11
- } from './QuestionDialog/QuestionDialog';
12
-
13
- export enum NPCDialogType {
14
- TextOnly = 'TextOnly',
15
- TextAndThumbnail = 'TextAndThumbnail',
16
- }
17
-
18
- export interface INPCDialogProps {
19
- text?: string;
20
- type: NPCDialogType;
21
- imagePath?: string;
22
- onClose?: () => void;
23
- isQuestionDialog?: boolean;
24
- answers?: IQuestionDialogAnswer[];
25
- questions?: IQuestionDialog[];
26
- }
27
-
28
- export const NPCDialog: React.FC<INPCDialogProps> = ({
29
- text,
30
- type,
31
- onClose,
32
- imagePath,
33
- isQuestionDialog = false,
34
- questions,
35
- answers,
36
- }) => {
37
- const [showGoNextIndicator, setShowGoNextIndicator] = useState<boolean>(
38
- false
39
- );
40
-
41
- return (
42
- <RPGUIContainer
43
- type={RPGUIContainerTypes.FramedGold}
44
- width={isQuestionDialog ? '600px' : '50%'}
45
- height={'180px'}
46
- >
47
- {isQuestionDialog && questions && answers ? (
48
- <>
49
- <TextContainer
50
- flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}
51
- >
52
- <QuestionDialog
53
- questions={questions}
54
- answers={answers}
55
- onClose={() => {
56
- if (onClose) {
57
- onClose();
58
- }
59
- }}
60
- />
61
- </TextContainer>
62
- {type === NPCDialogType.TextAndThumbnail && (
63
- <ThumbnailContainer>
64
- <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />
65
- </ThumbnailContainer>
66
- )}
67
- </>
68
- ) : (
69
- <>
70
- <Container>
71
- <TextContainer
72
- flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}
73
- >
74
- <NPCDialogText
75
- onStartStep={() => setShowGoNextIndicator(false)}
76
- onEndStep={() => setShowGoNextIndicator(true)}
77
- text={text || 'No text provided.'}
78
- onClose={() => {
79
- if (onClose) {
80
- onClose();
81
- }
82
- }}
83
- />
84
- </TextContainer>
85
- {type === NPCDialogType.TextAndThumbnail && (
86
- <ThumbnailContainer>
87
- <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />
88
- </ThumbnailContainer>
89
- )}
90
- </Container>
91
- {showGoNextIndicator && (
92
- <PressSpaceIndicator
93
- right={type === NPCDialogType.TextOnly ? '1rem' : '10.5rem'}
94
- src={pressSpaceGif}
95
- />
96
- )}
97
- </>
98
- )}
99
- </RPGUIContainer>
100
- );
101
- };
102
-
103
- const Container = styled.div`
104
- display: flex;
105
- width: 100%;
106
- height: 100%;
107
-
108
- box-sizing: border-box;
109
- justify-content: center;
110
- align-items: flex-start;
111
- position: relative;
112
- `;
113
-
114
- interface ITextContainerProps {
115
- flex: string;
116
- }
117
-
118
- const TextContainer = styled.div<ITextContainerProps>`
119
- flex: ${({ flex }) => flex} 0 0;
120
- width: 355px;
121
- `;
122
-
123
- const ThumbnailContainer = styled.div`
124
- flex: 30% 0 0;
125
- display: flex;
126
- justify-content: flex-end;
127
- `;
128
-
129
- const NPCThumbnail = styled.img`
130
- image-rendering: pixelated;
131
- height: 128px;
132
- width: 128px;
133
- `;
134
-
135
- interface IPressSpaceIndicatorProps {
136
- right: string;
137
- }
138
-
139
- const PressSpaceIndicator = styled.img<IPressSpaceIndicatorProps>`
140
- position: absolute;
141
- right: ${({ right }) => right};
142
- bottom: 1rem;
143
- height: 20.7px;
144
- image-rendering: -webkit-optimize-contrast;
145
- `;
1
+ import React, { useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';
4
+ import aliceDefaultThumbnail from './img/npcDialog/npcThumbnails/alice.png';
5
+ import pressSpaceGif from './img/space.gif';
6
+ import { NPCDialogText } from './NPCDialogText';
7
+ import {
8
+ IQuestionDialog,
9
+ IQuestionDialogAnswer,
10
+ QuestionDialog,
11
+ } from './QuestionDialog/QuestionDialog';
12
+
13
+ export enum NPCDialogType {
14
+ TextOnly = 'TextOnly',
15
+ TextAndThumbnail = 'TextAndThumbnail',
16
+ }
17
+
18
+ export interface INPCDialogProps {
19
+ text?: string;
20
+ type: NPCDialogType;
21
+ imagePath?: string;
22
+ onClose?: () => void;
23
+ isQuestionDialog?: boolean;
24
+ answers?: IQuestionDialogAnswer[];
25
+ questions?: IQuestionDialog[];
26
+ }
27
+
28
+ export const NPCDialog: React.FC<INPCDialogProps> = ({
29
+ text,
30
+ type,
31
+ onClose,
32
+ imagePath,
33
+ isQuestionDialog = false,
34
+ questions,
35
+ answers,
36
+ }) => {
37
+ const [showGoNextIndicator, setShowGoNextIndicator] = useState<boolean>(
38
+ false
39
+ );
40
+
41
+ return (
42
+ <RPGUIContainer
43
+ type={RPGUIContainerTypes.FramedGold}
44
+ width={isQuestionDialog ? '600px' : '50%'}
45
+ height={'180px'}
46
+ >
47
+ {isQuestionDialog && questions && answers ? (
48
+ <>
49
+ <TextContainer
50
+ flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}
51
+ >
52
+ <QuestionDialog
53
+ questions={questions}
54
+ answers={answers}
55
+ onClose={() => {
56
+ if (onClose) {
57
+ onClose();
58
+ }
59
+ }}
60
+ />
61
+ </TextContainer>
62
+ {type === NPCDialogType.TextAndThumbnail && (
63
+ <ThumbnailContainer>
64
+ <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />
65
+ </ThumbnailContainer>
66
+ )}
67
+ </>
68
+ ) : (
69
+ <>
70
+ <Container>
71
+ <TextContainer
72
+ flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}
73
+ >
74
+ <NPCDialogText
75
+ onStartStep={() => setShowGoNextIndicator(false)}
76
+ onEndStep={() => setShowGoNextIndicator(true)}
77
+ text={text || 'No text provided.'}
78
+ onClose={() => {
79
+ if (onClose) {
80
+ onClose();
81
+ }
82
+ }}
83
+ />
84
+ </TextContainer>
85
+ {type === NPCDialogType.TextAndThumbnail && (
86
+ <ThumbnailContainer>
87
+ <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />
88
+ </ThumbnailContainer>
89
+ )}
90
+ </Container>
91
+ {showGoNextIndicator && (
92
+ <PressSpaceIndicator
93
+ right={type === NPCDialogType.TextOnly ? '1rem' : '10.5rem'}
94
+ src={pressSpaceGif}
95
+ />
96
+ )}
97
+ </>
98
+ )}
99
+ </RPGUIContainer>
100
+ );
101
+ };
102
+
103
+ const Container = styled.div`
104
+ display: flex;
105
+ width: 100%;
106
+ height: 100%;
107
+
108
+ box-sizing: border-box;
109
+ justify-content: center;
110
+ align-items: flex-start;
111
+ position: relative;
112
+ `;
113
+
114
+ interface ITextContainerProps {
115
+ flex: string;
116
+ }
117
+
118
+ const TextContainer = styled.div<ITextContainerProps>`
119
+ flex: ${({ flex }) => flex} 0 0;
120
+ width: 355px;
121
+ `;
122
+
123
+ const ThumbnailContainer = styled.div`
124
+ flex: 30% 0 0;
125
+ display: flex;
126
+ justify-content: flex-end;
127
+ `;
128
+
129
+ const NPCThumbnail = styled.img`
130
+ image-rendering: pixelated;
131
+ height: 128px;
132
+ width: 128px;
133
+ `;
134
+
135
+ interface IPressSpaceIndicatorProps {
136
+ right: string;
137
+ }
138
+
139
+ const PressSpaceIndicator = styled.img<IPressSpaceIndicatorProps>`
140
+ position: absolute;
141
+ right: ${({ right }) => right};
142
+ bottom: 1rem;
143
+ height: 20.7px;
144
+ image-rendering: -webkit-optimize-contrast;
145
+ `;
@@ -1,53 +1,53 @@
1
- import React, { useEffect, useState } from 'react';
2
- import styled from 'styled-components';
3
- import { chunkString } from '../../libs/StringHelpers';
4
- import { DynamicText } from '../typography/DynamicText';
5
-
6
- interface IProps {
7
- text: string;
8
- onClose: () => void;
9
- onEndStep: () => void;
10
- onStartStep: () => void;
11
- }
12
-
13
- export const NPCDialogText: React.FC<IProps> = ({
14
- text,
15
- onClose,
16
- onEndStep,
17
- onStartStep,
18
- }) => {
19
- const textChunks = chunkString(text, 85);
20
-
21
- const [chunkIndex, setChunkIndex] = useState<number>(0);
22
-
23
- const onHandleSpacePress = (event: KeyboardEvent) => {
24
- if (event.code === 'Space') {
25
- const hasNextChunk = textChunks?.[chunkIndex + 1] || false;
26
-
27
- if (hasNextChunk) {
28
- setChunkIndex(prev => prev + 1);
29
- } else {
30
- // if there's no more text chunks, close the dialog
31
- onClose();
32
- }
33
- }
34
- };
35
-
36
- useEffect(() => {
37
- document.addEventListener('keydown', onHandleSpacePress);
38
-
39
- return () => document.removeEventListener('keydown', onHandleSpacePress);
40
- }, [chunkIndex]);
41
-
42
- return (
43
- <Container>
44
- <DynamicText
45
- text={textChunks?.[chunkIndex] || ''}
46
- onFinish={onEndStep}
47
- onStart={onStartStep}
48
- />
49
- </Container>
50
- );
51
- };
52
-
53
- const Container = styled.div``;
1
+ import React, { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { chunkString } from '../../libs/StringHelpers';
4
+ import { DynamicText } from '../typography/DynamicText';
5
+
6
+ interface IProps {
7
+ text: string;
8
+ onClose: () => void;
9
+ onEndStep: () => void;
10
+ onStartStep: () => void;
11
+ }
12
+
13
+ export const NPCDialogText: React.FC<IProps> = ({
14
+ text,
15
+ onClose,
16
+ onEndStep,
17
+ onStartStep,
18
+ }) => {
19
+ const textChunks = chunkString(text, 85);
20
+
21
+ const [chunkIndex, setChunkIndex] = useState<number>(0);
22
+
23
+ const onHandleSpacePress = (event: KeyboardEvent) => {
24
+ if (event.code === 'Space') {
25
+ const hasNextChunk = textChunks?.[chunkIndex + 1] || false;
26
+
27
+ if (hasNextChunk) {
28
+ setChunkIndex(prev => prev + 1);
29
+ } else {
30
+ // if there's no more text chunks, close the dialog
31
+ onClose();
32
+ }
33
+ }
34
+ };
35
+
36
+ useEffect(() => {
37
+ document.addEventListener('keydown', onHandleSpacePress);
38
+
39
+ return () => document.removeEventListener('keydown', onHandleSpacePress);
40
+ }, [chunkIndex]);
41
+
42
+ return (
43
+ <Container>
44
+ <DynamicText
45
+ text={textChunks?.[chunkIndex] || ''}
46
+ onFinish={onEndStep}
47
+ onStart={onStartStep}
48
+ />
49
+ </Container>
50
+ );
51
+ };
52
+
53
+ const Container = styled.div``;