@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 +49 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +2 -1
- package/dist/esm/index.js +49 -41
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +2 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ type TagsEditorProps = {
|
|
|
8
8
|
isSaving: boolean;
|
|
9
9
|
onCreateNew: (name: string) => void;
|
|
10
10
|
isCreatingNew: boolean;
|
|
11
|
+
popperContainer?: HTMLElement | null;
|
|
11
12
|
};
|
|
12
|
-
declare const TagsEditor: ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, }: TagsEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const TagsEditor: ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, popperContainer, }: TagsEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default TagsEditor;
|
package/dist/esm/index.js
CHANGED
|
@@ -15272,25 +15272,29 @@ const MembersSection = ({ contactData, title, navigate }) => {
|
|
|
15272
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)))] }));
|
|
15273
15273
|
};
|
|
15274
15274
|
|
|
15275
|
-
var add$1 = "Add";
|
|
15276
|
-
var close$1 = "Close";
|
|
15277
15275
|
var labels$1 = "Labels";
|
|
15278
15276
|
var phone$1 = "Phone";
|
|
15279
|
-
var phones$1 = "Phones";
|
|
15280
|
-
var number$1 = "Number";
|
|
15281
15277
|
var business$1 = "Business";
|
|
15282
15278
|
var businessMembers$1 = "Business Members";
|
|
15283
15279
|
var properties$1 = "Properties";
|
|
15284
|
-
var note$1 = "Note";
|
|
15285
15280
|
var view$1 = "View";
|
|
15286
|
-
var email$1 = "Email";
|
|
15287
15281
|
var tags$1 = "Tags";
|
|
15288
15282
|
var global$2 = {
|
|
15283
|
+
add: "Add",
|
|
15284
|
+
note: "Note",
|
|
15285
|
+
number: "Number",
|
|
15286
|
+
email: "Email",
|
|
15287
|
+
phones: "Phones",
|
|
15288
|
+
close: "Close",
|
|
15289
15289
|
back: "Back",
|
|
15290
|
+
createNew: "Create new",
|
|
15291
|
+
"delete": "Delete",
|
|
15292
|
+
cancel: "Cancel",
|
|
15290
15293
|
save: "Save",
|
|
15291
15294
|
noOptions: "No options",
|
|
15292
15295
|
noValue: "No value",
|
|
15293
|
-
birthdate: "Birthdate"
|
|
15296
|
+
birthdate: "Birthdate",
|
|
15297
|
+
country: "Country"
|
|
15294
15298
|
};
|
|
15295
15299
|
var avatar$1 = {
|
|
15296
15300
|
upload: "Upload photo",
|
|
@@ -15325,18 +15329,12 @@ var conversations$1 = {
|
|
|
15325
15329
|
}
|
|
15326
15330
|
};
|
|
15327
15331
|
var en = {
|
|
15328
|
-
add: add$1,
|
|
15329
|
-
close: close$1,
|
|
15330
15332
|
labels: labels$1,
|
|
15331
15333
|
phone: phone$1,
|
|
15332
|
-
phones: phones$1,
|
|
15333
|
-
number: number$1,
|
|
15334
15334
|
business: business$1,
|
|
15335
15335
|
businessMembers: businessMembers$1,
|
|
15336
15336
|
properties: properties$1,
|
|
15337
|
-
note: note$1,
|
|
15338
15337
|
view: view$1,
|
|
15339
|
-
email: email$1,
|
|
15340
15338
|
tags: tags$1,
|
|
15341
15339
|
global: global$2,
|
|
15342
15340
|
avatar: avatar$1,
|
|
@@ -15344,25 +15342,29 @@ var en = {
|
|
|
15344
15342
|
conversations: conversations$1
|
|
15345
15343
|
};
|
|
15346
15344
|
|
|
15347
|
-
var add = "Agregar";
|
|
15348
|
-
var close = "Cerrar";
|
|
15349
15345
|
var labels = "Etiquetas";
|
|
15350
15346
|
var phone = "Teléfono";
|
|
15351
|
-
var phones = "Teléfonos";
|
|
15352
|
-
var number = "Número";
|
|
15353
15347
|
var business = "Empresa";
|
|
15354
15348
|
var businessMembers = "Miembros de la empresa";
|
|
15355
15349
|
var properties = "Propiedades";
|
|
15356
|
-
var note = "Nota";
|
|
15357
15350
|
var view = "Ver";
|
|
15358
|
-
var email = "Correo Electrónico";
|
|
15359
15351
|
var tags = "Etiquetas";
|
|
15360
15352
|
var global$1 = {
|
|
15353
|
+
add: "Agregar",
|
|
15354
|
+
note: "Nota",
|
|
15355
|
+
number: "Número",
|
|
15356
|
+
email: "Correo Electrónico",
|
|
15357
|
+
close: "Cerrar",
|
|
15358
|
+
phones: "Teléfonos",
|
|
15359
|
+
"delete": "Eliminar",
|
|
15360
|
+
cancel: "Cancelar",
|
|
15361
|
+
createNew: "Crear nuevo",
|
|
15361
15362
|
back: "Atrás",
|
|
15362
15363
|
save: "Guardar",
|
|
15363
15364
|
noOptions: "Sin opciones",
|
|
15364
15365
|
noValue: "Sin valor",
|
|
15365
|
-
birthdate: "Fecha de nacimiento"
|
|
15366
|
+
birthdate: "Fecha de nacimiento",
|
|
15367
|
+
country: "País"
|
|
15366
15368
|
};
|
|
15367
15369
|
var avatar = {
|
|
15368
15370
|
upload: "Subir foto",
|
|
@@ -15397,18 +15399,12 @@ var conversations = {
|
|
|
15397
15399
|
}
|
|
15398
15400
|
};
|
|
15399
15401
|
var es = {
|
|
15400
|
-
add: add,
|
|
15401
|
-
close: close,
|
|
15402
15402
|
labels: labels,
|
|
15403
15403
|
phone: phone,
|
|
15404
|
-
phones: phones,
|
|
15405
|
-
number: number,
|
|
15406
15404
|
business: business,
|
|
15407
15405
|
businessMembers: businessMembers,
|
|
15408
15406
|
properties: properties,
|
|
15409
|
-
note: note,
|
|
15410
15407
|
view: view,
|
|
15411
|
-
email: email,
|
|
15412
15408
|
tags: tags,
|
|
15413
15409
|
global: global$1,
|
|
15414
15410
|
avatar: avatar,
|
|
@@ -24831,10 +24827,11 @@ Grow.muiSupportAuto = true;
|
|
|
24831
24827
|
var Grow$1 = Grow;
|
|
24832
24828
|
|
|
24833
24829
|
const PAGE_SIZE = 20;
|
|
24834
|
-
const AutocompletePopper =
|
|
24835
|
-
|
|
24836
|
-
}));
|
|
24837
|
-
|
|
24830
|
+
const AutocompletePopper = (props) => {
|
|
24831
|
+
const { popperContainer, ...rest } = props;
|
|
24832
|
+
return (jsxRuntimeExports.jsx(MuiPopper, { ...rest, container: popperContainer ?? rest.container, style: { ...(rest.style ?? {}), zIndex: 20000 } }));
|
|
24833
|
+
};
|
|
24834
|
+
const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, popperContainer, }) => {
|
|
24838
24835
|
const t = useTranslationContext();
|
|
24839
24836
|
const [searchValue, setSearchValue] = useState('');
|
|
24840
24837
|
const [limit, setLimit] = useState(PAGE_SIZE);
|
|
@@ -24859,7 +24856,7 @@ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, onCrea
|
|
|
24859
24856
|
alignItems: 'center',
|
|
24860
24857
|
}, 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') })] }));
|
|
24861
24858
|
};
|
|
24862
|
-
return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(IconButton$2, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(Box$2, { 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(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(Chip$2, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(TextField$1, { ...params, size: "small" }), ListboxProps: {
|
|
24859
|
+
return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(IconButton$2, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(Box$2, { 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(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(Chip$2, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(TextField$1, { ...params, size: "small" }), ListboxProps: {
|
|
24863
24860
|
onScroll: onListboxScroll,
|
|
24864
24861
|
sx: { maxHeight: 280, overflowY: 'auto' },
|
|
24865
24862
|
}, noOptionsText: jsxRuntimeExports.jsx(CustomNoOptionsMessage, {}), sx: { width: '100%' } })] }));
|
|
@@ -54941,15 +54938,26 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
|
|
|
54941
54938
|
return;
|
|
54942
54939
|
const check = () => {
|
|
54943
54940
|
const next = el.scrollWidth > el.clientWidth;
|
|
54944
|
-
setIsTitleTruncated(next);
|
|
54941
|
+
setIsTitleTruncated((prev) => (prev === next ? prev : next));
|
|
54945
54942
|
};
|
|
54946
54943
|
check();
|
|
54947
54944
|
if (typeof ResizeObserver !== 'undefined') {
|
|
54945
|
+
let rafId = 0;
|
|
54948
54946
|
const ro = new ResizeObserver(() => {
|
|
54949
|
-
|
|
54947
|
+
if (typeof window === 'undefined') {
|
|
54948
|
+
check();
|
|
54949
|
+
return;
|
|
54950
|
+
}
|
|
54951
|
+
if (rafId)
|
|
54952
|
+
window.cancelAnimationFrame(rafId);
|
|
54953
|
+
rafId = window.requestAnimationFrame(() => {
|
|
54954
|
+
check();
|
|
54955
|
+
});
|
|
54950
54956
|
});
|
|
54951
54957
|
ro.observe(el);
|
|
54952
54958
|
return () => {
|
|
54959
|
+
if (typeof window !== 'undefined' && rafId)
|
|
54960
|
+
window.cancelAnimationFrame(rafId);
|
|
54953
54961
|
ro.disconnect();
|
|
54954
54962
|
};
|
|
54955
54963
|
}
|
|
@@ -54959,7 +54967,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
|
|
|
54959
54967
|
return () => {
|
|
54960
54968
|
window.removeEventListener('resize', check);
|
|
54961
54969
|
};
|
|
54962
|
-
}, [customContactFields, property.nameKey
|
|
54970
|
+
}, [customContactFields, property.nameKey]);
|
|
54963
54971
|
const handleInputChange = (name, value) => {
|
|
54964
54972
|
const updatedValue = property.type === Contacts.ContactField_type.DATERANGE
|
|
54965
54973
|
? Array.isArray(value) && value[0] && value[1]
|
|
@@ -56668,7 +56676,6 @@ const StyledBox = styled$5(Box$2)(({ theme }) => ({
|
|
|
56668
56676
|
const StyledTypography = styled$5(Typography$2)(({}) => ({
|
|
56669
56677
|
letterSpacing: -0.5,
|
|
56670
56678
|
fontSize: 14,
|
|
56671
|
-
fontWeight: 600,
|
|
56672
56679
|
}));
|
|
56673
56680
|
const HeaderBox = styled$5(Box$2)(({}) => ({
|
|
56674
56681
|
display: 'flex',
|
|
@@ -57665,6 +57672,7 @@ const useModalCloseHandler = ({ onClose }) => {
|
|
|
57665
57672
|
|
|
57666
57673
|
const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, language = 'en', navigate, }) => {
|
|
57667
57674
|
const { t: i18nT, i18n } = useTranslation();
|
|
57675
|
+
const modalContentRef = useRef(null);
|
|
57668
57676
|
useEffect(() => {
|
|
57669
57677
|
if (language) {
|
|
57670
57678
|
i18n.changeLanguage(language);
|
|
@@ -57723,16 +57731,16 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, lang
|
|
|
57723
57731
|
boxShadow: 24,
|
|
57724
57732
|
outline: 0,
|
|
57725
57733
|
p: 3,
|
|
57726
|
-
overflow: '
|
|
57734
|
+
overflow: 'visible',
|
|
57727
57735
|
};
|
|
57728
57736
|
const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
|
|
57729
|
-
return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(Modal$2, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: Backdrop$2 }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(Fade$2, { in: open, timeout: 200, children: jsxRuntimeExports.jsxs(Box$2, { sx: mergedSx, children: [jsxRuntimeExports.jsx(IconButton$2, { "aria-label": "close", onClick: handleClose, sx: {
|
|
57737
|
+
return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(Modal$2, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: Backdrop$2 }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(Fade$2, { in: open, timeout: 200, children: jsxRuntimeExports.jsxs(Box$2, { sx: mergedSx, ref: modalContentRef, children: [jsxRuntimeExports.jsx(IconButton$2, { "aria-label": "close", onClick: handleClose, sx: {
|
|
57730
57738
|
position: 'absolute',
|
|
57731
|
-
right:
|
|
57732
|
-
top:
|
|
57739
|
+
right: 5,
|
|
57740
|
+
top: 5,
|
|
57733
57741
|
color: (theme) => theme.palette.grey[500],
|
|
57734
57742
|
zIndex: 1,
|
|
57735
|
-
}, children: jsxRuntimeExports.jsx(default_1$g, {}) }), state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(Box$2, { sx: {
|
|
57743
|
+
}, size: "small", children: jsxRuntimeExports.jsx(default_1$g, { sx: { fontSize: 20 } }) }), state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(Box$2, { sx: {
|
|
57736
57744
|
display: 'flex',
|
|
57737
57745
|
justifyContent: 'center',
|
|
57738
57746
|
alignItems: 'center',
|
|
@@ -57745,7 +57753,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, lang
|
|
|
57745
57753
|
: 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
|
|
57746
57754
|
selectors.contactType === 'business'
|
|
57747
57755
|
? selectors.contactType
|
|
57748
|
-
: 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(Fade$2, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(Box$2, { 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] }) }) }) }) }) }));
|
|
57756
|
+
: 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(Fade$2, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(Box$2, { 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] }) }) }) }) }) }));
|
|
57749
57757
|
};
|
|
57750
57758
|
|
|
57751
57759
|
export { ContactInfoPopup, EditContactModal };
|