@rpg-engine/long-bow 0.5.46 → 0.5.48

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.
@@ -26,5 +26,8 @@ export interface IChatRevampProps {
26
26
  onRemoveRecentChatCharacter?: (character: PrivateChatCharacter) => void;
27
27
  unseenMessageCharacterIds?: string[];
28
28
  onSendTradeMessage: (message: string) => void;
29
+ searchCharacterUI: boolean;
30
+ hideSearchCharacterUI: () => void;
31
+ showSearchCharacterUI: () => void;
29
32
  }
30
- export declare const ChatRevamp: ({ chatMessages, onSendGlobalChatMessage, onChangeCharacterName, onFocus, onBlur, onCloseButton, styles, tabs, onChangeTab, activeTab, privateChatCharacters, onCharacterClick, onSendPrivateChatMessage, recentChatCharacters, recentSelectedChatCharacterId, onPreviousChatCharacterClick, onRemoveRecentChatCharacter, unseenMessageCharacterIds, onSendTradeMessage, }: IChatRevampProps) => JSX.Element;
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;
@@ -7,8 +7,8 @@ interface ISearchCharacterProps {
7
7
  onChangeCharacterName: (characterName: string) => void;
8
8
  styles?: IStyles;
9
9
  recentCharacters?: PrivateChatCharacter[];
10
- setShowSearchCharacter: (show: boolean) => void;
11
10
  onCharacterClick?: (character: PrivateChatCharacter) => void;
11
+ hideSearchCharacterUI: () => void;
12
12
  }
13
- export declare const SearchCharacter: ({ onChangeCharacterName, onBlur, onFocus, recentCharacters, setShowSearchCharacter, onCharacterClick, styles, }: ISearchCharacterProps) => JSX.Element;
13
+ export declare const SearchCharacter: ({ onChangeCharacterName, onBlur, onFocus, recentCharacters, hideSearchCharacterUI, onCharacterClick, styles, }: ISearchCharacterProps) => JSX.Element;
14
14
  export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { ICharacter } from '@rpg-engine/shared';
3
+ export declare type IFriend = Pick<ICharacter, 'name' | '_id' | 'isOnline'>;
4
+ interface IFriendListProps {
5
+ scale?: number;
6
+ friends: IFriend[];
7
+ friendRequests: IFriend[];
8
+ searchedCharacters: IFriend[];
9
+ onFocus?: () => void;
10
+ onBlur?: () => void;
11
+ onClose: () => void;
12
+ onOpenPrivateMessage: (character: IFriend) => void;
13
+ onRemoveFriend: (character: IFriend) => void;
14
+ onSendFriendRequest: (character: IFriend) => void;
15
+ onSearch: (characterName: string) => void;
16
+ onAcceptRequest: (character: IFriend) => void;
17
+ onRejectRequest: (character: IFriend) => void;
18
+ }
19
+ export declare const FriendList: (props: IFriendListProps) => JSX.Element;
20
+ export {};
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { IFriend } from './FriendList';
3
+ interface ISearchFriendProp {
4
+ searchedCharacters: IFriend[];
5
+ friendRequests: IFriend[];
6
+ onFocus?: () => void;
7
+ onBlur?: () => void;
8
+ onSearch: (characterName: string) => void;
9
+ onSendFriendRequest: (character: IFriend) => void;
10
+ onAcceptRequest: (character: IFriend) => void;
11
+ onRejectRequest: (character: IFriend) => void;
12
+ }
13
+ export declare const SearchFriend: (props: ISearchFriendProp) => JSX.Element;
14
+ export {};
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './components/DraggableContainer';
10
10
  export * from './components/Dropdown';
11
11
  export * from './components/DropdownSelectorContainer';
12
12
  export * from './components/Equipment/EquipmentSet';
13
+ export * from './components/Friends/FriendList';
13
14
  export * from './components/HistoryDialog';
14
15
  export * from './components/ImageCarousel/ImageCarousel';
15
16
  export * from './components/Input';
@@ -12668,7 +12668,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
12668
12668
  onBlur = _ref.onBlur,
12669
12669
  onFocus = _ref.onFocus,
12670
12670
  recentCharacters = _ref.recentCharacters,
12671
- setShowSearchCharacter = _ref.setShowSearchCharacter,
12671
+ hideSearchCharacterUI = _ref.hideSearchCharacterUI,
12672
12672
  onCharacterClick = _ref.onCharacterClick,
12673
12673
  _ref$styles = _ref.styles,
12674
12674
  styles = _ref$styles === void 0 ? {
@@ -12701,7 +12701,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
12701
12701
  if (!onCharacterClick) return;
12702
12702
  setCharacterName('');
12703
12703
  onCharacterClick(character);
12704
- setShowSearchCharacter(false);
12704
+ hideSearchCharacterUI();
12705
12705
  };
12706
12706
  return React__default.createElement(SearchContainer, null, React__default.createElement(Form$1, {
12707
12707
  onSubmit: handleSubmit
@@ -12796,22 +12796,19 @@ var ChatRevamp = function ChatRevamp(_ref) {
12796
12796
  onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
12797
12797
  _ref$unseenMessageCha = _ref.unseenMessageCharacterIds,
12798
12798
  unseenMessageCharacterIds = _ref$unseenMessageCha === void 0 ? [] : _ref$unseenMessageCha,
12799
- onSendTradeMessage = _ref.onSendTradeMessage;
12800
- var _useState = React.useState(true),
12801
- showSearchCharacterUI = _useState[0],
12802
- setShowSearchCharacterUI = _useState[1];
12803
- var _useState2 = React.useState(false),
12804
- showRecentChats = _useState2[0],
12805
- setShowRecentChats = _useState2[1];
12806
- React.useEffect(function () {
12807
- setShowSearchCharacterUI(true);
12808
- }, [activeTab]);
12799
+ onSendTradeMessage = _ref.onSendTradeMessage,
12800
+ searchCharacterUI = _ref.searchCharacterUI,
12801
+ hideSearchCharacterUI = _ref.hideSearchCharacterUI,
12802
+ showSearchCharacterUI = _ref.showSearchCharacterUI;
12803
+ var _useState = React.useState(false),
12804
+ showRecentChats = _useState[0],
12805
+ setShowRecentChats = _useState[1];
12809
12806
  var isPrivate = activeTab === 'private';
12810
12807
  var isTrade = activeTab === 'trade';
12811
12808
  var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
12812
12809
  if (!onPreviousChatCharacterClick) return;
12813
12810
  onPreviousChatCharacterClick(character);
12814
- setShowSearchCharacterUI(false);
12811
+ hideSearchCharacterUI();
12815
12812
  };
12816
12813
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(TabContainer, null, tabs.map(function (tab, index) {
12817
12814
  return React__default.createElement(Tab, {
@@ -12838,7 +12835,7 @@ var ChatRevamp = function ChatRevamp(_ref) {
12838
12835
  hasUnseenMessages: (unseenMessageCharacterIds == null ? void 0 : unseenMessageCharacterIds.length) > 0 || false
12839
12836
  }, React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null), React__default.createElement(BurgerLineIcon, null)), showRecentChats && React__default.createElement(SearchButton$1, {
12840
12837
  onPointerDown: function onPointerDown() {
12841
- return setShowSearchCharacterUI(true);
12838
+ return showSearchCharacterUI();
12842
12839
  }
12843
12840
  }, React__default.createElement(rx.RxMagnifyingGlass, {
12844
12841
  size: 16,
@@ -12862,13 +12859,13 @@ var ChatRevamp = function ChatRevamp(_ref) {
12862
12859
  }, React__default.createElement(rx.RxCross2, {
12863
12860
  size: 16
12864
12861
  })));
12865
- }))), isPrivate && showSearchCharacterUI ? React__default.createElement(SearchCharacter, {
12862
+ }))), isPrivate && searchCharacterUI ? React__default.createElement(SearchCharacter, {
12866
12863
  onFocus: onFocus,
12867
12864
  onBlur: onBlur,
12868
12865
  onChangeCharacterName: onChangeCharacterName,
12869
12866
  styles: styles,
12870
12867
  recentCharacters: privateChatCharacters,
12871
- setShowSearchCharacter: setShowSearchCharacterUI,
12868
+ hideSearchCharacterUI: hideSearchCharacterUI,
12872
12869
  onCharacterClick: onCharacterClick
12873
12870
  }) : React__default.createElement(Chat, {
12874
12871
  chatMessages: chatMessages,
@@ -15114,6 +15111,183 @@ var EquipmentColumn = /*#__PURE__*/styled.div.withConfig({
15114
15111
  componentId: "sc-1wuddg2-1"
15115
15112
  })(["display:flex;justify-content:center;flex-wrap:wrap;flex-direction:column;touch-action:none;"]);
15116
15113
 
15114
+ var SearchFriend = function SearchFriend(props) {
15115
+ var searchedCharacters = props.searchedCharacters,
15116
+ friendRequests = props.friendRequests,
15117
+ onBlur = props.onBlur,
15118
+ onFocus = props.onFocus,
15119
+ onSearch = props.onSearch,
15120
+ onSendFriendRequest = props.onSendFriendRequest,
15121
+ onAcceptRequest = props.onAcceptRequest,
15122
+ onRejectRequest = props.onRejectRequest;
15123
+ var _useState = React.useState(''),
15124
+ characterName = _useState[0],
15125
+ setCharacterName = _useState[1];
15126
+ var handleSubmit = function handleSubmit(event) {
15127
+ event.preventDefault();
15128
+ if (!characterName || characterName.trim() === '') return;
15129
+ onSearch(characterName);
15130
+ };
15131
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(Form$3, {
15132
+ onSubmit: handleSubmit
15133
+ }, React__default.createElement(Column, {
15134
+ flex: 70
15135
+ }, React__default.createElement(TextField$2, {
15136
+ value: characterName,
15137
+ id: "characterName",
15138
+ name: "characterName",
15139
+ onChange: function onChange(e) {
15140
+ setCharacterName(e.target.value);
15141
+ },
15142
+ height: 20,
15143
+ type: "text",
15144
+ autoComplete: "off",
15145
+ onFocus: onFocus,
15146
+ onBlur: onBlur,
15147
+ onPointerDown: onFocus,
15148
+ autoFocus: true
15149
+ })), React__default.createElement(Column, {
15150
+ justifyContent: "flex-end"
15151
+ }, React__default.createElement(Button, {
15152
+ type: "submit",
15153
+ buttonType: exports.ButtonTypes.RPGUIButton
15154
+ }, "Search"))), React__default.createElement(ListContainer$1, null, searchedCharacters.map(function (character) {
15155
+ return React__default.createElement(ListElement$3, {
15156
+ key: character._id
15157
+ }, React__default.createElement("p", null, character.name), React__default.createElement(Button, {
15158
+ buttonType: exports.ButtonTypes.RPGUIButton,
15159
+ onPointerDown: function onPointerDown() {
15160
+ return onSendFriendRequest(character);
15161
+ }
15162
+ }, "Add Friend"));
15163
+ })), React__default.createElement(FriendRequestTitle, null, "Friend Requests ", React__default.createElement("span", null, "(", friendRequests.length, ")")), friendRequests.length > 0 && React__default.createElement(ListContainer$1, null, friendRequests.map(function (character) {
15164
+ return React__default.createElement(ListElement$3, {
15165
+ key: character._id
15166
+ }, React__default.createElement("p", null, character.name), React__default.createElement(AcceptRejectButtonContainer, null, React__default.createElement(Button, {
15167
+ buttonType: exports.ButtonTypes.RPGUIButton,
15168
+ onPointerDown: function onPointerDown() {
15169
+ return onAcceptRequest(character);
15170
+ }
15171
+ }, "Accept"), React__default.createElement(Button, {
15172
+ buttonType: exports.ButtonTypes.RPGUIButton,
15173
+ onPointerDown: function onPointerDown() {
15174
+ return onRejectRequest(character);
15175
+ }
15176
+ }, "Reject")));
15177
+ })));
15178
+ };
15179
+ var Form$3 = /*#__PURE__*/styled.form.withConfig({
15180
+ displayName: "SearchFriend__Form",
15181
+ componentId: "sc-1lt1ols-0"
15182
+ })(["display:flex;width:100%;justify-content:center;align-items:center;margin-top:1rem;"]);
15183
+ var TextField$2 = /*#__PURE__*/styled.input.withConfig({
15184
+ displayName: "SearchFriend__TextField",
15185
+ componentId: "sc-1lt1ols-1"
15186
+ })(["width:100%;background-color:rgba(0,0,0,0.25) !important;border:none !important;max-height:28px !important;"]);
15187
+ var ListContainer$1 = /*#__PURE__*/styled.ul.withConfig({
15188
+ displayName: "SearchFriend__ListContainer",
15189
+ componentId: "sc-1lt1ols-2"
15190
+ })(["width:100%;c4height:50vh;border:none;overflow-y:scroll;list-style:none;padding:0;@media (max-width:768px){max-height:90wh;}"]);
15191
+ var ListElement$3 = /*#__PURE__*/styled.li.withConfig({
15192
+ displayName: "SearchFriend__ListElement",
15193
+ componentId: "sc-1lt1ols-3"
15194
+ })(["margin:0.5rem 0 !important;font-size:", ";padding:0.5rem 2px;display:flex;align-items:center;justify-content:space-between;"], uiFonts.size.small);
15195
+ var FriendRequestTitle = /*#__PURE__*/styled.h3.withConfig({
15196
+ displayName: "SearchFriend__FriendRequestTitle",
15197
+ componentId: "sc-1lt1ols-4"
15198
+ })(["font-size:", " !important;margin-top:0.5rem !important;text-align:center;gap:0.5rem;"], uiFonts.size.small);
15199
+ var AcceptRejectButtonContainer = /*#__PURE__*/styled.div.withConfig({
15200
+ displayName: "SearchFriend__AcceptRejectButtonContainer",
15201
+ componentId: "sc-1lt1ols-5"
15202
+ })(["display:flex;justify-content:space-between;gap:0.5rem;"]);
15203
+
15204
+ var FriendList = function FriendList(props) {
15205
+ var _useState = React.useState(false),
15206
+ isAddFriendUI = _useState[0],
15207
+ setIsAddFriendUI = _useState[1];
15208
+ var scale = props.scale,
15209
+ friends = props.friends,
15210
+ friendRequests = props.friendRequests,
15211
+ searchedCharacters = props.searchedCharacters,
15212
+ onBlur = props.onBlur,
15213
+ onFocus = props.onFocus,
15214
+ onClose = props.onClose,
15215
+ onSearch = props.onSearch,
15216
+ onAcceptRequest = props.onAcceptRequest,
15217
+ onSendFriendRequest = props.onSendFriendRequest,
15218
+ onRemoveFriend = props.onRemoveFriend,
15219
+ onOpenPrivateMessage = props.onOpenPrivateMessage,
15220
+ onRejectRequest = props.onRejectRequest;
15221
+ return React__default.createElement(DraggableContainer, {
15222
+ type: exports.RPGUIContainerTypes.Framed,
15223
+ onCloseButton: function onCloseButton() {
15224
+ if (onClose) onClose();
15225
+ },
15226
+ width: "800px",
15227
+ cancelDrag: "#FriendListContainer, .rpgui-dropdown-imp, input, .empty-slot, button",
15228
+ scale: scale
15229
+ }, isAddFriendUI ? React__default.createElement(SearchFriend, {
15230
+ searchedCharacters: searchedCharacters,
15231
+ onSendFriendRequest: onSendFriendRequest,
15232
+ onAcceptRequest: onAcceptRequest,
15233
+ onRejectRequest: onRejectRequest,
15234
+ friendRequests: friendRequests,
15235
+ onSearch: onSearch,
15236
+ onBlur: onBlur,
15237
+ onFocus: onFocus
15238
+ }) : React__default.createElement(ListContainer$2, null, React__default.createElement(FriendsTitle, null, "Friends"), friends.map(function (friend) {
15239
+ return React__default.createElement(ListElement$4, {
15240
+ key: friend._id
15241
+ }, React__default.createElement("div", null, React__default.createElement(IsOnlineBadge, {
15242
+ "$isOnline": friend.isOnline
15243
+ }), friend.name), React__default.createElement(MessageAndDeleteContainer, null, React__default.createElement(Button, {
15244
+ buttonType: exports.ButtonTypes.RPGUIButton,
15245
+ onPointerDown: function onPointerDown() {
15246
+ return onOpenPrivateMessage(friend);
15247
+ }
15248
+ }, "Message"), React__default.createElement(Button, {
15249
+ buttonType: exports.ButtonTypes.RPGUIButton,
15250
+ onPointerDown: function onPointerDown() {
15251
+ return onRemoveFriend(friend);
15252
+ }
15253
+ }, "Remove")));
15254
+ })), React__default.createElement(ButtonContainer$1, null, React__default.createElement(Button, {
15255
+ buttonType: exports.ButtonTypes.RPGUIButton,
15256
+ onClick: function onClick() {
15257
+ return setIsAddFriendUI(function (t) {
15258
+ return !t;
15259
+ });
15260
+ }
15261
+ }, isAddFriendUI ? 'Back' : 'Add New Friend')));
15262
+ };
15263
+ var FriendsTitle = /*#__PURE__*/styled.h2.withConfig({
15264
+ displayName: "FriendList__FriendsTitle",
15265
+ componentId: "sc-3jf9vt-0"
15266
+ })(["font-size:", ";margin:0;padding:0;text-align:center;"], uiFonts.size.medium);
15267
+ var ListContainer$2 = /*#__PURE__*/styled.ul.withConfig({
15268
+ displayName: "FriendList__ListContainer",
15269
+ componentId: "sc-3jf9vt-1"
15270
+ })(["border:none;overflow-y:scroll;list-style:none;padding:0;width:100%;height:50vh;@media (max-width:768px){max-height:90wh;}"]);
15271
+ var ListElement$4 = /*#__PURE__*/styled.li.withConfig({
15272
+ displayName: "FriendList__ListElement",
15273
+ componentId: "sc-3jf9vt-2"
15274
+ })(["margin:0.5rem 0 !important;font-size:", ";padding:0.5rem 4px;display:flex;align-items:center;justify-content:space-between;border-radius:4px;& div{display:flex;align-items:center;}"], uiFonts.size.small);
15275
+ var IsOnlineBadge = /*#__PURE__*/styled.div.withConfig({
15276
+ displayName: "FriendList__IsOnlineBadge",
15277
+ componentId: "sc-3jf9vt-3"
15278
+ })(["width:10px;height:10px;border-radius:50%;background-color:", ";margin-right:1rem;"], function (_ref) {
15279
+ var $isOnline = _ref.$isOnline;
15280
+ return $isOnline ? uiColors.lightGreen : uiColors.red;
15281
+ });
15282
+ var ButtonContainer$1 = /*#__PURE__*/styled.div.withConfig({
15283
+ displayName: "FriendList__ButtonContainer",
15284
+ componentId: "sc-3jf9vt-4"
15285
+ })(["display:flex;justify-content:center;align-items:center;width:100%;margin-top:1rem;"]);
15286
+ var MessageAndDeleteContainer = /*#__PURE__*/styled.div.withConfig({
15287
+ displayName: "FriendList__MessageAndDeleteContainer",
15288
+ componentId: "sc-3jf9vt-5"
15289
+ })(["display:flex;justify-content:space-between;gap:0.5rem;"]);
15290
+
15117
15291
  var IS_MOBILE_OR_TABLET = /*#__PURE__*/shared.isMobileOrTablet();
15118
15292
 
15119
15293
  var chunkString = function chunkString(str, length) {
@@ -16419,7 +16593,7 @@ var ListMenu = function ListMenu(_ref) {
16419
16593
  overflow: 'hidden'
16420
16594
  }
16421
16595
  }, options.map(function (params, index) {
16422
- return React__default.createElement(ListElement$3, {
16596
+ return React__default.createElement(ListElement$5, {
16423
16597
  key: (params == null ? void 0 : params.id) || index,
16424
16598
  onPointerDown: function onPointerDown() {
16425
16599
  onSelected(params == null ? void 0 : params.id);
@@ -16435,7 +16609,7 @@ var Container$k = /*#__PURE__*/styled.div.withConfig({
16435
16609
  }, function (props) {
16436
16610
  return props.x || 0;
16437
16611
  }, uiFonts.size.xsmall);
16438
- var ListElement$3 = /*#__PURE__*/styled.li.withConfig({
16612
+ var ListElement$5 = /*#__PURE__*/styled.li.withConfig({
16439
16613
  displayName: "ListMenu__ListElement",
16440
16614
  componentId: "sc-i9097t-1"
16441
16615
  })(["margin-right:0.5rem;"]);
@@ -16550,7 +16724,7 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
16550
16724
  maxLines: 1,
16551
16725
  maxWidth: "200px",
16552
16726
  fontSize: "10px"
16553
- }, "$", itemPrice)))), React__default.createElement(ButtonContainer$1, null, React__default.createElement(Button, {
16727
+ }, "$", itemPrice)))), React__default.createElement(ButtonContainer$2, null, React__default.createElement(Button, {
16554
16728
  buttonType: exports.ButtonTypes.RPGUIButton,
16555
16729
  disabled: disabled,
16556
16730
  onPointerDown: function onPointerDown() {
@@ -16588,7 +16762,7 @@ var PriceValue = /*#__PURE__*/styled.div.withConfig({
16588
16762
  displayName: "MarketplaceRows__PriceValue",
16589
16763
  componentId: "sc-wmpr1o-6"
16590
16764
  })(["margin-left:40px;"]);
16591
- var ButtonContainer$1 = /*#__PURE__*/styled.div.withConfig({
16765
+ var ButtonContainer$2 = /*#__PURE__*/styled.div.withConfig({
16592
16766
  displayName: "MarketplaceRows__ButtonContainer",
16593
16767
  componentId: "sc-wmpr1o-7"
16594
16768
  })(["margin:auto;"]);
@@ -18955,6 +19129,7 @@ exports.DynamicText = DynamicText;
18955
19129
  exports.EquipmentSet = EquipmentSet;
18956
19130
  exports.EquipmentSlotSpriteByType = EquipmentSlotSpriteByType;
18957
19131
  exports.ErrorBoundary = ErrorBoundary;
19132
+ exports.FriendList = FriendList;
18958
19133
  exports.HistoryDialog = HistoryDialog;
18959
19134
  exports.ImageCarousel = ImageCarousel;
18960
19135
  exports.Input = Input;