@rpg-engine/long-bow 0.1.794 → 0.2.2

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 (129) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/Button.d.ts +1 -0
  4. package/dist/components/Equipment/EquipmentSet.d.ts +5 -3
  5. package/dist/components/Item/Cards/ItemTooltip.d.ts +6 -0
  6. package/dist/components/Item/Inventory/ItemContainer.d.ts +4 -6
  7. package/dist/components/Item/Inventory/ItemContainerTypes.d.ts +6 -0
  8. package/dist/components/Item/Inventory/ItemSlot.d.ts +5 -9
  9. package/dist/components/Item/Inventory/itemContainerHelper.d.ts +2 -7
  10. package/dist/components/PropertySelect/PropertySelect.d.ts +12 -0
  11. package/dist/components/QuestInfo/QuestInfo.d.ts +14 -0
  12. package/dist/components/RelativeListMenu.d.ts +13 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/long-bow.cjs.development.js +748 -1194
  15. package/dist/long-bow.cjs.development.js.map +1 -1
  16. package/dist/long-bow.cjs.production.min.js +1 -1
  17. package/dist/long-bow.cjs.production.min.js.map +1 -1
  18. package/dist/long-bow.esm.js +748 -1196
  19. package/dist/long-bow.esm.js.map +1 -1
  20. package/dist/mocks/equipmentSet.mocks.d.ts +2 -2
  21. package/dist/stories/Button.stories.d.ts +5 -0
  22. package/dist/stories/Chat.stories.d.ts +5 -0
  23. package/dist/stories/CheckButton.stories.d.ts +5 -0
  24. package/dist/stories/DraggableContainer.stories.d.ts +5 -0
  25. package/dist/stories/Dropdown.stories.d.ts +5 -0
  26. package/dist/stories/EquipmentSet.stories.d.ts +5 -0
  27. package/dist/stories/ItemContainer.stories.d.ts +5 -0
  28. package/dist/stories/ListMenu.stories.d.ts +5 -0
  29. package/dist/stories/Multitab.stories.d.ts +6 -0
  30. package/dist/stories/NPCDialog.stories.d.ts +7 -0
  31. package/dist/stories/ProgressBar.stories.d.ts +8 -0
  32. package/dist/stories/PropertySelect.stories.d.ts +5 -0
  33. package/dist/stories/QuestInfo.stories.d.ts +5 -0
  34. package/dist/stories/RPGUIContainers.stories.d.ts +5 -0
  35. package/dist/stories/RadioButton.stories.d.ts +5 -0
  36. package/dist/stories/RangeSlider.stories.d.ts +5 -0
  37. package/dist/stories/ScrollList.stories.d.ts +5 -0
  38. package/dist/stories/SimpleProgressBar.stories.d.ts +5 -0
  39. package/dist/stories/SkillProgressBar.stories.d.ts +5 -0
  40. package/dist/stories/SkillsContainer.stories.d.ts +5 -0
  41. package/dist/stories/Text.stories.d.ts +7 -0
  42. package/package.json +98 -96
  43. package/src/components/Abstractions/SlotsContainer.tsx +42 -42
  44. package/src/components/Button.tsx +30 -29
  45. package/src/components/Chat/Chat.tsx +193 -193
  46. package/src/components/CheckButton.tsx +65 -65
  47. package/src/components/DraggableContainer.tsx +150 -150
  48. package/src/components/Dropdown.tsx +57 -57
  49. package/src/components/Equipment/EquipmentSet.tsx +138 -180
  50. package/src/components/Input.tsx +11 -11
  51. package/src/components/Item/Cards/ItemTooltip.tsx +32 -0
  52. package/src/components/Item/Inventory/ItemContainer.tsx +68 -113
  53. package/src/components/Item/Inventory/ItemContainerTypes.ts +6 -0
  54. package/src/components/Item/Inventory/ItemSlot.tsx +212 -158
  55. package/src/components/Item/Inventory/itemContainerHelper.ts +146 -81
  56. package/src/components/ListMenu.tsx +65 -65
  57. package/src/components/Multitab/Tab.tsx +57 -57
  58. package/src/components/Multitab/TabBody.tsx +13 -13
  59. package/src/components/Multitab/TabsContainer.tsx +97 -97
  60. package/src/components/NPCDialog/NPCDialog.tsx +145 -145
  61. package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
  62. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +237 -242
  63. package/src/components/ProgressBar.tsx +91 -91
  64. package/src/components/PropertySelect/PropertySelect.tsx +101 -0
  65. package/src/components/PropertySelect/img/ui-arrows/arrow01-left-clicked.png +0 -0
  66. package/src/components/PropertySelect/img/ui-arrows/arrow01-left.png +0 -0
  67. package/src/components/PropertySelect/img/ui-arrows/arrow01-right-clicked.png +0 -0
  68. package/src/components/PropertySelect/img/ui-arrows/arrow01-right.png +0 -0
  69. package/src/components/PropertySelect/img/ui-arrows/arrow02-left-clicked.png +0 -0
  70. package/src/components/PropertySelect/img/ui-arrows/arrow02-left.png +0 -0
  71. package/src/components/PropertySelect/img/ui-arrows/arrow02-right-clicked.png +0 -0
  72. package/src/components/PropertySelect/img/ui-arrows/arrow02-right.png +0 -0
  73. package/src/components/QuestInfo/QuestInfo.tsx +143 -0
  74. package/src/components/QuestInfo/img/default.png +0 -0
  75. package/src/components/RPGUIContainer.tsx +47 -47
  76. package/src/components/RPGUIRoot.tsx +14 -14
  77. package/src/components/RadioButton.tsx +53 -53
  78. package/src/components/RangeSlider.tsx +68 -68
  79. package/src/components/RelativeListMenu.tsx +83 -0
  80. package/src/components/ScrollList.tsx +77 -77
  81. package/src/components/SimpleProgressBar.tsx +62 -62
  82. package/src/components/SkillProgressBar.tsx +123 -124
  83. package/src/components/SkillsContainer.tsx +196 -235
  84. package/src/components/TextArea.tsx +11 -11
  85. package/src/components/Truncate.tsx +25 -25
  86. package/src/components/shared/Column.tsx +16 -16
  87. package/src/components/shared/SpriteFromAtlas.tsx +99 -99
  88. package/src/components/typography/DynamicText.tsx +49 -49
  89. package/src/constants/uiColors.ts +10 -10
  90. package/src/hooks/useEventListener.ts +21 -21
  91. package/src/hooks/useOutsideAlerter.ts +25 -25
  92. package/src/index.tsx +25 -25
  93. package/src/libs/StringHelpers.ts +3 -3
  94. package/src/mocks/atlas/icons/icons.json +735 -303
  95. package/src/mocks/atlas/icons/icons.png +0 -0
  96. package/src/mocks/atlas/items/items.json +5215 -5195
  97. package/src/mocks/atlas/items/items.png +0 -0
  98. package/src/mocks/equipmentSet.mocks.ts +347 -347
  99. package/src/mocks/itemContainer.mocks.ts +281 -249
  100. package/src/mocks/skills.mocks.ts +122 -122
  101. package/src/stories/Button.stories.tsx +36 -0
  102. package/src/stories/Chat.stories.tsx +170 -0
  103. package/src/stories/CheckButton.stories.tsx +48 -0
  104. package/src/stories/DraggableContainer.stories.tsx +28 -0
  105. package/src/stories/Dropdown.stories.tsx +46 -0
  106. package/src/stories/EquipmentSet.stories.tsx +51 -0
  107. package/src/stories/ItemContainer.stories.tsx +51 -0
  108. package/src/stories/ListMenu.stories.tsx +56 -0
  109. package/src/stories/Multitab.stories.tsx +51 -0
  110. package/src/stories/NPCDialog.stories.tsx +130 -0
  111. package/src/stories/ProgressBar.stories.tsx +23 -0
  112. package/src/stories/PropertySelect.stories.tsx +41 -0
  113. package/src/stories/QuestInfo.stories.tsx +76 -0
  114. package/src/stories/RPGUIContainers.stories.tsx +42 -0
  115. package/src/stories/RadioButton.stories.tsx +49 -0
  116. package/src/stories/RangeSlider.stories.tsx +60 -0
  117. package/src/stories/ScrollList.stories.tsx +85 -0
  118. package/src/stories/SimpleProgressBar.stories.tsx +22 -0
  119. package/src/stories/SkillProgressBar.stories.tsx +30 -0
  120. package/src/stories/SkillsContainer.stories.tsx +31 -0
  121. package/src/stories/Text.stories.tsx +42 -0
  122. package/src/types/eventTypes.ts +4 -4
  123. package/src/types/index.d.ts +2 -2
  124. package/dist/components/Item/Cards/ItemCard.d.ts +0 -9
  125. package/dist/components/shared/SpriteIcon.d.ts +0 -9
  126. package/dist/components/store/UI.store.d.ts +0 -38
  127. package/src/components/Item/Cards/ItemCard.tsx +0 -36
  128. package/src/components/shared/SpriteIcon.tsx +0 -67
  129. package/src/components/store/UI.store.ts +0 -232
@@ -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``;