lecom-ui 4.2.1 → 4.3.0

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.
Files changed (38) hide show
  1. package/dist/components/DataTable/DataTable.js +171 -34
  2. package/dist/components/DataTable/DataTable.utils.js +22 -20
  3. package/dist/components/Header/Header.js +3 -3
  4. package/dist/components/Header/HelpMenu.js +6 -6
  5. package/dist/components/Header/ImgBrand.js +12 -9
  6. package/dist/components/Header/ModulesMenu.js +5 -4
  7. package/dist/components/Header/SocialMenu.js +1 -0
  8. package/dist/components/Header/UserMenu.js +8 -9
  9. package/dist/components/Layout/Layout.js +35 -20
  10. package/dist/components/Pagination/Pagination.js +68 -44
  11. package/dist/components/RadioGroup/RadioGroup.js +31 -27
  12. package/dist/components/Sidebar/Sidebar.js +2 -4
  13. package/dist/components/Spin/Spin.js +25 -22
  14. package/dist/components/Switch/Switch.js +14 -13
  15. package/dist/components/Tooltip/Tooltip.js +3 -2
  16. package/dist/components/Typography/Typography.js +1 -0
  17. package/dist/hooks/useIsMobile.js +1 -1
  18. package/dist/hooks/usePagination.js +21 -3
  19. package/dist/i18n/index.js +49 -2
  20. package/dist/i18n/locales/en_us.js +3 -4
  21. package/dist/i18n/locales/es_es.js +3 -4
  22. package/dist/i18n/locales/pt_br.js +3 -4
  23. package/dist/index.d.ts +300 -102
  24. package/dist/index.js +13 -1
  25. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +267 -0
  26. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +137 -0
  27. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +9 -1
  28. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js +18 -0
  29. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-first.js +16 -0
  30. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-last.js +16 -0
  31. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +15 -0
  32. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +17 -0
  33. package/dist/node_modules/react-i18next/dist/es/Translation.js +15 -0
  34. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +1 -1
  35. package/dist/plugin/plugin.cjs +5 -5
  36. package/dist/plugin/typographies.ts +6 -0
  37. package/dist/style.min.css +1 -1
  38. package/package.json +105 -105
@@ -1,57 +1,194 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useReactTable, flexRender } from '../../node_modules/@tanstack/react-table/build/lib/index.js';
4
- import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from '../Table/Table.js';
4
+ import { Pagination } from '../Pagination/Pagination.js';
5
+ import { ScrollArea, ScrollBar } from '../ScrollArea/ScrollArea.js';
6
+ import { Skeleton } from '../Skeleton/Skeleton.js';
7
+ import { buildColumns } from './DataTable.utils.js';
5
8
  import { getSortedRowModel, getCoreRowModel } from '../../node_modules/@tanstack/table-core/build/lib/index.js';
6
9
 
7
10
  function DataTable({
11
+ isLoading,
8
12
  columns,
9
13
  data,
10
- noResults
14
+ noResults,
15
+ pagination,
16
+ vwDiff,
17
+ vhDiff,
18
+ onIsSelected
11
19
  }) {
12
20
  const [sorting, setSorting] = React.useState([]);
13
- const [rowSelection, setRowSelection] = React.useState({});
14
21
  const table = useReactTable({
15
22
  data,
16
- columns,
23
+ columns: buildColumns({ columns }),
17
24
  getCoreRowModel: getCoreRowModel(),
18
25
  onSortingChange: setSorting,
19
26
  getSortedRowModel: getSortedRowModel(),
20
- onRowSelectionChange: setRowSelection,
21
27
  state: {
22
- sorting,
23
- rowSelection
28
+ sorting
24
29
  }
25
30
  });
26
- const getMetaStyle = (header) => {
27
- const meta = header.column.columnDef.meta;
28
- if (!meta) {
29
- return {};
31
+ const styleDataTableContainer = () => ({
32
+ width: vwDiff ? `calc(100vw - ${vwDiff}px)` : "100%",
33
+ height: vhDiff ? `calc(100vh - ${vhDiff}px)` : "100%"
34
+ });
35
+ const hasPagination = () => {
36
+ if (!pagination) {
37
+ return null;
30
38
  }
31
- return meta["style"] ?? {};
39
+ return /* @__PURE__ */ jsx(Pagination, { ...pagination });
32
40
  };
33
- return /* @__PURE__ */ jsx("div", { className: "bg-white rounded-[8px] py-0 px-2 pb-2", children: /* @__PURE__ */ jsxs(Table, { children: [
34
- /* @__PURE__ */ jsx(TableHeader, { className: "[&_tr]:border-b-[1.5px] [&_tr]:border-grey-400", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(
35
- TableHead,
36
- {
37
- style: getMetaStyle(header),
38
- children: header.isPlaceholder ? null : flexRender(
39
- header.column.columnDef.header,
40
- header.getContext()
41
- )
42
- },
43
- header.id
44
- )) }, headerGroup.id)) }),
45
- /* @__PURE__ */ jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
46
- TableRow,
41
+ const styleColumn = (meta, elem) => {
42
+ if (elem === "td" && meta.truncate) {
43
+ return {
44
+ width: meta.width,
45
+ overflow: "hidden",
46
+ maxWidth: "0",
47
+ textOverflow: "ellipsis",
48
+ whiteSpace: "nowrap"
49
+ };
50
+ }
51
+ return {
52
+ width: meta.width
53
+ };
54
+ };
55
+ const getFixed = (meta) => meta.fixed;
56
+ const arrSkeleton = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
57
+ React.useEffect(() => {
58
+ if (!isLoading) {
59
+ const listRows = document.querySelectorAll(`table#data-table tr`);
60
+ listRows.forEach((listRow, listRowIndex) => {
61
+ const rowsElem = listRow.querySelectorAll("[data-fixed]");
62
+ rowsElem.forEach((rowElem, rowElemIndex) => {
63
+ const beforeElem = rowsElem[rowElemIndex - 1];
64
+ const currentElem = rowElem;
65
+ const beforeElemWidth = beforeElem?.getBoundingClientRect()?.width ?? 0;
66
+ const beforeElemLeft = beforeElem?.style?.left ? Number(beforeElem.style.left.replace(/px/g, "")) : 0;
67
+ const lastColumnFixed = rowsElem.length - 1 === rowElemIndex;
68
+ const lastRow = listRows.length - 1 === listRowIndex;
69
+ const currentElemIsTh = currentElem.tagName === "TH";
70
+ const boxShadowWidth = currentElemIsTh ? "-1.5px" : "-0.5px";
71
+ const boxShadow = `#c9c9c9 0px ${lastRow ? "0px" : boxShadowWidth} 0px inset`;
72
+ currentElem.style.position = "sticky";
73
+ currentElem.style.left = `${beforeElemWidth + beforeElemLeft}px`;
74
+ currentElem.style.boxShadow = boxShadow;
75
+ if (lastColumnFixed) {
76
+ currentElem.setAttribute("data-separator-fixed", "true");
77
+ }
78
+ });
79
+ });
80
+ }
81
+ }, [isLoading]);
82
+ const onScroll = (e) => {
83
+ const target = e.target;
84
+ const elemSeparator = document.querySelectorAll("[data-separator-fixed]");
85
+ const countSeparator = elemSeparator.length - 1;
86
+ if (target.scrollLeft > 0) {
87
+ elemSeparator.forEach((elem, i) => {
88
+ const separator = elem;
89
+ if (countSeparator === i) {
90
+ separator.style.boxShadow = "#c9c9c9 -0.5px 0px 0px inset";
91
+ } else {
92
+ separator.style.boxShadow = `#c9c9c9 -0.5px ${i === 0 ? "-1.5px" : "-0.5px"} 0px inset`;
93
+ }
94
+ });
95
+ } else {
96
+ elemSeparator.forEach((elem, i) => {
97
+ const separator = elem;
98
+ if (i === 0) {
99
+ separator.style.boxShadow = "#c9c9c9 0px -1.5px 0px inset";
100
+ } else {
101
+ separator.style.boxShadow = `#c9c9c9 0px ${countSeparator === i ? "0px" : "-0.5px"} 0px inset`;
102
+ }
103
+ });
104
+ }
105
+ };
106
+ React.useEffect(() => {
107
+ document.querySelector("[data-radix-scroll-area-viewport]")?.addEventListener("scroll", onScroll);
108
+ return () => document.querySelector("[data-radix-scroll-area-viewport]")?.removeEventListener("scroll", onScroll);
109
+ }, []);
110
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
111
+ /* @__PURE__ */ jsx(
112
+ "div",
47
113
  {
48
- "data-state": row.getIsSelected() && "selected",
49
- className: "border-b-[0.5px] border-grey-400",
50
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { className: "py-0 h-10", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
51
- },
52
- row.id
53
- )) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, children: noResults ?? /* @__PURE__ */ jsx("div", { className: "text-center", children: "No results." }) }) }) })
54
- ] }) });
114
+ className: "bg-white rounded-[8px] p-2 transition-all duration-500",
115
+ style: { width: styleDataTableContainer().width },
116
+ children: /* @__PURE__ */ jsxs(ScrollArea, { type: "always", className: "p-2", children: [
117
+ /* @__PURE__ */ jsx(
118
+ "div",
119
+ {
120
+ className: "transition-all duration-500",
121
+ style: { maxHeight: styleDataTableContainer().height },
122
+ children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: arrSkeleton.map((id) => /* @__PURE__ */ jsx(
123
+ Skeleton,
124
+ {
125
+ className: "w-full h-[25px] rounded-lg bg-grey-200"
126
+ },
127
+ id
128
+ )) }) : /* @__PURE__ */ jsxs("table", { id: "data-table", className: "w-full", children: [
129
+ /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-10", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(
130
+ "th",
131
+ {
132
+ className: "h-12 px-4 [&:has([role=checkbox])]:pr-0 bg-white shadow-[0_-1.5px_0px_0px_#c9c9c9_inset] text-left",
133
+ "data-header": header.id,
134
+ "data-fixed": getFixed(
135
+ header.column.columnDef.meta
136
+ ),
137
+ style: styleColumn(
138
+ header.column.columnDef.meta,
139
+ "th"
140
+ ),
141
+ children: header.isPlaceholder ? null : flexRender(
142
+ header.column.columnDef.header,
143
+ header.getContext()
144
+ )
145
+ },
146
+ header.id
147
+ )) }, headerGroup.id)) }),
148
+ /* @__PURE__ */ jsx("tbody", { className: "[&_tr:last-child]:border-0 [&_tr:last-child_td]:shadow-none", children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
149
+ "tr",
150
+ {
151
+ "data-state": onIsSelected?.(row) ? "selected" : "",
152
+ className: "[&_td]:hover:bg-grey-100 [&_td]:data-[state=selected]:bg-grey-100",
153
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
154
+ "td",
155
+ {
156
+ className: "p-4 py-0 h-10 [&:has([role=checkbox])]:pr-0 transition-colors bg-white shadow-[0_-0.5px_0px_0px_#c9c9c9_inset] text-left",
157
+ "data-column": cell.column.id,
158
+ "data-fixed": getFixed(
159
+ cell.column.columnDef.meta
160
+ ),
161
+ style: styleColumn(
162
+ cell.column.columnDef.meta,
163
+ "td"
164
+ ),
165
+ children: flexRender(
166
+ cell.column.columnDef.cell,
167
+ cell.getContext()
168
+ )
169
+ },
170
+ cell.id
171
+ ))
172
+ },
173
+ row.id
174
+ )) : /* @__PURE__ */ jsx("tr", { className: "border-b-[0.5px] [&_td]:hover:bg-grey-100 [&_td]:data-[state=selected]:bg-grey-100", children: /* @__PURE__ */ jsx(
175
+ "td",
176
+ {
177
+ colSpan: columns.length,
178
+ className: "p-4 py-0 h-10 align-middle [&:has([role=checkbox])]:pr-0 transition-colors bg-white",
179
+ children: noResults ?? /* @__PURE__ */ jsx("div", { className: "text-center", children: "-" })
180
+ }
181
+ ) }) })
182
+ ] })
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
186
+ ] })
187
+ }
188
+ ),
189
+ hasPagination()
190
+ ] });
55
191
  }
192
+ DataTable.displayName = "DataTable";
56
193
 
57
194
  export { DataTable };
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
2
- import { clsx } from 'clsx';
3
- import { ArrowUpDown } from 'lucide-react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { clsx } from '../../node_modules/clsx/dist/clsx.js';
4
3
  import { Checkbox } from '../Checkbox/Checkbox.js';
5
4
  import { Typography } from '../Typography/Typography.js';
5
+ import ArrowUpDown from '../../node_modules/lucide-react/dist/esm/icons/arrow-up-down.js';
6
6
 
7
7
  function buildHeaderSelect({
8
8
  table,
@@ -10,7 +10,7 @@ function buildHeaderSelect({
10
10
  checkedHeader,
11
11
  onCheckedHeaderChange
12
12
  }) {
13
- return /* @__PURE__ */ React.createElement(
13
+ return /* @__PURE__ */ jsx(
14
14
  Checkbox,
15
15
  {
16
16
  checked: !!checkedHeader?.({ table, column }),
@@ -23,7 +23,7 @@ function buildCellSelect({
23
23
  checkedCell,
24
24
  onCheckedCellChange
25
25
  }) {
26
- return /* @__PURE__ */ React.createElement(
26
+ return /* @__PURE__ */ jsx(
27
27
  Checkbox,
28
28
  {
29
29
  checked: !!checkedCell?.({ row }),
@@ -37,7 +37,7 @@ function buildColumns({
37
37
  const mappedColumns = columns.map((externalColumn) => ({
38
38
  accessorKey: externalColumn.key,
39
39
  header: ({ table, column }) => {
40
- if (!!externalColumn.enableSelect) {
40
+ if (externalColumn.enableSelect) {
41
41
  return buildHeaderSelect({
42
42
  table,
43
43
  column,
@@ -50,34 +50,36 @@ function buildColumns({
50
50
  }
51
51
  const hasSort = !!externalColumn.onSort;
52
52
  const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
53
- return /* @__PURE__ */ React.createElement(
53
+ return /* @__PURE__ */ jsxs(
54
54
  "div",
55
55
  {
56
56
  className: clsx(
57
57
  "group flex items-center gap-1",
58
58
  hasSort && "hover:cursor-pointer"
59
59
  ),
60
- onClick: () => externalColumn.onSort?.({ table, column })
61
- },
62
- typeof externalColumn.title === "string" ? /* @__PURE__ */ React.createElement(Typography, { variant: "body-large-500", textColor: "text-grey-950" }, externalColumn.title) : title,
63
- hasSort && /* @__PURE__ */ React.createElement(
64
- ArrowUpDown,
65
- {
66
- size: 16,
67
- className: "text-grey-400 group-hover:text-grey-950"
68
- }
69
- )
60
+ onClick: () => externalColumn.onSort?.({ table, column }),
61
+ children: [
62
+ typeof externalColumn.title === "string" ? /* @__PURE__ */ jsx(Typography, { variant: "body-large-500", textColor: "text-grey-950", children: externalColumn.title }) : title,
63
+ hasSort && /* @__PURE__ */ jsx(
64
+ ArrowUpDown,
65
+ {
66
+ size: 16,
67
+ className: "text-grey-400 group-hover:text-grey-950"
68
+ }
69
+ )
70
+ ]
71
+ }
70
72
  );
71
73
  },
72
74
  cell: ({ row }) => {
73
- if (!!externalColumn.enableSelect) {
75
+ if (externalColumn.enableSelect) {
74
76
  return buildCellSelect({
75
77
  row,
76
78
  checkedCell: externalColumn.checkedCell,
77
79
  onCheckedCellChange: externalColumn.onCheckedCellChange
78
80
  });
79
81
  }
80
- if (!!externalColumn.render) {
82
+ if (externalColumn.render) {
81
83
  if (typeof externalColumn.render === "function") {
82
84
  return externalColumn.render({
83
85
  value: row.getValue(externalColumn.key),
@@ -86,7 +88,7 @@ function buildColumns({
86
88
  }
87
89
  return externalColumn.render;
88
90
  }
89
- return /* @__PURE__ */ React.createElement(Typography, { variant: "body-large-400", textColor: "text-grey-800" }, row.getValue(externalColumn.key));
91
+ return /* @__PURE__ */ jsx(Typography, { variant: "body-large-400", textColor: "text-grey-800", children: row.getValue(externalColumn.key) });
90
92
  },
91
93
  meta: {
92
94
  width: externalColumn.width,
@@ -4,7 +4,7 @@ import { cn } from '../../lib/utils.js';
4
4
  import { cva } from '../../node_modules/class-variance-authority/dist/index.js';
5
5
  import { colorLuminance } from '../../node_modules/use-color-luminance/index.es.js';
6
6
  import { useSidebar } from '../Sidebar/Sidebar.js';
7
- import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
7
+ import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
8
8
  import { HelpMenu } from './HelpMenu.js';
9
9
  import { ImgBrand } from './ImgBrand.js';
10
10
  import { ModulesMenu } from './ModulesMenu.js';
@@ -61,7 +61,7 @@ const Header = ({
61
61
  style: { backgroundColor: customStyles.bgColor },
62
62
  ...props,
63
63
  children: [
64
- /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
64
+ /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
65
65
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
66
66
  Menu,
67
67
  {
@@ -75,7 +75,7 @@ const Header = ({
75
75
  }
76
76
  ) }),
77
77
  /* @__PURE__ */ jsx(TooltipContent, { color: "black", align: "start", side: "bottom", children: open ? t("header.collapseMenu") : t("header.expandMenu") })
78
- ] }) }),
78
+ ] }),
79
79
  /* @__PURE__ */ jsxs("div", { className: "flex items-center grow gap-24", children: [
80
80
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-12", children: [
81
81
  /* @__PURE__ */ jsx(ImgBrand, { src: customImgSrc }),
@@ -4,7 +4,7 @@ import { Button } from '../Button/Button.js';
4
4
  import { Popover, PopoverContent, PopoverTrigger } from '../Popover/Popover.js';
5
5
  import { ScrollArea } from '../ScrollArea/ScrollArea.js';
6
6
  import { cn } from '../../lib/utils.js';
7
- import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
7
+ import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from '../Tooltip/Tooltip.js';
8
8
  import { useTranslation } from '../../node_modules/react-i18next/dist/es/useTranslation.js';
9
9
  import CircleHelp from '../../node_modules/lucide-react/dist/esm/icons/circle-help.js';
10
10
 
@@ -50,19 +50,19 @@ const HelpMenu = ({
50
50
  if (!title && !items) {
51
51
  return null;
52
52
  }
53
- const renderButtonTrigger = () => /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
53
+ const renderButtonTrigger = () => /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
54
54
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
55
55
  Button,
56
56
  {
57
57
  size: "small",
58
58
  iconButton: true,
59
59
  customStyles,
60
- className: "max-md:hidden",
60
+ className: "flex-shrink-0 max-md:hidden",
61
61
  isActive: isOpen,
62
62
  children: /* @__PURE__ */ jsx(CircleHelp, {})
63
63
  }
64
64
  ) }) }),
65
- /* @__PURE__ */ jsx(
65
+ /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(
66
66
  TooltipContent,
67
67
  {
68
68
  color: "black",
@@ -71,8 +71,8 @@ const HelpMenu = ({
71
71
  hidden: isOpen,
72
72
  children: t("header.help")
73
73
  }
74
- )
75
- ] }) });
74
+ ) })
75
+ ] });
76
76
  return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
77
77
  renderButtonTrigger(),
78
78
  /* @__PURE__ */ jsxs(
@@ -1,15 +1,18 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import img from '../../public/imgs/logo-lecom.png.js';
3
3
 
4
- const ImgBrand = ({ src }) => /* @__PURE__ */ jsx(
5
- "img",
6
- {
7
- loading: "lazy",
8
- src: src ?? img.src,
9
- alt: "Logo",
10
- className: "w-auto h-auto max-w-[102px] max-h-[32px]"
11
- }
12
- );
4
+ const ImgBrand = ({ src }) => {
5
+ const DEFAULT_LOGO = img;
6
+ return /* @__PURE__ */ jsx(
7
+ "img",
8
+ {
9
+ loading: "lazy",
10
+ src: src ?? DEFAULT_LOGO,
11
+ alt: "Logo",
12
+ className: "w-auto h-auto max-w-[102px] max-h-[32px]"
13
+ }
14
+ );
15
+ };
13
16
  ImgBrand.displayName = "ImgBrand";
14
17
 
15
18
  export { ImgBrand };
@@ -9,7 +9,7 @@ import '../CustomIcon/Icons/LogoLecomBrand.js';
9
9
  import { Popover, PopoverContent, PopoverTrigger } from '../Popover/Popover.js';
10
10
  import { ScrollArea } from '../ScrollArea/ScrollArea.js';
11
11
  import { cn } from '../../lib/utils.js';
12
- import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
12
+ import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from '../Tooltip/Tooltip.js';
13
13
  import { useTranslation } from '../../node_modules/react-i18next/dist/es/useTranslation.js';
14
14
 
15
15
  const Icon = ({
@@ -100,7 +100,7 @@ const ModulesMenu = ({
100
100
  if (!title && !items) {
101
101
  return null;
102
102
  }
103
- const renderButtonTrigger = () => /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
103
+ const renderButtonTrigger = () => /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
104
104
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
105
105
  Button,
106
106
  {
@@ -108,11 +108,12 @@ const ModulesMenu = ({
108
108
  iconButton: true,
109
109
  customStyles,
110
110
  isActive: isOpen,
111
+ className: "flex-shrink-0",
111
112
  children: /* @__PURE__ */ jsx(LogoLecom, {})
112
113
  }
113
114
  ) }) }),
114
- /* @__PURE__ */ jsx(TooltipContent, { color: "black", align: "end", side: "bottom", hidden: isOpen, children: t("header.modules") })
115
- ] }) });
115
+ /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipContent, { color: "black", align: "end", side: "bottom", hidden: isOpen, children: t("header.modules") }) })
116
+ ] });
116
117
  return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
117
118
  renderButtonTrigger(),
118
119
  /* @__PURE__ */ jsxs(
@@ -16,6 +16,7 @@ const SocialMenu = ({
16
16
  iconButton: true,
17
17
  customStyles,
18
18
  onClick: onOpenSocialMenuChange,
19
+ className: "flex-shrink-0",
19
20
  children: /* @__PURE__ */ jsx(MessageSquare, {})
20
21
  }
21
22
  );
@@ -4,12 +4,11 @@ import { Button } from '../Button/Button.js';
4
4
  import { Popover, PopoverContent, PopoverTrigger } from '../Popover/Popover.js';
5
5
  import { ScrollArea } from '../ScrollArea/ScrollArea.js';
6
6
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../Select/Select.js';
7
- import { useIsMobile } from '../../hooks/use-mobile.js';
8
- import '../../i18n/index.js';
9
- import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip.js';
7
+ import { useIsMobile } from '../../hooks/useIsMobile.js';
8
+ import instance from '../../node_modules/i18next/dist/esm/i18next.js';
9
+ import { Tooltip, TooltipTrigger, TooltipPortal, TooltipContent } from '../Tooltip/Tooltip.js';
10
10
  import { useTranslation } from '../../node_modules/react-i18next/dist/es/useTranslation.js';
11
11
  import User from '../../node_modules/lucide-react/dist/esm/icons/user.js';
12
- import instance from '../../node_modules/i18next/dist/esm/i18next.js';
13
12
 
14
13
  const UserMenu = ({
15
14
  customStyles,
@@ -69,7 +68,7 @@ const UserMenu = ({
69
68
  }
70
69
  );
71
70
  };
72
- const renderButtonTrigger = () => /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
71
+ const renderButtonTrigger = () => /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
73
72
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
74
73
  Button,
75
74
  {
@@ -80,7 +79,7 @@ const UserMenu = ({
80
79
  children: isMobile ? /* @__PURE__ */ jsx(User, {}) : user?.name
81
80
  }
82
81
  ) }) }),
83
- /* @__PURE__ */ jsx(
82
+ /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(
84
83
  TooltipContent,
85
84
  {
86
85
  color: "black",
@@ -89,8 +88,8 @@ const UserMenu = ({
89
88
  hidden: isOpen,
90
89
  children: t("header.settings")
91
90
  }
92
- )
93
- ] }) });
91
+ ) })
92
+ ] });
94
93
  return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
95
94
  renderButtonTrigger(),
96
95
  /* @__PURE__ */ jsx(
@@ -107,7 +106,7 @@ const UserMenu = ({
107
106
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-2", children: [
108
107
  /* @__PURE__ */ jsx("div", { className: "bg-grey-400/30 rounded-full w-9 h-9 flex items-center justify-center [&>svg]:!w-6 [&>svg]:!h-6 shrink-0", children: /* @__PURE__ */ jsx(User, { className: "text-grey-600" }) }),
109
108
  /* @__PURE__ */ jsxs("div", { className: "grow", children: [
110
- /* @__PURE__ */ jsx("span", { className: "block body-large-400 break-all", children: user?.name }),
109
+ /* @__PURE__ */ jsx("span", { className: "block body-large-400 break-words", children: user?.name }),
111
110
  /* @__PURE__ */ jsx("span", { className: "block body-medium-400 break-all", children: user?.email })
112
111
  ] })
113
112
  ] }),
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
+ import { initializeI18n } from '../../i18n/index.js';
3
4
  import { getCookie } from '../../utils/cookie.js';
4
5
  import '../CustomIcon/Icons/CadastroFacil.js';
5
6
  import '../CustomIcon/Icons/LogoLecom.js';
@@ -9,10 +10,9 @@ import { LogoLecomBrand } from '../CustomIcon/Icons/LogoLecomBrand.js';
9
10
  import { Header } from '../Header/Header.js';
10
11
  import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarFooter } from '../Sidebar/Sidebar.js';
11
12
  import { Typography } from '../Typography/Typography.js';
12
- import { useTranslation } from '../../node_modules/react-i18next/dist/es/useTranslation.js';
13
13
 
14
+ initializeI18n();
14
15
  const Layout = ({ children, header, sideBar }) => {
15
- const { t } = useTranslation();
16
16
  const { items, info } = sideBar;
17
17
  const [sidebarState, setSidebarState] = React.useState(
18
18
  void 0
@@ -46,31 +46,46 @@ const Layout = ({ children, header, sideBar }) => {
46
46
  {
47
47
  variant: "heading-xsmall-600",
48
48
  textColor: "text-grey-800",
49
- className: "flex items-center gap-2",
49
+ className: "flex items-center gap-2 w-[200px]",
50
50
  children: [
51
- t("sidebar.platform"),
52
- " ",
51
+ info.platformText,
53
52
  /* @__PURE__ */ jsx(LogoLecomBrand, { className: "w-16 shrink-0" })
54
53
  ]
55
54
  }
56
55
  ),
57
- /* @__PURE__ */ jsxs(Typography, { variant: "body-medium-400", textColor: "text-grey-800", children: [
58
- t("sidebar.version"),
59
- " ",
60
- info.version,
61
- " - ",
62
- info.cycle,
63
- " ",
64
- info.build
65
- ] }),
66
- /* @__PURE__ */ jsxs(Typography, { variant: "body-medium-400", textColor: "text-grey-800", children: [
67
- t("sidebar.authorizedFor"),
68
- " ",
69
- info.authorizedFor
70
- ] })
56
+ /* @__PURE__ */ jsxs(
57
+ Typography,
58
+ {
59
+ variant: "body-medium-400",
60
+ textColor: "text-grey-800",
61
+ className: "w-[200px]",
62
+ children: [
63
+ info.versionText,
64
+ " ",
65
+ info.version,
66
+ " - ",
67
+ info.cycle,
68
+ " ",
69
+ info.build
70
+ ]
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsxs(
74
+ Typography,
75
+ {
76
+ variant: "body-medium-400",
77
+ textColor: "text-grey-800",
78
+ className: "w-[200px]",
79
+ children: [
80
+ info.authorizedForText,
81
+ " ",
82
+ info.authorizedFor
83
+ ]
84
+ }
85
+ )
71
86
  ] })
72
87
  ] }),
73
- /* @__PURE__ */ jsx("main", { className: "grow", children })
88
+ /* @__PURE__ */ jsx("main", { className: "grow w-full", children })
74
89
  ] })
75
90
  ] });
76
91
  };