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