lecom-ui 4.0.3 → 4.0.5
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/components/Layout/Layout.js +3 -3
- package/dist/i18n/index.js +17 -27
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import i18n from 'i18next';
|
|
2
|
+
import { initializeI18n } from '../../i18n/index.js';
|
|
4
3
|
import { getCookie } from '../../utils/cookie.js';
|
|
5
4
|
import '../CustomIcon/Icons/CadastroFacil.js';
|
|
6
5
|
import '../CustomIcon/Icons/LogoLecom.js';
|
|
@@ -11,10 +10,11 @@ import { Header } from '../Header/Header.js';
|
|
|
11
10
|
import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarFooter } from '../Sidebar/Sidebar.js';
|
|
12
11
|
import { Typography } from '../Typography/Typography.js';
|
|
13
12
|
|
|
13
|
+
initializeI18n();
|
|
14
14
|
const Layout = ({ children, header, sideBar }) => {
|
|
15
15
|
const { items, info } = sideBar;
|
|
16
16
|
const sidebarState = getCookie("sidebar:state") === "true";
|
|
17
|
-
return /* @__PURE__ */ React.createElement(SidebarProvider, { className: "flex-col", defaultOpen: sidebarState }, /* @__PURE__ */ React.createElement(
|
|
17
|
+
return /* @__PURE__ */ React.createElement(SidebarProvider, { className: "flex-col", defaultOpen: sidebarState }, /* @__PURE__ */ React.createElement(Header, { ...header }), /* @__PURE__ */ React.createElement("div", { className: "flex grow" }, /* @__PURE__ */ React.createElement(Sidebar, { collapsible: "icon", variant: "sidebar" }, /* @__PURE__ */ React.createElement(SidebarContent, null, /* @__PURE__ */ React.createElement(SidebarGroup, null, /* @__PURE__ */ React.createElement(SidebarGroupContent, null, /* @__PURE__ */ React.createElement(SidebarMenu, null, items.map((item) => /* @__PURE__ */ React.createElement(SidebarMenuItem, { key: item.title }, /* @__PURE__ */ React.createElement(
|
|
18
18
|
SidebarMenuButton,
|
|
19
19
|
{
|
|
20
20
|
asChild: true,
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { initReactI18next } from 'react-i18next';
|
|
2
|
-
export { useTranslation } from 'react-i18next';
|
|
2
|
+
export { Translation, useTranslation } from 'react-i18next';
|
|
3
3
|
import i18n from 'i18next';
|
|
4
4
|
export { default as i18n } from 'i18next';
|
|
5
5
|
import { translations } from './locales/index.js';
|
|
@@ -23,42 +23,32 @@ const initializeI18n = (options) => {
|
|
|
23
23
|
const { resources, lng } = options || {
|
|
24
24
|
lng: "pt_BR" /* PT_BR */
|
|
25
25
|
};
|
|
26
|
+
const languages = [
|
|
27
|
+
"pt_BR" /* PT_BR */,
|
|
28
|
+
"en_US" /* EN_US */,
|
|
29
|
+
"es_ES" /* ES_ES */
|
|
30
|
+
];
|
|
26
31
|
if (!i18n.isInitialized) {
|
|
27
|
-
console.log("i18n.isInitialized if", i18n.isInitialized);
|
|
28
32
|
const mappedResources = {
|
|
29
|
-
resources: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
["en_US" /* EN_US */]: {
|
|
37
|
-
translations: {
|
|
38
|
-
...translations["en_US" /* EN_US */].translations,
|
|
39
|
-
...resources?.["en_US" /* EN_US */]?.translations ?? {}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
["es_ES" /* ES_ES */]: {
|
|
33
|
+
resources: {}
|
|
34
|
+
};
|
|
35
|
+
languages.forEach((language) => {
|
|
36
|
+
mappedResources.resources = {
|
|
37
|
+
...mappedResources.resources,
|
|
38
|
+
[language]: {
|
|
43
39
|
translations: {
|
|
44
|
-
...translations[
|
|
45
|
-
...resources?.[
|
|
40
|
+
...translations[language].translations,
|
|
41
|
+
...resources?.[language]?.translations ?? {}
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
44
|
+
};
|
|
45
|
+
});
|
|
50
46
|
i18n.use(initReactI18next).init({
|
|
51
47
|
...i18nConfig,
|
|
52
48
|
...mappedResources,
|
|
53
49
|
lng
|
|
54
50
|
});
|
|
55
|
-
} else {
|
|
56
|
-
console.log("i18n.isInitialized else", i18n.isInitialized);
|
|
57
|
-
const languages = [
|
|
58
|
-
"pt_BR" /* PT_BR */,
|
|
59
|
-
"en_US" /* EN_US */,
|
|
60
|
-
"es_ES" /* ES_ES */
|
|
61
|
-
];
|
|
51
|
+
} else if (resources) {
|
|
62
52
|
languages.forEach((language) => {
|
|
63
53
|
i18n.addResourceBundle(
|
|
64
54
|
language,
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
|
12
12
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
13
13
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
14
14
|
import { InitOptions } from 'i18next';
|
|
15
|
-
export { default as i18n } from 'i18next';
|
|
16
|
-
export { useTranslation } from 'react-i18next';
|
|
15
|
+
export { TFunction, default as i18n } from 'i18next';
|
|
16
|
+
export { Translation, useTranslation } from 'react-i18next';
|
|
17
17
|
|
|
18
18
|
declare const accordionVariants: (props?: ({
|
|
19
19
|
variant?: "default" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -29,4 +29,4 @@ export { Translations, initializeI18n } from './i18n/index.js';
|
|
|
29
29
|
export { colors } from './tokens/colors.js';
|
|
30
30
|
export { fonts } from './tokens/fonts.js';
|
|
31
31
|
export { default as i18n } from 'i18next';
|
|
32
|
-
export { useTranslation } from 'react-i18next';
|
|
32
|
+
export { Translation, useTranslation } from 'react-i18next';
|