lecom-ui 3.9.9 → 4.0.1

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.
@@ -6,9 +6,8 @@ import { ScrollArea } from '../ScrollArea/ScrollArea.js';
6
6
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../Select/Select.js';
7
7
  import { useIsMobile } from '../../hooks/useIsMobile.js';
8
8
  import { User } from 'lucide-react';
9
- import '../../i18n/index.js';
10
- import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from '../Tooltip/Tooltip.js';
11
9
  import i18n from 'i18next';
10
+ import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from '../Tooltip/Tooltip.js';
12
11
 
13
12
  const UserMenu = ({
14
13
  customStyles,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { I18nextProvider } from 'react-i18next';
3
- import '../../i18n/index.js';
3
+ import i18n from 'i18next';
4
4
  import { getCookie } from '../../utils/cookie.js';
5
5
  import '../CustomIcon/Icons/CadastroFacil.js';
6
6
  import '../CustomIcon/Icons/LogoLecom.js';
@@ -10,7 +10,6 @@ import { LogoLecomBrand } from '../CustomIcon/Icons/LogoLecomBrand.js';
10
10
  import { Header } from '../Header/Header.js';
11
11
  import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarFooter } from '../Sidebar/Sidebar.js';
12
12
  import { Typography } from '../Typography/Typography.js';
13
- import i18n from 'i18next';
14
13
 
15
14
  const Layout = ({ children, header, sideBar }) => {
16
15
  const { items, info } = sideBar;
@@ -3,10 +3,11 @@ import { useTranslation } from 'react-i18next';
3
3
  import { Button } from '../Button/Button.js';
4
4
  import { cn } from '../../lib/utils.js';
5
5
  import { ChevronFirst, ChevronLast, ChevronLeft, ChevronRight, MoreHorizontal, ChevronDown } from 'lucide-react';
6
- import '../../i18n/index.js';
6
+ import { initializeI18n } from '../../i18n/index.js';
7
7
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../DropdownMenu/DropdownMenu.js';
8
8
  import { Typography } from '../Typography/Typography.js';
9
9
 
10
+ initializeI18n();
10
11
  const PaginationContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
11
12
  "ul",
12
13
  {
@@ -19,21 +19,31 @@ const i18nConfig = {
19
19
  escapeValue: false
20
20
  }
21
21
  };
22
- if (!i18n.isInitialized) {
23
- i18n.use(initReactI18next).init(i18nConfig);
24
- }
25
- const initializeI18n = ({
26
- resources,
27
- lng = "pt_BR" /* PT_BR */
28
- }) => {
29
- let mappedResources = {};
30
- if (resources) {
31
- mappedResources = {
32
- ...i18nConfig.resources,
33
- resources
34
- };
35
- }
36
- console.log(i18nConfig, mappedResources, resources);
22
+ const initializeI18n = (options) => {
23
+ const { resources, lng } = options || {};
24
+ const mappedResources = {
25
+ resources: {
26
+ ["pt_BR" /* PT_BR */]: {
27
+ translations: {
28
+ ...translations["pt_BR" /* PT_BR */].translations,
29
+ ...resources?.["pt_BR" /* PT_BR */]?.translations ?? {}
30
+ }
31
+ },
32
+ ["en_US" /* EN_US */]: {
33
+ translations: {
34
+ ...translations["en_US" /* EN_US */].translations,
35
+ ...resources?.["en_US" /* EN_US */]?.translations ?? {}
36
+ }
37
+ },
38
+ ["es_ES" /* ES_ES */]: {
39
+ translations: {
40
+ ...translations["es_ES" /* ES_ES */].translations,
41
+ ...resources?.["es_ES" /* ES_ES */]?.translations ?? {}
42
+ }
43
+ }
44
+ }
45
+ };
46
+ console.log("i18n.isInitialized", i18n.isInitialized);
37
47
  i18n.use(initReactI18next).init({ ...i18nConfig, ...mappedResources, lng });
38
48
  };
39
49
 
package/dist/index.d.ts CHANGED
@@ -270,17 +270,6 @@ declare const usePagination: ({ count, defaultPage, boundaryCount, siblingCount,
270
270
  items: UsePaginationItem[];
271
271
  };
272
272
 
273
- declare enum Translations {
274
- PT_BR = "pt_BR",
275
- EN_US = "en_US",
276
- ES_ES = "es_ES"
277
- }
278
- interface InitializeI18n {
279
- resources?: InitOptions['resources'];
280
- lng?: Translations;
281
- }
282
- declare const initializeI18n: ({ resources, lng, }: InitializeI18n) => void;
283
-
284
273
  type PaginationButtonProps = {
285
274
  className?: string;
286
275
  disabled?: boolean;
@@ -666,6 +655,19 @@ declare function useSidebar(): SidebarContext;
666
655
 
667
656
  declare function useIsMobile(): boolean;
668
657
 
658
+ declare enum Translations {
659
+ PT_BR = "pt_BR",
660
+ EN_US = "en_US",
661
+ ES_ES = "es_ES"
662
+ }
663
+ interface InitializeI18n {
664
+ resources?: {
665
+ [key in Translations]: InitOptions['resources'];
666
+ };
667
+ lng?: Translations;
668
+ }
669
+ declare const initializeI18n: (options?: InitializeI18n) => void;
670
+
669
671
  type Fonts = 'roboto' | 'montserrat' | 'ibm';
670
672
  declare const fonts: {
671
673
  roboto: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "3.9.9",
3
+ "version": "4.0.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",