@robertorota/rota-designe 1.0.1 → 1.0.2
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/README.md +2 -11
- package/dist/index.cjs +2339 -0
- package/dist/index.d.cts +321 -0
- package/dist/index.d.ts +321 -3
- package/dist/index.js +2418 -0
- package/dist/rota-desgine.css +1 -2
- package/package.json +17 -14
- package/dist/components/AccountSettings/AccountModal/index.d.ts +0 -10
- package/dist/components/AccountSettings/AccountModal/index.d.ts.map +0 -1
- package/dist/components/AccountSettings/ContentPreference/index.d.ts +0 -3
- package/dist/components/AccountSettings/ContentPreference/index.d.ts.map +0 -1
- package/dist/components/Button/BarButton/index.d.ts +0 -8
- package/dist/components/Button/BarButton/index.d.ts.map +0 -1
- package/dist/components/Button/CreateButton/index.d.ts +0 -7
- package/dist/components/Button/CreateButton/index.d.ts.map +0 -1
- package/dist/components/Checkbox/index.d.ts +0 -7
- package/dist/components/Checkbox/index.d.ts.map +0 -1
- package/dist/components/CodeModal/index.d.ts +0 -10
- package/dist/components/CodeModal/index.d.ts.map +0 -1
- package/dist/components/DataTable/index.d.ts +0 -41
- package/dist/components/DataTable/index.d.ts.map +0 -1
- package/dist/components/DatePicker/index.d.ts +0 -7
- package/dist/components/DatePicker/index.d.ts.map +0 -1
- package/dist/components/Header/index.d.ts +0 -30
- package/dist/components/Header/index.d.ts.map +0 -1
- package/dist/components/Icon/index.d.ts +0 -10
- package/dist/components/Icon/index.d.ts.map +0 -1
- package/dist/components/InputNumber/index.d.ts +0 -7
- package/dist/components/InputNumber/index.d.ts.map +0 -1
- package/dist/components/LoadingModal/index.d.ts +0 -8
- package/dist/components/LoadingModal/index.d.ts.map +0 -1
- package/dist/components/Modal/index.d.ts +0 -17
- package/dist/components/Modal/index.d.ts.map +0 -1
- package/dist/components/RadioButton/index.d.ts +0 -7
- package/dist/components/RadioButton/index.d.ts.map +0 -1
- package/dist/components/Spinner/index.d.ts +0 -8
- package/dist/components/Spinner/index.d.ts.map +0 -1
- package/dist/components/Switch/index.d.ts +0 -7
- package/dist/components/Switch/index.d.ts.map +0 -1
- package/dist/components/TableToolbar/index.d.ts +0 -20
- package/dist/components/TableToolbar/index.d.ts.map +0 -1
- package/dist/components/Text/index.d.ts +0 -10
- package/dist/components/Text/index.d.ts.map +0 -1
- package/dist/components/TextArea/index.d.ts +0 -7
- package/dist/components/TextArea/index.d.ts.map +0 -1
- package/dist/components/Toast/index.d.ts +0 -12
- package/dist/components/Toast/index.d.ts.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -11
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/alignMainContent/index.d.ts +0 -7
- package/dist/components/alignMainContent/index.d.ts.map +0 -1
- package/dist/components/asideBar/index.d.ts +0 -24
- package/dist/components/asideBar/index.d.ts.map +0 -1
- package/dist/components/expandedGroup/index.d.ts +0 -12
- package/dist/components/expandedGroup/index.d.ts.map +0 -1
- package/dist/components/filtersBar/index.d.ts +0 -28
- package/dist/components/filtersBar/index.d.ts.map +0 -1
- package/dist/components/filtersComponents/ButtonMain/index.d.ts +0 -2
- package/dist/components/filtersComponents/ButtonMain/index.d.ts.map +0 -1
- package/dist/components/filtersComponents/MyFastFilter/index.d.ts +0 -7
- package/dist/components/filtersComponents/MyFastFilter/index.d.ts.map +0 -1
- package/dist/components/filtersComponents/MySearch/index.d.ts +0 -5
- package/dist/components/filtersComponents/MySearch/index.d.ts.map +0 -1
- package/dist/components/filtersComponents/MySelect/index.d.ts +0 -13
- package/dist/components/filtersComponents/MySelect/index.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -32
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/input/index.d.ts +0 -7
- package/dist/components/input/index.d.ts.map +0 -1
- package/dist/components/maincontent/index.d.ts +0 -12
- package/dist/components/maincontent/index.d.ts.map +0 -1
- package/dist/components/sidebar-pinned-store.d.ts +0 -3
- package/dist/components/sidebar-pinned-store.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/rota-desgine.cjs +0 -12
- package/dist/rota-desgine.js +0 -4827
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.tsx
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AccountModal: () => AccountModal,
|
|
34
|
+
AlignMainContent: () => AlignMainContent,
|
|
35
|
+
AsideBar: () => AsideBar,
|
|
36
|
+
Checkbox: () => Checkbox,
|
|
37
|
+
CodeModal: () => CodeModal,
|
|
38
|
+
ContentPreference: () => ContentPreference,
|
|
39
|
+
DataTable: () => DataTable,
|
|
40
|
+
DatePicker: () => DatePicker,
|
|
41
|
+
FastFilter: () => FastFilter,
|
|
42
|
+
FilterBar: () => FilterBar,
|
|
43
|
+
Header: () => Header,
|
|
44
|
+
Icon: () => Icon_default,
|
|
45
|
+
InputNumber: () => InputNumber,
|
|
46
|
+
LoadingModal: () => LoadingModal,
|
|
47
|
+
MainContent: () => MainContent,
|
|
48
|
+
Modal: () => Modal,
|
|
49
|
+
MyButton: () => MyButton,
|
|
50
|
+
MyButtonMain: () => MyButtonMain,
|
|
51
|
+
MyCreateButton: () => MyCreateButton,
|
|
52
|
+
MyExpandGroup: () => MyExpandGroup,
|
|
53
|
+
MyInput: () => MyInput,
|
|
54
|
+
MySearch: () => MySearch,
|
|
55
|
+
MySelect: () => MySelect,
|
|
56
|
+
RadioButton: () => RadioButton,
|
|
57
|
+
Spinner: () => Spinner,
|
|
58
|
+
Switch: () => Switch,
|
|
59
|
+
TableToolbar: () => TableToolbar,
|
|
60
|
+
Text: () => Text,
|
|
61
|
+
TextArea: () => TextArea,
|
|
62
|
+
Toast: () => Toast,
|
|
63
|
+
Tooltip: () => Tooltip
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(index_exports);
|
|
66
|
+
|
|
67
|
+
// src/components/AccountSettings/AccountModal/index.tsx
|
|
68
|
+
var import_react5 = require("react");
|
|
69
|
+
var import_fi3 = require("react-icons/fi");
|
|
70
|
+
|
|
71
|
+
// src/components/Modal/index.tsx
|
|
72
|
+
var import_react = require("react");
|
|
73
|
+
var import_fi = require("react-icons/fi");
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
+
function Modal({
|
|
76
|
+
open,
|
|
77
|
+
title,
|
|
78
|
+
titleIcon,
|
|
79
|
+
children,
|
|
80
|
+
footer,
|
|
81
|
+
onClose,
|
|
82
|
+
onSubmit,
|
|
83
|
+
closeOnBackdrop = false,
|
|
84
|
+
showHeader = true,
|
|
85
|
+
paddedBody = true,
|
|
86
|
+
className = "",
|
|
87
|
+
bodyClassName = ""
|
|
88
|
+
}) {
|
|
89
|
+
(0, import_react.useEffect)(() => {
|
|
90
|
+
if (!open || !onClose) return;
|
|
91
|
+
function handleKeyDown(event) {
|
|
92
|
+
if (event.key === "Escape") onClose?.();
|
|
93
|
+
}
|
|
94
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
95
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
96
|
+
}, [onClose, open]);
|
|
97
|
+
if (!open) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const panelClassName = [
|
|
101
|
+
"flex max-h-[92vh] w-full max-w-lg flex-col overflow-hidden rounded-lg bg-surface-base-light shadow-xl",
|
|
102
|
+
className
|
|
103
|
+
].filter(Boolean).join(" ");
|
|
104
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
105
|
+
showHeader && (title || onClose) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "flex shrink-0 items-center justify-between border-b border-neutral-border px-5 py-4", children: [
|
|
106
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
107
|
+
titleIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "flex shrink-0 items-center text-brand-primary", "aria-hidden": "true", children: titleIcon }),
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-sm font-medium text-neutral-text-primary", children: title })
|
|
109
|
+
] }),
|
|
110
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: onClose,
|
|
115
|
+
className: "ml-auto cursor-pointer text-neutral-placeholder transition-colors hover:text-neutral-text-primary",
|
|
116
|
+
"aria-label": "Fechar modal",
|
|
117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_fi.FiX, { size: 20 })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: [
|
|
125
|
+
"flex-1 overflow-y-auto",
|
|
126
|
+
paddedBody ? "px-5 py-5" : "",
|
|
127
|
+
bodyClassName
|
|
128
|
+
].filter(Boolean).join(" "),
|
|
129
|
+
children
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", { className: "flex shrink-0 justify-end gap-3 border-t border-neutral-border bg-surface-subtle-light px-5 py-4", children: footer })
|
|
133
|
+
] });
|
|
134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-surface-base-dark/40 p-4 backdrop-blur-sm",
|
|
138
|
+
onClick: closeOnBackdrop ? onClose : void 0,
|
|
139
|
+
children: onSubmit ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
"form",
|
|
141
|
+
{
|
|
142
|
+
className: panelClassName,
|
|
143
|
+
role: "dialog",
|
|
144
|
+
"aria-modal": "true",
|
|
145
|
+
onSubmit,
|
|
146
|
+
onClick: (event) => event.stopPropagation(),
|
|
147
|
+
children: content
|
|
148
|
+
}
|
|
149
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
+
"section",
|
|
151
|
+
{
|
|
152
|
+
className: panelClassName,
|
|
153
|
+
role: "dialog",
|
|
154
|
+
"aria-modal": "true",
|
|
155
|
+
onClick: (event) => event.stopPropagation(),
|
|
156
|
+
children: content
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// src/components/AccountSettings/ContentPreference/index.tsx
|
|
164
|
+
var import_react4 = require("react");
|
|
165
|
+
var import_fi2 = require("react-icons/fi");
|
|
166
|
+
|
|
167
|
+
// src/components/Switch/index.tsx
|
|
168
|
+
var import_react2 = require("react");
|
|
169
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
170
|
+
function Switch({ label, id, className = "", ...props }) {
|
|
171
|
+
const generatedId = (0, import_react2.useId)();
|
|
172
|
+
const inputId = id ?? generatedId;
|
|
173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
174
|
+
"label",
|
|
175
|
+
{
|
|
176
|
+
htmlFor: inputId,
|
|
177
|
+
className: [
|
|
178
|
+
"inline-flex items-center gap-3 text-sm font-medium text-neutral-text-primary",
|
|
179
|
+
props.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
180
|
+
className
|
|
181
|
+
].filter(Boolean).join(" "),
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { id: inputId, type: "checkbox", className: "peer sr-only", ...props }),
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "relative h-6 w-11 rounded-full bg-neutral-border transition-colors after:absolute after:left-1 after:top-1 after:h-4 after:w-4 after:rounded-full after:bg-surface-base-light after:transition-transform peer-checked:bg-action-primary peer-checked:after:translate-x-5" }),
|
|
185
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/components/sidebar-pinned-store.ts
|
|
192
|
+
var import_react3 = require("react");
|
|
193
|
+
var STORAGE_KEY = "app-sidebar-pinned";
|
|
194
|
+
var PREFERENCE_EVENT = "app-sidebar-preference-change";
|
|
195
|
+
function subscribe(onStoreChange) {
|
|
196
|
+
const handlePreferenceChange = () => onStoreChange();
|
|
197
|
+
const handleStorage = (event) => {
|
|
198
|
+
if (event.key === STORAGE_KEY) onStoreChange();
|
|
199
|
+
};
|
|
200
|
+
window.addEventListener(PREFERENCE_EVENT, handlePreferenceChange);
|
|
201
|
+
window.addEventListener("storage", handleStorage);
|
|
202
|
+
return () => {
|
|
203
|
+
window.removeEventListener(PREFERENCE_EVENT, handlePreferenceChange);
|
|
204
|
+
window.removeEventListener("storage", handleStorage);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function getSnapshot() {
|
|
208
|
+
return window.localStorage.getItem(STORAGE_KEY) === "true";
|
|
209
|
+
}
|
|
210
|
+
function getServerSnapshot() {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
function useSidebarPinned() {
|
|
214
|
+
return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
215
|
+
}
|
|
216
|
+
function setSidebarPinned(isPinned) {
|
|
217
|
+
window.localStorage.setItem(STORAGE_KEY, String(isPinned));
|
|
218
|
+
window.dispatchEvent(new Event(PREFERENCE_EVENT));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/components/AccountSettings/ContentPreference/index.tsx
|
|
222
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
223
|
+
var THEME_STORAGE_KEY = "app-theme-preference";
|
|
224
|
+
var THEME_PREFERENCE_EVENT = "app-theme-preference-change";
|
|
225
|
+
var themeOptions = [
|
|
226
|
+
{ label: "Claro", value: "light", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_fi2.FiSun, { size: 20 }) },
|
|
227
|
+
{ label: "Escuro", value: "dark", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_fi2.FiMoon, { size: 20 }) },
|
|
228
|
+
{ label: "Sistema", value: "system", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_fi2.FiMonitor, { size: 20 }) }
|
|
229
|
+
];
|
|
230
|
+
function getSavedTheme() {
|
|
231
|
+
const savedTheme = window.localStorage.getItem(THEME_STORAGE_KEY);
|
|
232
|
+
if (savedTheme === "light" || savedTheme === "dark" || savedTheme === "system") {
|
|
233
|
+
return savedTheme;
|
|
234
|
+
}
|
|
235
|
+
return "light";
|
|
236
|
+
}
|
|
237
|
+
function subscribeTheme(onStoreChange) {
|
|
238
|
+
const handlePreferenceChange = () => onStoreChange();
|
|
239
|
+
const handleStorage = (event) => {
|
|
240
|
+
if (event.key === THEME_STORAGE_KEY) onStoreChange();
|
|
241
|
+
};
|
|
242
|
+
window.addEventListener(THEME_PREFERENCE_EVENT, handlePreferenceChange);
|
|
243
|
+
window.addEventListener("storage", handleStorage);
|
|
244
|
+
return () => {
|
|
245
|
+
window.removeEventListener(THEME_PREFERENCE_EVENT, handlePreferenceChange);
|
|
246
|
+
window.removeEventListener("storage", handleStorage);
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function getServerTheme() {
|
|
250
|
+
return "light";
|
|
251
|
+
}
|
|
252
|
+
function useThemePreference() {
|
|
253
|
+
return (0, import_react4.useSyncExternalStore)(subscribeTheme, getSavedTheme, getServerTheme);
|
|
254
|
+
}
|
|
255
|
+
function setThemePreference(theme) {
|
|
256
|
+
window.localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
257
|
+
window.dispatchEvent(new Event(THEME_PREFERENCE_EVENT));
|
|
258
|
+
}
|
|
259
|
+
function resolveTheme(theme) {
|
|
260
|
+
if (theme !== "system") return theme;
|
|
261
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
262
|
+
}
|
|
263
|
+
function ContentPreference() {
|
|
264
|
+
const theme = useThemePreference();
|
|
265
|
+
const isSidebarPinned = useSidebarPinned();
|
|
266
|
+
(0, import_react4.useEffect)(() => {
|
|
267
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
268
|
+
const applyTheme = () => {
|
|
269
|
+
document.documentElement.dataset.theme = resolveTheme(theme);
|
|
270
|
+
window.localStorage.setItem("app-theme", resolveTheme(theme));
|
|
271
|
+
};
|
|
272
|
+
applyTheme();
|
|
273
|
+
if (theme === "system") {
|
|
274
|
+
mediaQuery.addEventListener("change", applyTheme);
|
|
275
|
+
return () => mediaQuery.removeEventListener("change", applyTheme);
|
|
276
|
+
}
|
|
277
|
+
}, [theme]);
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { "aria-labelledby": "preference-title", children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
280
|
+
"h3",
|
|
281
|
+
{
|
|
282
|
+
id: "preference-title",
|
|
283
|
+
className: "text-xl font-semibold text-neutral-text-primary",
|
|
284
|
+
children: "Prefer\xEAncias"
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mt-1 text-sm text-neutral-text-secondary", children: "Personalize a apar\xEAncia da aplica\xE7\xE3o." }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mt-7 py-6", children: [
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-xs font-medium uppercase tracking-wide text-neutral-placeholder", children: "Tema" }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mt-3 grid grid-cols-3 gap-3", children: themeOptions.map((option) => {
|
|
291
|
+
const isSelected = theme === option.value;
|
|
292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
type: "button",
|
|
296
|
+
onClick: () => setThemePreference(option.value),
|
|
297
|
+
"aria-pressed": isSelected,
|
|
298
|
+
className: [
|
|
299
|
+
"relative flex cursor-pointer flex-col items-center gap-2 rounded-xl border px-3 py-4 text-sm font-medium transition-colors",
|
|
300
|
+
isSelected ? "border-action-primary bg-action-primary/10 text-action-primary" : "border-neutral-border text-neutral-text-secondary hover:bg-neutral-surface"
|
|
301
|
+
].join(" "),
|
|
302
|
+
children: [
|
|
303
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "absolute right-2 top-2 flex h-5 w-5 items-center justify-center rounded-full bg-action-primary text-text-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_fi2.FiCheck, { size: 12, "aria-hidden": "true" }) }),
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", children: option.icon }),
|
|
305
|
+
option.label
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
option.value
|
|
309
|
+
);
|
|
310
|
+
}) })
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "border-t border-neutral-border py-6", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between gap-6", children: [
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-sm font-medium text-neutral-text-primary", children: "Barra lateral fixa" }),
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "mt-1 text-sm text-neutral-text-secondary", children: "Mant\xE9m o menu lateral aberto durante a navega\xE7\xE3o." })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
318
|
+
Switch,
|
|
319
|
+
{
|
|
320
|
+
checked: isSidebarPinned,
|
|
321
|
+
onChange: (event) => setSidebarPinned(event.target.checked),
|
|
322
|
+
"aria-label": "Manter barra lateral fixa e aberta"
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
] }) })
|
|
326
|
+
] });
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/components/AccountSettings/AccountModal/index.tsx
|
|
330
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
331
|
+
var navigationItems = [
|
|
332
|
+
{ id: "account", label: "Conta", icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi3.FiUser, { size: 16 }) },
|
|
333
|
+
{ id: "preferences", label: "Prefer\xEAncias", icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi3.FiSliders, { size: 16 }) }
|
|
334
|
+
];
|
|
335
|
+
function AccountPanel() {
|
|
336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { "aria-labelledby": "account-title", children: [
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
338
|
+
"h2",
|
|
339
|
+
{
|
|
340
|
+
id: "account-title",
|
|
341
|
+
className: "text-xl font-semibold text-neutral-text-primary",
|
|
342
|
+
children: "Minha conta"
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mt-1 text-sm text-neutral-text-secondary", children: "Personalize a apar\xEAncia da sua conta, alterando o tema, tamanho das fontes e outros itens. " })
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
348
|
+
function AccountModal({
|
|
349
|
+
open,
|
|
350
|
+
onClose,
|
|
351
|
+
onLogout,
|
|
352
|
+
sidebar,
|
|
353
|
+
children
|
|
354
|
+
}) {
|
|
355
|
+
const [activeSection, setActiveSection] = (0, import_react5.useState)("account");
|
|
356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
357
|
+
Modal,
|
|
358
|
+
{
|
|
359
|
+
open,
|
|
360
|
+
onClose,
|
|
361
|
+
closeOnBackdrop: true,
|
|
362
|
+
showHeader: false,
|
|
363
|
+
paddedBody: false,
|
|
364
|
+
className: "h-[45rem] !max-w-4xl rounded-2xl border border-neutral-border",
|
|
365
|
+
bodyClassName: "min-h-0",
|
|
366
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex h-full min-h-0", children: [
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
368
|
+
"aside",
|
|
369
|
+
{
|
|
370
|
+
className: "flex w-56 shrink-0 flex-col border-r border-neutral-border bg-surface-subtle-light/60 px-2 py-5",
|
|
371
|
+
"aria-label": "Navega\xE7\xE3o da conta",
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { className: "px-2 text-sm font-semibold text-neutral-text-primary", children: "Perfil" }),
|
|
374
|
+
sidebar ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("nav", { className: "mt-4 flex flex-col gap-1", children: navigationItems.map((item) => {
|
|
375
|
+
const isActive = activeSection === item.id;
|
|
376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
377
|
+
"button",
|
|
378
|
+
{
|
|
379
|
+
type: "button",
|
|
380
|
+
onClick: () => setActiveSection(item.id),
|
|
381
|
+
"aria-current": isActive ? "page" : void 0,
|
|
382
|
+
className: [
|
|
383
|
+
"flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-medium transition-colors",
|
|
384
|
+
isActive ? "bg-surface-base-light text-action-primary shadow-sm ring-1 ring-neutral-border/60" : "text-neutral-text-secondary hover:bg-surface-base-light/70 hover:text-neutral-text-primary"
|
|
385
|
+
].join(" "),
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "shrink-0", "aria-hidden": "true", children: item.icon }),
|
|
388
|
+
item.label
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
item.id
|
|
392
|
+
);
|
|
393
|
+
}) }),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
395
|
+
"button",
|
|
396
|
+
{
|
|
397
|
+
type: "button",
|
|
398
|
+
onClick: onLogout,
|
|
399
|
+
className: "mt-auto flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-sm text-neutral-text-secondary transition-colors hover:bg-status-danger-soft/20 hover:text-status-danger",
|
|
400
|
+
children: [
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi3.FiLogOut, { size: 16, "aria-hidden": "true" }),
|
|
402
|
+
"Sair da conta"
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("main", { className: "relative min-w-0 flex-1 overflow-y-auto px-8 py-6", children: [
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
411
|
+
"button",
|
|
412
|
+
{
|
|
413
|
+
type: "button",
|
|
414
|
+
onClick: onClose,
|
|
415
|
+
className: "absolute right-6 top-6 cursor-pointer text-neutral-placeholder transition-colors hover:text-neutral-text-primary",
|
|
416
|
+
"aria-label": "Fechar modal",
|
|
417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi3.FiX, { size: 20, "aria-hidden": "true" })
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "pr-8", children: children ?? (activeSection === "preferences" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ContentPreference, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AccountPanel, {})) })
|
|
421
|
+
] })
|
|
422
|
+
] })
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// src/components/alignMainContent/index.tsx
|
|
428
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
429
|
+
var AlignMainContent = ({
|
|
430
|
+
children
|
|
431
|
+
}) => {
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("main", { className: "flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-6 pt-2 md:px-10 md:pb-8 lg:px-12", children });
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// src/components/asideBar/index.tsx
|
|
436
|
+
var import_react6 = require("react");
|
|
437
|
+
var import_bs = require("react-icons/bs");
|
|
438
|
+
var import_fa = require("react-icons/fa");
|
|
439
|
+
var import_fi4 = require("react-icons/fi");
|
|
440
|
+
var import_md = require("react-icons/md");
|
|
441
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
442
|
+
var defaultItems = [
|
|
443
|
+
{ label: "Dashboard", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_md.MdOutlineDashboard, { size: 20 }) },
|
|
444
|
+
{ label: "Kits a montar", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fa.FaWrench, { size: 18 }) },
|
|
445
|
+
{ label: "Configuracoes", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_bs.BsFillGearFill, { size: 18 }) },
|
|
446
|
+
{ label: "Equipamentos", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fa.FaTools, { size: 18 }) },
|
|
447
|
+
{ label: "Revenda", icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fa.FaStore, { size: 18 }) }
|
|
448
|
+
];
|
|
449
|
+
function AsideBar({
|
|
450
|
+
activePage,
|
|
451
|
+
onNavigate,
|
|
452
|
+
items = defaultItems,
|
|
453
|
+
groups,
|
|
454
|
+
brandTitle = "Rota",
|
|
455
|
+
brandSubtitle,
|
|
456
|
+
brandLogoSrc = "/favicon.png",
|
|
457
|
+
logoutLabel = "Sair",
|
|
458
|
+
onLogout,
|
|
459
|
+
className = "",
|
|
460
|
+
...props
|
|
461
|
+
}) {
|
|
462
|
+
const activeGroupId = groups?.find(
|
|
463
|
+
(group) => group.items.some((item) => item.label === activePage)
|
|
464
|
+
)?.id;
|
|
465
|
+
const [isExpanded, setIsExpanded] = (0, import_react6.useState)(false);
|
|
466
|
+
const isPinned = useSidebarPinned();
|
|
467
|
+
const [openGroupId, setOpenGroupId] = (0, import_react6.useState)(
|
|
468
|
+
activeGroupId
|
|
469
|
+
);
|
|
470
|
+
const isSidebarExpanded = isPinned || isExpanded;
|
|
471
|
+
function collapse() {
|
|
472
|
+
if (isPinned) return;
|
|
473
|
+
setIsExpanded(false);
|
|
474
|
+
setOpenGroupId(activeGroupId);
|
|
475
|
+
}
|
|
476
|
+
function renderItem(item, groupId) {
|
|
477
|
+
const isActive = item.label === activePage;
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
onClick: () => onNavigate(item.label, groupId),
|
|
483
|
+
"aria-label": item.label,
|
|
484
|
+
title: isSidebarExpanded ? void 0 : item.label,
|
|
485
|
+
className: [
|
|
486
|
+
"flex min-h-11 w-full cursor-pointer items-center gap-3 rounded-lg px-3 text-sm transition-colors",
|
|
487
|
+
isActive ? "font-semibold text-[var(--app-sidebar-item)]" : "text-[var(--app-sidebar-item)] hover:bg-neutral-surface"
|
|
488
|
+
].join(" "),
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
491
|
+
"span",
|
|
492
|
+
{
|
|
493
|
+
className: `flex w-8 shrink-0 items-center justify-center ${isActive ? "text-action-primary" : ""}`,
|
|
494
|
+
children: item.icon
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
isSidebarExpanded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "whitespace-nowrap", children: item.label })
|
|
498
|
+
]
|
|
499
|
+
},
|
|
500
|
+
item.label
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
504
|
+
"aside",
|
|
505
|
+
{
|
|
506
|
+
className: [
|
|
507
|
+
"flex min-h-0 shrink-0 flex-col overflow-hidden border-r border-neutral-border bg-surface-subtle-light shadow transition-[width] duration-300",
|
|
508
|
+
isSidebarExpanded ? "w-[290px]" : "w-20",
|
|
509
|
+
className
|
|
510
|
+
].join(" "),
|
|
511
|
+
onMouseEnter: () => setIsExpanded(true),
|
|
512
|
+
onMouseLeave: collapse,
|
|
513
|
+
...props,
|
|
514
|
+
children: [
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex h-[88px] shrink-0 items-center gap-4 overflow-hidden px-[22px]", children: [
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
517
|
+
"img",
|
|
518
|
+
{
|
|
519
|
+
src: brandLogoSrc,
|
|
520
|
+
alt: brandTitle,
|
|
521
|
+
className: "h-9 w-9 shrink-0 object-contain"
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
isSidebarExpanded && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex min-w-0 flex-col whitespace-nowrap", children: [
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: brandTitle }),
|
|
526
|
+
brandSubtitle && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-neutral-text-secondary", children: brandSubtitle })
|
|
527
|
+
] })
|
|
528
|
+
] }),
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { className: "flex flex-1 flex-col gap-1 overflow-y-auto p-2", "aria-label": "Navegacao principal", children: groups ? groups.map((group) => {
|
|
530
|
+
const isOpen = openGroupId === group.id;
|
|
531
|
+
const isActive = group.id === activeGroupId;
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
534
|
+
"button",
|
|
535
|
+
{
|
|
536
|
+
type: "button",
|
|
537
|
+
className: [
|
|
538
|
+
"flex min-h-12 w-full cursor-pointer items-center gap-3 rounded-lg px-3 text-[var(--app-sidebar-item)] transition-colors hover:bg-neutral-surface"
|
|
539
|
+
].join(" "),
|
|
540
|
+
onClick: () => setOpenGroupId(
|
|
541
|
+
(current) => current === group.id ? activeGroupId : group.id
|
|
542
|
+
),
|
|
543
|
+
"aria-expanded": isSidebarExpanded && isOpen,
|
|
544
|
+
"aria-label": group.label,
|
|
545
|
+
title: isSidebarExpanded ? void 0 : group.label,
|
|
546
|
+
children: [
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
548
|
+
"span",
|
|
549
|
+
{
|
|
550
|
+
className: `flex w-8 shrink-0 items-center justify-center ${isActive ? "text-action-primary" : ""}`,
|
|
551
|
+
children: group.icon
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
isSidebarExpanded && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex min-w-0 flex-1 items-center justify-between whitespace-nowrap text-sm font-semibold", children: [
|
|
555
|
+
group.label,
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
557
|
+
import_fi4.FiChevronDown,
|
|
558
|
+
{
|
|
559
|
+
className: `transition-transform ${isOpen ? "rotate-180" : ""}`,
|
|
560
|
+
size: 18
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
] })
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
isSidebarExpanded && isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-1 flex flex-col gap-1 pl-3", children: group.items.map((item) => renderItem(item, group.id)) })
|
|
568
|
+
] }, group.id);
|
|
569
|
+
}) : items.map((item) => renderItem(item)) }),
|
|
570
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "border-t border-neutral-border/70 px-3 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
571
|
+
"button",
|
|
572
|
+
{
|
|
573
|
+
type: "button",
|
|
574
|
+
onClick: onLogout,
|
|
575
|
+
className: "flex min-h-12 w-full cursor-pointer items-center gap-3 rounded-lg px-3 text-[var(--app-sidebar-item)] transition-colors hover:bg-neutral-surface hover:text-status-danger",
|
|
576
|
+
"aria-label": logoutLabel,
|
|
577
|
+
title: isSidebarExpanded ? void 0 : logoutLabel,
|
|
578
|
+
children: [
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex w-8 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi4.FiLogOut, { size: 20 }) }),
|
|
580
|
+
isSidebarExpanded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "whitespace-nowrap text-sm font-semibold", children: logoutLabel })
|
|
581
|
+
]
|
|
582
|
+
}
|
|
583
|
+
) })
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// src/components/Button/BarButton/index.tsx
|
|
590
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
591
|
+
function MyButton({
|
|
592
|
+
label,
|
|
593
|
+
icon,
|
|
594
|
+
type = "button",
|
|
595
|
+
className = "",
|
|
596
|
+
...props
|
|
597
|
+
}) {
|
|
598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
599
|
+
"button",
|
|
600
|
+
{
|
|
601
|
+
type,
|
|
602
|
+
className: `flex items-center gap-2 ${className}`,
|
|
603
|
+
...props,
|
|
604
|
+
children: [
|
|
605
|
+
icon,
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label })
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// src/components/Button/CreateButton/index.tsx
|
|
613
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
614
|
+
function MyCreateButton({
|
|
615
|
+
label,
|
|
616
|
+
icon,
|
|
617
|
+
type = "button",
|
|
618
|
+
className = "",
|
|
619
|
+
...props
|
|
620
|
+
}) {
|
|
621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
type,
|
|
625
|
+
className: `flex items-center gap-2 rounded-lg bg-brand-primary px-4 py-2 text-text-inverse outline-none hover:bg-brand-primary-hover focus:border-action-primary transition-colors cursor-pointer ${className}`,
|
|
626
|
+
...props,
|
|
627
|
+
children: [
|
|
628
|
+
icon,
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: label })
|
|
630
|
+
]
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/components/Checkbox/index.tsx
|
|
636
|
+
var import_react7 = require("react");
|
|
637
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
638
|
+
function Checkbox({ label, id, className = "", ...props }) {
|
|
639
|
+
const generatedId = (0, import_react7.useId)();
|
|
640
|
+
const inputId = id ?? generatedId;
|
|
641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
642
|
+
"label",
|
|
643
|
+
{
|
|
644
|
+
htmlFor: inputId,
|
|
645
|
+
className: [
|
|
646
|
+
"inline-flex items-center gap-2 text-sm font-medium text-neutral-text-primary",
|
|
647
|
+
props.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
648
|
+
className
|
|
649
|
+
].filter(Boolean).join(" "),
|
|
650
|
+
children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
652
|
+
"input",
|
|
653
|
+
{
|
|
654
|
+
id: inputId,
|
|
655
|
+
type: "checkbox",
|
|
656
|
+
className: "h-4 w-4 rounded border-neutral-border accent-action-primary",
|
|
657
|
+
...props
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label })
|
|
661
|
+
]
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// src/components/CodeModal/index.tsx
|
|
667
|
+
var import_react8 = require("react");
|
|
668
|
+
var import_fi5 = require("react-icons/fi");
|
|
669
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
670
|
+
function CodeModal({
|
|
671
|
+
isOpen,
|
|
672
|
+
isPositive,
|
|
673
|
+
onClose,
|
|
674
|
+
successTitle = "Success",
|
|
675
|
+
errorTitle = "Failed",
|
|
676
|
+
autoCloseDuration = 1e3
|
|
677
|
+
}) {
|
|
678
|
+
(0, import_react8.useEffect)(() => {
|
|
679
|
+
if (!isOpen || autoCloseDuration === null) return;
|
|
680
|
+
const timeoutId = window.setTimeout(onClose, autoCloseDuration);
|
|
681
|
+
return () => window.clearTimeout(timeoutId);
|
|
682
|
+
}, [autoCloseDuration, isOpen, onClose]);
|
|
683
|
+
(0, import_react8.useEffect)(() => {
|
|
684
|
+
if (!isOpen) return;
|
|
685
|
+
function handleKeyDown(event) {
|
|
686
|
+
if (event.key === "Escape") onClose();
|
|
687
|
+
}
|
|
688
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
689
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
690
|
+
}, [isOpen, onClose]);
|
|
691
|
+
if (!isOpen) return null;
|
|
692
|
+
const title = isPositive ? successTitle : errorTitle;
|
|
693
|
+
const Icon2 = isPositive ? import_fi5.FiCheckCircle : import_fi5.FiXCircle;
|
|
694
|
+
const iconClassName = isPositive ? "text-status-success" : "text-status-danger";
|
|
695
|
+
function stopPropagation(event) {
|
|
696
|
+
event.stopPropagation();
|
|
697
|
+
}
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
699
|
+
"div",
|
|
700
|
+
{
|
|
701
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-surface-base-dark/40 p-4",
|
|
702
|
+
onClick: onClose,
|
|
703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
704
|
+
"div",
|
|
705
|
+
{
|
|
706
|
+
className: "relative flex w-full max-w-sm flex-col items-center gap-4 rounded-lg bg-surface-base-light p-8 text-center shadow-xl",
|
|
707
|
+
role: "dialog",
|
|
708
|
+
"aria-modal": "true",
|
|
709
|
+
"aria-labelledby": "code-modal-title",
|
|
710
|
+
onClick: stopPropagation,
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
713
|
+
"button",
|
|
714
|
+
{
|
|
715
|
+
type: "button",
|
|
716
|
+
onClick: onClose,
|
|
717
|
+
className: "absolute right-4 top-4 cursor-pointer text-neutral-placeholder transition-colors hover:text-neutral-text-primary",
|
|
718
|
+
"aria-label": "Fechar modal",
|
|
719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_fi5.FiX, { size: 20 })
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { className: iconClassName, size: 56, strokeWidth: 1.8, "aria-hidden": "true" }),
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { id: "code-modal-title", className: "text-xl font-semibold text-neutral-text-primary", children: title })
|
|
724
|
+
]
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// src/components/DataTable/index.tsx
|
|
732
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
733
|
+
var import_fi6 = require("react-icons/fi");
|
|
734
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
735
|
+
var compareValues = (left, right) => {
|
|
736
|
+
if (left == null && right == null) return 0;
|
|
737
|
+
if (left == null) return -1;
|
|
738
|
+
if (right == null) return 1;
|
|
739
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
740
|
+
return left - right;
|
|
741
|
+
}
|
|
742
|
+
return String(left).localeCompare(String(right), void 0, {
|
|
743
|
+
numeric: true,
|
|
744
|
+
sensitivity: "base"
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
var matchesSearch = (row, columns, search) => columns.some(
|
|
748
|
+
(column) => String(row[column.accessor] ?? "").toLocaleLowerCase().includes(search)
|
|
749
|
+
);
|
|
750
|
+
function DataTable({
|
|
751
|
+
columns,
|
|
752
|
+
data,
|
|
753
|
+
isLoading = false,
|
|
754
|
+
itemsPerPage = 10,
|
|
755
|
+
paginate = true,
|
|
756
|
+
searchable = true,
|
|
757
|
+
searchPlaceholder = "Pesquisar",
|
|
758
|
+
searchValue,
|
|
759
|
+
onSearchChange,
|
|
760
|
+
customFilters,
|
|
761
|
+
toolbarStart,
|
|
762
|
+
exportOptions = [],
|
|
763
|
+
renderExpandedRow,
|
|
764
|
+
onRowClick,
|
|
765
|
+
getRowKey,
|
|
766
|
+
emptyMessage = "Nenhum resultado encontrado.",
|
|
767
|
+
resetKey,
|
|
768
|
+
minWidth = 800,
|
|
769
|
+
maxCellCharacters = 35,
|
|
770
|
+
tableLayout = "auto",
|
|
771
|
+
className = ""
|
|
772
|
+
}) {
|
|
773
|
+
const [internalSearch, setInternalSearch] = (0, import_react9.useState)("");
|
|
774
|
+
const activeSearch = searchValue ?? internalSearch;
|
|
775
|
+
const resetIdentity = `${activeSearch}\0${String(resetKey ?? "")}`;
|
|
776
|
+
const [pageState, setPageState] = (0, import_react9.useState)({ page: 1, resetIdentity });
|
|
777
|
+
const [sortAccessor, setSortAccessor] = (0, import_react9.useState)(null);
|
|
778
|
+
const [sortDirection, setSortDirection] = (0, import_react9.useState)("asc");
|
|
779
|
+
const [expandedRowState, setExpandedRowState] = (0, import_react9.useState)(null);
|
|
780
|
+
const [showExportMenu, setShowExportMenu] = (0, import_react9.useState)(false);
|
|
781
|
+
const [exportingId, setExportingId] = (0, import_react9.useState)(null);
|
|
782
|
+
const exportMenuRef = (0, import_react9.useRef)(null);
|
|
783
|
+
const currentPage = pageState.resetIdentity === resetIdentity ? pageState.page : 1;
|
|
784
|
+
const expandedRowKey = expandedRowState?.resetIdentity === resetIdentity ? expandedRowState.key : null;
|
|
785
|
+
const safeItemsPerPage = Math.max(1, itemsPerPage);
|
|
786
|
+
const filteredData = (0, import_react9.useMemo)(() => {
|
|
787
|
+
const search = activeSearch.trim().toLocaleLowerCase();
|
|
788
|
+
return searchable && search ? data.filter((row) => matchesSearch(row, columns, search)) : data;
|
|
789
|
+
}, [activeSearch, columns, data, searchable]);
|
|
790
|
+
const sortedData = (0, import_react9.useMemo)(() => {
|
|
791
|
+
if (sortAccessor == null) return filteredData;
|
|
792
|
+
const column = columns.find(
|
|
793
|
+
(candidate) => candidate.accessor === sortAccessor
|
|
794
|
+
);
|
|
795
|
+
if (!column) return filteredData;
|
|
796
|
+
return [...filteredData].sort((left, right) => {
|
|
797
|
+
const leftValue = column.sortValue ? column.sortValue(left) : left[sortAccessor];
|
|
798
|
+
const rightValue = column.sortValue ? column.sortValue(right) : right[sortAccessor];
|
|
799
|
+
const result = compareValues(leftValue, rightValue);
|
|
800
|
+
return sortDirection === "asc" ? result : -result;
|
|
801
|
+
});
|
|
802
|
+
}, [columns, filteredData, sortAccessor, sortDirection]);
|
|
803
|
+
const totalPages = paginate ? Math.max(1, Math.ceil(sortedData.length / safeItemsPerPage)) : 1;
|
|
804
|
+
const activePage = Math.min(currentPage, totalPages);
|
|
805
|
+
const firstItemIndex = paginate ? (activePage - 1) * safeItemsPerPage : 0;
|
|
806
|
+
const visibleData = paginate ? sortedData.slice(firstItemIndex, firstItemIndex + safeItemsPerPage) : sortedData;
|
|
807
|
+
const displayedStart = sortedData.length === 0 ? 0 : firstItemIndex + 1;
|
|
808
|
+
const displayedEnd = paginate ? Math.min(firstItemIndex + safeItemsPerPage, sortedData.length) : sortedData.length;
|
|
809
|
+
const showToolbar = searchable || Boolean(customFilters) || Boolean(toolbarStart) || exportOptions.length > 0;
|
|
810
|
+
const resolveRowKey = (row, index) => getRowKey?.(row, firstItemIndex + index) ?? firstItemIndex + index;
|
|
811
|
+
const updateSearch = (value) => {
|
|
812
|
+
if (searchValue === void 0) setInternalSearch(value);
|
|
813
|
+
onSearchChange?.(value);
|
|
814
|
+
};
|
|
815
|
+
const updateSort = (accessor) => {
|
|
816
|
+
if (sortAccessor === accessor) {
|
|
817
|
+
setSortDirection(
|
|
818
|
+
(direction) => direction === "asc" ? "desc" : "asc"
|
|
819
|
+
);
|
|
820
|
+
} else {
|
|
821
|
+
setSortAccessor(accessor);
|
|
822
|
+
setSortDirection("asc");
|
|
823
|
+
}
|
|
824
|
+
setPageState({ page: 1, resetIdentity });
|
|
825
|
+
setExpandedRowState(null);
|
|
826
|
+
};
|
|
827
|
+
const changePage = (page) => {
|
|
828
|
+
setPageState({
|
|
829
|
+
page: Math.min(Math.max(page, 1), totalPages),
|
|
830
|
+
resetIdentity
|
|
831
|
+
});
|
|
832
|
+
setExpandedRowState(null);
|
|
833
|
+
};
|
|
834
|
+
const handleExport = async (option) => {
|
|
835
|
+
setExportingId(option.id);
|
|
836
|
+
try {
|
|
837
|
+
await option.onExport(sortedData);
|
|
838
|
+
setShowExportMenu(false);
|
|
839
|
+
} finally {
|
|
840
|
+
setExportingId(null);
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
(0, import_react9.useEffect)(() => {
|
|
844
|
+
const handleClickOutside = (event) => {
|
|
845
|
+
if (exportMenuRef.current && !exportMenuRef.current.contains(event.target)) {
|
|
846
|
+
setShowExportMenu(false);
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
850
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
851
|
+
}, []);
|
|
852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `relative flex min-h-0 w-full flex-col ${className}`, children: [
|
|
853
|
+
exportingId && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
854
|
+
"div",
|
|
855
|
+
{
|
|
856
|
+
className: "fixed inset-0 z-40 cursor-wait bg-black/5 backdrop-blur-[2px]",
|
|
857
|
+
"aria-hidden": "true"
|
|
858
|
+
}
|
|
859
|
+
),
|
|
860
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-end justify-between gap-3 border-b border-neutral-border pb-4", children: [
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-3", children: [
|
|
862
|
+
toolbarStart,
|
|
863
|
+
customFilters
|
|
864
|
+
] }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "ml-auto flex flex-wrap items-center justify-end gap-3", children: [
|
|
866
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "relative block", children: [
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: searchPlaceholder }),
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
869
|
+
import_fi6.FiSearch,
|
|
870
|
+
{
|
|
871
|
+
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-placeholder",
|
|
872
|
+
size: 15,
|
|
873
|
+
"aria-hidden": "true"
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
877
|
+
"input",
|
|
878
|
+
{
|
|
879
|
+
type: "search",
|
|
880
|
+
value: activeSearch,
|
|
881
|
+
onChange: (event) => updateSearch(event.target.value),
|
|
882
|
+
placeholder: searchPlaceholder,
|
|
883
|
+
className: "h-[34px] w-44 rounded-2xl border border-neutral-border bg-surface-base-light py-2 pl-9 pr-3 text-sm text-neutral-text-primary outline-none transition-colors placeholder:text-neutral-placeholder focus:border-action-primary"
|
|
884
|
+
}
|
|
885
|
+
)
|
|
886
|
+
] }),
|
|
887
|
+
exportOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative", ref: exportMenuRef, children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
889
|
+
"button",
|
|
890
|
+
{
|
|
891
|
+
type: "button",
|
|
892
|
+
onClick: () => setShowExportMenu((visible) => !visible),
|
|
893
|
+
className: "flex h-[34px] items-center gap-2 rounded-2xl border border-neutral-border bg-surface-base-light px-4 text-sm font-semibold text-action-primary transition-colors hover:bg-neutral-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary",
|
|
894
|
+
"aria-expanded": showExportMenu,
|
|
895
|
+
"aria-haspopup": "menu",
|
|
896
|
+
children: [
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiDownload, { size: 15, "aria-hidden": "true" }),
|
|
898
|
+
"Exportar dados"
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
showExportMenu && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
903
|
+
"div",
|
|
904
|
+
{
|
|
905
|
+
className: "absolute right-0 top-full z-50 mt-2 w-56 overflow-hidden rounded-xl border border-neutral-border bg-surface-base-light shadow-xl",
|
|
906
|
+
role: "menu",
|
|
907
|
+
children: exportOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
type: "button",
|
|
911
|
+
onClick: () => void handleExport(option),
|
|
912
|
+
disabled: exportingId !== null,
|
|
913
|
+
className: "flex h-10 w-full items-center justify-between border-b border-neutral-border px-3 text-left text-sm font-semibold text-neutral-text-secondary transition-colors last:border-b-0 hover:bg-neutral-surface disabled:cursor-wait disabled:opacity-60",
|
|
914
|
+
role: "menuitem",
|
|
915
|
+
children: [
|
|
916
|
+
option.label,
|
|
917
|
+
exportingId === option.id && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-neutral-border border-t-action-primary" })
|
|
918
|
+
]
|
|
919
|
+
},
|
|
920
|
+
option.id
|
|
921
|
+
))
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
] })
|
|
925
|
+
] })
|
|
926
|
+
] }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "min-h-0 w-full flex-1 overflow-auto [-webkit-overflow-scrolling:touch]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
928
|
+
"table",
|
|
929
|
+
{
|
|
930
|
+
className: `w-full bg-surface-base-light text-sm ${tableLayout === "fixed" ? "table-fixed" : "table-auto"}`,
|
|
931
|
+
style: { minWidth },
|
|
932
|
+
children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { className: "sticky top-0 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { className: "border-b border-neutral-border bg-surface-base-light", children: [
|
|
934
|
+
renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "w-12 border-t border-neutral-border bg-surface-base-light px-4 py-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Detalhes" }) }),
|
|
935
|
+
columns.map((column) => {
|
|
936
|
+
const isSorted = sortAccessor === column.accessor;
|
|
937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
938
|
+
"th",
|
|
939
|
+
{
|
|
940
|
+
"aria-sort": isSorted ? sortDirection === "asc" ? "ascending" : "descending" : void 0,
|
|
941
|
+
className: `max-w-[200px] border-t border-neutral-border bg-surface-base-light px-4 py-3.5 text-left align-middle text-xs font-semibold uppercase tracking-wide text-neutral-placeholder ${column.headerClassName ?? column.className ?? ""}`,
|
|
942
|
+
children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
type: "button",
|
|
946
|
+
onClick: () => updateSort(column.accessor),
|
|
947
|
+
className: "flex items-center gap-1 text-left transition-colors hover:text-neutral-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary",
|
|
948
|
+
children: [
|
|
949
|
+
column.header,
|
|
950
|
+
isSorted && (sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronUp, { size: 16, "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronDown, { size: 16, "aria-hidden": "true" }))
|
|
951
|
+
]
|
|
952
|
+
}
|
|
953
|
+
) : column.header
|
|
954
|
+
},
|
|
955
|
+
String(column.accessor)
|
|
956
|
+
);
|
|
957
|
+
})
|
|
958
|
+
] }) }),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: isLoading ? Array.from({ length: safeItemsPerPage }).map((_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { children: [
|
|
960
|
+
renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "border-t border-neutral-border bg-surface-base-light px-4 py-3.5" }),
|
|
961
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
962
|
+
"td",
|
|
963
|
+
{
|
|
964
|
+
className: "border-t border-neutral-border bg-surface-base-light px-4 py-3.5",
|
|
965
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block h-4 w-full max-w-28 animate-pulse rounded bg-neutral-border" })
|
|
966
|
+
},
|
|
967
|
+
String(column.accessor)
|
|
968
|
+
))
|
|
969
|
+
] }, rowIndex)) : visibleData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
970
|
+
"td",
|
|
971
|
+
{
|
|
972
|
+
colSpan: columns.length + (renderExpandedRow ? 1 : 0),
|
|
973
|
+
className: "border-t border-neutral-border bg-surface-base-light px-4 py-12 text-center align-middle text-sm text-neutral-placeholder",
|
|
974
|
+
children: emptyMessage
|
|
975
|
+
}
|
|
976
|
+
) }) : visibleData.map((row, rowIndex) => {
|
|
977
|
+
const rowKey = resolveRowKey(row, rowIndex);
|
|
978
|
+
const isExpanded = expandedRowKey === rowKey;
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react9.default.Fragment, { children: [
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
981
|
+
"tr",
|
|
982
|
+
{
|
|
983
|
+
onClick: () => onRowClick?.(row),
|
|
984
|
+
className: `group ${onRowClick ? "cursor-pointer" : ""}`,
|
|
985
|
+
children: [
|
|
986
|
+
renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "border-t border-neutral-border bg-surface-base-light px-4 py-3.5 align-middle transition-colors duration-200 group-hover:bg-[#2ea7ad1f]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
987
|
+
"button",
|
|
988
|
+
{
|
|
989
|
+
type: "button",
|
|
990
|
+
onClick: (event) => {
|
|
991
|
+
event.stopPropagation();
|
|
992
|
+
setExpandedRowState(
|
|
993
|
+
isExpanded ? null : { key: rowKey, resetIdentity }
|
|
994
|
+
);
|
|
995
|
+
},
|
|
996
|
+
className: "flex h-7 w-7 items-center justify-center rounded-full text-neutral-text-secondary transition-colors hover:bg-neutral-surface focus-visible:outline-2 focus-visible:outline-action-primary",
|
|
997
|
+
"aria-expanded": isExpanded,
|
|
998
|
+
"aria-label": isExpanded ? "Ocultar detalhes" : "Exibir detalhes",
|
|
999
|
+
children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronUp, { size: 18, "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronDown, { size: 18, "aria-hidden": "true" })
|
|
1000
|
+
}
|
|
1001
|
+
) }),
|
|
1002
|
+
columns.map((column) => {
|
|
1003
|
+
const cellValue = row[column.accessor];
|
|
1004
|
+
const cellText = String(cellValue ?? "");
|
|
1005
|
+
const displayedText = cellText.length > maxCellCharacters ? `${cellText.slice(0, maxCellCharacters)}...` : cellText;
|
|
1006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1007
|
+
"td",
|
|
1008
|
+
{
|
|
1009
|
+
className: `max-w-[200px] border-t border-neutral-border bg-surface-base-light px-4 py-3.5 align-middle text-neutral-text-primary transition-colors duration-200 group-hover:bg-[#2ea7ad1f] ${column.className ?? ""}`,
|
|
1010
|
+
children: column.render ? column.render(cellValue, row) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block truncate", title: cellText, children: displayedText })
|
|
1011
|
+
},
|
|
1012
|
+
String(column.accessor)
|
|
1013
|
+
);
|
|
1014
|
+
})
|
|
1015
|
+
]
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1018
|
+
isExpanded && renderExpandedRow && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1019
|
+
"td",
|
|
1020
|
+
{
|
|
1021
|
+
colSpan: columns.length + 1,
|
|
1022
|
+
className: "border-t border-neutral-border bg-neutral-surface p-0",
|
|
1023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rounded-xl px-12 py-10", children: renderExpandedRow(row) })
|
|
1024
|
+
}
|
|
1025
|
+
) })
|
|
1026
|
+
] }, rowKey);
|
|
1027
|
+
}) })
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
) }),
|
|
1031
|
+
paginate && !isLoading && sortedData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 border-t border-neutral-border bg-surface-subtle-light px-4 py-3", children: [
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-sm text-neutral-text-secondary", children: [
|
|
1033
|
+
displayedStart,
|
|
1034
|
+
" - ",
|
|
1035
|
+
displayedEnd,
|
|
1036
|
+
" de ",
|
|
1037
|
+
sortedData.length
|
|
1038
|
+
] }),
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1041
|
+
"button",
|
|
1042
|
+
{
|
|
1043
|
+
type: "button",
|
|
1044
|
+
onClick: () => changePage(activePage - 1),
|
|
1045
|
+
disabled: activePage === 1,
|
|
1046
|
+
className: "flex h-8 w-8 items-center justify-center rounded-full text-neutral-text-secondary transition-colors hover:bg-neutral-surface disabled:cursor-not-allowed disabled:opacity-40",
|
|
1047
|
+
"aria-label": "P\xE1gina anterior",
|
|
1048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronLeft, { size: 20, "aria-hidden": "true" })
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-24 text-center text-sm text-neutral-text-secondary", children: [
|
|
1052
|
+
"P\xE1gina ",
|
|
1053
|
+
activePage,
|
|
1054
|
+
" de ",
|
|
1055
|
+
totalPages
|
|
1056
|
+
] }),
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1058
|
+
"button",
|
|
1059
|
+
{
|
|
1060
|
+
type: "button",
|
|
1061
|
+
onClick: () => changePage(activePage + 1),
|
|
1062
|
+
disabled: activePage === totalPages,
|
|
1063
|
+
className: "flex h-8 w-8 items-center justify-center rounded-full text-neutral-text-secondary transition-colors hover:bg-neutral-surface disabled:cursor-not-allowed disabled:opacity-40",
|
|
1064
|
+
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
1065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_fi6.FiChevronRight, { size: 20, "aria-hidden": "true" })
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] })
|
|
1069
|
+
] })
|
|
1070
|
+
] });
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
// src/components/DatePicker/index.tsx
|
|
1074
|
+
var import_react10 = require("react");
|
|
1075
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1076
|
+
function DatePicker({
|
|
1077
|
+
label,
|
|
1078
|
+
id,
|
|
1079
|
+
required,
|
|
1080
|
+
className = "",
|
|
1081
|
+
...props
|
|
1082
|
+
}) {
|
|
1083
|
+
const generatedId = (0, import_react10.useId)();
|
|
1084
|
+
const inputId = id ?? generatedId;
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: inputId, className: "flex w-full flex-col gap-2", children: [
|
|
1086
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-sm font-medium text-neutral-text-primary", children: [
|
|
1087
|
+
label,
|
|
1088
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-action-primary", children: " *" })
|
|
1089
|
+
] }),
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1091
|
+
"input",
|
|
1092
|
+
{
|
|
1093
|
+
id: inputId,
|
|
1094
|
+
type: "date",
|
|
1095
|
+
required,
|
|
1096
|
+
className: `w-full rounded-lg border border-neutral-border bg-surface-base-light px-4 py-2 text-neutral-text-primary outline-none transition-colors focus:border-action-primary ${className}`,
|
|
1097
|
+
...props
|
|
1098
|
+
}
|
|
1099
|
+
)
|
|
1100
|
+
] });
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// src/components/expandedGroup/index.tsx
|
|
1104
|
+
var import_react11 = require("react");
|
|
1105
|
+
var import_fi7 = require("react-icons/fi");
|
|
1106
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1107
|
+
function MyExpandGroup({
|
|
1108
|
+
label,
|
|
1109
|
+
children,
|
|
1110
|
+
defaultOpen = false,
|
|
1111
|
+
icon,
|
|
1112
|
+
open,
|
|
1113
|
+
onToggle
|
|
1114
|
+
}) {
|
|
1115
|
+
const [internalOpen, setInternalOpen] = (0, import_react11.useState)(defaultOpen);
|
|
1116
|
+
const contentId = (0, import_react11.useId)();
|
|
1117
|
+
const isOpen = open ?? internalOpen;
|
|
1118
|
+
const handleToggle = () => {
|
|
1119
|
+
if (onToggle) {
|
|
1120
|
+
onToggle();
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
setInternalOpen((currentOpen) => !currentOpen);
|
|
1124
|
+
};
|
|
1125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "w-full shrink-0 overflow-hidden rounded-lg border border-neutral-border bg-surface-base-light", children: [
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1127
|
+
"button",
|
|
1128
|
+
{
|
|
1129
|
+
type: "button",
|
|
1130
|
+
onClick: handleToggle,
|
|
1131
|
+
"aria-expanded": isOpen,
|
|
1132
|
+
"aria-controls": contentId,
|
|
1133
|
+
className: "flex w-full items-center justify-between px-4 py-3 text-left",
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1136
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-brand-primary", children: icon }),
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-sm font-medium text-neutral-text-primary", children: label })
|
|
1138
|
+
] }),
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1140
|
+
import_fi7.FiChevronDown,
|
|
1141
|
+
{
|
|
1142
|
+
className: `text-neutral-text-secondary transition-transform duration-300 ${isOpen ? "rotate-180" : ""}`,
|
|
1143
|
+
size: 16
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
),
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1150
|
+
"div",
|
|
1151
|
+
{
|
|
1152
|
+
id: contentId,
|
|
1153
|
+
className: `grid transition-[grid-template-rows,opacity] duration-300 ${isOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"}`,
|
|
1154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "border-t border-neutral-border px-4 py-4", children }) })
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
] });
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// src/components/filtersBar/index.tsx
|
|
1161
|
+
var import_react12 = require("react");
|
|
1162
|
+
|
|
1163
|
+
// src/components/filtersComponents/ButtonMain/index.tsx
|
|
1164
|
+
var import_fi8 = require("react-icons/fi");
|
|
1165
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1166
|
+
var MyButtonMain = ({
|
|
1167
|
+
children,
|
|
1168
|
+
className = "",
|
|
1169
|
+
...props
|
|
1170
|
+
}) => {
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1172
|
+
"button",
|
|
1173
|
+
{
|
|
1174
|
+
...props,
|
|
1175
|
+
className: `flex items-center gap-2 border border-neutral-border rounded-lg bg-surface-base-light py-2 pl-4 pr-4 text-neutral-text-primary outline-none hover:bg-neutral-surface focus:border-action-primary transition-colors cursor-pointer ${className}`,
|
|
1176
|
+
children: [
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_fi8.FiMenu, { size: 16 }),
|
|
1178
|
+
children
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
// src/components/filtersComponents/MyFastFilter/index.tsx
|
|
1185
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1186
|
+
var FastFilter = ({
|
|
1187
|
+
label,
|
|
1188
|
+
className = "",
|
|
1189
|
+
...props
|
|
1190
|
+
}) => {
|
|
1191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "cursor-pointer", children: [
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1193
|
+
"input",
|
|
1194
|
+
{
|
|
1195
|
+
type: "checkbox",
|
|
1196
|
+
className: "peer hidden",
|
|
1197
|
+
...props
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1201
|
+
"span",
|
|
1202
|
+
{
|
|
1203
|
+
className: `
|
|
1204
|
+
inline-flex items-center justify-center
|
|
1205
|
+
rounded-full border border-neutral-border
|
|
1206
|
+
px-4 py-2
|
|
1207
|
+
bg-surface-base-light text-neutral-text-primary
|
|
1208
|
+
transition-colors
|
|
1209
|
+
peer-checked:bg-action-primary
|
|
1210
|
+
peer-checked:border-action-primary
|
|
1211
|
+
peer-checked:text-text-inverse
|
|
1212
|
+
${className}
|
|
1213
|
+
`,
|
|
1214
|
+
children: label
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
] });
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
// src/components/filtersComponents/MySearch/index.tsx
|
|
1221
|
+
var import_fi9 = require("react-icons/fi");
|
|
1222
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1223
|
+
var MySearch = ({ className = "", ...props }) => {
|
|
1224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative flex items-center ", children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_fi9.FiSearch, { className: "absolute left-3 text-neutral-text-secondary pointer-events-none font-bold", size: 16 }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1227
|
+
"input",
|
|
1228
|
+
{
|
|
1229
|
+
type: "search",
|
|
1230
|
+
...props,
|
|
1231
|
+
className: `border border-neutral-border rounded-lg bg-surface-base-light py-2 pl-9 pr-4 text-neutral-text-primary placeholder:text-neutral-placeholder outline-none focus:border-action-primary
|
|
1232
|
+
transition-colors ${className}`
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
] });
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
// src/components/filtersComponents/MySelect/index.tsx
|
|
1239
|
+
var import_fi10 = require("react-icons/fi");
|
|
1240
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1241
|
+
var MySelect = ({
|
|
1242
|
+
options,
|
|
1243
|
+
placeholder,
|
|
1244
|
+
containerClassName = "w-50",
|
|
1245
|
+
className = "",
|
|
1246
|
+
...props
|
|
1247
|
+
}) => {
|
|
1248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `relative flex items-center ${containerClassName}`, children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1250
|
+
"select",
|
|
1251
|
+
{
|
|
1252
|
+
...props,
|
|
1253
|
+
className: `appearance-none w-full border border-neutral-border rounded-lg bg-surface-base-light py-2 pl-4 pr-9 text-neutral-text-primary outline-none focus:border-action-primary transition-colors ${className}`,
|
|
1254
|
+
children: [
|
|
1255
|
+
placeholder && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", disabled: true, children: placeholder }),
|
|
1256
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
1257
|
+
]
|
|
1258
|
+
}
|
|
1259
|
+
),
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1261
|
+
import_fi10.FiChevronDown,
|
|
1262
|
+
{
|
|
1263
|
+
className: "absolute right-3 text-neutral-text-secondary pointer-events-none",
|
|
1264
|
+
size: 16
|
|
1265
|
+
}
|
|
1266
|
+
)
|
|
1267
|
+
] });
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
// src/components/filtersBar/index.tsx
|
|
1271
|
+
var import_io = require("react-icons/io");
|
|
1272
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1273
|
+
var mockItens = [
|
|
1274
|
+
{ label: "S\xE3o Paulo", value: "sp" },
|
|
1275
|
+
{ label: "Curitiba", value: "curitiba" },
|
|
1276
|
+
{ label: "Joinville", value: "joinville" }
|
|
1277
|
+
];
|
|
1278
|
+
var FilterBar = ({
|
|
1279
|
+
fastFilters = [],
|
|
1280
|
+
showSearch = true,
|
|
1281
|
+
showSelect = true,
|
|
1282
|
+
showAdvancedFilters = true,
|
|
1283
|
+
showExport = true,
|
|
1284
|
+
typeCreation = "revenda",
|
|
1285
|
+
onCreateClick,
|
|
1286
|
+
createLabel,
|
|
1287
|
+
data = [],
|
|
1288
|
+
searchFields = [],
|
|
1289
|
+
searchValue,
|
|
1290
|
+
defaultSearchValue = "",
|
|
1291
|
+
searchPlaceholder = "Buscar...",
|
|
1292
|
+
onSearchChange,
|
|
1293
|
+
onFilteredDataChange
|
|
1294
|
+
}) => {
|
|
1295
|
+
const [internalSearchValue, setInternalSearchValue] = (0, import_react12.useState)(defaultSearchValue);
|
|
1296
|
+
const lastFilteredDataRef = (0, import_react12.useRef)(void 0);
|
|
1297
|
+
const currentSearchValue = searchValue ?? internalSearchValue;
|
|
1298
|
+
const filteredData = (0, import_react12.useMemo)(() => {
|
|
1299
|
+
const normalizedSearch = currentSearchValue.trim().toLowerCase();
|
|
1300
|
+
if (!normalizedSearch || searchFields.length === 0) {
|
|
1301
|
+
return data;
|
|
1302
|
+
}
|
|
1303
|
+
return data.filter(
|
|
1304
|
+
(item) => searchFields.some((field) => {
|
|
1305
|
+
const value = typeof field === "function" ? field(item) : item[field];
|
|
1306
|
+
return String(value ?? "").toLowerCase().includes(normalizedSearch);
|
|
1307
|
+
})
|
|
1308
|
+
);
|
|
1309
|
+
}, [currentSearchValue, data, searchFields]);
|
|
1310
|
+
(0, import_react12.useEffect)(() => {
|
|
1311
|
+
if (!onFilteredDataChange) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
const lastFilteredData = lastFilteredDataRef.current;
|
|
1315
|
+
const hasSameItems = lastFilteredData?.length === filteredData.length && lastFilteredData.every((item, index) => Object.is(item, filteredData[index]));
|
|
1316
|
+
if (hasSameItems) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
lastFilteredDataRef.current = filteredData;
|
|
1320
|
+
onFilteredDataChange(filteredData);
|
|
1321
|
+
}, [filteredData, onFilteredDataChange]);
|
|
1322
|
+
function handleSearchChange(event) {
|
|
1323
|
+
const value = event.target.value;
|
|
1324
|
+
if (searchValue === void 0) {
|
|
1325
|
+
setInternalSearchValue(value);
|
|
1326
|
+
}
|
|
1327
|
+
onSearchChange?.(value);
|
|
1328
|
+
}
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "w-full flex items-center border-b-2 border-neutral-border h-15 mb-5 p-1 gap-5", children: [
|
|
1330
|
+
showSearch && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1331
|
+
MySearch,
|
|
1332
|
+
{
|
|
1333
|
+
value: currentSearchValue,
|
|
1334
|
+
onChange: handleSearchChange,
|
|
1335
|
+
placeholder: searchPlaceholder
|
|
1336
|
+
}
|
|
1337
|
+
),
|
|
1338
|
+
showSelect && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1339
|
+
MySelect,
|
|
1340
|
+
{
|
|
1341
|
+
defaultValue: "",
|
|
1342
|
+
placeholder: "Escolha",
|
|
1343
|
+
options: mockItens
|
|
1344
|
+
}
|
|
1345
|
+
),
|
|
1346
|
+
fastFilters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1347
|
+
FastFilter,
|
|
1348
|
+
{
|
|
1349
|
+
label: filter.label,
|
|
1350
|
+
checked: filter.checked,
|
|
1351
|
+
onChange: filter.onChange
|
|
1352
|
+
},
|
|
1353
|
+
filter.label
|
|
1354
|
+
)),
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-5 ml-auto", children: [
|
|
1356
|
+
showAdvancedFilters && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MyButtonMain, { children: "Filtros avan\xE7ados" }),
|
|
1357
|
+
showExport && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MyButtonMain, { children: "Exportar" }),
|
|
1358
|
+
typeCreation !== "no" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1359
|
+
MyCreateButton,
|
|
1360
|
+
{
|
|
1361
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_io.IoMdAdd, {}),
|
|
1362
|
+
label: createLabel ?? `Adicionar ${typeCreation}`,
|
|
1363
|
+
onClick: onCreateClick
|
|
1364
|
+
}
|
|
1365
|
+
)
|
|
1366
|
+
] })
|
|
1367
|
+
] });
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
// src/components/Header/index.tsx
|
|
1371
|
+
var import_react13 = require("react");
|
|
1372
|
+
var import_fi11 = require("react-icons/fi");
|
|
1373
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1374
|
+
function Header({
|
|
1375
|
+
title = "Dashboard",
|
|
1376
|
+
section,
|
|
1377
|
+
sectionIcon,
|
|
1378
|
+
userName = "",
|
|
1379
|
+
notifications = [],
|
|
1380
|
+
searchItems = [],
|
|
1381
|
+
searchPlaceholder = "Pesquisar...",
|
|
1382
|
+
onSearchItemSelect,
|
|
1383
|
+
onNotificationClick,
|
|
1384
|
+
onMarkAllNotificationsAsRead,
|
|
1385
|
+
onViewAllNotifications,
|
|
1386
|
+
className = "",
|
|
1387
|
+
...props
|
|
1388
|
+
}) {
|
|
1389
|
+
const [isNotificationsOpen, setIsNotificationsOpen] = (0, import_react13.useState)(false);
|
|
1390
|
+
const [isProfileOpen, setIsProfileOpen] = (0, import_react13.useState)(false);
|
|
1391
|
+
const [searchTerm, setSearchTerm] = (0, import_react13.useState)("");
|
|
1392
|
+
const [isSearchOpen, setIsSearchOpen] = (0, import_react13.useState)(false);
|
|
1393
|
+
const [activeSearchIndex, setActiveSearchIndex] = (0, import_react13.useState)(0);
|
|
1394
|
+
const notificationsId = (0, import_react13.useId)();
|
|
1395
|
+
const searchResultsId = (0, import_react13.useId)();
|
|
1396
|
+
const notificationsRef = (0, import_react13.useRef)(null);
|
|
1397
|
+
const notificationsButtonRef = (0, import_react13.useRef)(null);
|
|
1398
|
+
const searchRef = (0, import_react13.useRef)(null);
|
|
1399
|
+
const unreadCount = notifications.filter((notification) => !notification.read).length;
|
|
1400
|
+
const filteredSearchItems = (0, import_react13.useMemo)(() => {
|
|
1401
|
+
const search = searchTerm.trim().toLocaleLowerCase();
|
|
1402
|
+
if (!search) return searchItems.slice(0, 5);
|
|
1403
|
+
return searchItems.filter(
|
|
1404
|
+
(item) => [item.label, item.section, item.keywords].filter(Boolean).join(" ").toLocaleLowerCase().includes(search)
|
|
1405
|
+
).slice(0, 4);
|
|
1406
|
+
}, [searchItems, searchTerm]);
|
|
1407
|
+
const selectSearchItem = (item) => {
|
|
1408
|
+
onSearchItemSelect?.(item);
|
|
1409
|
+
setSearchTerm("");
|
|
1410
|
+
setIsSearchOpen(false);
|
|
1411
|
+
setActiveSearchIndex(0);
|
|
1412
|
+
};
|
|
1413
|
+
const handleSearchKeyDown = (event) => {
|
|
1414
|
+
if (event.key === "ArrowDown") {
|
|
1415
|
+
event.preventDefault();
|
|
1416
|
+
setIsSearchOpen(true);
|
|
1417
|
+
setActiveSearchIndex(
|
|
1418
|
+
(index) => Math.min(index + 1, Math.max(filteredSearchItems.length - 1, 0))
|
|
1419
|
+
);
|
|
1420
|
+
} else if (event.key === "ArrowUp") {
|
|
1421
|
+
event.preventDefault();
|
|
1422
|
+
setActiveSearchIndex((index) => Math.max(index - 1, 0));
|
|
1423
|
+
} else if (event.key === "Enter" && filteredSearchItems.length > 0) {
|
|
1424
|
+
event.preventDefault();
|
|
1425
|
+
selectSearchItem(filteredSearchItems[activeSearchIndex] ?? filteredSearchItems[0]);
|
|
1426
|
+
} else if (event.key === "Escape") {
|
|
1427
|
+
setIsSearchOpen(false);
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
(0, import_react13.useEffect)(() => {
|
|
1431
|
+
if (!isSearchOpen) return;
|
|
1432
|
+
const handlePointerDown = (event) => {
|
|
1433
|
+
if (!searchRef.current?.contains(event.target)) {
|
|
1434
|
+
setIsSearchOpen(false);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
1438
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
1439
|
+
}, [isSearchOpen]);
|
|
1440
|
+
(0, import_react13.useEffect)(() => {
|
|
1441
|
+
if (!isNotificationsOpen) return;
|
|
1442
|
+
const handlePointerDown = (event) => {
|
|
1443
|
+
if (!notificationsRef.current?.contains(event.target)) {
|
|
1444
|
+
setIsNotificationsOpen(false);
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
const handleKeyDown = (event) => {
|
|
1448
|
+
if (event.key === "Escape") {
|
|
1449
|
+
setIsNotificationsOpen(false);
|
|
1450
|
+
notificationsButtonRef.current?.focus();
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
1454
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1455
|
+
return () => {
|
|
1456
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
1457
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
1458
|
+
};
|
|
1459
|
+
}, [isNotificationsOpen]);
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1462
|
+
"header",
|
|
1463
|
+
{
|
|
1464
|
+
className: `flex min-h-24 shrink-0 items-center justify-between gap-5 bg-surface-base-light px-6 py-5 md:px-10 lg:px-12 ${className}`,
|
|
1465
|
+
...props,
|
|
1466
|
+
children: [
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "min-w-0", children: [
|
|
1468
|
+
section && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mb-1 flex items-center gap-1.5 text-[13px] text-neutral-text-secondary", children: [
|
|
1469
|
+
sectionIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex shrink-0 items-center", "aria-hidden": "true", children: sectionIcon }),
|
|
1470
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate", children: section }),
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fi11.FiChevronRight, { className: "shrink-0", size: 13, "aria-hidden": "true" }),
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate", "aria-current": "page", children: title })
|
|
1473
|
+
] }),
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "truncate text-2xl font-semibold text-action-primary", children: title })
|
|
1475
|
+
] }),
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex shrink-0 items-center gap-3", children: [
|
|
1477
|
+
searchItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
className: "relative w-35 sm:w-44 lg:w-60",
|
|
1481
|
+
ref: searchRef,
|
|
1482
|
+
children: [
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "relative block", children: [
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "sr-only", children: "Pesquisar funcionalidades" }),
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1486
|
+
import_fi11.FiSearch,
|
|
1487
|
+
{
|
|
1488
|
+
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-neutral-placeholder",
|
|
1489
|
+
size: 16,
|
|
1490
|
+
"aria-hidden": "true"
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1494
|
+
"input",
|
|
1495
|
+
{
|
|
1496
|
+
type: "search",
|
|
1497
|
+
value: searchTerm,
|
|
1498
|
+
onChange: (event) => {
|
|
1499
|
+
setSearchTerm(event.target.value);
|
|
1500
|
+
setActiveSearchIndex(0);
|
|
1501
|
+
setIsSearchOpen(true);
|
|
1502
|
+
},
|
|
1503
|
+
onFocus: () => setIsSearchOpen(true),
|
|
1504
|
+
onKeyDown: handleSearchKeyDown,
|
|
1505
|
+
placeholder: searchPlaceholder,
|
|
1506
|
+
role: "combobox",
|
|
1507
|
+
"aria-autocomplete": "list",
|
|
1508
|
+
"aria-expanded": isSearchOpen,
|
|
1509
|
+
"aria-controls": searchResultsId,
|
|
1510
|
+
"aria-activedescendant": isSearchOpen && filteredSearchItems[activeSearchIndex] ? `${searchResultsId}-${filteredSearchItems[activeSearchIndex].id}` : void 0,
|
|
1511
|
+
className: "h-10 w-full rounded-xl border border-neutral-border bg-surface-subtle-light py-1.5 pl-9 pr-3 text-sm text-neutral-text-primary outline-none transition-colors placeholder:text-neutral-placeholder focus:border-action-primary focus:bg-surface-base-light focus:ring-2 focus:ring-action-primary/15"
|
|
1512
|
+
}
|
|
1513
|
+
)
|
|
1514
|
+
] }),
|
|
1515
|
+
isSearchOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1516
|
+
"div",
|
|
1517
|
+
{
|
|
1518
|
+
id: searchResultsId,
|
|
1519
|
+
role: "listbox",
|
|
1520
|
+
"aria-label": "Funcionalidades encontradas",
|
|
1521
|
+
className: "absolute right-0 top-full z-50 mt-2 w-full min-w-72 overflow-hidden rounded-xl border border-neutral-border bg-surface-base-light shadow-xl",
|
|
1522
|
+
children: filteredSearchItems.length > 0 ? filteredSearchItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
id: `${searchResultsId}-${item.id}`,
|
|
1526
|
+
type: "button",
|
|
1527
|
+
role: "option",
|
|
1528
|
+
"aria-selected": index === activeSearchIndex,
|
|
1529
|
+
onMouseEnter: () => setActiveSearchIndex(index),
|
|
1530
|
+
onClick: () => selectSearchItem(item),
|
|
1531
|
+
className: `flex w-full items-center gap-3 border-b border-neutral-border px-4 py-3 text-left transition-colors last:border-b-0 ${index === activeSearchIndex ? "bg-neutral-surface" : "hover:bg-neutral-surface"}`,
|
|
1532
|
+
children: [
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1534
|
+
import_fi11.FiSearch,
|
|
1535
|
+
{
|
|
1536
|
+
className: "shrink-0 text-neutral-placeholder",
|
|
1537
|
+
size: 15,
|
|
1538
|
+
"aria-hidden": "true"
|
|
1539
|
+
}
|
|
1540
|
+
),
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "min-w-0", children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "block truncate text-sm font-medium text-neutral-text-primary", children: item.label }),
|
|
1543
|
+
item.section && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "block truncate text-xs text-neutral-text-secondary", children: item.section })
|
|
1544
|
+
] })
|
|
1545
|
+
]
|
|
1546
|
+
},
|
|
1547
|
+
item.id
|
|
1548
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "px-4 py-6 text-center text-sm text-neutral-placeholder", children: "Nenhuma funcionalidade encontrada." })
|
|
1549
|
+
}
|
|
1550
|
+
)
|
|
1551
|
+
]
|
|
1552
|
+
}
|
|
1553
|
+
),
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", ref: notificationsRef, children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1556
|
+
"button",
|
|
1557
|
+
{
|
|
1558
|
+
ref: notificationsButtonRef,
|
|
1559
|
+
type: "button",
|
|
1560
|
+
"aria-label": unreadCount > 0 ? `Notifica\xE7\xF5es: ${unreadCount} n\xE3o lidas` : "Notifica\xE7\xF5es",
|
|
1561
|
+
"aria-expanded": isNotificationsOpen,
|
|
1562
|
+
"aria-controls": notificationsId,
|
|
1563
|
+
"aria-haspopup": "dialog",
|
|
1564
|
+
onClick: () => setIsNotificationsOpen((current) => !current),
|
|
1565
|
+
className: "relative flex cursor-pointer items-center justify-center rounded-full p-2 text-neutral-text-secondary transition-colors hover:bg-neutral-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary",
|
|
1566
|
+
children: [
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fi11.FiBell, { size: 18, "aria-hidden": "true" }),
|
|
1568
|
+
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "absolute right-0.5 top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-status-danger px-1 text-[10px] font-semibold leading-none text-text-inverse", children: unreadCount > 9 ? "9+" : unreadCount })
|
|
1569
|
+
]
|
|
1570
|
+
}
|
|
1571
|
+
),
|
|
1572
|
+
isNotificationsOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1573
|
+
"section",
|
|
1574
|
+
{
|
|
1575
|
+
id: notificationsId,
|
|
1576
|
+
role: "dialog",
|
|
1577
|
+
"aria-label": "Central de notifica\xE7\xF5es",
|
|
1578
|
+
className: "absolute right-0 top-full z-50 mt-2 w-[min(23rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-neutral-border bg-surface-base-light shadow-xl",
|
|
1579
|
+
children: [
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-neutral-border px-4 py-3", children: [
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "font-semibold text-neutral-text-primary", children: "Notifica\xE7\xF5es" }),
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-neutral-text-secondary", children: unreadCount > 0 ? `${unreadCount} n\xE3o lida${unreadCount === 1 ? "" : "s"}` : "Tudo em dia" })
|
|
1584
|
+
] }),
|
|
1585
|
+
unreadCount > 0 && onMarkAllNotificationsAsRead && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1586
|
+
"button",
|
|
1587
|
+
{
|
|
1588
|
+
type: "button",
|
|
1589
|
+
onClick: onMarkAllNotificationsAsRead,
|
|
1590
|
+
className: "flex cursor-pointer items-center gap-1.5 text-xs font-medium text-brand-primary hover:underline",
|
|
1591
|
+
children: [
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fi11.FiCheck, { size: 14, "aria-hidden": "true" }),
|
|
1593
|
+
"Marcar como lidas"
|
|
1594
|
+
]
|
|
1595
|
+
}
|
|
1596
|
+
)
|
|
1597
|
+
] }),
|
|
1598
|
+
notifications.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "max-h-80 overflow-y-auto", children: notifications.map((notification) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1599
|
+
"button",
|
|
1600
|
+
{
|
|
1601
|
+
type: "button",
|
|
1602
|
+
onClick: () => {
|
|
1603
|
+
onNotificationClick?.(notification);
|
|
1604
|
+
setIsNotificationsOpen(false);
|
|
1605
|
+
},
|
|
1606
|
+
className: "flex w-full cursor-pointer gap-3 border-b border-neutral-border px-4 py-3 text-left transition-colors last:border-b-0 hover:bg-neutral-surface",
|
|
1607
|
+
children: [
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1609
|
+
"span",
|
|
1610
|
+
{
|
|
1611
|
+
className: `mt-1.5 h-2 w-2 shrink-0 rounded-full ${notification.read ? "bg-neutral-border" : "bg-brand-primary"}`,
|
|
1612
|
+
"aria-hidden": "true"
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "block truncate text-sm font-medium text-neutral-text-primary", children: notification.title }),
|
|
1617
|
+
notification.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mt-0.5 block text-xs leading-5 text-neutral-text-secondary", children: notification.description }),
|
|
1618
|
+
notification.time && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mt-1 block text-[11px] text-neutral-placeholder", children: notification.time })
|
|
1619
|
+
] })
|
|
1620
|
+
]
|
|
1621
|
+
},
|
|
1622
|
+
notification.id
|
|
1623
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col items-center px-6 py-8 text-center", children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-neutral-surface text-neutral-text-secondary", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fi11.FiBell, { size: 19, "aria-hidden": "true" }) }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm font-medium text-neutral-text-primary", children: "Nenhuma notifica\xE7\xE3o" }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-1 text-xs text-neutral-text-secondary", children: "Novas atualiza\xE7\xF5es aparecer\xE3o aqui." })
|
|
1627
|
+
] }),
|
|
1628
|
+
notifications.length > 0 && onViewAllNotifications && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1629
|
+
"button",
|
|
1630
|
+
{
|
|
1631
|
+
type: "button",
|
|
1632
|
+
onClick: () => {
|
|
1633
|
+
onViewAllNotifications();
|
|
1634
|
+
setIsNotificationsOpen(false);
|
|
1635
|
+
},
|
|
1636
|
+
className: "w-full cursor-pointer border-t border-neutral-border px-4 py-3 text-center text-sm font-medium text-brand-primary transition-colors hover:bg-neutral-surface",
|
|
1637
|
+
children: "Ver todas as notifica\xE7\xF5es"
|
|
1638
|
+
}
|
|
1639
|
+
)
|
|
1640
|
+
]
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
] }),
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1645
|
+
"button",
|
|
1646
|
+
{
|
|
1647
|
+
type: "button",
|
|
1648
|
+
onClick: () => {
|
|
1649
|
+
setIsNotificationsOpen(false);
|
|
1650
|
+
setIsProfileOpen(true);
|
|
1651
|
+
},
|
|
1652
|
+
className: "flex cursor-pointer items-center gap-2 rounded-lg p-1 transition-colors hover:bg-neutral-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-action-primary",
|
|
1653
|
+
"aria-label": "Abrir perfil",
|
|
1654
|
+
"aria-haspopup": "dialog",
|
|
1655
|
+
"aria-expanded": isProfileOpen,
|
|
1656
|
+
children: [
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-brand-primary text-text-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_fi11.FiUser, { size: 16, "aria-hidden": "true" }) }),
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "max-w-40 truncate text-sm text-neutral-text-secondary", children: userName })
|
|
1659
|
+
]
|
|
1660
|
+
}
|
|
1661
|
+
)
|
|
1662
|
+
] })
|
|
1663
|
+
]
|
|
1664
|
+
}
|
|
1665
|
+
),
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1667
|
+
AccountModal,
|
|
1668
|
+
{
|
|
1669
|
+
open: isProfileOpen,
|
|
1670
|
+
onClose: () => setIsProfileOpen(false)
|
|
1671
|
+
}
|
|
1672
|
+
)
|
|
1673
|
+
] });
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
// src/components/Icon/index.tsx
|
|
1677
|
+
var import_ri = require("react-icons/ri");
|
|
1678
|
+
var import_fa2 = require("react-icons/fa");
|
|
1679
|
+
var import_hi2 = require("react-icons/hi2");
|
|
1680
|
+
var import_fa6 = require("react-icons/fa6");
|
|
1681
|
+
var import_si = require("react-icons/si");
|
|
1682
|
+
var import_bi = require("react-icons/bi");
|
|
1683
|
+
var import_bs2 = require("react-icons/bs");
|
|
1684
|
+
var import_pi = require("react-icons/pi");
|
|
1685
|
+
var import_gr = require("react-icons/gr");
|
|
1686
|
+
var import_fa62 = require("react-icons/fa6");
|
|
1687
|
+
var import_fi12 = require("react-icons/fi");
|
|
1688
|
+
var import_lu = require("react-icons/lu");
|
|
1689
|
+
var import_md2 = require("react-icons/md");
|
|
1690
|
+
var import_tb = require("react-icons/tb");
|
|
1691
|
+
var import_lia = require("react-icons/lia");
|
|
1692
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1693
|
+
var iconComponents = {
|
|
1694
|
+
RiMapLine: import_ri.RiMapLine,
|
|
1695
|
+
RiCustomerService2Line: import_ri.RiCustomerService2Line,
|
|
1696
|
+
RiFileChartLine: import_ri.RiFileChartLine,
|
|
1697
|
+
RiDatabase2Line: import_ri.RiDatabase2Line,
|
|
1698
|
+
RiBuildingLine: import_ri.RiBuildingLine,
|
|
1699
|
+
RiToolsFill: import_ri.RiToolsFill,
|
|
1700
|
+
RiSettings3Line: import_ri.RiSettings3Line,
|
|
1701
|
+
RiUserAddLine: import_ri.RiUserAddLine,
|
|
1702
|
+
RiSearchLine: import_ri.RiSearchLine,
|
|
1703
|
+
RiFilter2Line: import_ri.RiFilter2Line,
|
|
1704
|
+
FaChevronLeft: import_fa62.FaChevronLeft,
|
|
1705
|
+
RiArrowDropLeftLine: import_ri.RiArrowDropLeftLine,
|
|
1706
|
+
RiArrowDropRightLine: import_ri.RiArrowDropRightLine,
|
|
1707
|
+
FaEllipsis: import_fa62.FaEllipsis,
|
|
1708
|
+
RiDeleteBin7Line: import_ri.RiDeleteBin7Line,
|
|
1709
|
+
FaChevronDown: import_fa2.FaChevronDown,
|
|
1710
|
+
RiArrowDropDownLine: import_ri.RiArrowDropDownLine,
|
|
1711
|
+
RiArrowDropUpLine: import_ri.RiArrowDropUpLine,
|
|
1712
|
+
RiUserLine: import_ri.RiUserLine,
|
|
1713
|
+
RiGroupLine: import_ri.RiGroupLine,
|
|
1714
|
+
FaArrowRightArrowLeft: import_fa62.FaArrowRightArrowLeft,
|
|
1715
|
+
RiArrowRightDoubleFill: import_ri.RiArrowRightDoubleFill,
|
|
1716
|
+
RiArrowLeftDoubleFill: import_ri.RiArrowLeftDoubleFill,
|
|
1717
|
+
RiCpuLine: import_ri.RiCpuLine,
|
|
1718
|
+
RiBarChartBoxLine: import_ri.RiBarChartBoxLine,
|
|
1719
|
+
FaArrowsRotate: import_fa62.FaArrowsRotate,
|
|
1720
|
+
RiExternalLinkLine: import_ri.RiExternalLinkLine,
|
|
1721
|
+
RiSimCard2Line: import_ri.RiSimCard2Line,
|
|
1722
|
+
RiCloseFill: import_ri.RiCloseFill,
|
|
1723
|
+
RiAddFill: import_ri.RiAddFill,
|
|
1724
|
+
FiRadio: import_fi12.FiRadio,
|
|
1725
|
+
RiCarLine: import_ri.RiCarLine,
|
|
1726
|
+
RiSteering2Line: import_ri.RiSteering2Line,
|
|
1727
|
+
RiInfoI: import_ri.RiInfoI,
|
|
1728
|
+
RiCheckFill: import_ri.RiCheckFill,
|
|
1729
|
+
LuGroup: import_lu.LuGroup,
|
|
1730
|
+
RiInformationLine: import_ri.RiInformationLine,
|
|
1731
|
+
MdTerrain: import_md2.MdTerrain,
|
|
1732
|
+
RiSpeedUpFill: import_ri.RiSpeedUpFill,
|
|
1733
|
+
RiBatteryChargeLine: import_ri.RiBatteryChargeLine,
|
|
1734
|
+
RiTimer2Line: import_ri.RiTimer2Line,
|
|
1735
|
+
SiGooglestreetview: import_si.SiGooglestreetview,
|
|
1736
|
+
SiKeepassxc: import_si.SiKeepassxc,
|
|
1737
|
+
FaStreetView: import_fa6.FaStreetView,
|
|
1738
|
+
FaSatelliteDish: import_fa6.FaSatelliteDish,
|
|
1739
|
+
RiTruckLine: import_ri.RiTruckLine,
|
|
1740
|
+
RiShutDownLine: import_ri.RiShutDownLine,
|
|
1741
|
+
TbTruckOff: import_tb.TbTruckOff,
|
|
1742
|
+
TbLayoutSidebarRightExpand: import_tb.TbLayoutSidebarRightExpand,
|
|
1743
|
+
TbLayoutBottombarExpand: import_tb.TbLayoutBottombarExpand,
|
|
1744
|
+
RiInformation2Line: import_ri.RiInformation2Line,
|
|
1745
|
+
RiRestartLine: import_ri.RiRestartLine,
|
|
1746
|
+
RiStarFill: import_ri.RiStarFill,
|
|
1747
|
+
RiStarHalfFill: import_ri.RiStarHalfFill,
|
|
1748
|
+
RiStarLine: import_ri.RiStarLine,
|
|
1749
|
+
RiThermometerLine: import_ri.RiThermometerLine,
|
|
1750
|
+
LuFuel: import_lu.LuFuel,
|
|
1751
|
+
TbLock: import_tb.TbLock,
|
|
1752
|
+
TbAnchor: import_tb.TbAnchor,
|
|
1753
|
+
RiRouteLine: import_ri.RiRouteLine,
|
|
1754
|
+
RiTimerLine: import_ri.RiTimerLine,
|
|
1755
|
+
RiAlertLine: import_ri.RiAlertLine,
|
|
1756
|
+
TbTransformPoint: import_tb.TbTransformPoint,
|
|
1757
|
+
TbTruckDelivery: import_tb.TbTruckDelivery,
|
|
1758
|
+
TbTruck: import_tb.TbTruck,
|
|
1759
|
+
TbLockOpen: import_tb.TbLockOpen,
|
|
1760
|
+
RiUpload2Line: import_ri.RiUpload2Line,
|
|
1761
|
+
RiListView: import_ri.RiListView,
|
|
1762
|
+
RiKanbanView2: import_ri.RiKanbanView2,
|
|
1763
|
+
RiCustomerService2Fill: import_ri.RiCustomerService2Fill,
|
|
1764
|
+
RiPencilLine: import_ri.RiPencilLine,
|
|
1765
|
+
RiListCheck2: import_ri.RiListCheck2,
|
|
1766
|
+
RiWhatsappLine: import_ri.RiWhatsappLine,
|
|
1767
|
+
RiCornerDownRightLine: import_ri.RiCornerDownRightLine,
|
|
1768
|
+
RiHistoryLine: import_ri.RiHistoryLine,
|
|
1769
|
+
RiCalendarLine: import_ri.RiCalendarLine,
|
|
1770
|
+
RiFileList2Line: import_ri.RiFileList2Line,
|
|
1771
|
+
RiRefreshLine: import_ri.RiRefreshLine,
|
|
1772
|
+
BiAnchor: import_bi.BiAnchor,
|
|
1773
|
+
BsWebcam: import_bs2.BsWebcam,
|
|
1774
|
+
PiVideoCameraBold: import_pi.PiVideoCameraBold,
|
|
1775
|
+
RiRfidLine: import_ri.RiRfidLine,
|
|
1776
|
+
HiOutlineWrenchScrewdriver: import_hi2.HiOutlineWrenchScrewdriver,
|
|
1777
|
+
RiClipboardLine: import_ri.RiClipboardLine,
|
|
1778
|
+
RiToolsLine: import_ri.RiToolsLine,
|
|
1779
|
+
RiGasStationLine: import_ri.RiGasStationLine,
|
|
1780
|
+
RiTimeLine: import_ri.RiTimeLine,
|
|
1781
|
+
RiDashboardFill: import_ri.RiDashboardFill,
|
|
1782
|
+
RiMoneyDollarCircleLine: import_ri.RiMoneyDollarCircleLine,
|
|
1783
|
+
RiEyeLine: import_ri.RiEyeLine,
|
|
1784
|
+
RiEyeCloseLine: import_ri.RiEyeCloseLine,
|
|
1785
|
+
RiSpam2Line: import_ri.RiSpam2Line,
|
|
1786
|
+
TbPolygon: import_tb.TbPolygon,
|
|
1787
|
+
MdOutlineTrendingUp: import_md2.MdOutlineTrendingUp,
|
|
1788
|
+
MdOutlineTrendingDown: import_md2.MdOutlineTrendingDown,
|
|
1789
|
+
LuMinus: import_lu.LuMinus,
|
|
1790
|
+
LuThermometerSnowflake: import_lu.LuThermometerSnowflake,
|
|
1791
|
+
RiArrowDownSFill: import_ri.RiArrowDownSFill,
|
|
1792
|
+
RiArrowUpSFill: import_ri.RiArrowUpSFill,
|
|
1793
|
+
RiTempHotLine: import_ri.RiTempHotLine,
|
|
1794
|
+
RiBarChart2Line: import_ri.RiBarChart2Line,
|
|
1795
|
+
RiMedalLine: import_ri.RiMedalLine,
|
|
1796
|
+
RiMapPin2Line: import_ri.RiMapPin2Line,
|
|
1797
|
+
RiRoadMapLine: import_ri.RiRoadMapLine,
|
|
1798
|
+
RiLineChartLine: import_ri.RiLineChartLine,
|
|
1799
|
+
LiaCarBatterySolid: import_lia.LiaCarBatterySolid,
|
|
1800
|
+
FaRegEyeSlash: import_fa6.FaRegEyeSlash,
|
|
1801
|
+
FaRegEye: import_fa6.FaRegEye,
|
|
1802
|
+
RiFileListFill: import_ri.RiFileListFill,
|
|
1803
|
+
FaRoute: import_fa6.FaRoute,
|
|
1804
|
+
RiRfidFill: import_ri.RiRfidFill,
|
|
1805
|
+
RiMapPinLine: import_ri.RiMapPinLine,
|
|
1806
|
+
RiIdCardLine: import_ri.RiIdCardLine,
|
|
1807
|
+
LiaTachometerAltSolid: import_lia.LiaTachometerAltSolid,
|
|
1808
|
+
TbReportAnalytics: import_tb.TbReportAnalytics,
|
|
1809
|
+
GrCircleAlert: import_gr.GrCircleAlert,
|
|
1810
|
+
RiBarChart2Fill: import_ri.RiBarChart2Fill,
|
|
1811
|
+
MdOutlineAdminPanelSettings: import_md2.MdOutlineAdminPanelSettings,
|
|
1812
|
+
MdOutlineInsights: import_md2.MdOutlineInsights,
|
|
1813
|
+
MdArrowRightAlt: import_md2.MdArrowRightAlt,
|
|
1814
|
+
MdTrackChanges: import_md2.MdTrackChanges,
|
|
1815
|
+
MdOutlineHealthAndSafety: import_md2.MdOutlineHealthAndSafety,
|
|
1816
|
+
RiArrowLeftSFill: import_ri.RiArrowLeftSFill,
|
|
1817
|
+
RiArrowRightSFill: import_ri.RiArrowRightSFill,
|
|
1818
|
+
RiDashboardLine: import_ri.RiDashboardLine,
|
|
1819
|
+
LiaSortAlphaDownSolid: import_lia.LiaSortAlphaDownSolid,
|
|
1820
|
+
LiaSortAlphaDownAltSolid: import_lia.LiaSortAlphaDownAltSolid,
|
|
1821
|
+
LuPanelRight: import_lu.LuPanelRight,
|
|
1822
|
+
LuPanelBottom: import_lu.LuPanelBottom,
|
|
1823
|
+
RiPushpinLine: import_ri.RiPushpinLine
|
|
1824
|
+
};
|
|
1825
|
+
var Icon = ({
|
|
1826
|
+
name,
|
|
1827
|
+
size,
|
|
1828
|
+
onClick,
|
|
1829
|
+
className
|
|
1830
|
+
}) => {
|
|
1831
|
+
const SelectedIcon = iconComponents[name];
|
|
1832
|
+
if (!SelectedIcon) {
|
|
1833
|
+
return null;
|
|
1834
|
+
}
|
|
1835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1836
|
+
SelectedIcon,
|
|
1837
|
+
{
|
|
1838
|
+
className: `${className} ${onClick ? "clickable" : ""}`,
|
|
1839
|
+
size: size || "24px",
|
|
1840
|
+
onClick
|
|
1841
|
+
}
|
|
1842
|
+
);
|
|
1843
|
+
};
|
|
1844
|
+
var Icon_default = Icon;
|
|
1845
|
+
|
|
1846
|
+
// src/components/input/index.tsx
|
|
1847
|
+
var import_react14 = require("react");
|
|
1848
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1849
|
+
var MyInput = ({
|
|
1850
|
+
label,
|
|
1851
|
+
id,
|
|
1852
|
+
required,
|
|
1853
|
+
className = "",
|
|
1854
|
+
...props
|
|
1855
|
+
}) => {
|
|
1856
|
+
const generatedId = (0, import_react14.useId)();
|
|
1857
|
+
const inputId = id ?? generatedId;
|
|
1858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { htmlFor: inputId, className: "flex w-full flex-col gap-2", children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-sm font-medium text-neutral-text-primary", children: [
|
|
1860
|
+
label,
|
|
1861
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-action-primary", children: " *" })
|
|
1862
|
+
] }),
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1864
|
+
"input",
|
|
1865
|
+
{
|
|
1866
|
+
id: inputId,
|
|
1867
|
+
required,
|
|
1868
|
+
...props,
|
|
1869
|
+
className: `w-full border border-neutral-border rounded-lg bg-surface-base-light px-4 py-2 text-neutral-text-primary placeholder:text-neutral-placeholder outline-none focus:border-action-primary transition-colors ${className}`
|
|
1870
|
+
}
|
|
1871
|
+
)
|
|
1872
|
+
] });
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
// src/components/InputNumber/index.tsx
|
|
1876
|
+
var import_react15 = require("react");
|
|
1877
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1878
|
+
function InputNumber({
|
|
1879
|
+
label,
|
|
1880
|
+
id,
|
|
1881
|
+
required,
|
|
1882
|
+
className = "",
|
|
1883
|
+
...props
|
|
1884
|
+
}) {
|
|
1885
|
+
const generatedId = (0, import_react15.useId)();
|
|
1886
|
+
const inputId = id ?? generatedId;
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { htmlFor: inputId, className: "flex w-full flex-col gap-2", children: [
|
|
1888
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "text-sm font-medium text-neutral-text-primary", children: [
|
|
1889
|
+
label,
|
|
1890
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-action-primary", children: " *" })
|
|
1891
|
+
] }),
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1893
|
+
"input",
|
|
1894
|
+
{
|
|
1895
|
+
id: inputId,
|
|
1896
|
+
type: "number",
|
|
1897
|
+
required,
|
|
1898
|
+
className: `w-full rounded-lg border border-neutral-border bg-surface-base-light px-4 py-2 text-neutral-text-primary placeholder:text-neutral-placeholder outline-none transition-colors focus:border-action-primary ${className}`,
|
|
1899
|
+
...props
|
|
1900
|
+
}
|
|
1901
|
+
)
|
|
1902
|
+
] });
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// src/components/Spinner/index.tsx
|
|
1906
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1907
|
+
function Spinner({
|
|
1908
|
+
className = "",
|
|
1909
|
+
sizeClassName = "h-5 w-5",
|
|
1910
|
+
label = "Carregando"
|
|
1911
|
+
}) {
|
|
1912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1913
|
+
"span",
|
|
1914
|
+
{
|
|
1915
|
+
className: [
|
|
1916
|
+
"inline-flex animate-spin rounded-full border-2 border-neutral-border border-t-brand-primary",
|
|
1917
|
+
sizeClassName,
|
|
1918
|
+
className
|
|
1919
|
+
].filter(Boolean).join(" "),
|
|
1920
|
+
role: "status",
|
|
1921
|
+
"aria-label": label
|
|
1922
|
+
}
|
|
1923
|
+
);
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
// src/components/LoadingModal/index.tsx
|
|
1927
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1928
|
+
function LoadingModal({
|
|
1929
|
+
open,
|
|
1930
|
+
title = "Carregando",
|
|
1931
|
+
message = "Aguarde enquanto processamos as informacoes."
|
|
1932
|
+
}) {
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Modal, { open, title, className: "max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-center gap-4 py-4 text-center", children: [
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Spinner, { sizeClassName: "h-10 w-10" }),
|
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-neutral-text-secondary", children: message })
|
|
1936
|
+
] }) });
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
// src/components/maincontent/index.tsx
|
|
1940
|
+
var import_react16 = require("react");
|
|
1941
|
+
var import_fi13 = require("react-icons/fi");
|
|
1942
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1943
|
+
var MAX_CELL_CHARACTERS = 35;
|
|
1944
|
+
var ITEMS_PER_PAGE = 10;
|
|
1945
|
+
var formatCellValue = (value) => {
|
|
1946
|
+
const text = String(value ?? "");
|
|
1947
|
+
if (text.length <= MAX_CELL_CHARACTERS) {
|
|
1948
|
+
return text;
|
|
1949
|
+
}
|
|
1950
|
+
return `${text.slice(0, MAX_CELL_CHARACTERS)}...`;
|
|
1951
|
+
};
|
|
1952
|
+
function MainContent({
|
|
1953
|
+
columns,
|
|
1954
|
+
data,
|
|
1955
|
+
header,
|
|
1956
|
+
isClickable = false,
|
|
1957
|
+
onRowClick
|
|
1958
|
+
}) {
|
|
1959
|
+
const [currentPage, setCurrentPage] = (0, import_react16.useState)(1);
|
|
1960
|
+
const totalPages = Math.max(1, Math.ceil(data.length / ITEMS_PER_PAGE));
|
|
1961
|
+
const activePage = Math.min(currentPage, totalPages);
|
|
1962
|
+
const firstItemIndex = (activePage - 1) * ITEMS_PER_PAGE;
|
|
1963
|
+
const paginatedData = data.slice(
|
|
1964
|
+
firstItemIndex,
|
|
1965
|
+
firstItemIndex + ITEMS_PER_PAGE
|
|
1966
|
+
);
|
|
1967
|
+
const displayedStart = data.length === 0 ? 0 : firstItemIndex + 1;
|
|
1968
|
+
const displayedEnd = Math.min(firstItemIndex + ITEMS_PER_PAGE, data.length);
|
|
1969
|
+
(0, import_react16.useEffect)(() => {
|
|
1970
|
+
setCurrentPage(1);
|
|
1971
|
+
}, [data]);
|
|
1972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex min-h-0 w-full flex-1 flex-col overflow-hidden rounded-2xl bg-surface-base-light shadow", children: [
|
|
1973
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "bg-surface-subtle-light px-6 py-3 border-b border-neutral-border shrink-0", children: header }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "scrollbar-indicator flex-1 overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("table", { className: "w-full table-fixed text-sm", children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("thead", { className: "sticky top-0 bg-surface-subtle-light", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1976
|
+
"th",
|
|
1977
|
+
{
|
|
1978
|
+
className: `px-6 py-3 text-left text-xs font-semibold uppercase tracking-wide text-neutral-placeholder border-b border-neutral-border ${col.className ?? ""}`,
|
|
1979
|
+
children: col.header
|
|
1980
|
+
},
|
|
1981
|
+
String(col.accessor)
|
|
1982
|
+
)) }) }),
|
|
1983
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { children: data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1984
|
+
"td",
|
|
1985
|
+
{
|
|
1986
|
+
colSpan: columns.length,
|
|
1987
|
+
className: "py-12 text-center text-sm text-neutral-placeholder",
|
|
1988
|
+
children: "Nenhum resultado encontrado."
|
|
1989
|
+
}
|
|
1990
|
+
) }) : paginatedData.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1991
|
+
"tr",
|
|
1992
|
+
{
|
|
1993
|
+
onClick: () => {
|
|
1994
|
+
if (isClickable) {
|
|
1995
|
+
onRowClick?.(row);
|
|
1996
|
+
}
|
|
1997
|
+
},
|
|
1998
|
+
className: `border-b border-neutral-surface transition-colors hover:bg-neutral-surface ${isClickable ? "cursor-pointer" : ""}`,
|
|
1999
|
+
children: columns.map((col) => {
|
|
2000
|
+
const cellValue = String(row[col.accessor] ?? "");
|
|
2001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2002
|
+
"td",
|
|
2003
|
+
{
|
|
2004
|
+
className: `px-6 py-4 text-neutral-text-primary ${col.className ?? ""}`,
|
|
2005
|
+
children: col.render ? col.render(row[col.accessor], row) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "block truncate", title: cellValue, children: formatCellValue(cellValue) })
|
|
2006
|
+
},
|
|
2007
|
+
String(col.accessor)
|
|
2008
|
+
);
|
|
2009
|
+
})
|
|
2010
|
+
},
|
|
2011
|
+
firstItemIndex + rowIndex
|
|
2012
|
+
)) })
|
|
2013
|
+
] }) }),
|
|
2014
|
+
data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex shrink-0 items-center justify-between gap-4 border-t border-neutral-border bg-surface-subtle-light px-6 py-3", children: [
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "text-sm text-neutral-text-secondary", children: [
|
|
2016
|
+
"Mostrando ",
|
|
2017
|
+
displayedStart,
|
|
2018
|
+
"-",
|
|
2019
|
+
displayedEnd,
|
|
2020
|
+
" de ",
|
|
2021
|
+
data.length
|
|
2022
|
+
] }),
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2024
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2025
|
+
"button",
|
|
2026
|
+
{
|
|
2027
|
+
type: "button",
|
|
2028
|
+
onClick: () => setCurrentPage((page) => Math.max(1, page - 1)),
|
|
2029
|
+
disabled: activePage === 1,
|
|
2030
|
+
className: "flex h-9 w-9 items-center justify-center rounded-lg border border-neutral-border bg-surface-base-light text-neutral-text-primary transition-colors hover:bg-neutral-surface disabled:cursor-not-allowed disabled:opacity-40",
|
|
2031
|
+
"aria-label": "P\xE1gina anterior",
|
|
2032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_fi13.FiChevronLeft, { size: 18, "aria-hidden": "true" })
|
|
2033
|
+
}
|
|
2034
|
+
),
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "min-w-24 text-center text-sm text-neutral-text-secondary", children: [
|
|
2036
|
+
"P\xE1gina ",
|
|
2037
|
+
activePage,
|
|
2038
|
+
" de ",
|
|
2039
|
+
totalPages
|
|
2040
|
+
] }),
|
|
2041
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2042
|
+
"button",
|
|
2043
|
+
{
|
|
2044
|
+
type: "button",
|
|
2045
|
+
onClick: () => setCurrentPage((page) => Math.min(totalPages, page + 1)),
|
|
2046
|
+
disabled: activePage === totalPages,
|
|
2047
|
+
className: "flex h-9 w-9 items-center justify-center rounded-lg border border-neutral-border bg-surface-base-light text-neutral-text-primary transition-colors hover:bg-neutral-surface disabled:cursor-not-allowed disabled:opacity-40",
|
|
2048
|
+
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
2049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_fi13.FiChevronRight, { size: 18, "aria-hidden": "true" })
|
|
2050
|
+
}
|
|
2051
|
+
)
|
|
2052
|
+
] })
|
|
2053
|
+
] })
|
|
2054
|
+
] });
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// src/components/RadioButton/index.tsx
|
|
2058
|
+
var import_react17 = require("react");
|
|
2059
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2060
|
+
function RadioButton({
|
|
2061
|
+
label,
|
|
2062
|
+
id,
|
|
2063
|
+
className = "",
|
|
2064
|
+
...props
|
|
2065
|
+
}) {
|
|
2066
|
+
const generatedId = (0, import_react17.useId)();
|
|
2067
|
+
const inputId = id ?? generatedId;
|
|
2068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2069
|
+
"label",
|
|
2070
|
+
{
|
|
2071
|
+
htmlFor: inputId,
|
|
2072
|
+
className: [
|
|
2073
|
+
"inline-flex items-center gap-2 text-sm font-medium text-neutral-text-primary",
|
|
2074
|
+
props.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
2075
|
+
className
|
|
2076
|
+
].filter(Boolean).join(" "),
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2079
|
+
"input",
|
|
2080
|
+
{
|
|
2081
|
+
id: inputId,
|
|
2082
|
+
type: "radio",
|
|
2083
|
+
className: "h-4 w-4 border-neutral-border accent-action-primary",
|
|
2084
|
+
...props
|
|
2085
|
+
}
|
|
2086
|
+
),
|
|
2087
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: label })
|
|
2088
|
+
]
|
|
2089
|
+
}
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
// src/components/TableToolbar/index.tsx
|
|
2094
|
+
var import_fi14 = require("react-icons/fi");
|
|
2095
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2096
|
+
var TableToolbar = ({
|
|
2097
|
+
searchValue,
|
|
2098
|
+
onSearchChange,
|
|
2099
|
+
searchPlaceholder = "Buscar...",
|
|
2100
|
+
filterLabel,
|
|
2101
|
+
filterOptions,
|
|
2102
|
+
filterValue,
|
|
2103
|
+
onFilterChange,
|
|
2104
|
+
total,
|
|
2105
|
+
pageStart,
|
|
2106
|
+
pageEnd,
|
|
2107
|
+
onExport
|
|
2108
|
+
}) => {
|
|
2109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between pb-4 border-b border-neutral-border", children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2111
|
+
filterOptions && onFilterChange && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2113
|
+
"select",
|
|
2114
|
+
{
|
|
2115
|
+
value: filterValue,
|
|
2116
|
+
onChange: (e) => onFilterChange(e.target.value),
|
|
2117
|
+
className: "appearance-none flex items-center gap-2 border border-neutral-border rounded-lg px-4 py-2 pr-8 text-sm text-neutral-text-primary bg-surface-base-light cursor-pointer hover:border-action-primary transition-colors focus:outline-none focus:ring-1 focus:ring-action-primary",
|
|
2118
|
+
children: [
|
|
2119
|
+
filterLabel && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "", children: filterLabel }),
|
|
2120
|
+
filterOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
2121
|
+
]
|
|
2122
|
+
}
|
|
2123
|
+
),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2125
|
+
import_fi14.FiChevronDown,
|
|
2126
|
+
{
|
|
2127
|
+
size: 14,
|
|
2128
|
+
className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-neutral-text-secondary"
|
|
2129
|
+
}
|
|
2130
|
+
)
|
|
2131
|
+
] }),
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 border border-neutral-border rounded-lg px-3 py-2 bg-surface-base-light focus-within:ring-1 focus-within:ring-action-primary focus-within:border-action-primary transition-colors", children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_fi14.FiSearch, { size: 15, className: "text-neutral-placeholder shrink-0" }),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2135
|
+
"input",
|
|
2136
|
+
{
|
|
2137
|
+
type: "text",
|
|
2138
|
+
value: searchValue,
|
|
2139
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
2140
|
+
placeholder: searchPlaceholder,
|
|
2141
|
+
className: "text-sm text-neutral-text-primary placeholder:text-neutral-placeholder bg-transparent outline-none w-48"
|
|
2142
|
+
}
|
|
2143
|
+
)
|
|
2144
|
+
] })
|
|
2145
|
+
] }),
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
2147
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-sm text-neutral-text-secondary", children: [
|
|
2148
|
+
pageStart,
|
|
2149
|
+
" - ",
|
|
2150
|
+
pageEnd,
|
|
2151
|
+
" de",
|
|
2152
|
+
" ",
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "font-medium text-neutral-text-primary", children: total })
|
|
2154
|
+
] }),
|
|
2155
|
+
onExport && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2156
|
+
"button",
|
|
2157
|
+
{
|
|
2158
|
+
onClick: onExport,
|
|
2159
|
+
className: "flex items-center gap-1.5 text-sm text-action-primary hover:text-action-primary-hover transition-colors",
|
|
2160
|
+
children: [
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_fi14.FiDownload, { size: 15 }),
|
|
2162
|
+
"Exportar dados"
|
|
2163
|
+
]
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
] })
|
|
2167
|
+
] });
|
|
2168
|
+
};
|
|
2169
|
+
|
|
2170
|
+
// src/components/Text/index.tsx
|
|
2171
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2172
|
+
function Text({
|
|
2173
|
+
children,
|
|
2174
|
+
className = "",
|
|
2175
|
+
truncate = false,
|
|
2176
|
+
preserveLines = false,
|
|
2177
|
+
noSelect = false,
|
|
2178
|
+
...props
|
|
2179
|
+
}) {
|
|
2180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2181
|
+
"p",
|
|
2182
|
+
{
|
|
2183
|
+
className: [
|
|
2184
|
+
"m-0 text-sm text-neutral-text-primary",
|
|
2185
|
+
truncate ? "truncate" : "",
|
|
2186
|
+
preserveLines ? "whitespace-pre-line" : "",
|
|
2187
|
+
noSelect ? "select-none" : "",
|
|
2188
|
+
props.onClick ? "cursor-pointer" : "",
|
|
2189
|
+
className
|
|
2190
|
+
].filter(Boolean).join(" "),
|
|
2191
|
+
...props,
|
|
2192
|
+
children
|
|
2193
|
+
}
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
// src/components/TextArea/index.tsx
|
|
2198
|
+
var import_react18 = require("react");
|
|
2199
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2200
|
+
function TextArea({
|
|
2201
|
+
label,
|
|
2202
|
+
id,
|
|
2203
|
+
required,
|
|
2204
|
+
className = "",
|
|
2205
|
+
...props
|
|
2206
|
+
}) {
|
|
2207
|
+
const generatedId = (0, import_react18.useId)();
|
|
2208
|
+
const inputId = id ?? generatedId;
|
|
2209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { htmlFor: inputId, className: "flex w-full flex-col gap-2", children: [
|
|
2210
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-sm font-medium text-neutral-text-primary", children: [
|
|
2211
|
+
label,
|
|
2212
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-action-primary", children: " *" })
|
|
2213
|
+
] }),
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2215
|
+
"textarea",
|
|
2216
|
+
{
|
|
2217
|
+
id: inputId,
|
|
2218
|
+
required,
|
|
2219
|
+
className: [
|
|
2220
|
+
"min-h-28 w-full resize-y rounded-lg border border-neutral-border bg-surface-base-light px-4 py-2 text-neutral-text-primary",
|
|
2221
|
+
"placeholder:text-neutral-placeholder outline-none transition-colors focus:border-action-primary",
|
|
2222
|
+
className
|
|
2223
|
+
].join(" "),
|
|
2224
|
+
...props
|
|
2225
|
+
}
|
|
2226
|
+
)
|
|
2227
|
+
] });
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
// src/components/Toast/index.tsx
|
|
2231
|
+
var import_fi15 = require("react-icons/fi");
|
|
2232
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2233
|
+
var variantClasses = {
|
|
2234
|
+
success: "border-status-success text-status-success",
|
|
2235
|
+
warning: "border-status-warning text-neutral-text-primary",
|
|
2236
|
+
danger: "border-status-danger text-status-danger",
|
|
2237
|
+
info: "border-action-primary text-action-primary"
|
|
2238
|
+
};
|
|
2239
|
+
function Toast({
|
|
2240
|
+
title,
|
|
2241
|
+
children,
|
|
2242
|
+
variant = "info",
|
|
2243
|
+
onClose,
|
|
2244
|
+
className = ""
|
|
2245
|
+
}) {
|
|
2246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2247
|
+
"div",
|
|
2248
|
+
{
|
|
2249
|
+
className: [
|
|
2250
|
+
"flex w-full max-w-sm gap-3 rounded-lg border bg-surface-base-light px-4 py-3 shadow-xl",
|
|
2251
|
+
variantClasses[variant],
|
|
2252
|
+
className
|
|
2253
|
+
].filter(Boolean).join(" "),
|
|
2254
|
+
role: "status",
|
|
2255
|
+
children: [
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
2257
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("strong", { className: "block text-sm font-semibold", children: title }),
|
|
2258
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mt-1 text-sm text-neutral-text-secondary", children })
|
|
2259
|
+
] }),
|
|
2260
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2261
|
+
"button",
|
|
2262
|
+
{
|
|
2263
|
+
type: "button",
|
|
2264
|
+
onClick: onClose,
|
|
2265
|
+
className: "shrink-0 text-neutral-placeholder transition-colors hover:text-neutral-text-primary",
|
|
2266
|
+
"aria-label": "Fechar aviso",
|
|
2267
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_fi15.FiX, { size: 18 })
|
|
2268
|
+
}
|
|
2269
|
+
)
|
|
2270
|
+
]
|
|
2271
|
+
}
|
|
2272
|
+
);
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
// src/components/Tooltip/index.tsx
|
|
2276
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2277
|
+
var placementClasses = {
|
|
2278
|
+
top: "bottom-full left-1/2 mb-2 -translate-x-1/2",
|
|
2279
|
+
right: "left-full top-1/2 ml-2 -translate-y-1/2",
|
|
2280
|
+
bottom: "left-1/2 top-full mt-2 -translate-x-1/2",
|
|
2281
|
+
left: "right-full top-1/2 mr-2 -translate-y-1/2"
|
|
2282
|
+
};
|
|
2283
|
+
function Tooltip({
|
|
2284
|
+
content,
|
|
2285
|
+
children,
|
|
2286
|
+
placement = "top",
|
|
2287
|
+
className = ""
|
|
2288
|
+
}) {
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "group relative inline-flex", children: [
|
|
2290
|
+
children,
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2292
|
+
"span",
|
|
2293
|
+
{
|
|
2294
|
+
className: [
|
|
2295
|
+
"pointer-events-none absolute z-50 max-w-64 rounded-md bg-surface-base-dark px-3 py-2 text-xs text-text-inverse",
|
|
2296
|
+
"opacity-0 shadow transition-opacity group-hover:opacity-100",
|
|
2297
|
+
placementClasses[placement],
|
|
2298
|
+
className
|
|
2299
|
+
].join(" "),
|
|
2300
|
+
role: "tooltip",
|
|
2301
|
+
children: content
|
|
2302
|
+
}
|
|
2303
|
+
)
|
|
2304
|
+
] });
|
|
2305
|
+
}
|
|
2306
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2307
|
+
0 && (module.exports = {
|
|
2308
|
+
AccountModal,
|
|
2309
|
+
AlignMainContent,
|
|
2310
|
+
AsideBar,
|
|
2311
|
+
Checkbox,
|
|
2312
|
+
CodeModal,
|
|
2313
|
+
ContentPreference,
|
|
2314
|
+
DataTable,
|
|
2315
|
+
DatePicker,
|
|
2316
|
+
FastFilter,
|
|
2317
|
+
FilterBar,
|
|
2318
|
+
Header,
|
|
2319
|
+
Icon,
|
|
2320
|
+
InputNumber,
|
|
2321
|
+
LoadingModal,
|
|
2322
|
+
MainContent,
|
|
2323
|
+
Modal,
|
|
2324
|
+
MyButton,
|
|
2325
|
+
MyButtonMain,
|
|
2326
|
+
MyCreateButton,
|
|
2327
|
+
MyExpandGroup,
|
|
2328
|
+
MyInput,
|
|
2329
|
+
MySearch,
|
|
2330
|
+
MySelect,
|
|
2331
|
+
RadioButton,
|
|
2332
|
+
Spinner,
|
|
2333
|
+
Switch,
|
|
2334
|
+
TableToolbar,
|
|
2335
|
+
Text,
|
|
2336
|
+
TextArea,
|
|
2337
|
+
Toast,
|
|
2338
|
+
Tooltip
|
|
2339
|
+
});
|