@rpg-engine/long-bow 0.7.23 → 0.7.25
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 +70 -57
- 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 +70 -57
- 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/ExpandButton.tsx +1 -1
- package/src/components/ChatRevamp/PrivateChat.tsx +0 -0
- package/src/components/ChatRevamp/RecentChats.tsx +55 -44
- package/src/hooks/useChat.ts +17 -17
- package/src/stories/ChatRevamp.stories.tsx +38 -10
package/dist/long-bow.esm.js
CHANGED
|
@@ -26421,8 +26421,12 @@ var useChat = function useChat(_ref) {
|
|
|
26421
26421
|
onChangeTab(tabId);
|
|
26422
26422
|
};
|
|
26423
26423
|
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26424
|
-
|
|
26425
|
-
|
|
26424
|
+
if (onPreviousChatCharacterClick) {
|
|
26425
|
+
onPreviousChatCharacterClick(character);
|
|
26426
|
+
}
|
|
26427
|
+
if (hideSearchCharacterUI) {
|
|
26428
|
+
hideSearchCharacterUI();
|
|
26429
|
+
}
|
|
26426
26430
|
};
|
|
26427
26431
|
return {
|
|
26428
26432
|
showRecentChats: showRecentChats,
|
|
@@ -26568,6 +26572,18 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26568
26572
|
privateChatCharacters = _ref.privateChatCharacters,
|
|
26569
26573
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26570
26574
|
onCharacterClick = _ref.onCharacterClick;
|
|
26575
|
+
var handleSendMessage = function handleSendMessage(message) {
|
|
26576
|
+
if (autoCloseOnSend) {
|
|
26577
|
+
onCloseButton();
|
|
26578
|
+
}
|
|
26579
|
+
if (isPrivate) {
|
|
26580
|
+
onSendPrivateChatMessage(message);
|
|
26581
|
+
} else if (isTrade) {
|
|
26582
|
+
onSendTradeMessage(message);
|
|
26583
|
+
} else {
|
|
26584
|
+
onSendGlobalChatMessage(message);
|
|
26585
|
+
}
|
|
26586
|
+
};
|
|
26571
26587
|
if (isPrivate && searchCharacterUI) {
|
|
26572
26588
|
return React.createElement(SearchCharacter, {
|
|
26573
26589
|
onFocus: onFocus,
|
|
@@ -26581,18 +26597,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26581
26597
|
}
|
|
26582
26598
|
return React.createElement(ChatWrapper, null, React.createElement(Chat, {
|
|
26583
26599
|
chatMessages: chatMessages,
|
|
26584
|
-
onSendChatMessage:
|
|
26585
|
-
if (autoCloseOnSend) {
|
|
26586
|
-
onCloseButton();
|
|
26587
|
-
}
|
|
26588
|
-
if (isPrivate) {
|
|
26589
|
-
return onSendPrivateChatMessage;
|
|
26590
|
-
} else if (isTrade) {
|
|
26591
|
-
return onSendTradeMessage;
|
|
26592
|
-
} else {
|
|
26593
|
-
return onSendGlobalChatMessage;
|
|
26594
|
-
}
|
|
26595
|
-
},
|
|
26600
|
+
onSendChatMessage: handleSendMessage,
|
|
26596
26601
|
sendMessage: true,
|
|
26597
26602
|
onCloseButton: onCloseButton,
|
|
26598
26603
|
styles: styles,
|
|
@@ -26652,7 +26657,7 @@ var StyledExpandButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
26652
26657
|
componentId: "sc-vdxez5-0"
|
|
26653
26658
|
})(["position:absolute;top:0;", ";width:30px;height:30px;background-color:", ";color:white;border:none;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all 0.3s ease;z-index:10;&:hover{background-color:", ";}"], function (_ref2) {
|
|
26654
26659
|
var isExpanded = _ref2.isExpanded;
|
|
26655
|
-
return isExpanded ? 'right: 0' : 'left: 0';
|
|
26660
|
+
return isExpanded ? 'right: 0' : 'left: 0.5rem';
|
|
26656
26661
|
}, uiColors.orange, uiColors.orange);
|
|
26657
26662
|
|
|
26658
26663
|
var RecentChats = function RecentChats(_ref) {
|
|
@@ -26665,7 +26670,12 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26665
26670
|
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26666
26671
|
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26667
26672
|
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26668
|
-
isPrivate = _ref.isPrivate
|
|
26673
|
+
isPrivate = _ref.isPrivate,
|
|
26674
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI;
|
|
26675
|
+
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26676
|
+
onPreviousChatCharacterClick(character);
|
|
26677
|
+
hideSearchCharacterUI(); // Call hideSearchCharacterUI here
|
|
26678
|
+
};
|
|
26669
26679
|
return React.createElement(RecentChatTabContainer, {
|
|
26670
26680
|
isOpen: showRecentChats,
|
|
26671
26681
|
isPrivate: isPrivate
|
|
@@ -26686,7 +26696,7 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26686
26696
|
}, React.createElement(ListElement$1, {
|
|
26687
26697
|
active: character._id === recentSelectedChatCharacterId,
|
|
26688
26698
|
onPointerDown: function onPointerDown() {
|
|
26689
|
-
return
|
|
26699
|
+
return handlePreviousChatCharacterClick(character);
|
|
26690
26700
|
}
|
|
26691
26701
|
}, React.createElement(StatusDot, {
|
|
26692
26702
|
isUnseen: (_unseenMessageCharact = unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) != null ? _unseenMessageCharact : false
|
|
@@ -26764,40 +26774,40 @@ var CloseButton$2 = /*#__PURE__*/styled.button.withConfig({
|
|
|
26764
26774
|
componentId: "sc-uzad2m-9"
|
|
26765
26775
|
})(["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);
|
|
26766
26776
|
|
|
26767
|
-
var ChatRevamp = function ChatRevamp(
|
|
26768
|
-
var chatMessages =
|
|
26769
|
-
onSendGlobalChatMessage =
|
|
26770
|
-
onChangeCharacterName =
|
|
26771
|
-
onFocus =
|
|
26772
|
-
onBlur =
|
|
26773
|
-
onCloseButton =
|
|
26774
|
-
styles =
|
|
26775
|
-
tabs =
|
|
26776
|
-
onChangeTab =
|
|
26777
|
-
activeTab =
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
|
|
26783
|
-
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
|
|
26777
|
+
var ChatRevamp = function ChatRevamp(_ref) {
|
|
26778
|
+
var chatMessages = _ref.chatMessages,
|
|
26779
|
+
onSendGlobalChatMessage = _ref.onSendGlobalChatMessage,
|
|
26780
|
+
onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26781
|
+
onFocus = _ref.onFocus,
|
|
26782
|
+
onBlur = _ref.onBlur,
|
|
26783
|
+
onCloseButton = _ref.onCloseButton,
|
|
26784
|
+
styles = _ref.styles,
|
|
26785
|
+
tabs = _ref.tabs,
|
|
26786
|
+
onChangeTab = _ref.onChangeTab,
|
|
26787
|
+
_ref$activeTab = _ref.activeTab,
|
|
26788
|
+
activeTab = _ref$activeTab === void 0 ? 'global' : _ref$activeTab,
|
|
26789
|
+
privateChatCharacters = _ref.privateChatCharacters,
|
|
26790
|
+
onCharacterClick = _ref.onCharacterClick,
|
|
26791
|
+
onSendPrivateChatMessage = _ref.onSendPrivateChatMessage,
|
|
26792
|
+
recentChatCharacters = _ref.recentChatCharacters,
|
|
26793
|
+
recentSelectedChatCharacterId = _ref.recentSelectedChatCharacterId,
|
|
26794
|
+
onPreviousChatCharacterClick = _ref.onPreviousChatCharacterClick,
|
|
26795
|
+
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26796
|
+
unseenMessageCharacterIds = _ref.unseenMessageCharacterIds,
|
|
26797
|
+
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26798
|
+
searchCharacterUI = _ref.searchCharacterUI,
|
|
26799
|
+
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26800
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26801
|
+
_ref$minimizedByDefau = _ref.minimizedByDefault,
|
|
26802
|
+
minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau,
|
|
26803
|
+
autoCloseOnSend = _ref.autoCloseOnSend;
|
|
26792
26804
|
var isPrivate = activeTab === 'private';
|
|
26793
26805
|
var isTrade = activeTab === 'trade';
|
|
26794
26806
|
var chatHook = useChat({
|
|
26795
|
-
activeTab: activeTab,
|
|
26796
26807
|
minimizedByDefault: minimizedByDefault,
|
|
26797
26808
|
isPrivate: isPrivate,
|
|
26798
26809
|
onChangeTab: onChangeTab,
|
|
26799
26810
|
onPreviousChatCharacterClick: onPreviousChatCharacterClick,
|
|
26800
|
-
hideSearchCharacterUI: hideSearchCharacterUI,
|
|
26801
26811
|
unseenMessageCharacterIds: unseenMessageCharacterIds
|
|
26802
26812
|
});
|
|
26803
26813
|
return React.createElement(ChatRevampContainer, null, React.createElement(TopBar, {
|
|
@@ -26813,7 +26823,7 @@ var ChatRevamp = function ChatRevamp(props) {
|
|
|
26813
26823
|
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26814
26824
|
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26815
26825
|
isExpanded: chatHook.isExpanded
|
|
26816
|
-
}, chatHook.isExpanded ? React.createElement(
|
|
26826
|
+
}, chatHook.isExpanded ? React.createElement(ExpandedChatContent, null, isPrivate && React.createElement(RecentChats, {
|
|
26817
26827
|
showRecentChats: chatHook.showRecentChats,
|
|
26818
26828
|
toggleRecentChats: chatHook.toggleRecentChats,
|
|
26819
26829
|
hasUnseenMessages: chatHook.hasUnseenMessages || false,
|
|
@@ -26821,11 +26831,10 @@ var ChatRevamp = function ChatRevamp(props) {
|
|
|
26821
26831
|
recentChatCharacters: recentChatCharacters,
|
|
26822
26832
|
recentSelectedChatCharacterId: recentSelectedChatCharacterId,
|
|
26823
26833
|
unseenMessageCharacterIds: unseenMessageCharacterIds,
|
|
26824
|
-
onPreviousChatCharacterClick:
|
|
26825
|
-
return chatHook.handlePreviousChatCharacterClick(character);
|
|
26826
|
-
},
|
|
26834
|
+
onPreviousChatCharacterClick: chatHook.handlePreviousChatCharacterClick,
|
|
26827
26835
|
onRemoveRecentChatCharacter: onRemoveRecentChatCharacter,
|
|
26828
|
-
isPrivate: isPrivate
|
|
26836
|
+
isPrivate: isPrivate,
|
|
26837
|
+
hideSearchCharacterUI: hideSearchCharacterUI
|
|
26829
26838
|
}), React.createElement(ChatContentWrapper, {
|
|
26830
26839
|
isPrivate: isPrivate
|
|
26831
26840
|
}, React.createElement(ChatContent, {
|
|
@@ -26864,31 +26873,35 @@ var ChatRevampContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
26864
26873
|
var TopBar = /*#__PURE__*/styled.div.withConfig({
|
|
26865
26874
|
displayName: "ChatRevamp__TopBar",
|
|
26866
26875
|
componentId: "sc-1sdiknw-1"
|
|
26867
|
-
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (
|
|
26868
|
-
var isExpanded =
|
|
26876
|
+
})(["display:flex;align-items:center;justify-content:flex-start;min-height:", ";"], function (_ref2) {
|
|
26877
|
+
var isExpanded = _ref2.isExpanded;
|
|
26869
26878
|
return isExpanded ? 'auto' : '32px';
|
|
26870
26879
|
});
|
|
26871
26880
|
var PrivateChatContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26872
26881
|
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26873
26882
|
componentId: "sc-1sdiknw-2"
|
|
26874
|
-
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (
|
|
26875
|
-
var width =
|
|
26883
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-wrap:wrap;"], function (_ref3) {
|
|
26884
|
+
var width = _ref3.width;
|
|
26876
26885
|
return width;
|
|
26877
|
-
}, function (
|
|
26878
|
-
var height =
|
|
26879
|
-
isExpanded =
|
|
26886
|
+
}, function (_ref4) {
|
|
26887
|
+
var height = _ref4.height,
|
|
26888
|
+
isExpanded = _ref4.isExpanded;
|
|
26880
26889
|
return isExpanded ? height : 'auto';
|
|
26881
26890
|
});
|
|
26882
26891
|
var ChatContentWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
26883
26892
|
displayName: "ChatRevamp__ChatContentWrapper",
|
|
26884
26893
|
componentId: "sc-1sdiknw-3"
|
|
26885
26894
|
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;width:", ";"], function (props) {
|
|
26886
|
-
return props.isPrivate ? '
|
|
26895
|
+
return props.isPrivate ? '75%' : '100%';
|
|
26887
26896
|
});
|
|
26888
26897
|
var CollapsedChatInput = /*#__PURE__*/styled.div.withConfig({
|
|
26889
26898
|
displayName: "ChatRevamp__CollapsedChatInput",
|
|
26890
26899
|
componentId: "sc-1sdiknw-4"
|
|
26891
26900
|
})(["width:100%;height:100%;display:flex;align-items:center;"]);
|
|
26901
|
+
var ExpandedChatContent = /*#__PURE__*/styled.div.withConfig({
|
|
26902
|
+
displayName: "ChatRevamp__ExpandedChatContent",
|
|
26903
|
+
componentId: "sc-1sdiknw-5"
|
|
26904
|
+
})(["display:flex;width:100%;height:100%;"]);
|
|
26892
26905
|
|
|
26893
26906
|
var CheckButton = function CheckButton(_ref) {
|
|
26894
26907
|
var items = _ref.items,
|