lecom-ui 4.2.2 → 4.3.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.
- package/dist/components/DataTable/DataTable.js +171 -34
- package/dist/components/DataTable/DataTable.utils.js +102 -0
- package/dist/components/ErrorEmptyDisplay/ErrorEmptyDisplay.js +47 -0
- package/dist/components/Header/Header.js +3 -3
- package/dist/components/Header/HelpMenu.js +6 -6
- package/dist/components/Header/ImgBrand.js +12 -9
- package/dist/components/Header/ModulesMenu.js +5 -4
- package/dist/components/Header/SocialMenu.js +1 -0
- package/dist/components/Header/UserMenu.js +8 -9
- package/dist/components/Layout/Layout.js +35 -20
- package/dist/components/Notification/Notification.js +2 -2
- package/dist/components/Notification/NotificationCallout.js +3 -2
- package/dist/components/Notification/NotificationInline.js +2 -2
- package/dist/components/Pagination/Pagination.js +228 -0
- package/dist/components/RadioGroup/RadioGroup.js +46 -0
- package/dist/components/Sidebar/Sidebar.js +2 -4
- package/dist/components/Spin/Spin.js +43 -0
- package/dist/components/Switch/Switch.js +27 -0
- package/dist/components/Tooltip/Tooltip.js +3 -2
- package/dist/components/Typography/Typography.js +1 -0
- package/dist/hooks/useIsMobile.js +20 -0
- package/dist/hooks/usePagination.js +115 -0
- package/dist/i18n/index.js +49 -2
- package/dist/i18n/locales/en_us.js +3 -4
- package/dist/i18n/locales/es_es.js +3 -4
- package/dist/i18n/locales/pt_br.js +3 -4
- package/dist/index.d.ts +317 -104
- package/dist/index.js +14 -1
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +267 -0
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +137 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +9 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-first.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-last.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +17 -0
- package/dist/node_modules/react-i18next/dist/es/Translation.js +15 -0
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +1 -1
- package/dist/plugin/typographies.ts +6 -0
- package/dist/style.min.css +1 -1
- package/package.json +12 -5
|
@@ -1,57 +1,194 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
39
|
+
return /* @__PURE__ */ jsx(Pagination, { ...pagination });
|
|
32
40
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
"
|
|
49
|
-
|
|
50
|
-
children:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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 };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { clsx } from '../../node_modules/clsx/dist/clsx.js';
|
|
3
|
+
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
4
|
+
import { Typography } from '../Typography/Typography.js';
|
|
5
|
+
import ArrowUpDown from '../../node_modules/lucide-react/dist/esm/icons/arrow-up-down.js';
|
|
6
|
+
|
|
7
|
+
function buildHeaderSelect({
|
|
8
|
+
table,
|
|
9
|
+
column,
|
|
10
|
+
checkedHeader,
|
|
11
|
+
onCheckedHeaderChange
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Checkbox,
|
|
15
|
+
{
|
|
16
|
+
checked: !!checkedHeader?.({ table, column }),
|
|
17
|
+
onCheckedChange: (value) => onCheckedHeaderChange?.({ table, column, value: !!value })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function buildCellSelect({
|
|
22
|
+
row,
|
|
23
|
+
checkedCell,
|
|
24
|
+
onCheckedCellChange
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Checkbox,
|
|
28
|
+
{
|
|
29
|
+
checked: !!checkedCell?.({ row }),
|
|
30
|
+
onCheckedChange: (value) => onCheckedCellChange?.({ row, value: !!value })
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function buildColumns({
|
|
35
|
+
columns
|
|
36
|
+
}) {
|
|
37
|
+
const mappedColumns = columns.map((externalColumn) => ({
|
|
38
|
+
accessorKey: externalColumn.key,
|
|
39
|
+
header: ({ table, column }) => {
|
|
40
|
+
if (externalColumn.enableSelect) {
|
|
41
|
+
return buildHeaderSelect({
|
|
42
|
+
table,
|
|
43
|
+
column,
|
|
44
|
+
checkedHeader: externalColumn.checkedHeader,
|
|
45
|
+
onCheckedHeaderChange: externalColumn.onCheckedHeaderChange
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!externalColumn.title) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const hasSort = !!externalColumn.onSort;
|
|
52
|
+
const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
|
|
53
|
+
return /* @__PURE__ */ jsxs(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: clsx(
|
|
57
|
+
"group flex items-center gap-1",
|
|
58
|
+
hasSort && "hover:cursor-pointer"
|
|
59
|
+
),
|
|
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
|
+
}
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
cell: ({ row }) => {
|
|
75
|
+
if (externalColumn.enableSelect) {
|
|
76
|
+
return buildCellSelect({
|
|
77
|
+
row,
|
|
78
|
+
checkedCell: externalColumn.checkedCell,
|
|
79
|
+
onCheckedCellChange: externalColumn.onCheckedCellChange
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (externalColumn.render) {
|
|
83
|
+
if (typeof externalColumn.render === "function") {
|
|
84
|
+
return externalColumn.render({
|
|
85
|
+
value: row.getValue(externalColumn.key),
|
|
86
|
+
row
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return externalColumn.render;
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "body-large-400", textColor: "text-grey-800", children: row.getValue(externalColumn.key) });
|
|
92
|
+
},
|
|
93
|
+
meta: {
|
|
94
|
+
width: externalColumn.width,
|
|
95
|
+
fixed: externalColumn.fixed,
|
|
96
|
+
truncate: !!externalColumn.truncate
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
99
|
+
return mappedColumns;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { buildColumns };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
|
|
4
|
+
const ErrorEmptyDisplay = ({
|
|
5
|
+
className,
|
|
6
|
+
classContent,
|
|
7
|
+
image,
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
footer,
|
|
11
|
+
render
|
|
12
|
+
}) => {
|
|
13
|
+
if (render) {
|
|
14
|
+
return render;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
id: "error-empty-display",
|
|
20
|
+
"data-testid": "error-empty-display",
|
|
21
|
+
className: cn(
|
|
22
|
+
"flex flex-col justify-center items-center space-y-8 p-6",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
children: [
|
|
26
|
+
image,
|
|
27
|
+
/* @__PURE__ */ jsxs(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
className: cn(
|
|
31
|
+
"flex flex-col items-center justify-center space-y-2",
|
|
32
|
+
classContent
|
|
33
|
+
),
|
|
34
|
+
children: [
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
footer
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
ErrorEmptyDisplay.displayName = "ErrorEmptyDisplay";
|
|
46
|
+
|
|
47
|
+
export { ErrorEmptyDisplay };
|
|
@@ -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 {
|
|
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__ */
|
|
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 {
|
|
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__ */
|
|
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 }) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 {
|
|
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__ */
|
|
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(
|
|
@@ -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/
|
|
8
|
-
import '../../
|
|
9
|
-
import {
|
|
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__ */
|
|
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-
|
|
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
|
-
|
|
52
|
-
" ",
|
|
51
|
+
info.platformText,
|
|
53
52
|
/* @__PURE__ */ jsx(LogoLecomBrand, { className: "w-16 shrink-0" })
|
|
54
53
|
]
|
|
55
54
|
}
|
|
56
55
|
),
|
|
57
|
-
/* @__PURE__ */ jsxs(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
};
|