@trii/components 2.0.12 → 2.0.13
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 +45 -2814
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +2 -1
- package/dist/cjs/types/components/ContactInfoPopup/components/Header/Header.d.ts +6 -6
- package/dist/cjs/types/index.d.ts +0 -5
- package/dist/esm/index.js +48 -2811
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +2 -1
- package/dist/esm/types/components/ContactInfoPopup/components/Header/Header.d.ts +6 -6
- package/dist/esm/types/index.d.ts +0 -5
- package/dist/index.d.ts +3 -84
- package/package.json +2 -6
- package/readme +0 -42
|
@@ -4,10 +4,11 @@ export interface ContactInfoPopupProps {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
anchorEl: HTMLElement | null;
|
|
6
6
|
onClose: () => void;
|
|
7
|
+
t?: (key: string) => string;
|
|
7
8
|
contactData?: IContact | IBusiness;
|
|
8
9
|
avatarImgUrl?: string;
|
|
9
10
|
sx?: SxProps<Theme>;
|
|
10
11
|
navigate: (path: string) => void;
|
|
11
12
|
}
|
|
12
|
-
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default ContactInfoPopup;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
type HeaderProps = {
|
|
2
|
+
imgUrl: string | undefined;
|
|
3
|
+
name: string | undefined;
|
|
4
|
+
contactId: string | undefined;
|
|
5
5
|
navigate: (path: string) => void;
|
|
6
|
-
}
|
|
7
|
-
|
|
6
|
+
};
|
|
7
|
+
declare const Header: ({ imgUrl, name, contactId, navigate }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default Header;
|
|
@@ -1,6 +1 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export { LanguageProvider, useLanguage } from './contexts/LanguageContext';
|
|
3
|
-
export { LanguageSelector } from './components/LanguageSelector';
|
|
4
|
-
export { useTriiTranslation } from './utils/translation';
|
|
5
|
-
export { enTranslations } from './translations/en';
|
|
6
|
-
export { esTranslations } from './translations/es';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { IContact, IBusiness } from '@trii/types/dist/Contacts';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import * as i18next from 'i18next';
|
|
6
4
|
|
|
7
5
|
interface TestBoxProps {
|
|
8
6
|
/**
|
|
@@ -16,91 +14,12 @@ interface ContactInfoPopupProps {
|
|
|
16
14
|
open: boolean;
|
|
17
15
|
anchorEl: HTMLElement | null;
|
|
18
16
|
onClose: () => void;
|
|
17
|
+
t?: (key: string) => string;
|
|
19
18
|
contactData?: IContact | IBusiness;
|
|
20
19
|
avatarImgUrl?: string;
|
|
21
20
|
sx?: SxProps<Theme>;
|
|
22
21
|
navigate: (path: string) => void;
|
|
23
22
|
}
|
|
24
|
-
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, }: ContactInfoPopupProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t, }: ContactInfoPopupProps) => react_jsx_runtime.JSX.Element;
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
language: string;
|
|
28
|
-
setLanguage: (lang: string) => void;
|
|
29
|
-
}
|
|
30
|
-
declare const LanguageProvider: React.FC<{
|
|
31
|
-
children: React.ReactNode;
|
|
32
|
-
}>;
|
|
33
|
-
declare const useLanguage: () => LanguageContextType;
|
|
34
|
-
|
|
35
|
-
declare const LanguageSelector: React.FC;
|
|
36
|
-
|
|
37
|
-
declare const useTriiTranslation: (namespace?: string) => {
|
|
38
|
-
t: (key: string, options?: Record<string, any>) => string;
|
|
39
|
-
i18n: i18next.i18n;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
declare const enTranslations: {
|
|
43
|
-
components: {
|
|
44
|
-
contactInfoPopup: {
|
|
45
|
-
businessSection: {
|
|
46
|
-
title: string;
|
|
47
|
-
description: string;
|
|
48
|
-
};
|
|
49
|
-
contactMethod: {
|
|
50
|
-
email: string;
|
|
51
|
-
phone: string;
|
|
52
|
-
website: string;
|
|
53
|
-
};
|
|
54
|
-
labelsSection: {
|
|
55
|
-
title: string;
|
|
56
|
-
};
|
|
57
|
-
membersSection: {
|
|
58
|
-
title: string;
|
|
59
|
-
noMembers: string;
|
|
60
|
-
};
|
|
61
|
-
global: {
|
|
62
|
-
properties: string;
|
|
63
|
-
business: string;
|
|
64
|
-
businessMembers: string;
|
|
65
|
-
labels: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
textBox: {
|
|
69
|
-
placeholder: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
declare const esTranslations: {
|
|
75
|
-
components: {
|
|
76
|
-
contactInfoPopup: {
|
|
77
|
-
businessSection: {
|
|
78
|
-
title: string;
|
|
79
|
-
description: string;
|
|
80
|
-
};
|
|
81
|
-
contactMethod: {
|
|
82
|
-
email: string;
|
|
83
|
-
phone: string;
|
|
84
|
-
website: string;
|
|
85
|
-
};
|
|
86
|
-
labelsSection: {
|
|
87
|
-
title: string;
|
|
88
|
-
};
|
|
89
|
-
membersSection: {
|
|
90
|
-
title: string;
|
|
91
|
-
noMembers: string;
|
|
92
|
-
};
|
|
93
|
-
global: {
|
|
94
|
-
properties: string;
|
|
95
|
-
business: string;
|
|
96
|
-
businessMembers: string;
|
|
97
|
-
labels: string;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
textBox: {
|
|
101
|
-
placeholder: string;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export { ContactInfoPopup, LanguageProvider, LanguageSelector, TestBox, enTranslations, esTranslations, useLanguage, useTriiTranslation };
|
|
25
|
+
export { ContactInfoPopup, TestBox };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trii/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"description": "Trii components package",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -74,14 +74,12 @@
|
|
|
74
74
|
"@types/jest": "^29.5.5",
|
|
75
75
|
"@types/react": "^18.2.23",
|
|
76
76
|
"babel-jest": "^29.7.0",
|
|
77
|
-
"i18next": "^23.7.16",
|
|
78
77
|
"jest": "^29.7.0",
|
|
79
78
|
"jest-environment-jsdom": "^29.7.0",
|
|
80
79
|
"postcss": "^8.4.31",
|
|
81
80
|
"postcss-import": "^15.1.0",
|
|
82
81
|
"react": "^18.2.0",
|
|
83
82
|
"react-dom": "^18.2.0",
|
|
84
|
-
"react-i18next": "^14.0.5",
|
|
85
83
|
"rollup": "^3.29.4",
|
|
86
84
|
"rollup-plugin-dts": "^6.0.2",
|
|
87
85
|
"rollup-plugin-postcss": "^4.0.2",
|
|
@@ -92,9 +90,7 @@
|
|
|
92
90
|
"peerDependencies": {
|
|
93
91
|
"@emotion/react": "^11.11.4",
|
|
94
92
|
"react": ">=17.0.2 <19.0.0",
|
|
95
|
-
"react-dom": ">=17.0.2 <19.0.0"
|
|
96
|
-
"i18next": ">=21.0.0",
|
|
97
|
-
"react-i18next": ">=13.0.0"
|
|
93
|
+
"react-dom": ">=17.0.2 <19.0.0"
|
|
98
94
|
},
|
|
99
95
|
"dependencies": {
|
|
100
96
|
"@trii/types": "^2.10.398",
|
package/readme
CHANGED
|
@@ -69,45 +69,3 @@ or
|
|
|
69
69
|
```sh
|
|
70
70
|
yarn publish
|
|
71
71
|
```
|
|
72
|
-
|
|
73
|
-
## Translations
|
|
74
|
-
|
|
75
|
-
The components support translations using react-i18next. To use translations in your project:
|
|
76
|
-
|
|
77
|
-
1. Make sure you have react-i18next installed in your project
|
|
78
|
-
2. Import the translation utility:
|
|
79
|
-
```typescript
|
|
80
|
-
import { useTriiTranslation } from '@trii/components';
|
|
81
|
-
```
|
|
82
|
-
3. Use the translation hook in your components:
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
const { t } = useTriiTranslation();
|
|
86
|
-
|
|
87
|
-
// Use translations
|
|
88
|
-
<div>{t('components.contactInfoPopup.businessSection.title')}</div>;
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Default Translations
|
|
92
|
-
|
|
93
|
-
The package includes default English translations. You can extend or override these translations in your project by adding them to your i18next configuration:
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
import { enTranslations } from '@trii/components/translations/en';
|
|
97
|
-
|
|
98
|
-
i18n.addResourceBundle('en', 'translation', enTranslations, true, true);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Type Safety
|
|
102
|
-
|
|
103
|
-
The package includes TypeScript types for translations. You can extend the `TriiTranslations` interface to add your own translations:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import { TriiTranslations } from '@trii/components/types/translations';
|
|
107
|
-
|
|
108
|
-
declare module '@trii/components/types/translations' {
|
|
109
|
-
interface TriiTranslations {
|
|
110
|
-
// Add your custom translations here
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|