@rpg-engine/long-bow 0.6.66 → 0.6.69

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,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { ICharacter } from '@rpg-engine/shared';
3
3
  export declare type IFriend = Pick<ICharacter, 'name' | '_id' | 'isOnline'>;
4
4
  interface IFriendListProps {
@@ -15,6 +15,8 @@ interface IFriendListProps {
15
15
  onSearch: (characterName: string) => void;
16
16
  onAcceptRequest: (character: IFriend) => void;
17
17
  onRejectRequest: (character: IFriend) => void;
18
+ onAddFriend?: () => void;
19
+ onBackFriendList?: () => void;
18
20
  }
19
- export declare const FriendList: (props: IFriendListProps) => JSX.Element;
21
+ export declare const FriendList: React.FC<IFriendListProps>;
20
22
  export {};
@@ -0,0 +1,5 @@
1
+ export declare const Table: import("styled-components").StyledComponent<"table", any, {}, never>;
2
+ export declare const TableRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
3
+ export declare const TableHeader: import("styled-components").StyledComponent<"th", any, {}, never>;
4
+ export declare const TableCell: import("styled-components").StyledComponent<"td", any, {}, never>;
5
+ export declare const ActionButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
package/dist/index.d.ts CHANGED
@@ -52,4 +52,5 @@ export * from './components/TradingMenu/TradingMenu';
52
52
  export * from './components/Truncate';
53
53
  export * from './components/Tutorial/TutorialStepper';
54
54
  export * from './components/typography/DynamicText';
55
+ export * from './components/Table/Table';
55
56
  export { useEventListener } from './hooks/useEventListener';
@@ -28787,6 +28787,27 @@ var EquipmentColumn = /*#__PURE__*/styled__default.div.withConfig({
28787
28787
  componentId: "sc-1wuddg2-1"
28788
28788
  })(["display:flex;justify-content:center;flex-wrap:wrap;flex-direction:column;touch-action:none;"]);
28789
28789
 
28790
+ var Table = /*#__PURE__*/styled__default.table.withConfig({
28791
+ displayName: "Table",
28792
+ componentId: "sc-1c24pcj-0"
28793
+ })(["width:100%;border-collapse:collapse;margin-top:1rem;"]);
28794
+ var TableRow = /*#__PURE__*/styled__default.tr.withConfig({
28795
+ displayName: "Table__TableRow",
28796
+ componentId: "sc-1c24pcj-1"
28797
+ })(["&:nth-child(even){background-color:rgba(255,255,255,0.05) !important;}"]);
28798
+ var TableHeader = /*#__PURE__*/styled__default.th.withConfig({
28799
+ displayName: "Table__TableHeader",
28800
+ componentId: "sc-1c24pcj-2"
28801
+ })(["text-align:left;padding:0.5rem;color:", " !important;border-bottom:1px solid ", ";"], uiColors.yellow, uiColors.lightGray);
28802
+ var TableCell = /*#__PURE__*/styled__default.td.withConfig({
28803
+ displayName: "Table__TableCell",
28804
+ componentId: "sc-1c24pcj-3"
28805
+ })(["padding:0.5rem;color:", ";border-bottom:1px solid ", ";"], uiColors.white, uiColors.lightGray);
28806
+ var ActionButtons = /*#__PURE__*/styled__default.div.withConfig({
28807
+ displayName: "Table__ActionButtons",
28808
+ componentId: "sc-1c24pcj-4"
28809
+ })(["display:flex;gap:10px;align-items:center;"]);
28810
+
28790
28811
  var SearchFriend = function SearchFriend(props) {
28791
28812
  var searchedCharacters = props.searchedCharacters,
28792
28813
  friendRequests = props.friendRequests,
@@ -28877,32 +28898,31 @@ var AcceptRejectButtonContainer = /*#__PURE__*/styled__default.div.withConfig({
28877
28898
  componentId: "sc-1lt1ols-5"
28878
28899
  })(["display:flex;justify-content:space-between;gap:0.5rem;"]);
28879
28900
 
28880
- var FriendList = function FriendList(props) {
28901
+ var FriendList = function FriendList(_ref) {
28902
+ var friends = _ref.friends,
28903
+ friendRequests = _ref.friendRequests,
28904
+ searchedCharacters = _ref.searchedCharacters,
28905
+ onFocus = _ref.onFocus,
28906
+ onBlur = _ref.onBlur,
28907
+ onSearch = _ref.onSearch,
28908
+ onAcceptRequest = _ref.onAcceptRequest,
28909
+ onSendFriendRequest = _ref.onSendFriendRequest,
28910
+ onRemoveFriend = _ref.onRemoveFriend,
28911
+ onOpenPrivateMessage = _ref.onOpenPrivateMessage,
28912
+ onRejectRequest = _ref.onRejectRequest,
28913
+ onAddFriend = _ref.onAddFriend,
28914
+ onBackFriendList = _ref.onBackFriendList;
28881
28915
  var _useState = React.useState(false),
28882
28916
  isAddFriendUI = _useState[0],
28883
28917
  setIsAddFriendUI = _useState[1];
28884
- var scale = props.scale,
28885
- friends = props.friends,
28886
- friendRequests = props.friendRequests,
28887
- searchedCharacters = props.searchedCharacters,
28888
- onBlur = props.onBlur,
28889
- onFocus = props.onFocus,
28890
- onClose = props.onClose,
28891
- onSearch = props.onSearch,
28892
- onAcceptRequest = props.onAcceptRequest,
28893
- onSendFriendRequest = props.onSendFriendRequest,
28894
- onRemoveFriend = props.onRemoveFriend,
28895
- onOpenPrivateMessage = props.onOpenPrivateMessage,
28896
- onRejectRequest = props.onRejectRequest;
28897
- return React__default.createElement(DraggableContainer, {
28898
- type: exports.RPGUIContainerTypes.Framed,
28899
- onCloseButton: function onCloseButton() {
28900
- if (onClose) onClose();
28901
- },
28902
- width: "800px",
28903
- cancelDrag: "#FriendListContainer, .rpgui-dropdown-imp, input, .empty-slot, button",
28904
- scale: scale
28905
- }, isAddFriendUI ? React__default.createElement(SearchFriend, {
28918
+ React.useEffect(function () {
28919
+ if (isAddFriendUI) {
28920
+ onAddFriend == null ? void 0 : onAddFriend();
28921
+ } else {
28922
+ onBackFriendList == null ? void 0 : onBackFriendList();
28923
+ }
28924
+ }, [isAddFriendUI]);
28925
+ return React__default.createElement(ListWrapper, null, isAddFriendUI ? React__default.createElement(SearchFriend, {
28906
28926
  searchedCharacters: searchedCharacters,
28907
28927
  onSendFriendRequest: onSendFriendRequest,
28908
28928
  onAcceptRequest: onAcceptRequest,
@@ -28911,58 +28931,58 @@ var FriendList = function FriendList(props) {
28911
28931
  onSearch: onSearch,
28912
28932
  onBlur: onBlur,
28913
28933
  onFocus: onFocus
28914
- }) : React__default.createElement(ListContainer$2, null, React__default.createElement(FriendsTitle, null, "Friends"), friends.map(function (friend) {
28915
- return React__default.createElement(ListElement$4, {
28934
+ }) : React__default.createElement(React__default.Fragment, null, React__default.createElement(ScrollableArea, null, React__default.createElement(Table, null, React__default.createElement("thead", null, React__default.createElement(TableRow, null, React__default.createElement(TableHeader, null, "Online"), React__default.createElement(TableHeader, null, "Name"), React__default.createElement(TableHeader, null, "Actions"))), React__default.createElement("tbody", null, friends.map(function (friend) {
28935
+ return React__default.createElement(TableRow, {
28916
28936
  key: friend._id
28917
- }, React__default.createElement("div", null, React__default.createElement(IsOnlineBadge, {
28937
+ }, React__default.createElement(TableCell, null, React__default.createElement(IsOnlineBadge, {
28918
28938
  "$isOnline": friend.isOnline
28919
- }), friend.name), React__default.createElement(MessageAndDeleteContainer, null, React__default.createElement(Button, {
28920
- buttonType: exports.ButtonTypes.RPGUIButton,
28921
- onPointerDown: function onPointerDown() {
28939
+ })), React__default.createElement(TableCell, null, friend.name), React__default.createElement(TableCell, null, React__default.createElement(ActionButtons, null, React__default.createElement(UserAction, {
28940
+ color: uiColors.yellow,
28941
+ onClick: function onClick() {
28922
28942
  return onOpenPrivateMessage(friend);
28923
28943
  }
28924
- }, "Message"), React__default.createElement(Button, {
28925
- buttonType: exports.ButtonTypes.RPGUIButton,
28926
- onPointerDown: function onPointerDown() {
28944
+ }, "Chat"), React__default.createElement(UserAction, {
28945
+ color: uiColors.red,
28946
+ onClick: function onClick() {
28927
28947
  return onRemoveFriend(friend);
28928
28948
  }
28929
- }, "Remove")));
28930
- })), React__default.createElement(ButtonContainer$1, null, React__default.createElement(Button, {
28949
+ }, "Remove"))));
28950
+ }))))), React__default.createElement(ButtonContainer$1, null, React__default.createElement(Button, {
28931
28951
  buttonType: exports.ButtonTypes.RPGUIButton,
28932
28952
  onClick: function onClick() {
28933
- return setIsAddFriendUI(function (t) {
28934
- return !t;
28953
+ return setIsAddFriendUI(function (prev) {
28954
+ return !prev;
28935
28955
  });
28936
28956
  }
28937
28957
  }, isAddFriendUI ? 'Back' : 'Add New Friend')));
28938
28958
  };
28939
- var FriendsTitle = /*#__PURE__*/styled__default.h2.withConfig({
28940
- displayName: "FriendList__FriendsTitle",
28959
+ // Styled components for FriendList UI
28960
+ var ListWrapper = /*#__PURE__*/styled__default.div.withConfig({
28961
+ displayName: "FriendList__ListWrapper",
28941
28962
  componentId: "sc-3jf9vt-0"
28942
- })(["font-size:", ";margin:0;padding:0;text-align:center;"], uiFonts.size.medium);
28943
- var ListContainer$2 = /*#__PURE__*/styled__default.ul.withConfig({
28944
- displayName: "FriendList__ListContainer",
28963
+ })(["margin-top:1rem;max-height:350px;display:flex;flex-direction:column;"]);
28964
+ var ScrollableArea = /*#__PURE__*/styled__default.div.withConfig({
28965
+ displayName: "FriendList__ScrollableArea",
28945
28966
  componentId: "sc-3jf9vt-1"
28946
- })(["border:none;overflow-y:scroll;list-style:none;padding:0;width:100%;height:50vh;@media (max-width:768px){max-height:90wh;}"]);
28947
- var ListElement$4 = /*#__PURE__*/styled__default.li.withConfig({
28948
- displayName: "FriendList__ListElement",
28949
- componentId: "sc-3jf9vt-2"
28950
- })(["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);
28967
+ })(["overflow-y:auto;max-height:300px;"]);
28951
28968
  var IsOnlineBadge = /*#__PURE__*/styled__default.div.withConfig({
28952
28969
  displayName: "FriendList__IsOnlineBadge",
28953
- componentId: "sc-3jf9vt-3"
28954
- })(["width:10px;height:10px;border-radius:50%;background-color:", ";margin-right:1rem;"], function (_ref) {
28955
- var $isOnline = _ref.$isOnline;
28970
+ componentId: "sc-3jf9vt-2"
28971
+ })(["width:10px;height:10px;border-radius:50%;background-color:", ";margin-right:1rem;"], function (_ref2) {
28972
+ var $isOnline = _ref2.$isOnline;
28956
28973
  return $isOnline ? uiColors.lightGreen : uiColors.red;
28957
28974
  });
28958
28975
  var ButtonContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
28959
28976
  displayName: "FriendList__ButtonContainer",
28960
- componentId: "sc-3jf9vt-4"
28977
+ componentId: "sc-3jf9vt-3"
28961
28978
  })(["display:flex;justify-content:center;align-items:center;width:100%;margin-top:1rem;"]);
28962
- var MessageAndDeleteContainer = /*#__PURE__*/styled__default.div.withConfig({
28963
- displayName: "FriendList__MessageAndDeleteContainer",
28964
- componentId: "sc-3jf9vt-5"
28965
- })(["display:flex;justify-content:space-between;gap:0.5rem;"]);
28979
+ var UserAction = /*#__PURE__*/styled__default.span.withConfig({
28980
+ displayName: "FriendList__UserAction",
28981
+ componentId: "sc-3jf9vt-4"
28982
+ })(["color:", " !important;cursor:pointer;margin-right:0.5rem;&:hover{text-decoration:underline;}"], function (_ref3) {
28983
+ var color = _ref3.color;
28984
+ return color;
28985
+ });
28966
28986
 
28967
28987
  var IS_MOBILE_OR_TABLET = /*#__PURE__*/shared.isMobileOrTablet();
28968
28988
 
@@ -30475,7 +30495,7 @@ var ListMenu = function ListMenu(_ref) {
30475
30495
  overflow: 'hidden'
30476
30496
  }
30477
30497
  }, options.map(function (params, index) {
30478
- return React__default.createElement(ListElement$5, {
30498
+ return React__default.createElement(ListElement$4, {
30479
30499
  key: (params == null ? void 0 : params.id) || index,
30480
30500
  onPointerDown: function onPointerDown() {
30481
30501
  onSelected(params == null ? void 0 : params.id);
@@ -30491,7 +30511,7 @@ var Container$l = /*#__PURE__*/styled__default.div.withConfig({
30491
30511
  }, function (props) {
30492
30512
  return props.x || 0;
30493
30513
  }, uiFonts.size.xsmall);
30494
- var ListElement$5 = /*#__PURE__*/styled__default.li.withConfig({
30514
+ var ListElement$4 = /*#__PURE__*/styled__default.li.withConfig({
30495
30515
  displayName: "ListMenu__ListElement",
30496
30516
  componentId: "sc-i9097t-1"
30497
30517
  })(["margin-right:0.5rem;"]);
@@ -33428,6 +33448,7 @@ var LessonContainer = /*#__PURE__*/styled__default.div.withConfig({
33428
33448
  componentId: "sc-7tgzv2-6"
33429
33449
  })(["display:flex;flex-direction:column;justify-content:space-between;min-height:200px;p{font-size:0.7rem !important;}"]);
33430
33450
 
33451
+ exports.ActionButtons = ActionButtons;
33431
33452
  exports.AsyncDropdown = AsyncDropdown;
33432
33453
  exports.Button = Button;
33433
33454
  exports.CharacterSelection = CharacterSelection;
@@ -33482,6 +33503,10 @@ exports.Spellbook = Spellbook;
33482
33503
  exports.SpriteFromAtlas = SpriteFromAtlas;
33483
33504
  exports.Stepper = Stepper;
33484
33505
  exports.TabBody = TabBody;
33506
+ exports.Table = Table;
33507
+ exports.TableCell = TableCell;
33508
+ exports.TableHeader = TableHeader;
33509
+ exports.TableRow = TableRow;
33485
33510
  exports.TableTab = TableTab;
33486
33511
  exports.TabsContainer = TabsContainer;
33487
33512
  exports.TextArea = TextArea;