@rpg-engine/long-bow 0.7.23 → 0.7.24
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/ChatRevamp/RecentChats.d.ts +1 -0
- package/dist/hooks/useChat.d.ts +10 -3
- package/dist/long-bow.cjs.development.js +69 -56
- 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 +69 -56
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatRevamp/ChatContent.tsx +15 -13
- package/src/components/ChatRevamp/ChatRevamp.tsx +38 -35
- package/src/components/ChatRevamp/RecentChats.tsx +55 -44
- package/src/hooks/useChat.ts +17 -17
- package/src/stories/ChatRevamp.stories.tsx +38 -10
|
@@ -11,6 +11,7 @@ interface IRecentChatsProps {
|
|
|
11
11
|
onPreviousChatCharacterClick: (character: PrivateChatCharacter) => void;
|
|
12
12
|
onRemoveRecentChatCharacter?: (character: PrivateChatCharacter) => void;
|
|
13
13
|
isPrivate: boolean;
|
|
14
|
+
hideSearchCharacterUI: () => void;
|
|
14
15
|
}
|
|
15
16
|
export declare const RecentChats: React.FC<IRecentChatsProps>;
|
|
16
17
|
export {};
|
package/dist/hooks/useChat.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PrivateChatCharacter } from '../components/ChatRevamp/types';
|
|
2
|
+
interface IUseChat {
|
|
3
|
+
minimizedByDefault: boolean;
|
|
3
4
|
isPrivate: boolean;
|
|
4
|
-
|
|
5
|
+
onChangeTab: (tabId: string) => void;
|
|
6
|
+
onPreviousChatCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
7
|
+
hideSearchCharacterUI?: () => void;
|
|
8
|
+
unseenMessageCharacterIds?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const useChat: ({ minimizedByDefault, isPrivate, onChangeTab, onPreviousChatCharacterClick, hideSearchCharacterUI, unseenMessageCharacterIds, }: IUseChat) => {
|
|
5
11
|
showRecentChats: boolean;
|
|
6
12
|
isExpanded: boolean;
|
|
7
13
|
toggleExpand: () => void;
|
|
@@ -10,3 +16,4 @@ export declare const useChat: ({ minimizedByDefault, isPrivate, onChangeTab, onP
|
|
|
10
16
|
handlePreviousChatCharacterClick: (character: PrivateChatCharacter) => void;
|
|
11
17
|
hasUnseenMessages: boolean | undefined;
|
|
12
18
|
};
|
|
19
|
+
export {};
|
|
@@ -26427,8 +26427,12 @@ var useChat = function useChat(_ref) {
|
|
|
26427
26427
|
onChangeTab(tabId);
|
|
26428
26428
|
};
|
|
26429
26429
|
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26430
|
-
|
|
26431
|
-
|
|
26430
|
+
if (onPreviousChatCharacterClick) {
|
|
26431
|
+
onPreviousChatCharacterClick(character);
|
|
26432
|
+
}
|
|
26433
|
+
if (hideSearchCharacterUI) {
|
|
26434
|
+
hideSearchCharacterUI();
|
|
26435
|
+
}
|
|
26432
26436
|
};
|
|
26433
26437
|
return {
|
|
26434
26438
|
showRecentChats: showRecentChats,
|
|
@@ -26574,6 +26578,18 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26574
26578
|
privateChatCharacters = _ref.privateChatCharacters,
|
|
26575
26579
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26576
26580
|
onCharacterClick = _ref.onCharacterClick;
|
|
26581
|
+
var handleSendMessage = function handleSendMessage(message) {
|
|
26582
|
+
if (autoCloseOnSend) {
|
|
26583
|
+
onCloseButton();
|
|
26584
|
+
}
|
|
26585
|
+
if (isPrivate) {
|
|
26586
|
+
onSendPrivateChatMessage(message);
|
|
26587
|
+
} else if (isTrade) {
|
|
26588
|
+
onSendTradeMessage(message);
|
|
26589
|
+
} else {
|
|
26590
|
+
onSendGlobalChatMessage(message);
|
|
26591
|
+
}
|
|
26592
|
+
};
|
|
26577
26593
|
if (isPrivate && searchCharacterUI) {
|
|
26578
26594
|
return React__default.createElement(SearchCharacter, {
|
|
26579
26595
|
onFocus: onFocus,
|
|
@@ -26587,18 +26603,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26587
26603
|
}
|
|
26588
26604
|
return React__default.createElement(ChatWrapper, null, React__default.createElement(Chat, {
|
|
26589
26605
|
chatMessages: chatMessages,
|
|
26590
|
-
onSendChatMessage:
|
|
26591
|
-
if (autoCloseOnSend) {
|
|
26592
|
-
onCloseButton();
|
|
26593
|
-
}
|
|
26594
|
-
if (isPrivate) {
|
|
26595
|
-
return onSendPrivateChatMessage;
|
|
26596
|
-
} else if (isTrade) {
|
|
26597
|
-
return onSendTradeMessage;
|
|
26598
|
-
} else {
|
|
26599
|
-
return onSendGlobalChatMessage;
|
|
26600
|
-
}
|
|
26601
|
-
},
|
|
26606
|
+
onSendChatMessage: handleSendMessage,
|
|
26602
26607
|
sendMessage: true,
|
|
26603
26608
|
onCloseButton: onCloseButton,
|
|
26604
26609
|
styles: styles,
|
|
@@ -26671,7 +26676,12 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26671
26676
|
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26672
26677
|
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26673
26678
|
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26674
|
-
isPrivate = _ref.isPrivate
|
|
26679
|
+
isPrivate = _ref.isPrivate,
|
|
26680
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI;
|
|
26681
|
+
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26682
|
+
onPreviousChatCharacterClick(character);
|
|
26683
|
+
hideSearchCharacterUI(); // Call hideSearchCharacterUI here
|
|
26684
|
+
};
|
|
26675
26685
|
return React__default.createElement(RecentChatTabContainer, {
|
|
26676
26686
|
isOpen: showRecentChats,
|
|
26677
26687
|
isPrivate: isPrivate
|
|
@@ -26692,7 +26702,7 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26692
26702
|
}, React__default.createElement(ListElement$1, {
|
|
26693
26703
|
active: character._id === recentSelectedChatCharacterId,
|
|
26694
26704
|
onPointerDown: function onPointerDown() {
|
|
26695
|
-
return
|
|
26705
|
+
return handlePreviousChatCharacterClick(character);
|
|
26696
26706
|
}
|
|
26697
26707
|
}, React__default.createElement(StatusDot, {
|
|
26698
26708
|
isUnseen: (_unseenMessageCharact = unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) != null ? _unseenMessageCharact : false
|
|
@@ -26770,40 +26780,40 @@ var CloseButton$2 = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
26770
26780
|
componentId: "sc-uzad2m-9"
|
|
26771
26781
|
})(["all:unset;font-size:", ";margin:0 0.5rem;transition:all 0.2s ease-in-out;background-color:", ";color:", ";width:16px;height:16px;border-radius:50%;display:flex;justify-content:center;align-items:center;&:hover{background-color:", ";color:", ";}"], uiFonts.size.xxsmall, uiColors.red, uiColors.white, uiColors.white, uiColors.red);
|
|
26772
26782
|
|
|
26773
|
-
var ChatRevamp = function ChatRevamp(
|
|
26774
|
-
var chatMessages =
|
|
26775
|
-
onSendGlobalChatMessage =
|
|
26776
|
-
onChangeCharacterName =
|
|
26777
|
-
onFocus =
|
|
26778
|
-
onBlur =
|
|
26779
|
-
onCloseButton =
|
|
26780
|
-
styles =
|
|
26781
|
-
tabs =
|
|
26782
|
-
onChangeTab =
|
|
26783
|
-
activeTab =
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
-
|
|
26783
|
+
var ChatRevamp = function ChatRevamp(_ref) {
|
|
26784
|
+
var chatMessages = _ref.chatMessages,
|
|
26785
|
+
onSendGlobalChatMessage = _ref.onSendGlobalChatMessage,
|
|
26786
|
+
onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26787
|
+
onFocus = _ref.onFocus,
|
|
26788
|
+
onBlur = _ref.onBlur,
|
|
26789
|
+
onCloseButton = _ref.onCloseButton,
|
|
26790
|
+
styles = _ref.styles,
|
|
26791
|
+
tabs = _ref.tabs,
|
|
26792
|
+
onChangeTab = _ref.onChangeTab,
|
|
26793
|
+
_ref$activeTab = _ref.activeTab,
|
|
26794
|
+
activeTab = _ref$activeTab === void 0 ? 'global' : _ref$activeTab,
|
|
26795
|
+
privateChatCharacters = _ref.privateChatCharacters,
|
|
26796
|
+
onCharacterClick = _ref.onCharacterClick,
|
|
26797
|
+
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26798
|
+
recentChatCharacters = _ref.recentChatCharacters,
|
|
26799
|
+
recentSelectedChatCharacterId = _ref.recentSelectedChatCharacterId,
|
|
26800
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26801
|
+
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26802
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26803
|
+
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26804
|
+
searchCharacterUI = _ref.searchCharacterUI,
|
|
26805
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26806
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26807
|
+
_ref$minimizedByDefau = _ref.minimizedByDefault,
|
|
26808
|
+
minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau,
|
|
26809
|
+
autoCloseOnSend = _ref.autoCloseOnSend;
|
|
26798
26810
|
var isPrivate = activeTab === 'private';
|
|
26799
26811
|
var isTrade = activeTab === 'trade';
|
|
26800
26812
|
var chatHook = useChat({
|
|
26801
|
-
activeTab: activeTab,
|
|
26802
26813
|
minimizedByDefault: minimizedByDefault,
|
|
26803
26814
|
isPrivate: isPrivate,
|
|
26804
26815
|
onChangeTab: onChangeTab,
|
|
26805
26816
|
onPreviousChatCharacterClick: onPreviousChatCharacterClick,
|
|
26806
|
-
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26807
26817
|
unseenMessageCharacterIds: unseenMessageCharacterIds
|
|
26808
26818
|
});
|
|
26809
26819
|
return React__default.createElement(ChatRevampContainer, null, React__default.createElement(TopBar, {
|
|
@@ -26819,7 +26829,7 @@ var ChatRevamp = function ChatRevamp(props) {
|
|
|
26819
26829
|
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26820
26830
|
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26821
26831
|
isExpanded: chatHook.isExpanded
|
|
26822
|
-
}, chatHook.isExpanded ? React__default.createElement(
|
|
26832
|
+
}, chatHook.isExpanded ? React__default.createElement(ExpandedChatContent, null, isPrivate && React__default.createElement(RecentChats, {
|
|
26823
26833
|
showRecentChats: chatHook.showRecentChats,
|
|
26824
26834
|
toggleRecentChats: chatHook.toggleRecentChats,
|
|
26825
26835
|
hasUnseenMessages: chatHook.hasUnseenMessages || false,
|
|
@@ -26827,11 +26837,10 @@ var ChatRevamp = function ChatRevamp(props) {
|
|
|
26827
26837
|
recentChatCharacters: recentChatCharacters,
|
|
26828
26838
|
recentSelectedChatCharacterId: recentSelectedChatCharacterId,
|
|
26829
26839
|
unseenMessageCharacterIds: unseenMessageCharacterIds,
|
|
26830
|
-
onPreviousChatCharacterClick:
|
|
26831
|
-
return chatHook.handlePreviousChatCharacterClick(character);
|
|
26832
|
-
},
|
|
26840
|
+
onPreviousChatCharacterClick: chatHook.handlePreviousChatCharacterClick,
|
|
26833
26841
|
onRemoveRecentChatCharacter: onRemoveRecentChatCharacter,
|
|
26834
|
-
isPrivate: isPrivate
|
|
26842
|
+
isPrivate: isPrivate,
|
|
26843
|
+
hideSearchCharacterUI: hideSearchCharacterUI
|
|
26835
26844
|
}), React__default.createElement(ChatContentWrapper, {
|
|
26836
26845
|
isPrivate: isPrivate
|
|
26837
26846
|
}, React__default.createElement(ChatContent, {
|
|
@@ -26870,31 +26879,35 @@ var ChatRevampContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26870
26879
|
var TopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26871
26880
|
displayName: "ChatRevamp__TopBar",
|
|
26872
26881
|
componentId: "sc-1sdiknw-1"
|
|
26873
|
-
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (
|
|
26874
|
-
var isExpanded =
|
|
26882
|
+
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (_ref2) {
|
|
26883
|
+
var isExpanded = _ref2.isExpanded;
|
|
26875
26884
|
return isExpanded ? 'auto' : '32px';
|
|
26876
26885
|
});
|
|
26877
26886
|
var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26878
26887
|
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26879
26888
|
componentId: "sc-1sdiknw-2"
|
|
26880
|
-
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (
|
|
26881
|
-
var width =
|
|
26889
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (_ref3) {
|
|
26890
|
+
var width = _ref3.width;
|
|
26882
26891
|
return width;
|
|
26883
|
-
}, function (
|
|
26884
|
-
var height =
|
|
26885
|
-
isExpanded =
|
|
26892
|
+
}, function (_ref4) {
|
|
26893
|
+
var height = _ref4.height,
|
|
26894
|
+
isExpanded = _ref4.isExpanded;
|
|
26886
26895
|
return isExpanded ? height : 'auto';
|
|
26887
26896
|
});
|
|
26888
26897
|
var ChatContentWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26889
26898
|
displayName: "ChatRevamp__ChatContentWrapper",
|
|
26890
26899
|
componentId: "sc-1sdiknw-3"
|
|
26891
26900
|
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;width:", ";"], function (props) {
|
|
26892
|
-
return props.isPrivate ? '
|
|
26901
|
+
return props.isPrivate ? '75%' : '100%';
|
|
26893
26902
|
});
|
|
26894
26903
|
var CollapsedChatInput = /*#__PURE__*/styled__default.div.withConfig({
|
|
26895
26904
|
displayName: "ChatRevamp__CollapsedChatInput",
|
|
26896
26905
|
componentId: "sc-1sdiknw-4"
|
|
26897
26906
|
})(["width:100%;height:100%;display:flex;align-items:center;"]);
|
|
26907
|
+
var ExpandedChatContent = /*#__PURE__*/styled__default.div.withConfig({
|
|
26908
|
+
displayName: "ChatRevamp__ExpandedChatContent",
|
|
26909
|
+
componentId: "sc-1sdiknw-5"
|
|
26910
|
+
})(["display:flex;width:100%;height:100%;"]);
|
|
26898
26911
|
|
|
26899
26912
|
var CheckButton = function CheckButton(_ref) {
|
|
26900
26913
|
var items = _ref.items,
|