@trii/components 2.0.44 → 2.0.47
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 +165 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +3 -2
- package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +3 -2
- package/dist/cjs/types/i18n/config.d.ts +2 -0
- package/dist/cjs/types/i18n/index.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/esm/index.js +165 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +3 -2
- package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +3 -2
- package/dist/esm/types/i18n/config.d.ts +2 -0
- package/dist/esm/types/i18n/index.d.ts +2 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/index.d.ts +5 -4
- package/package.json +5 -2
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { IBusiness, IContact } from '@trii/types/dist/Contacts';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
import '../../i18n/config';
|
|
3
4
|
export interface ContactInfoPopupProps {
|
|
4
5
|
open: boolean;
|
|
5
6
|
anchorEl: HTMLElement | null;
|
|
6
7
|
onClose: () => void;
|
|
7
|
-
|
|
8
|
+
language?: 'en' | 'es';
|
|
8
9
|
contactData?: IContact | IBusiness;
|
|
9
10
|
avatarImgUrl?: string;
|
|
10
11
|
sx?: SxProps<Theme>;
|
|
11
12
|
navigate: (path: string) => void;
|
|
12
13
|
}
|
|
13
|
-
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate,
|
|
14
|
+
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, language, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default ContactInfoPopup;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import '../../i18n/config';
|
|
2
3
|
export interface Props {
|
|
3
4
|
open: boolean;
|
|
4
5
|
onClose: () => void;
|
|
5
6
|
baseUrl?: string;
|
|
6
7
|
spaceId?: string;
|
|
7
8
|
contactId?: string;
|
|
8
|
-
|
|
9
|
+
language?: 'en' | 'es';
|
|
9
10
|
sx?: SxProps<Theme>;
|
|
10
11
|
navigate: (path: string) => void;
|
|
11
12
|
}
|
|
12
|
-
declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx,
|
|
13
|
+
declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx, language, navigate, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default EditContactModal;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,9 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { useCallback, useEffect, createContext, useContext, useState, useMemo, Children, isValidElement, cloneElement, 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, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Button as Button$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, 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';
|
|
6
|
+
import i18n from 'i18next';
|
|
7
|
+
export { default as i18n } from 'i18next';
|
|
5
8
|
import * as ReactDOM from 'react-dom';
|
|
6
9
|
import ReactDOM__default from 'react-dom';
|
|
7
10
|
|
|
@@ -4718,11 +4721,11 @@ var createStyled$2 = function createStyled(tag, options) {
|
|
|
4718
4721
|
};
|
|
4719
4722
|
};
|
|
4720
4723
|
|
|
4721
|
-
var tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
|
|
4724
|
+
var tags$2 = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
|
|
4722
4725
|
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
|
|
4723
4726
|
|
|
4724
4727
|
var newStyled = createStyled$2.bind();
|
|
4725
|
-
tags.forEach(function (tagName) {
|
|
4728
|
+
tags$2.forEach(function (tagName) {
|
|
4726
4729
|
// $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
|
|
4727
4730
|
newStyled[tagName] = newStyled(tagName);
|
|
4728
4731
|
});
|
|
@@ -6409,7 +6412,7 @@ function memoize(fn) {
|
|
|
6409
6412
|
};
|
|
6410
6413
|
}
|
|
6411
6414
|
|
|
6412
|
-
const properties = {
|
|
6415
|
+
const properties$2 = {
|
|
6413
6416
|
m: 'margin',
|
|
6414
6417
|
p: 'padding'
|
|
6415
6418
|
};
|
|
@@ -6441,7 +6444,7 @@ const getCssProperties = memoize(prop => {
|
|
|
6441
6444
|
}
|
|
6442
6445
|
}
|
|
6443
6446
|
const [a, b] = prop.split('');
|
|
6444
|
-
const property = properties[a];
|
|
6447
|
+
const property = properties$2[a];
|
|
6445
6448
|
const direction = directions[b] || '';
|
|
6446
6449
|
return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
|
|
6447
6450
|
});
|
|
@@ -15234,7 +15237,7 @@ function isBusiness$1(obj) {
|
|
|
15234
15237
|
}
|
|
15235
15238
|
|
|
15236
15239
|
const MemberItem = ({ name, memberId, navigate }) => {
|
|
15237
|
-
const url = `/a/
|
|
15240
|
+
const url = `/a/conversations/conversations&conversationId=${memberId}`;
|
|
15238
15241
|
const handleNavigation = (event) => {
|
|
15239
15242
|
event.preventDefault();
|
|
15240
15243
|
event.stopPropagation();
|
|
@@ -15269,6 +15272,146 @@ const MembersSection = ({ contactData, title, navigate }) => {
|
|
|
15269
15272
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), contactData?.members.map((member) => (jsxRuntimeExports.jsx(MemberItem, { memberId: String(member.id), name: member.name, navigate: navigate }, member.id)))] }));
|
|
15270
15273
|
};
|
|
15271
15274
|
|
|
15275
|
+
var labels$1 = "Labels";
|
|
15276
|
+
var phone$1 = "Phone";
|
|
15277
|
+
var business$1 = "Business";
|
|
15278
|
+
var businessMembers$1 = "Business Members";
|
|
15279
|
+
var properties$1 = "Properties";
|
|
15280
|
+
var view$1 = "View";
|
|
15281
|
+
var email$1 = "Email";
|
|
15282
|
+
var tags$1 = "Tags";
|
|
15283
|
+
var global$2 = {
|
|
15284
|
+
back: "Back",
|
|
15285
|
+
save: "Save",
|
|
15286
|
+
noOptions: "No options",
|
|
15287
|
+
noValue: "No value",
|
|
15288
|
+
birthdate: "Birthdate"
|
|
15289
|
+
};
|
|
15290
|
+
var avatar$1 = {
|
|
15291
|
+
upload: "Upload photo",
|
|
15292
|
+
"delete": "Delete photo"
|
|
15293
|
+
};
|
|
15294
|
+
var contactEdit$1 = {
|
|
15295
|
+
from: "From",
|
|
15296
|
+
to: "To"
|
|
15297
|
+
};
|
|
15298
|
+
var conversations$1 = {
|
|
15299
|
+
contactDetails: {
|
|
15300
|
+
contactOwner: "Contact Owner",
|
|
15301
|
+
business: "Business",
|
|
15302
|
+
createdBy: "Created By",
|
|
15303
|
+
modifiedBy: "Modified By",
|
|
15304
|
+
street: "Street",
|
|
15305
|
+
city: "City",
|
|
15306
|
+
state: "State",
|
|
15307
|
+
postcode: "Postcode",
|
|
15308
|
+
country: "Country",
|
|
15309
|
+
addressInformation: "Address Information",
|
|
15310
|
+
primaryAddress: "Primary Address",
|
|
15311
|
+
secondaryAddress: "Secondary Address",
|
|
15312
|
+
contactInformation: "Contact Information",
|
|
15313
|
+
phones: "Phones",
|
|
15314
|
+
contactInfo: {
|
|
15315
|
+
emptySelection: "No selection"
|
|
15316
|
+
}
|
|
15317
|
+
},
|
|
15318
|
+
businessDetails: {
|
|
15319
|
+
businessOwner: "Business Owner"
|
|
15320
|
+
}
|
|
15321
|
+
};
|
|
15322
|
+
var en = {
|
|
15323
|
+
labels: labels$1,
|
|
15324
|
+
phone: phone$1,
|
|
15325
|
+
business: business$1,
|
|
15326
|
+
businessMembers: businessMembers$1,
|
|
15327
|
+
properties: properties$1,
|
|
15328
|
+
view: view$1,
|
|
15329
|
+
email: email$1,
|
|
15330
|
+
tags: tags$1,
|
|
15331
|
+
global: global$2,
|
|
15332
|
+
avatar: avatar$1,
|
|
15333
|
+
contactEdit: contactEdit$1,
|
|
15334
|
+
conversations: conversations$1
|
|
15335
|
+
};
|
|
15336
|
+
|
|
15337
|
+
var labels = "Etiquetas";
|
|
15338
|
+
var phone = "Teléfono";
|
|
15339
|
+
var business = "Empresa";
|
|
15340
|
+
var businessMembers = "Miembros de la empresa";
|
|
15341
|
+
var properties = "Propiedades";
|
|
15342
|
+
var view = "Ver";
|
|
15343
|
+
var email = "Correo Electrónico";
|
|
15344
|
+
var tags = "Etiquetas";
|
|
15345
|
+
var global$1 = {
|
|
15346
|
+
back: "Atrás",
|
|
15347
|
+
save: "Guardar",
|
|
15348
|
+
noOptions: "Sin opciones",
|
|
15349
|
+
noValue: "Sin valor",
|
|
15350
|
+
birthdate: "Fecha de nacimiento"
|
|
15351
|
+
};
|
|
15352
|
+
var avatar = {
|
|
15353
|
+
upload: "Subir foto",
|
|
15354
|
+
"delete": "Eliminar foto"
|
|
15355
|
+
};
|
|
15356
|
+
var contactEdit = {
|
|
15357
|
+
from: "Desde",
|
|
15358
|
+
to: "Hasta"
|
|
15359
|
+
};
|
|
15360
|
+
var conversations = {
|
|
15361
|
+
contactDetails: {
|
|
15362
|
+
contactOwner: "Propietario del contacto",
|
|
15363
|
+
business: "Empresa",
|
|
15364
|
+
createdBy: "Creado por",
|
|
15365
|
+
modifiedBy: "Modificado por",
|
|
15366
|
+
street: "Calle",
|
|
15367
|
+
city: "Ciudad",
|
|
15368
|
+
state: "Estado",
|
|
15369
|
+
postcode: "Código postal",
|
|
15370
|
+
country: "País",
|
|
15371
|
+
addressInformation: "Información de dirección",
|
|
15372
|
+
primaryAddress: "Dirección principal",
|
|
15373
|
+
secondaryAddress: "Dirección secundaria",
|
|
15374
|
+
contactInformation: "Información de contacto",
|
|
15375
|
+
phones: "Teléfonos",
|
|
15376
|
+
contactInfo: {
|
|
15377
|
+
emptySelection: "Sin selección"
|
|
15378
|
+
}
|
|
15379
|
+
},
|
|
15380
|
+
businessDetails: {
|
|
15381
|
+
businessOwner: "Propietario de la empresa"
|
|
15382
|
+
}
|
|
15383
|
+
};
|
|
15384
|
+
var es = {
|
|
15385
|
+
labels: labels,
|
|
15386
|
+
phone: phone,
|
|
15387
|
+
business: business,
|
|
15388
|
+
businessMembers: businessMembers,
|
|
15389
|
+
properties: properties,
|
|
15390
|
+
view: view,
|
|
15391
|
+
email: email,
|
|
15392
|
+
tags: tags,
|
|
15393
|
+
global: global$1,
|
|
15394
|
+
avatar: avatar,
|
|
15395
|
+
contactEdit: contactEdit,
|
|
15396
|
+
conversations: conversations
|
|
15397
|
+
};
|
|
15398
|
+
|
|
15399
|
+
const resources = {
|
|
15400
|
+
en: { translation: en },
|
|
15401
|
+
es: { translation: es },
|
|
15402
|
+
};
|
|
15403
|
+
i18n.use(initReactI18next).init({
|
|
15404
|
+
resources,
|
|
15405
|
+
lng: 'en',
|
|
15406
|
+
fallbackLng: 'en',
|
|
15407
|
+
interpolation: {
|
|
15408
|
+
escapeValue: false,
|
|
15409
|
+
},
|
|
15410
|
+
react: {
|
|
15411
|
+
useSuspense: false,
|
|
15412
|
+
},
|
|
15413
|
+
});
|
|
15414
|
+
|
|
15272
15415
|
const PopupContainer = styled$5(Box$2)(({ theme }) => ({
|
|
15273
15416
|
//@ts-ignore
|
|
15274
15417
|
backgroundColor: theme.palette.background.panel,
|
|
@@ -15296,15 +15439,14 @@ const PopupContainer = styled$5(Box$2)(({ theme }) => ({
|
|
|
15296
15439
|
background: '#616161',
|
|
15297
15440
|
},
|
|
15298
15441
|
}));
|
|
15299
|
-
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate,
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
}[key] || key), }) => {
|
|
15442
|
+
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, language = 'en', }) => {
|
|
15443
|
+
const { t: i18nT, i18n } = useTranslation();
|
|
15444
|
+
useEffect(() => {
|
|
15445
|
+
if (language) {
|
|
15446
|
+
i18n.changeLanguage(language);
|
|
15447
|
+
}
|
|
15448
|
+
}, [language, i18n]);
|
|
15449
|
+
const t = i18nT;
|
|
15308
15450
|
const dataIsBusiness = isBusiness$1(contactData);
|
|
15309
15451
|
const dataIsContact = isContact$1(contactData);
|
|
15310
15452
|
const contactMethods = [
|
|
@@ -15355,7 +15497,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
15355
15497
|
window.removeEventListener('keydown', handleKeyDown);
|
|
15356
15498
|
};
|
|
15357
15499
|
}, [open, onClose]);
|
|
15358
|
-
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 &&
|
|
15500
|
+
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') })] }) }) }) }));
|
|
15359
15501
|
};
|
|
15360
15502
|
|
|
15361
15503
|
var Edit = {};
|
|
@@ -57288,7 +57430,14 @@ const useModalCloseHandler = ({ onClose }) => {
|
|
|
57288
57430
|
return handleClose;
|
|
57289
57431
|
};
|
|
57290
57432
|
|
|
57291
|
-
const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx,
|
|
57433
|
+
const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, language = 'en', navigate, }) => {
|
|
57434
|
+
const { t: i18nT, i18n } = useTranslation();
|
|
57435
|
+
useEffect(() => {
|
|
57436
|
+
if (language) {
|
|
57437
|
+
i18n.changeLanguage(language);
|
|
57438
|
+
}
|
|
57439
|
+
}, [language, i18n]);
|
|
57440
|
+
const t = (key) => i18nT(key);
|
|
57292
57441
|
const api = useMemo(() => {
|
|
57293
57442
|
if (!baseUrl || !spaceId)
|
|
57294
57443
|
return null;
|