@rpg-engine/long-bow 0.1.78 → 0.1.794

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 (57) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/store/UI.store.d.ts +4 -0
  4. package/dist/long-bow.cjs.development.js +48 -6
  5. package/dist/long-bow.cjs.development.js.map +1 -1
  6. package/dist/long-bow.cjs.production.min.js +1 -1
  7. package/dist/long-bow.cjs.production.min.js.map +1 -1
  8. package/dist/long-bow.esm.js +48 -6
  9. package/dist/long-bow.esm.js.map +1 -1
  10. package/package.json +96 -96
  11. package/src/components/Abstractions/SlotsContainer.tsx +42 -42
  12. package/src/components/Button.tsx +29 -29
  13. package/src/components/Chat/Chat.tsx +193 -193
  14. package/src/components/CheckButton.tsx +65 -65
  15. package/src/components/DraggableContainer.tsx +150 -150
  16. package/src/components/Dropdown.tsx +57 -57
  17. package/src/components/Equipment/EquipmentSet.tsx +180 -179
  18. package/src/components/Input.tsx +11 -11
  19. package/src/components/Item/Cards/ItemCard.tsx +36 -36
  20. package/src/components/Item/Inventory/ItemContainer.tsx +113 -113
  21. package/src/components/Item/Inventory/ItemSlot.tsx +158 -158
  22. package/src/components/Item/Inventory/itemContainerHelper.ts +81 -81
  23. package/src/components/ListMenu.tsx +65 -65
  24. package/src/components/Multitab/Tab.tsx +57 -57
  25. package/src/components/Multitab/TabBody.tsx +13 -13
  26. package/src/components/Multitab/TabsContainer.tsx +97 -97
  27. package/src/components/NPCDialog/NPCDialog.tsx +145 -145
  28. package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
  29. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +242 -242
  30. package/src/components/ProgressBar.tsx +91 -91
  31. package/src/components/RPGUIContainer.tsx +47 -47
  32. package/src/components/RPGUIRoot.tsx +14 -14
  33. package/src/components/RadioButton.tsx +53 -53
  34. package/src/components/RangeSlider.tsx +68 -68
  35. package/src/components/ScrollList.tsx +77 -77
  36. package/src/components/SimpleProgressBar.tsx +62 -62
  37. package/src/components/SkillProgressBar.tsx +124 -124
  38. package/src/components/SkillsContainer.tsx +235 -235
  39. package/src/components/TextArea.tsx +11 -11
  40. package/src/components/Truncate.tsx +25 -25
  41. package/src/components/shared/Column.tsx +16 -16
  42. package/src/components/shared/SpriteFromAtlas.tsx +99 -99
  43. package/src/components/shared/SpriteIcon.tsx +67 -67
  44. package/src/components/store/UI.store.ts +232 -192
  45. package/src/components/typography/DynamicText.tsx +49 -49
  46. package/src/constants/uiColors.ts +10 -10
  47. package/src/hooks/useEventListener.ts +21 -21
  48. package/src/hooks/useOutsideAlerter.ts +25 -25
  49. package/src/index.tsx +25 -25
  50. package/src/libs/StringHelpers.ts +3 -3
  51. package/src/mocks/atlas/icons/icons.json +303 -303
  52. package/src/mocks/atlas/items/items.json +5195 -5195
  53. package/src/mocks/equipmentSet.mocks.ts +347 -347
  54. package/src/mocks/itemContainer.mocks.ts +249 -249
  55. package/src/mocks/skills.mocks.ts +122 -122
  56. package/src/types/eventTypes.ts +4 -4
  57. 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``;