@trii/components 2.0.45 → 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 CHANGED
@@ -3,6 +3,8 @@
3
3
  var React$1 = require('react');
4
4
  var material = require('@mui/material');
5
5
  var react = require('@emotion/react');
6
+ var reactI18next = require('react-i18next');
7
+ var i18n = require('i18next');
6
8
  var ReactDOM = require('react-dom');
7
9
 
8
10
  function _interopNamespaceDefault(e) {
@@ -4738,11 +4740,11 @@ var createStyled$2 = function createStyled(tag, options) {
4738
4740
  };
4739
4741
  };
4740
4742
 
4741
- 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
4743
+ 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
4742
4744
  'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
4743
4745
 
4744
4746
  var newStyled = createStyled$2.bind();
4745
- tags.forEach(function (tagName) {
4747
+ tags$2.forEach(function (tagName) {
4746
4748
  // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
4747
4749
  newStyled[tagName] = newStyled(tagName);
4748
4750
  });
@@ -6429,7 +6431,7 @@ function memoize(fn) {
6429
6431
  };
6430
6432
  }
6431
6433
 
6432
- const properties = {
6434
+ const properties$2 = {
6433
6435
  m: 'margin',
6434
6436
  p: 'padding'
6435
6437
  };
@@ -6461,7 +6463,7 @@ const getCssProperties = memoize(prop => {
6461
6463
  }
6462
6464
  }
6463
6465
  const [a, b] = prop.split('');
6464
- const property = properties[a];
6466
+ const property = properties$2[a];
6465
6467
  const direction = directions[b] || '';
6466
6468
  return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
6467
6469
  });
@@ -15289,6 +15291,146 @@ const MembersSection = ({ contactData, title, navigate }) => {
15289
15291
  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)))] }));
15290
15292
  };
15291
15293
 
15294
+ var labels$1 = "Labels";
15295
+ var phone$1 = "Phone";
15296
+ var business$1 = "Business";
15297
+ var businessMembers$1 = "Business Members";
15298
+ var properties$1 = "Properties";
15299
+ var view$1 = "View";
15300
+ var email$1 = "Email";
15301
+ var tags$1 = "Tags";
15302
+ var global$2 = {
15303
+ back: "Back",
15304
+ save: "Save",
15305
+ noOptions: "No options",
15306
+ noValue: "No value",
15307
+ birthdate: "Birthdate"
15308
+ };
15309
+ var avatar$1 = {
15310
+ upload: "Upload photo",
15311
+ "delete": "Delete photo"
15312
+ };
15313
+ var contactEdit$1 = {
15314
+ from: "From",
15315
+ to: "To"
15316
+ };
15317
+ var conversations$1 = {
15318
+ contactDetails: {
15319
+ contactOwner: "Contact Owner",
15320
+ business: "Business",
15321
+ createdBy: "Created By",
15322
+ modifiedBy: "Modified By",
15323
+ street: "Street",
15324
+ city: "City",
15325
+ state: "State",
15326
+ postcode: "Postcode",
15327
+ country: "Country",
15328
+ addressInformation: "Address Information",
15329
+ primaryAddress: "Primary Address",
15330
+ secondaryAddress: "Secondary Address",
15331
+ contactInformation: "Contact Information",
15332
+ phones: "Phones",
15333
+ contactInfo: {
15334
+ emptySelection: "No selection"
15335
+ }
15336
+ },
15337
+ businessDetails: {
15338
+ businessOwner: "Business Owner"
15339
+ }
15340
+ };
15341
+ var en = {
15342
+ labels: labels$1,
15343
+ phone: phone$1,
15344
+ business: business$1,
15345
+ businessMembers: businessMembers$1,
15346
+ properties: properties$1,
15347
+ view: view$1,
15348
+ email: email$1,
15349
+ tags: tags$1,
15350
+ global: global$2,
15351
+ avatar: avatar$1,
15352
+ contactEdit: contactEdit$1,
15353
+ conversations: conversations$1
15354
+ };
15355
+
15356
+ var labels = "Etiquetas";
15357
+ var phone = "Teléfono";
15358
+ var business = "Empresa";
15359
+ var businessMembers = "Miembros de la empresa";
15360
+ var properties = "Propiedades";
15361
+ var view = "Ver";
15362
+ var email = "Correo Electrónico";
15363
+ var tags = "Etiquetas";
15364
+ var global$1 = {
15365
+ back: "Atrás",
15366
+ save: "Guardar",
15367
+ noOptions: "Sin opciones",
15368
+ noValue: "Sin valor",
15369
+ birthdate: "Fecha de nacimiento"
15370
+ };
15371
+ var avatar = {
15372
+ upload: "Subir foto",
15373
+ "delete": "Eliminar foto"
15374
+ };
15375
+ var contactEdit = {
15376
+ from: "Desde",
15377
+ to: "Hasta"
15378
+ };
15379
+ var conversations = {
15380
+ contactDetails: {
15381
+ contactOwner: "Propietario del contacto",
15382
+ business: "Empresa",
15383
+ createdBy: "Creado por",
15384
+ modifiedBy: "Modificado por",
15385
+ street: "Calle",
15386
+ city: "Ciudad",
15387
+ state: "Estado",
15388
+ postcode: "Código postal",
15389
+ country: "País",
15390
+ addressInformation: "Información de dirección",
15391
+ primaryAddress: "Dirección principal",
15392
+ secondaryAddress: "Dirección secundaria",
15393
+ contactInformation: "Información de contacto",
15394
+ phones: "Teléfonos",
15395
+ contactInfo: {
15396
+ emptySelection: "Sin selección"
15397
+ }
15398
+ },
15399
+ businessDetails: {
15400
+ businessOwner: "Propietario de la empresa"
15401
+ }
15402
+ };
15403
+ var es = {
15404
+ labels: labels,
15405
+ phone: phone,
15406
+ business: business,
15407
+ businessMembers: businessMembers,
15408
+ properties: properties,
15409
+ view: view,
15410
+ email: email,
15411
+ tags: tags,
15412
+ global: global$1,
15413
+ avatar: avatar,
15414
+ contactEdit: contactEdit,
15415
+ conversations: conversations
15416
+ };
15417
+
15418
+ const resources = {
15419
+ en: { translation: en },
15420
+ es: { translation: es },
15421
+ };
15422
+ i18n.use(reactI18next.initReactI18next).init({
15423
+ resources,
15424
+ lng: 'en',
15425
+ fallbackLng: 'en',
15426
+ interpolation: {
15427
+ escapeValue: false,
15428
+ },
15429
+ react: {
15430
+ useSuspense: false,
15431
+ },
15432
+ });
15433
+
15292
15434
  const PopupContainer = material.styled(material.Box)(({ theme }) => ({
15293
15435
  //@ts-ignore
15294
15436
  backgroundColor: theme.palette.background.panel,
@@ -15316,15 +15458,14 @@ const PopupContainer = material.styled(material.Box)(({ theme }) => ({
15316
15458
  background: '#616161',
15317
15459
  },
15318
15460
  }));
15319
- const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t = (key) => ({
15320
- labels: 'Etiquetas',
15321
- phone: 'Teléfono',
15322
- business: 'Empresa',
15323
- businessMembers: 'Miembros de la empresa',
15324
- properties: 'Propiedades',
15325
- view: 'Ver',
15326
- email: 'Correo Electrónico',
15327
- }[key] || key), }) => {
15461
+ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, language = 'en', }) => {
15462
+ const { t: i18nT, i18n } = reactI18next.useTranslation();
15463
+ React$1.useEffect(() => {
15464
+ if (language) {
15465
+ i18n.changeLanguage(language);
15466
+ }
15467
+ }, [language, i18n]);
15468
+ const t = i18nT;
15328
15469
  const dataIsBusiness = isBusiness$1(contactData);
15329
15470
  const dataIsContact = isContact$1(contactData);
15330
15471
  const contactMethods = [
@@ -15375,7 +15516,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
15375
15516
  window.removeEventListener('keydown', handleKeyDown);
15376
15517
  };
15377
15518
  }, [open, onClose]);
15378
- return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.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') })] }) }) }) }));
15519
+ return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.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') })] }) }) }) }));
15379
15520
  };
15380
15521
 
15381
15522
  var Edit = {};
@@ -57308,7 +57449,14 @@ const useModalCloseHandler = ({ onClose }) => {
57308
57449
  return handleClose;
57309
57450
  };
57310
57451
 
57311
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }) => {
57452
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, language = 'en', navigate, }) => {
57453
+ const { t: i18nT, i18n } = reactI18next.useTranslation();
57454
+ React$1.useEffect(() => {
57455
+ if (language) {
57456
+ i18n.changeLanguage(language);
57457
+ }
57458
+ }, [language, i18n]);
57459
+ const t = (key) => i18nT(key);
57312
57460
  const api = React$1.useMemo(() => {
57313
57461
  if (!baseUrl || !spaceId)
57314
57462
  return null;
@@ -57380,6 +57528,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, n
57380
57528
  : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags }) }) })] }) })) : null }) }) }) }) }) }));
57381
57529
  };
57382
57530
 
57531
+ exports.i18n = i18n;
57383
57532
  exports.ContactInfoPopup = ContactInfoPopup;
57384
57533
  exports.EditContactModal = EditContactModal;
57385
57534
  //# sourceMappingURL=index.js.map