@tree-ia/design-system 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +41 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +165 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useR
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { AlertCircle, AlertOctagon, AlertTriangle, ArrowDown, ArrowUp, ArrowUpDown, Check, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, File, GripVertical, Image, Inbox, Info, LogOut, Moon, Search, Sun, Upload, User, X, XCircle } from "lucide-react";
|
|
5
|
-
import { Bar, Line } from "react-chartjs-2";
|
|
6
|
-
import { BarElement, CategoryScale, Chart, Filler, Legend, LineElement, LinearScale, PointElement, Title as Title$1, Tooltip as Tooltip$1 } from "chart.js";
|
|
5
|
+
import { Bar, Doughnut, Line } from "react-chartjs-2";
|
|
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";
|
|
8
8
|
|
|
9
9
|
//#region src/components/Loading/index.tsx
|
|
@@ -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$30 = (...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$30(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$29 = (...classes) => classes.filter(Boolean).join(" ");
|
|
85
85
|
const Input = React.forwardRef(({ className, type = "text", label, error, children, id, ...props }, ref) => {
|
|
86
86
|
const inputId = id || (label ? `input-${label.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
87
87
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -97,7 +97,7 @@ const Input = React.forwardRef(({ className, type = "text", label, error, childr
|
|
|
97
97
|
children: [/* @__PURE__ */ jsx("input", {
|
|
98
98
|
type,
|
|
99
99
|
id: inputId,
|
|
100
|
-
className: cn$
|
|
100
|
+
className: cn$29("flex h-10 w-full rounded-md border border-[var(--dashboard-text-secondary,#6b7280)]/30 bg-[var(--dashboard-surface,#ffffff)] px-3 py-2 text-sm 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", error ? "border-[var(--dashboard-status-danger,#EF4444)] focus:border-[var(--dashboard-status-danger,#EF4444)]" : void 0, children ? "pr-10" : void 0, className),
|
|
101
101
|
ref,
|
|
102
102
|
...props
|
|
103
103
|
}), children && /* @__PURE__ */ jsx("div", {
|
|
@@ -761,16 +761,16 @@ function FormField({ label, name, type = "text", value, onChange, error, require
|
|
|
761
761
|
|
|
762
762
|
//#endregion
|
|
763
763
|
//#region src/components/Tabs/index.tsx
|
|
764
|
-
const cn$
|
|
764
|
+
const cn$28 = (...classes) => classes.filter(Boolean).join(" ");
|
|
765
765
|
function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
766
766
|
if (variant === "pill") return /* @__PURE__ */ jsx("div", {
|
|
767
|
-
className: cn$
|
|
767
|
+
className: cn$28("flex flex-wrap gap-2", className),
|
|
768
768
|
role: "tablist",
|
|
769
769
|
children: tabs.map((tab) => {
|
|
770
770
|
const isActive = activeTab === tab.id;
|
|
771
771
|
return /* @__PURE__ */ jsxs("button", {
|
|
772
772
|
onClick: () => onChange(tab.id),
|
|
773
|
-
className: cn$
|
|
773
|
+
className: cn$28("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"),
|
|
774
774
|
role: "tab",
|
|
775
775
|
"aria-selected": isActive,
|
|
776
776
|
children: [
|
|
@@ -780,7 +780,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
780
780
|
}),
|
|
781
781
|
tab.label,
|
|
782
782
|
tab.count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
783
|
-
className: cn$
|
|
783
|
+
className: cn$28("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)]"),
|
|
784
784
|
children: tab.count
|
|
785
785
|
})
|
|
786
786
|
]
|
|
@@ -788,7 +788,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
788
788
|
})
|
|
789
789
|
});
|
|
790
790
|
return /* @__PURE__ */ jsx("div", {
|
|
791
|
-
className: cn$
|
|
791
|
+
className: cn$28("border-b border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
792
792
|
children: /* @__PURE__ */ jsx("nav", {
|
|
793
793
|
className: "flex gap-6",
|
|
794
794
|
"aria-label": "Tabs",
|
|
@@ -796,7 +796,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
796
796
|
const isActive = activeTab === tab.id;
|
|
797
797
|
return /* @__PURE__ */ jsxs("button", {
|
|
798
798
|
onClick: () => onChange(tab.id),
|
|
799
|
-
className: cn$
|
|
799
|
+
className: cn$28("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"),
|
|
800
800
|
role: "tab",
|
|
801
801
|
"aria-selected": isActive,
|
|
802
802
|
children: [
|
|
@@ -806,7 +806,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
806
806
|
}),
|
|
807
807
|
tab.label,
|
|
808
808
|
tab.count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
809
|
-
className: cn$
|
|
809
|
+
className: cn$28("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)]"),
|
|
810
810
|
children: tab.count
|
|
811
811
|
})
|
|
812
812
|
]
|
|
@@ -818,7 +818,7 @@ function Tabs({ tabs, activeTab, onChange, variant = "underline", className }) {
|
|
|
818
818
|
|
|
819
819
|
//#endregion
|
|
820
820
|
//#region src/components/DateRangePicker/index.tsx
|
|
821
|
-
const cn$
|
|
821
|
+
const cn$27 = (...classes) => classes.filter(Boolean).join(" ");
|
|
822
822
|
const locales = {
|
|
823
823
|
pt: {
|
|
824
824
|
months: [
|
|
@@ -925,7 +925,7 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
925
925
|
};
|
|
926
926
|
const days = getDaysInMonth(currentMonth);
|
|
927
927
|
return /* @__PURE__ */ jsxs("div", {
|
|
928
|
-
className: cn$
|
|
928
|
+
className: cn$27("w-64 bg-[var(--dashboard-surface,#ffffff)] rounded-lg p-4 shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20", className),
|
|
929
929
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
930
930
|
className: "flex items-center justify-between mb-4",
|
|
931
931
|
children: [
|
|
@@ -963,9 +963,9 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
963
963
|
const isSelected = isStart || isEnd;
|
|
964
964
|
return /* @__PURE__ */ jsxs("div", {
|
|
965
965
|
className: "relative h-8 w-8",
|
|
966
|
-
children: [value.start && value.end && (inRange || isStart || isEnd) && /* @__PURE__ */ jsx("div", { className: cn$
|
|
966
|
+
children: [value.start && value.end && (inRange || isStart || isEnd) && /* @__PURE__ */ jsx("div", { className: cn$27("absolute inset-0 bg-[var(--dashboard-text-secondary,#6b7280)]/10", isStart && "rounded-l-full", isEnd && "rounded-r-full") }), /* @__PURE__ */ jsx("button", {
|
|
967
967
|
onClick: () => handleDayClick(day),
|
|
968
|
-
className: cn$
|
|
968
|
+
className: cn$27("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"),
|
|
969
969
|
children: day
|
|
970
970
|
})]
|
|
971
971
|
}, day);
|
|
@@ -976,7 +976,7 @@ function DateRangePicker({ value, onChange, locale = "pt", className }) {
|
|
|
976
976
|
|
|
977
977
|
//#endregion
|
|
978
978
|
//#region src/components/Title/index.tsx
|
|
979
|
-
const cn$
|
|
979
|
+
const cn$26 = (...classes) => classes.filter(Boolean).join(" ");
|
|
980
980
|
const defaultSizeByLevel = {
|
|
981
981
|
1: "text-2xl sm:text-3xl md:text-4xl lg:text-5xl",
|
|
982
982
|
2: "text-xl sm:text-2xl md:text-3xl lg:text-4xl",
|
|
@@ -1011,7 +1011,7 @@ function Title({ children, level = 1, size, weight = "bold", align = "left", col
|
|
|
1011
1011
|
const sizeClass = size ? customSizes[size] : defaultSizeByLevel[level];
|
|
1012
1012
|
const colorClass = color || "text-[var(--dashboard-text-primary,#2d2d2d)]";
|
|
1013
1013
|
return /* @__PURE__ */ jsx(Tag, {
|
|
1014
|
-
className: cn$
|
|
1014
|
+
className: cn$26(sizeClass, weightStyles[weight], alignStyles[align], colorClass, className),
|
|
1015
1015
|
...props,
|
|
1016
1016
|
children
|
|
1017
1017
|
});
|
|
@@ -1019,7 +1019,7 @@ function Title({ children, level = 1, size, weight = "bold", align = "left", col
|
|
|
1019
1019
|
|
|
1020
1020
|
//#endregion
|
|
1021
1021
|
//#region src/components/ToggleSwitch/index.tsx
|
|
1022
|
-
const cn$
|
|
1022
|
+
const cn$25 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1023
1023
|
const sizeConfig$1 = {
|
|
1024
1024
|
sm: {
|
|
1025
1025
|
track: "h-5 w-9",
|
|
@@ -1043,7 +1043,7 @@ const sizeConfig$1 = {
|
|
|
1043
1043
|
function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label, className }) {
|
|
1044
1044
|
const config = sizeConfig$1[size];
|
|
1045
1045
|
return /* @__PURE__ */ jsxs("div", {
|
|
1046
|
-
className: cn$
|
|
1046
|
+
className: cn$25("inline-flex items-center gap-2", className),
|
|
1047
1047
|
children: [/* @__PURE__ */ jsx("button", {
|
|
1048
1048
|
type: "button",
|
|
1049
1049
|
role: "switch",
|
|
@@ -1051,10 +1051,10 @@ function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label,
|
|
|
1051
1051
|
"aria-label": label,
|
|
1052
1052
|
disabled,
|
|
1053
1053
|
onClick: () => onChange(!enabled),
|
|
1054
|
-
className: cn$
|
|
1055
|
-
children: /* @__PURE__ */ jsx("span", { className: cn$
|
|
1054
|
+
className: cn$25("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"),
|
|
1055
|
+
children: /* @__PURE__ */ jsx("span", { className: cn$25("inline-block transform rounded-full bg-white shadow-sm transition-transform", config.thumb, enabled ? config.translateOn : config.translateOff) })
|
|
1056
1056
|
}), label && /* @__PURE__ */ jsx("span", {
|
|
1057
|
-
className: cn$
|
|
1057
|
+
className: cn$25("text-sm text-[var(--dashboard-text-primary,#2d2d2d)]", disabled && "opacity-50"),
|
|
1058
1058
|
children: label
|
|
1059
1059
|
})]
|
|
1060
1060
|
});
|
|
@@ -1062,7 +1062,7 @@ function ToggleSwitch({ enabled, onChange, disabled = false, size = "md", label,
|
|
|
1062
1062
|
|
|
1063
1063
|
//#endregion
|
|
1064
1064
|
//#region src/components/BadgeStatus/index.tsx
|
|
1065
|
-
const cn$
|
|
1065
|
+
const cn$24 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1066
1066
|
const variantStyles = {
|
|
1067
1067
|
success: {
|
|
1068
1068
|
color: "text-[var(--dashboard-status-success,#10B981)]",
|
|
@@ -1093,7 +1093,7 @@ function BadgeStatus({ label, variant = "neutral", color, bgColor, size = "md",
|
|
|
1093
1093
|
const styles = variantStyles[variant];
|
|
1094
1094
|
const useCustomColors = color || bgColor;
|
|
1095
1095
|
return /* @__PURE__ */ jsx("span", {
|
|
1096
|
-
className: cn$
|
|
1096
|
+
className: cn$24("inline-flex items-center rounded-full font-medium whitespace-nowrap", sizeClasses$1[size], !useCustomColors && styles.color, !useCustomColors && styles.bgColor, className),
|
|
1097
1097
|
style: useCustomColors ? {
|
|
1098
1098
|
color: color || void 0,
|
|
1099
1099
|
backgroundColor: bgColor || void 0
|
|
@@ -1104,7 +1104,7 @@ function BadgeStatus({ label, variant = "neutral", color, bgColor, size = "md",
|
|
|
1104
1104
|
|
|
1105
1105
|
//#endregion
|
|
1106
1106
|
//#region src/components/Sidebar/index.tsx
|
|
1107
|
-
const cn$
|
|
1107
|
+
const cn$23 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1108
1108
|
function DefaultLink({ href, className, children }) {
|
|
1109
1109
|
return /* @__PURE__ */ jsx("a", {
|
|
1110
1110
|
href,
|
|
@@ -1180,7 +1180,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1180
1180
|
const isChildActive = item.children?.some((c) => currentPath === c.href);
|
|
1181
1181
|
if (hasChildren) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
|
|
1182
1182
|
onClick: () => toggleExpand(item.id),
|
|
1183
|
-
className: cn$
|
|
1183
|
+
className: cn$23("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,#5DD611)]" : "text-[var(--dashboard-sidebar-text,#FFFFFF)] hover:bg-[var(--dashboard-primary,#37a501)]/10"),
|
|
1184
1184
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1185
1185
|
title: collapsed && !mobile ? item.label : void 0,
|
|
1186
1186
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1195,7 +1195,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1195
1195
|
children: item.label
|
|
1196
1196
|
}), /* @__PURE__ */ jsx(ChevronRight, {
|
|
1197
1197
|
size: 14,
|
|
1198
|
-
className: cn$
|
|
1198
|
+
className: cn$23("ml-auto flex-shrink-0 transition-transform duration-200", isExpanded ? "rotate-90" : "")
|
|
1199
1199
|
})] })]
|
|
1200
1200
|
}), (!collapsed || mobile) && /* @__PURE__ */ jsx("div", {
|
|
1201
1201
|
className: "overflow-hidden transition-all duration-200 ml-7 border-l-2 border-[var(--dashboard-sidebar-border,#2A6510)]",
|
|
@@ -1207,7 +1207,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1207
1207
|
href: child.href,
|
|
1208
1208
|
className: "block",
|
|
1209
1209
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1210
|
-
className: cn$
|
|
1210
|
+
className: cn$23("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,#5DD611)] font-semibold border-l-2 border-[var(--dashboard-primary,#37a501)] -ml-[2px]" : "text-[var(--dashboard-sidebar-text,#FFFFFF)] hover:text-[var(--dashboard-sidebar-active-text,#5DD611)]"),
|
|
1211
1211
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1212
1212
|
children: [/* @__PURE__ */ jsx(ChildIcon, {
|
|
1213
1213
|
size: 15,
|
|
@@ -1224,7 +1224,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1224
1224
|
href: item.href,
|
|
1225
1225
|
className: "block",
|
|
1226
1226
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1227
|
-
className: cn$
|
|
1227
|
+
className: cn$23("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,#37a501)]/25 text-[var(--dashboard-sidebar-active-text,#5DD611)]" : "text-[var(--dashboard-sidebar-text,#FFFFFF)] hover:bg-[var(--dashboard-primary,#37a501)]/10"),
|
|
1228
1228
|
style: { transition: "background-color 200ms, color 200ms" },
|
|
1229
1229
|
title: collapsed && !mobile ? item.label : void 0,
|
|
1230
1230
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1318,7 +1318,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1318
1318
|
})
|
|
1319
1319
|
})]
|
|
1320
1320
|
}), /* @__PURE__ */ jsxs("aside", {
|
|
1321
|
-
className: cn$
|
|
1321
|
+
className: cn$23("hidden xl:flex xl:flex-col xl:fixed xl:left-0 xl:top-0 xl:h-screen bg-[var(--dashboard-sidebar-bg,#1B4D08)] border-r border-[var(--dashboard-sidebar-border,#2A6510)] overflow-visible", isCollapsed ? "xl:w-[109px]" : "xl:w-[280px]", className),
|
|
1322
1322
|
style: { transition: `width 400ms ${cubicBezier}` },
|
|
1323
1323
|
children: [onToggleCollapse && /* @__PURE__ */ jsxs("button", {
|
|
1324
1324
|
onClick: onToggleCollapse,
|
|
@@ -1387,7 +1387,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1387
1387
|
children: [
|
|
1388
1388
|
user && /* @__PURE__ */ jsxs("button", {
|
|
1389
1389
|
onClick: onUserClick,
|
|
1390
|
-
className: cn$
|
|
1390
|
+
className: cn$23("w-full flex items-center px-4 py-3 rounded-lg bg-[var(--dashboard-primary,#37a501)]/5 hover:bg-[var(--dashboard-primary,#37a501)]/10 transition-colors cursor-pointer", isCollapsed ? "justify-center" : "justify-start"),
|
|
1391
1391
|
title: isCollapsed ? `${user.subtitle ? user.subtitle + " - " : ""}${user.name}` : void 0,
|
|
1392
1392
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1393
1393
|
className: "flex items-center justify-center w-8 h-8 rounded-full bg-[var(--dashboard-primary,#37a501)]/30 text-[var(--dashboard-sidebar-text,#FFFFFF)] flex-shrink-0",
|
|
@@ -1419,7 +1419,7 @@ function Sidebar({ menuItems, logo, collapsedLogo, currentPath, linkComponent: L
|
|
|
1419
1419
|
footerItems?.map((item) => renderMenuItem(item, isCollapsed, false)),
|
|
1420
1420
|
onLogout && /* @__PURE__ */ jsxs("button", {
|
|
1421
1421
|
onClick: onLogout,
|
|
1422
|
-
className: cn$
|
|
1422
|
+
className: cn$23("w-full flex items-center px-4 py-3 rounded-lg text-sm font-medium cursor-pointer text-[var(--dashboard-sidebar-text,#FFFFFF)] hover:bg-[var(--dashboard-primary,#37a501)]/10", isCollapsed ? "justify-center" : "justify-start"),
|
|
1423
1423
|
style: { transition: "background-color 200ms" },
|
|
1424
1424
|
title: isCollapsed ? logoutLabel : void 0,
|
|
1425
1425
|
children: [/* @__PURE__ */ jsx(LogOut, {
|
|
@@ -1456,7 +1456,7 @@ function useTheme() {
|
|
|
1456
1456
|
|
|
1457
1457
|
//#endregion
|
|
1458
1458
|
//#region src/components/ThemeSwitcher/index.tsx
|
|
1459
|
-
const cn$
|
|
1459
|
+
const cn$22 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1460
1460
|
function ThemeSwitcher({ className }) {
|
|
1461
1461
|
const { resolvedTheme, setTheme } = useTheme();
|
|
1462
1462
|
const toggle = () => {
|
|
@@ -1465,7 +1465,7 @@ function ThemeSwitcher({ className }) {
|
|
|
1465
1465
|
return /* @__PURE__ */ jsxs("button", {
|
|
1466
1466
|
type: "button",
|
|
1467
1467
|
onClick: toggle,
|
|
1468
|
-
className: cn$
|
|
1468
|
+
className: cn$22("relative inline-flex items-center justify-center h-9 w-9 rounded-md border border-[var(--dashboard-text-secondary,#6b7280)]/30 bg-[var(--dashboard-surface,#ffffff)] shadow-sm transition-colors cursor-pointer hover:bg-[var(--dashboard-text-secondary,#6b7280)]/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--dashboard-primary,#37a501)] focus-visible:ring-offset-2", className),
|
|
1469
1469
|
"aria-label": "Alternar tema",
|
|
1470
1470
|
children: [
|
|
1471
1471
|
/* @__PURE__ */ jsx(Sun, { className: "h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }),
|
|
@@ -1480,7 +1480,7 @@ function ThemeSwitcher({ className }) {
|
|
|
1480
1480
|
|
|
1481
1481
|
//#endregion
|
|
1482
1482
|
//#region src/components/KPICard/index.tsx
|
|
1483
|
-
const cn$
|
|
1483
|
+
const cn$21 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1484
1484
|
function formatValue(value, format) {
|
|
1485
1485
|
switch (format) {
|
|
1486
1486
|
case "currency": return new Intl.NumberFormat("pt-BR", {
|
|
@@ -1510,7 +1510,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
1510
1510
|
if (isLoading) return /* @__PURE__ */ jsx(KPICardSkeleton, { className });
|
|
1511
1511
|
const trendConfig = trendConfigs[trend];
|
|
1512
1512
|
return /* @__PURE__ */ jsxs("div", {
|
|
1513
|
-
className: cn$
|
|
1513
|
+
className: cn$21("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),
|
|
1514
1514
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1515
1515
|
className: "flex justify-between items-start mb-4",
|
|
1516
1516
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
@@ -1527,7 +1527,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
1527
1527
|
className: "text-3xl font-bold text-[var(--dashboard-text-primary,#0F172A)] whitespace-nowrap tracking-tight",
|
|
1528
1528
|
children: formatValue(value, format)
|
|
1529
1529
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1530
|
-
className: cn$
|
|
1530
|
+
className: cn$21("inline-flex items-center gap-1 px-2 py-1 rounded-full flex-shrink-0 mb-1", trendConfig.color),
|
|
1531
1531
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1532
1532
|
className: "text-sm",
|
|
1533
1533
|
children: trendConfig.icon
|
|
@@ -1541,7 +1541,7 @@ function KPICard({ title, value, variation, trend, format = "number", benchmark,
|
|
|
1541
1541
|
}
|
|
1542
1542
|
function KPICardSkeleton({ className }) {
|
|
1543
1543
|
return /* @__PURE__ */ jsxs("div", {
|
|
1544
|
-
className: cn$
|
|
1544
|
+
className: cn$21("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),
|
|
1545
1545
|
children: [/* @__PURE__ */ jsx("div", { className: "h-3 bg-[var(--dashboard-text-secondary,#64748B)]/10 rounded w-2/3 mb-4" }), /* @__PURE__ */ jsxs("div", {
|
|
1546
1546
|
className: "flex items-end gap-3 flex-1",
|
|
1547
1547
|
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" })]
|
|
@@ -1551,13 +1551,13 @@ function KPICardSkeleton({ className }) {
|
|
|
1551
1551
|
|
|
1552
1552
|
//#endregion
|
|
1553
1553
|
//#region src/components/PageLayout/index.tsx
|
|
1554
|
-
const cn$
|
|
1554
|
+
const cn$20 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1555
1555
|
function PageLayout({ title, description, headerActions, children, contentPadding = true, sidebar, sidebarCollapsed = false, sidebarWidth = 280, sidebarCollapsedWidth = 109, className }) {
|
|
1556
1556
|
const marginLeft = sidebar ? sidebarCollapsed ? `max(0px, ${sidebarCollapsedWidth}px)` : `max(0px, ${sidebarWidth}px)` : "0px";
|
|
1557
1557
|
return /* @__PURE__ */ jsxs("div", {
|
|
1558
|
-
className: cn$
|
|
1558
|
+
className: cn$20("min-h-screen bg-[var(--dashboard-background,#f2f2f2)]", className),
|
|
1559
1559
|
children: [sidebar, /* @__PURE__ */ jsxs("main", {
|
|
1560
|
-
className: cn$
|
|
1560
|
+
className: cn$20("pt-16 xl:pt-0", !sidebar && "pt-0"),
|
|
1561
1561
|
style: {
|
|
1562
1562
|
marginLeft,
|
|
1563
1563
|
transition: "margin-left 400ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
@@ -1595,7 +1595,7 @@ function PageLayout({ title, description, headerActions, children, contentPaddin
|
|
|
1595
1595
|
//#endregion
|
|
1596
1596
|
//#region src/components/ComparisonLineChart/index.tsx
|
|
1597
1597
|
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Title$1, Tooltip$1, Legend, Filler);
|
|
1598
|
-
const cn$
|
|
1598
|
+
const cn$19 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1599
1599
|
function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, currentPeriodLabel = "Período atual", previousPeriodLabel = "Período anterior", title, color, height = 300, className }) {
|
|
1600
1600
|
const primaryColor = color || (typeof document !== "undefined" ? getComputedStyle(document.documentElement).getPropertyValue("--dashboard-primary").trim() : "") || "#37a501";
|
|
1601
1601
|
const data = {
|
|
@@ -1689,7 +1689,7 @@ function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, cu
|
|
|
1689
1689
|
}
|
|
1690
1690
|
};
|
|
1691
1691
|
return /* @__PURE__ */ jsxs("div", {
|
|
1692
|
-
className: cn$
|
|
1692
|
+
className: cn$19("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6", className),
|
|
1693
1693
|
children: [title && /* @__PURE__ */ jsx("h3", {
|
|
1694
1694
|
className: "text-base font-semibold mb-4 text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
1695
1695
|
children: title
|
|
@@ -1706,7 +1706,7 @@ function ComparisonLineChart({ labels, currentPeriodData, previousPeriodData, cu
|
|
|
1706
1706
|
//#endregion
|
|
1707
1707
|
//#region src/components/HorizontalBarChart/index.tsx
|
|
1708
1708
|
Chart.register(CategoryScale, LinearScale, BarElement, Title$1, Tooltip$1, Legend);
|
|
1709
|
-
const cn$
|
|
1709
|
+
const cn$18 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1710
1710
|
function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, valueLabel = "itens", valueLabelSingular, bestItemLabel = "Melhor item", className }) {
|
|
1711
1711
|
const [activeTab, setActiveTab] = useState((tabs ? tabs.map((t) => t.id) : Object.keys(datasets))[0]);
|
|
1712
1712
|
const [isMobile, setIsMobile] = useState(false);
|
|
@@ -1781,7 +1781,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
1781
1781
|
}
|
|
1782
1782
|
};
|
|
1783
1783
|
return /* @__PURE__ */ jsxs("div", {
|
|
1784
|
-
className: cn$
|
|
1784
|
+
className: cn$18("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),
|
|
1785
1785
|
children: [
|
|
1786
1786
|
title && /* @__PURE__ */ jsxs("div", {
|
|
1787
1787
|
className: "flex items-center gap-2 mb-4",
|
|
@@ -1794,7 +1794,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
1794
1794
|
className: "flex gap-2 mb-4 flex-wrap",
|
|
1795
1795
|
children: tabs.map((tab) => /* @__PURE__ */ jsx("button", {
|
|
1796
1796
|
onClick: () => setActiveTab(tab.id),
|
|
1797
|
-
className: cn$
|
|
1797
|
+
className: cn$18("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"),
|
|
1798
1798
|
children: tab.label
|
|
1799
1799
|
}, tab.id))
|
|
1800
1800
|
}),
|
|
@@ -1833,7 +1833,7 @@ function HorizontalBarChart({ labels, datasets, tabs, title, titleIcon, color, v
|
|
|
1833
1833
|
//#endregion
|
|
1834
1834
|
//#region src/components/VerticalBarChart/index.tsx
|
|
1835
1835
|
Chart.register(CategoryScale, LinearScale, BarElement, Title$1, Tooltip$1, Legend);
|
|
1836
|
-
const cn$
|
|
1836
|
+
const cn$17 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1837
1837
|
function VerticalBarChart({ labels, data: values, title, titleIcon, color, valueLabel = "itens", valueLabelSingular, bestItemLabel = "Melhor item", labelMaxChars = 3, className }) {
|
|
1838
1838
|
const maxValue = Math.max(...values);
|
|
1839
1839
|
const bestLabel = labels[values.indexOf(maxValue)];
|
|
@@ -1896,7 +1896,7 @@ function VerticalBarChart({ labels, data: values, title, titleIcon, color, value
|
|
|
1896
1896
|
}
|
|
1897
1897
|
};
|
|
1898
1898
|
return /* @__PURE__ */ jsxs("div", {
|
|
1899
|
-
className: cn$
|
|
1899
|
+
className: cn$17("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),
|
|
1900
1900
|
children: [
|
|
1901
1901
|
title && /* @__PURE__ */ jsxs("div", {
|
|
1902
1902
|
className: "flex items-center gap-2 mb-4",
|
|
@@ -1937,6 +1937,120 @@ function VerticalBarChart({ labels, data: values, title, titleIcon, color, value
|
|
|
1937
1937
|
});
|
|
1938
1938
|
}
|
|
1939
1939
|
|
|
1940
|
+
//#endregion
|
|
1941
|
+
//#region src/components/DoughnutChart/index.tsx
|
|
1942
|
+
Chart.register(ArcElement, Tooltip$1, Legend);
|
|
1943
|
+
const DEFAULT_COLORS = [
|
|
1944
|
+
"#2563EB",
|
|
1945
|
+
"#059669",
|
|
1946
|
+
"#D97706",
|
|
1947
|
+
"#DC2626",
|
|
1948
|
+
"#7C3AED",
|
|
1949
|
+
"#0891B2",
|
|
1950
|
+
"#DB2777",
|
|
1951
|
+
"#65A30D",
|
|
1952
|
+
"#EA580C",
|
|
1953
|
+
"#4F46E5"
|
|
1954
|
+
];
|
|
1955
|
+
const cn$16 = (...classes) => classes.filter(Boolean).join(" ");
|
|
1956
|
+
function DoughnutChart({ items, title, titleIcon, centerLabel, centerValue, showLegend = true, formatValue, cutout = 65, height = 240, className }) {
|
|
1957
|
+
const total = items.reduce((sum, item) => sum + item.value, 0);
|
|
1958
|
+
const format = formatValue || ((v) => String(v));
|
|
1959
|
+
const colors = items.map((item, i) => item.color || DEFAULT_COLORS[i % DEFAULT_COLORS.length]);
|
|
1960
|
+
const chartData = {
|
|
1961
|
+
labels: items.map((i) => i.label),
|
|
1962
|
+
datasets: [{
|
|
1963
|
+
data: items.map((i) => i.value),
|
|
1964
|
+
backgroundColor: colors,
|
|
1965
|
+
borderColor: "var(--dashboard-surface, #ffffff)",
|
|
1966
|
+
borderWidth: 2,
|
|
1967
|
+
hoverOffset: 4
|
|
1968
|
+
}]
|
|
1969
|
+
};
|
|
1970
|
+
const options = {
|
|
1971
|
+
responsive: true,
|
|
1972
|
+
maintainAspectRatio: false,
|
|
1973
|
+
cutout: `${cutout}%`,
|
|
1974
|
+
plugins: {
|
|
1975
|
+
legend: { display: false },
|
|
1976
|
+
tooltip: {
|
|
1977
|
+
backgroundColor: "rgba(45, 45, 45, 0.95)",
|
|
1978
|
+
titleColor: "#fff",
|
|
1979
|
+
bodyColor: "#fff",
|
|
1980
|
+
padding: 12,
|
|
1981
|
+
displayColors: true,
|
|
1982
|
+
titleFont: {
|
|
1983
|
+
size: 12,
|
|
1984
|
+
weight: "bold"
|
|
1985
|
+
},
|
|
1986
|
+
bodyFont: { size: 11 },
|
|
1987
|
+
callbacks: { label: (context) => {
|
|
1988
|
+
const pct = total > 0 ? (context.parsed / total * 100).toFixed(1) : "0";
|
|
1989
|
+
return ` ${context.label}: ${format(context.parsed)} (${pct}%)`;
|
|
1990
|
+
} }
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1995
|
+
className: cn$16("bg-[var(--dashboard-surface,#ffffff)] rounded-lg shadow-sm border border-[var(--dashboard-text-secondary,#6b7280)]/20 p-6", className),
|
|
1996
|
+
children: [title && /* @__PURE__ */ jsxs("div", {
|
|
1997
|
+
className: "flex items-center gap-2 mb-4",
|
|
1998
|
+
children: [titleIcon, /* @__PURE__ */ jsx("h3", {
|
|
1999
|
+
className: "text-base font-semibold text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
2000
|
+
children: title
|
|
2001
|
+
})]
|
|
2002
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2003
|
+
className: cn$16("flex items-center", showLegend ? "gap-6" : "justify-center"),
|
|
2004
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2005
|
+
className: "relative flex-shrink-0",
|
|
2006
|
+
style: {
|
|
2007
|
+
width: height,
|
|
2008
|
+
height
|
|
2009
|
+
},
|
|
2010
|
+
children: [/* @__PURE__ */ jsx(Doughnut, {
|
|
2011
|
+
data: chartData,
|
|
2012
|
+
options
|
|
2013
|
+
}), (centerLabel || centerValue) && /* @__PURE__ */ jsxs("div", {
|
|
2014
|
+
className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none",
|
|
2015
|
+
children: [centerValue && /* @__PURE__ */ jsx("span", {
|
|
2016
|
+
className: "text-2xl font-bold text-[var(--dashboard-text-primary,#2d2d2d)]",
|
|
2017
|
+
children: centerValue
|
|
2018
|
+
}), centerLabel && /* @__PURE__ */ jsx("span", {
|
|
2019
|
+
className: "text-xs text-[var(--dashboard-text-secondary,#6b7280)]",
|
|
2020
|
+
children: centerLabel
|
|
2021
|
+
})]
|
|
2022
|
+
})]
|
|
2023
|
+
}), showLegend && items.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
2024
|
+
className: "flex-1 min-w-0 space-y-2",
|
|
2025
|
+
children: items.map((item, i) => {
|
|
2026
|
+
const pct = total > 0 ? (item.value / total * 100).toFixed(1) : "0";
|
|
2027
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2028
|
+
className: "flex items-center gap-2",
|
|
2029
|
+
children: [
|
|
2030
|
+
/* @__PURE__ */ jsx("span", {
|
|
2031
|
+
className: "w-3 h-3 rounded-full flex-shrink-0",
|
|
2032
|
+
style: { backgroundColor: colors[i] }
|
|
2033
|
+
}),
|
|
2034
|
+
/* @__PURE__ */ jsx("span", {
|
|
2035
|
+
className: "text-sm text-[var(--dashboard-text-secondary,#6b7280)] truncate flex-1",
|
|
2036
|
+
children: item.label
|
|
2037
|
+
}),
|
|
2038
|
+
/* @__PURE__ */ jsx("span", {
|
|
2039
|
+
className: "text-sm font-medium text-[var(--dashboard-text-primary,#2d2d2d)] whitespace-nowrap",
|
|
2040
|
+
children: format(item.value)
|
|
2041
|
+
}),
|
|
2042
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2043
|
+
className: "text-xs text-[var(--dashboard-text-secondary,#6b7280)] whitespace-nowrap",
|
|
2044
|
+
children: [pct, "%"]
|
|
2045
|
+
})
|
|
2046
|
+
]
|
|
2047
|
+
}, item.label);
|
|
2048
|
+
})
|
|
2049
|
+
})]
|
|
2050
|
+
})]
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
|
|
1940
2054
|
//#endregion
|
|
1941
2055
|
//#region src/components/ProgressBarList/index.tsx
|
|
1942
2056
|
const cn$15 = (...classes) => classes.filter(Boolean).join(" ");
|
|
@@ -4323,5 +4437,5 @@ function DashboardProvider({ config: configOverrides, children }) {
|
|
|
4323
4437
|
}
|
|
4324
4438
|
|
|
4325
4439
|
//#endregion
|
|
4326
|
-
export { Alert, AuthLayout, BadgeStatus, Breadcrumb, Button, Card, Checkbox, CodeInput, Combobox, ComparisonLineChart, DashboardProvider, DataGrid, DateRangePicker, Dropdown, EmptyState, FileUpload, FilterBar, FormField, HorizontalBarChart, 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, createColumnHelper, createConfig, defaultConfig, useConfig, useLoading, useNotifications, useTheme };
|
|
4440
|
+
export { Alert, AuthLayout, BadgeStatus, Breadcrumb, Button, Card, Checkbox, CodeInput, Combobox, ComparisonLineChart, DashboardProvider, DataGrid, DateRangePicker, DoughnutChart, Dropdown, EmptyState, FileUpload, FilterBar, FormField, HorizontalBarChart, 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, createColumnHelper, createConfig, defaultConfig, useConfig, useLoading, useNotifications, useTheme };
|
|
4327
4441
|
//# sourceMappingURL=index.mjs.map
|