@kala-ui/react-app 0.1.0-beta.0
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/components/app-shell/app-shell.d.ts +54 -0
- package/dist/components/app-shell/app-shell.js +91 -0
- package/dist/components/app-shell/index.d.ts +1 -0
- package/dist/components/app-shell/index.js +2 -0
- package/dist/components/charts/area-chart.d.ts +6 -0
- package/dist/components/charts/area-chart.js +172 -0
- package/dist/components/charts/bar-chart.d.ts +6 -0
- package/dist/components/charts/bar-chart.js +153 -0
- package/dist/components/charts/chart-skeleton.d.ts +36 -0
- package/dist/components/charts/chart-skeleton.js +13 -0
- package/dist/components/charts/chart.d.ts +25 -0
- package/dist/components/charts/chart.js +48 -0
- package/dist/components/charts/chart.types.d.ts +196 -0
- package/dist/components/charts/chart.types.js +6 -0
- package/dist/components/charts/donut-chart.d.ts +7 -0
- package/dist/components/charts/donut-chart.js +146 -0
- package/dist/components/charts/index.d.ts +14 -0
- package/dist/components/charts/index.js +15 -0
- package/dist/components/charts/line-chart.d.ts +6 -0
- package/dist/components/charts/line-chart.js +158 -0
- package/dist/components/charts/radial-bar-chart.d.ts +6 -0
- package/dist/components/charts/radial-bar-chart.js +115 -0
- package/dist/components/charts/theme-utils.d.ts +77 -0
- package/dist/components/charts/theme-utils.js +243 -0
- package/dist/components/charts/use-theme-aware-chart.d.ts +12 -0
- package/dist/components/charts/use-theme-aware-chart.js +68 -0
- package/dist/components/charts/utils.d.ts +56 -0
- package/dist/components/charts/utils.js +135 -0
- package/dist/components/data-table/column-filters.d.ts +14 -0
- package/dist/components/data-table/column-filters.js +51 -0
- package/dist/components/data-table/column-header-filter.d.ts +14 -0
- package/dist/components/data-table/column-header-filter.js +75 -0
- package/dist/components/data-table/data-table-body-rows.d.ts +23 -0
- package/dist/components/data-table/data-table-body-rows.js +43 -0
- package/dist/components/data-table/data-table-filter-chips.d.ts +14 -0
- package/dist/components/data-table/data-table-filter-chips.js +42 -0
- package/dist/components/data-table/data-table-header-row.d.ts +21 -0
- package/dist/components/data-table/data-table-header-row.js +35 -0
- package/dist/components/data-table/data-table-skeleton.d.ts +49 -0
- package/dist/components/data-table/data-table-skeleton.js +32 -0
- package/dist/components/data-table/data-table-toolbar.d.ts +18 -0
- package/dist/components/data-table/data-table-toolbar.js +25 -0
- package/dist/components/data-table/data-table.d.ts +23 -0
- package/dist/components/data-table/data-table.js +250 -0
- package/dist/components/data-table/data-table.types.d.ts +305 -0
- package/dist/components/data-table/data-table.types.js +6 -0
- package/dist/components/data-table/index.d.ts +6 -0
- package/dist/components/data-table/index.js +6 -0
- package/dist/components/data-table/pagination-nav.d.ts +15 -0
- package/dist/components/data-table/pagination-nav.js +23 -0
- package/dist/components/data-table/useTableState.d.ts +29 -0
- package/dist/components/data-table/useTableState.js +312 -0
- package/dist/components/dnd/dnd.d.ts +118 -0
- package/dist/components/dnd/dnd.js +128 -0
- package/dist/components/dnd/index.d.ts +1 -0
- package/dist/components/dnd/index.js +2 -0
- package/dist/components/footer/footer.d.ts +37 -0
- package/dist/components/footer/footer.js +8 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/footer/index.js +2 -0
- package/dist/components/header/header-skeleton.d.ts +54 -0
- package/dist/components/header/header-skeleton.js +23 -0
- package/dist/components/header/header.d.ts +40 -0
- package/dist/components/header/header.js +77 -0
- package/dist/components/header/header.types.d.ts +39 -0
- package/dist/components/header/header.types.js +2 -0
- package/dist/components/header/index.d.ts +4 -0
- package/dist/components/header/index.js +3 -0
- package/dist/components/metric-card/index.d.ts +2 -0
- package/dist/components/metric-card/index.js +3 -0
- package/dist/components/metric-card/metric-card-skeleton.d.ts +32 -0
- package/dist/components/metric-card/metric-card-skeleton.js +29 -0
- package/dist/components/metric-card/metric-card.d.ts +16 -0
- package/dist/components/metric-card/metric-card.js +55 -0
- package/dist/components/metric-card/metric-card.types.d.ts +14 -0
- package/dist/components/metric-card/metric-card.types.js +2 -0
- package/dist/components/nav-link/index.d.ts +1 -0
- package/dist/components/nav-link/index.js +2 -0
- package/dist/components/nav-link/nav-link.d.ts +26 -0
- package/dist/components/nav-link/nav-link.js +23 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/components/navigation/index.js +3 -0
- package/dist/components/navigation/navigation-skeleton.d.ts +54 -0
- package/dist/components/navigation/navigation-skeleton.js +23 -0
- package/dist/components/navigation/navigation.d.ts +26 -0
- package/dist/components/navigation/navigation.js +44 -0
- package/dist/components/session-card/index.d.ts +2 -0
- package/dist/components/session-card/index.js +3 -0
- package/dist/components/session-card/session-card-skeleton.d.ts +31 -0
- package/dist/components/session-card/session-card-skeleton.js +28 -0
- package/dist/components/session-card/session-card.d.ts +27 -0
- package/dist/components/session-card/session-card.js +67 -0
- package/dist/components/sidebar/index.d.ts +3 -0
- package/dist/components/sidebar/index.js +3 -0
- package/dist/components/sidebar/sidebar-skeleton.d.ts +54 -0
- package/dist/components/sidebar/sidebar-skeleton.js +23 -0
- package/dist/components/sidebar/sidebar.d.ts +46 -0
- package/dist/components/sidebar/sidebar.js +69 -0
- package/dist/components/social-login-button/index.d.ts +1 -0
- package/dist/components/social-login-button/index.js +2 -0
- package/dist/components/social-login-button/social-login-button.d.ts +20 -0
- package/dist/components/social-login-button/social-login-button.js +57 -0
- package/dist/components/social-login-buttons/index.d.ts +1 -0
- package/dist/components/social-login-buttons/index.js +2 -0
- package/dist/components/social-login-buttons/social-login-buttons.d.ts +34 -0
- package/dist/components/social-login-buttons/social-login-buttons.js +18 -0
- package/dist/components/sparkline-chart/index.d.ts +2 -0
- package/dist/components/sparkline-chart/index.js +2 -0
- package/dist/components/sparkline-chart/sparkline-chart.d.ts +51 -0
- package/dist/components/sparkline-chart/sparkline-chart.js +134 -0
- package/dist/components/user-menu-dropdown/index.d.ts +1 -0
- package/dist/components/user-menu-dropdown/index.js +2 -0
- package/dist/components/user-menu-dropdown/user-menu-dropdown.d.ts +31 -0
- package/dist/components/user-menu-dropdown/user-menu-dropdown.js +27 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +19 -0
- package/dist/lib/active-path.d.ts +5 -0
- package/dist/lib/active-path.js +12 -0
- package/dist/styles/app.css +2125 -0
- package/package.json +164 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* SparklineChart Component
|
|
4
|
+
* Small inline chart for use in cards and dashboards
|
|
5
|
+
* Optimized for compact display with minimal visual noise
|
|
6
|
+
*/
|
|
7
|
+
"use client";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { cn } from "@kala-ui/react/lib/utils";
|
|
10
|
+
import { useThemeAwareChart } from "../charts/index.js";
|
|
11
|
+
import { Chart } from "../charts/chart.js";
|
|
12
|
+
export function SparklineChart({ data, type = "line", color, width = "100%", height = 64, tooltip = false, className, gradientFrom, gradientTo, animated = true, interactive = false, }) {
|
|
13
|
+
const { colors: themeColors, theme } = useThemeAwareChart();
|
|
14
|
+
const chartColor = color || themeColors.primary[0];
|
|
15
|
+
const options = {
|
|
16
|
+
chart: {
|
|
17
|
+
type,
|
|
18
|
+
sparkline: {
|
|
19
|
+
enabled: true,
|
|
20
|
+
},
|
|
21
|
+
animations: {
|
|
22
|
+
enabled: animated,
|
|
23
|
+
speed: 400,
|
|
24
|
+
},
|
|
25
|
+
toolbar: {
|
|
26
|
+
show: false,
|
|
27
|
+
},
|
|
28
|
+
zoom: {
|
|
29
|
+
enabled: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
colors: [chartColor],
|
|
33
|
+
states: {
|
|
34
|
+
hover: {
|
|
35
|
+
filter: {
|
|
36
|
+
type: interactive ? "lighten" : "none",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
active: {
|
|
40
|
+
filter: {
|
|
41
|
+
type: "none",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
stroke: {
|
|
46
|
+
curve: "smooth",
|
|
47
|
+
width: type === "line" ? 2 : 0,
|
|
48
|
+
},
|
|
49
|
+
fill: {
|
|
50
|
+
type: type === "area" ? "gradient" : "solid",
|
|
51
|
+
...(type === "area" && {
|
|
52
|
+
gradient: {
|
|
53
|
+
shadeIntensity: 1,
|
|
54
|
+
opacityFrom: 0.7,
|
|
55
|
+
opacityTo: 0.1,
|
|
56
|
+
stops: [0, 100],
|
|
57
|
+
...(gradientFrom &&
|
|
58
|
+
gradientTo && {
|
|
59
|
+
colorStops: [
|
|
60
|
+
{
|
|
61
|
+
offset: 0,
|
|
62
|
+
color: gradientFrom,
|
|
63
|
+
opacity: 0.7,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
offset: 100,
|
|
67
|
+
color: gradientTo,
|
|
68
|
+
opacity: 0.1,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
tooltip: {
|
|
76
|
+
enabled: tooltip,
|
|
77
|
+
theme: theme === "dark" || theme === "accent" ? "dark" : "light",
|
|
78
|
+
x: {
|
|
79
|
+
show: false,
|
|
80
|
+
},
|
|
81
|
+
y: {
|
|
82
|
+
title: {
|
|
83
|
+
formatter: () => "",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
marker: {
|
|
87
|
+
show: false,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
markers: {
|
|
91
|
+
size: 0,
|
|
92
|
+
hover: {
|
|
93
|
+
size: interactive ? 4 : 0,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
grid: {
|
|
97
|
+
show: false,
|
|
98
|
+
},
|
|
99
|
+
xaxis: {
|
|
100
|
+
labels: {
|
|
101
|
+
show: false,
|
|
102
|
+
},
|
|
103
|
+
axisBorder: {
|
|
104
|
+
show: false,
|
|
105
|
+
},
|
|
106
|
+
axisTicks: {
|
|
107
|
+
show: false,
|
|
108
|
+
},
|
|
109
|
+
tooltip: {
|
|
110
|
+
enabled: false,
|
|
111
|
+
},
|
|
112
|
+
crosshairs: {
|
|
113
|
+
show: interactive,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
yaxis: {
|
|
117
|
+
labels: {
|
|
118
|
+
show: false,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
plotOptions: {
|
|
122
|
+
bar: {
|
|
123
|
+
columnWidth: "80%",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
const series = [
|
|
128
|
+
{
|
|
129
|
+
name: "Value",
|
|
130
|
+
data: data,
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
return (_jsx("div", { className: cn("sparkline-chart", className), children: _jsx(Chart, { options: options, series: series, type: type, height: height, width: width }) }));
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserMenuDropdown, type UserMenuDropdownProps, } from "./user-menu-dropdown";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface UserMenuDropdownProps extends Omit<React.ComponentProps<"button">, "color"> {
|
|
2
|
+
/**
|
|
3
|
+
* User information to display
|
|
4
|
+
*/
|
|
5
|
+
user: {
|
|
6
|
+
name?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Whether the dropdown is currently open
|
|
12
|
+
*/
|
|
13
|
+
isOpen?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback when dropdown open state changes
|
|
16
|
+
*/
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when logout is clicked
|
|
20
|
+
*/
|
|
21
|
+
onLogout?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Base URL for navigation links (default: '/admin')
|
|
24
|
+
*/
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Additional CSS classes for the trigger button
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function UserMenuDropdown({ user, isOpen, onOpenChange, onLogout, baseUrl, className, ref, ...props }: UserMenuDropdownProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@kala-ui/react/avatar";
|
|
4
|
+
import { Button } from "@kala-ui/react/button";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@kala-ui/react/dropdown-menu";
|
|
6
|
+
import { cn } from "@kala-ui/react/lib/utils";
|
|
7
|
+
import { LogOut, Settings, User } from "lucide-react";
|
|
8
|
+
export function UserMenuDropdown({ user, isOpen, onOpenChange, onLogout, baseUrl = "/admin", className, ref, ...props }) {
|
|
9
|
+
const initials = user.name
|
|
10
|
+
? user.name
|
|
11
|
+
.split(" ")
|
|
12
|
+
.map((n) => n[0])
|
|
13
|
+
.join("")
|
|
14
|
+
.toUpperCase()
|
|
15
|
+
.slice(0, 2)
|
|
16
|
+
: (user.email?.[0]?.toUpperCase() ?? "?");
|
|
17
|
+
const handleProfileClick = () => {
|
|
18
|
+
window.location.href = `${baseUrl}/profile`;
|
|
19
|
+
};
|
|
20
|
+
const handleSettingsClick = () => {
|
|
21
|
+
window.location.href = `${baseUrl}/profile/security`;
|
|
22
|
+
};
|
|
23
|
+
const handleLogoutClick = () => {
|
|
24
|
+
onLogout?.();
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs(DropdownMenu, { ...(isOpen !== undefined && { open: isOpen }), ...(onOpenChange && { onOpenChange }), children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", ref: ref, className: cn("h-auto p-1 rounded-full hover:bg-accent", className), "aria-label": "User menu", ...props, children: _jsxs(Avatar, { className: "size-8", children: [user.avatar && (_jsx(AvatarImage, { src: user.avatar, alt: user.name ?? "User" })), _jsx(AvatarFallback, { className: "bg-primary text-primary-foreground text-sm font-medium", children: initials })] }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsx(DropdownMenuLabel, { children: _jsxs("div", { className: "flex flex-col space-y-1", children: [user.name && (_jsx("p", { className: "text-sm font-medium leading-none", children: user.name })), user.email && (_jsx("p", { className: "text-xs text-muted-foreground leading-none", children: user.email }))] }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: handleProfileClick, children: [_jsx(User, { className: "mr-2 size-4" }), "Profile"] }), _jsxs(DropdownMenuItem, { onClick: handleSettingsClick, children: [_jsx(Settings, { className: "mr-2 size-4" }), "Settings"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: handleLogoutClick, color: "destructive", children: [_jsx(LogOut, { className: "mr-2 size-4" }), "Logout"] })] })] }));
|
|
27
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./components/app-shell";
|
|
2
|
+
export * from "./components/charts";
|
|
3
|
+
export * from "./components/data-table";
|
|
4
|
+
export * from "./components/dnd";
|
|
5
|
+
export * from "./components/footer";
|
|
6
|
+
export * from "./components/header";
|
|
7
|
+
export * from "./components/metric-card";
|
|
8
|
+
export * from "./components/nav-link";
|
|
9
|
+
export * from "./components/navigation";
|
|
10
|
+
export * from "./components/session-card";
|
|
11
|
+
export * from "./components/sidebar";
|
|
12
|
+
export * from "./components/social-login-button";
|
|
13
|
+
export * from "./components/social-login-buttons";
|
|
14
|
+
export * from "./components/sparkline-chart";
|
|
15
|
+
export * from "./components/user-menu-dropdown";
|
|
16
|
+
export { isActivePath } from "./lib/active-path";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// Main entry point for @kala-ui/react-app
|
|
3
|
+
// App-level composite components built on @kala-ui/react primitives.
|
|
4
|
+
export * from "./components/app-shell/index.js";
|
|
5
|
+
export * from "./components/charts/index.js";
|
|
6
|
+
export * from "./components/data-table/index.js";
|
|
7
|
+
export * from "./components/dnd/index.js";
|
|
8
|
+
export * from "./components/footer/index.js";
|
|
9
|
+
export * from "./components/header/index.js";
|
|
10
|
+
export * from "./components/metric-card/index.js";
|
|
11
|
+
export * from "./components/nav-link/index.js";
|
|
12
|
+
export * from "./components/navigation/index.js";
|
|
13
|
+
export * from "./components/session-card/index.js";
|
|
14
|
+
export * from "./components/sidebar/index.js";
|
|
15
|
+
export * from "./components/social-login-button/index.js";
|
|
16
|
+
export * from "./components/social-login-buttons/index.js";
|
|
17
|
+
export * from "./components/sparkline-chart/index.js";
|
|
18
|
+
export * from "./components/user-menu-dropdown/index.js";
|
|
19
|
+
export { isActivePath } from "./lib/active-path.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Active-link check without false positives: "/admin" must not match
|
|
3
|
+
* pathname "/admin-panel", while "/users" still matches "/users/123".
|
|
4
|
+
*/
|
|
5
|
+
export function isActivePath(pathname, href) {
|
|
6
|
+
const path = pathname.replace(/\/+$/, "") || "/";
|
|
7
|
+
const target = href.replace(/\/+$/, "");
|
|
8
|
+
if (target === "/" || target === "") {
|
|
9
|
+
return path === "/";
|
|
10
|
+
}
|
|
11
|
+
return path === target || path.startsWith(`${target}/`);
|
|
12
|
+
}
|