sceyt-chat-react-uikit 1.7.6-beta.17 → 1.7.6-beta.19

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.
Files changed (3) hide show
  1. package/index.js +138 -15
  2. package/index.modern.js +138 -15
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -21685,7 +21685,7 @@ function addMembers(action) {
21685
21685
  m: membersIds
21686
21686
  },
21687
21687
  body: 'AM',
21688
- mentionedUsers: addedMembers,
21688
+ mentionedUsers: getDisableFrowardMentionsCount() ? [] : addedMembers,
21689
21689
  attachments: [],
21690
21690
  type: 'system'
21691
21691
  };
@@ -23833,6 +23833,12 @@ var Channel = function Channel(_ref3) {
23833
23833
  var isTypeValid = React.useCallback(function (type) {
23834
23834
  return !doNotShowMessageDeliveryTypes.includes(type);
23835
23835
  }, [doNotShowMessageDeliveryTypes]);
23836
+ var handleDragEnter = React.useCallback(function (e) {
23837
+ if (e.dataTransfer.types.includes('Files') && activeChannel.id !== channel.id) {
23838
+ e.preventDefault();
23839
+ setSelectedChannel(channel);
23840
+ }
23841
+ }, [channel, activeChannel.id, setSelectedChannel]);
23836
23842
  return /*#__PURE__*/React__default.createElement(Container$3, {
23837
23843
  theme: theme,
23838
23844
  selectedChannel: channel.id === activeChannel.id,
@@ -23845,6 +23851,7 @@ var Channel = function Channel(_ref3) {
23845
23851
  onClick: function onClick() {
23846
23852
  return setSelectedChannel(channel);
23847
23853
  },
23854
+ onDragEnter: handleDragEnter,
23848
23855
  hoverBackground: channelHoverBackground || backgroundHovered
23849
23856
  }, showAvatar && (/*#__PURE__*/React__default.createElement(AvatarWrapper, null, /*#__PURE__*/React__default.createElement(Avatar, {
23850
23857
  name: avatarName,
@@ -23912,7 +23919,7 @@ var Channel = function Channel(_ref3) {
23912
23919
  color: textPrimary
23913
23920
  }, /*#__PURE__*/React__default.createElement("span", {
23914
23921
  ref: messageAuthorRef
23915
- }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id)) : ((typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording)) && draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== 'system') && (/*#__PURE__*/React__default.createElement(Points, {
23922
+ }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id)) : draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== 'system') && (/*#__PURE__*/React__default.createElement(Points, {
23916
23923
  color: draftMessageText && warningColor || textPrimary
23917
23924
  }, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
23918
23925
  color: textSecondary,
@@ -23998,7 +24005,7 @@ var Container$3 = styled__default.div(_templateObject6$2 || (_templateObject6$2
23998
24005
  }, UserStatus, function (props) {
23999
24006
  return props.selectedChannel && "\n border-color: " + props.selectedBackgroundColor + ";\n ";
24000
24007
  });
24001
- var DraftMessageTitle = styled__default.span(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n"])), function (props) {
24008
+ var DraftMessageTitle = styled__default.span(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n margin-right: 4px;\n"])), function (props) {
24002
24009
  return props.color;
24003
24010
  });
24004
24011
  var DraftMessageText = styled__default.span(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"])), function (props) {
@@ -28812,6 +28819,7 @@ var Message = function Message(_ref) {
28812
28819
  }
28813
28820
  }, [connectionStatus]);
28814
28821
  return /*#__PURE__*/React__default.createElement(Container$c, {
28822
+ id: message.id || message.tid,
28815
28823
  ref: messageItemRef,
28816
28824
  marginTop: differentUserMessageSpacing || '16px',
28817
28825
  marginBottom: nextMessage && nextMessage.type !== exports.MESSAGE_TYPE.SYSTEM ? differentUserMessageSpacing || '16px' : '',
@@ -35825,6 +35833,13 @@ var MessageInfo = function MessageInfo(_ref) {
35825
35833
  var _useState7 = React.useState(false),
35826
35834
  flipLocked = _useState7[0],
35827
35835
  setFlipLocked = _useState7[1];
35836
+ var _useState8 = React.useState(8),
35837
+ verticalOffset = _useState8[0],
35838
+ setVerticalOffset = _useState8[1];
35839
+ var _useState9 = React.useState(0),
35840
+ transformY = _useState9[0],
35841
+ setTransformY = _useState9[1];
35842
+ var initializingRef = React.useRef(true);
35828
35843
  var getFromContacts = React.useMemo(function () {
35829
35844
  return getShowOnlyContactUsers();
35830
35845
  }, []);
@@ -35913,23 +35928,57 @@ var MessageInfo = function MessageInfo(_ref) {
35913
35928
  var availableAbove = anchorRect.top - containerRect.top - 8;
35914
35929
  var nextFlip = Boolean(flipTarget > availableBelow && flipTarget <= availableAbove);
35915
35930
  setFlipAbove(nextFlip);
35931
+ var offset = 8;
35932
+ var transform = 0;
35933
+ if (nextFlip) {
35934
+ var naturalPopupBottom = anchorRect.top - offset;
35935
+ var naturalPopupTop = naturalPopupBottom - flipTarget;
35936
+ if (naturalPopupTop < containerRect.top) {
35937
+ transform = containerRect.top - naturalPopupTop;
35938
+ } else if (naturalPopupBottom > containerRect.bottom) {
35939
+ transform = containerRect.bottom - naturalPopupBottom;
35940
+ }
35941
+ } else {
35942
+ var _naturalPopupTop = anchorRect.bottom + offset;
35943
+ var _naturalPopupBottom = _naturalPopupTop + flipTarget;
35944
+ if (_naturalPopupBottom > containerRect.bottom) {
35945
+ transform = containerRect.bottom - _naturalPopupBottom;
35946
+ } else if (_naturalPopupTop < containerRect.top) {
35947
+ transform = containerRect.top - _naturalPopupTop;
35948
+ }
35949
+ }
35950
+ setVerticalOffset(offset);
35951
+ setTransformY(transform);
35916
35952
  }
35917
35953
  setIsTransitioning(true);
35918
35954
  setOpen(true);
35919
35955
  setReady(true);
35920
35956
  setFlipLocked(true);
35957
+ setTimeout(function () {
35958
+ initializingRef.current = false;
35959
+ }, 150);
35921
35960
  }, []);
35922
35961
  React.useEffect(function () {
35962
+ if (!open) {
35963
+ initializingRef.current = true;
35964
+ }
35965
+ }, [open]);
35966
+ React.useEffect(function () {
35967
+ if (!open || !ready) return;
35923
35968
  var onDown = function onDown(e) {
35969
+ if (initializingRef.current) return;
35924
35970
  if (rootRef.current && !rootRef.current.contains(e.target)) {
35925
35971
  togglePopup();
35926
35972
  }
35927
35973
  };
35928
- document.addEventListener('mousedown', onDown);
35974
+ var timeoutId = setTimeout(function () {
35975
+ document.addEventListener('mousedown', onDown);
35976
+ }, 100);
35929
35977
  return function () {
35978
+ clearTimeout(timeoutId);
35930
35979
  document.removeEventListener('mousedown', onDown);
35931
35980
  };
35932
- }, []);
35981
+ }, [open, ready, togglePopup]);
35933
35982
  React.useEffect(function () {
35934
35983
  var container = document.getElementById('scrollableDiv');
35935
35984
  if (!container) return;
@@ -35949,16 +35998,48 @@ var MessageInfo = function MessageInfo(_ref) {
35949
35998
  var availableAbove = anchorRect.top - containerRect.top - 8;
35950
35999
  var overflowBelow = dropdownHeight > availableBelow;
35951
36000
  var overflowAbove = dropdownHeight > availableAbove;
36001
+ var nextFlip = flipAbove;
35952
36002
  if (!isTransitioning && !flipLocked) {
35953
36003
  setFlipAbove(function (prev) {
35954
36004
  if (prev) {
35955
- if (overflowAbove && !overflowBelow) return false;
36005
+ if (overflowAbove && !overflowBelow) {
36006
+ nextFlip = false;
36007
+ return false;
36008
+ }
36009
+ nextFlip = true;
35956
36010
  return true;
35957
36011
  }
35958
- if (overflowBelow && !overflowAbove) return true;
36012
+ if (overflowBelow && !overflowAbove) {
36013
+ nextFlip = true;
36014
+ return true;
36015
+ }
36016
+ nextFlip = false;
35959
36017
  return false;
35960
36018
  });
36019
+ } else {
36020
+ nextFlip = flipAbove;
36021
+ }
36022
+ var offset = 8;
36023
+ var transform = 0;
36024
+ if (nextFlip) {
36025
+ var naturalPopupBottom = anchorRect.top - offset;
36026
+ var naturalPopupTop = naturalPopupBottom - dropdownHeight;
36027
+ if (naturalPopupTop < containerRect.top) {
36028
+ transform = containerRect.top - naturalPopupTop;
36029
+ } else if (naturalPopupBottom > containerRect.bottom) {
36030
+ transform = containerRect.bottom - naturalPopupBottom;
36031
+ }
36032
+ } else {
36033
+ var _naturalPopupTop2 = anchorRect.bottom + offset;
36034
+ var _naturalPopupBottom2 = _naturalPopupTop2 + dropdownHeight;
36035
+ if (_naturalPopupBottom2 > containerRect.bottom) {
36036
+ transform = containerRect.bottom - _naturalPopupBottom2;
36037
+ } else if (_naturalPopupTop2 < containerRect.top) {
36038
+ transform = containerRect.top - _naturalPopupTop2;
36039
+ }
35961
36040
  }
36041
+ setVerticalOffset(offset);
36042
+ setTransformY(transform);
35962
36043
  };
35963
36044
  if (open) {
35964
36045
  recalc();
@@ -35988,7 +36069,7 @@ var MessageInfo = function MessageInfo(_ref) {
35988
36069
  window.removeEventListener('resize', recalc);
35989
36070
  };
35990
36071
  }
35991
- }, [open, ready, message.id, panelHeightPx, isTransitioning, flipLocked, height]);
36072
+ }, [open, ready, message.id, panelHeightPx, isTransitioning, flipLocked, height, flipAbove, messagesMarkersLoadingState]);
35992
36073
  React.useLayoutEffect(function () {
35993
36074
  var _rootRef$current2;
35994
36075
  var container = document.getElementById('scrollableDiv');
@@ -36014,23 +36095,53 @@ var MessageInfo = function MessageInfo(_ref) {
36014
36095
  var availableBelow = containerRect.bottom - anchorRect.bottom - 8;
36015
36096
  var availableAbove = anchorRect.top - containerRect.top - 8;
36016
36097
  setFlipLocked(true);
36098
+ var currentFlip = flipAbove;
36017
36099
  if (messagesMarkersLoadingState !== LOADING_STATE.LOADING) {
36018
36100
  var overflowBelow = nextHeight > availableBelow;
36019
36101
  var overflowAbove = nextHeight > availableAbove;
36020
36102
  setFlipAbove(function (prev) {
36021
36103
  if (prev) {
36022
- if (overflowAbove && !overflowBelow) return false;
36104
+ if (overflowAbove && !overflowBelow) {
36105
+ currentFlip = false;
36106
+ return false;
36107
+ }
36108
+ currentFlip = true;
36023
36109
  return true;
36024
36110
  }
36025
- if (overflowBelow && !overflowAbove) return true;
36111
+ if (overflowBelow && !overflowAbove) {
36112
+ currentFlip = true;
36113
+ return true;
36114
+ }
36115
+ currentFlip = false;
36026
36116
  return false;
36027
36117
  });
36028
36118
  }
36119
+ var offset = 8;
36120
+ var transform = 0;
36121
+ if (currentFlip) {
36122
+ var naturalPopupBottom = anchorRect.top - offset;
36123
+ var naturalPopupTop = naturalPopupBottom - nextHeight;
36124
+ if (naturalPopupTop < containerRect.top) {
36125
+ transform = containerRect.top - naturalPopupTop;
36126
+ } else if (naturalPopupBottom > containerRect.bottom) {
36127
+ transform = containerRect.bottom - naturalPopupBottom;
36128
+ }
36129
+ } else {
36130
+ var _naturalPopupTop3 = anchorRect.bottom + offset;
36131
+ var _naturalPopupBottom3 = _naturalPopupTop3 + nextHeight;
36132
+ if (_naturalPopupBottom3 > containerRect.bottom) {
36133
+ transform = containerRect.bottom - _naturalPopupBottom3;
36134
+ } else if (_naturalPopupTop3 < containerRect.top) {
36135
+ transform = containerRect.top - _naturalPopupTop3;
36136
+ }
36137
+ }
36138
+ setVerticalOffset(offset);
36139
+ setTransformY(transform);
36029
36140
  if (panelHeightPx !== nextHeight) {
36030
36141
  setIsTransitioning(true);
36031
36142
  setPanelHeightPx(nextHeight);
36032
36143
  }
36033
- }, [ready, panelHeightPx, activeMarkers.length, messagesMarkersLoadingState, height]);
36144
+ }, [ready, panelHeightPx, activeMarkers.length, messagesMarkersLoadingState, height, flipAbove]);
36034
36145
  React.useEffect(function () {
36035
36146
  if (messagesMarkersLoadingState === LOADING_STATE.LOADING) {
36036
36147
  setFlipLocked(true);
@@ -36057,12 +36168,17 @@ var MessageInfo = function MessageInfo(_ref) {
36057
36168
  dispatch(getMessageMarkersAC(message.id, message.channelId, activeTab));
36058
36169
  }
36059
36170
  }, [activeTab, message.id, message.channelId]);
36171
+ if ((messagesMarkersLoadingState === LOADING_STATE.LOADING || messagesMarkersLoadingState == null) && !markers) {
36172
+ return null;
36173
+ }
36060
36174
  return /*#__PURE__*/React__default.createElement(DropdownRoot, {
36061
36175
  ref: rootRef,
36062
36176
  rtl: message.incoming,
36063
36177
  backgroundColor: backgroundSections,
36064
36178
  flip: flipAbove,
36065
- ready: ready
36179
+ ready: ready,
36180
+ verticalOffset: verticalOffset,
36181
+ transformY: transformY
36066
36182
  }, /*#__PURE__*/React__default.createElement(Panel, {
36067
36183
  ref: panelRef,
36068
36184
  bg: backgroundSections,
@@ -36132,12 +36248,14 @@ var RowDate = styled__default.div(_templateObject7$j || (_templateObject7$j = _t
36132
36248
  var Empty = styled__default.div(_templateObject8$h || (_templateObject8$h = _taggedTemplateLiteralLoose(["\n color: ", ";\n text-align: center;\n padding: 16px 0;\n font-size: 14px;\n height: calc(100% - 32px);\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n"])), function (p) {
36133
36249
  return p.color;
36134
36250
  });
36135
- var DropdownRoot = styled__default.div(_templateObject9$f || (_templateObject9$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n ", "\n z-index: 15;\n background: ", ";\n box-shadow: 0px 0px 24px 0px #11153929;\n border-radius: 16px;\n direction: initial;\n visibility: ", ";\n"])), function (p) {
36136
- return p.flip ? 'auto' : 'calc(100% + 8px)';
36251
+ var DropdownRoot = styled__default.div(_templateObject9$f || (_templateObject9$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n ", "\n transform: ", ";\n z-index: 15;\n background: ", ";\n box-shadow: 0px 0px 24px 0px #11153929;\n border-radius: 16px;\n direction: initial;\n visibility: ", ";\n"])), function (p) {
36252
+ return p.flip ? 'auto' : "calc(100% + " + p.verticalOffset + "px)";
36137
36253
  }, function (p) {
36138
- return p.flip ? 'calc(100% + 8px)' : 'auto';
36254
+ return p.flip ? "calc(100% + " + p.verticalOffset + "px)" : 'auto';
36139
36255
  }, function (p) {
36140
36256
  return p.rtl ? 'left: 4%;' : 'right: 4%;';
36257
+ }, function (p) {
36258
+ return p.transformY !== 0 ? "translateY(" + p.transformY + "px)" : 'none';
36141
36259
  }, function (_ref2) {
36142
36260
  var backgroundColor = _ref2.backgroundColor;
36143
36261
  return backgroundColor;
@@ -36605,6 +36723,11 @@ var Message$1 = function Message(_ref) {
36605
36723
  }
36606
36724
  }
36607
36725
  }, [isVisible, unreadScrollTo]);
36726
+ React.useEffect(function () {
36727
+ if (!isVisible && infoPopupOpen) {
36728
+ setInfoPopupOpen(false);
36729
+ }
36730
+ }, [isVisible, infoPopupOpen]);
36608
36731
  useDidUpdate(function () {
36609
36732
  if (tabIsActive) {
36610
36733
  handleSendReadMarker();
package/index.modern.js CHANGED
@@ -21684,7 +21684,7 @@ function addMembers(action) {
21684
21684
  m: membersIds
21685
21685
  },
21686
21686
  body: 'AM',
21687
- mentionedUsers: addedMembers,
21687
+ mentionedUsers: getDisableFrowardMentionsCount() ? [] : addedMembers,
21688
21688
  attachments: [],
21689
21689
  type: 'system'
21690
21690
  };
@@ -23832,6 +23832,12 @@ var Channel = function Channel(_ref3) {
23832
23832
  var isTypeValid = useCallback(function (type) {
23833
23833
  return !doNotShowMessageDeliveryTypes.includes(type);
23834
23834
  }, [doNotShowMessageDeliveryTypes]);
23835
+ var handleDragEnter = useCallback(function (e) {
23836
+ if (e.dataTransfer.types.includes('Files') && activeChannel.id !== channel.id) {
23837
+ e.preventDefault();
23838
+ setSelectedChannel(channel);
23839
+ }
23840
+ }, [channel, activeChannel.id, setSelectedChannel]);
23835
23841
  return /*#__PURE__*/React__default.createElement(Container$3, {
23836
23842
  theme: theme,
23837
23843
  selectedChannel: channel.id === activeChannel.id,
@@ -23844,6 +23850,7 @@ var Channel = function Channel(_ref3) {
23844
23850
  onClick: function onClick() {
23845
23851
  return setSelectedChannel(channel);
23846
23852
  },
23853
+ onDragEnter: handleDragEnter,
23847
23854
  hoverBackground: channelHoverBackground || backgroundHovered
23848
23855
  }, showAvatar && (/*#__PURE__*/React__default.createElement(AvatarWrapper, null, /*#__PURE__*/React__default.createElement(Avatar, {
23849
23856
  name: avatarName,
@@ -23911,7 +23918,7 @@ var Channel = function Channel(_ref3) {
23911
23918
  color: textPrimary
23912
23919
  }, /*#__PURE__*/React__default.createElement("span", {
23913
23920
  ref: messageAuthorRef
23914
- }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id)) : ((typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording)) && draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== 'system') && (/*#__PURE__*/React__default.createElement(Points, {
23921
+ }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id)) : draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== 'system') && (/*#__PURE__*/React__default.createElement(Points, {
23915
23922
  color: draftMessageText && warningColor || textPrimary
23916
23923
  }, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
23917
23924
  color: textSecondary,
@@ -23997,7 +24004,7 @@ var Container$3 = styled.div(_templateObject6$2 || (_templateObject6$2 = _tagged
23997
24004
  }, UserStatus, function (props) {
23998
24005
  return props.selectedChannel && "\n border-color: " + props.selectedBackgroundColor + ";\n ";
23999
24006
  });
24000
- var DraftMessageTitle = styled.span(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n"])), function (props) {
24007
+ var DraftMessageTitle = styled.span(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n margin-right: 4px;\n"])), function (props) {
24001
24008
  return props.color;
24002
24009
  });
24003
24010
  var DraftMessageText = styled.span(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"])), function (props) {
@@ -28811,6 +28818,7 @@ var Message = function Message(_ref) {
28811
28818
  }
28812
28819
  }, [connectionStatus]);
28813
28820
  return /*#__PURE__*/React__default.createElement(Container$c, {
28821
+ id: message.id || message.tid,
28814
28822
  ref: messageItemRef,
28815
28823
  marginTop: differentUserMessageSpacing || '16px',
28816
28824
  marginBottom: nextMessage && nextMessage.type !== MESSAGE_TYPE.SYSTEM ? differentUserMessageSpacing || '16px' : '',
@@ -35824,6 +35832,13 @@ var MessageInfo = function MessageInfo(_ref) {
35824
35832
  var _useState7 = useState(false),
35825
35833
  flipLocked = _useState7[0],
35826
35834
  setFlipLocked = _useState7[1];
35835
+ var _useState8 = useState(8),
35836
+ verticalOffset = _useState8[0],
35837
+ setVerticalOffset = _useState8[1];
35838
+ var _useState9 = useState(0),
35839
+ transformY = _useState9[0],
35840
+ setTransformY = _useState9[1];
35841
+ var initializingRef = useRef(true);
35827
35842
  var getFromContacts = useMemo(function () {
35828
35843
  return getShowOnlyContactUsers();
35829
35844
  }, []);
@@ -35912,23 +35927,57 @@ var MessageInfo = function MessageInfo(_ref) {
35912
35927
  var availableAbove = anchorRect.top - containerRect.top - 8;
35913
35928
  var nextFlip = Boolean(flipTarget > availableBelow && flipTarget <= availableAbove);
35914
35929
  setFlipAbove(nextFlip);
35930
+ var offset = 8;
35931
+ var transform = 0;
35932
+ if (nextFlip) {
35933
+ var naturalPopupBottom = anchorRect.top - offset;
35934
+ var naturalPopupTop = naturalPopupBottom - flipTarget;
35935
+ if (naturalPopupTop < containerRect.top) {
35936
+ transform = containerRect.top - naturalPopupTop;
35937
+ } else if (naturalPopupBottom > containerRect.bottom) {
35938
+ transform = containerRect.bottom - naturalPopupBottom;
35939
+ }
35940
+ } else {
35941
+ var _naturalPopupTop = anchorRect.bottom + offset;
35942
+ var _naturalPopupBottom = _naturalPopupTop + flipTarget;
35943
+ if (_naturalPopupBottom > containerRect.bottom) {
35944
+ transform = containerRect.bottom - _naturalPopupBottom;
35945
+ } else if (_naturalPopupTop < containerRect.top) {
35946
+ transform = containerRect.top - _naturalPopupTop;
35947
+ }
35948
+ }
35949
+ setVerticalOffset(offset);
35950
+ setTransformY(transform);
35915
35951
  }
35916
35952
  setIsTransitioning(true);
35917
35953
  setOpen(true);
35918
35954
  setReady(true);
35919
35955
  setFlipLocked(true);
35956
+ setTimeout(function () {
35957
+ initializingRef.current = false;
35958
+ }, 150);
35920
35959
  }, []);
35921
35960
  useEffect(function () {
35961
+ if (!open) {
35962
+ initializingRef.current = true;
35963
+ }
35964
+ }, [open]);
35965
+ useEffect(function () {
35966
+ if (!open || !ready) return;
35922
35967
  var onDown = function onDown(e) {
35968
+ if (initializingRef.current) return;
35923
35969
  if (rootRef.current && !rootRef.current.contains(e.target)) {
35924
35970
  togglePopup();
35925
35971
  }
35926
35972
  };
35927
- document.addEventListener('mousedown', onDown);
35973
+ var timeoutId = setTimeout(function () {
35974
+ document.addEventListener('mousedown', onDown);
35975
+ }, 100);
35928
35976
  return function () {
35977
+ clearTimeout(timeoutId);
35929
35978
  document.removeEventListener('mousedown', onDown);
35930
35979
  };
35931
- }, []);
35980
+ }, [open, ready, togglePopup]);
35932
35981
  useEffect(function () {
35933
35982
  var container = document.getElementById('scrollableDiv');
35934
35983
  if (!container) return;
@@ -35948,16 +35997,48 @@ var MessageInfo = function MessageInfo(_ref) {
35948
35997
  var availableAbove = anchorRect.top - containerRect.top - 8;
35949
35998
  var overflowBelow = dropdownHeight > availableBelow;
35950
35999
  var overflowAbove = dropdownHeight > availableAbove;
36000
+ var nextFlip = flipAbove;
35951
36001
  if (!isTransitioning && !flipLocked) {
35952
36002
  setFlipAbove(function (prev) {
35953
36003
  if (prev) {
35954
- if (overflowAbove && !overflowBelow) return false;
36004
+ if (overflowAbove && !overflowBelow) {
36005
+ nextFlip = false;
36006
+ return false;
36007
+ }
36008
+ nextFlip = true;
35955
36009
  return true;
35956
36010
  }
35957
- if (overflowBelow && !overflowAbove) return true;
36011
+ if (overflowBelow && !overflowAbove) {
36012
+ nextFlip = true;
36013
+ return true;
36014
+ }
36015
+ nextFlip = false;
35958
36016
  return false;
35959
36017
  });
36018
+ } else {
36019
+ nextFlip = flipAbove;
36020
+ }
36021
+ var offset = 8;
36022
+ var transform = 0;
36023
+ if (nextFlip) {
36024
+ var naturalPopupBottom = anchorRect.top - offset;
36025
+ var naturalPopupTop = naturalPopupBottom - dropdownHeight;
36026
+ if (naturalPopupTop < containerRect.top) {
36027
+ transform = containerRect.top - naturalPopupTop;
36028
+ } else if (naturalPopupBottom > containerRect.bottom) {
36029
+ transform = containerRect.bottom - naturalPopupBottom;
36030
+ }
36031
+ } else {
36032
+ var _naturalPopupTop2 = anchorRect.bottom + offset;
36033
+ var _naturalPopupBottom2 = _naturalPopupTop2 + dropdownHeight;
36034
+ if (_naturalPopupBottom2 > containerRect.bottom) {
36035
+ transform = containerRect.bottom - _naturalPopupBottom2;
36036
+ } else if (_naturalPopupTop2 < containerRect.top) {
36037
+ transform = containerRect.top - _naturalPopupTop2;
36038
+ }
35960
36039
  }
36040
+ setVerticalOffset(offset);
36041
+ setTransformY(transform);
35961
36042
  };
35962
36043
  if (open) {
35963
36044
  recalc();
@@ -35987,7 +36068,7 @@ var MessageInfo = function MessageInfo(_ref) {
35987
36068
  window.removeEventListener('resize', recalc);
35988
36069
  };
35989
36070
  }
35990
- }, [open, ready, message.id, panelHeightPx, isTransitioning, flipLocked, height]);
36071
+ }, [open, ready, message.id, panelHeightPx, isTransitioning, flipLocked, height, flipAbove, messagesMarkersLoadingState]);
35991
36072
  useLayoutEffect(function () {
35992
36073
  var _rootRef$current2;
35993
36074
  var container = document.getElementById('scrollableDiv');
@@ -36013,23 +36094,53 @@ var MessageInfo = function MessageInfo(_ref) {
36013
36094
  var availableBelow = containerRect.bottom - anchorRect.bottom - 8;
36014
36095
  var availableAbove = anchorRect.top - containerRect.top - 8;
36015
36096
  setFlipLocked(true);
36097
+ var currentFlip = flipAbove;
36016
36098
  if (messagesMarkersLoadingState !== LOADING_STATE.LOADING) {
36017
36099
  var overflowBelow = nextHeight > availableBelow;
36018
36100
  var overflowAbove = nextHeight > availableAbove;
36019
36101
  setFlipAbove(function (prev) {
36020
36102
  if (prev) {
36021
- if (overflowAbove && !overflowBelow) return false;
36103
+ if (overflowAbove && !overflowBelow) {
36104
+ currentFlip = false;
36105
+ return false;
36106
+ }
36107
+ currentFlip = true;
36022
36108
  return true;
36023
36109
  }
36024
- if (overflowBelow && !overflowAbove) return true;
36110
+ if (overflowBelow && !overflowAbove) {
36111
+ currentFlip = true;
36112
+ return true;
36113
+ }
36114
+ currentFlip = false;
36025
36115
  return false;
36026
36116
  });
36027
36117
  }
36118
+ var offset = 8;
36119
+ var transform = 0;
36120
+ if (currentFlip) {
36121
+ var naturalPopupBottom = anchorRect.top - offset;
36122
+ var naturalPopupTop = naturalPopupBottom - nextHeight;
36123
+ if (naturalPopupTop < containerRect.top) {
36124
+ transform = containerRect.top - naturalPopupTop;
36125
+ } else if (naturalPopupBottom > containerRect.bottom) {
36126
+ transform = containerRect.bottom - naturalPopupBottom;
36127
+ }
36128
+ } else {
36129
+ var _naturalPopupTop3 = anchorRect.bottom + offset;
36130
+ var _naturalPopupBottom3 = _naturalPopupTop3 + nextHeight;
36131
+ if (_naturalPopupBottom3 > containerRect.bottom) {
36132
+ transform = containerRect.bottom - _naturalPopupBottom3;
36133
+ } else if (_naturalPopupTop3 < containerRect.top) {
36134
+ transform = containerRect.top - _naturalPopupTop3;
36135
+ }
36136
+ }
36137
+ setVerticalOffset(offset);
36138
+ setTransformY(transform);
36028
36139
  if (panelHeightPx !== nextHeight) {
36029
36140
  setIsTransitioning(true);
36030
36141
  setPanelHeightPx(nextHeight);
36031
36142
  }
36032
- }, [ready, panelHeightPx, activeMarkers.length, messagesMarkersLoadingState, height]);
36143
+ }, [ready, panelHeightPx, activeMarkers.length, messagesMarkersLoadingState, height, flipAbove]);
36033
36144
  useEffect(function () {
36034
36145
  if (messagesMarkersLoadingState === LOADING_STATE.LOADING) {
36035
36146
  setFlipLocked(true);
@@ -36056,12 +36167,17 @@ var MessageInfo = function MessageInfo(_ref) {
36056
36167
  dispatch(getMessageMarkersAC(message.id, message.channelId, activeTab));
36057
36168
  }
36058
36169
  }, [activeTab, message.id, message.channelId]);
36170
+ if ((messagesMarkersLoadingState === LOADING_STATE.LOADING || messagesMarkersLoadingState == null) && !markers) {
36171
+ return null;
36172
+ }
36059
36173
  return /*#__PURE__*/React__default.createElement(DropdownRoot, {
36060
36174
  ref: rootRef,
36061
36175
  rtl: message.incoming,
36062
36176
  backgroundColor: backgroundSections,
36063
36177
  flip: flipAbove,
36064
- ready: ready
36178
+ ready: ready,
36179
+ verticalOffset: verticalOffset,
36180
+ transformY: transformY
36065
36181
  }, /*#__PURE__*/React__default.createElement(Panel, {
36066
36182
  ref: panelRef,
36067
36183
  bg: backgroundSections,
@@ -36131,12 +36247,14 @@ var RowDate = styled.div(_templateObject7$j || (_templateObject7$j = _taggedTemp
36131
36247
  var Empty = styled.div(_templateObject8$h || (_templateObject8$h = _taggedTemplateLiteralLoose(["\n color: ", ";\n text-align: center;\n padding: 16px 0;\n font-size: 14px;\n height: calc(100% - 32px);\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n"])), function (p) {
36132
36248
  return p.color;
36133
36249
  });
36134
- var DropdownRoot = styled.div(_templateObject9$f || (_templateObject9$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n ", "\n z-index: 15;\n background: ", ";\n box-shadow: 0px 0px 24px 0px #11153929;\n border-radius: 16px;\n direction: initial;\n visibility: ", ";\n"])), function (p) {
36135
- return p.flip ? 'auto' : 'calc(100% + 8px)';
36250
+ var DropdownRoot = styled.div(_templateObject9$f || (_templateObject9$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n ", "\n transform: ", ";\n z-index: 15;\n background: ", ";\n box-shadow: 0px 0px 24px 0px #11153929;\n border-radius: 16px;\n direction: initial;\n visibility: ", ";\n"])), function (p) {
36251
+ return p.flip ? 'auto' : "calc(100% + " + p.verticalOffset + "px)";
36136
36252
  }, function (p) {
36137
- return p.flip ? 'calc(100% + 8px)' : 'auto';
36253
+ return p.flip ? "calc(100% + " + p.verticalOffset + "px)" : 'auto';
36138
36254
  }, function (p) {
36139
36255
  return p.rtl ? 'left: 4%;' : 'right: 4%;';
36256
+ }, function (p) {
36257
+ return p.transformY !== 0 ? "translateY(" + p.transformY + "px)" : 'none';
36140
36258
  }, function (_ref2) {
36141
36259
  var backgroundColor = _ref2.backgroundColor;
36142
36260
  return backgroundColor;
@@ -36604,6 +36722,11 @@ var Message$1 = function Message(_ref) {
36604
36722
  }
36605
36723
  }
36606
36724
  }, [isVisible, unreadScrollTo]);
36725
+ useEffect(function () {
36726
+ if (!isVisible && infoPopupOpen) {
36727
+ setInfoPopupOpen(false);
36728
+ }
36729
+ }, [isVisible, infoPopupOpen]);
36607
36730
  useDidUpdate(function () {
36608
36731
  if (tabIsActive) {
36609
36732
  handleSendReadMarker();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.7.6-beta.17",
3
+ "version": "1.7.6-beta.19",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",