@rpg-engine/long-bow 0.5.22 → 0.5.23
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.
- package/dist/components/Item/Inventory/ItemQuantitySelectorModal.d.ts +12 -0
- package/dist/long-bow.cjs.development.js +109 -100
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +109 -100
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +5 -38
- package/src/components/Item/Inventory/ItemQuantitySelectorModal.tsx +59 -0
package/package.json
CHANGED
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
import React, { useState } from 'react';
|
|
10
10
|
import styled from 'styled-components';
|
|
11
11
|
import { SlotsContainer } from '../../Abstractions/SlotsContainer';
|
|
12
|
-
import { ItemQuantitySelector } from './ItemQuantitySelector';
|
|
13
12
|
|
|
14
13
|
import { IPosition } from '../../../types/eventTypes';
|
|
15
|
-
import ModalPortal from '../../Abstractions/ModalPortal';
|
|
16
14
|
import { ShortcutsSetter } from '../../Shortcuts/ShortcutsSetter';
|
|
17
15
|
import { DraggedItem } from './DraggedItem';
|
|
16
|
+
import { ItemQuantitySelectorModal } from './ItemQuantitySelectorModal';
|
|
18
17
|
import { ItemSlot } from './ItemSlot';
|
|
19
18
|
import { DraggingProvider } from './context/DraggingContext';
|
|
20
19
|
|
|
@@ -186,29 +185,10 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
186
185
|
</ItemsContainer>
|
|
187
186
|
</SlotsContainer>
|
|
188
187
|
{quantitySelect.isOpen && (
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
onConfirm={quantity => {
|
|
194
|
-
quantitySelect.callback(quantity);
|
|
195
|
-
setQuantitySelect({
|
|
196
|
-
isOpen: false,
|
|
197
|
-
maxQuantity: 1,
|
|
198
|
-
callback: () => {},
|
|
199
|
-
});
|
|
200
|
-
}}
|
|
201
|
-
onClose={() => {
|
|
202
|
-
quantitySelect.callback(-1);
|
|
203
|
-
setQuantitySelect({
|
|
204
|
-
isOpen: false,
|
|
205
|
-
maxQuantity: 1,
|
|
206
|
-
callback: () => {},
|
|
207
|
-
});
|
|
208
|
-
}}
|
|
209
|
-
/>
|
|
210
|
-
</QuantitySelectorContainer>
|
|
211
|
-
</ModalPortal>
|
|
188
|
+
<ItemQuantitySelectorModal
|
|
189
|
+
quantitySelect={quantitySelect}
|
|
190
|
+
setQuantitySelect={setQuantitySelect}
|
|
191
|
+
/>
|
|
212
192
|
)}
|
|
213
193
|
</DraggingProvider>
|
|
214
194
|
);
|
|
@@ -223,16 +203,3 @@ const ItemsContainer = styled.div`
|
|
|
223
203
|
overflow-x: hidden;
|
|
224
204
|
width: 415px;
|
|
225
205
|
`;
|
|
226
|
-
|
|
227
|
-
const QuantitySelectorContainer = styled.div`
|
|
228
|
-
position: absolute;
|
|
229
|
-
top: 0;
|
|
230
|
-
left: 0;
|
|
231
|
-
width: 100vw;
|
|
232
|
-
height: 100vh;
|
|
233
|
-
z-index: 100;
|
|
234
|
-
display: flex;
|
|
235
|
-
justify-content: center;
|
|
236
|
-
align-items: center;
|
|
237
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
238
|
-
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import ModalPortal from '../../Abstractions/ModalPortal';
|
|
4
|
+
import { ItemQuantitySelector } from './ItemQuantitySelector';
|
|
5
|
+
|
|
6
|
+
export interface IQuantitySelect {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
maxQuantity: number;
|
|
9
|
+
callback: (_quantity: number) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IProps {
|
|
13
|
+
quantitySelect: IQuantitySelect;
|
|
14
|
+
setQuantitySelect: React.Dispatch<React.SetStateAction<IQuantitySelect>>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ItemQuantitySelectorModal = ({
|
|
18
|
+
quantitySelect,
|
|
19
|
+
setQuantitySelect,
|
|
20
|
+
}: IProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<ModalPortal>
|
|
23
|
+
<QuantitySelectorContainer>
|
|
24
|
+
<ItemQuantitySelector
|
|
25
|
+
quantity={quantitySelect.maxQuantity}
|
|
26
|
+
onConfirm={quantity => {
|
|
27
|
+
quantitySelect.callback(quantity);
|
|
28
|
+
setQuantitySelect({
|
|
29
|
+
isOpen: false,
|
|
30
|
+
maxQuantity: 1,
|
|
31
|
+
callback: () => {},
|
|
32
|
+
});
|
|
33
|
+
}}
|
|
34
|
+
onClose={() => {
|
|
35
|
+
quantitySelect.callback(-1);
|
|
36
|
+
setQuantitySelect({
|
|
37
|
+
isOpen: false,
|
|
38
|
+
maxQuantity: 1,
|
|
39
|
+
callback: () => {},
|
|
40
|
+
});
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
</QuantitySelectorContainer>
|
|
44
|
+
</ModalPortal>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const QuantitySelectorContainer = styled.div`
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
width: 100vw;
|
|
53
|
+
height: 100vh;
|
|
54
|
+
z-index: 100;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: center;
|
|
58
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
59
|
+
`;
|