@rpg-engine/long-bow 0.3.69 → 0.3.71

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 (158) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/CraftBook/CraftBook.d.ts +2 -1
  4. package/dist/components/Item/Cards/ItemInfo.d.ts +10 -0
  5. package/dist/components/Item/Cards/ItemInfoDisplay.d.ts +9 -0
  6. package/dist/components/Item/Cards/ItemInfoWrapper.d.ts +11 -0
  7. package/dist/components/Item/Cards/ItemTooltip.d.ts +7 -4
  8. package/dist/components/Item/Inventory/ItemContainer.d.ts +2 -1
  9. package/dist/components/Item/Inventory/ItemSlot.d.ts +4 -1
  10. package/dist/components/TradingMenu/TradingItemRow.d.ts +2 -1
  11. package/dist/components/TradingMenu/TradingMenu.d.ts +4 -3
  12. package/dist/components/shared/SpriteFromAtlas.d.ts +1 -0
  13. package/dist/long-bow.cjs.development.js +1220 -949
  14. package/dist/long-bow.cjs.development.js.map +1 -1
  15. package/dist/long-bow.cjs.production.min.js +1 -1
  16. package/dist/long-bow.cjs.production.min.js.map +1 -1
  17. package/dist/long-bow.esm.js +1222 -953
  18. package/dist/long-bow.esm.js.map +1 -1
  19. package/dist/stories/ItemInfoDisplay.stories.d.ts +8 -0
  20. package/dist/stories/TradingMenu.stories.d.ts +2 -2
  21. package/package.json +100 -100
  22. package/src/components/Abstractions/SlotsContainer.tsx +45 -45
  23. package/src/components/Arrow/SelectArrow.tsx +69 -69
  24. package/src/components/Arrow/img/arrow01-left-clicked.png +0 -0
  25. package/src/components/Arrow/img/arrow01-left.png +0 -0
  26. package/src/components/Arrow/img/arrow01-right-clicked.png +0 -0
  27. package/src/components/Arrow/img/arrow01-right.png +0 -0
  28. package/src/components/Arrow/img/arrow02-left-clicked.png +0 -0
  29. package/src/components/Arrow/img/arrow02-left.png +0 -0
  30. package/src/components/Arrow/img/arrow02-right-clicked.png +0 -0
  31. package/src/components/Arrow/img/arrow02-right.png +0 -0
  32. package/src/components/Button.tsx +40 -40
  33. package/src/components/Character/CharacterSelection.tsx +96 -96
  34. package/src/components/CharacterStatus/CharacterStatus.tsx +120 -120
  35. package/src/components/Chat/Chat.tsx +195 -195
  36. package/src/components/Chatdeprecated/ChatDeprecated.tsx +198 -198
  37. package/src/components/CheckButton.tsx +65 -65
  38. package/src/components/CircularController/CircularController.tsx +248 -248
  39. package/src/components/CraftBook/CraftBook.tsx +237 -227
  40. package/src/components/CraftBook/MockItems.ts +41 -46
  41. package/src/components/DraggableContainer.tsx +153 -153
  42. package/src/components/Dropdown.tsx +90 -90
  43. package/src/components/DropdownSelectorContainer.tsx +42 -42
  44. package/src/components/Equipment/EquipmentSet.tsx +190 -190
  45. package/src/components/HistoryDialog.tsx +104 -104
  46. package/src/components/Input.tsx +15 -15
  47. package/src/components/Item/Cards/ItemInfo.tsx +248 -0
  48. package/src/components/Item/Cards/ItemInfoDisplay.tsx +120 -0
  49. package/src/components/Item/Cards/ItemInfoWrapper.tsx +39 -0
  50. package/src/components/Item/Cards/ItemTooltip.tsx +85 -33
  51. package/src/components/Item/Inventory/ErrorBoundary.tsx +42 -42
  52. package/src/components/Item/Inventory/ItemContainer.tsx +214 -210
  53. package/src/components/Item/Inventory/ItemContainerTypes.ts +6 -6
  54. package/src/components/Item/Inventory/ItemQuantitySelector.tsx +138 -138
  55. package/src/components/Item/Inventory/ItemSlot.tsx +512 -501
  56. package/src/components/Item/Inventory/itemContainerHelper.ts +156 -156
  57. package/src/components/ListMenu.tsx +63 -63
  58. package/src/components/Multitab/Tab.tsx +66 -66
  59. package/src/components/Multitab/TabBody.tsx +13 -13
  60. package/src/components/Multitab/TabsContainer.tsx +97 -97
  61. package/src/components/NPCDialog/NPCDialog.tsx +121 -121
  62. package/src/components/NPCDialog/NPCDialogText.tsx +113 -113
  63. package/src/components/NPCDialog/NPCMultiDialog.tsx +159 -159
  64. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +237 -237
  65. package/src/components/ProgressBar.tsx +92 -92
  66. package/src/components/PropertySelect/PropertySelect.tsx +106 -106
  67. package/src/components/QuestInfo/QuestInfo.tsx +230 -230
  68. package/src/components/QuestList.tsx +129 -129
  69. package/src/components/RPGUIContainer.tsx +47 -47
  70. package/src/components/RPGUIForceRenderStart.tsx +45 -45
  71. package/src/components/RPGUIRoot.tsx +14 -14
  72. package/src/components/RadioButton.tsx +53 -53
  73. package/src/components/RadioInput/RadioButton.tsx +96 -96
  74. package/src/components/RadioInput/RadioInput.tsx +102 -102
  75. package/src/components/RadioInput/instruments.ts +15 -15
  76. package/src/components/RangeSlider.tsx +78 -78
  77. package/src/components/RelativeListMenu.tsx +83 -83
  78. package/src/components/ScrollList.tsx +79 -79
  79. package/src/components/Shortcuts/Shortcuts.tsx +151 -151
  80. package/src/components/Shortcuts/ShortcutsSetter.tsx +132 -132
  81. package/src/components/Shortcuts/SingleShortcut.ts +62 -62
  82. package/src/components/SimpleProgressBar.tsx +62 -62
  83. package/src/components/SkillProgressBar.tsx +133 -133
  84. package/src/components/SkillsContainer.tsx +198 -198
  85. package/src/components/Spellbook/Spell.tsx +201 -201
  86. package/src/components/Spellbook/Spellbook.tsx +150 -150
  87. package/src/components/Spellbook/constants.ts +8 -8
  88. package/src/components/Spellbook/mockSpells.ts +60 -60
  89. package/src/components/StaticBook/StaticBook.tsx +103 -103
  90. package/src/components/TextArea.tsx +11 -11
  91. package/src/components/TimeWidget/DayNightPeriod/DayNightPeriod.tsx +35 -35
  92. package/src/components/TimeWidget/TimeWidget.tsx +63 -63
  93. package/src/components/TradingMenu/TradingItemRow.tsx +195 -181
  94. package/src/components/TradingMenu/TradingMenu.tsx +211 -203
  95. package/src/components/TradingMenu/items.mock.ts +48 -96
  96. package/src/components/Truncate.tsx +25 -25
  97. package/src/components/itemSelector/ItemSelector.tsx +136 -136
  98. package/src/components/shared/Column.tsx +16 -16
  99. package/src/components/shared/Ellipsis.tsx +65 -65
  100. package/src/components/shared/SpriteFromAtlas.tsx +104 -102
  101. package/src/components/typography/DynamicText.tsx +49 -49
  102. package/src/constants/uiColors.ts +20 -20
  103. package/src/constants/uiDevices.ts +3 -3
  104. package/src/constants/uiFonts.ts +12 -12
  105. package/src/hooks/useEventListener.ts +21 -21
  106. package/src/hooks/useOutsideAlerter.ts +25 -25
  107. package/src/index.tsx +40 -40
  108. package/src/libs/StringHelpers.ts +3 -3
  109. package/src/mocks/atlas/entities/entities.json +20215 -20215
  110. package/src/mocks/atlas/icons/icons.json +735 -735
  111. package/src/mocks/atlas/items/items.json +12086 -12086
  112. package/src/mocks/equipmentSet.mocks.ts +391 -393
  113. package/src/mocks/itemContainer.mocks.ts +563 -562
  114. package/src/mocks/skills.mocks.ts +128 -128
  115. package/src/stories/Arrow.stories.tsx +26 -26
  116. package/src/stories/Button.stories.tsx +36 -36
  117. package/src/stories/CharacterSelection.stories.tsx +45 -45
  118. package/src/stories/CharacterStatus.stories.tsx +29 -29
  119. package/src/stories/Chat.stories.tsx +187 -187
  120. package/src/stories/ChatDeprecated.stories.tsx +170 -170
  121. package/src/stories/CheckButton.stories.tsx +48 -48
  122. package/src/stories/CircullarController.stories.tsx +37 -37
  123. package/src/stories/CraftBook.stories.tsx +42 -40
  124. package/src/stories/DayNightPeriod.stories.tsx +27 -27
  125. package/src/stories/DraggableContainer.stories.tsx +28 -28
  126. package/src/stories/Dropdown.stories.tsx +46 -46
  127. package/src/stories/DropdownSelectorContainer.stories.tsx +41 -41
  128. package/src/stories/EquipmentSet.stories.tsx +65 -65
  129. package/src/stories/HistoryDialog.stories.tsx +61 -61
  130. package/src/stories/ItemContainer.stories.tsx +200 -198
  131. package/src/stories/ItemInfoDisplay.stories.tsx +33 -0
  132. package/src/stories/ItemQuantitySelector.stories.tsx +26 -26
  133. package/src/stories/ItemSelector.stories.tsx +77 -77
  134. package/src/stories/ItemTradingComponent.stories.tsx +35 -35
  135. package/src/stories/ListMenu.stories.tsx +56 -56
  136. package/src/stories/Multitab.stories.tsx +51 -51
  137. package/src/stories/NPCDialog.stories.tsx +130 -130
  138. package/src/stories/NPCMultiDialog.stories.tsx +71 -71
  139. package/src/stories/ProgressBar.stories.tsx +23 -23
  140. package/src/stories/PropertySelect.stories.tsx +40 -40
  141. package/src/stories/QuestInfo.stories.tsx +107 -107
  142. package/src/stories/QuestList.stories.tsx +82 -82
  143. package/src/stories/RPGUIContainers.stories.tsx +42 -42
  144. package/src/stories/RadioButton.stories.tsx +49 -49
  145. package/src/stories/RadioInput.stories.tsx +34 -34
  146. package/src/stories/RangeSlider.stories.tsx +64 -64
  147. package/src/stories/ScrollList.stories.tsx +85 -85
  148. package/src/stories/Shortcuts.stories.tsx +39 -39
  149. package/src/stories/SimpleProgressBar.stories.tsx +22 -22
  150. package/src/stories/SkillProgressBar.stories.tsx +34 -34
  151. package/src/stories/SkillsContainer.stories.tsx +35 -35
  152. package/src/stories/Spellbook.stories.tsx +104 -104
  153. package/src/stories/StaticBook.stories.tsx +32 -32
  154. package/src/stories/Text.stories.tsx +42 -42
  155. package/src/stories/TimeWidget.stories.tsx +27 -27
  156. package/src/stories/TradingMenu.stories.tsx +47 -45
  157. package/src/types/eventTypes.ts +4 -4
  158. package/src/types/index.d.ts +2 -2
@@ -1,35 +1,35 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
-
4
- import { PeriodOfDay } from '@rpg-engine/shared';
5
- import AfternoonGif from './gif/afternoon.gif';
6
- import MorningGif from './gif/morning.gif';
7
- import NightGif from './gif/night.gif';
8
-
9
- export interface IPeriodOfDayDisplayProps {
10
- periodOfDay: PeriodOfDay;
11
- }
12
-
13
- export const DayNightPeriod: React.FC<IPeriodOfDayDisplayProps> = ({
14
- periodOfDay,
15
- }) => {
16
- const periodOfDaySrcFiles = {
17
- [PeriodOfDay.Morning]: MorningGif,
18
- [PeriodOfDay.Afternoon]: AfternoonGif,
19
- [PeriodOfDay.Night]: NightGif,
20
- };
21
-
22
- return (
23
- <GifContainer>
24
- <img src={periodOfDaySrcFiles[periodOfDay]} />
25
- </GifContainer>
26
- );
27
- };
28
-
29
- const GifContainer = styled.div`
30
- width: 100%;
31
-
32
- img {
33
- width: 67%;
34
- }
35
- `;
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { PeriodOfDay } from '@rpg-engine/shared';
5
+ import AfternoonGif from './gif/afternoon.gif';
6
+ import MorningGif from './gif/morning.gif';
7
+ import NightGif from './gif/night.gif';
8
+
9
+ export interface IPeriodOfDayDisplayProps {
10
+ periodOfDay: PeriodOfDay;
11
+ }
12
+
13
+ export const DayNightPeriod: React.FC<IPeriodOfDayDisplayProps> = ({
14
+ periodOfDay,
15
+ }) => {
16
+ const periodOfDaySrcFiles = {
17
+ [PeriodOfDay.Morning]: MorningGif,
18
+ [PeriodOfDay.Afternoon]: AfternoonGif,
19
+ [PeriodOfDay.Night]: NightGif,
20
+ };
21
+
22
+ return (
23
+ <GifContainer>
24
+ <img src={periodOfDaySrcFiles[periodOfDay]} />
25
+ </GifContainer>
26
+ );
27
+ };
28
+
29
+ const GifContainer = styled.div`
30
+ width: 100%;
31
+
32
+ img {
33
+ width: 67%;
34
+ }
35
+ `;
@@ -1,63 +1,63 @@
1
- import { PeriodOfDay } from '@rpg-engine/shared';
2
- import React from 'react';
3
- import Draggable from 'react-draggable';
4
- import styled from 'styled-components';
5
- import { uiFonts } from '../../constants/uiFonts';
6
- import { DayNightPeriod } from './DayNightPeriod/DayNightPeriod';
7
-
8
- import ClockWidgetImg from './img/clockwidget.png';
9
-
10
- export interface IClockWidgetProps {
11
- onClose?: () => void;
12
- TimeClock: string;
13
- periodOfDay: PeriodOfDay;
14
- }
15
-
16
- export const TimeWidget: React.FC<IClockWidgetProps> = ({
17
- onClose,
18
- TimeClock,
19
- periodOfDay,
20
- }) => {
21
- return (
22
- <Draggable>
23
- <WidgetContainer>
24
- <CloseButton onPointerDown={onClose}>X</CloseButton>
25
- <DayNightContainer>
26
- <DayNightPeriod periodOfDay={periodOfDay} />
27
- </DayNightContainer>
28
- <Time>{TimeClock}</Time>
29
- </WidgetContainer>
30
- </Draggable>
31
- );
32
- };
33
-
34
- const WidgetContainer = styled.div`
35
- background-image: url(${ClockWidgetImg});
36
- background-size: 10rem;
37
- background-repeat: no-repeat;
38
- width: 10rem;
39
- position: absolute;
40
- height: 100px;
41
- `;
42
-
43
- const Time = styled.div`
44
- top: 0.75rem;
45
- right: 0.5rem;
46
- position: absolute;
47
- font-size: ${uiFonts.size.small};
48
- color: white;
49
- `;
50
-
51
- const CloseButton = styled.p`
52
- position: absolute;
53
- top: -0.5rem;
54
- margin: 0;
55
- right: -0.2rem;
56
- font-size: ${uiFonts.size.small} !important;
57
- z-index: 1;
58
- `;
59
-
60
- const DayNightContainer = styled.div`
61
- margin-top: -0.3rem;
62
- margin-left: -0.3rem;
63
- `;
1
+ import { PeriodOfDay } from '@rpg-engine/shared';
2
+ import React from 'react';
3
+ import Draggable from 'react-draggable';
4
+ import styled from 'styled-components';
5
+ import { uiFonts } from '../../constants/uiFonts';
6
+ import { DayNightPeriod } from './DayNightPeriod/DayNightPeriod';
7
+
8
+ import ClockWidgetImg from './img/clockwidget.png';
9
+
10
+ export interface IClockWidgetProps {
11
+ onClose?: () => void;
12
+ TimeClock: string;
13
+ periodOfDay: PeriodOfDay;
14
+ }
15
+
16
+ export const TimeWidget: React.FC<IClockWidgetProps> = ({
17
+ onClose,
18
+ TimeClock,
19
+ periodOfDay,
20
+ }) => {
21
+ return (
22
+ <Draggable>
23
+ <WidgetContainer>
24
+ <CloseButton onPointerDown={onClose}>X</CloseButton>
25
+ <DayNightContainer>
26
+ <DayNightPeriod periodOfDay={periodOfDay} />
27
+ </DayNightContainer>
28
+ <Time>{TimeClock}</Time>
29
+ </WidgetContainer>
30
+ </Draggable>
31
+ );
32
+ };
33
+
34
+ const WidgetContainer = styled.div`
35
+ background-image: url(${ClockWidgetImg});
36
+ background-size: 10rem;
37
+ background-repeat: no-repeat;
38
+ width: 10rem;
39
+ position: absolute;
40
+ height: 100px;
41
+ `;
42
+
43
+ const Time = styled.div`
44
+ top: 0.75rem;
45
+ right: 0.5rem;
46
+ position: absolute;
47
+ font-size: ${uiFonts.size.small};
48
+ color: white;
49
+ `;
50
+
51
+ const CloseButton = styled.p`
52
+ position: absolute;
53
+ top: -0.5rem;
54
+ margin: 0;
55
+ right: -0.2rem;
56
+ font-size: ${uiFonts.size.small} !important;
57
+ z-index: 1;
58
+ `;
59
+
60
+ const DayNightContainer = styled.div`
61
+ margin-top: -0.3rem;
62
+ margin-left: -0.3rem;
63
+ `;
@@ -1,181 +1,195 @@
1
- import { getItemTextureKeyPath, ITradeResponseItem } from '@rpg-engine/shared';
2
- import capitalize from 'lodash/capitalize';
3
- import React from 'react';
4
- import styled from 'styled-components';
5
- import { uiColors } from '../../constants/uiColors';
6
- import { uiFonts } from '../../constants/uiFonts';
7
- import SelectArrow from '../Arrow/SelectArrow';
8
- import { Ellipsis } from '../shared/Ellipsis';
9
- import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
10
- export interface ITradeComponentProps {
11
- traderItem: ITradeResponseItem;
12
- onQuantityChange: (
13
- traderItem: ITradeResponseItem,
14
- selectedQty: number
15
- ) => void;
16
- atlasJSON: any;
17
- atlasIMG: any;
18
- selectedQty: number;
19
- }
20
-
21
- const outerQty = 10;
22
-
23
- export const TradingItemRow: React.FC<ITradeComponentProps> = ({
24
- atlasIMG,
25
- atlasJSON,
26
- onQuantityChange,
27
- traderItem,
28
- selectedQty,
29
- }) => {
30
- const onLeftClick = (qty = 1) => {
31
- onQuantityChange(traderItem, Math.max(0, selectedQty - qty));
32
- };
33
-
34
- const onRightClick = (qty = 1) => {
35
- onQuantityChange(
36
- traderItem,
37
- Math.min(traderItem.qty ?? 999, selectedQty + qty)
38
- );
39
- };
40
-
41
- return (
42
- <ItemWrapper>
43
- <ItemIconContainer>
44
- <SpriteContainer>
45
- <SpriteFromAtlas
46
- atlasIMG={atlasIMG}
47
- atlasJSON={atlasJSON}
48
- spriteKey={getItemTextureKeyPath(
49
- {
50
- key: traderItem.key,
51
- stackQty: traderItem.qty || 1,
52
- texturePath: traderItem.texturePath,
53
- },
54
- atlasJSON
55
- )}
56
- imgScale={2.5}
57
- />
58
- </SpriteContainer>
59
- </ItemIconContainer>
60
- <ItemNameContainer>
61
- <NameValue>
62
- <p>
63
- <Ellipsis maxLines={1} maxWidth="250px">
64
- {capitalize(traderItem.name)}
65
- </Ellipsis>
66
- </p>
67
- <p>${traderItem.price}</p>
68
- </NameValue>
69
- </ItemNameContainer>
70
-
71
- <QuantityContainer>
72
- <SelectArrow
73
- size={32}
74
- className="arrow-selector"
75
- direction="left"
76
- onPointerDown={onLeftClick.bind(null, outerQty)}
77
- />
78
- <StyledArrow
79
- size={32}
80
- className="arrow-selector"
81
- direction="left"
82
- onPointerDown={onLeftClick}
83
- />
84
- <QuantityDisplay>
85
- <TextOverlay>
86
- <Item>{selectedQty}</Item>
87
- </TextOverlay>
88
- </QuantityDisplay>
89
- <StyledArrow
90
- size={32}
91
- className="arrow-selector"
92
- direction="right"
93
- onPointerDown={onRightClick}
94
- />
95
- <SelectArrow
96
- size={32}
97
- className="arrow-selector"
98
- direction="right"
99
- onPointerDown={onRightClick.bind(null, outerQty)}
100
- />
101
- </QuantityContainer>
102
- </ItemWrapper>
103
- );
104
- };
105
-
106
- const StyledArrow = styled(SelectArrow)`
107
- margin: 40px;
108
- `;
109
-
110
- const ItemWrapper = styled.div`
111
- width: 100%;
112
- margin: auto;
113
- display: flex;
114
- justify-content: space-between;
115
- margin-bottom: 1rem;
116
-
117
- &:hover {
118
- background-color: ${uiColors.darkGray};
119
- }
120
- padding: 0.5rem;
121
- `;
122
-
123
- const ItemNameContainer = styled.div`
124
- flex: 60%;
125
- `;
126
-
127
- const ItemIconContainer = styled.div`
128
- display: flex;
129
- justify-content: flex-start;
130
- align-items: center;
131
-
132
- flex: 0 0 58px;
133
- `;
134
-
135
- const SpriteContainer = styled.div`
136
- position: relative;
137
- top: -0.5rem;
138
- left: 0.5rem;
139
- `;
140
-
141
- const NameValue = styled.div`
142
- p {
143
- font-size: 0.75rem;
144
- margin: 0;
145
- }
146
- `;
147
-
148
- const Item = styled.span`
149
- color: white;
150
- text-align: center;
151
- z-index: 1;
152
-
153
- width: 100%;
154
- `;
155
-
156
- const TextOverlay = styled.div`
157
- width: 100%;
158
- position: relative;
159
- `;
160
-
161
- interface IContainerProps {
162
- percentageWidth?: number;
163
- minWidth?: number;
164
- style?: Record<string, any>;
165
- }
166
-
167
- const QuantityContainer = styled.div<IContainerProps>`
168
- position: relative;
169
- display: flex;
170
-
171
- min-width: 100px;
172
- width: 40%;
173
- justify-content: center;
174
- align-items: center;
175
-
176
- flex: 40%;
177
- `;
178
-
179
- const QuantityDisplay = styled.div`
180
- font-size: ${uiFonts.size.small};
181
- `;
1
+ import {
2
+ getItemTextureKeyPath,
3
+ IEquipmentSet,
4
+ ITradeResponseItem,
5
+ } from '@rpg-engine/shared';
6
+ import capitalize from 'lodash/capitalize';
7
+ import React from 'react';
8
+ import styled from 'styled-components';
9
+ import { uiColors } from '../../constants/uiColors';
10
+ import { uiFonts } from '../../constants/uiFonts';
11
+ import SelectArrow from '../Arrow/SelectArrow';
12
+ import { ItemInfoWrapper } from '../Item/Cards/ItemInfoWrapper';
13
+ import { Ellipsis } from '../shared/Ellipsis';
14
+ import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
15
+ export interface ITradeComponentProps {
16
+ traderItem: ITradeResponseItem;
17
+ onQuantityChange: (
18
+ traderItem: ITradeResponseItem,
19
+ selectedQty: number
20
+ ) => void;
21
+ atlasJSON: any;
22
+ atlasIMG: any;
23
+ selectedQty: number;
24
+ equipmentSet?: IEquipmentSet | null;
25
+ }
26
+
27
+ const outerQty = 10;
28
+
29
+ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
30
+ atlasIMG,
31
+ atlasJSON,
32
+ onQuantityChange,
33
+ traderItem,
34
+ selectedQty,
35
+ equipmentSet,
36
+ }) => {
37
+ const onLeftClick = (qty = 1) => {
38
+ onQuantityChange(traderItem, Math.max(0, selectedQty - qty));
39
+ };
40
+
41
+ const onRightClick = (qty = 1) => {
42
+ onQuantityChange(
43
+ traderItem,
44
+ Math.min(traderItem.stackQty ?? 999, selectedQty + qty)
45
+ );
46
+ };
47
+
48
+ return (
49
+ <ItemWrapper>
50
+ <ItemIconContainer>
51
+ <SpriteContainer>
52
+ <ItemInfoWrapper
53
+ atlasIMG={atlasIMG}
54
+ atlasJSON={atlasJSON}
55
+ equipmentSet={equipmentSet}
56
+ item={traderItem}
57
+ >
58
+ <SpriteFromAtlas
59
+ atlasIMG={atlasIMG}
60
+ atlasJSON={atlasJSON}
61
+ spriteKey={getItemTextureKeyPath(
62
+ {
63
+ key: traderItem.key,
64
+ stackQty: traderItem.stackQty || 1,
65
+ texturePath: traderItem.texturePath,
66
+ },
67
+ atlasJSON
68
+ )}
69
+ imgScale={2.5}
70
+ />
71
+ </ItemInfoWrapper>
72
+ </SpriteContainer>
73
+ </ItemIconContainer>
74
+
75
+ <ItemNameContainer>
76
+ <NameValue>
77
+ <p>
78
+ <Ellipsis maxLines={1} maxWidth="250px">
79
+ {capitalize(traderItem.name)}
80
+ </Ellipsis>
81
+ </p>
82
+ <p>${traderItem.price}</p>
83
+ </NameValue>
84
+ </ItemNameContainer>
85
+ <QuantityContainer>
86
+ <SelectArrow
87
+ size={32}
88
+ className="arrow-selector"
89
+ direction="left"
90
+ onPointerDown={onLeftClick.bind(null, outerQty)}
91
+ />
92
+ <StyledArrow
93
+ size={32}
94
+ className="arrow-selector"
95
+ direction="left"
96
+ onPointerDown={onLeftClick}
97
+ />
98
+ <QuantityDisplay>
99
+ <TextOverlay>
100
+ <Item>{selectedQty}</Item>
101
+ </TextOverlay>
102
+ </QuantityDisplay>
103
+ <StyledArrow
104
+ size={32}
105
+ className="arrow-selector"
106
+ direction="right"
107
+ onPointerDown={onRightClick}
108
+ />
109
+ <SelectArrow
110
+ size={32}
111
+ className="arrow-selector"
112
+ direction="right"
113
+ onPointerDown={onRightClick.bind(null, outerQty)}
114
+ />
115
+ </QuantityContainer>
116
+ </ItemWrapper>
117
+ );
118
+ };
119
+
120
+ const StyledArrow = styled(SelectArrow)`
121
+ margin: 40px;
122
+ `;
123
+
124
+ const ItemWrapper = styled.div`
125
+ width: 100%;
126
+ margin: auto;
127
+ display: flex;
128
+ justify-content: space-between;
129
+ margin-bottom: 1rem;
130
+
131
+ &:hover {
132
+ background-color: ${uiColors.darkGray};
133
+ }
134
+ padding: 0.5rem;
135
+ `;
136
+
137
+ const ItemNameContainer = styled.div`
138
+ flex: 60%;
139
+ `;
140
+
141
+ const ItemIconContainer = styled.div`
142
+ display: flex;
143
+ justify-content: flex-start;
144
+ align-items: center;
145
+
146
+ flex: 0 0 58px;
147
+ `;
148
+
149
+ const SpriteContainer = styled.div`
150
+ position: relative;
151
+ top: -0.5rem;
152
+ left: 0.5rem;
153
+ `;
154
+
155
+ const NameValue = styled.div`
156
+ p {
157
+ font-size: 0.75rem;
158
+ margin: 0;
159
+ }
160
+ `;
161
+
162
+ const Item = styled.span`
163
+ color: white;
164
+ text-align: center;
165
+ z-index: 1;
166
+
167
+ width: 100%;
168
+ `;
169
+
170
+ const TextOverlay = styled.div`
171
+ width: 100%;
172
+ position: relative;
173
+ `;
174
+
175
+ interface IContainerProps {
176
+ percentageWidth?: number;
177
+ minWidth?: number;
178
+ style?: Record<string, any>;
179
+ }
180
+
181
+ const QuantityContainer = styled.div<IContainerProps>`
182
+ position: relative;
183
+ display: flex;
184
+
185
+ min-width: 100px;
186
+ width: 40%;
187
+ justify-content: center;
188
+ align-items: center;
189
+
190
+ flex: 40%;
191
+ `;
192
+
193
+ const QuantityDisplay = styled.div`
194
+ font-size: ${uiFonts.size.small};
195
+ `;