@rpg-engine/long-bow 0.1.91 → 0.1.92

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 (88) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/Item/Inventory/itemContainerHelper.d.ts +2 -2
  4. package/dist/long-bow.cjs.development.js +49 -2
  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 +49 -2
  9. package/dist/long-bow.esm.js.map +1 -1
  10. package/package.json +98 -98
  11. package/src/components/Abstractions/SlotsContainer.tsx +42 -42
  12. package/src/components/Button.tsx +30 -30
  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 +134 -134
  18. package/src/components/Input.tsx +11 -11
  19. package/src/components/Item/Cards/ItemTooltip.tsx +32 -32
  20. package/src/components/Item/Inventory/ItemContainer.tsx +65 -65
  21. package/src/components/Item/Inventory/ItemContainerTypes.ts +4 -4
  22. package/src/components/Item/Inventory/ItemSlot.tsx +199 -199
  23. package/src/components/Item/Inventory/itemContainerHelper.ts +94 -81
  24. package/src/components/ListMenu.tsx +65 -65
  25. package/src/components/Multitab/Tab.tsx +57 -57
  26. package/src/components/Multitab/TabBody.tsx +13 -13
  27. package/src/components/Multitab/TabsContainer.tsx +97 -97
  28. package/src/components/NPCDialog/NPCDialog.tsx +145 -145
  29. package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
  30. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +239 -239
  31. package/src/components/ProgressBar.tsx +91 -91
  32. package/src/components/PropertySelect/PropertySelect.tsx +101 -101
  33. package/src/components/PropertySelect/img/ui-arrows/arrow01-left-clicked.png +0 -0
  34. package/src/components/PropertySelect/img/ui-arrows/arrow01-left.png +0 -0
  35. package/src/components/PropertySelect/img/ui-arrows/arrow01-right-clicked.png +0 -0
  36. package/src/components/PropertySelect/img/ui-arrows/arrow01-right.png +0 -0
  37. package/src/components/PropertySelect/img/ui-arrows/arrow02-left-clicked.png +0 -0
  38. package/src/components/PropertySelect/img/ui-arrows/arrow02-left.png +0 -0
  39. package/src/components/PropertySelect/img/ui-arrows/arrow02-right-clicked.png +0 -0
  40. package/src/components/PropertySelect/img/ui-arrows/arrow02-right.png +0 -0
  41. package/src/components/QuestInfo/QuestInfo.tsx +143 -143
  42. package/src/components/RPGUIContainer.tsx +47 -47
  43. package/src/components/RPGUIRoot.tsx +14 -14
  44. package/src/components/RadioButton.tsx +53 -53
  45. package/src/components/RangeSlider.tsx +68 -68
  46. package/src/components/RelativeListMenu.tsx +83 -83
  47. package/src/components/ScrollList.tsx +77 -77
  48. package/src/components/SimpleProgressBar.tsx +62 -62
  49. package/src/components/SkillProgressBar.tsx +123 -123
  50. package/src/components/SkillsContainer.tsx +196 -196
  51. package/src/components/TextArea.tsx +11 -11
  52. package/src/components/Truncate.tsx +25 -25
  53. package/src/components/shared/Column.tsx +16 -16
  54. package/src/components/shared/SpriteFromAtlas.tsx +99 -99
  55. package/src/components/typography/DynamicText.tsx +49 -49
  56. package/src/constants/uiColors.ts +10 -10
  57. package/src/hooks/useEventListener.ts +21 -21
  58. package/src/hooks/useOutsideAlerter.ts +25 -25
  59. package/src/index.tsx +25 -25
  60. package/src/libs/StringHelpers.ts +3 -3
  61. package/src/mocks/atlas/icons/icons.json +735 -735
  62. package/src/mocks/atlas/items/items.json +5215 -5215
  63. package/src/mocks/equipmentSet.mocks.ts +347 -347
  64. package/src/mocks/itemContainer.mocks.ts +249 -249
  65. package/src/mocks/skills.mocks.ts +122 -122
  66. package/src/stories/Button.stories.tsx +36 -36
  67. package/src/stories/Chat.stories.tsx +170 -170
  68. package/src/stories/CheckButton.stories.tsx +48 -48
  69. package/src/stories/DraggableContainer.stories.tsx +28 -28
  70. package/src/stories/Dropdown.stories.tsx +46 -46
  71. package/src/stories/EquipmentSet.stories.tsx +50 -50
  72. package/src/stories/ItemContainer.stories.tsx +50 -50
  73. package/src/stories/ListMenu.stories.tsx +56 -56
  74. package/src/stories/Multitab.stories.tsx +51 -51
  75. package/src/stories/NPCDialog.stories.tsx +130 -130
  76. package/src/stories/ProgressBar.stories.tsx +23 -23
  77. package/src/stories/PropertySelect.stories.tsx +41 -41
  78. package/src/stories/QuestInfo.stories.tsx +76 -76
  79. package/src/stories/RPGUIContainers.stories.tsx +42 -42
  80. package/src/stories/RadioButton.stories.tsx +49 -49
  81. package/src/stories/RangeSlider.stories.tsx +60 -60
  82. package/src/stories/ScrollList.stories.tsx +85 -85
  83. package/src/stories/SimpleProgressBar.stories.tsx +22 -22
  84. package/src/stories/SkillProgressBar.stories.tsx +30 -30
  85. package/src/stories/SkillsContainer.stories.tsx +31 -31
  86. package/src/stories/Text.stories.tsx +42 -42
  87. package/src/types/eventTypes.ts +4 -4
  88. 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``;