@rpg-engine/long-bow 0.7.19 → 0.7.21
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/Chat/Chat.d.ts +1 -0
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +95 -40
- 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 +95 -40
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +44 -38
- package/src/components/ChatRevamp/ChatRevamp.tsx +96 -14
|
@@ -14,6 +14,7 @@ var shared = require('@rpg-engine/shared');
|
|
|
14
14
|
var dayjs = _interopDefault(require('dayjs'));
|
|
15
15
|
var reactErrorBoundary = require('react-error-boundary');
|
|
16
16
|
var fa = require('react-icons/fa');
|
|
17
|
+
var io = require('react-icons/io');
|
|
17
18
|
var rx = require('react-icons/rx');
|
|
18
19
|
var Draggable = _interopDefault(require('react-draggable'));
|
|
19
20
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
@@ -26117,17 +26118,19 @@ var Chat = function Chat(_ref) {
|
|
|
26117
26118
|
buttonBackgroundColor: '#333',
|
|
26118
26119
|
width: '100%',
|
|
26119
26120
|
height: '100%'
|
|
26120
|
-
} : _ref$styles
|
|
26121
|
+
} : _ref$styles,
|
|
26122
|
+
isExpanded = _ref.isExpanded;
|
|
26121
26123
|
var _useState = React.useState(''),
|
|
26122
26124
|
message = _useState[0],
|
|
26123
26125
|
setMessage = _useState[1];
|
|
26124
26126
|
var inputRef = React.useRef(null);
|
|
26125
26127
|
React.useEffect(function () {
|
|
26126
26128
|
var _inputRef$current;
|
|
26127
|
-
|
|
26128
|
-
|
|
26129
|
+
if (isExpanded) {
|
|
26130
|
+
scrollChatToBottom();
|
|
26131
|
+
}
|
|
26129
26132
|
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
26130
|
-
}, [chatMessages]);
|
|
26133
|
+
}, [chatMessages, isExpanded]);
|
|
26131
26134
|
var scrollChatToBottom = function scrollChatToBottom() {
|
|
26132
26135
|
var scrollingElement = document.querySelector('.chat-body');
|
|
26133
26136
|
if (scrollingElement) {
|
|
@@ -26153,20 +26156,22 @@ var Chat = function Chat(_ref) {
|
|
|
26153
26156
|
};
|
|
26154
26157
|
return React__default.createElement(ChatContainer, {
|
|
26155
26158
|
width: styles.width || 'auto',
|
|
26156
|
-
height: styles.height || 'auto'
|
|
26159
|
+
height: styles.height || 'auto',
|
|
26160
|
+
isExpanded: isExpanded
|
|
26161
|
+
}, isExpanded && React__default.createElement(reactErrorBoundary.ErrorBoundary, {
|
|
26162
|
+
fallback: React__default.createElement("p", null, "Oops! Your chat has crashed.")
|
|
26157
26163
|
}, React__default.createElement(CloseButton, {
|
|
26158
26164
|
onClick: onCloseButton
|
|
26159
|
-
}, React__default.createElement(fa.FaTimes, null)), React__default.createElement(
|
|
26160
|
-
fallback: React__default.createElement("p", null, "Oops! Your chat has crashed.")
|
|
26161
|
-
}, React__default.createElement(MessagesContainer, {
|
|
26165
|
+
}, React__default.createElement(fa.FaTimes, null)), React__default.createElement(MessagesContainer, {
|
|
26162
26166
|
className: "chat-body"
|
|
26163
26167
|
}, chatMessages.map(function (chatMessage, index) {
|
|
26164
26168
|
return React__default.createElement(Message, {
|
|
26165
26169
|
color: styles.textColor || uiColors.yellow,
|
|
26166
26170
|
key: chatMessage._id + "_" + index
|
|
26167
26171
|
}, formatMessage(chatMessage));
|
|
26168
|
-
})), React__default.createElement(Form, {
|
|
26169
|
-
onSubmit: handleSubmit
|
|
26172
|
+
}))), React__default.createElement(Form, {
|
|
26173
|
+
onSubmit: handleSubmit,
|
|
26174
|
+
isExpanded: isExpanded
|
|
26170
26175
|
}, React__default.createElement(TextField, {
|
|
26171
26176
|
ref: inputRef,
|
|
26172
26177
|
value: message,
|
|
@@ -26182,7 +26187,7 @@ var Chat = function Chat(_ref) {
|
|
|
26182
26187
|
}), React__default.createElement(SendButton, {
|
|
26183
26188
|
type: "submit",
|
|
26184
26189
|
disabled: !message.trim()
|
|
26185
|
-
}, "\u25B6")))
|
|
26190
|
+
}, "\u25B6")));
|
|
26186
26191
|
};
|
|
26187
26192
|
var ChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26188
26193
|
displayName: "Chat__ChatContainer",
|
|
@@ -26190,7 +26195,7 @@ var ChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26190
26195
|
})(["width:", ";height:", ";background-color:rgba(30,30,30,0.3);display:flex;flex-direction:column;position:relative;border-radius:8px;border:1px solid rgba(0,0,0,0.1);overflow:hidden;"], function (props) {
|
|
26191
26196
|
return props.width;
|
|
26192
26197
|
}, function (props) {
|
|
26193
|
-
return props.height;
|
|
26198
|
+
return props.isExpanded ? props.height : 'auto';
|
|
26194
26199
|
});
|
|
26195
26200
|
var CloseButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
26196
26201
|
displayName: "Chat__CloseButton",
|
|
@@ -26210,7 +26215,9 @@ var Message = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26210
26215
|
var Form = /*#__PURE__*/styled__default.form.withConfig({
|
|
26211
26216
|
displayName: "Chat__Form",
|
|
26212
26217
|
componentId: "sc-1bk05n6-4"
|
|
26213
|
-
})(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);"])
|
|
26218
|
+
})(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);border-radius:", ";"], function (props) {
|
|
26219
|
+
return props.isExpanded ? '0' : '8px';
|
|
26220
|
+
});
|
|
26214
26221
|
var TextField = /*#__PURE__*/styled__default.input.withConfig({
|
|
26215
26222
|
displayName: "Chat__TextField",
|
|
26216
26223
|
componentId: "sc-1bk05n6-5"
|
|
@@ -26524,17 +26531,38 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26524
26531
|
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26525
26532
|
searchCharacterUI = _ref.searchCharacterUI,
|
|
26526
26533
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26527
|
-
showSearchCharacterUI = _ref.showSearchCharacterUI
|
|
26534
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26535
|
+
_ref$minimizedByDefau = _ref.minimizedByDefault,
|
|
26536
|
+
minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau;
|
|
26528
26537
|
var _useState = React.useState(false),
|
|
26529
26538
|
showRecentChats = _useState[0],
|
|
26530
26539
|
setShowRecentChats = _useState[1];
|
|
26540
|
+
var _useState2 = React.useState(!minimizedByDefault),
|
|
26541
|
+
isExpanded = _useState2[0],
|
|
26542
|
+
setIsExpanded = _useState2[1];
|
|
26531
26543
|
var isPrivate = activeTab === 'private';
|
|
26532
26544
|
var isTrade = activeTab === 'trade';
|
|
26545
|
+
React.useEffect(function () {
|
|
26546
|
+
if (isPrivate) {
|
|
26547
|
+
setIsExpanded(true);
|
|
26548
|
+
}
|
|
26549
|
+
}, [isPrivate]);
|
|
26550
|
+
var toggleExpand = function toggleExpand() {
|
|
26551
|
+
return setIsExpanded(function (prev) {
|
|
26552
|
+
return !prev;
|
|
26553
|
+
});
|
|
26554
|
+
};
|
|
26533
26555
|
var toggleRecentChats = function toggleRecentChats() {
|
|
26534
26556
|
return setShowRecentChats(function (prev) {
|
|
26535
26557
|
return !prev;
|
|
26536
26558
|
});
|
|
26537
26559
|
};
|
|
26560
|
+
var handleTabChange = function handleTabChange(tabId) {
|
|
26561
|
+
if (tabId === 'private') {
|
|
26562
|
+
setIsExpanded(true);
|
|
26563
|
+
}
|
|
26564
|
+
onChangeTab(tabId);
|
|
26565
|
+
};
|
|
26538
26566
|
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26539
26567
|
onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
|
|
26540
26568
|
hideSearchCharacterUI();
|
|
@@ -26545,7 +26573,7 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26545
26573
|
key: tab.label + "_" + index,
|
|
26546
26574
|
active: tab.id === activeTab,
|
|
26547
26575
|
onPointerDown: function onPointerDown() {
|
|
26548
|
-
return
|
|
26576
|
+
return handleTabChange(tab.id);
|
|
26549
26577
|
}
|
|
26550
26578
|
}, tab.label);
|
|
26551
26579
|
}));
|
|
@@ -26606,24 +26634,46 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26606
26634
|
onCloseButton: onCloseButton,
|
|
26607
26635
|
styles: styles,
|
|
26608
26636
|
onFocus: onFocus,
|
|
26609
|
-
onBlur: onBlur
|
|
26637
|
+
onBlur: onBlur,
|
|
26638
|
+
isExpanded: isExpanded
|
|
26610
26639
|
});
|
|
26611
26640
|
};
|
|
26612
|
-
return React__default.createElement(
|
|
26641
|
+
return React__default.createElement(ChatRevampContainer, null, React__default.createElement(TopBar, {
|
|
26642
|
+
isExpanded: isExpanded
|
|
26643
|
+
}, isExpanded && renderTabs(), React__default.createElement(ExpandButton, {
|
|
26644
|
+
onClick: toggleExpand,
|
|
26645
|
+
isExpanded: isExpanded
|
|
26646
|
+
}, isExpanded ? React__default.createElement(io.IoMdContract, {
|
|
26647
|
+
size: 20
|
|
26648
|
+
}) : React__default.createElement(io.IoMdExpand, {
|
|
26649
|
+
size: 20
|
|
26650
|
+
}))), React__default.createElement(PrivateChatContainer, {
|
|
26613
26651
|
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26614
|
-
height: (styles == null ? void 0 : styles.height) || 'auto'
|
|
26615
|
-
|
|
26652
|
+
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26653
|
+
isExpanded: isExpanded
|
|
26654
|
+
}, isExpanded && React__default.createElement(RecentChatTabContainer, {
|
|
26616
26655
|
isPrivate: isPrivate,
|
|
26617
26656
|
isOpen: showRecentChats
|
|
26618
26657
|
}, renderRecentChatTopBar(), renderRecentChatList()), React__default.createElement(ChatWrapper, null, renderChatContent())));
|
|
26619
26658
|
};
|
|
26659
|
+
var ChatRevampContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26660
|
+
displayName: "ChatRevamp__ChatRevampContainer",
|
|
26661
|
+
componentId: "sc-1sdiknw-0"
|
|
26662
|
+
})(["display:flex;flex-direction:column;width:100%;position:relative;"]);
|
|
26663
|
+
var TopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26664
|
+
displayName: "ChatRevamp__TopBar",
|
|
26665
|
+
componentId: "sc-1sdiknw-1"
|
|
26666
|
+
})(["display:flex;align-items:center;justify-content:flex-start;", ""], function (_ref2) {
|
|
26667
|
+
var isExpanded = _ref2.isExpanded;
|
|
26668
|
+
return !isExpanded && styled.css(["min-height:32px;"]);
|
|
26669
|
+
});
|
|
26620
26670
|
var TabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26621
26671
|
displayName: "ChatRevamp__TabContainer",
|
|
26622
|
-
componentId: "sc-1sdiknw-
|
|
26623
|
-
})(["
|
|
26672
|
+
componentId: "sc-1sdiknw-2"
|
|
26673
|
+
})(["display:flex;gap:10px;align-items:center;flex-grow:1;"]);
|
|
26624
26674
|
var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
26625
26675
|
displayName: "ChatRevamp__Tab",
|
|
26626
|
-
componentId: "sc-1sdiknw-
|
|
26676
|
+
componentId: "sc-1sdiknw-3"
|
|
26627
26677
|
})(["width:120px;color:white;font-size:0.8rem;all:unset;padding:0.6rem;font-size:0.8rem;border-radius:5px 5px 0 0;border-width:0.25rem 0.25rem 0 0.25rem;border-style:solid;border-color:", ";background-color:", ";color:", ";"], function (props) {
|
|
26628
26678
|
return props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)';
|
|
26629
26679
|
}, function (props) {
|
|
@@ -26631,19 +26681,24 @@ var Tab = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
26631
26681
|
}, function (props) {
|
|
26632
26682
|
return props.active ? 'white' : uiColors.darkGray;
|
|
26633
26683
|
});
|
|
26684
|
+
var ExpandButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
26685
|
+
displayName: "ChatRevamp__ExpandButton",
|
|
26686
|
+
componentId: "sc-1sdiknw-4"
|
|
26687
|
+
})(["position:absolute;top:0;right: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:", ";}"], uiColors.orange, uiColors.orange);
|
|
26634
26688
|
var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26635
26689
|
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26636
|
-
componentId: "sc-1sdiknw-
|
|
26637
|
-
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;"], function (
|
|
26638
|
-
var width =
|
|
26690
|
+
componentId: "sc-1sdiknw-5"
|
|
26691
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-direction:column;"], function (_ref3) {
|
|
26692
|
+
var width = _ref3.width;
|
|
26639
26693
|
return width;
|
|
26640
|
-
}, function (
|
|
26641
|
-
var height =
|
|
26642
|
-
|
|
26694
|
+
}, function (_ref4) {
|
|
26695
|
+
var height = _ref4.height,
|
|
26696
|
+
isExpanded = _ref4.isExpanded;
|
|
26697
|
+
return isExpanded ? height : 'auto';
|
|
26643
26698
|
});
|
|
26644
26699
|
var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26645
26700
|
displayName: "ChatRevamp__RecentChatTabContainer",
|
|
26646
|
-
componentId: "sc-1sdiknw-
|
|
26701
|
+
componentId: "sc-1sdiknw-6"
|
|
26647
26702
|
})(["display:", ";flex-direction:column;border-right:1px solid ", ";outline:none;width:", ";max-width:200px;min-width:", ";transition:all 0.3s ease-in-out;overflow:hidden;height:100%;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
|
|
26648
26703
|
return props.isPrivate ? 'flex' : 'none';
|
|
26649
26704
|
}, uiColors.gray, function (props) {
|
|
@@ -26657,25 +26712,25 @@ var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26657
26712
|
});
|
|
26658
26713
|
var RecentChatTopBar = /*#__PURE__*/styled__default.div.withConfig({
|
|
26659
26714
|
displayName: "ChatRevamp__RecentChatTopBar",
|
|
26660
|
-
componentId: "sc-1sdiknw-
|
|
26715
|
+
componentId: "sc-1sdiknw-7"
|
|
26661
26716
|
})(["display:flex;align-items:center;justify-content:space-between;height:30px;flex-shrink:0;"]);
|
|
26662
26717
|
var SearchButton$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26663
26718
|
displayName: "ChatRevamp__SearchButton",
|
|
26664
|
-
componentId: "sc-1sdiknw-
|
|
26719
|
+
componentId: "sc-1sdiknw-8"
|
|
26665
26720
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
|
|
26666
26721
|
var BurgerIconContainer = /*#__PURE__*/styled__default.button.withConfig({
|
|
26667
26722
|
displayName: "ChatRevamp__BurgerIconContainer",
|
|
26668
|
-
componentId: "sc-1sdiknw-
|
|
26723
|
+
componentId: "sc-1sdiknw-9"
|
|
26669
26724
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;padding:4px;gap:2px;position:relative;&:after{content:'';width:6px;height:6px;position:absolute;top:0;right:2px;border-radius:50%;background-color:", ";display:", ";}"], uiColors.lightGreen, function (props) {
|
|
26670
26725
|
return props.hasUnseenMessages ? 'block' : 'none';
|
|
26671
26726
|
});
|
|
26672
26727
|
var BurgerLineIcon = /*#__PURE__*/styled__default.span.withConfig({
|
|
26673
26728
|
displayName: "ChatRevamp__BurgerLineIcon",
|
|
26674
|
-
componentId: "sc-1sdiknw-
|
|
26729
|
+
componentId: "sc-1sdiknw-10"
|
|
26675
26730
|
})(["width:1rem;height:2px;background-color:#ffffff;"]);
|
|
26676
26731
|
var RecentChatLogContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26677
26732
|
displayName: "ChatRevamp__RecentChatLogContainer",
|
|
26678
|
-
componentId: "sc-1sdiknw-
|
|
26733
|
+
componentId: "sc-1sdiknw-11"
|
|
26679
26734
|
})(["display:", ";opacity:", ";flex-direction:column;gap:0.25rem;transition:opacity 0.3s ease-in-out;padding:0;margin:0;overflow-y:auto;flex-grow:1;height:0;scrollbar-width:thin;scrollbar-color:rgba(51,51,51,0.4) rgba(30,30,30,0.4);&::-webkit-scrollbar{width:8px;height:8px;}&::-webkit-scrollbar-track{background:rgba(30,30,30,0.2);border-radius:4px;}&::-webkit-scrollbar-thumb{background-color:rgba(255,102,0,0.5);border-radius:4px;border:2px solid rgba(30,30,30,0.2);}&::-webkit-scrollbar-thumb:hover{background-color:rgba(255,102,0,0.7);}"], function (props) {
|
|
26680
26735
|
return props.isOpen ? 'flex' : 'none';
|
|
26681
26736
|
}, function (props) {
|
|
@@ -26683,28 +26738,28 @@ var RecentChatLogContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
26683
26738
|
});
|
|
26684
26739
|
var ListElementContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26685
26740
|
displayName: "ChatRevamp__ListElementContainer",
|
|
26686
|
-
componentId: "sc-1sdiknw-
|
|
26741
|
+
componentId: "sc-1sdiknw-12"
|
|
26687
26742
|
})(["display:flex;justify-content:space-between;align-items:center;padding:2px 0;"]);
|
|
26688
26743
|
var ListElement$1 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26689
26744
|
displayName: "ChatRevamp__ListElement",
|
|
26690
|
-
componentId: "sc-1sdiknw-
|
|
26745
|
+
componentId: "sc-1sdiknw-13"
|
|
26691
26746
|
})(["margin:0 !important;font-size:", " !important;padding:2px;all:unset;color:", ";width:100%;position:relative;display:flex;align-items:center;gap:4px;&:hover{color:#ff0;}max-width:calc(100% - 24px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], uiFonts.size.small, function (props) {
|
|
26692
26747
|
return props.active ? uiColors.yellow : uiColors.white;
|
|
26693
26748
|
});
|
|
26694
26749
|
var StatusDot = /*#__PURE__*/styled__default.span.withConfig({
|
|
26695
26750
|
displayName: "ChatRevamp__StatusDot",
|
|
26696
|
-
componentId: "sc-1sdiknw-
|
|
26751
|
+
componentId: "sc-1sdiknw-14"
|
|
26697
26752
|
})(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
|
|
26698
26753
|
return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
|
|
26699
26754
|
});
|
|
26700
26755
|
var CloseButton$2 = /*#__PURE__*/styled__default.button.withConfig({
|
|
26701
26756
|
displayName: "ChatRevamp__CloseButton",
|
|
26702
|
-
componentId: "sc-1sdiknw-
|
|
26757
|
+
componentId: "sc-1sdiknw-15"
|
|
26703
26758
|
})(["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);
|
|
26704
26759
|
var ChatWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26705
26760
|
displayName: "ChatRevamp__ChatWrapper",
|
|
26706
|
-
componentId: "sc-1sdiknw-
|
|
26707
|
-
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;"]);
|
|
26761
|
+
componentId: "sc-1sdiknw-16"
|
|
26762
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;"]);
|
|
26708
26763
|
|
|
26709
26764
|
var CheckButton = function CheckButton(_ref) {
|
|
26710
26765
|
var items = _ref.items,
|