@trii/components 2.0.51 → 2.0.53
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.
- package/dist/cjs/index.js +26 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +1 -2
- package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +1 -2
- package/dist/cjs/types/i18n/config.d.ts +2 -2
- package/dist/esm/index.js +27 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +1 -2
- package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +1 -2
- package/dist/esm/types/i18n/config.d.ts +2 -2
- package/dist/index.d.ts +6 -4
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IBusiness, IContact } from '@trii/types/dist/Contacts';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
|
-
import '../../i18n/config';
|
|
4
3
|
export interface ContactInfoPopupProps {
|
|
5
4
|
open: boolean;
|
|
6
5
|
anchorEl: HTMLElement | null;
|
|
@@ -11,5 +10,5 @@ export interface ContactInfoPopupProps {
|
|
|
11
10
|
sx?: SxProps<Theme>;
|
|
12
11
|
navigate: (path: string) => void;
|
|
13
12
|
}
|
|
14
|
-
declare const ContactInfoPopup: (
|
|
13
|
+
declare const ContactInfoPopup: (props: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
14
|
export default ContactInfoPopup;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
-
import '../../i18n/config';
|
|
3
2
|
export interface Props {
|
|
4
3
|
open: boolean;
|
|
5
4
|
onClose: () => void;
|
|
@@ -10,5 +9,5 @@ export interface Props {
|
|
|
10
9
|
sx?: SxProps<Theme>;
|
|
11
10
|
navigate: (path: string) => void;
|
|
12
11
|
}
|
|
13
|
-
declare const EditContactModal: (
|
|
12
|
+
declare const EditContactModal: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export default EditContactModal;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const i18nInstance: import("i18next").i18n;
|
|
2
|
+
export default i18nInstance;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,9 +2,8 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { useCallback, useEffect, createContext, useContext, useState, useMemo, Children, isValidElement, cloneElement, useDeferredValue, createElement, useRef } from 'react';
|
|
3
3
|
import { styled as styled$5, Box as Box$2, IconButton as IconButton$2, Avatar, Typography as Typography$2, CircularProgress as CircularProgress$2, Tooltip, Chip as Chip$2, Popper as Popper$2, ClickAwayListener, CardContent, Stack as Stack$2, Popover as Popover$2, TextField as TextField$1, Autocomplete, Button as Button$2, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, LinearProgress, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
|
|
4
4
|
import { withEmotionCache, ThemeContext, CacheProvider, Global, css, keyframes } from '@emotion/react';
|
|
5
|
-
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
5
|
+
import { initReactI18next, I18nextProvider, useTranslation } from 'react-i18next';
|
|
6
6
|
import i18n from 'i18next';
|
|
7
|
-
export { default as i18n } from 'i18next';
|
|
8
7
|
import * as ReactDOM from 'react-dom';
|
|
9
8
|
import ReactDOM__default from 'react-dom';
|
|
10
9
|
|
|
@@ -15448,7 +15447,8 @@ const resources = {
|
|
|
15448
15447
|
en: { translation: en },
|
|
15449
15448
|
es: { translation: es },
|
|
15450
15449
|
};
|
|
15451
|
-
i18n.
|
|
15450
|
+
const i18nInstance = i18n.createInstance();
|
|
15451
|
+
i18nInstance.use(initReactI18next).init({
|
|
15452
15452
|
resources,
|
|
15453
15453
|
lng: 'en',
|
|
15454
15454
|
fallbackLng: 'en',
|
|
@@ -15487,7 +15487,7 @@ const PopupContainer = styled$5(Box$2)(({ theme }) => ({
|
|
|
15487
15487
|
background: '#616161',
|
|
15488
15488
|
},
|
|
15489
15489
|
}));
|
|
15490
|
-
const
|
|
15490
|
+
const ContactInfoPopupContent = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, language = 'en', }) => {
|
|
15491
15491
|
const { t: i18nT, i18n } = useTranslation();
|
|
15492
15492
|
useEffect(() => {
|
|
15493
15493
|
if (language) {
|
|
@@ -15547,6 +15547,9 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
15547
15547
|
}, [open, onClose]);
|
|
15548
15548
|
return (jsxRuntimeExports.jsx(Popper$2, { 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$1, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), 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'), navigate: navigate })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod$1, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
|
|
15549
15549
|
};
|
|
15550
|
+
const ContactInfoPopup = (props) => {
|
|
15551
|
+
return (jsxRuntimeExports.jsx(I18nextProvider, { i18n: i18nInstance, children: jsxRuntimeExports.jsx(ContactInfoPopupContent, { ...props }) }));
|
|
15552
|
+
};
|
|
15550
15553
|
|
|
15551
15554
|
var Close = {};
|
|
15552
15555
|
|
|
@@ -25380,7 +25383,7 @@ const SearchLocationEditor = ({ baseUrl, spaceId, entityType, entityId, onBack,
|
|
|
25380
25383
|
}
|
|
25381
25384
|
};
|
|
25382
25385
|
const isDisabled = !canSubmit || isSavingMain || isSavingSecondary;
|
|
25383
|
-
return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb:
|
|
25386
|
+
return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 3 }, children: [jsxRuntimeExports.jsx(IconButton$2, { size: "small", onClick: onBack, "aria-label": t('global.back'), children: jsxRuntimeExports.jsx(default_1$c, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography$2, { variant: "h6", children: t('searchLocationModal.searchAddress') })] }), jsxRuntimeExports.jsxs(Stack$2, { spacing: 3, children: [jsxRuntimeExports.jsxs(Box$2, { sx: { position: 'relative', zIndex: 1400 }, children: [jsxRuntimeExports.jsx(SearchLocationInput, { onPlaceSelected: handlePlaceSelected, onError: handleError, placeholder: t('searchLocationModal.enterLocation') }), error ? (jsxRuntimeExports.jsx(Typography$2, { variant: "caption", color: "error", sx: { mt: 0.5, display: 'block' }, children: error })) : null] }), jsxRuntimeExports.jsx(TextField$1, { label: t('conversations.contactDetails.street'), value: draft.street, onChange: handleChange('street'), fullWidth: true, size: "medium" }), jsxRuntimeExports.jsxs(Stack$2, { direction: { xs: 'column', sm: 'row' }, spacing: 2, children: [jsxRuntimeExports.jsx(TextField$1, { label: t('searchLocationModal.city'), value: draft.city, onChange: handleChange('city'), fullWidth: true, size: "medium" }), jsxRuntimeExports.jsx(TextField$1, { label: t('searchLocationModal.state'), value: draft.state, onChange: handleChange('state'), fullWidth: true, size: "medium" })] }), jsxRuntimeExports.jsxs(Stack$2, { direction: { xs: 'column', sm: 'row' }, spacing: 2, children: [jsxRuntimeExports.jsx(TextField$1, { label: t('searchLocationModal.postalCode'), value: draft.zipcode, onChange: handleChange('zipcode'), fullWidth: true, size: "medium" }), jsxRuntimeExports.jsx(TextField$1, { label: t('searchLocationModal.country'), value: draft.country, onChange: handleChange('country'), fullWidth: true, size: "medium" })] }), query ? (jsxRuntimeExports.jsx(Typography$2, { variant: "caption", sx: { opacity: 0.7 }, children: query })) : null, jsxRuntimeExports.jsxs(Stack$2, { direction: "row", spacing: 2, justifyContent: "flex-end", sx: { pt: 2 }, children: [jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "large", startIcon: jsxRuntimeExports.jsx(default_1$b, {}), onClick: handleSaveMainAddress, loading: isSavingMain, disabled: isDisabled, children: t('searchLocationModal.saveMainAddress') }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "outlined", size: "large", startIcon: jsxRuntimeExports.jsx(default_1$b, {}), onClick: handleSaveSecondaryAddress, loading: isSavingSecondary, disabled: isDisabled, children: t('searchLocationModal.saveSecondaryAddress') })] })] })] }));
|
|
25384
25387
|
};
|
|
25385
25388
|
|
|
25386
25389
|
/**
|
|
@@ -27027,6 +27030,9 @@ const Section = ({ title, children, enableDirectionSearch = false, onDirectionSe
|
|
|
27027
27030
|
borderRadius: 2,
|
|
27028
27031
|
p: 2,
|
|
27029
27032
|
mb: 2,
|
|
27033
|
+
display: 'flex',
|
|
27034
|
+
alignItems: 'center',
|
|
27035
|
+
justifyContent: 'space-between',
|
|
27030
27036
|
}, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", children: title }), enableDirectionSearch && (jsxRuntimeExports.jsx(Button$2, { startIcon: jsxRuntimeExports.jsx(default_1$9, { sx: { color: 'primary.main', height: 18, width: 18 } }), size: "small", variant: "outlined", color: "primary", onClick: () => onDirectionSearchClick && onDirectionSearchClick(), children: t('global.searchLocation') })), jsxRuntimeExports.jsx(Divider, { sx: { my: 1.5 } }), children] }));
|
|
27031
27037
|
};
|
|
27032
27038
|
|
|
@@ -58295,9 +58301,20 @@ const BusinessSelectEditor = ({ baseUrl, spaceId, contactId, initialBusiness, on
|
|
|
58295
58301
|
} })] })] }));
|
|
58296
58302
|
};
|
|
58297
58303
|
|
|
58298
|
-
const
|
|
58304
|
+
const EditContactModalContent = ({ open, onClose, baseUrl, spaceId, contactId, sx, language = 'en', navigate, }) => {
|
|
58299
58305
|
const { t: i18nT, i18n } = useTranslation();
|
|
58300
58306
|
const modalContentRef = useRef(null);
|
|
58307
|
+
useEffect(() => {
|
|
58308
|
+
// Load the google script and append it to the document body
|
|
58309
|
+
const script = document.createElement('script');
|
|
58310
|
+
script.src = 'https://accounts.google.com/gsi/client';
|
|
58311
|
+
script.async = true;
|
|
58312
|
+
script.defer = true;
|
|
58313
|
+
document.body.appendChild(script);
|
|
58314
|
+
return () => {
|
|
58315
|
+
document.body.removeChild(script);
|
|
58316
|
+
};
|
|
58317
|
+
}, []);
|
|
58301
58318
|
useEffect(() => {
|
|
58302
58319
|
if (language) {
|
|
58303
58320
|
i18n.changeLanguage(language);
|
|
@@ -58389,6 +58406,9 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, lang
|
|
|
58389
58406
|
}
|
|
58390
58407
|
: null, onBack: () => setView('main'), onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }) }) })] }) }) })) : null] }) }) }) }) }) }));
|
|
58391
58408
|
};
|
|
58409
|
+
const EditContactModal = (props) => {
|
|
58410
|
+
return (jsxRuntimeExports.jsx(I18nextProvider, { i18n: i18nInstance, children: jsxRuntimeExports.jsx(EditContactModalContent, { ...props }) }));
|
|
58411
|
+
};
|
|
58392
58412
|
|
|
58393
|
-
export { ContactInfoPopup, EditContactModal };
|
|
58413
|
+
export { ContactInfoPopup, EditContactModal, i18nInstance as i18n };
|
|
58394
58414
|
//# sourceMappingURL=index.js.map
|