@rpg-engine/long-bow 0.7.18 → 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.
@@ -6,6 +6,7 @@ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarit
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
8
  import { FaTimes } from 'react-icons/fa';
9
+ import { IoMdContract, IoMdExpand } from 'react-icons/io';
9
10
  import { RxMagnifyingGlass, RxCross2 } from 'react-icons/rx';
10
11
  import Draggable from 'react-draggable';
11
12
  import ReactDOM from 'react-dom';
@@ -26110,13 +26111,19 @@ var Chat = function Chat(_ref) {
26110
26111
  buttonBackgroundColor: '#333',
26111
26112
  width: '100%',
26112
26113
  height: '100%'
26113
- } : _ref$styles;
26114
+ } : _ref$styles,
26115
+ isExpanded = _ref.isExpanded;
26114
26116
  var _useState = useState(''),
26115
26117
  message = _useState[0],
26116
26118
  setMessage = _useState[1];
26119
+ var inputRef = useRef(null);
26117
26120
  useEffect(function () {
26118
- scrollChatToBottom();
26119
- }, [chatMessages]);
26121
+ var _inputRef$current;
26122
+ if (isExpanded) {
26123
+ scrollChatToBottom();
26124
+ }
26125
+ (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
26126
+ }, [chatMessages, isExpanded]);
26120
26127
  var scrollChatToBottom = function scrollChatToBottom() {
26121
26128
  var scrollingElement = document.querySelector('.chat-body');
26122
26129
  if (scrollingElement) {
@@ -26142,21 +26149,24 @@ var Chat = function Chat(_ref) {
26142
26149
  };
26143
26150
  return React.createElement(ChatContainer, {
26144
26151
  width: styles.width || 'auto',
26145
- height: styles.height || 'auto'
26152
+ height: styles.height || 'auto',
26153
+ isExpanded: isExpanded
26154
+ }, isExpanded && React.createElement(ErrorBoundary$1, {
26155
+ fallback: React.createElement("p", null, "Oops! Your chat has crashed.")
26146
26156
  }, React.createElement(CloseButton, {
26147
26157
  onClick: onCloseButton
26148
- }, React.createElement(FaTimes, null)), React.createElement(ErrorBoundary$1, {
26149
- fallback: React.createElement("p", null, "Oops! Your chat has crashed.")
26150
- }, React.createElement(MessagesContainer, {
26158
+ }, React.createElement(FaTimes, null)), React.createElement(MessagesContainer, {
26151
26159
  className: "chat-body"
26152
26160
  }, chatMessages.map(function (chatMessage, index) {
26153
26161
  return React.createElement(Message, {
26154
26162
  color: styles.textColor || uiColors.yellow,
26155
26163
  key: chatMessage._id + "_" + index
26156
26164
  }, formatMessage(chatMessage));
26157
- })), React.createElement(Form, {
26158
- onSubmit: handleSubmit
26165
+ }))), React.createElement(Form, {
26166
+ onSubmit: handleSubmit,
26167
+ isExpanded: isExpanded
26159
26168
  }, React.createElement(TextField, {
26169
+ ref: inputRef,
26160
26170
  value: message,
26161
26171
  onChange: function onChange(e) {
26162
26172
  return setMessage(e.target.value);
@@ -26166,12 +26176,11 @@ var Chat = function Chat(_ref) {
26166
26176
  onFocus: onFocus,
26167
26177
  onBlur: onBlur,
26168
26178
  onPointerDown: onFocus,
26169
- autoFocus: true,
26170
26179
  placeholder: "Type your message..."
26171
26180
  }), React.createElement(SendButton, {
26172
26181
  type: "submit",
26173
26182
  disabled: !message.trim()
26174
- }, "\u25B6"))));
26183
+ }, "\u25B6")));
26175
26184
  };
26176
26185
  var ChatContainer = /*#__PURE__*/styled.div.withConfig({
26177
26186
  displayName: "Chat__ChatContainer",
@@ -26179,7 +26188,7 @@ var ChatContainer = /*#__PURE__*/styled.div.withConfig({
26179
26188
  })(["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) {
26180
26189
  return props.width;
26181
26190
  }, function (props) {
26182
- return props.height;
26191
+ return props.isExpanded ? props.height : 'auto';
26183
26192
  });
26184
26193
  var CloseButton = /*#__PURE__*/styled.button.withConfig({
26185
26194
  displayName: "Chat__CloseButton",
@@ -26199,7 +26208,9 @@ var Message = /*#__PURE__*/styled.div.withConfig({
26199
26208
  var Form = /*#__PURE__*/styled.form.withConfig({
26200
26209
  displayName: "Chat__Form",
26201
26210
  componentId: "sc-1bk05n6-4"
26202
- })(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);"]);
26211
+ })(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);border-radius:", ";"], function (props) {
26212
+ return props.isExpanded ? '0' : '8px';
26213
+ });
26203
26214
  var TextField = /*#__PURE__*/styled.input.withConfig({
26204
26215
  displayName: "Chat__TextField",
26205
26216
  componentId: "sc-1bk05n6-5"
@@ -26514,17 +26525,38 @@ var ChatRevamp = function ChatRevamp(_ref) {
26514
26525
  onSendTradeMessage = _ref.onSendTradeMessage,
26515
26526
  searchCharacterUI = _ref.searchCharacterUI,
26516
26527
  hideSearchCharacterUI = _ref.hideSearchCharacterUI,
26517
- showSearchCharacterUI = _ref.showSearchCharacterUI;
26528
+ showSearchCharacterUI = _ref.showSearchCharacterUI,
26529
+ _ref$minimizedByDefau = _ref.minimizedByDefault,
26530
+ minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau;
26518
26531
  var _useState = useState(false),
26519
26532
  showRecentChats = _useState[0],
26520
26533
  setShowRecentChats = _useState[1];
26534
+ var _useState2 = useState(!minimizedByDefault),
26535
+ isExpanded = _useState2[0],
26536
+ setIsExpanded = _useState2[1];
26521
26537
  var isPrivate = activeTab === 'private';
26522
26538
  var isTrade = activeTab === 'trade';
26539
+ useEffect(function () {
26540
+ if (isPrivate) {
26541
+ setIsExpanded(true);
26542
+ }
26543
+ }, [isPrivate]);
26544
+ var toggleExpand = function toggleExpand() {
26545
+ return setIsExpanded(function (prev) {
26546
+ return !prev;
26547
+ });
26548
+ };
26523
26549
  var toggleRecentChats = function toggleRecentChats() {
26524
26550
  return setShowRecentChats(function (prev) {
26525
26551
  return !prev;
26526
26552
  });
26527
26553
  };
26554
+ var handleTabChange = function handleTabChange(tabId) {
26555
+ if (tabId === 'private') {
26556
+ setIsExpanded(true);
26557
+ }
26558
+ onChangeTab(tabId);
26559
+ };
26528
26560
  var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
26529
26561
  onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
26530
26562
  hideSearchCharacterUI();
@@ -26535,7 +26567,7 @@ var ChatRevamp = function ChatRevamp(_ref) {
26535
26567
  key: tab.label + "_" + index,
26536
26568
  active: tab.id === activeTab,
26537
26569
  onPointerDown: function onPointerDown() {
26538
- return onChangeTab(tab.id);
26570
+ return handleTabChange(tab.id);
26539
26571
  }
26540
26572
  }, tab.label);
26541
26573
  }));
@@ -26596,24 +26628,46 @@ var ChatRevamp = function ChatRevamp(_ref) {
26596
26628
  onCloseButton: onCloseButton,
26597
26629
  styles: styles,
26598
26630
  onFocus: onFocus,
26599
- onBlur: onBlur
26631
+ onBlur: onBlur,
26632
+ isExpanded: isExpanded
26600
26633
  });
26601
26634
  };
26602
- return React.createElement(React.Fragment, null, renderTabs(), React.createElement(PrivateChatContainer, {
26635
+ return React.createElement(ChatRevampContainer, null, React.createElement(TopBar, {
26636
+ isExpanded: isExpanded
26637
+ }, isExpanded && renderTabs(), React.createElement(ExpandButton, {
26638
+ onClick: toggleExpand,
26639
+ isExpanded: isExpanded
26640
+ }, isExpanded ? React.createElement(IoMdContract, {
26641
+ size: 20
26642
+ }) : React.createElement(IoMdExpand, {
26643
+ size: 20
26644
+ }))), React.createElement(PrivateChatContainer, {
26603
26645
  width: (styles == null ? void 0 : styles.width) || '80%',
26604
- height: (styles == null ? void 0 : styles.height) || 'auto'
26605
- }, React.createElement(RecentChatTabContainer, {
26646
+ height: (styles == null ? void 0 : styles.height) || 'auto',
26647
+ isExpanded: isExpanded
26648
+ }, isExpanded && React.createElement(RecentChatTabContainer, {
26606
26649
  isPrivate: isPrivate,
26607
26650
  isOpen: showRecentChats
26608
26651
  }, renderRecentChatTopBar(), renderRecentChatList()), React.createElement(ChatWrapper, null, renderChatContent())));
26609
26652
  };
26653
+ var ChatRevampContainer = /*#__PURE__*/styled.div.withConfig({
26654
+ displayName: "ChatRevamp__ChatRevampContainer",
26655
+ componentId: "sc-1sdiknw-0"
26656
+ })(["display:flex;flex-direction:column;width:100%;position:relative;"]);
26657
+ var TopBar = /*#__PURE__*/styled.div.withConfig({
26658
+ displayName: "ChatRevamp__TopBar",
26659
+ componentId: "sc-1sdiknw-1"
26660
+ })(["display:flex;align-items:center;justify-content:flex-start;", ""], function (_ref2) {
26661
+ var isExpanded = _ref2.isExpanded;
26662
+ return !isExpanded && css(["min-height:32px;"]);
26663
+ });
26610
26664
  var TabContainer = /*#__PURE__*/styled.div.withConfig({
26611
26665
  displayName: "ChatRevamp__TabContainer",
26612
- componentId: "sc-1sdiknw-0"
26613
- })(["width:100%;display:flex;gap:10px;"]);
26666
+ componentId: "sc-1sdiknw-2"
26667
+ })(["display:flex;gap:10px;align-items:center;flex-grow:1;"]);
26614
26668
  var Tab = /*#__PURE__*/styled.button.withConfig({
26615
26669
  displayName: "ChatRevamp__Tab",
26616
- componentId: "sc-1sdiknw-1"
26670
+ componentId: "sc-1sdiknw-3"
26617
26671
  })(["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) {
26618
26672
  return props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)';
26619
26673
  }, function (props) {
@@ -26621,19 +26675,24 @@ var Tab = /*#__PURE__*/styled.button.withConfig({
26621
26675
  }, function (props) {
26622
26676
  return props.active ? 'white' : uiColors.darkGray;
26623
26677
  });
26678
+ var ExpandButton = /*#__PURE__*/styled.button.withConfig({
26679
+ displayName: "ChatRevamp__ExpandButton",
26680
+ componentId: "sc-1sdiknw-4"
26681
+ })(["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);
26624
26682
  var PrivateChatContainer = /*#__PURE__*/styled.div.withConfig({
26625
26683
  displayName: "ChatRevamp__PrivateChatContainer",
26626
- componentId: "sc-1sdiknw-2"
26627
- })(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;"], function (_ref2) {
26628
- var width = _ref2.width;
26684
+ componentId: "sc-1sdiknw-5"
26685
+ })(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-direction:column;"], function (_ref3) {
26686
+ var width = _ref3.width;
26629
26687
  return width;
26630
- }, function (_ref3) {
26631
- var height = _ref3.height;
26632
- return height;
26688
+ }, function (_ref4) {
26689
+ var height = _ref4.height,
26690
+ isExpanded = _ref4.isExpanded;
26691
+ return isExpanded ? height : 'auto';
26633
26692
  });
26634
26693
  var RecentChatTabContainer = /*#__PURE__*/styled.div.withConfig({
26635
26694
  displayName: "ChatRevamp__RecentChatTabContainer",
26636
- componentId: "sc-1sdiknw-3"
26695
+ componentId: "sc-1sdiknw-6"
26637
26696
  })(["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) {
26638
26697
  return props.isPrivate ? 'flex' : 'none';
26639
26698
  }, uiColors.gray, function (props) {
@@ -26647,25 +26706,25 @@ var RecentChatTabContainer = /*#__PURE__*/styled.div.withConfig({
26647
26706
  });
26648
26707
  var RecentChatTopBar = /*#__PURE__*/styled.div.withConfig({
26649
26708
  displayName: "ChatRevamp__RecentChatTopBar",
26650
- componentId: "sc-1sdiknw-4"
26709
+ componentId: "sc-1sdiknw-7"
26651
26710
  })(["display:flex;align-items:center;justify-content:space-between;height:30px;flex-shrink:0;"]);
26652
26711
  var SearchButton$1 = /*#__PURE__*/styled.button.withConfig({
26653
26712
  displayName: "ChatRevamp__SearchButton",
26654
- componentId: "sc-1sdiknw-5"
26713
+ componentId: "sc-1sdiknw-8"
26655
26714
  })(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
26656
26715
  var BurgerIconContainer = /*#__PURE__*/styled.button.withConfig({
26657
26716
  displayName: "ChatRevamp__BurgerIconContainer",
26658
- componentId: "sc-1sdiknw-6"
26717
+ componentId: "sc-1sdiknw-9"
26659
26718
  })(["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) {
26660
26719
  return props.hasUnseenMessages ? 'block' : 'none';
26661
26720
  });
26662
26721
  var BurgerLineIcon = /*#__PURE__*/styled.span.withConfig({
26663
26722
  displayName: "ChatRevamp__BurgerLineIcon",
26664
- componentId: "sc-1sdiknw-7"
26723
+ componentId: "sc-1sdiknw-10"
26665
26724
  })(["width:1rem;height:2px;background-color:#ffffff;"]);
26666
26725
  var RecentChatLogContainer = /*#__PURE__*/styled.div.withConfig({
26667
26726
  displayName: "ChatRevamp__RecentChatLogContainer",
26668
- componentId: "sc-1sdiknw-8"
26727
+ componentId: "sc-1sdiknw-11"
26669
26728
  })(["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) {
26670
26729
  return props.isOpen ? 'flex' : 'none';
26671
26730
  }, function (props) {
@@ -26673,28 +26732,28 @@ var RecentChatLogContainer = /*#__PURE__*/styled.div.withConfig({
26673
26732
  });
26674
26733
  var ListElementContainer = /*#__PURE__*/styled.div.withConfig({
26675
26734
  displayName: "ChatRevamp__ListElementContainer",
26676
- componentId: "sc-1sdiknw-9"
26735
+ componentId: "sc-1sdiknw-12"
26677
26736
  })(["display:flex;justify-content:space-between;align-items:center;padding:2px 0;"]);
26678
26737
  var ListElement$1 = /*#__PURE__*/styled.button.withConfig({
26679
26738
  displayName: "ChatRevamp__ListElement",
26680
- componentId: "sc-1sdiknw-10"
26739
+ componentId: "sc-1sdiknw-13"
26681
26740
  })(["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) {
26682
26741
  return props.active ? uiColors.yellow : uiColors.white;
26683
26742
  });
26684
26743
  var StatusDot = /*#__PURE__*/styled.span.withConfig({
26685
26744
  displayName: "ChatRevamp__StatusDot",
26686
- componentId: "sc-1sdiknw-11"
26745
+ componentId: "sc-1sdiknw-14"
26687
26746
  })(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
26688
26747
  return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
26689
26748
  });
26690
26749
  var CloseButton$2 = /*#__PURE__*/styled.button.withConfig({
26691
26750
  displayName: "ChatRevamp__CloseButton",
26692
- componentId: "sc-1sdiknw-12"
26751
+ componentId: "sc-1sdiknw-15"
26693
26752
  })(["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);
26694
26753
  var ChatWrapper = /*#__PURE__*/styled.div.withConfig({
26695
26754
  displayName: "ChatRevamp__ChatWrapper",
26696
- componentId: "sc-1sdiknw-13"
26697
- })(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;"]);
26755
+ componentId: "sc-1sdiknw-16"
26756
+ })(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;"]);
26698
26757
 
26699
26758
  var CheckButton = function CheckButton(_ref) {
26700
26759
  var items = _ref.items,