@rpg-engine/long-bow 0.5.76 → 0.5.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.5.76",
3
+ "version": "0.5.78",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@rollup/plugin-image": "^2.1.1",
86
- "@rpg-engine/shared": "^0.9.19",
86
+ "@rpg-engine/shared": "^0.9.28",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
@@ -14,6 +14,8 @@ interface IProps {
14
14
  initialPosition?: IPosition;
15
15
  scale?: number;
16
16
  width?: string;
17
+ isFullScreen?: boolean;
18
+ opacity?: number;
17
19
  }
18
20
 
19
21
  export const SlotsContainer: React.FC<IProps> = ({
@@ -27,9 +29,13 @@ export const SlotsContainer: React.FC<IProps> = ({
27
29
  initialPosition,
28
30
  scale,
29
31
  width,
32
+ isFullScreen,
33
+ opacity,
30
34
  }) => {
31
35
  return (
32
36
  <DraggableContainer
37
+ isFullScreen={isFullScreen}
38
+ opacity={opacity}
33
39
  title={title}
34
40
  type={RPGUIContainerTypes.Framed}
35
41
  onCloseButton={() => {
@@ -15,6 +15,7 @@ export interface IAsyncDropdownProps {
15
15
  width?: string;
16
16
  onChange: (value: string) => void;
17
17
  defaultValue?: string;
18
+ opensUp?: boolean;
18
19
  }
19
20
 
20
21
  export const AsyncDropdown: React.FC<IAsyncDropdownProps> = ({
@@ -22,6 +23,7 @@ export const AsyncDropdown: React.FC<IAsyncDropdownProps> = ({
22
23
  width,
23
24
  onChange,
24
25
  defaultValue,
26
+ opensUp = false,
25
27
  }) => {
26
28
  const dropdownId = uuidv4();
27
29
 
@@ -68,7 +70,11 @@ export const AsyncDropdown: React.FC<IAsyncDropdownProps> = ({
68
70
  </DropdownDisplay>
69
71
  </DropdownSelect>
70
72
 
71
- <DropdownOptions className="rpgui-dropdown-imp" opened={opened}>
73
+ <DropdownOptions
74
+ className="rpgui-dropdown-imp"
75
+ opened={opened}
76
+ opensUp={opensUp}
77
+ >
72
78
  {options?.map(option => (
73
79
  <li
74
80
  key={option.id}
@@ -113,6 +119,7 @@ const DropdownSelect = styled.p`
113
119
 
114
120
  const DropdownOptions = styled.ul<{
115
121
  opened: boolean;
122
+ opensUp: boolean;
116
123
  }>`
117
124
  position: absolute;
118
125
  width: 100%;
@@ -120,6 +127,10 @@ const DropdownOptions = styled.ul<{
120
127
  overflow-y: auto;
121
128
  display: ${props => (props.opened ? 'block' : 'none')};
122
129
  box-sizing: border-box;
130
+ bottom: ${props => (props.opensUp ? '100%' : 'auto')};
131
+ top: ${props => (props.opensUp ? 'auto' : '100%')};
132
+ margin: 0;
133
+ padding: 0;
123
134
 
124
135
  @media (max-width: 768px) {
125
136
  padding: 8px 0;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import Draggable from 'react-draggable';
3
- import styled from 'styled-components';
3
+ import styled, { css } from 'styled-components';
4
4
  import { uiFonts } from '../constants/uiFonts';
5
5
  import { useOutsideClick } from '../hooks/useOutsideAlerter';
6
6
  import { IPosition } from '../types/eventTypes';
@@ -24,6 +24,8 @@ export interface IDraggableContainerProps {
24
24
  initialPosition?: IPosition;
25
25
  scale?: number;
26
26
  dragDisabled?: boolean;
27
+ isFullScreen?: boolean;
28
+ opacity?: number;
27
29
  }
28
30
 
29
31
  export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
@@ -44,9 +46,16 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
44
46
  initialPosition = { x: 0, y: 0 },
45
47
  scale,
46
48
  dragDisabled = false,
49
+ isFullScreen,
50
+ opacity,
47
51
  }) => {
48
52
  const draggableRef = useRef(null);
49
53
 
54
+ if (isFullScreen) {
55
+ width = '100%';
56
+ height = '100%';
57
+ }
58
+
50
59
  useOutsideClick(draggableRef, 'item-container');
51
60
 
52
61
  useEffect(() => {
@@ -101,6 +110,8 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
101
110
  width={width}
102
111
  height={height || 'auto'}
103
112
  className={`rpgui-container ${type} ${className}`}
113
+ isFullScreen={isFullScreen}
114
+ opacity={opacity}
104
115
  >
105
116
  {title && (
106
117
  <TitleContainer className="drag-handler">
@@ -128,6 +139,8 @@ export const DraggableContainer: React.FC<IDraggableContainerProps> = ({
128
139
  interface IContainerProps {
129
140
  width: string;
130
141
  height: string;
142
+ isFullScreen?: boolean;
143
+ opacity?: number;
131
144
  }
132
145
 
133
146
  const Container = styled.div<IContainerProps>`
@@ -137,6 +150,20 @@ const Container = styled.div<IContainerProps>`
137
150
  flex-wrap: wrap;
138
151
  image-rendering: pixelated;
139
152
 
153
+ ${({ opacity }) =>
154
+ opacity &&
155
+ css`
156
+ opacity: ${opacity};
157
+ `}
158
+
159
+ ${({ isFullScreen }) =>
160
+ isFullScreen &&
161
+ css`
162
+ justify-content: center;
163
+ align-items: flex-start;
164
+ align-content: flex-start;
165
+ `}
166
+
140
167
  &.rpgui-container {
141
168
  padding-top: 1.5rem;
142
169
  }
@@ -162,6 +189,7 @@ const TitleContainer = styled.div`
162
189
  flex-wrap: wrap;
163
190
  justify-content: flex-start;
164
191
  align-items: center;
192
+ max-height: 42px;
165
193
  `;
166
194
 
167
195
  const Title = styled.h1`
@@ -102,7 +102,7 @@ const DropdownSelect = styled.p`
102
102
 
103
103
  const DropdownOptions = styled.ul<{
104
104
  opened: boolean;
105
- opensUp: boolean; // Add a new prop to the styled component
105
+ opensUp: boolean;
106
106
  }>`
107
107
  position: absolute;
108
108
  width: 100%;
@@ -110,10 +110,8 @@ const DropdownOptions = styled.ul<{
110
110
  overflow-y: auto;
111
111
  display: ${props => (props.opened ? 'block' : 'none')};
112
112
  box-sizing: border-box;
113
- bottom: ${props =>
114
- props.opensUp ? '100%' : 'auto'}; // Adjust the position based on the prop
115
- top: ${props =>
116
- props.opensUp ? 'auto' : '100%'}; // Adjust the position based on the prop
113
+ bottom: ${props => (props.opensUp ? '100%' : 'auto')};
114
+ top: ${props => (props.opensUp ? 'auto' : '100%')};
117
115
  margin: 0;
118
116
  padding: 0;
119
117
  @media (max-width: 768px) {
@@ -55,6 +55,8 @@ export interface IItemContainerProps {
55
55
  isDepotSystem?: boolean;
56
56
  onPositionChangeEnd?: (position: IPosition) => void;
57
57
  onPositionChangeStart?: (position: IPosition) => void;
58
+ isFullScreen?: boolean;
59
+ opacity?: number;
58
60
  }
59
61
 
60
62
  type onDragStart =
@@ -93,6 +95,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
93
95
  isDepotSystem,
94
96
  onPositionChangeEnd,
95
97
  onPositionChangeStart,
98
+ isFullScreen,
99
+ opacity,
96
100
  }) => {
97
101
  const [quantitySelect, setQuantitySelect] = useState({
98
102
  isOpen: false,
@@ -230,6 +234,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
230
234
  scale={scale}
231
235
  onPositionChangeEnd={onPositionChangeEnd}
232
236
  onPositionChangeStart={onPositionChangeStart}
237
+ isFullScreen={isFullScreen}
238
+ opacity={opacity}
233
239
  >
234
240
  {type === ItemContainerType.Inventory &&
235
241
  shortcuts &&
@@ -247,6 +253,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
247
253
  className="item-container-body"
248
254
  ref={containerRef}
249
255
  isScrollable={itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL}
256
+ isFullScreen={isFullScreen}
250
257
  >
251
258
  {onRenderSlots()}
252
259
  </ItemsContainer>
@@ -263,14 +270,22 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
263
270
 
264
271
  interface IItemsContainerProps {
265
272
  isScrollable: boolean;
273
+ isFullScreen?: boolean;
266
274
  }
267
275
 
268
276
  const ItemsContainer = styled.div<IItemsContainerProps>`
269
277
  display: flex;
270
- justify-content: center;
278
+ justify-content: ${({ isFullScreen }) =>
279
+ isFullScreen ? 'flex-start' : 'center'};
271
280
  flex-wrap: wrap;
272
- max-height: 270px;
281
+ max-height: ${({ isFullScreen }) =>
282
+ isFullScreen
283
+ ? '100vh'
284
+ : '270px'}; // Adjust the max-height based on the prop
273
285
  overflow-y: ${({ isScrollable }) => (isScrollable ? 'scroll' : 'hidden')};
274
286
  overflow-x: hidden;
275
- width: 415px;
287
+ width: ${({ isFullScreen }) =>
288
+ isFullScreen ? '100vw' : '415px'}; // Adjust the width based on the prop
289
+
290
+ margin-top: ${({ isFullScreen }) => (isFullScreen ? '1rem' : '0')};
276
291
  `;
@@ -7,6 +7,7 @@ import {
7
7
  } from '@rpg-engine/shared';
8
8
  import React from 'react';
9
9
  import styled from 'styled-components';
10
+ import { UI_BREAKPOINT_MOBILE } from '../../constants/uiBreakpoints';
10
11
  import { uiColors } from '../../constants/uiColors';
11
12
  import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
12
13
 
@@ -115,6 +116,11 @@ const Container = styled.div`
115
116
  }
116
117
 
117
118
  width: 100%;
119
+
120
+ /*MOBILE ONLY CODE*/
121
+ @media screen and (max-width: ${UI_BREAKPOINT_MOBILE}) {
122
+ max-height: 80px;
123
+ }
118
124
  `;
119
125
 
120
126
  const Shortcut = styled.button<{ isBeingSet?: boolean }>`