@trii/components 2.0.48 → 2.0.50

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
@@ -15291,25 +15291,29 @@ const MembersSection = ({ contactData, title, navigate }) => {
15291
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)))] }));
15292
15292
  };
15293
15293
 
15294
- var add$1 = "Add";
15295
- var close$1 = "Close";
15296
15294
  var labels$1 = "Labels";
15297
15295
  var phone$1 = "Phone";
15298
- var phones$1 = "Phones";
15299
- var number$1 = "Number";
15300
15296
  var business$1 = "Business";
15301
15297
  var businessMembers$1 = "Business Members";
15302
15298
  var properties$1 = "Properties";
15303
- var note$1 = "Note";
15304
15299
  var view$1 = "View";
15305
- var email$1 = "Email";
15306
15300
  var tags$1 = "Tags";
15307
15301
  var global$2 = {
15302
+ add: "Add",
15303
+ note: "Note",
15304
+ number: "Number",
15305
+ email: "Email",
15306
+ phones: "Phones",
15307
+ close: "Close",
15308
15308
  back: "Back",
15309
+ createNew: "Create new",
15310
+ "delete": "Delete",
15311
+ cancel: "Cancel",
15309
15312
  save: "Save",
15310
15313
  noOptions: "No options",
15311
15314
  noValue: "No value",
15312
- birthdate: "Birthdate"
15315
+ birthdate: "Birthdate",
15316
+ country: "Country"
15313
15317
  };
15314
15318
  var avatar$1 = {
15315
15319
  upload: "Upload photo",
@@ -15344,18 +15348,12 @@ var conversations$1 = {
15344
15348
  }
15345
15349
  };
15346
15350
  var en = {
15347
- add: add$1,
15348
- close: close$1,
15349
15351
  labels: labels$1,
15350
15352
  phone: phone$1,
15351
- phones: phones$1,
15352
- number: number$1,
15353
15353
  business: business$1,
15354
15354
  businessMembers: businessMembers$1,
15355
15355
  properties: properties$1,
15356
- note: note$1,
15357
15356
  view: view$1,
15358
- email: email$1,
15359
15357
  tags: tags$1,
15360
15358
  global: global$2,
15361
15359
  avatar: avatar$1,
@@ -15363,25 +15361,29 @@ var en = {
15363
15361
  conversations: conversations$1
15364
15362
  };
15365
15363
 
15366
- var add = "Agregar";
15367
- var close = "Cerrar";
15368
15364
  var labels = "Etiquetas";
15369
15365
  var phone = "Teléfono";
15370
- var phones = "Teléfonos";
15371
- var number = "Número";
15372
15366
  var business = "Empresa";
15373
15367
  var businessMembers = "Miembros de la empresa";
15374
15368
  var properties = "Propiedades";
15375
- var note = "Nota";
15376
15369
  var view = "Ver";
15377
- var email = "Correo Electrónico";
15378
15370
  var tags = "Etiquetas";
15379
15371
  var global$1 = {
15372
+ add: "Agregar",
15373
+ note: "Nota",
15374
+ number: "Número",
15375
+ email: "Correo Electrónico",
15376
+ close: "Cerrar",
15377
+ phones: "Teléfonos",
15378
+ "delete": "Eliminar",
15379
+ cancel: "Cancelar",
15380
+ createNew: "Crear nuevo",
15380
15381
  back: "Atrás",
15381
15382
  save: "Guardar",
15382
15383
  noOptions: "Sin opciones",
15383
15384
  noValue: "Sin valor",
15384
- birthdate: "Fecha de nacimiento"
15385
+ birthdate: "Fecha de nacimiento",
15386
+ country: "País"
15385
15387
  };
15386
15388
  var avatar = {
15387
15389
  upload: "Subir foto",
@@ -15416,18 +15418,12 @@ var conversations = {
15416
15418
  }
15417
15419
  };
15418
15420
  var es = {
15419
- add: add,
15420
- close: close,
15421
15421
  labels: labels,
15422
15422
  phone: phone,
15423
- phones: phones,
15424
- number: number,
15425
15423
  business: business,
15426
15424
  businessMembers: businessMembers,
15427
15425
  properties: properties,
15428
- note: note,
15429
15426
  view: view,
15430
- email: email,
15431
15427
  tags: tags,
15432
15428
  global: global$1,
15433
15429
  avatar: avatar,
@@ -24850,10 +24846,11 @@ Grow.muiSupportAuto = true;
24850
24846
  var Grow$1 = Grow;
24851
24847
 
24852
24848
  const PAGE_SIZE = 20;
24853
- const AutocompletePopper = styled$3(MuiPopper)(({ theme }) => ({
24854
- zIndex: theme.zIndex.modal + 1,
24855
- }));
24856
- const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, }) => {
24849
+ const AutocompletePopper = (props) => {
24850
+ const { popperContainer, ...rest } = props;
24851
+ return (jsxRuntimeExports.jsx(MuiPopper, { ...rest, container: popperContainer ?? rest.container, style: { ...(rest.style ?? {}), zIndex: 20000 } }));
24852
+ };
24853
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, popperContainer, }) => {
24857
24854
  const t = useTranslationContext();
24858
24855
  const [searchValue, setSearchValue] = React$1.useState('');
24859
24856
  const [limit, setLimit] = React$1.useState(PAGE_SIZE);
@@ -24878,7 +24875,7 @@ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, onCrea
24878
24875
  alignItems: 'center',
24879
24876
  }, children: [t('global.noOptions'), jsxRuntimeExports.jsx(LoadingButton$1, { onClick: () => onCreateNew(trimmedSearchValue), loading: isCreatingNew, disabled: isDisabled, variant: "contained", size: "small", sx: { marginTop: 1.3 }, children: t('global.createNew') })] }));
24880
24877
  };
24881
- return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(material.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(material.Box, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1$a, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(material.Autocomplete, { multiple: true, disablePortal: false, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), PopperComponent: AutocompletePopper, renderOption: (props, option) => jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' }), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(material.Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(material.TextField, { ...params, size: "small" }), ListboxProps: {
24878
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(material.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(material.Box, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1$a, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(material.Autocomplete, { multiple: true, disablePortal: false, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), PopperComponent: (props) => (jsxRuntimeExports.jsx(AutocompletePopper, { ...props, popperContainer: popperContainer })), renderOption: (props, option) => jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' }), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(material.Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(material.TextField, { ...params, size: "small" }), ListboxProps: {
24882
24879
  onScroll: onListboxScroll,
24883
24880
  sx: { maxHeight: 280, overflowY: 'auto' },
24884
24881
  }, noOptionsText: jsxRuntimeExports.jsx(CustomNoOptionsMessage, {}), sx: { width: '100%' } })] }));
@@ -54960,15 +54957,26 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54960
54957
  return;
54961
54958
  const check = () => {
54962
54959
  const next = el.scrollWidth > el.clientWidth;
54963
- setIsTitleTruncated(next);
54960
+ setIsTitleTruncated((prev) => (prev === next ? prev : next));
54964
54961
  };
54965
54962
  check();
54966
54963
  if (typeof ResizeObserver !== 'undefined') {
54964
+ let rafId = 0;
54967
54965
  const ro = new ResizeObserver(() => {
54968
- check();
54966
+ if (typeof window === 'undefined') {
54967
+ check();
54968
+ return;
54969
+ }
54970
+ if (rafId)
54971
+ window.cancelAnimationFrame(rafId);
54972
+ rafId = window.requestAnimationFrame(() => {
54973
+ check();
54974
+ });
54969
54975
  });
54970
54976
  ro.observe(el);
54971
54977
  return () => {
54978
+ if (typeof window !== 'undefined' && rafId)
54979
+ window.cancelAnimationFrame(rafId);
54972
54980
  ro.disconnect();
54973
54981
  };
54974
54982
  }
@@ -54978,7 +54986,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54978
54986
  return () => {
54979
54987
  window.removeEventListener('resize', check);
54980
54988
  };
54981
- }, [customContactFields, property.nameKey, isEditing]);
54989
+ }, [customContactFields, property.nameKey]);
54982
54990
  const handleInputChange = (name, value) => {
54983
54991
  const updatedValue = property.type === Contacts.ContactField_type.DATERANGE
54984
54992
  ? Array.isArray(value) && value[0] && value[1]
@@ -56687,7 +56695,6 @@ const StyledBox = material.styled(material.Box)(({ theme }) => ({
56687
56695
  const StyledTypography = material.styled(material.Typography)(({}) => ({
56688
56696
  letterSpacing: -0.5,
56689
56697
  fontSize: 14,
56690
- fontWeight: 600,
56691
56698
  }));
56692
56699
  const HeaderBox = material.styled(material.Box)(({}) => ({
56693
56700
  display: 'flex',
@@ -57684,6 +57691,7 @@ const useModalCloseHandler = ({ onClose }) => {
57684
57691
 
57685
57692
  const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, language = 'en', navigate, }) => {
57686
57693
  const { t: i18nT, i18n } = reactI18next.useTranslation();
57694
+ const modalContentRef = React$1.useRef(null);
57687
57695
  React$1.useEffect(() => {
57688
57696
  if (language) {
57689
57697
  i18n.changeLanguage(language);
@@ -57742,16 +57750,16 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, lang
57742
57750
  boxShadow: 24,
57743
57751
  outline: 0,
57744
57752
  p: 3,
57745
- overflow: 'hidden',
57753
+ overflow: 'visible',
57746
57754
  };
57747
57755
  const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57748
- return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsxs(material.Box, { sx: mergedSx, children: [jsxRuntimeExports.jsx(material.IconButton, { "aria-label": "close", onClick: handleClose, sx: {
57756
+ return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsxs(material.Box, { sx: mergedSx, ref: modalContentRef, children: [jsxRuntimeExports.jsx(material.IconButton, { "aria-label": "close", onClick: handleClose, sx: {
57749
57757
  position: 'absolute',
57750
- right: 8,
57751
- top: 8,
57758
+ right: 5,
57759
+ top: 5,
57752
57760
  color: (theme) => theme.palette.grey[500],
57753
57761
  zIndex: 1,
57754
- }, children: jsxRuntimeExports.jsx(default_1$g, {}) }), state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
57762
+ }, size: "small", children: jsxRuntimeExports.jsx(default_1$g, { sx: { fontSize: 20 } }) }), state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
57755
57763
  display: 'flex',
57756
57764
  justifyContent: 'center',
57757
57765
  alignItems: 'center',
@@ -57764,7 +57772,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, lang
57764
57772
  : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57765
57773
  selectors.contactType === 'business'
57766
57774
  ? selectors.contactType
57767
- : '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: labelsOptions, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, onCreateNew: handleCreateLabel, isCreatingNew: isCreatingLabel }) }) })] }) })) : null] }) }) }) }) }) }));
57775
+ : '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: labelsOptions, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, onCreateNew: handleCreateLabel, isCreatingNew: isCreatingLabel, popperContainer: modalContentRef.current }) }) })] }) })) : null] }) }) }) }) }) }));
57768
57776
  };
57769
57777
 
57770
57778
  exports.i18n = i18n;