@trii/components 2.0.15 → 2.0.16

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.
@@ -5,6 +5,7 @@ type HeaderProps = {
5
5
  navigate: (path: string) => void;
6
6
  isLoading?: boolean;
7
7
  onError?: (error: Error) => void;
8
+ onClose: () => void;
8
9
  };
9
- declare const Header: ({ imgUrl, name, contactId, navigate, isLoading, onError, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const Header: ({ imgUrl, name, contactId, navigate, isLoading, onError, onClose, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default Header;
package/dist/esm/index.js CHANGED
@@ -8814,7 +8814,7 @@ const LoadingContainer = styled$3(Box)({
8814
8814
  height: 60,
8815
8815
  marginBottom: 8,
8816
8816
  });
8817
- const Header = ({ imgUrl, name, contactId, navigate, isLoading = false, onError, }) => {
8817
+ const Header = ({ imgUrl, name, contactId, navigate, isLoading = false, onError, onClose, }) => {
8818
8818
  const handleNavigation = useCallback((url) => (event) => {
8819
8819
  try {
8820
8820
  event.preventDefault();
@@ -8838,7 +8838,25 @@ const Header = ({ imgUrl, name, contactId, navigate, isLoading = false, onError,
8838
8838
  const handleNavigateToConversations = handleNavigation('/a/conversations/conversations');
8839
8839
  const displayName = name || 'Unknown Contact';
8840
8840
  const avatarAlt = `Avatar for ${displayName}`;
8841
- return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsxs(ButtonsContainer, { children: [jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: handleNavigateToContacts, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: handleNavigateToConversations, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName })] }));
8841
+ return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsxs(ButtonsContainer, { children: [jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8842
+ handleNavigateToContacts(e);
8843
+ onClose();
8844
+ }, onMouseDown: (e) => {
8845
+ if (e.button === 1) {
8846
+ // Middle mouse button
8847
+ handleNavigateToContacts(e);
8848
+ onClose();
8849
+ }
8850
+ }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8851
+ handleNavigateToConversations(e);
8852
+ onClose();
8853
+ }, onMouseDown: (e) => {
8854
+ if (e.button === 1) {
8855
+ // Middle mouse button
8856
+ handleNavigateToConversations(e);
8857
+ onClose();
8858
+ }
8859
+ }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName })] }));
8842
8860
  };
8843
8861
 
8844
8862
  const Container$1 = styled$3(Box)({
@@ -14927,7 +14945,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
14927
14945
  window.removeEventListener('keydown', handleKeyDown);
14928
14946
  };
14929
14947
  }, [open, onClose]);
14930
- return (jsxRuntimeExports.jsx(Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers') })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
14948
+ return (jsxRuntimeExports.jsx(Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers') })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
14931
14949
  };
14932
14950
 
14933
14951
  export { ContactInfoPopup, TestBox };