@rpg-engine/long-bow 0.6.96 → 0.6.99

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.
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { ICharacter, IChatMessage, IPrivateChatMessage, ITradeChatMessage } from '@rpg-engine/shared';
2
+ import React from 'react';
3
3
  import { IStyles } from '../Chat/Chat';
4
4
  export declare type PrivateChatCharacter = Pick<ICharacter, '_id' | 'name'>;
5
5
  export declare type ChatMessage = IChatMessage | IPrivateChatMessage | ITradeChatMessage;
@@ -30,4 +30,4 @@ export interface IChatRevampProps {
30
30
  hideSearchCharacterUI: () => void;
31
31
  showSearchCharacterUI: () => void;
32
32
  }
33
- export declare const ChatRevamp: ({ chatMessages, onSendGlobalChatMessage, onChangeCharacterName, onFocus, onBlur, onCloseButton, styles, tabs, onChangeTab, activeTab, privateChatCharacters, onCharacterClick, onSendPrivateChatMessage, recentChatCharacters, recentSelectedChatCharacterId, onPreviousChatCharacterClick, onRemoveRecentChatCharacter, unseenMessageCharacterIds, onSendTradeMessage, searchCharacterUI, hideSearchCharacterUI, showSearchCharacterUI, }: IChatRevampProps) => JSX.Element;
33
+ export declare const ChatRevamp: React.FC<IChatRevampProps>;
@@ -26528,103 +26528,110 @@ var ChatRevamp = function ChatRevamp(_ref) {
26528
26528
  setShowRecentChats = _useState[1];
26529
26529
  var isPrivate = activeTab === 'private';
26530
26530
  var isTrade = activeTab === 'trade';
26531
+ var toggleRecentChats = function toggleRecentChats() {
26532
+ return setShowRecentChats(function (prev) {
26533
+ return !prev;
26534
+ });
26535
+ };
26531
26536
  var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
26532
- if (!onPreviousChatCharacterClick) return;
26533
- onPreviousChatCharacterClick(character);
26537
+ onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
26534
26538
  hideSearchCharacterUI();
26535
26539
  };
26536
- return React__default.createElement(ChatContainer$1, null, React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
26537
- return React__default.createElement(Tab, {
26538
- key: tab.label + "_" + index,
26539
- active: tab.id === activeTab,
26540
- onClick: function onClick() {
26541
- return onChangeTab(tab.id);
26542
- }
26543
- }, tab.label);
26544
- })), React__default.createElement(PrivateChatContainer, {
26540
+ var renderTabs = function renderTabs() {
26541
+ return React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
26542
+ return React__default.createElement(Tab, {
26543
+ key: tab.label + "_" + index,
26544
+ active: tab.id === activeTab,
26545
+ onPointerDown: function onPointerDown() {
26546
+ return onChangeTab(tab.id);
26547
+ }
26548
+ }, tab.label);
26549
+ }));
26550
+ };
26551
+ var renderRecentChatTopBar = function renderRecentChatTopBar() {
26552
+ return React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
26553
+ onPointerDown: toggleRecentChats,
26554
+ hasUnseenMessages: unseenMessageCharacterIds.length > 0
26555
+ }, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
26556
+ onPointerDown: showSearchCharacterUI
26557
+ }, React__default.createElement(rx.RxMagnifyingGlass, {
26558
+ size: 16,
26559
+ color: uiColors.white
26560
+ })));
26561
+ };
26562
+ var renderRecentChatList = function renderRecentChatList() {
26563
+ return React__default.createElement(RecentChatLogContainer, {
26564
+ isOpen: showRecentChats
26565
+ }, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
26566
+ return React__default.createElement(ListElementContainer, {
26567
+ key: character._id
26568
+ }, React__default.createElement(ListElement$1, {
26569
+ active: character._id === recentSelectedChatCharacterId,
26570
+ onPointerDown: function onPointerDown() {
26571
+ return handlePreviousChatCharacterClick(character);
26572
+ }
26573
+ }, React__default.createElement(StatusDot, {
26574
+ isUnseen: unseenMessageCharacterIds.includes(character._id)
26575
+ }), React__default.createElement(Ellipsis, {
26576
+ maxWidth: "140px",
26577
+ maxLines: 1
26578
+ }, character.name)), React__default.createElement(CloseButton$1, {
26579
+ onPointerDown: function onPointerDown() {
26580
+ return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
26581
+ }
26582
+ }, React__default.createElement(rx.RxCross2, {
26583
+ size: 16
26584
+ })));
26585
+ }));
26586
+ };
26587
+ var renderChatContent = function renderChatContent() {
26588
+ if (isPrivate && searchCharacterUI) {
26589
+ return React__default.createElement(SearchCharacter, {
26590
+ onFocus: onFocus,
26591
+ onBlur: onBlur,
26592
+ onChangeCharacterName: onChangeCharacterName,
26593
+ styles: styles,
26594
+ recentCharacters: privateChatCharacters,
26595
+ hideSearchCharacterUI: hideSearchCharacterUI,
26596
+ onCharacterClick: onCharacterClick
26597
+ });
26598
+ }
26599
+ return React__default.createElement(Chat, {
26600
+ chatMessages: chatMessages,
26601
+ onSendChatMessage: isPrivate ? onSendPrivateChatMessage : isTrade ? onSendTradeMessage : onSendGlobalChatMessage,
26602
+ sendMessage: true,
26603
+ onCloseButton: onCloseButton,
26604
+ styles: styles,
26605
+ onFocus: onFocus,
26606
+ onBlur: onBlur
26607
+ });
26608
+ };
26609
+ return React__default.createElement(React__default.Fragment, null, renderTabs(), React__default.createElement(PrivateChatContainer, {
26545
26610
  width: (styles == null ? void 0 : styles.width) || '80%',
26546
26611
  height: (styles == null ? void 0 : styles.height) || 'auto'
26547
- }, isPrivate && React__default.createElement(RecentChatTabContainer, {
26612
+ }, React__default.createElement(RecentChatTabContainer, {
26548
26613
  isPrivate: isPrivate,
26549
26614
  isOpen: showRecentChats
26550
- }, React__default.createElement(RecentChatContent, {
26551
- isOpen: showRecentChats
26552
- }, React__default.createElement(RecentChatTopBar, null, React__default.createElement(BurgerIconContainer, {
26553
- onClick: function onClick() {
26554
- return setShowRecentChats(function (t) {
26555
- return !t;
26556
- });
26557
- },
26558
- hasUnseenMessages: (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.length) > 0 || false
26559
- }, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
26560
- onClick: function onClick() {
26561
- return showSearchCharacterUI();
26562
- }
26563
- }, React__default.createElement(rx.RxMagnifyingGlass, {
26564
- size: 16,
26565
- color: uiColors.white
26566
- }))), React__default.createElement(RecentChatLogContainer, null, recentChatCharacters == null ? void 0 : recentChatCharacters.map(function (character) {
26567
- return React__default.createElement(ListElementContainer, {
26568
- key: character._id
26569
- }, React__default.createElement(ListElement$1, {
26570
- active: character._id === recentSelectedChatCharacterId,
26571
- onClick: function onClick() {
26572
- return handlePreviousChatCharacterClick(character);
26573
- }
26574
- }, React__default.createElement(StatusDot, {
26575
- isUnseen: (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.includes(character._id)) || false
26576
- }), React__default.createElement(EllipsisWrapper, null, React__default.createElement(Ellipsis, {
26577
- maxLines: 1,
26578
- maxWidth: "140px"
26579
- }, character.name))), React__default.createElement(CloseButton$1, {
26580
- onClick: function onClick() {
26581
- return onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
26582
- }
26583
- }, React__default.createElement(rx.RxCross2, {
26584
- size: 16
26585
- })));
26586
- })))), isPrivate && searchCharacterUI ? React__default.createElement(SearchCharacter, {
26587
- onFocus: onFocus,
26588
- onBlur: onBlur,
26589
- onChangeCharacterName: onChangeCharacterName,
26590
- styles: styles,
26591
- recentCharacters: privateChatCharacters,
26592
- hideSearchCharacterUI: hideSearchCharacterUI,
26593
- onCharacterClick: onCharacterClick
26594
- }) : React__default.createElement(Chat, {
26595
- chatMessages: chatMessages,
26596
- onSendChatMessage: isPrivate ? onSendPrivateChatMessage : isTrade ? onSendTradeMessage : onSendGlobalChatMessage,
26597
- sendMessage: true,
26598
- onCloseButton: onCloseButton,
26599
- styles: styles,
26600
- onFocus: onFocus,
26601
- onBlur: onBlur
26602
- })));
26615
+ }, renderRecentChatTopBar(), renderRecentChatList()), renderChatContent()));
26603
26616
  };
26604
- var ChatContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
26605
- displayName: "ChatRevamp__ChatContainer",
26606
- componentId: "sc-1sdiknw-0"
26607
- })(["display:flex;flex-direction:column;gap:10px;max-width:1200px;"]);
26608
26617
  var TabContainer = /*#__PURE__*/styled__default.div.withConfig({
26609
26618
  displayName: "ChatRevamp__TabContainer",
26610
- componentId: "sc-1sdiknw-1"
26619
+ componentId: "sc-1sdiknw-0"
26611
26620
  })(["width:100%;display:flex;gap:10px;"]);
26612
26621
  var Tab = /*#__PURE__*/styled__default.button.withConfig({
26613
26622
  displayName: "ChatRevamp__Tab",
26614
- componentId: "sc-1sdiknw-2"
26615
- })(["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:", ";transition:all 0.3s ease;cursor:pointer;&:hover{background-color:", ";}"], function (props) {
26623
+ componentId: "sc-1sdiknw-1"
26624
+ })(["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) {
26616
26625
  return props.active ? '#c65102' : uiColors.gray;
26617
26626
  }, function (props) {
26618
26627
  return props.active ? uiColors.orange : 'transparent';
26619
26628
  }, function (props) {
26620
26629
  return props.active ? 'white' : uiColors.raisinBlack;
26621
- }, function (props) {
26622
- return props.active ? uiColors.orange : uiColors.lightGray;
26623
26630
  });
26624
26631
  var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
26625
26632
  displayName: "ChatRevamp__PrivateChatContainer",
26626
- componentId: "sc-1sdiknw-3"
26627
- })(["width:", ";min-height:", " !important;padding:10px;background-color:rgba(0,0,0,0.2);height:auto;display:flex;gap:10px;border-radius:0 0 10px 10px;box-shadow:0 4px 6px rgba(0,0,0,0.1);"], function (_ref2) {
26633
+ componentId: "sc-1sdiknw-2"
26634
+ })(["width:", ";min-height:", " !important;padding:10px;background-color:rgba(0,0,0,0.2);height:auto;display:flex;gap:10px;"], function (_ref2) {
26628
26635
  var width = _ref2.width;
26629
26636
  return width;
26630
26637
  }, function (_ref3) {
@@ -26633,70 +26640,62 @@ var PrivateChatContainer = /*#__PURE__*/styled__default.div.withConfig({
26633
26640
  });
26634
26641
  var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
26635
26642
  displayName: "ChatRevamp__RecentChatTabContainer",
26636
- componentId: "sc-1sdiknw-4"
26637
- })(["display:", ";flex-direction:column;border-right:1px solid ", ";outline:none;width:", ";min-width:", ";max-width:300px;transition:all 0.3s ease-in-out;overflow:hidden;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
26643
+ componentId: "sc-1sdiknw-3"
26644
+ })(["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;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
26638
26645
  return props.isPrivate ? 'flex' : 'none';
26639
26646
  }, uiColors.gray, function (props) {
26640
- return props.isOpen ? '20%' : '30px';
26647
+ return props.isOpen ? '25%' : '30px';
26641
26648
  }, function (props) {
26642
- return props.isOpen ? '140px' : '30px';
26649
+ return props.isOpen ? '180px' : '30px';
26643
26650
  }, function (props) {
26644
- return props.isOpen ? '40%' : '30px';
26651
+ return props.isOpen ? '50%' : '30px';
26645
26652
  }, function (props) {
26646
- return props.isOpen ? '140px' : '30px';
26647
- });
26648
- var RecentChatContent = /*#__PURE__*/styled__default.div.withConfig({
26649
- displayName: "ChatRevamp__RecentChatContent",
26650
- componentId: "sc-1sdiknw-5"
26651
- })(["width:100%;min-width:140px;opacity:", ";transition:opacity 0.3s ease-in-out;"], function (props) {
26652
- return props.isOpen ? 1 : 0;
26653
+ return props.isOpen ? '150px' : '30px';
26653
26654
  });
26654
26655
  var RecentChatTopBar = /*#__PURE__*/styled__default.div.withConfig({
26655
26656
  displayName: "ChatRevamp__RecentChatTopBar",
26656
- componentId: "sc-1sdiknw-6"
26657
+ componentId: "sc-1sdiknw-4"
26657
26658
  })(["display:flex;align-items:center;justify-content:space-between;height:30px;"]);
26658
26659
  var SearchButton$1 = /*#__PURE__*/styled__default.button.withConfig({
26659
26660
  displayName: "ChatRevamp__SearchButton",
26660
- componentId: "sc-1sdiknw-7"
26661
+ componentId: "sc-1sdiknw-5"
26661
26662
  })(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
26662
26663
  var BurgerIconContainer = /*#__PURE__*/styled__default.button.withConfig({
26663
26664
  displayName: "ChatRevamp__BurgerIconContainer",
26664
- componentId: "sc-1sdiknw-8"
26665
+ componentId: "sc-1sdiknw-6"
26665
26666
  })(["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) {
26666
26667
  return props.hasUnseenMessages ? 'block' : 'none';
26667
26668
  });
26668
26669
  var BurgerLineIcon = /*#__PURE__*/styled__default.span.withConfig({
26669
26670
  displayName: "ChatRevamp__BurgerLineIcon",
26670
- componentId: "sc-1sdiknw-9"
26671
+ componentId: "sc-1sdiknw-7"
26671
26672
  })(["width:1rem;height:2px;background-color:#ffffff;"]);
26672
26673
  var RecentChatLogContainer = /*#__PURE__*/styled__default.div.withConfig({
26673
26674
  displayName: "ChatRevamp__RecentChatLogContainer",
26674
- componentId: "sc-1sdiknw-10"
26675
- })(["border:none;list-style:none;display:flex;flex-direction:column;gap:0.5rem;padding:0;margin:0;flex:1;"]);
26675
+ componentId: "sc-1sdiknw-8"
26676
+ })(["border:none;list-style:none;display:flex;opacity:", ";flex-direction:column;gap:0.5rem;transition:opacity 0.3s ease-in-out;padding:0;margin:0;flex:1;"], function (props) {
26677
+ return props.isOpen ? 1 : 0;
26678
+ });
26676
26679
  var ListElementContainer = /*#__PURE__*/styled__default.div.withConfig({
26677
26680
  displayName: "ChatRevamp__ListElementContainer",
26678
- componentId: "sc-1sdiknw-11"
26679
- })(["display:flex;justify-content:space-between;align-items:center;width:100%;"]);
26681
+ componentId: "sc-1sdiknw-9"
26682
+ })(["display:flex;justify-content:space-between;align-items:center;"]);
26680
26683
  var ListElement$1 = /*#__PURE__*/styled__default.button.withConfig({
26681
26684
  displayName: "ChatRevamp__ListElement",
26682
- componentId: "sc-1sdiknw-12"
26683
- })(["margin:0.5rem 0 !important;font-size:", " !important;padding:8px 4px;border-radius:4px;all:unset;color:", ";width:100%;position:relative;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;flex:1;min-width:0;&:hover{background-color:rgba(255,255,255,0.1);}"], uiFonts.size.small, function (props) {
26685
+ componentId: "sc-1sdiknw-10"
26686
+ })(["margin:0.5rem 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) {
26684
26687
  return props.active ? uiColors.yellow : uiColors.white;
26685
26688
  });
26686
- var EllipsisWrapper = /*#__PURE__*/styled__default.div.withConfig({
26687
- displayName: "ChatRevamp__EllipsisWrapper",
26688
- componentId: "sc-1sdiknw-13"
26689
- })(["flex:1;min-width:0;"]);
26690
26689
  var StatusDot = /*#__PURE__*/styled__default.span.withConfig({
26691
26690
  displayName: "ChatRevamp__StatusDot",
26692
- componentId: "sc-1sdiknw-14"
26691
+ componentId: "sc-1sdiknw-11"
26693
26692
  })(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
26694
26693
  return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
26695
26694
  });
26696
26695
  var CloseButton$1 = /*#__PURE__*/styled__default.button.withConfig({
26697
26696
  displayName: "ChatRevamp__CloseButton",
26698
- componentId: "sc-1sdiknw-15"
26699
- })(["all:unset;font-size:", ";margin:0 0.5rem;transition:all 0.2s ease-in-out;background-color:", ";color:", ";border-radius:50%;padding:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;&:hover{background-color:", ";color:", ";}"], uiFonts.size.xxsmall, uiColors.red, uiColors.white, uiColors.white, uiColors.red);
26697
+ componentId: "sc-1sdiknw-12"
26698
+ })(["all:unset;font-size:", ";margin:0 0.5rem;transition:all 0.2s ease-in-out;background-color:", ";color:", ";&:hover{background-color:", ";color:", ";}"], uiFonts.size.xxsmall, uiColors.red, uiColors.white, uiColors.white, uiColors.red);
26700
26699
 
26701
26700
  var CheckButton = function CheckButton(_ref) {
26702
26701
  var items = _ref.items,