@rpg-engine/long-bow 0.7.25 → 0.7.27

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.7.25",
3
+ "version": "0.7.27",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -60,7 +60,7 @@ export const ChatRevamp: React.FC<IChatRevampProps> = ({
60
60
  onClick={chatHook.toggleExpand}
61
61
  />
62
62
  </TopBar>
63
- <PrivateChatContainer
63
+ <AllChatsContainer
64
64
  width={styles?.width || '80%'}
65
65
  height={styles?.height || 'auto'}
66
66
  isExpanded={chatHook.isExpanded}
@@ -120,7 +120,7 @@ export const ChatRevamp: React.FC<IChatRevampProps> = ({
120
120
  />
121
121
  </CollapsedChatInput>
122
122
  )}
123
- </PrivateChatContainer>
123
+ </AllChatsContainer>
124
124
  </ChatRevampContainer>
125
125
  );
126
126
  };
@@ -139,7 +139,7 @@ const TopBar = styled.div<{ isExpanded: boolean }>`
139
139
  min-height: ${({ isExpanded }) => (isExpanded ? 'auto' : '32px')};
140
140
  `;
141
141
 
142
- const PrivateChatContainer = styled.div<{
142
+ const AllChatsContainer = styled.div<{
143
143
  width: string;
144
144
  height: string;
145
145
  isExpanded: boolean;
@@ -29,6 +29,7 @@ export interface ITabsContainer {
29
29
  imgSrc?: string;
30
30
  imgWidth?: string;
31
31
  };
32
+ isDraggableModal: boolean;
32
33
  }
33
34
 
34
35
  export const TabsContainer: React.FC<ITabsContainer> = ({
@@ -36,9 +37,10 @@ export const TabsContainer: React.FC<ITabsContainer> = ({
36
37
  onCloseButton,
37
38
  tabs,
38
39
  type = MultitabType.Brown,
39
- styles = {}, // default to an empty object to avoid undefined errors
40
+ styles = {},
41
+ isDraggableModal = false,
40
42
  }) => {
41
- const [selectedTab, setSelectedTab] = useState(tabs[0].id); // by default the first one
43
+ const [selectedTab, setSelectedTab] = useState(tabs[0].id);
42
44
 
43
45
  const onRenderTabs = () =>
44
46
  tabs.map((tab, index) => (
@@ -62,20 +64,8 @@ export const TabsContainer: React.FC<ITabsContainer> = ({
62
64
  }
63
65
  };
64
66
 
65
- return (
66
- <DraggableContainer
67
- onCloseButton={onCloseButton}
68
- type={onGetContainerType()}
69
- cancelDrag=".tabs-container *" // Disable drag on all elements inside .tabs-container
70
- width={styles?.width} // use optional chaining
71
- height={styles?.height}
72
- minWidth={styles?.minWidth}
73
- minHeight={styles?.minHeight}
74
- className={styles?.className}
75
- title={styles?.title}
76
- imgSrc={styles?.imgSrc}
77
- imgWidth={styles?.imgWidth}
78
- >
67
+ const TabsCore = () => (
68
+ <>
79
69
  {onRenderTabs()}
80
70
  <BodyContainer
81
71
  selectedTab={selectedTab}
@@ -83,7 +73,38 @@ export const TabsContainer: React.FC<ITabsContainer> = ({
83
73
  >
84
74
  {children}
85
75
  </BodyContainer>
86
- </DraggableContainer>
76
+ </>
77
+ );
78
+
79
+ if (isDraggableModal) {
80
+ return (
81
+ <DraggableContainer
82
+ onCloseButton={onCloseButton}
83
+ type={onGetContainerType()}
84
+ cancelDrag=".tabs-container *"
85
+ width={styles?.width}
86
+ height={styles?.height}
87
+ minWidth={styles?.minWidth}
88
+ minHeight={styles?.minHeight}
89
+ className={styles?.className}
90
+ title={styles?.title}
91
+ imgSrc={styles?.imgSrc}
92
+ imgWidth={styles?.imgWidth}
93
+ >
94
+ {TabsCore()}
95
+ </DraggableContainer>
96
+ );
97
+ }
98
+
99
+ return (
100
+ <NonDraggableWrapper
101
+ width={styles?.width}
102
+ height={styles?.height}
103
+ minWidth={styles?.minWidth}
104
+ minHeight={styles?.minHeight}
105
+ >
106
+ {TabsCore()}
107
+ </NonDraggableWrapper>
87
108
  );
88
109
  };
89
110
 
@@ -92,6 +113,7 @@ interface IBodyContainer {
92
113
  }
93
114
 
94
115
  const BodyContainer = styled.div<IBodyContainer>`
116
+
95
117
  display: flex;
96
118
  width: 100%;
97
119
  height: 100%;
@@ -115,3 +137,23 @@ const BodyContainer = styled.div<IBodyContainer>`
115
137
  border-radius: 5px;
116
138
  padding: 0.5rem;
117
139
  `;
140
+
141
+ interface INonDraggableWrapperProps {
142
+ width?: string;
143
+ height?: string;
144
+ minWidth?: string;
145
+ minHeight?: string;
146
+ }
147
+
148
+ const NonDraggableWrapper = styled.div<INonDraggableWrapperProps>`
149
+ height: ${props => props.height || 'auto'};
150
+ width: ${props => props.width || '50%'};
151
+ min-width: ${props => props.minWidth || 'auto'};
152
+ min-height: ${props => props.minHeight || 'auto'};
153
+ display: flex;
154
+ flex-wrap: wrap;
155
+ image-rendering: pixelated;
156
+ overflow-y: hidden;
157
+ padding-top: 1.5rem;
158
+ position: relative;
159
+ `;
File without changes