@tree-ia/design-system 2.0.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/index.d.mts +67 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +524 -144
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -0
- package/package.json +10 -11
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { AlertCircle, AlertOctagon, AlertTriangle, ArrowDown, ArrowUp, ArrowUpDown, Building2, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Copy, File, GripVertical, Image, Inbox, Info, Lightbulb, LogOut, Menu, Monitor, Moon, Search, ShieldAlert, Sun, Upload, User, X, XCircle } from "lucide-react";
|
|
4
|
+
import { AlertCircle, AlertOctagon, AlertTriangle, ArrowDown, ArrowUp, ArrowUpDown, Building2, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Copy, File, GripVertical, Image, Inbox, Info, Lightbulb, LogOut, Menu, Monitor, Moon, Search, ShieldAlert, Sun, Text, Upload, User, X, XCircle } from "lucide-react";
|
|
5
5
|
import { Bar, Doughnut, Line } from "react-chartjs-2";
|
|
6
6
|
import { ArcElement, BarElement, CategoryScale, Chart, Filler, Legend, LineElement, LinearScale, PointElement, Title as Title$1, Tooltip as Tooltip$1 } from "chart.js";
|
|
7
7
|
import { createColumnHelper, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
@@ -35,7 +35,7 @@ function Loading({ size = "md", className = "", text, textColor, color, variant
|
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/components/Button/index.tsx
|
|
38
|
-
const cn$
|
|
38
|
+
const cn$35 = (...classes) => classes.filter(Boolean).join(" ");
|
|
39
39
|
function Button({ children, variant = "primary", size = "md", isLoading = false, icon, iconPosition = "left", className, disabled, ...props }) {
|
|
40
40
|
const baseStyles = "font-medium rounded-lg transition-all duration-200 ease-out cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--dashboard-primary,#2563EB)] active:scale-[0.97]";
|
|
41
41
|
const variantStyles = {
|
|
@@ -56,7 +56,7 @@ function Button({ children, variant = "primary", size = "md", isLoading = false,
|
|
|
56
56
|
};
|
|
57
57
|
const isIconOnly = !!icon && (children === void 0 || children === null || typeof children === "string" && children.trim() === "");
|
|
58
58
|
return /* @__PURE__ */ jsx("button", {
|
|
59
|
-
className: cn$
|
|
59
|
+
className: cn$35(baseStyles, variantStyles[variant], isIconOnly ? iconOnlySizeStyles[size] : sizeStyles[size], className),
|
|
60
60
|
disabled: disabled || isLoading,
|
|
61
61
|
...props,
|
|
62
62
|
children: isLoading ? /* @__PURE__ */ jsxs("span", {
|
|
@@ -81,7 +81,7 @@ function Button({ children, variant = "primary", size = "md", isLoading = false,
|
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/components/Input/index.tsx
|
|
84
|
-
const cn$
|
|
84
|
+
const cn$34 = (...classes) => classes.filter(Boolean).join(" ");
|
|
85
85
|
const sizeStyles = {
|
|
86
86
|
sm: "h-8 px-2.5 text-xs",
|
|
87
87
|
md: "h-9 px-3 text-sm",
|
|
@@ -102,7 +102,7 @@ const Input = React.forwardRef(({ className, type = "text", label, error, childr
|
|
|
102
102
|
children: [/* @__PURE__ */ jsx("input", {
|
|
103
103
|
type,
|
|
104
104
|
id: inputId,
|
|
105
|
-
className: cn$
|
|
105
|
+
className: cn$34("flex w-full rounded-md border border-[var(--dashboard-text-secondary,#6b7280)]/30 bg-[var(--dashboard-surface,#ffffff)] text-[var(--dashboard-text-primary,#2d2d2d)] shadow-sm transition-colors duration-200 focus:border-[var(--dashboard-primary,#37a501)] placeholder:text-[var(--dashboard-text-secondary,#6b7280)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", sizeStyles[size], error ? "border-[var(--dashboard-status-danger,#EF4444)] focus:border-[var(--dashboard-status-danger,#EF4444)]" : void 0, children ? "pr-10" : void 0, className),
|
|
106
106
|
ref,
|
|
107
107
|
...props
|
|
108
108
|
}), children && /* @__PURE__ */ jsx("div", {
|
|
@@ -757,16 +757,16 @@ function FormField({ label, name, type = "text", value, onChange, error, require
|
|
|
757
757
|
|
|
758
758
|
//#endregion
|
|
759
759
|
//#region src/components/Tabs/index.tsx
|
|
760
|
-
const cn$
|
|
760
|
+
const cn$33 = (...classes) => classes.filter(Boolean).join(" ");
|
|
761
761
|
function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
762
762
|
if (variant === "pill") return /* @__PURE__ */ jsx("div", {
|
|
763
|
-
className: cn$
|
|
763
|
+
className: cn$33("flex flex-wrap gap-2", className),
|
|
764
764
|
role: "tablist",
|
|
765
765
|
children: tabs.map((tab) => {
|
|
766
766
|
const isActive = activeTab === tab.id;
|
|
767
767
|
return /* @__PURE__ */ jsxs("button", {
|
|
768
768
|
onClick: () => onChange(tab.id),
|
|
769
|
-
className: cn$
|
|
769
|
+
className: cn$33("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-colors cursor-pointer", isActive ? "bg-[var(--dashboard-primary,#37a501)] text-white" : "bg-[var(--dashboard-text-secondary,#6b7280)]/10 text-[var(--dashboard-text-secondary,#6b7280)] hover:bg-[var(--dashboard-text-secondary,#6b7280)]/20"),
|
|
770
770
|
role: "tab",
|
|
771
771
|
"aria-selected": isActive,
|
|
772
772
|
children: [
|
|
@@ -776,7 +776,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
776
776
|
}),
|
|
777
777
|
tab.label,
|
|
778
778
|
tab.count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
779
|
-
className: cn$
|
|
779
|
+
className: cn$33("ml-1 text-xs rounded-full px-1.5 py-0.5", isActive ? "bg-white/20 text-white" : "bg-[var(--dashboard-text-secondary,#6b7280)]/10 text-[var(--dashboard-text-secondary,#6b7280)]"),
|
|
780
780
|
children: tab.count
|
|
781
781
|
})
|
|
782
782
|
]
|
|
@@ -784,7 +784,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
784
784
|
})
|
|
785
785
|
});
|
|
786
786
|
return /* @__PURE__ */ jsx("div", {
|
|
787
|
-
className: cn$
|
|
787
|
+
className: cn$33("border-b border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
788
788
|
children: /* @__PURE__ */ jsx("nav", {
|
|
789
789
|
className: "flex gap-6",
|
|
790
790
|
"aria-label": "Tabs",
|
|
@@ -792,7 +792,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
792
792
|
const isActive = activeTab === tab.id;
|
|
793
793
|
return /* @__PURE__ */ jsxs("button", {
|
|
794
794
|
onClick: () => onChange(tab.id),
|
|
795
|
-
className: cn$
|
|
795
|
+
className: cn$33("relative pb-3 px-1 text-sm font-medium transition-colors border-b-2 flex items-center gap-2 cursor-pointer", isActive ? "text-[var(--dashboard-primary,#37a501)] border-[var(--dashboard-primary,#37a501)]" : "text-[var(--dashboard-text-secondary,#6b7280)] hover:text-[var(--dashboard-text-primary,#2d2d2d)] border-transparent"),
|
|
796
796
|
role: "tab",
|
|
797
797
|
"aria-selected": isActive,
|
|
798
798
|
children: [
|
|
@@ -802,7 +802,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
802
802
|
}),
|
|
803
803
|
tab.label,
|
|
804
804
|
tab.count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
805
|
-
className: cn$
|
|
805
|
+
className: cn$33("ml-1 text-xs rounded-full px-1.5 py-0.5", isActive ? "bg-[var(--dashboard-primary,#37a501)]/10 text-[var(--dashboard-primary,#37a501)]" : "bg-[var(--dashboard-text-secondary,#6b7280)]/10 text-[var(--dashboard-text-secondary,#6b7280)]"),
|
|
806
806
|
children: tab.count
|
|
807
807
|
})
|
|
808
808
|
]
|
|
@@ -814,7 +814,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
814
814
|
|
|
815
815
|
//#endregion
|
|
816
816
|
//#region src/components/DateRangePicker/index.tsx
|
|
817
|
-
const cn$
|
|
817
|
+
const cn$32 = (...classes) => classes.filter(Boolean).join(" ");
|
|
818
818
|
const locales$1 = {
|
|
819
819
|
pt: {
|
|
820
820
|
months: [
|
|
@@ -921,7 +921,7 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
921
921
|
};
|
|
922
922
|
const days = getDaysInMonth(currentMonth);
|
|
923
923
|
return /* @__PURE__ */ jsxs("div", {
|
|
924
|
-
className: cn$
|
|
924
|
+
className: cn$32("w-64 bg-[var(--dashboard-surface,#ffffff)] rounded-lg p-4 shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
925
925
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
926
926
|
className: "flex items-center justify-between mb-4",
|
|
927
927
|
children: [
|
|
@@ -959,9 +959,9 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
959
959
|
const isSelected = isStart || isEnd;
|
|
960
960
|
return /* @__PURE__ */ jsxs("div", {
|
|
961
961
|
className: "relative h-8 w-8",
|
|
962
|
-
children: [value.start && value.end && (inRange || isStart || isEnd) && /* @__PURE__ */ jsx("div", { className: cn$
|
|
962
|
+
children: [value.start && value.end && (inRange || isStart || isEnd) && /* @__PURE__ */ jsx("div", { className: cn$32("absolute inset-0 bg-[var(--dashboard-text-secondary,#6b7280)]/10", isStart && "rounded-l-full", isEnd && "rounded-r-full") }), /* @__PURE__ */ jsx("button", {
|
|
963
963
|
onClick: () => handleDayClick(day),
|
|
964
|
-
className: cn$
|
|
964
|
+
className: cn$32("relative h-8 w-8 flex items-center justify-center text-xs font-medium transition-colors z-10 rounded-full cursor-pointer", isSelected ? "bg-[var(--dashboard-primary,#37a501)] text-white hover:opacity-90" : "text-[var(--dashboard-text-primary,#2d2d2d)] hover:bg-[var(--dashboard-text-secondary,#6b7280)]/20"),
|
|
965
965
|
children: day
|
|
966
966
|
})]
|
|
967
967
|
}, day);
|
|
@@ -972,7 +972,7 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
972
972
|
|
|
973
973
|
//#endregion
|
|
974
974
|
//#region src/components/DatePicker/index.tsx
|
|
975
|
-
const cn$
|
|
975
|
+
const cn$31 = (...classes) => classes.filter(Boolean).join(" ");
|
|
976
976
|
const locales = {
|
|
977
977
|
pt: {
|
|
978
978
|
months: [
|
|
@@ -1067,7 +1067,7 @@ function DatePicker({ value, onChange, locale = "pt", minDate, maxDate, classNam
|
|
|
1067
1067
|
};
|
|
1068
1068
|
const days = getDaysInMonth(currentMonth);
|
|
1069
1069
|
return /* @__PURE__ */ jsxs("div", {
|
|
1070
|
-
className: cn$
|
|
1070
|
+
className: cn$31("w-64 bg-[var(--dashboard-surface,#ffffff)] rounded-lg p-4 shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
1071
1071
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1072
1072
|
className: "flex items-center justify-between mb-4",
|
|
1073
1073
|
children: [
|
|
@@ -1109,7 +1109,7 @@ function DatePicker({ value, onChange, locale = "pt", minDate, maxDate, classNam
|
|
|
1109
1109
|
type: "button",
|
|
1110
1110
|
onClick: () => handleDayClick(day),
|
|
1111
1111
|
disabled,
|
|
1112
|
-
className: cn$
|
|
1112
|
+
className: cn$31("relative h-8 w-8 flex items-center justify-center text-xs font-medium transition-colors z-10 rounded-full", disabled ? "text-[var(--dashboard-text-secondary,#6b7280)]/40 cursor-not-allowed" : "cursor-pointer", !disabled && selected ? "bg-[var(--dashboard-primary,#37a501)] text-white hover:opacity-90" : !disabled && "text-[var(--dashboard-text-primary,#2d2d2d)] hover:bg-[var(--dashboard-text-secondary,#6b7280)]/20"),
|
|
1113
1113
|
children: day
|
|
1114
1114
|
})
|
|
1115
1115
|
}, day);
|
|
@@ -1120,7 +1120,7 @@ function DatePicker({ value, onChange, locale = "pt", minDate, maxDate, classNam
|
|
|
1120
1120
|
|
|
1121
1121
|
//#endregion
|
|
1122
1122
|
//#region src/components/Title/index.tsx
|
|
1123
|
-
const cn$
|
|
1123
|
+
const cn$30 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1124
1124
|
const defaultSizeByLevel = {
|
|
1125
1125
|
1: "text-2xl sm:text-3xl md:text-4xl lg:text-5xl",
|
|
1126
1126
|
2: "text-xl sm:text-2xl md:text-3xl lg:text-4xl",
|
|
@@ -1155,7 +1155,7 @@ function Title({ children, level = 1, size, weight = "bold", align = "left", col
|
|
|
1155
1155
|
const sizeClass = size ? customSizes[size] : defaultSizeByLevel[level];
|
|
1156
1156
|
const colorClass = color || "text-[var(--dashboard-text-primary,#2d2d2d)]";
|
|
1157
1157
|
return /* @__PURE__ */ jsx(Tag, {
|
|
1158
|
-
className: cn$
|
|
1158
|
+
className: cn$30(sizeClass, weightStyles[weight], alignStyles[align], colorClass, className),
|
|
1159
1159
|
...props,
|
|
1160
1160
|
children
|
|
1161
1161
|
});
|
|
@@ -1163,7 +1163,7 @@ function Title({ children, level = 1, size, weight = "bold", align = "left", col
|
|
|
1163
1163
|
|
|
1164
1164
|
//#endregion
|
|
1165
1165
|
//#region src/components/ToggleSwitch/index.tsx
|
|
1166
|
-
const cn$
|
|
1166
|
+
const cn$29 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1167
1167
|
const sizeConfig$1 = {
|
|
1168
1168
|
sm: {
|
|
1169
1169
|
track: "h-5 w-9",
|
|
@@ -1187,7 +1187,7 @@ const sizeConfig$1 = {
|
|
|
1187
1187
|
function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label, className }) {
|
|
1188
1188
|
const config = sizeConfig$1[size];
|
|
1189
1189
|
return /* @__PURE__ */ jsxs("div", {
|
|
1190
|
-
className: cn$
|
|
1190
|
+
className: cn$29("inline-flex items-center gap-2", className),
|
|
1191
1191
|
children: [/* @__PURE__ */ jsx("button", {
|
|
1192
1192
|
type: "button",
|
|
1193
1193
|
role: "switch",
|
|
@@ -1195,10 +1195,10 @@ function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label,
|
|
|
1195
1195
|
"aria-label": label,
|
|
1196
1196
|
disabled,
|
|
1197
1197
|
onClick: () => onChange(!enabled),
|
|
1198
|
-
className: cn$
|
|
1199
|
-
children: /* @__PURE__ */ jsx("span", { className: cn$
|
|
1198
|
+
className: cn$29("relative inline-flex items-center rounded-full transition-colors outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[var(--dashboard-primary,#37a501)]", config.track, enabled ? "bg-[var(--dashboard-primary,#37a501)]" : "bg-[var(--dashboard-text-secondary,#6b7280)]/30", disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"),
|
|
1199
|
+
children: /* @__PURE__ */ jsx("span", { className: cn$29("inline-block transform rounded-full bg-white shadow-sm transition-transform", config.thumb, enabled ? config.translateOn : config.translateOff) })
|
|
1200
1200
|
}), label && /* @__PURE__ */ jsx("span", {
|
|
1201
|
-
className: cn$
|
|
1201
|
+
className: cn$29("text-sm text-[var(--dashboard-text-primary,#2d2d2d)]", disabled && "opacity-50"),
|
|
1202
1202
|
children: label
|
|
1203
1203
|
})]
|
|
1204
1204
|
});
|
|
@@ -1206,7 +1206,7 @@ function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label,
|
|
|
1206
1206
|
|
|
1207
1207
|
//#endregion
|
|
1208
1208
|
//#region src/components/BadgeStatus/index.tsx
|
|
1209
|
-
const cn$
|
|
1209
|
+
const cn$28 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1210
1210
|
const variantStyles = {
|
|
1211
1211
|
success: {
|
|
1212
1212
|
color: "text-[var(--dashboard-status-success,#10B981)]",
|
|
@@ -1237,7 +1237,7 @@ function BadgeStatus({ label, variant = "neutral", color, bgColor, size = "md",
|
|
|
1237
1237
|
const styles = variantStyles[variant];
|
|
1238
1238
|
const useCustomColors = color || bgColor;
|
|
1239
1239
|
return /* @__PURE__ */ jsx("span", {
|
|
1240
|
-
className: cn$
|
|
1240
|
+
className: cn$28("inline-flex w-fit items-center justify-center rounded-full font-medium whitespace-nowrap", sizeClasses$1[size], !useCustomColors && styles.color, !useCustomColors && styles.bgColor, className),
|
|
1241
1241
|
style: useCustomColors ? {
|
|
1242
1242
|
color: color || void 0,
|
|
1243
1243
|
backgroundColor: bgColor || void 0
|
|
@@ -1248,7 +1248,7 @@ function BadgeStatus({ label, variant = "neutral", color, bgColor, size = "md",
|
|
|
1248
1248
|
|
|
1249
1249
|
//#endregion
|
|
1250
1250
|
//#region src/components/Sidebar/index.tsx
|
|
1251
|
-
const cn$
|
|
1251
|
+
const cn$27 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1252
1252
|
function DefaultLink$1({ href, className, children }) {
|
|
1253
1253
|
return /* @__PURE__ */ jsx("a", {
|
|
1254
1254
|
href,
|
|
@@ -1324,7 +1324,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1324
1324
|
const isChildActive = item.children?.some((c) => currentPath === c.href);
|
|
1325
1325
|
if (hasChildren) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
|
|
1326
1326
|
onClick: () => toggleExpand(item.id),
|
|
1327
|
-
className: cn$
|
|
1327
|
+
className: cn$27("w-full flex items-center px-4 py-3 rounded-lg text-sm font-medium cursor-pointer", collapsed && !mobile ? "justify-center" : "justify-start", isChildActive ? "text-[var(--dashboard-sidebar-active-text,#ff521d)]" : "text-[var(--dashboard-sidebar-text,#403f52)] hover:bg-[var(--dashboard-primary,#ff521d)]/10"),
|
|
1328
1328
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1329
1329
|
title: collapsed && !mobile ? item.label : void 0,
|
|
1330
1330
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1339,7 +1339,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1339
1339
|
children: item.label
|
|
1340
1340
|
}), /* @__PURE__ */ jsx(ChevronRight, {
|
|
1341
1341
|
size: 14,
|
|
1342
|
-
className: cn$
|
|
1342
|
+
className: cn$27("ml-auto flex-shrink-0 transition-transform duration-200", isExpanded ? "rotate-90" : "")
|
|
1343
1343
|
})] })]
|
|
1344
1344
|
}), (!collapsed || mobile) && /* @__PURE__ */ jsx("div", {
|
|
1345
1345
|
className: "overflow-hidden transition-all duration-200 ml-7 border-l-2 border-[var(--dashboard-sidebar-border,#e0dfe3)]",
|
|
@@ -1351,7 +1351,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1351
1351
|
href: child.href,
|
|
1352
1352
|
className: "block",
|
|
1353
1353
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1354
|
-
className: cn$
|
|
1354
|
+
className: cn$27("w-full flex items-center pl-4 pr-4 py-2 rounded-r-lg text-[13px] cursor-pointer", childActive ? "text-[var(--dashboard-sidebar-active-text,#ff521d)] font-semibold border-l-2 border-[var(--dashboard-primary,#ff521d)] -ml-[2px]" : "text-[var(--dashboard-sidebar-text,#403f52)] hover:text-[var(--dashboard-sidebar-active-text,#ff521d)]"),
|
|
1355
1355
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1356
1356
|
children: [/* @__PURE__ */ jsx(ChildIcon, {
|
|
1357
1357
|
size: 15,
|
|
@@ -1368,7 +1368,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1368
1368
|
href: item.href,
|
|
1369
1369
|
className: "block",
|
|
1370
1370
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1371
|
-
className: cn$
|
|
1371
|
+
className: cn$27("w-full flex items-center px-4 py-3 rounded-lg text-sm font-medium cursor-pointer", collapsed && !mobile ? "justify-center" : "justify-start", isActive ? "bg-[var(--dashboard-primary,#ff521d)]/25 text-[var(--dashboard-sidebar-active-text,#ff521d)]" : "text-[var(--dashboard-sidebar-text,#403f52)] hover:bg-[var(--dashboard-primary,#ff521d)]/10"),
|
|
1372
1372
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1373
1373
|
title: collapsed && !mobile ? item.label : void 0,
|
|
1374
1374
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1463,7 +1463,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1463
1463
|
})]
|
|
1464
1464
|
});
|
|
1465
1465
|
const desktopSidebar = /* @__PURE__ */ jsxs("aside", {
|
|
1466
|
-
className: cn$
|
|
1466
|
+
className: cn$27("hidden xl:flex xl:flex-col xl:fixed xl:left-0 xl:top-0 xl:h-screen bg-[var(--dashboard-sidebar-bg,#f0f0f0)] border-r border-[var(--dashboard-sidebar-border,#e0dfe3)] overflow-visible", isCollapsed ? "xl:w-[109px]" : "xl:w-[280px]", className),
|
|
1467
1467
|
style: { transition: `width 400ms ${cubicBezier}` },
|
|
1468
1468
|
children: [onToggleCollapse && /* @__PURE__ */ jsxs("button", {
|
|
1469
1469
|
onClick: onToggleCollapse,
|
|
@@ -1537,7 +1537,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1537
1537
|
children: [
|
|
1538
1538
|
user && /* @__PURE__ */ jsxs("button", {
|
|
1539
1539
|
onClick: onUserClick,
|
|
1540
|
-
className: cn$
|
|
1540
|
+
className: cn$27("w-full flex items-center px-4 py-3 rounded-lg bg-[var(--dashboard-primary,#ff521d)]/5 hover:bg-[var(--dashboard-primary,#ff521d)]/10 transition-colors cursor-pointer", isCollapsed ? "justify-center" : "justify-start"),
|
|
1541
1541
|
title: isCollapsed ? `${user.subtitle ? user.subtitle + " - " : ""}${user.name}` : void 0,
|
|
1542
1542
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1543
1543
|
className: "flex items-center justify-center w-8 h-8 rounded-full bg-[var(--dashboard-primary,#ff521d)]/30 text-[var(--dashboard-sidebar-text,#403f52)] flex-shrink-0",
|
|
@@ -1570,7 +1570,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1570
1570
|
footerItems?.map((item) => renderMenuItem(item, isCollapsed, false)),
|
|
1571
1571
|
onLogout && /* @__PURE__ */ jsxs("button", {
|
|
1572
1572
|
onClick: onLogout,
|
|
1573
|
-
className: cn$
|
|
1573
|
+
className: cn$27("w-full flex items-center px-4 py-3 rounded-lg text-sm font-medium cursor-pointer text-[var(--dashboard-sidebar-text,#403f52)] hover:bg-[var(--dashboard-primary,#ff521d)]/10", isCollapsed ? "justify-center" : "justify-start"),
|
|
1574
1574
|
style: { transition: "background-color 200ms" },
|
|
1575
1575
|
title: isCollapsed ? logoutLabel : void 0,
|
|
1576
1576
|
children: [/* @__PURE__ */ jsx(LogOut, {
|
|
@@ -1599,7 +1599,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1599
1599
|
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/components/Header/index.tsx
|
|
1602
|
-
const cn$
|
|
1602
|
+
const cn$26 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1603
1603
|
function isGroup(item) {
|
|
1604
1604
|
return "children" in item && Array.isArray(item.children);
|
|
1605
1605
|
}
|
|
@@ -1646,7 +1646,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1646
1646
|
const Icon = item.icon;
|
|
1647
1647
|
const active = currentPath === item.href;
|
|
1648
1648
|
if (item.disabled) return /* @__PURE__ */ jsxs("span", {
|
|
1649
|
-
className: cn$
|
|
1649
|
+
className: cn$26("flex items-center gap-2 rounded-lg text-sm font-medium cursor-not-allowed", options.mobile ? "px-4 py-3" : "h-10 px-3", "text-[var(--dashboard-text-secondary,#6b7280)]/40"),
|
|
1650
1650
|
title: "Em breve",
|
|
1651
1651
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1652
1652
|
size: 18,
|
|
@@ -1661,7 +1661,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1661
1661
|
className: "block",
|
|
1662
1662
|
onClick: closeMenus,
|
|
1663
1663
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1664
|
-
className: cn$
|
|
1664
|
+
className: cn$26("flex items-center gap-2 rounded-lg text-sm font-medium transition-colors", options.mobile ? "px-4 py-3" : "h-10 px-3", active ? "bg-[var(--dashboard-primary,#37a501)]/12 text-[var(--dashboard-primary,#37a501)]" : "text-[var(--dashboard-text-secondary,#6b7280)] hover:bg-[var(--dashboard-primary,#37a501)]/8 hover:text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
1665
1665
|
"aria-current": active ? "page" : void 0,
|
|
1666
1666
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1667
1667
|
size: 18,
|
|
@@ -1698,7 +1698,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1698
1698
|
className: "block",
|
|
1699
1699
|
onClick: closeMenus,
|
|
1700
1700
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1701
|
-
className: cn$
|
|
1701
|
+
className: cn$26("flex items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium transition-colors", active ? "bg-[var(--dashboard-primary,#37a501)]/12 text-[var(--dashboard-primary,#37a501)]" : "text-[var(--dashboard-text-secondary,#6b7280)] hover:bg-[var(--dashboard-primary,#37a501)]/8 hover:text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
1702
1702
|
children: [/* @__PURE__ */ jsx(child.icon, {
|
|
1703
1703
|
size: 16,
|
|
1704
1704
|
className: "flex-shrink-0"
|
|
@@ -1714,7 +1714,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1714
1714
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
1715
1715
|
type: "button",
|
|
1716
1716
|
onClick: () => setOpenDropdownId((prev) => prev === group.id ? null : group.id),
|
|
1717
|
-
className: cn$
|
|
1717
|
+
className: cn$26("flex items-center gap-1.5 rounded-lg h-10 px-3 text-sm font-medium transition-colors", groupActive ? "bg-[var(--dashboard-primary,#37a501)]/12 text-[var(--dashboard-primary,#37a501)]" : "text-[var(--dashboard-text-secondary,#6b7280)] hover:bg-[var(--dashboard-primary,#37a501)]/8 hover:text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
1718
1718
|
"aria-expanded": isOpen,
|
|
1719
1719
|
children: [
|
|
1720
1720
|
/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1724,7 +1724,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1724
1724
|
/* @__PURE__ */ jsx("span", { children: group.label }),
|
|
1725
1725
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
1726
1726
|
size: 14,
|
|
1727
|
-
className: cn$
|
|
1727
|
+
className: cn$26("flex-shrink-0 transition-transform", isOpen && "rotate-180")
|
|
1728
1728
|
})
|
|
1729
1729
|
]
|
|
1730
1730
|
}), isOpen && /* @__PURE__ */ jsx("div", {
|
|
@@ -1746,7 +1746,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1746
1746
|
className: "block",
|
|
1747
1747
|
onClick: () => setOpenDropdownId(null),
|
|
1748
1748
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1749
|
-
className: cn$
|
|
1749
|
+
className: cn$26("flex items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors", active ? "bg-[var(--dashboard-primary,#37a501)]/10 text-[var(--dashboard-primary,#37a501)] font-semibold" : "text-[var(--dashboard-text-primary,#2d2d2d)]/80 hover:bg-[var(--dashboard-primary,#37a501)]/8 hover:text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
1750
1750
|
children: [
|
|
1751
1751
|
/* @__PURE__ */ jsx(child.icon, {
|
|
1752
1752
|
size: 16,
|
|
@@ -1799,7 +1799,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1799
1799
|
style: { "--dashboard-header-offset-left": desktopOffset }
|
|
1800
1800
|
}),
|
|
1801
1801
|
/* @__PURE__ */ jsxs("header", {
|
|
1802
|
-
className: cn$
|
|
1802
|
+
className: cn$26("fixed left-[var(--dashboard-page-gutter,0px)] right-[var(--dashboard-page-gutter,0px)] top-2 z-40 rounded-2xl border border-[var(--dashboard-text-secondary,#6b7280)]/15 bg-[var(--dashboard-surface,#ffffff)] text-[var(--dashboard-text-primary,#2d2d2d)] shadow-sm transition-[left,right] duration-[400ms] ease-[cubic-bezier(0.4,0,0.2,1)] xl:left-[calc(var(--dashboard-header-offset-left,0px)+var(--dashboard-page-gutter,0px))]", className),
|
|
1803
1803
|
style: { "--dashboard-header-offset-left": desktopOffset },
|
|
1804
1804
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1805
1805
|
className: "flex h-20 items-center gap-4 px-4 sm:px-5 xl:grid xl:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]",
|
|
@@ -1843,7 +1843,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1843
1843
|
}),
|
|
1844
1844
|
/* @__PURE__ */ jsx(ChevronDown, {
|
|
1845
1845
|
size: 16,
|
|
1846
|
-
className: cn$
|
|
1846
|
+
className: cn$26("ml-auto flex-shrink-0 transition-transform", isUserMenuOpen && "rotate-180")
|
|
1847
1847
|
})
|
|
1848
1848
|
]
|
|
1849
1849
|
}), isUserMenuOpen && /* @__PURE__ */ jsxs("div", {
|
|
@@ -1887,7 +1887,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1887
1887
|
onEstablishmentChange?.(establishment.id);
|
|
1888
1888
|
},
|
|
1889
1889
|
disabled: isDisabled,
|
|
1890
|
-
className: cn$
|
|
1890
|
+
className: cn$26("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors", establishment.active ? "bg-[var(--dashboard-primary,#37a501)]/10 text-[var(--dashboard-primary,#37a501)]" : "hover:bg-[var(--dashboard-primary,#37a501)]/8", isDisabled ? establishment.active ? "cursor-default" : "cursor-not-allowed opacity-60" : "cursor-pointer"),
|
|
1891
1891
|
children: [
|
|
1892
1892
|
/* @__PURE__ */ jsx("div", {
|
|
1893
1893
|
className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-[var(--dashboard-primary,#37a501)]/12 text-[var(--dashboard-primary,#37a501)]",
|
|
@@ -1935,7 +1935,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1935
1935
|
})
|
|
1936
1936
|
]
|
|
1937
1937
|
}), /* @__PURE__ */ jsx("div", {
|
|
1938
|
-
className: cn$
|
|
1938
|
+
className: cn$26("xl:hidden overflow-hidden border-t border-[var(--dashboard-text-secondary,#6b7280)]/20 bg-[var(--dashboard-surface,#ffffff)] shadow-lg transition-[max-height] duration-200", isMobileMenuOpen ? "max-h-[calc(100vh-4rem)]" : "max-h-0"),
|
|
1939
1939
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1940
1940
|
className: "max-h-[calc(100vh-4rem)] overflow-y-auto px-4 py-3",
|
|
1941
1941
|
children: [/* @__PURE__ */ jsx("nav", {
|
|
@@ -1988,7 +1988,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
1988
1988
|
onEstablishmentChange?.(establishment.id);
|
|
1989
1989
|
},
|
|
1990
1990
|
disabled: isDisabled,
|
|
1991
|
-
className: cn$
|
|
1991
|
+
className: cn$26("flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left transition-colors", establishment.active ? "bg-[var(--dashboard-primary,#37a501)]/10 text-[var(--dashboard-primary,#37a501)]" : "hover:bg-[var(--dashboard-primary,#37a501)]/8", isDisabled ? establishment.active ? "cursor-default" : "cursor-not-allowed opacity-60" : "cursor-pointer"),
|
|
1992
1992
|
children: [
|
|
1993
1993
|
/* @__PURE__ */ jsx("div", {
|
|
1994
1994
|
className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-[var(--dashboard-primary,#37a501)]/12 text-[var(--dashboard-primary,#37a501)]",
|
|
@@ -2031,7 +2031,7 @@ function Header({ menuItems, logo, currentPath, linkComponent: LinkComponent = D
|
|
|
2031
2031
|
|
|
2032
2032
|
//#endregion
|
|
2033
2033
|
//#region src/components/ThemeSwitcher/index.tsx
|
|
2034
|
-
const cn$
|
|
2034
|
+
const cn$25 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2035
2035
|
const modes = [
|
|
2036
2036
|
{
|
|
2037
2037
|
value: "light",
|
|
@@ -2051,11 +2051,11 @@ const modes = [
|
|
|
2051
2051
|
];
|
|
2052
2052
|
function ThemeSwitcher({ mode, onModeChange, className }) {
|
|
2053
2053
|
return /* @__PURE__ */ jsx("div", {
|
|
2054
|
-
className: cn$
|
|
2054
|
+
className: cn$25("inline-flex items-center gap-1 rounded-lg bg-[var(--dashboard-background,#f2f2f2)] p-1", className),
|
|
2055
2055
|
children: modes.map(({ value, icon: Icon, label }) => /* @__PURE__ */ jsxs("button", {
|
|
2056
2056
|
type: "button",
|
|
2057
2057
|
onClick: () => onModeChange(value),
|
|
2058
|
-
className: cn$
|
|
2058
|
+
className: cn$25("flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", mode === value ? "bg-[var(--dashboard-surface,#ffffff)] text-[var(--dashboard-text-primary,#2d2d2d)] shadow-sm" : "text-[var(--dashboard-text-secondary,#6b7280)] hover:text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
2059
2059
|
title: label,
|
|
2060
2060
|
children: [/* @__PURE__ */ jsx(Icon, { size: 14 }), /* @__PURE__ */ jsx("span", { children: label })]
|
|
2061
2061
|
}, value))
|
|
@@ -2064,7 +2064,7 @@ function ThemeSwitcher({ mode, onModeChange, className }) {
|
|
|
2064
2064
|
|
|
2065
2065
|
//#endregion
|
|
2066
2066
|
//#region src/components/KPICard/index.tsx
|
|
2067
|
-
const cn$
|
|
2067
|
+
const cn$24 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2068
2068
|
function formatValue(value, format) {
|
|
2069
2069
|
switch (format) {
|
|
2070
2070
|
case "currency": return new Intl.NumberFormat("pt-BR", {
|
|
@@ -2094,7 +2094,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
2094
2094
|
if (isLoading) return /* @__PURE__ */ jsx(KPICardSkeleton, { className });
|
|
2095
2095
|
const trendConfig = trendConfigs[trend];
|
|
2096
2096
|
return /* @__PURE__ */ jsxs("div", {
|
|
2097
|
-
className: cn$
|
|
2097
|
+
className: cn$24("h-full w-full bg-[var(--dashboard-surface,#ffffff)] rounded-xl p-6 border border-[var(--dashboard-text-secondary,#64748B)]/12 transition-all duration-200 ease-out dashboard-shadow-sm hover:dashboard-shadow-md flex flex-col", className),
|
|
2098
2098
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2099
2099
|
className: "flex justify-between items-start mb-4 gap-2",
|
|
2100
2100
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -2118,7 +2118,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
2118
2118
|
className: "text-3xl font-bold text-[var(--dashboard-text-primary,#0F172A)] whitespace-nowrap tracking-tight",
|
|
2119
2119
|
children: formatValue(value, format)
|
|
2120
2120
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2121
|
-
className: cn$
|
|
2121
|
+
className: cn$24("inline-flex items-center gap-1 px-2 py-1 rounded-full flex-shrink-0 mb-1", trendConfig.color),
|
|
2122
2122
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2123
2123
|
className: "text-sm",
|
|
2124
2124
|
children: trendConfig.icon
|
|
@@ -2132,7 +2132,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
2132
2132
|
}
|
|
2133
2133
|
function KPICardSkeleton({ className }) {
|
|
2134
2134
|
return /* @__PURE__ */ jsxs("div", {
|
|
2135
|
-
className: cn$
|
|
2135
|
+
className: cn$24("h-full bg-[var(--dashboard-surface,#ffffff)] rounded-xl p-6 border border-[var(--dashboard-text-secondary,#64748B)]/12 dashboard-shadow-sm animate-pulse flex flex-col", className),
|
|
2136
2136
|
children: [/* @__PURE__ */ jsx("div", { className: "h-3 bg-[var(--dashboard-text-secondary,#64748B)]/10 rounded w-2/3 mb-4" }), /* @__PURE__ */ jsxs("div", {
|
|
2137
2137
|
className: "flex items-end gap-3 flex-1",
|
|
2138
2138
|
children: [/* @__PURE__ */ jsx("div", { className: "h-8 bg-[var(--dashboard-text-secondary,#64748B)]/10 rounded w-1/2" }), /* @__PURE__ */ jsx("div", { className: "h-5 bg-[var(--dashboard-text-secondary,#64748B)]/10 rounded-full w-1/4" })]
|
|
@@ -2142,13 +2142,13 @@ function KPICardSkeleton({ className }) {
|
|
|
2142
2142
|
|
|
2143
2143
|
//#endregion
|
|
2144
2144
|
//#region src/components/PageLayout/index.tsx
|
|
2145
|
-
const cn$
|
|
2145
|
+
const cn$23 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2146
2146
|
function PageLayout({ title, description, headerActions, appHeader, children, contentPadding = true, sidebar, sidebarCollapsed = false, sidebarWidth = 280, sidebarCollapsedWidth = 109, className }) {
|
|
2147
2147
|
const marginLeft = sidebar ? sidebarCollapsed ? `max(0px, ${sidebarCollapsedWidth}px)` : `max(0px, ${sidebarWidth}px)` : "0px";
|
|
2148
2148
|
const mainTopPadding = appHeader ? "pt-24" : sidebar ? "pt-16 xl:pt-0" : "pt-0";
|
|
2149
2149
|
const layoutContainer = "mx-[var(--dashboard-page-gutter)]";
|
|
2150
2150
|
return /* @__PURE__ */ jsxs("div", {
|
|
2151
|
-
className: cn$
|
|
2151
|
+
className: cn$23("min-h-screen bg-[var(--dashboard-background,#f2f2f2)] [--dashboard-page-gutter:1.5rem] sm:[--dashboard-page-gutter:2rem] lg:[--dashboard-page-gutter:2.5rem] xl:[--dashboard-page-gutter:3rem]", className),
|
|
2152
2152
|
children: [
|
|
2153
2153
|
appHeader,
|
|
2154
2154
|
sidebar,
|
|
@@ -2167,7 +2167,7 @@ function PageLayout({ title, description, headerActions, appHeader, children, co
|
|
|
2167
2167
|
}
|
|
2168
2168
|
` }),
|
|
2169
2169
|
/* @__PURE__ */ jsx("div", {
|
|
2170
|
-
className: cn$
|
|
2170
|
+
className: cn$23(layoutContainer, "-mt-10 rounded-b-2xl border-b border-[var(--dashboard-text-secondary,#6b7280)]/20 bg-[var(--dashboard-surface,#ffffff)] px-7 pb-7 pt-16 sm:px-10 lg:px-12"),
|
|
2171
2171
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2172
2172
|
className: "flex flex-col gap-5 lg:flex-row lg:items-end lg:justify-between",
|
|
2173
2173
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -2186,7 +2186,7 @@ function PageLayout({ title, description, headerActions, appHeader, children, co
|
|
|
2186
2186
|
})
|
|
2187
2187
|
}),
|
|
2188
2188
|
/* @__PURE__ */ jsx("div", {
|
|
2189
|
-
className: contentPadding ? cn$
|
|
2189
|
+
className: contentPadding ? cn$23(layoutContainer, "py-6") : "",
|
|
2190
2190
|
children
|
|
2191
2191
|
})
|
|
2192
2192
|
]
|
|
@@ -2198,7 +2198,7 @@ function PageLayout({ title, description, headerActions, appHeader, children, co
|
|
|
2198
2198
|
//#endregion
|
|
2199
2199
|
//#region src/components/ComparisonLineChart/index.tsx
|
|
2200
2200
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title$1, Tooltip$1, Legend, Filler);
|
|
2201
|
-
const cn$
|
|
2201
|
+
const cn$22 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2202
2202
|
function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, currentPeriodLabel = "Período atual", previousPeriodLabel = "Período anterior", title, color, height = 300, className }) {
|
|
2203
2203
|
const primaryColor = color || (typeof document !== "undefined" ? getComputedStyle(document.documentElement).getPropertyValue("--dashboard-primary").trim() : "") || "#37a501";
|
|
2204
2204
|
const data = {
|
|
@@ -2292,7 +2292,7 @@ function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, cu
|
|
|
2292
2292
|
}
|
|
2293
2293
|
};
|
|
2294
2294
|
return /* @__PURE__ */ jsxs("div", {
|
|
2295
|
-
className: cn$
|
|
2295
|
+
className: cn$22("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6", className),
|
|
2296
2296
|
children: [title && /* @__PURE__ */ jsx("h3", {
|
|
2297
2297
|
className: "text-base font-semibold mb-4 text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
2298
2298
|
children: title
|
|
@@ -2309,7 +2309,7 @@ function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, cu
|
|
|
2309
2309
|
//#endregion
|
|
2310
2310
|
//#region src/components/HorizontalBarChart/index.tsx
|
|
2311
2311
|
Chart.register(CategoryScale, LinearScale, BarElement, Title$1, Tooltip$1, Legend);
|
|
2312
|
-
const cn$
|
|
2312
|
+
const cn$21 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2313
2313
|
function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, valueLabel = "itens", valueLabelSingular, bestItemLabel = "Melhor item", className }) {
|
|
2314
2314
|
const [activeTab, setActiveTab] = useState((tabs ? tabs.map((t) => t.id) : Object.keys(datasets))[0]);
|
|
2315
2315
|
const [isMobile, setIsMobile] = useState(false);
|
|
@@ -2384,7 +2384,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
2386
|
return /* @__PURE__ */ jsxs("div", {
|
|
2387
|
-
className: cn$
|
|
2387
|
+
className: cn$21("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-5 sm:p-6 min-h-[850px] sm:h-full flex flex-col", className),
|
|
2388
2388
|
children: [
|
|
2389
2389
|
title && /* @__PURE__ */ jsxs("div", {
|
|
2390
2390
|
className: "flex items-center gap-2 mb-4",
|
|
@@ -2397,7 +2397,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
2397
2397
|
className: "flex gap-2 mb-4 flex-wrap",
|
|
2398
2398
|
children: tabs.map((tab) => /* @__PURE__ */ jsx("button", {
|
|
2399
2399
|
onClick: () => setActiveTab(tab.id),
|
|
2400
|
-
className: cn$
|
|
2400
|
+
className: cn$21("px-3.5 py-2 sm:px-4 sm:py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap cursor-pointer", activeTab === tab.id ? "bg-[var(--dashboard-primary,#37a501)] text-white" : "bg-[var(--dashboard-text-secondary,#6b7280)]/10 text-[var(--dashboard-text-secondary,#6b7280)] hover:bg-[var(--dashboard-text-secondary,#6b7280)]/20"),
|
|
2401
2401
|
children: tab.label
|
|
2402
2402
|
}, tab.id))
|
|
2403
2403
|
}),
|
|
@@ -2436,7 +2436,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
2436
2436
|
//#endregion
|
|
2437
2437
|
//#region src/components/VerticalBarChart/index.tsx
|
|
2438
2438
|
Chart.register(CategoryScale, LinearScale, BarElement, Title$1, Tooltip$1, Legend);
|
|
2439
|
-
const cn$
|
|
2439
|
+
const cn$20 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2440
2440
|
function VerticalBarChart({ labels, data: values, title, titleIcon, color, valueLabel = "itens", valueLabelSingular, bestItemLabel = "Melhor item", labelMaxChars = 3, className }) {
|
|
2441
2441
|
const maxValue = Math.max(...values);
|
|
2442
2442
|
const bestLabel = labels[values.indexOf(maxValue)];
|
|
@@ -2499,7 +2499,7 @@ function VerticalBarChart({ labels, data: values, title, titleIcon, color, value
|
|
|
2499
2499
|
}
|
|
2500
2500
|
};
|
|
2501
2501
|
return /* @__PURE__ */ jsxs("div", {
|
|
2502
|
-
className: cn$
|
|
2502
|
+
className: cn$20("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6 flex-1 flex flex-col", className),
|
|
2503
2503
|
children: [
|
|
2504
2504
|
title && /* @__PURE__ */ jsxs("div", {
|
|
2505
2505
|
className: "flex items-center gap-2 mb-4",
|
|
@@ -2555,7 +2555,7 @@ const DEFAULT_COLORS = [
|
|
|
2555
2555
|
"#EA580C",
|
|
2556
2556
|
"#4F46E5"
|
|
2557
2557
|
];
|
|
2558
|
-
const cn$
|
|
2558
|
+
const cn$19 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2559
2559
|
function DoughnutChart({ items, title, titleIcon, centerLabel, centerValue, showLegend = true, formatValue, cutout = 65, height = 240, className }) {
|
|
2560
2560
|
const total = items.reduce((sum, item) => sum + item.value, 0);
|
|
2561
2561
|
const format = formatValue || ((v) => String(v));
|
|
@@ -2595,7 +2595,7 @@ function DoughnutChart({ items, title, titleIcon, centerLabel, centerValue, show
|
|
|
2595
2595
|
}
|
|
2596
2596
|
};
|
|
2597
2597
|
return /* @__PURE__ */ jsxs("div", {
|
|
2598
|
-
className: cn$
|
|
2598
|
+
className: cn$19("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6", className),
|
|
2599
2599
|
children: [title && /* @__PURE__ */ jsxs("div", {
|
|
2600
2600
|
className: "flex items-center gap-2 mb-4",
|
|
2601
2601
|
children: [titleIcon, /* @__PURE__ */ jsx("h3", {
|
|
@@ -2603,7 +2603,7 @@ function DoughnutChart({ items, title, titleIcon, centerLabel, centerValue, show
|
|
|
2603
2603
|
children: title
|
|
2604
2604
|
})]
|
|
2605
2605
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2606
|
-
className: cn$
|
|
2606
|
+
className: cn$19("flex items-center", showLegend ? "gap-6" : "justify-center"),
|
|
2607
2607
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
2608
2608
|
className: "relative flex-shrink-0",
|
|
2609
2609
|
style: {
|
|
@@ -2656,7 +2656,7 @@ function DoughnutChart({ items, title, titleIcon, centerLabel, centerValue, show
|
|
|
2656
2656
|
|
|
2657
2657
|
//#endregion
|
|
2658
2658
|
//#region src/components/ProgressBarList/index.tsx
|
|
2659
|
-
const cn$
|
|
2659
|
+
const cn$18 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2660
2660
|
function ProgressBarList({ items, title, titleIcon, color, valueLabel = "itens", valueLabelSingular, sortByValue = true, formatValue, className }) {
|
|
2661
2661
|
const sortedItems = sortByValue ? [...items].sort((a, b) => b.value - a.value) : items;
|
|
2662
2662
|
const maxValue = Math.max(...items.map((i) => i.value));
|
|
@@ -2665,7 +2665,7 @@ function ProgressBarList({ items, title, titleIcon, color, valueLabel = "itens",
|
|
|
2665
2665
|
const defaultFormat = (v) => `${v} ${v === 1 ? singular : valueLabel}`;
|
|
2666
2666
|
const fmt = formatValue || defaultFormat;
|
|
2667
2667
|
return /* @__PURE__ */ jsxs("div", {
|
|
2668
|
-
className: cn$
|
|
2668
|
+
className: cn$18("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6 flex-1 flex flex-col", className),
|
|
2669
2669
|
children: [title && /* @__PURE__ */ jsxs("div", {
|
|
2670
2670
|
className: "flex items-center gap-2 mb-4",
|
|
2671
2671
|
children: [titleIcon, /* @__PURE__ */ jsx("h3", {
|
|
@@ -2714,7 +2714,7 @@ function ProgressBarList({ items, title, titleIcon, color, valueLabel = "itens",
|
|
|
2714
2714
|
//#endregion
|
|
2715
2715
|
//#region src/components/MetricPanel/index.tsx
|
|
2716
2716
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title$1, Tooltip$1, Legend, Filler);
|
|
2717
|
-
const cn$
|
|
2717
|
+
const cn$17 = (...classes) => classes.filter(Boolean).join(" ");
|
|
2718
2718
|
function formatMetricValue(value, format) {
|
|
2719
2719
|
switch (format) {
|
|
2720
2720
|
case "currency": return new Intl.NumberFormat("pt-BR", {
|
|
@@ -3034,7 +3034,7 @@ function MetricPanel({ title, titleIcon: TitleIcon, metrics, chartData, color, s
|
|
|
3034
3034
|
}
|
|
3035
3035
|
};
|
|
3036
3036
|
return /* @__PURE__ */ jsxs("div", {
|
|
3037
|
-
className: cn$
|
|
3037
|
+
className: cn$17("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
3038
3038
|
style: { overflow: "visible" },
|
|
3039
3039
|
children: [
|
|
3040
3040
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -3075,7 +3075,7 @@ function MetricPanel({ title, titleIcon: TitleIcon, metrics, chartData, color, s
|
|
|
3075
3075
|
const Icon = metric.icon;
|
|
3076
3076
|
return /* @__PURE__ */ jsxs("button", {
|
|
3077
3077
|
onClick: () => setSelectedMetricKey(metric.key),
|
|
3078
|
-
className: cn$
|
|
3078
|
+
className: cn$17("flex items-center gap-2 px-4 md:px-6 py-2 rounded-full text-sm font-medium transition-colors cursor-pointer", selectedMetricKey === metric.key ? "bg-[var(--dashboard-surface,#ffffff)] border-2 text-[var(--dashboard-primary,#37a501)]" : "bg-[var(--dashboard-surface,#ffffff)] border border-[var(--dashboard-text-secondary,#6b7280)]/30 text-[var(--dashboard-text-secondary,#6b7280)] hover:border-[var(--dashboard-text-secondary,#6b7280)]/50"),
|
|
3079
3079
|
style: selectedMetricKey === metric.key ? {
|
|
3080
3080
|
borderColor: primaryColor,
|
|
3081
3081
|
color: primaryColor
|
|
@@ -3123,10 +3123,10 @@ function MetricPanel({ title, titleIcon: TitleIcon, metrics, chartData, color, s
|
|
|
3123
3123
|
|
|
3124
3124
|
//#endregion
|
|
3125
3125
|
//#region src/components/FilterBar/index.tsx
|
|
3126
|
-
const cn$
|
|
3126
|
+
const cn$16 = (...classes) => classes.filter(Boolean).join(" ");
|
|
3127
3127
|
function FilterBar({ searchValue, onSearchChange, searchPlaceholder = "Buscar...", children, actions, className }) {
|
|
3128
3128
|
return /* @__PURE__ */ jsxs("div", {
|
|
3129
|
-
className: cn$
|
|
3129
|
+
className: cn$16("flex flex-col gap-3 sm:flex-row sm:items-center sm:flex-wrap", className),
|
|
3130
3130
|
children: [
|
|
3131
3131
|
onSearchChange !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
3132
3132
|
className: "flex-1 min-w-[200px]",
|
|
@@ -3166,7 +3166,7 @@ function FilterBar({ searchValue, onSearchChange, searchPlaceholder = "Buscar...
|
|
|
3166
3166
|
|
|
3167
3167
|
//#endregion
|
|
3168
3168
|
//#region src/components/Checkbox/index.tsx
|
|
3169
|
-
const cn$
|
|
3169
|
+
const cn$15 = (...classes) => classes.filter(Boolean).join(" ");
|
|
3170
3170
|
const sizeConfig = {
|
|
3171
3171
|
sm: {
|
|
3172
3172
|
box: 16,
|
|
@@ -3214,7 +3214,7 @@ function Checkbox({ name, id, label, checked = false, onChange, disabled = false
|
|
|
3214
3214
|
const resolvedColor = primaryColor || "var(--dashboard-primary, #37A501)";
|
|
3215
3215
|
return /* @__PURE__ */ jsxs("label", {
|
|
3216
3216
|
htmlFor: inputId,
|
|
3217
|
-
className: cn$
|
|
3217
|
+
className: cn$15("inline-flex items-center cursor-pointer select-none", disabled && "opacity-50 cursor-not-allowed", className),
|
|
3218
3218
|
style: { gap: cfg.gap },
|
|
3219
3219
|
children: [
|
|
3220
3220
|
/* @__PURE__ */ jsx("input", {
|
|
@@ -3265,7 +3265,7 @@ function Checkbox({ name, id, label, checked = false, onChange, disabled = false
|
|
|
3265
3265
|
|
|
3266
3266
|
//#endregion
|
|
3267
3267
|
//#region src/components/AuthLayout/index.tsx
|
|
3268
|
-
const cn$
|
|
3268
|
+
const cn$14 = (...classes) => classes.filter(Boolean).join(" ");
|
|
3269
3269
|
/** Resolves a CSS color value (including var() references) to a computed hex/rgb string */
|
|
3270
3270
|
function useResolvedColor(cssValue) {
|
|
3271
3271
|
const [resolved, setResolved] = useState(cssValue);
|
|
@@ -3432,7 +3432,7 @@ function AuthLayout({ logo, title, subtitle, error, success, fields, values, onF
|
|
|
3432
3432
|
if (link.onClick) return /* @__PURE__ */ jsx("button", {
|
|
3433
3433
|
type: "button",
|
|
3434
3434
|
onClick: link.onClick,
|
|
3435
|
-
className: cn$
|
|
3435
|
+
className: cn$14("bg-transparent border-none cursor-pointer hover:opacity-80 text-sm font-semibold p-0 transition-colors", extraClass),
|
|
3436
3436
|
style,
|
|
3437
3437
|
children: link.label
|
|
3438
3438
|
});
|
|
@@ -3440,13 +3440,13 @@ function AuthLayout({ logo, title, subtitle, error, success, fields, values, onF
|
|
|
3440
3440
|
href: link.href,
|
|
3441
3441
|
target: link.target,
|
|
3442
3442
|
rel: link.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
3443
|
-
className: cn$
|
|
3443
|
+
className: cn$14("hover:opacity-80 text-sm font-semibold transition-colors", extraClass),
|
|
3444
3444
|
style,
|
|
3445
3445
|
children: link.label
|
|
3446
3446
|
});
|
|
3447
3447
|
}
|
|
3448
3448
|
return /* @__PURE__ */ jsxs("div", {
|
|
3449
|
-
className: cn$
|
|
3449
|
+
className: cn$14("fixed inset-0 flex select-none overflow-hidden", className),
|
|
3450
3450
|
style: bgCss,
|
|
3451
3451
|
children: [
|
|
3452
3452
|
branding && branding.logos.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
@@ -3729,7 +3729,7 @@ function CodeInput({ length = 6, value, onChange, disabled = false, error = fals
|
|
|
3729
3729
|
|
|
3730
3730
|
//#endregion
|
|
3731
3731
|
//#region src/components/Skeleton/index.tsx
|
|
3732
|
-
const cn$
|
|
3732
|
+
const cn$13 = (...classes) => classes.filter(Boolean).join(" ");
|
|
3733
3733
|
function Skeleton({ variant = "text", width, height, animate = true, className, lines = 1 }) {
|
|
3734
3734
|
const baseStyles = "bg-[var(--dashboard-text-secondary,#6b7280)]/10 relative overflow-hidden";
|
|
3735
3735
|
const shimmerStyles = animate ? "after:absolute after:inset-0 after:bg-gradient-to-r after:from-transparent after:via-[var(--dashboard-text-secondary,#6b7280)]/5 after:to-transparent dashboard-animate-shimmer after:content-['']" : "";
|
|
@@ -3748,9 +3748,9 @@ function Skeleton({ variant = "text", width, height, animate = true, className,
|
|
|
3748
3748
|
}
|
|
3749
3749
|
if (variant === "card" && !height) style.height = "120px";
|
|
3750
3750
|
if (variant === "text" && lines > 1) return /* @__PURE__ */ jsx("div", {
|
|
3751
|
-
className: cn$
|
|
3751
|
+
className: cn$13("flex flex-col gap-2", className),
|
|
3752
3752
|
children: Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ jsx("div", {
|
|
3753
|
-
className: cn$
|
|
3753
|
+
className: cn$13(baseStyles, shimmerStyles, variantStyles.text),
|
|
3754
3754
|
style: {
|
|
3755
3755
|
...style,
|
|
3756
3756
|
width: i === lines - 1 ? "75%" : style.width || "100%"
|
|
@@ -3758,14 +3758,14 @@ function Skeleton({ variant = "text", width, height, animate = true, className,
|
|
|
3758
3758
|
}, i))
|
|
3759
3759
|
});
|
|
3760
3760
|
return /* @__PURE__ */ jsx("div", {
|
|
3761
|
-
className: cn$
|
|
3761
|
+
className: cn$13(baseStyles, shimmerStyles, variantStyles[variant], className),
|
|
3762
3762
|
style
|
|
3763
3763
|
});
|
|
3764
3764
|
}
|
|
3765
3765
|
|
|
3766
3766
|
//#endregion
|
|
3767
3767
|
//#region src/components/DataGrid/index.tsx
|
|
3768
|
-
const cn$
|
|
3768
|
+
const cn$12 = (...classes) => classes.filter(Boolean).join(" ");
|
|
3769
3769
|
function SortIcon({ sorted }) {
|
|
3770
3770
|
if (sorted === "asc") return /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" });
|
|
3771
3771
|
if (sorted === "desc") return /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" });
|
|
@@ -3820,7 +3820,7 @@ function VirtualRows({ table, rowHeight, onRowClick, compact }) {
|
|
|
3820
3820
|
className: "bg-[var(--dashboard-text-secondary,#6b7280)]/5 sticky top-0 z-10",
|
|
3821
3821
|
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx("th", {
|
|
3822
3822
|
scope: "col",
|
|
3823
|
-
className: cn$
|
|
3823
|
+
className: cn$12("text-left text-xs font-semibold text-[var(--dashboard-text-secondary,#6b7280)] uppercase tracking-wider", compact ? "px-4 py-2" : "px-6 py-3", header.column.getCanSort() && "cursor-pointer select-none"),
|
|
3824
3824
|
style: { width: header.getSize() },
|
|
3825
3825
|
onClick: header.column.getToggleSortingHandler(),
|
|
3826
3826
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -3835,10 +3835,10 @@ function VirtualRows({ table, rowHeight, onRowClick, compact }) {
|
|
|
3835
3835
|
}),
|
|
3836
3836
|
visibleRows.map((row) => /* @__PURE__ */ jsx("tr", {
|
|
3837
3837
|
onClick: () => onRowClick?.(row.original),
|
|
3838
|
-
className: cn$
|
|
3838
|
+
className: cn$12("hover:bg-[var(--dashboard-text-secondary,#6b7280)]/5 transition-colors", onRowClick && "cursor-pointer", row.getIsSelected() && "bg-[var(--dashboard-primary,#37a501)]/5"),
|
|
3839
3839
|
style: { height: rowHeight },
|
|
3840
3840
|
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx("td", {
|
|
3841
|
-
className: cn$
|
|
3841
|
+
className: cn$12(cellPadding, "text-sm whitespace-nowrap"),
|
|
3842
3842
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
3843
3843
|
}, cell.id))
|
|
3844
3844
|
}, row.id)),
|
|
@@ -3917,7 +3917,7 @@ function DataGrid({ columns, data, isLoading = false, skeletonRows = 5, sorting:
|
|
|
3917
3917
|
const cellPadding = compact ? "px-4 py-2" : "px-6 py-4";
|
|
3918
3918
|
const headerPadding = compact ? "px-4 py-2" : "px-6 py-3";
|
|
3919
3919
|
if (enableVirtualization) return /* @__PURE__ */ jsx("div", {
|
|
3920
|
-
className: cn$
|
|
3920
|
+
className: cn$12("overflow-hidden rounded-lg bg-[var(--dashboard-surface,#ffffff)] shadow-sm", bordered && "border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
3921
3921
|
children: /* @__PURE__ */ jsx(VirtualRows, {
|
|
3922
3922
|
table,
|
|
3923
3923
|
rowHeight,
|
|
@@ -3926,16 +3926,16 @@ function DataGrid({ columns, data, isLoading = false, skeletonRows = 5, sorting:
|
|
|
3926
3926
|
})
|
|
3927
3927
|
});
|
|
3928
3928
|
return /* @__PURE__ */ jsxs("div", {
|
|
3929
|
-
className: cn$
|
|
3929
|
+
className: cn$12("overflow-hidden rounded-lg bg-[var(--dashboard-surface,#ffffff)] shadow-sm", bordered && "border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
3930
3930
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3931
3931
|
className: "overflow-x-auto",
|
|
3932
3932
|
children: /* @__PURE__ */ jsxs("table", {
|
|
3933
3933
|
className: "min-w-full divide-y divide-[var(--dashboard-text-secondary,#6b7280)]/20",
|
|
3934
3934
|
children: [/* @__PURE__ */ jsx("thead", {
|
|
3935
|
-
className: cn$
|
|
3935
|
+
className: cn$12("bg-[var(--dashboard-text-secondary,#6b7280)]/5", stickyHeader && "sticky top-0 z-10"),
|
|
3936
3936
|
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx("th", {
|
|
3937
3937
|
scope: "col",
|
|
3938
|
-
className: cn$
|
|
3938
|
+
className: cn$12("text-left text-xs font-semibold text-[var(--dashboard-text-secondary,#6b7280)] uppercase tracking-wider", headerPadding, header.column.getCanSort() && "cursor-pointer select-none"),
|
|
3939
3939
|
style: header.getSize() !== 150 ? { width: header.getSize() } : void 0,
|
|
3940
3940
|
onClick: header.column.getToggleSortingHandler(),
|
|
3941
3941
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -3972,9 +3972,9 @@ function DataGrid({ columns, data, isLoading = false, skeletonRows = 5, sorting:
|
|
|
3972
3972
|
})
|
|
3973
3973
|
}) }) : table.getRowModel().rows.map((row, rowIndex) => /* @__PURE__ */ jsx("tr", {
|
|
3974
3974
|
onClick: () => onRowClick?.(row.original),
|
|
3975
|
-
className: cn$
|
|
3975
|
+
className: cn$12("transition-colors", onRowClick && "cursor-pointer", "hover:bg-[var(--dashboard-text-secondary,#6b7280)]/5", row.getIsSelected() && "bg-[var(--dashboard-primary,#37a501)]/5", striped && rowIndex % 2 === 1 && "bg-[var(--dashboard-text-secondary,#6b7280)]/3"),
|
|
3976
3976
|
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx("td", {
|
|
3977
|
-
className: cn$
|
|
3977
|
+
className: cn$12(cellPadding, "text-sm text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
3978
3978
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
3979
3979
|
}, cell.id))
|
|
3980
3980
|
}, row.id))
|
|
@@ -4035,7 +4035,7 @@ function DataGrid({ columns, data, isLoading = false, skeletonRows = 5, sorting:
|
|
|
4035
4035
|
|
|
4036
4036
|
//#endregion
|
|
4037
4037
|
//#region src/components/TreeView/index.tsx
|
|
4038
|
-
const cn$
|
|
4038
|
+
const cn$11 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4039
4039
|
function TreeItem({ node, level, expanded, selectedId, draggable, indentSize, onSelect, onToggle, onMove, renderNode, dragState, setDragState }) {
|
|
4040
4040
|
const hasChildren = node.children && node.children.length > 0;
|
|
4041
4041
|
const isExpanded = expanded.has(node.id);
|
|
@@ -4100,7 +4100,7 @@ function TreeItem({ node, level, expanded, selectedId, draggable, indentSize, on
|
|
|
4100
4100
|
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
4101
4101
|
"aria-selected": isSelected,
|
|
4102
4102
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
4103
|
-
className: cn$
|
|
4103
|
+
className: cn$11("group flex items-center gap-1 rounded-md px-2 py-1.5 transition-colors", isSelected ? "bg-[var(--dashboard-primary,#37a501)]/10 text-[var(--dashboard-primary,#37a501)]" : "hover:bg-[var(--dashboard-text-secondary,#6b7280)]/10 text-[var(--dashboard-text-primary,#2d2d2d)]", isDragging && "opacity-40", isDropTarget && dragState.position === "inside" && "ring-2 ring-[var(--dashboard-primary,#37a501)] ring-inset", node.disabled && "opacity-50 cursor-not-allowed"),
|
|
4104
4104
|
style: { paddingLeft: `${level * indentSize + 4}px` },
|
|
4105
4105
|
draggable: draggable && !node.disabled,
|
|
4106
4106
|
onDragStart: handleDragStart,
|
|
@@ -4118,10 +4118,10 @@ function TreeItem({ node, level, expanded, selectedId, draggable, indentSize, on
|
|
|
4118
4118
|
/* @__PURE__ */ jsx("button", {
|
|
4119
4119
|
type: "button",
|
|
4120
4120
|
onClick: () => hasChildren && onToggle(node.id),
|
|
4121
|
-
className: cn$
|
|
4121
|
+
className: cn$11("flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-transform", hasChildren ? "cursor-pointer" : "invisible"),
|
|
4122
4122
|
tabIndex: hasChildren ? 0 : -1,
|
|
4123
4123
|
"aria-label": isExpanded ? "Recolher" : "Expandir",
|
|
4124
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { className: cn$
|
|
4124
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: cn$11("h-3.5 w-3.5 transition-transform duration-150", isExpanded && "rotate-90") })
|
|
4125
4125
|
}),
|
|
4126
4126
|
renderNode ? /* @__PURE__ */ jsx("div", {
|
|
4127
4127
|
className: "flex-1 min-w-0 cursor-pointer",
|
|
@@ -4133,7 +4133,7 @@ function TreeItem({ node, level, expanded, selectedId, draggable, indentSize, on
|
|
|
4133
4133
|
children: node.icon
|
|
4134
4134
|
}),
|
|
4135
4135
|
/* @__PURE__ */ jsx("span", {
|
|
4136
|
-
className: cn$
|
|
4136
|
+
className: cn$11("flex-1 min-w-0 text-sm truncate", !node.disabled && "cursor-pointer"),
|
|
4137
4137
|
onClick: () => !node.disabled && onSelect?.(node),
|
|
4138
4138
|
children: node.label
|
|
4139
4139
|
}),
|
|
@@ -4186,7 +4186,7 @@ function TreeView({ nodes, onSelect, onExpand, onMove, renderNode, selectedId, d
|
|
|
4186
4186
|
}, [onExpand]);
|
|
4187
4187
|
return /* @__PURE__ */ jsx("ul", {
|
|
4188
4188
|
role: "tree",
|
|
4189
|
-
className: cn$
|
|
4189
|
+
className: cn$11("select-none", className),
|
|
4190
4190
|
children: nodes.map((node) => /* @__PURE__ */ jsx(TreeItem, {
|
|
4191
4191
|
node,
|
|
4192
4192
|
level: 0,
|
|
@@ -4206,7 +4206,7 @@ function TreeView({ nodes, onSelect, onExpand, onMove, renderNode, selectedId, d
|
|
|
4206
4206
|
|
|
4207
4207
|
//#endregion
|
|
4208
4208
|
//#region src/components/Stepper/index.tsx
|
|
4209
|
-
const cn$
|
|
4209
|
+
const cn$10 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4210
4210
|
function StepIcon({ step, index }) {
|
|
4211
4211
|
const status = step.status || "pending";
|
|
4212
4212
|
if (status === "completed") return /* @__PURE__ */ jsx("div", {
|
|
@@ -4250,17 +4250,17 @@ function Stepper({ steps, activeStep, onStepChange, orientation = "horizontal",
|
|
|
4250
4250
|
type: "button",
|
|
4251
4251
|
onClick: () => onStepChange?.(index),
|
|
4252
4252
|
disabled: !onStepChange,
|
|
4253
|
-
className: cn$
|
|
4253
|
+
className: cn$10("relative z-10", onStepChange && "cursor-pointer", !onStepChange && "cursor-default"),
|
|
4254
4254
|
"aria-current": step.status === "active" ? "step" : void 0,
|
|
4255
4255
|
children: /* @__PURE__ */ jsx(StepIcon, {
|
|
4256
4256
|
step,
|
|
4257
4257
|
index
|
|
4258
4258
|
})
|
|
4259
|
-
}), index < resolvedSteps.length - 1 && /* @__PURE__ */ jsx("div", { className: cn$
|
|
4259
|
+
}), index < resolvedSteps.length - 1 && /* @__PURE__ */ jsx("div", { className: cn$10("w-0.5 flex-1 min-h-[32px]", step.status === "completed" ? "bg-[var(--dashboard-primary,#37a501)]" : "bg-[var(--dashboard-text-secondary,#6b7280)]/20") })]
|
|
4260
4260
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4261
|
-
className: cn$
|
|
4261
|
+
className: cn$10("pb-6", index === resolvedSteps.length - 1 && "pb-0"),
|
|
4262
4262
|
children: [/* @__PURE__ */ jsx("p", {
|
|
4263
|
-
className: cn$
|
|
4263
|
+
className: cn$10("text-sm font-medium leading-8", step.status === "active" ? "text-[var(--dashboard-primary,#37a501)]" : step.status === "completed" ? "text-[var(--dashboard-text-primary,#2d2d2d)]" : step.status === "error" ? "text-[var(--dashboard-status-danger,#EF4444)]" : "text-[var(--dashboard-text-secondary,#6b7280)]"),
|
|
4264
4264
|
children: step.label
|
|
4265
4265
|
}), step.description && /* @__PURE__ */ jsx("p", {
|
|
4266
4266
|
className: "text-xs text-[var(--dashboard-text-secondary,#6b7280)] mt-0.5",
|
|
@@ -4276,12 +4276,12 @@ function Stepper({ steps, activeStep, onStepChange, orientation = "horizontal",
|
|
|
4276
4276
|
children: /* @__PURE__ */ jsx("ol", {
|
|
4277
4277
|
className: "flex items-center",
|
|
4278
4278
|
children: resolvedSteps.map((step, index) => /* @__PURE__ */ jsxs("li", {
|
|
4279
|
-
className: cn$
|
|
4279
|
+
className: cn$10("flex items-center", index < resolvedSteps.length - 1 && "flex-1"),
|
|
4280
4280
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
4281
4281
|
type: "button",
|
|
4282
4282
|
onClick: () => onStepChange?.(index),
|
|
4283
4283
|
disabled: !onStepChange,
|
|
4284
|
-
className: cn$
|
|
4284
|
+
className: cn$10("flex items-center gap-2 group", onStepChange && "cursor-pointer", !onStepChange && "cursor-default"),
|
|
4285
4285
|
"aria-current": step.status === "active" ? "step" : void 0,
|
|
4286
4286
|
children: [/* @__PURE__ */ jsx(StepIcon, {
|
|
4287
4287
|
step,
|
|
@@ -4289,14 +4289,14 @@ function Stepper({ steps, activeStep, onStepChange, orientation = "horizontal",
|
|
|
4289
4289
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4290
4290
|
className: "hidden sm:block text-left",
|
|
4291
4291
|
children: [/* @__PURE__ */ jsx("p", {
|
|
4292
|
-
className: cn$
|
|
4292
|
+
className: cn$10("text-sm font-medium whitespace-nowrap", step.status === "active" ? "text-[var(--dashboard-primary,#37a501)]" : step.status === "completed" ? "text-[var(--dashboard-text-primary,#2d2d2d)]" : step.status === "error" ? "text-[var(--dashboard-status-danger,#EF4444)]" : "text-[var(--dashboard-text-secondary,#6b7280)]"),
|
|
4293
4293
|
children: step.label
|
|
4294
4294
|
}), step.description && /* @__PURE__ */ jsx("p", {
|
|
4295
4295
|
className: "text-xs text-[var(--dashboard-text-secondary,#6b7280)] whitespace-nowrap",
|
|
4296
4296
|
children: step.description
|
|
4297
4297
|
})]
|
|
4298
4298
|
})]
|
|
4299
|
-
}), index < resolvedSteps.length - 1 && /* @__PURE__ */ jsx("div", { className: cn$
|
|
4299
|
+
}), index < resolvedSteps.length - 1 && /* @__PURE__ */ jsx("div", { className: cn$10("flex-1 h-0.5 mx-3", step.status === "completed" ? "bg-[var(--dashboard-primary,#37a501)]" : "bg-[var(--dashboard-text-secondary,#6b7280)]/20") })]
|
|
4300
4300
|
}, step.id))
|
|
4301
4301
|
})
|
|
4302
4302
|
});
|
|
@@ -4304,7 +4304,7 @@ function Stepper({ steps, activeStep, onStepChange, orientation = "horizontal",
|
|
|
4304
4304
|
|
|
4305
4305
|
//#endregion
|
|
4306
4306
|
//#region src/components/FileUpload/index.tsx
|
|
4307
|
-
const cn$
|
|
4307
|
+
const cn$9 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4308
4308
|
function formatSize(bytes) {
|
|
4309
4309
|
if (bytes < 1024) return `${bytes} B`;
|
|
4310
4310
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -4400,7 +4400,7 @@ function FileUpload({ accept, maxSize, multiple = false, onUpload, onRemove, pre
|
|
|
4400
4400
|
onDragOver: handleDragOver,
|
|
4401
4401
|
onDragLeave: handleDragLeave,
|
|
4402
4402
|
onClick: () => !disabled && inputRef.current?.click(),
|
|
4403
|
-
className: cn$
|
|
4403
|
+
className: cn$9("relative flex flex-col items-center justify-center rounded-lg border-2 border-dashed p-6 transition-colors", isDragging ? "border-[var(--dashboard-primary,#37a501)] bg-[var(--dashboard-primary,#37a501)]/5" : "border-[var(--dashboard-text-secondary,#6b7280)]/30 hover:border-[var(--dashboard-text-secondary,#6b7280)]/50", disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"),
|
|
4404
4404
|
role: "button",
|
|
4405
4405
|
tabIndex: disabled ? -1 : 0,
|
|
4406
4406
|
"aria-label": label,
|
|
@@ -4423,7 +4423,7 @@ function FileUpload({ accept, maxSize, multiple = false, onUpload, onRemove, pre
|
|
|
4423
4423
|
}), /* @__PURE__ */ jsxs("div", {
|
|
4424
4424
|
className: "flex flex-col items-center text-center",
|
|
4425
4425
|
children: [
|
|
4426
|
-
icon || /* @__PURE__ */ jsx(Upload, { className: cn$
|
|
4426
|
+
icon || /* @__PURE__ */ jsx(Upload, { className: cn$9("h-8 w-8 mb-3", isDragging ? "text-[var(--dashboard-primary,#37a501)]" : "text-[var(--dashboard-text-secondary,#6b7280)]") }),
|
|
4427
4427
|
/* @__PURE__ */ jsx("p", {
|
|
4428
4428
|
className: "text-sm font-medium text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
4429
4429
|
children: label
|
|
@@ -4490,7 +4490,7 @@ function FileUpload({ accept, maxSize, multiple = false, onUpload, onRemove, pre
|
|
|
4490
4490
|
|
|
4491
4491
|
//#endregion
|
|
4492
4492
|
//#region src/components/Tooltip/index.tsx
|
|
4493
|
-
const cn$
|
|
4493
|
+
const cn$8 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4494
4494
|
function Tooltip({ content, position = "top", delay = 200, children, className, maxWidth = 240 }) {
|
|
4495
4495
|
const [visible, setVisible] = useState(false);
|
|
4496
4496
|
const [positioned, setPositioned] = useState(false);
|
|
@@ -4601,14 +4601,14 @@ function Tooltip({ content, position = "top", delay = 200, children, className,
|
|
|
4601
4601
|
ref: tooltipRef,
|
|
4602
4602
|
id: idRef.current,
|
|
4603
4603
|
role: "tooltip",
|
|
4604
|
-
className: cn$
|
|
4604
|
+
className: cn$8("fixed z-[10002] rounded-md px-3 py-2 text-xs font-medium", "bg-[var(--dashboard-tooltip-bg,#1a1a1a)] text-[var(--dashboard-tooltip-text,#ffffff)]", "shadow-lg pointer-events-none", positioned && "dashboard-animate-fade-in", className),
|
|
4605
4605
|
style: {
|
|
4606
4606
|
top: coords.top,
|
|
4607
4607
|
left: coords.left,
|
|
4608
4608
|
maxWidth,
|
|
4609
4609
|
opacity: positioned ? 1 : 0
|
|
4610
4610
|
},
|
|
4611
|
-
children: [content, /* @__PURE__ */ jsx("span", { className: cn$
|
|
4611
|
+
children: [content, /* @__PURE__ */ jsx("span", { className: cn$8("absolute w-0 h-0 border-[5px]", {
|
|
4612
4612
|
top: "left-1/2 -translate-x-1/2 top-full border-t-[var(--dashboard-tooltip-bg,#1a1a1a)] border-x-transparent border-b-transparent",
|
|
4613
4613
|
bottom: "left-1/2 -translate-x-1/2 bottom-full border-b-[var(--dashboard-tooltip-bg,#1a1a1a)] border-x-transparent border-t-transparent",
|
|
4614
4614
|
left: "top-1/2 -translate-y-1/2 left-full border-l-[var(--dashboard-tooltip-bg,#1a1a1a)] border-y-transparent border-r-transparent",
|
|
@@ -4677,7 +4677,7 @@ function InfoTooltip({ content, term, size = 14, position = "top", maxWidth = 28
|
|
|
4677
4677
|
|
|
4678
4678
|
//#endregion
|
|
4679
4679
|
//#region src/components/Breadcrumb/index.tsx
|
|
4680
|
-
const cn$
|
|
4680
|
+
const cn$7 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4681
4681
|
function Breadcrumb({ items, separator, onNavigate, className }) {
|
|
4682
4682
|
const defaultSeparator = /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 text-[var(--dashboard-text-secondary,#6b7280)] flex-shrink-0" });
|
|
4683
4683
|
const handleClick = (e, href) => {
|
|
@@ -4699,7 +4699,7 @@ function Breadcrumb({ items, separator, onNavigate, className }) {
|
|
|
4699
4699
|
"aria-hidden": "true",
|
|
4700
4700
|
children: separator || defaultSeparator
|
|
4701
4701
|
}), isLast ? /* @__PURE__ */ jsxs("span", {
|
|
4702
|
-
className: cn$
|
|
4702
|
+
className: cn$7("flex items-center gap-1.5 text-sm font-medium", "text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
4703
4703
|
"aria-current": "page",
|
|
4704
4704
|
children: [item.icon && /* @__PURE__ */ jsx("span", {
|
|
4705
4705
|
className: "flex-shrink-0 h-4 w-4",
|
|
@@ -4708,7 +4708,7 @@ function Breadcrumb({ items, separator, onNavigate, className }) {
|
|
|
4708
4708
|
}) : /* @__PURE__ */ jsxs("a", {
|
|
4709
4709
|
href: item.href || "#",
|
|
4710
4710
|
onClick: (e) => handleClick(e, item.href),
|
|
4711
|
-
className: cn$
|
|
4711
|
+
className: cn$7("flex items-center gap-1.5 text-sm", "text-[var(--dashboard-text-secondary,#6b7280)]", "hover:text-[var(--dashboard-primary,#37a501)] transition-colors"),
|
|
4712
4712
|
children: [item.icon && /* @__PURE__ */ jsx("span", {
|
|
4713
4713
|
className: "flex-shrink-0 h-4 w-4",
|
|
4714
4714
|
children: item.icon
|
|
@@ -4722,7 +4722,7 @@ function Breadcrumb({ items, separator, onNavigate, className }) {
|
|
|
4722
4722
|
|
|
4723
4723
|
//#endregion
|
|
4724
4724
|
//#region src/components/Combobox/index.tsx
|
|
4725
|
-
const cn$
|
|
4725
|
+
const cn$6 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4726
4726
|
function Combobox({ options, value, onChange, multiple = false, searchable = true, placeholder = "Selecione...", label, error, disabled = false, renderOption, noResultsText = "Nenhum resultado encontrado", className }) {
|
|
4727
4727
|
const [isOpen, setIsOpen] = useState(false);
|
|
4728
4728
|
const [query, setQuery] = useState("");
|
|
@@ -4852,7 +4852,7 @@ function Combobox({ options, value, onChange, multiple = false, searchable = tru
|
|
|
4852
4852
|
}, [focusedIndex]);
|
|
4853
4853
|
const selectedLabels = selectedValues.map((v) => options.find((o) => o.value === v)?.label).filter(Boolean);
|
|
4854
4854
|
return /* @__PURE__ */ jsxs("div", {
|
|
4855
|
-
className: cn$
|
|
4855
|
+
className: cn$6("space-y-2", className),
|
|
4856
4856
|
children: [
|
|
4857
4857
|
label && /* @__PURE__ */ jsx("label", {
|
|
4858
4858
|
className: "block text-sm text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
@@ -4868,7 +4868,7 @@ function Combobox({ options, value, onChange, multiple = false, searchable = tru
|
|
|
4868
4868
|
"aria-controls": "combobox-listbox",
|
|
4869
4869
|
tabIndex: disabled ? -1 : 0,
|
|
4870
4870
|
onClick: () => isOpen ? close() : open(),
|
|
4871
|
-
className: cn$
|
|
4871
|
+
className: cn$6("flex min-h-[40px] w-full items-center gap-2 rounded-lg border px-3 py-2 transition-colors", isOpen ? "border-[var(--dashboard-primary,#37a501)] ring-2 ring-[var(--dashboard-primary,#37a501)]/20" : error ? "border-[var(--dashboard-status-danger,#EF4444)]" : "border-[var(--dashboard-text-secondary,#6b7280)]/30 hover:border-[var(--dashboard-text-secondary,#6b7280)]/50", disabled ? "opacity-50 cursor-not-allowed bg-[var(--dashboard-text-secondary,#6b7280)]/10" : "cursor-pointer bg-[var(--dashboard-surface,#ffffff)]"),
|
|
4872
4872
|
children: [
|
|
4873
4873
|
/* @__PURE__ */ jsx("div", {
|
|
4874
4874
|
className: "flex flex-1 flex-wrap items-center gap-1 min-w-0",
|
|
@@ -4896,7 +4896,7 @@ function Combobox({ options, value, onChange, multiple = false, searchable = tru
|
|
|
4896
4896
|
"aria-label": "Limpar seleção",
|
|
4897
4897
|
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
4898
4898
|
}),
|
|
4899
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: cn$
|
|
4899
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn$6("h-4 w-4 flex-shrink-0 text-[var(--dashboard-text-secondary,#6b7280)] transition-transform", isOpen && "rotate-180") })
|
|
4900
4900
|
]
|
|
4901
4901
|
}), isOpen && typeof document !== "undefined" && createPortal(/* @__PURE__ */ jsxs("div", {
|
|
4902
4902
|
className: "dc-combobox-portal rounded-lg border border-[var(--dashboard-text-secondary,#6b7280)]/20 bg-[var(--dashboard-surface,#ffffff)] shadow-lg dashboard-animate-fade-in overflow-hidden",
|
|
@@ -4941,7 +4941,7 @@ function Combobox({ options, value, onChange, multiple = false, searchable = tru
|
|
|
4941
4941
|
onClick: () => {
|
|
4942
4942
|
if (!option.disabled) toggleOption(option.value);
|
|
4943
4943
|
},
|
|
4944
|
-
className: cn$
|
|
4944
|
+
className: cn$6("flex items-center justify-between px-3 py-2 text-sm transition-colors", option.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer", isFocused && "bg-[var(--dashboard-text-secondary,#6b7280)]/10", !isFocused && !option.disabled && "hover:bg-[var(--dashboard-text-secondary,#6b7280)]/10", isSelected ? "text-[var(--dashboard-primary,#37a501)] font-medium" : "text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
4945
4945
|
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
4946
4946
|
className: "truncate",
|
|
4947
4947
|
children: option.label
|
|
@@ -4961,7 +4961,7 @@ function Combobox({ options, value, onChange, multiple = false, searchable = tru
|
|
|
4961
4961
|
|
|
4962
4962
|
//#endregion
|
|
4963
4963
|
//#region src/components/Alert/index.tsx
|
|
4964
|
-
const cn$
|
|
4964
|
+
const cn$5 = (...classes) => classes.filter(Boolean).join(" ");
|
|
4965
4965
|
const variantConfig$1 = {
|
|
4966
4966
|
info: {
|
|
4967
4967
|
border: "border-[var(--dashboard-status-info,#3b82f6)]",
|
|
@@ -4991,24 +4991,24 @@ const variantConfig$1 = {
|
|
|
4991
4991
|
function Alert({ variant = "info", title, description, onClose, actions, icon, className }) {
|
|
4992
4992
|
const config = variantConfig$1[variant];
|
|
4993
4993
|
return /* @__PURE__ */ jsx("div", {
|
|
4994
|
-
className: cn$
|
|
4994
|
+
className: cn$5("rounded-lg border-l-4 p-4", config.border, config.bg, className),
|
|
4995
4995
|
role: "alert",
|
|
4996
4996
|
children: /* @__PURE__ */ jsxs("div", {
|
|
4997
4997
|
className: "flex gap-3",
|
|
4998
4998
|
children: [
|
|
4999
4999
|
/* @__PURE__ */ jsx("div", {
|
|
5000
|
-
className: cn$
|
|
5000
|
+
className: cn$5("flex-shrink-0 mt-0.5", config.text),
|
|
5001
5001
|
children: icon || config.icon
|
|
5002
5002
|
}),
|
|
5003
5003
|
/* @__PURE__ */ jsxs("div", {
|
|
5004
5004
|
className: "flex-1 min-w-0",
|
|
5005
5005
|
children: [
|
|
5006
5006
|
title && /* @__PURE__ */ jsx("h3", {
|
|
5007
|
-
className: cn$
|
|
5007
|
+
className: cn$5("text-sm font-semibold", "text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
5008
5008
|
children: title
|
|
5009
5009
|
}),
|
|
5010
5010
|
description && /* @__PURE__ */ jsx("div", {
|
|
5011
|
-
className: cn$
|
|
5011
|
+
className: cn$5("text-sm text-[var(--dashboard-text-secondary,#6b7280)]", title && "mt-1"),
|
|
5012
5012
|
children: description
|
|
5013
5013
|
}),
|
|
5014
5014
|
actions && /* @__PURE__ */ jsx("div", {
|
|
@@ -5030,7 +5030,7 @@ function Alert({ variant = "info", title, description, onClose, actions, icon, c
|
|
|
5030
5030
|
|
|
5031
5031
|
//#endregion
|
|
5032
5032
|
//#region src/components/Callout/index.tsx
|
|
5033
|
-
const cn$
|
|
5033
|
+
const cn$4 = (...classes) => classes.filter(Boolean).join(" ");
|
|
5034
5034
|
const variantConfig = {
|
|
5035
5035
|
info: {
|
|
5036
5036
|
border: "border-[var(--dashboard-status-info,#3b82f6)]",
|
|
@@ -5060,20 +5060,20 @@ const variantConfig = {
|
|
|
5060
5060
|
function Callout({ variant = "info", title, children, icon, className }) {
|
|
5061
5061
|
const config = variantConfig[variant];
|
|
5062
5062
|
return /* @__PURE__ */ jsx("div", {
|
|
5063
|
-
className: cn$
|
|
5063
|
+
className: cn$4("rounded-lg border-l-4 p-4 my-4", config.border, config.bg, className),
|
|
5064
5064
|
role: "note",
|
|
5065
5065
|
children: /* @__PURE__ */ jsxs("div", {
|
|
5066
5066
|
className: "flex gap-3",
|
|
5067
5067
|
children: [/* @__PURE__ */ jsx("div", {
|
|
5068
|
-
className: cn$
|
|
5068
|
+
className: cn$4("flex-shrink-0 mt-0.5", config.text),
|
|
5069
5069
|
children: icon || config.icon
|
|
5070
5070
|
}), /* @__PURE__ */ jsxs("div", {
|
|
5071
5071
|
className: "flex-1 min-w-0",
|
|
5072
5072
|
children: [title && /* @__PURE__ */ jsx("p", {
|
|
5073
|
-
className: cn$
|
|
5073
|
+
className: cn$4("text-sm font-semibold", "text-[var(--dashboard-text-primary,#2d2d2d)]"),
|
|
5074
5074
|
children: title
|
|
5075
5075
|
}), children && /* @__PURE__ */ jsx("div", {
|
|
5076
|
-
className: cn$
|
|
5076
|
+
className: cn$4("text-sm text-[var(--dashboard-text-secondary,#6b7280)]", title && "mt-1"),
|
|
5077
5077
|
children
|
|
5078
5078
|
})]
|
|
5079
5079
|
})]
|
|
@@ -5083,7 +5083,7 @@ function Callout({ variant = "info", title, children, icon, className }) {
|
|
|
5083
5083
|
|
|
5084
5084
|
//#endregion
|
|
5085
5085
|
//#region src/components/CodeBlock/index.tsx
|
|
5086
|
-
const cn$
|
|
5086
|
+
const cn$3 = (...classes) => classes.filter(Boolean).join(" ");
|
|
5087
5087
|
function CodeBlock({ code, language, filename, showLineNumbers = false, className, copyLabel = "Copiar", copiedLabel = "Copiado!" }) {
|
|
5088
5088
|
const [copied, setCopied] = useState(false);
|
|
5089
5089
|
const handleCopy = useCallback(async () => {
|
|
@@ -5095,7 +5095,7 @@ function CodeBlock({ code, language, filename, showLineNumbers = false, classNam
|
|
|
5095
5095
|
}, [code]);
|
|
5096
5096
|
const lines = code.split("\n");
|
|
5097
5097
|
return /* @__PURE__ */ jsxs("div", {
|
|
5098
|
-
className: cn$
|
|
5098
|
+
className: cn$3("relative rounded-lg overflow-hidden border border-[var(--dashboard-text-secondary,#64748B)]/12 my-4", className),
|
|
5099
5099
|
children: [(filename || language) && /* @__PURE__ */ jsxs("div", {
|
|
5100
5100
|
className: "flex items-center justify-between px-4 py-2 bg-[var(--dashboard-text-primary,#0F172A)] border-b border-[var(--dashboard-text-secondary,#64748B)]/20",
|
|
5101
5101
|
children: [
|
|
@@ -5129,7 +5129,7 @@ function CodeBlock({ code, language, filename, showLineNumbers = false, classNam
|
|
|
5129
5129
|
})
|
|
5130
5130
|
}), /* @__PURE__ */ jsxs("button", {
|
|
5131
5131
|
onClick: handleCopy,
|
|
5132
|
-
className: cn$
|
|
5132
|
+
className: cn$3("absolute top-3 right-3 flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium transition-all duration-200 cursor-pointer", copied ? "bg-[var(--dashboard-status-success,#059669)]/20 text-[var(--dashboard-status-success,#059669)]" : "bg-[var(--dashboard-surface,#FFFFFF)]/10 text-[var(--dashboard-surface,#FFFFFF)]/60 hover:bg-[var(--dashboard-surface,#FFFFFF)]/20 hover:text-[var(--dashboard-surface,#FFFFFF)]/80"),
|
|
5133
5133
|
"aria-label": copied ? copiedLabel : copyLabel,
|
|
5134
5134
|
title: copied ? copiedLabel : copyLabel,
|
|
5135
5135
|
children: [copied ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: copied ? copiedLabel : copyLabel })]
|
|
@@ -5140,10 +5140,10 @@ function CodeBlock({ code, language, filename, showLineNumbers = false, classNam
|
|
|
5140
5140
|
|
|
5141
5141
|
//#endregion
|
|
5142
5142
|
//#region src/components/EmptyState/index.tsx
|
|
5143
|
-
const cn$
|
|
5143
|
+
const cn$2 = (...classes) => classes.filter(Boolean).join(" ");
|
|
5144
5144
|
function EmptyState({ icon, title, description, action, className }) {
|
|
5145
5145
|
return /* @__PURE__ */ jsxs("div", {
|
|
5146
|
-
className: cn$
|
|
5146
|
+
className: cn$2("flex flex-col items-center justify-center py-12 px-6 text-center", className),
|
|
5147
5147
|
children: [
|
|
5148
5148
|
/* @__PURE__ */ jsx("div", {
|
|
5149
5149
|
className: "flex h-16 w-16 items-center justify-center rounded-full bg-[var(--dashboard-text-secondary,#6b7280)]/10 mb-4",
|
|
@@ -5167,7 +5167,7 @@ function EmptyState({ icon, title, description, action, className }) {
|
|
|
5167
5167
|
|
|
5168
5168
|
//#endregion
|
|
5169
5169
|
//#region src/components/StatusBadge/index.tsx
|
|
5170
|
-
const cn = (...classes) => classes.filter(Boolean).join(" ");
|
|
5170
|
+
const cn$1 = (...classes) => classes.filter(Boolean).join(" ");
|
|
5171
5171
|
const defaultColorMap = {
|
|
5172
5172
|
ACTIVE: "var(--dashboard-status-success,#10B981)",
|
|
5173
5173
|
APPROVED: "var(--dashboard-status-success,#10B981)",
|
|
@@ -5209,18 +5209,398 @@ function StatusBadge({ status, colorMap, size = "md", label, dot = true, classNa
|
|
|
5209
5209
|
}[status.toUpperCase().replace(/[\s-]/g, "_")] || "var(--dashboard-text-secondary,#6b7280)";
|
|
5210
5210
|
const displayLabel = label || formatLabel(status);
|
|
5211
5211
|
return /* @__PURE__ */ jsxs("span", {
|
|
5212
|
-
className: cn("inline-flex items-center gap-1.5 rounded-full font-medium whitespace-nowrap", sizeClasses[size], className),
|
|
5212
|
+
className: cn$1("inline-flex items-center gap-1.5 rounded-full font-medium whitespace-nowrap", sizeClasses[size], className),
|
|
5213
5213
|
style: {
|
|
5214
5214
|
color,
|
|
5215
5215
|
backgroundColor: `color-mix(in srgb, ${color} 12%, transparent)`
|
|
5216
5216
|
},
|
|
5217
5217
|
children: [dot && /* @__PURE__ */ jsx("span", {
|
|
5218
|
-
className: cn("rounded-full flex-shrink-0", dotSizeClasses[size]),
|
|
5218
|
+
className: cn$1("rounded-full flex-shrink-0", dotSizeClasses[size]),
|
|
5219
5219
|
style: { backgroundColor: color }
|
|
5220
5220
|
}), displayLabel]
|
|
5221
5221
|
});
|
|
5222
5222
|
}
|
|
5223
5223
|
|
|
5224
|
+
//#endregion
|
|
5225
|
+
//#region src/components/TableOfContents/index.tsx
|
|
5226
|
+
const cn = (...classes) => classes.filter(Boolean).join(" ");
|
|
5227
|
+
function getIdFromUrl(url) {
|
|
5228
|
+
if (typeof url === "string" && url.startsWith("#")) return url.slice(1);
|
|
5229
|
+
return null;
|
|
5230
|
+
}
|
|
5231
|
+
function arraysShallowEqual(a, b) {
|
|
5232
|
+
if (a === b) return true;
|
|
5233
|
+
if (a.length !== b.length) return false;
|
|
5234
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
5235
|
+
return true;
|
|
5236
|
+
}
|
|
5237
|
+
function findScrollableParent(el) {
|
|
5238
|
+
let current = el?.parentElement;
|
|
5239
|
+
while (current && current !== document.body) {
|
|
5240
|
+
const overflowY = getComputedStyle(current).overflowY;
|
|
5241
|
+
if (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") {
|
|
5242
|
+
if (current.scrollHeight > current.clientHeight) return current;
|
|
5243
|
+
}
|
|
5244
|
+
current = current.parentElement;
|
|
5245
|
+
}
|
|
5246
|
+
return document.documentElement;
|
|
5247
|
+
}
|
|
5248
|
+
function scrollAnchorIntoView(anchor, container, options = {}) {
|
|
5249
|
+
const { behavior = "smooth", block = "center" } = options;
|
|
5250
|
+
const containerRect = container.getBoundingClientRect();
|
|
5251
|
+
const offsetTopRelativeToContainer = anchor.getBoundingClientRect().top - containerRect.top + container.scrollTop;
|
|
5252
|
+
let targetScroll;
|
|
5253
|
+
if (block === "center") targetScroll = offsetTopRelativeToContainer - container.clientHeight / 2 + anchor.clientHeight / 2;
|
|
5254
|
+
else if (block === "end") targetScroll = offsetTopRelativeToContainer - container.clientHeight + anchor.clientHeight;
|
|
5255
|
+
else targetScroll = offsetTopRelativeToContainer;
|
|
5256
|
+
container.scrollTo({
|
|
5257
|
+
top: Math.max(0, targetScroll),
|
|
5258
|
+
behavior
|
|
5259
|
+
});
|
|
5260
|
+
}
|
|
5261
|
+
var TocObserver = class {
|
|
5262
|
+
constructor() {
|
|
5263
|
+
this.items = [];
|
|
5264
|
+
this.single = false;
|
|
5265
|
+
this.intersectionObserver = null;
|
|
5266
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
5267
|
+
}
|
|
5268
|
+
listen(fn) {
|
|
5269
|
+
this.listeners.add(fn);
|
|
5270
|
+
}
|
|
5271
|
+
unlisten(fn) {
|
|
5272
|
+
this.listeners.delete(fn);
|
|
5273
|
+
}
|
|
5274
|
+
setItems(nextItems) {
|
|
5275
|
+
if (this.intersectionObserver) for (const item of this.items) {
|
|
5276
|
+
const el = document.getElementById(item.id);
|
|
5277
|
+
if (el) this.intersectionObserver.unobserve(el);
|
|
5278
|
+
}
|
|
5279
|
+
const next = [];
|
|
5280
|
+
for (const item of nextItems) {
|
|
5281
|
+
const id = getIdFromUrl(item.url);
|
|
5282
|
+
if (!id) continue;
|
|
5283
|
+
next.push({
|
|
5284
|
+
id,
|
|
5285
|
+
active: false,
|
|
5286
|
+
fallback: false,
|
|
5287
|
+
t: 0,
|
|
5288
|
+
original: item
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5291
|
+
this.update(next);
|
|
5292
|
+
this.observeAll();
|
|
5293
|
+
}
|
|
5294
|
+
watch(options) {
|
|
5295
|
+
if (this.intersectionObserver) return;
|
|
5296
|
+
if (typeof window === "undefined") return;
|
|
5297
|
+
this.intersectionObserver = new IntersectionObserver(this.handleIntersection.bind(this), options);
|
|
5298
|
+
this.observeAll();
|
|
5299
|
+
}
|
|
5300
|
+
unwatch() {
|
|
5301
|
+
this.intersectionObserver?.disconnect();
|
|
5302
|
+
this.intersectionObserver = null;
|
|
5303
|
+
}
|
|
5304
|
+
handleIntersection(entries) {
|
|
5305
|
+
if (entries.length === 0) return;
|
|
5306
|
+
let hasActive = false;
|
|
5307
|
+
const updated = this.items.map((item) => {
|
|
5308
|
+
const entry = entries.find((e) => e.target.id === item.id);
|
|
5309
|
+
let active = entry ? entry.isIntersecting : item.active && !item.fallback;
|
|
5310
|
+
if (this.single && hasActive) active = false;
|
|
5311
|
+
let nextItem = item;
|
|
5312
|
+
if (item.active !== active) nextItem = {
|
|
5313
|
+
...item,
|
|
5314
|
+
t: Date.now(),
|
|
5315
|
+
active,
|
|
5316
|
+
fallback: false
|
|
5317
|
+
};
|
|
5318
|
+
if (active) hasActive = true;
|
|
5319
|
+
return nextItem;
|
|
5320
|
+
});
|
|
5321
|
+
if (!hasActive && entries[0].rootBounds) {
|
|
5322
|
+
const viewTop = entries[0].rootBounds.top;
|
|
5323
|
+
let min = Number.POSITIVE_INFINITY;
|
|
5324
|
+
let fallbackIdx = -1;
|
|
5325
|
+
for (let i = 0; i < updated.length; i++) {
|
|
5326
|
+
const el = document.getElementById(updated[i].id);
|
|
5327
|
+
if (!el) continue;
|
|
5328
|
+
const distance = Math.abs(viewTop - el.getBoundingClientRect().top);
|
|
5329
|
+
if (distance < min) {
|
|
5330
|
+
min = distance;
|
|
5331
|
+
fallbackIdx = i;
|
|
5332
|
+
}
|
|
5333
|
+
}
|
|
5334
|
+
if (fallbackIdx !== -1) updated[fallbackIdx] = {
|
|
5335
|
+
...updated[fallbackIdx],
|
|
5336
|
+
active: true,
|
|
5337
|
+
fallback: true,
|
|
5338
|
+
t: Date.now()
|
|
5339
|
+
};
|
|
5340
|
+
}
|
|
5341
|
+
this.update(updated);
|
|
5342
|
+
}
|
|
5343
|
+
observeAll() {
|
|
5344
|
+
if (!this.intersectionObserver) return;
|
|
5345
|
+
for (const item of this.items) {
|
|
5346
|
+
const el = document.getElementById(item.id);
|
|
5347
|
+
if (el) this.intersectionObserver.observe(el);
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
update(next) {
|
|
5351
|
+
this.items = next;
|
|
5352
|
+
for (const fn of this.listeners) fn(next);
|
|
5353
|
+
}
|
|
5354
|
+
};
|
|
5355
|
+
const ObserverContext = createContext(null);
|
|
5356
|
+
const ItemsContext = createContext([]);
|
|
5357
|
+
const LinksRefContext = createContext(null);
|
|
5358
|
+
function useObserver() {
|
|
5359
|
+
const observer = useContext(ObserverContext);
|
|
5360
|
+
if (!observer) throw new Error("TableOfContents hooks must be used inside <TOCProvider> or <TableOfContents>.");
|
|
5361
|
+
return observer;
|
|
5362
|
+
}
|
|
5363
|
+
/**
|
|
5364
|
+
* Headless provider that drives the scrollspy. Use directly when you want to
|
|
5365
|
+
* render the visual ToC yourself (e.g. mobile drawer, custom layout).
|
|
5366
|
+
*/
|
|
5367
|
+
function TOCProvider({ items, single = false, rootMargin = "0px 0px -70% 0px", threshold = 0, children }) {
|
|
5368
|
+
const observer = useMemo(() => new TocObserver(), []);
|
|
5369
|
+
observer.single = single;
|
|
5370
|
+
useEffect(() => {
|
|
5371
|
+
observer.setItems(items);
|
|
5372
|
+
}, [observer, items]);
|
|
5373
|
+
useEffect(() => {
|
|
5374
|
+
observer.watch({
|
|
5375
|
+
rootMargin,
|
|
5376
|
+
threshold
|
|
5377
|
+
});
|
|
5378
|
+
return () => observer.unwatch();
|
|
5379
|
+
}, [
|
|
5380
|
+
observer,
|
|
5381
|
+
rootMargin,
|
|
5382
|
+
threshold
|
|
5383
|
+
]);
|
|
5384
|
+
return /* @__PURE__ */ jsx(ObserverContext.Provider, {
|
|
5385
|
+
value: observer,
|
|
5386
|
+
children: /* @__PURE__ */ jsx(ItemsContext.Provider, {
|
|
5387
|
+
value: items,
|
|
5388
|
+
children
|
|
5389
|
+
})
|
|
5390
|
+
});
|
|
5391
|
+
}
|
|
5392
|
+
function useObserverState(select, isEqual = Object.is) {
|
|
5393
|
+
const observer = useObserver();
|
|
5394
|
+
const [value, setValue] = useState(() => select(observer.items));
|
|
5395
|
+
const selectRef = useRef(select);
|
|
5396
|
+
const isEqualRef = useRef(isEqual);
|
|
5397
|
+
selectRef.current = select;
|
|
5398
|
+
isEqualRef.current = isEqual;
|
|
5399
|
+
useEffect(() => {
|
|
5400
|
+
const listener = (items) => {
|
|
5401
|
+
const next = selectRef.current(items);
|
|
5402
|
+
setValue((prev) => isEqualRef.current(prev, next) ? prev : next);
|
|
5403
|
+
};
|
|
5404
|
+
observer.listen(listener);
|
|
5405
|
+
return () => observer.unlisten(listener);
|
|
5406
|
+
}, [observer]);
|
|
5407
|
+
return value;
|
|
5408
|
+
}
|
|
5409
|
+
/** Returns the id of the most recently activated heading (best guess). */
|
|
5410
|
+
function useActiveAnchor() {
|
|
5411
|
+
return useObserverState((items) => {
|
|
5412
|
+
let best;
|
|
5413
|
+
for (const item of items) {
|
|
5414
|
+
if (!item.active) continue;
|
|
5415
|
+
if (!best || item.t > best.t) best = item;
|
|
5416
|
+
}
|
|
5417
|
+
return best?.id;
|
|
5418
|
+
});
|
|
5419
|
+
}
|
|
5420
|
+
/** Returns the ids of every currently active heading. */
|
|
5421
|
+
function useActiveAnchors() {
|
|
5422
|
+
return useObserverState((items) => {
|
|
5423
|
+
const out = [];
|
|
5424
|
+
for (const item of items) if (item.active) out.push(item.id);
|
|
5425
|
+
return out;
|
|
5426
|
+
}, arraysShallowEqual);
|
|
5427
|
+
}
|
|
5428
|
+
/** Returns the static items list registered with the provider. */
|
|
5429
|
+
function useTOCItems() {
|
|
5430
|
+
return useContext(ItemsContext);
|
|
5431
|
+
}
|
|
5432
|
+
function handleAnchorClick(e, id) {
|
|
5433
|
+
const el = document.getElementById(id);
|
|
5434
|
+
if (!el) return;
|
|
5435
|
+
e.preventDefault();
|
|
5436
|
+
el.scrollIntoView({
|
|
5437
|
+
behavior: "smooth",
|
|
5438
|
+
block: "start"
|
|
5439
|
+
});
|
|
5440
|
+
if (typeof window !== "undefined" && window.history) window.history.replaceState(null, "", `#${id}`);
|
|
5441
|
+
}
|
|
5442
|
+
function TocAnchor({ item }) {
|
|
5443
|
+
const id = getIdFromUrl(item.url) ?? "";
|
|
5444
|
+
const activeIds = useActiveAnchors();
|
|
5445
|
+
const isActive = id ? activeIds.includes(id) : false;
|
|
5446
|
+
const linksRef = useContext(LinksRefContext);
|
|
5447
|
+
return /* @__PURE__ */ jsx("a", {
|
|
5448
|
+
ref: useCallback((node) => {
|
|
5449
|
+
if (!linksRef || !id) return;
|
|
5450
|
+
if (node) linksRef.current.set(id, node);
|
|
5451
|
+
else linksRef.current.delete(id);
|
|
5452
|
+
}, [linksRef, id]),
|
|
5453
|
+
href: item.url,
|
|
5454
|
+
"data-active": isActive,
|
|
5455
|
+
onClick: (e) => handleAnchorClick(e, id),
|
|
5456
|
+
className: cn("py-1.5 text-sm transition-colors scroll-m-4 wrap-anywhere first:pt-0 last:pb-0", "text-[var(--dashboard-text-secondary,#6b7280)]", "hover:text-[var(--dashboard-text-primary,#2d2d2d)]", "data-[active=true]:text-[var(--dashboard-primary,#e74410)]", item.depth <= 2 && "pl-3", item.depth === 3 && "pl-6", item.depth >= 4 && "pl-8"),
|
|
5457
|
+
children: item.title
|
|
5458
|
+
});
|
|
5459
|
+
}
|
|
5460
|
+
function TocThumb({ computed }) {
|
|
5461
|
+
const ref = useRef(null);
|
|
5462
|
+
const observer = useObserver();
|
|
5463
|
+
const calculate = useCallback((items) => {
|
|
5464
|
+
const out = {};
|
|
5465
|
+
const startIdx = items.findIndex((item) => item.active);
|
|
5466
|
+
if (startIdx === -1) return out;
|
|
5467
|
+
let endIdx = startIdx;
|
|
5468
|
+
for (let i = items.length - 1; i >= startIdx; i--) if (items[i].active) {
|
|
5469
|
+
endIdx = i;
|
|
5470
|
+
break;
|
|
5471
|
+
}
|
|
5472
|
+
const startPos = computed.positions[startIdx];
|
|
5473
|
+
const endPos = computed.positions[endIdx];
|
|
5474
|
+
if (!startPos || !endPos) return out;
|
|
5475
|
+
out["--track-top"] = `${startPos[0]}px`;
|
|
5476
|
+
out["--track-bottom"] = `${endPos[1]}px`;
|
|
5477
|
+
return out;
|
|
5478
|
+
}, [computed]);
|
|
5479
|
+
useEffect(() => {
|
|
5480
|
+
const el = ref.current;
|
|
5481
|
+
if (!el) return;
|
|
5482
|
+
const apply = (items) => {
|
|
5483
|
+
const styles = calculate(items);
|
|
5484
|
+
for (const [k, v] of Object.entries(styles)) el.style.setProperty(k, v);
|
|
5485
|
+
};
|
|
5486
|
+
apply(observer.items);
|
|
5487
|
+
observer.listen(apply);
|
|
5488
|
+
return () => observer.unlisten(apply);
|
|
5489
|
+
}, [observer, calculate]);
|
|
5490
|
+
const initialStyles = calculate(observer.items);
|
|
5491
|
+
return /* @__PURE__ */ jsx("div", {
|
|
5492
|
+
ref,
|
|
5493
|
+
"aria-hidden": true,
|
|
5494
|
+
className: "absolute inset-y-0 left-0 w-px bg-[var(--dashboard-primary,#e74410)] transition-[clip-path]",
|
|
5495
|
+
style: {
|
|
5496
|
+
clipPath: "polygon(0 var(--track-top, 0), 100% var(--track-top, 0), 100% var(--track-bottom, 0), 0 var(--track-bottom, 0))",
|
|
5497
|
+
...initialStyles
|
|
5498
|
+
}
|
|
5499
|
+
});
|
|
5500
|
+
}
|
|
5501
|
+
function TocList({ items, showThumb }) {
|
|
5502
|
+
const containerRef = useRef(null);
|
|
5503
|
+
const [computed, setComputed] = useState(null);
|
|
5504
|
+
const recompute = useCallback(() => {
|
|
5505
|
+
const container = containerRef.current;
|
|
5506
|
+
if (!container) return;
|
|
5507
|
+
if (items.length === 0) {
|
|
5508
|
+
setComputed(null);
|
|
5509
|
+
return;
|
|
5510
|
+
}
|
|
5511
|
+
const positions = [];
|
|
5512
|
+
for (const item of items) {
|
|
5513
|
+
const el = container.querySelector(`a[href="${item.url}"]`);
|
|
5514
|
+
if (!el) {
|
|
5515
|
+
positions.push([0, 0]);
|
|
5516
|
+
continue;
|
|
5517
|
+
}
|
|
5518
|
+
const styles = window.getComputedStyle(el);
|
|
5519
|
+
const top = el.offsetTop + parseFloat(styles.paddingTop || "0");
|
|
5520
|
+
const bottom = el.offsetTop + el.clientHeight - parseFloat(styles.paddingBottom || "0");
|
|
5521
|
+
positions.push([top, bottom]);
|
|
5522
|
+
}
|
|
5523
|
+
setComputed({ positions });
|
|
5524
|
+
}, [items]);
|
|
5525
|
+
useLayoutEffect(() => {
|
|
5526
|
+
recompute();
|
|
5527
|
+
}, [recompute]);
|
|
5528
|
+
useEffect(() => {
|
|
5529
|
+
const container = containerRef.current;
|
|
5530
|
+
if (!container || typeof ResizeObserver === "undefined") return;
|
|
5531
|
+
const ro = new ResizeObserver(() => recompute());
|
|
5532
|
+
ro.observe(container);
|
|
5533
|
+
return () => ro.disconnect();
|
|
5534
|
+
}, [recompute]);
|
|
5535
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5536
|
+
className: "relative",
|
|
5537
|
+
children: [showThumb && computed && /* @__PURE__ */ jsx(TocThumb, { computed }), /* @__PURE__ */ jsx("div", {
|
|
5538
|
+
ref: containerRef,
|
|
5539
|
+
className: "flex flex-col border-l border-[var(--dashboard-text-secondary,#6b7280)]/15",
|
|
5540
|
+
children: items.map((item) => /* @__PURE__ */ jsx(TocAnchor, { item }, item.url))
|
|
5541
|
+
})]
|
|
5542
|
+
});
|
|
5543
|
+
}
|
|
5544
|
+
function ActiveChangeReporter({ onActiveChange }) {
|
|
5545
|
+
const ids = useActiveAnchors();
|
|
5546
|
+
const cbRef = useRef(onActiveChange);
|
|
5547
|
+
cbRef.current = onActiveChange;
|
|
5548
|
+
useEffect(() => {
|
|
5549
|
+
cbRef.current(ids);
|
|
5550
|
+
}, [ids]);
|
|
5551
|
+
return null;
|
|
5552
|
+
}
|
|
5553
|
+
function ActiveScrollSync({ linksRef }) {
|
|
5554
|
+
const activeId = useActiveAnchor();
|
|
5555
|
+
useEffect(() => {
|
|
5556
|
+
if (!activeId) return;
|
|
5557
|
+
const link = linksRef.current.get(activeId);
|
|
5558
|
+
if (!link) return;
|
|
5559
|
+
const container = findScrollableParent(link);
|
|
5560
|
+
if (container === document.documentElement) return;
|
|
5561
|
+
scrollAnchorIntoView(link, container);
|
|
5562
|
+
}, [activeId, linksRef]);
|
|
5563
|
+
return null;
|
|
5564
|
+
}
|
|
5565
|
+
/**
|
|
5566
|
+
* Adapted from Fumadocs (MIT) — https://github.com/fuma-nama/fumadocs
|
|
5567
|
+
*
|
|
5568
|
+
* Scrollspy table of contents. Renders a sticky list of headings and tracks
|
|
5569
|
+
* which are visible in the viewport via IntersectionObserver. The active
|
|
5570
|
+
* range is highlighted with a thin animated bar (TocThumb).
|
|
5571
|
+
*/
|
|
5572
|
+
function TableOfContents({ items, title = "Nesta página", showThumb = true, single = false, rootMargin = "0px 0px -70% 0px", threshold = 0, className, onActiveChange }) {
|
|
5573
|
+
const linksRef = useRef(/* @__PURE__ */ new Map());
|
|
5574
|
+
return /* @__PURE__ */ jsx(TOCProvider, {
|
|
5575
|
+
items,
|
|
5576
|
+
single,
|
|
5577
|
+
rootMargin,
|
|
5578
|
+
threshold,
|
|
5579
|
+
children: /* @__PURE__ */ jsx(LinksRefContext.Provider, {
|
|
5580
|
+
value: linksRef,
|
|
5581
|
+
children: /* @__PURE__ */ jsxs("nav", {
|
|
5582
|
+
"aria-label": typeof title === "string" ? title : "Sumário",
|
|
5583
|
+
className: cn("text-sm", className),
|
|
5584
|
+
children: [
|
|
5585
|
+
title !== null && /* @__PURE__ */ jsxs("h3", {
|
|
5586
|
+
className: "inline-flex items-center gap-1.5 text-sm font-medium mb-3 text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
5587
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
5588
|
+
className: "h-4 w-4",
|
|
5589
|
+
"aria-hidden": true
|
|
5590
|
+
}), title]
|
|
5591
|
+
}),
|
|
5592
|
+
/* @__PURE__ */ jsx(TocList, {
|
|
5593
|
+
items,
|
|
5594
|
+
showThumb
|
|
5595
|
+
}),
|
|
5596
|
+
onActiveChange && /* @__PURE__ */ jsx(ActiveChangeReporter, { onActiveChange }),
|
|
5597
|
+
/* @__PURE__ */ jsx(ActiveScrollSync, { linksRef })
|
|
5598
|
+
]
|
|
5599
|
+
})
|
|
5600
|
+
})
|
|
5601
|
+
});
|
|
5602
|
+
}
|
|
5603
|
+
|
|
5224
5604
|
//#endregion
|
|
5225
5605
|
//#region src/config/defaults.ts
|
|
5226
5606
|
const defaultConfig = {
|
|
@@ -5515,5 +5895,5 @@ const modalSizes = {
|
|
|
5515
5895
|
};
|
|
5516
5896
|
|
|
5517
5897
|
//#endregion
|
|
5518
|
-
export { Alert, AuthLayout, BadgeStatus, Breadcrumb, Button, Callout, Card, Checkbox, CodeBlock, CodeInput, Combobox, ComparisonLineChart, DashboardProvider, DataGrid, DatePicker, DateRangePicker, DoughnutChart, Dropdown, EmptyState, FileUpload, FilterBar, FormField, Header, HorizontalBarChart, InfoTooltip, Input, KPICard, Loading, LoadingProvider, MetricPanel, Modal, NotificationsProvider, PageLayout, Pagination, ProgressBarList, Sidebar, Skeleton, StatusBadge, Stepper, Table, TableBody, TableEmpty, TableHeader, TableSkeleton, Tabs, ThemeProvider, ThemeSwitcher, Title, Toast, ToggleSwitch, Tooltip, TreeView, VerticalBarChart, badgeSizes, componentSizes, createColumnHelper, createConfig, defaultConfig, modalSizes, useConfig, useLoading, useNotifications, useTheme };
|
|
5898
|
+
export { Alert, AuthLayout, BadgeStatus, Breadcrumb, Button, Callout, Card, Checkbox, CodeBlock, CodeInput, Combobox, ComparisonLineChart, DashboardProvider, DataGrid, DatePicker, DateRangePicker, DoughnutChart, Dropdown, EmptyState, FileUpload, FilterBar, FormField, Header, HorizontalBarChart, InfoTooltip, Input, KPICard, Loading, LoadingProvider, MetricPanel, Modal, NotificationsProvider, PageLayout, Pagination, ProgressBarList, Sidebar, Skeleton, StatusBadge, Stepper, TOCProvider, Table, TableBody, TableEmpty, TableHeader, TableOfContents, TableSkeleton, Tabs, ThemeProvider, ThemeSwitcher, Title, Toast, ToggleSwitch, Tooltip, TreeView, VerticalBarChart, badgeSizes, componentSizes, createColumnHelper, createConfig, defaultConfig, modalSizes, useActiveAnchor, useActiveAnchors, useConfig, useLoading, useNotifications, useTOCItems, useTheme };
|
|
5519
5899
|
//# sourceMappingURL=index.mjs.map
|