@gaulatti/bleecker 0.1.29 → 0.1.31
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/components/area-chart.d.ts +13 -0
- package/dist/components/area-chart.js +9 -0
- package/dist/components/bar-chart.d.ts +13 -0
- package/dist/components/bar-chart.js +6 -0
- package/dist/components/button.d.ts +3 -1
- package/dist/components/button.js +6 -2
- package/dist/components/chart-theme.d.ts +46 -0
- package/dist/components/chart-theme.js +56 -0
- package/dist/components/chart.js +3 -10
- package/dist/components/dashboard-grid.d.ts +13 -0
- package/dist/components/dashboard-grid.js +8 -0
- package/dist/components/dashboard-section.d.ts +10 -0
- package/dist/components/dashboard-section.js +5 -0
- package/dist/components/data-list.d.ts +13 -0
- package/dist/components/data-list.js +5 -0
- package/dist/components/data-table-column-toggle.d.ts +7 -0
- package/dist/components/data-table-column-toggle.js +27 -0
- package/dist/components/data-table-filters.d.ts +22 -0
- package/dist/components/data-table-filters.js +11 -0
- package/dist/components/data-table-pagination.d.ts +7 -0
- package/dist/components/data-table-pagination.js +11 -0
- package/dist/components/data-table-toolbar.d.ts +11 -0
- package/dist/components/data-table-toolbar.js +9 -0
- package/dist/components/date-range-picker.d.ts +15 -0
- package/dist/components/date-range-picker.js +17 -0
- package/dist/components/donut-chart.d.ts +9 -0
- package/dist/components/donut-chart.js +5 -0
- package/dist/components/dropdown-menu.d.ts +27 -0
- package/dist/components/dropdown-menu.js +32 -0
- package/dist/components/error-state.d.ts +10 -0
- package/dist/components/error-state.js +7 -0
- package/dist/components/filter-chip.d.ts +13 -0
- package/dist/components/filter-chip.js +11 -0
- package/dist/components/funnel-chart.d.ts +12 -0
- package/dist/components/funnel-chart.js +10 -0
- package/dist/components/line-chart.d.ts +12 -0
- package/dist/components/line-chart.js +6 -0
- package/dist/components/loading-overlay.d.ts +8 -0
- package/dist/components/loading-overlay.js +9 -0
- package/dist/components/metric.d.ts +13 -0
- package/dist/components/metric.js +21 -0
- package/dist/components/notification-badge.d.ts +15 -0
- package/dist/components/notification-badge.js +9 -0
- package/dist/components/page-header.d.ts +11 -0
- package/dist/components/page-header.js +8 -0
- package/dist/components/pie-chart.d.ts +14 -0
- package/dist/components/pie-chart.js +6 -0
- package/dist/components/progress-stack.d.ts +14 -0
- package/dist/components/progress-stack.js +9 -0
- package/dist/components/radar-chart.d.ts +15 -0
- package/dist/components/radar-chart.js +9 -0
- package/dist/components/radial-bar-chart.d.ts +15 -0
- package/dist/components/radial-bar-chart.js +10 -0
- package/dist/components/sankey-chart.d.ts +29 -0
- package/dist/components/sankey-chart.js +26 -0
- package/dist/components/scatter-chart.d.ts +19 -0
- package/dist/components/scatter-chart.js +6 -0
- package/dist/components/search-input.d.ts +6 -0
- package/dist/components/search-input.js +9 -0
- package/dist/components/select.js +2 -2
- package/dist/components/sidebar.d.ts +28 -0
- package/dist/components/sidebar.js +26 -0
- package/dist/components/skeleton.d.ts +18 -0
- package/dist/components/skeleton.js +11 -0
- package/dist/components/sortable-table-header.d.ts +14 -0
- package/dist/components/sortable-table-header.js +11 -0
- package/dist/components/sparkline.d.ts +9 -0
- package/dist/components/sparkline.js +7 -0
- package/dist/components/stat-card.d.ts +19 -0
- package/dist/components/stat-card.js +19 -0
- package/dist/components/stepper.d.ts +16 -0
- package/dist/components/stepper.js +33 -0
- package/dist/components/sunburst-chart.d.ts +14 -0
- package/dist/components/sunburst-chart.js +35 -0
- package/dist/components/table.js +28 -2
- package/dist/components/timeline.d.ts +15 -0
- package/dist/components/timeline.js +15 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +38 -0
- package/dist/layout/admin-shell.d.ts +10 -0
- package/dist/layout/admin-shell.js +5 -0
- package/dist/styles.css +1 -1
- package/dist/utils/format.d.ts +15 -0
- package/dist/utils/format.js +63 -0
- package/dist/utils/hooks.d.ts +22 -0
- package/dist/utils/hooks.js +58 -0
- package/package.json +5 -3
- package/src/styles/global.css +153 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CartesianGrid, Legend, Line, LineChart as RechartsLineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function LineChart({ data, height = 300, series, xAxisKey, showGrid = true, showLegend = true, yAxisTickFormatter, tooltipFormatter }) {
|
|
5
|
+
return (_jsx("div", { className: 'w-full', style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsLineChart, { data: data, margin: { top: 10, right: 20, bottom: 5, left: 0 }, children: [showGrid && _jsx(CartesianGrid, { stroke: chartTheme.grid.stroke, strokeDasharray: chartTheme.grid.strokeDasharray, vertical: false }), _jsx(XAxis, { dataKey: xAxisKey, stroke: chartTheme.axis.stroke, tick: chartTheme.axis.tick, tickLine: false, axisLine: false }), _jsx(YAxis, { stroke: chartTheme.axis.stroke, tick: chartTheme.axis.tick, tickLine: false, axisLine: false, tickFormatter: yAxisTickFormatter }), _jsx(Tooltip, { ...chartTheme.tooltip, formatter: (value) => [tooltipFormatter && typeof value === 'number' ? tooltipFormatter(value) : value ?? '', ''] }), showLegend && _jsx(Legend, { wrapperStyle: { paddingTop: '1rem' } }), series.map((s, i) => (_jsx(Line, { type: 'monotone', dataKey: s.key, name: s.name, stroke: s.color ?? chartTheme.palette[i % chartTheme.palette.length], strokeWidth: 2, dot: false, activeDot: { r: 5, strokeWidth: 2, stroke: 'var(--color-card)' } }, s.key)))] }) }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface LoadingOverlayProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
overlayClassName?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function LoadingOverlay({ visible, label, className, overlayClassName }: LoadingOverlayProps): React.ReactPortal | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { LoadingSpinner } from './loading-spinner.js';
|
|
5
|
+
export function LoadingOverlay({ visible, label = 'Loading...', className, overlayClassName }) {
|
|
6
|
+
if (!visible || typeof document === 'undefined')
|
|
7
|
+
return null;
|
|
8
|
+
return createPortal(_jsx("div", { className: cn('fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm', overlayClassName), children: _jsxs("div", { className: cn('flex flex-col items-center gap-3 rounded-[var(--radius-card)] bg-card p-6 shadow-lg ring-1 ring-border', className), children: [_jsx(LoadingSpinner, { size: 'lg' }), label && _jsx("p", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: label })] }) }), document.body);
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type MetricFormat = 'number' | 'currency' | 'percent' | 'compact';
|
|
3
|
+
export interface MetricProps {
|
|
4
|
+
value: number | undefined | null;
|
|
5
|
+
format?: MetricFormat;
|
|
6
|
+
currency?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
prefix?: React.ReactNode;
|
|
9
|
+
suffix?: React.ReactNode;
|
|
10
|
+
decimals?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function Metric({ value, format, currency, className, prefix, suffix, decimals }: MetricProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { formatNumber, formatCurrency, formatPercent, formatCompactNumber } from '../utils/format.js';
|
|
5
|
+
export function Metric({ value, format = 'number', currency = 'USD', className, prefix, suffix, decimals }) {
|
|
6
|
+
const formatted = React.useMemo(() => {
|
|
7
|
+
const options = decimals !== undefined ? { minimumFractionDigits: decimals, maximumFractionDigits: decimals } : {};
|
|
8
|
+
switch (format) {
|
|
9
|
+
case 'currency':
|
|
10
|
+
return formatCurrency(value, currency, options);
|
|
11
|
+
case 'percent':
|
|
12
|
+
return formatPercent(value, options);
|
|
13
|
+
case 'compact':
|
|
14
|
+
return formatCompactNumber(value, options);
|
|
15
|
+
case 'number':
|
|
16
|
+
default:
|
|
17
|
+
return formatNumber(value, options);
|
|
18
|
+
}
|
|
19
|
+
}, [value, format, currency, decimals]);
|
|
20
|
+
return (_jsxs("span", { className: cn('tabular-nums tracking-refined', className), children: [prefix, formatted, suffix] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface NotificationItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
timestamp?: string;
|
|
6
|
+
unread?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface NotificationBadgeProps {
|
|
10
|
+
count?: number;
|
|
11
|
+
items?: NotificationItem[];
|
|
12
|
+
onMarkAllRead?: () => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function NotificationBadge({ count, items, onMarkAllRead, className }: NotificationBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Bell } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { IconButton } from './icon-button.js';
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from './dropdown-menu.js';
|
|
6
|
+
export function NotificationBadge({ count = 0, items = [], onMarkAllRead, className }) {
|
|
7
|
+
const hasUnread = count > 0 || items.some((item) => item.unread);
|
|
8
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("div", { className: cn('relative', className), children: [_jsx(IconButton, { "aria-label": 'Notifications', children: _jsx(Bell, { size: 18 }) }), count > 0 && (_jsx("span", { className: 'absolute right-0 top-0 flex h-4 min-w-4 items-center justify-center rounded-full bg-terracotta px-1 text-[10px] font-bold text-white', children: count > 99 ? '99+' : count }))] }) }), _jsxs(DropdownMenuContent, { align: 'end', className: 'w-80', children: [_jsxs("div", { className: 'flex items-center justify-between px-2 py-1.5', children: [_jsx(DropdownMenuLabel, { className: 'uppercase', children: "Notifications" }), hasUnread && onMarkAllRead && (_jsx("button", { type: 'button', onClick: onMarkAllRead, className: 'text-xs text-sea hover:underline dark:text-accent-blue', children: "Mark all read" }))] }), _jsx(DropdownMenuSeparator, {}), items.length === 0 ? (_jsx("div", { className: 'px-2 py-6 text-center text-sm text-text-secondary dark:text-text-secondary', children: "No notifications" })) : (items.map((item) => (_jsx(DropdownMenuItem, { onClick: item.onClick, className: 'flex flex-col items-start gap-0.5 py-2', children: _jsxs("div", { className: 'flex w-full items-start gap-2', children: [item.unread && _jsx("span", { className: 'mt-1.5 h-2 w-2 shrink-0 rounded-full bg-sea dark:bg-accent-blue' }), _jsxs("div", { className: 'flex-1', children: [_jsx("p", { className: cn('text-sm', item.unread && 'font-semibold'), children: item.title }), item.description && _jsx("p", { className: 'text-xs text-text-secondary dark:text-text-secondary', children: item.description }), item.timestamp && _jsx("p", { className: 'mt-1 text-xs text-text-secondary dark:text-text-secondary', children: item.timestamp })] })] }) }, item.id))))] })] }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PageHeaderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
breadcrumbs?: React.ReactNode;
|
|
6
|
+
actions?: React.ReactNode;
|
|
7
|
+
backHref?: string;
|
|
8
|
+
onBack?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function PageHeader({ title, description, breadcrumbs, actions, backHref, onBack, className }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
export function PageHeader({ title, description, breadcrumbs, actions, backHref, onBack, className }) {
|
|
6
|
+
const showBack = Boolean(backHref || onBack);
|
|
7
|
+
return (_jsxs("div", { className: cn('space-y-2', className), children: [breadcrumbs && _jsx("div", { className: 'text-sm text-text-secondary dark:text-text-secondary', children: breadcrumbs }), _jsxs("div", { className: 'flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: 'flex items-start gap-3', children: [showBack && (_jsx(Button, { variant: 'ghost', size: 'sm', className: 'mt-0.5 h-8 w-8 p-0', onClick: onBack, as: backHref ? 'a' : 'button', href: backHref, children: _jsx(ChevronLeft, { size: 18 }) })), _jsxs("div", { children: [_jsx("h1", { className: 'text-2xl font-bold tracking-refined text-text-primary dark:text-text-primary', children: title }), description && _jsx("p", { className: 'mt-1 text-sm text-text-secondary dark:text-text-secondary', children: description })] })] }), actions && _jsx("div", { className: 'flex flex-wrap items-center gap-2', children: actions })] })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PieChartDatum {
|
|
2
|
+
name: string;
|
|
3
|
+
value: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PieChartProps {
|
|
7
|
+
data: PieChartDatum[];
|
|
8
|
+
height?: number;
|
|
9
|
+
nameKey?: string;
|
|
10
|
+
dataKey?: string;
|
|
11
|
+
showLegend?: boolean;
|
|
12
|
+
innerRadius?: number | string;
|
|
13
|
+
}
|
|
14
|
+
export declare function PieChart({ data, height, nameKey, dataKey, showLegend, innerRadius }: PieChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cell, Pie, PieChart as RechartsPieChart, ResponsiveContainer, Tooltip, Legend } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function PieChart({ data, height = 300, nameKey = 'name', dataKey = 'value', showLegend = true, innerRadius = 0 }) {
|
|
5
|
+
return (_jsx("div", { className: 'w-full', style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsPieChart, { children: [_jsx(Pie, { data: data, dataKey: dataKey, nameKey: nameKey, cx: '50%', cy: '50%', outerRadius: '80%', innerRadius: innerRadius, paddingAngle: 2, labelLine: false, label: ({ name, percent }) => `${name}: ${percent !== undefined ? (percent * 100).toFixed(0) : 0}%`, children: data.map((entry, index) => (_jsx(Cell, { fill: entry.color ?? chartTheme.palette[index % chartTheme.palette.length] }, `cell-${index}`))) }), _jsx(Tooltip, { ...chartTheme.tooltip, formatter: (value) => [value ?? '', ''] }), showLegend && _jsx(Legend, { verticalAlign: 'bottom', height: 36 })] }) }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ProgressStackItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ProgressStackProps {
|
|
8
|
+
items: ProgressStackItem[];
|
|
9
|
+
max?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
barClassName?: string;
|
|
12
|
+
showLegend?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function ProgressStack({ items, max, className, barClassName, showLegend }: ProgressStackProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils/cn.js';
|
|
3
|
+
export function ProgressStack({ items, max, className, barClassName, showLegend = true }) {
|
|
4
|
+
const total = max ?? items.reduce((sum, item) => sum + item.value, 0);
|
|
5
|
+
return (_jsxs("div", { className: cn('space-y-3', className), children: [_jsx("div", { className: cn('flex h-3 w-full overflow-hidden rounded-full bg-sand/20 dark:bg-sand/20', barClassName), children: items.map((item, index) => {
|
|
6
|
+
const width = total > 0 ? (item.value / total) * 100 : 0;
|
|
7
|
+
return (_jsx("div", { className: cn('h-full first:rounded-l-full last:rounded-r-full', item.className), style: { width: `${width}%`, backgroundColor: item.color }, title: `${item.label}: ${item.value}` }, index));
|
|
8
|
+
}) }), showLegend && (_jsx("div", { className: 'flex flex-wrap items-center gap-3 text-xs', children: items.map((item, index) => (_jsxs("div", { className: 'flex items-center gap-1.5', children: [_jsx("span", { className: 'h-2.5 w-2.5 rounded-full', style: { backgroundColor: item.color } }), _jsx("span", { className: 'text-text-secondary dark:text-text-secondary', children: item.label }), _jsx("span", { className: 'font-semibold text-text-primary dark:text-text-primary', children: item.value })] }, index))) }))] }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RadarSeries {
|
|
2
|
+
key: string;
|
|
3
|
+
name: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
fill?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RadarChartProps {
|
|
8
|
+
data: Record<string, unknown>[];
|
|
9
|
+
height?: number;
|
|
10
|
+
subjectKey: string;
|
|
11
|
+
series: RadarSeries[];
|
|
12
|
+
showLegend?: boolean;
|
|
13
|
+
tickFormatter?: (value: number) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare function RadarChart({ data, height, subjectKey, series, showLegend, tickFormatter }: RadarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Legend, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar as RechartsRadar, RadarChart as RechartsRadarChart, ResponsiveContainer, Tooltip } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function RadarChart({ data, height = 350, subjectKey, series, showLegend = true, tickFormatter }) {
|
|
5
|
+
return (_jsx("div", { className: 'w-full', style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsRadarChart, { data: data, margin: { top: 10, right: 20, bottom: 5, left: 0 }, children: [_jsx(PolarGrid, { stroke: chartTheme.grid.stroke }), _jsx(PolarAngleAxis, { dataKey: subjectKey, tick: { fill: 'var(--color-text-secondary)', fontSize: 12 } }), _jsx(PolarRadiusAxis, { stroke: chartTheme.axis.stroke, tick: { fill: 'var(--color-text-secondary)', fontSize: 10 }, tickFormatter: tickFormatter }), _jsx(Tooltip, { ...chartTheme.tooltip, formatter: (value) => [tickFormatter && typeof value === 'number' ? tickFormatter(value) : value, ''] }), showLegend && _jsx(Legend, { wrapperStyle: { paddingTop: '1rem' } }), series.map((s, i) => {
|
|
6
|
+
const color = s.color ?? chartTheme.palette[i % chartTheme.palette.length];
|
|
7
|
+
return (_jsx(RechartsRadar, { name: s.name, dataKey: s.key, stroke: color, fill: color, fillOpacity: s.fill ? 0.35 : 0 }, s.key));
|
|
8
|
+
})] }) }) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RadialBarChartDatum {
|
|
2
|
+
name: string;
|
|
3
|
+
value: number;
|
|
4
|
+
fill?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface RadialBarChartProps {
|
|
7
|
+
data: RadialBarChartDatum[];
|
|
8
|
+
height?: number;
|
|
9
|
+
innerRadius?: string | number;
|
|
10
|
+
outerRadius?: string | number;
|
|
11
|
+
showLegend?: boolean;
|
|
12
|
+
startAngle?: number;
|
|
13
|
+
endAngle?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function RadialBarChart({ data, height, innerRadius, outerRadius, showLegend, startAngle, endAngle }: RadialBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Legend, PolarAngleAxis, RadialBar, RadialBarChart as RechartsRadialBarChart, ResponsiveContainer, Tooltip } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function RadialBarChart({ data, height = 350, innerRadius = '10%', outerRadius = '80%', showLegend = true, startAngle = 90, endAngle = -270 }) {
|
|
5
|
+
const coloredData = data.map((entry, index) => ({
|
|
6
|
+
...entry,
|
|
7
|
+
fill: entry.fill ?? chartTheme.palette[index % chartTheme.palette.length]
|
|
8
|
+
}));
|
|
9
|
+
return (_jsx("div", { className: 'w-full', style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsRadialBarChart, { data: coloredData, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, children: [_jsx(PolarAngleAxis, { type: 'number', domain: [0, 'dataMax'], tick: false }), _jsx(RadialBar, { background: { fill: 'var(--color-muted)' }, dataKey: 'value', cornerRadius: 8, label: { position: 'insideStart', fill: 'var(--color-text-primary)', fontWeight: 600 } }), _jsx(Tooltip, { ...chartTheme.tooltip, formatter: (value) => [value ?? '', ''] }), showLegend && _jsx(Legend, { iconSize: 10, layout: 'vertical', verticalAlign: 'middle', align: 'right' })] }) }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface SankeyNode {
|
|
2
|
+
name: string;
|
|
3
|
+
fill?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SankeyLink {
|
|
6
|
+
source: number;
|
|
7
|
+
target: number;
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SankeyChartProps {
|
|
11
|
+
data: {
|
|
12
|
+
nodes: SankeyNode[];
|
|
13
|
+
links: SankeyLink[];
|
|
14
|
+
};
|
|
15
|
+
height?: number;
|
|
16
|
+
nodeWidth?: number;
|
|
17
|
+
linkCurvature?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optional palette for nodes. Defaults to the Bleecker chart palette.
|
|
20
|
+
* Individual node `fill` values override the palette.
|
|
21
|
+
*/
|
|
22
|
+
nodeColors?: string[];
|
|
23
|
+
/** Opacity of flow bands. @default 0.35 */
|
|
24
|
+
linkOpacity?: number;
|
|
25
|
+
/** Radius of node corners. @default 4 */
|
|
26
|
+
nodeRadius?: number;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function SankeyChart({ data, height, nodeWidth, linkCurvature, nodeColors, linkOpacity, nodeRadius, className }: SankeyChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ResponsiveContainer, Sankey as RechartsSankey, Tooltip } from 'recharts';
|
|
4
|
+
import { cn } from '../utils/cn.js';
|
|
5
|
+
import { chartTheme } from './chart-theme.js';
|
|
6
|
+
function getNodeColor(node, index, palette) {
|
|
7
|
+
return node.fill ?? palette[index % palette.length];
|
|
8
|
+
}
|
|
9
|
+
export function SankeyChart({ data, height = 400, nodeWidth = 12, linkCurvature = 0.5, nodeColors = chartTheme.palette, linkOpacity = 0.35, nodeRadius = 4, className }) {
|
|
10
|
+
const nodeRender = React.useCallback((props) => {
|
|
11
|
+
const { x, y, width, height, index, payload } = props;
|
|
12
|
+
const color = getNodeColor(payload, index, nodeColors);
|
|
13
|
+
return (_jsx("rect", { x: x, y: y, width: width, height: height, rx: nodeRadius, ry: nodeRadius, fill: color, stroke: 'var(--color-card)', strokeWidth: 2 }));
|
|
14
|
+
}, [nodeColors, nodeRadius]);
|
|
15
|
+
const linkRender = React.useCallback((props) => {
|
|
16
|
+
const { sourceX, targetX, sourceY, targetY, sourceControlX, targetControlX, sourceRelativeY, targetRelativeY, linkWidth, payload } = props;
|
|
17
|
+
const sourceIndex = payload.source.index ?? 0;
|
|
18
|
+
const color = getNodeColor(payload.source, sourceIndex, nodeColors);
|
|
19
|
+
const top = `M ${sourceX},${sourceY + sourceRelativeY}
|
|
20
|
+
C ${sourceControlX},${sourceY + sourceRelativeY} ${targetControlX},${targetY + targetRelativeY} ${targetX},${targetY + targetRelativeY}`;
|
|
21
|
+
const bottom = `L ${targetX},${targetY + targetRelativeY + linkWidth}
|
|
22
|
+
C ${targetControlX},${targetY + targetRelativeY + linkWidth} ${sourceControlX},${sourceY + sourceRelativeY + linkWidth} ${sourceX},${sourceY + sourceRelativeY + linkWidth}`;
|
|
23
|
+
return (_jsx("path", { d: `${top} ${bottom} Z`, fill: color, fillOpacity: linkOpacity, stroke: 'none', className: 'transition-opacity duration-300 hover:opacity-80' }));
|
|
24
|
+
}, [linkOpacity, nodeColors]);
|
|
25
|
+
return (_jsx("div", { className: cn('w-full', className), style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsx(RechartsSankey, { data: data, nodeWidth: nodeWidth, linkCurvature: linkCurvature, nodePadding: 16, margin: { top: 10, right: 20, bottom: 10, left: 20 }, node: nodeRender, link: linkRender, children: _jsx(Tooltip, { ...chartTheme.tooltip }) }) }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ScatterSeries {
|
|
2
|
+
key: string;
|
|
3
|
+
name: string;
|
|
4
|
+
xKey: string;
|
|
5
|
+
yKey: string;
|
|
6
|
+
zKey?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ScatterChartProps {
|
|
10
|
+
data: Record<string, unknown>[];
|
|
11
|
+
height?: number;
|
|
12
|
+
series: ScatterSeries[];
|
|
13
|
+
showGrid?: boolean;
|
|
14
|
+
showLegend?: boolean;
|
|
15
|
+
xAxisTickFormatter?: (value: number | string) => string;
|
|
16
|
+
yAxisTickFormatter?: (value: number | string) => string;
|
|
17
|
+
tooltipFormatter?: (value: number) => string;
|
|
18
|
+
}
|
|
19
|
+
export declare function ScatterChart({ data, height, series, showGrid, showLegend, xAxisTickFormatter, yAxisTickFormatter, tooltipFormatter }: ScatterChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CartesianGrid, Legend, ResponsiveContainer, Scatter as RechartsScatter, ScatterChart as RechartsScatterChart, Tooltip, XAxis, YAxis, ZAxis } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function ScatterChart({ data, height = 350, series, showGrid = true, showLegend = true, xAxisTickFormatter, yAxisTickFormatter, tooltipFormatter }) {
|
|
5
|
+
return (_jsx("div", { className: 'w-full', style: { height }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsScatterChart, { margin: { top: 10, right: 20, bottom: 5, left: 0 }, children: [showGrid && _jsx(CartesianGrid, { stroke: chartTheme.grid.stroke, strokeDasharray: chartTheme.grid.strokeDasharray }), _jsx(XAxis, { type: 'number', dataKey: (entry) => entry[series[0].xKey], stroke: chartTheme.axis.stroke, tick: chartTheme.axis.tick, tickLine: false, axisLine: false, tickFormatter: xAxisTickFormatter }), _jsx(YAxis, { type: 'number', dataKey: (entry) => entry[series[0].yKey], stroke: chartTheme.axis.stroke, tick: chartTheme.axis.tick, tickLine: false, axisLine: false, tickFormatter: yAxisTickFormatter }), _jsx(ZAxis, { type: 'number', dataKey: (entry) => (series[0].zKey ? entry[series[0].zKey] : 1), range: [60, 400] }), _jsx(Tooltip, { ...chartTheme.tooltip, cursor: { strokeDasharray: '3 3' }, formatter: (value) => [tooltipFormatter && typeof value === 'number' ? tooltipFormatter(value) : value, ''] }), showLegend && _jsx(Legend, { wrapperStyle: { paddingTop: '1rem' } }), series.map((s, i) => (_jsx(RechartsScatter, { name: s.name, data: data, fill: s.color ?? chartTheme.palette[i % chartTheme.palette.length] }, s.key)))] }) }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type InputProps } from './input';
|
|
3
|
+
export interface SearchInputProps extends Omit<InputProps, 'startIcon' | 'endIcon' | 'type'> {
|
|
4
|
+
onClear?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Search, X } from 'lucide-react';
|
|
4
|
+
import { cn } from '../utils/cn.js';
|
|
5
|
+
import { Input } from './input.js';
|
|
6
|
+
export const SearchInput = React.forwardRef(function SearchInput({ className, onClear, value, onChange, ...props }, ref) {
|
|
7
|
+
const inputValue = typeof value === 'string' ? value : '';
|
|
8
|
+
return (_jsxs("div", { className: cn('relative', className), children: [_jsx(Input, { ref: ref, type: 'search', value: value, onChange: onChange, startIcon: _jsx(Search, { className: 'h-4 w-4' }), className: 'pr-8', ...props }), inputValue && onClear && (_jsx("button", { type: 'button', onClick: onClear, className: 'absolute right-2.5 top-1/2 -translate-y-1/2 rounded-full p-0.5 text-text-secondary transition-colors hover:bg-sand/10 hover:text-text-primary dark:hover:bg-sand/15', children: _jsx(X, { size: 14 }) }))] }));
|
|
9
|
+
});
|
|
@@ -39,8 +39,8 @@ export function Select({ className, disabled = false, error = false, onChange, o
|
|
|
39
39
|
if (rect) {
|
|
40
40
|
setMenuStyle({
|
|
41
41
|
position: 'fixed',
|
|
42
|
-
top: `${rect.bottom
|
|
43
|
-
left: `${rect.left
|
|
42
|
+
top: `${rect.bottom}px`,
|
|
43
|
+
left: `${rect.left}px`,
|
|
44
44
|
width: `${rect.width}px`,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SidebarItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
badge?: React.ReactNode;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
items?: SidebarItem[];
|
|
11
|
+
}
|
|
12
|
+
export interface SidebarProps {
|
|
13
|
+
items: SidebarItem[];
|
|
14
|
+
header?: React.ReactNode;
|
|
15
|
+
footer?: React.ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
collapsed?: boolean;
|
|
18
|
+
onItemClick?: (item: SidebarItem) => void;
|
|
19
|
+
renderLink?: (props: {
|
|
20
|
+
item: SidebarItem & {
|
|
21
|
+
href: string;
|
|
22
|
+
};
|
|
23
|
+
className?: string;
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
}) => React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function Sidebar({ items, header, footer, className, collapsed, onItemClick, renderLink }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ChevronRight } from 'lucide-react';
|
|
4
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
5
|
+
import { cn } from '../utils/cn.js';
|
|
6
|
+
function SidebarLink({ item, collapsed, renderLink, onClick }) {
|
|
7
|
+
const content = (_jsxs(_Fragment, { children: [item.icon && _jsx("span", { className: 'flex h-5 w-5 shrink-0 items-center justify-center', children: item.icon }), !collapsed && (_jsxs(_Fragment, { children: [_jsx("span", { className: 'flex-1 truncate text-sm font-medium', children: item.label }), item.badge && _jsx("span", { className: 'ml-auto shrink-0', children: item.badge })] }))] }));
|
|
8
|
+
const className = cn('flex items-center gap-3 rounded-[var(--radius-ui)] px-3 py-2.5 text-text-secondary transition-colors hover:bg-sand/10 hover:text-text-primary dark:text-text-secondary dark:hover:bg-sand/15 dark:hover:text-text-primary', item.active && 'bg-sea/10 font-medium text-sea dark:bg-accent-blue/10 dark:text-accent-blue', item.disabled && 'pointer-events-none opacity-50');
|
|
9
|
+
if (renderLink) {
|
|
10
|
+
return renderLink({ item, className, children: content, onClick });
|
|
11
|
+
}
|
|
12
|
+
return (_jsx("a", { href: item.href, className: className, onClick: onClick, "aria-current": item.active ? 'page' : undefined, children: content }));
|
|
13
|
+
}
|
|
14
|
+
function SidebarGroup({ item, collapsed, renderLink, onItemClick }) {
|
|
15
|
+
const [open, setOpen] = React.useState(item.items?.some((child) => child.active) ?? false);
|
|
16
|
+
if (collapsed || !item.items || item.items.length === 0) {
|
|
17
|
+
if (item.href) {
|
|
18
|
+
return _jsx(SidebarLink, { item: item, collapsed: collapsed, renderLink: renderLink, onClick: () => onItemClick?.(item) });
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs(CollapsiblePrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(CollapsiblePrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: 'button', className: cn('flex w-full items-center gap-3 rounded-[var(--radius-ui)] px-3 py-2.5 text-text-secondary transition-colors hover:bg-sand/10 hover:text-text-primary dark:text-text-secondary dark:hover:bg-sand/15 dark:hover:text-text-primary', item.active && 'bg-sea/10 font-medium text-sea dark:bg-accent-blue/10 dark:text-accent-blue'), children: [item.icon && _jsx("span", { className: 'flex h-5 w-5 shrink-0 items-center justify-center', children: item.icon }), _jsx("span", { className: 'flex-1 truncate text-left text-sm font-medium', children: item.label }), item.badge && _jsx("span", { className: 'ml-auto shrink-0', children: item.badge }), _jsx(ChevronRight, { size: 14, className: cn('shrink-0 transition-transform duration-200', open && 'rotate-90') })] }) }), _jsx(CollapsiblePrimitive.Content, { className: 'overflow-hidden', children: _jsx("div", { className: 'relative ml-5 mt-1 border-l border-sand/20 pl-4 dark:border-sand/20', children: item.items.map((child) => child.href ? (_jsx(SidebarLink, { item: child, collapsed: collapsed, renderLink: renderLink, onClick: () => onItemClick?.(child) }, child.id)) : null) }) })] }));
|
|
23
|
+
}
|
|
24
|
+
export function Sidebar({ items, header, footer, className, collapsed = false, onItemClick, renderLink }) {
|
|
25
|
+
return (_jsxs("aside", { className: cn('flex h-full flex-col border-r border-border bg-card transition-all duration-300 dark:border-white/[0.08] dark:bg-dark-sand/95', collapsed ? 'w-16 px-2 py-4' : 'w-64 px-3 py-4', className), children: [header && _jsx("div", { className: cn('mb-4', collapsed && 'flex justify-center'), children: header }), _jsx("nav", { className: 'flex-1 space-y-1 overflow-y-auto scrollbar-thin', children: items.map((item) => (_jsx(SidebarGroup, { item: item, collapsed: collapsed, renderLink: renderLink, onItemClick: onItemClick }, item.id))) }), footer && _jsx("div", { className: cn('mt-auto pt-4', collapsed && 'flex justify-center'), children: footer })] }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
circle?: boolean;
|
|
4
|
+
width?: string | number;
|
|
5
|
+
height?: string | number;
|
|
6
|
+
}
|
|
7
|
+
export declare function Skeleton({ className, circle, width, height, style, ...props }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface SkeletonCardProps {
|
|
9
|
+
rows?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function SkeletonCard({ rows, className }: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export interface SkeletonTableProps {
|
|
14
|
+
rows?: number;
|
|
15
|
+
columns?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function SkeletonTable({ rows, columns, className }: SkeletonTableProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils/cn.js';
|
|
3
|
+
export function Skeleton({ className, circle, width, height, style, ...props }) {
|
|
4
|
+
return (_jsx("div", { className: cn('animate-pulse bg-sand/20 dark:bg-white/10', circle ? 'rounded-full' : 'rounded-[var(--radius-ui)]', className), style: { ...style, width, height }, ...props }));
|
|
5
|
+
}
|
|
6
|
+
export function SkeletonCard({ rows = 3, className }) {
|
|
7
|
+
return (_jsxs("div", { className: cn('space-y-3 rounded-[var(--radius-card)] bg-card p-6 shadow-sm ring-1 ring-border', className), children: [_jsxs("div", { className: 'flex items-center gap-3', children: [_jsx(Skeleton, { circle: true, width: 40, height: 40 }), _jsxs("div", { className: 'flex-1 space-y-2', children: [_jsx(Skeleton, { height: 16, className: 'w-1/3' }), _jsx(Skeleton, { height: 12, className: 'w-1/2' })] })] }), Array.from({ length: rows }).map((_, i) => (_jsx(Skeleton, { height: 12, className: 'w-full' }, i)))] }));
|
|
8
|
+
}
|
|
9
|
+
export function SkeletonTable({ rows = 5, columns = 4, className }) {
|
|
10
|
+
return (_jsxs("div", { className: cn('w-full space-y-2', className), children: [_jsx("div", { className: 'flex gap-2', children: Array.from({ length: columns }).map((_, i) => (_jsx(Skeleton, { height: 32, className: 'flex-1' }, i))) }), Array.from({ length: rows }).map((_, rowIndex) => (_jsx("div", { className: 'flex gap-2', children: Array.from({ length: columns }).map((_, colIndex) => (_jsx(Skeleton, { height: 40, className: 'flex-1' }, colIndex))) }, rowIndex)))] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SortState {
|
|
2
|
+
field: string;
|
|
3
|
+
order: 'asc' | 'desc';
|
|
4
|
+
}
|
|
5
|
+
export interface SortableTableHeaderProps {
|
|
6
|
+
align?: 'left' | 'right';
|
|
7
|
+
className?: string;
|
|
8
|
+
currentSort: SortState;
|
|
9
|
+
field: string;
|
|
10
|
+
label: string;
|
|
11
|
+
onSort: (field: string, order: 'asc' | 'desc') => void;
|
|
12
|
+
sortable?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function SortableTableHeader({ align, className, currentSort, field, label, onSort, sortable }: SortableTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
export function SortableTableHeader({ align = 'left', className, currentSort, field, label, onSort, sortable = true }) {
|
|
5
|
+
const isSorted = currentSort.field === field;
|
|
6
|
+
if (!sortable) {
|
|
7
|
+
return (_jsx("th", { className: cn(align === 'right' ? 'text-right' : 'text-left', 'h-11 px-4 text-xs font-semibold uppercase tracking-wider text-text-secondary dark:text-text-secondary', className), children: label }));
|
|
8
|
+
}
|
|
9
|
+
const SortIcon = isSorted ? (currentSort.order === 'asc' ? ArrowUp : ArrowDown) : ArrowUpDown;
|
|
10
|
+
return (_jsx("th", { className: cn(align === 'right' ? 'text-right' : 'text-left', 'h-11 px-4', className), children: _jsxs("button", { type: 'button', onClick: () => onSort(field, isSorted && currentSort.order === 'asc' ? 'desc' : 'asc'), className: cn('inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider transition-colors duration-150 focus:outline-none focus-visible:underline', isSorted ? 'text-sea dark:text-accent-blue' : 'text-text-secondary hover:text-text-primary dark:text-text-secondary dark:hover:text-text-primary'), children: [label, _jsx(SortIcon, { size: 12, className: cn('flex-shrink-0 transition-opacity duration-150', isSorted ? 'opacity-100' : 'opacity-40') })] }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SparklineProps {
|
|
2
|
+
data: Record<string, unknown>[];
|
|
3
|
+
dataKey: string;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
showArea?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Sparkline({ data, dataKey, height, color, showArea, className }: SparklineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Line, LineChart as RechartsLineChart, ResponsiveContainer, Tooltip } from 'recharts';
|
|
3
|
+
import { chartTheme } from './chart-theme.js';
|
|
4
|
+
export function Sparkline({ data, dataKey, height = 40, color, showArea = false, className }) {
|
|
5
|
+
const stroke = color ?? chartTheme.colors.sea;
|
|
6
|
+
return (_jsx("div", { className: className, style: { height, width: '100%' }, children: _jsx(ResponsiveContainer, { width: '100%', height: '100%', children: _jsxs(RechartsLineChart, { data: data, margin: { top: 2, right: 2, bottom: 2, left: 2 }, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: 'sparklineGradient', x1: '0', y1: '0', x2: '0', y2: '1', children: [_jsx("stop", { offset: '0%', stopColor: stroke, stopOpacity: 0.3 }), _jsx("stop", { offset: '100%', stopColor: stroke, stopOpacity: 0 })] }) }), _jsx(Tooltip, { ...chartTheme.tooltip, formatter: (value) => [value ?? '', ''], labelFormatter: () => '' }), _jsx(Line, { type: 'monotone', dataKey: dataKey, stroke: stroke, strokeWidth: 2, dot: false, activeDot: { r: 3, strokeWidth: 0 }, fill: showArea ? 'url(#sparklineGradient)' : undefined })] }) }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type StatTrendDirection = 'up' | 'down' | 'neutral';
|
|
3
|
+
export interface StatCardProps {
|
|
4
|
+
title: string;
|
|
5
|
+
value: React.ReactNode;
|
|
6
|
+
description?: string;
|
|
7
|
+
trend?: {
|
|
8
|
+
value: string;
|
|
9
|
+
direction: StatTrendDirection;
|
|
10
|
+
label?: string;
|
|
11
|
+
};
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
sparklineData?: Record<string, unknown>[];
|
|
15
|
+
sparklineDataKey?: string;
|
|
16
|
+
sparklineColor?: string;
|
|
17
|
+
footer?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare function StatCard({ title, value, description, trend, icon, className, sparklineData, sparklineDataKey, sparklineColor, footer }: StatCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TrendingDown, TrendingUp, Minus } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
import { Card } from './card.js';
|
|
5
|
+
import { Sparkline } from './sparkline.js';
|
|
6
|
+
const trendIcons = {
|
|
7
|
+
up: TrendingUp,
|
|
8
|
+
down: TrendingDown,
|
|
9
|
+
neutral: Minus
|
|
10
|
+
};
|
|
11
|
+
const trendClasses = {
|
|
12
|
+
up: 'text-emerald-600 dark:text-emerald-400',
|
|
13
|
+
down: 'text-terracotta dark:text-terracotta',
|
|
14
|
+
neutral: 'text-text-secondary dark:text-text-secondary'
|
|
15
|
+
};
|
|
16
|
+
export function StatCard({ title, value, description, trend, icon, className, sparklineData, sparklineDataKey, sparklineColor, footer }) {
|
|
17
|
+
const TrendIcon = trend ? trendIcons[trend.direction] : null;
|
|
18
|
+
return (_jsxs(Card, { className: cn('flex flex-col gap-4 p-5', className), children: [_jsxs("div", { className: 'flex items-start justify-between gap-4', children: [_jsxs("div", { className: 'min-w-0 flex-1 space-y-1', children: [_jsx("p", { className: 'text-sm font-medium text-text-secondary dark:text-text-secondary', children: title }), _jsx("p", { className: 'text-3xl font-bold tracking-refined text-text-primary dark:text-text-primary', children: value }), trend && (_jsxs("div", { className: 'flex items-center gap-1.5 text-sm', children: [TrendIcon && _jsx(TrendIcon, { size: 14, className: cn('flex-shrink-0', trendClasses[trend.direction]) }), _jsx("span", { className: cn('font-semibold', trendClasses[trend.direction]), children: trend.value }), trend.label && _jsx("span", { className: 'text-text-secondary dark:text-text-secondary', children: trend.label })] })), description && !trend && _jsx("p", { className: 'text-sm text-text-secondary dark:text-text-secondary', children: description })] }), icon && (_jsx("div", { className: 'flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--radius-ui)] bg-sea/10 text-sea dark:bg-accent-blue/10 dark:text-accent-blue', children: icon }))] }), sparklineData && sparklineDataKey && (_jsx("div", { className: '-mx-1', children: _jsx(Sparkline, { data: sparklineData, dataKey: sparklineDataKey, height: 48, color: sparklineColor, showArea: true }) })), footer && _jsx("div", { className: 'border-t border-sand/10 pt-3 dark:border-sand/20', children: footer })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type StepStatus = 'pending' | 'active' | 'completed' | 'error';
|
|
2
|
+
export interface Step {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status?: StepStatus;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface StepperProps {
|
|
10
|
+
steps: Step[];
|
|
11
|
+
activeStep?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
onStepClick?: (step: Step) => void;
|
|
14
|
+
orientation?: 'horizontal' | 'vertical';
|
|
15
|
+
}
|
|
16
|
+
export declare function Stepper({ steps, activeStep, className, onStepClick, orientation }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check } from 'lucide-react';
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
const statusClasses = {
|
|
5
|
+
completed: {
|
|
6
|
+
circle: 'bg-sea text-white ring-sea dark:bg-accent-blue dark:ring-accent-blue',
|
|
7
|
+
line: 'bg-sea dark:bg-accent-blue'
|
|
8
|
+
},
|
|
9
|
+
active: {
|
|
10
|
+
circle: 'bg-white text-sea ring-2 ring-sea dark:bg-deep-sea dark:text-accent-blue dark:ring-accent-blue',
|
|
11
|
+
line: 'bg-sand/30 dark:bg-sand/30'
|
|
12
|
+
},
|
|
13
|
+
pending: {
|
|
14
|
+
circle: 'bg-white text-text-secondary ring-2 ring-sand/30 dark:bg-deep-sea dark:text-text-secondary dark:ring-sand/30',
|
|
15
|
+
line: 'bg-sand/30 dark:bg-sand/30'
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
circle: 'bg-terracotta text-white ring-terracotta',
|
|
19
|
+
line: 'bg-sand/30 dark:bg-sand/30'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export function Stepper({ steps, activeStep, className, onStepClick, orientation = 'horizontal' }) {
|
|
23
|
+
const activeIndex = activeStep ? steps.findIndex((s) => s.id === activeStep) : -1;
|
|
24
|
+
const isHorizontal = orientation === 'horizontal';
|
|
25
|
+
return (_jsx("div", { className: cn(isHorizontal ? 'flex w-full items-start' : 'flex flex-col', className), children: steps.map((step, index) => {
|
|
26
|
+
const status = step.status ?? (index < activeIndex ? 'completed' : index === activeIndex ? 'active' : 'pending');
|
|
27
|
+
const isLast = index === steps.length - 1;
|
|
28
|
+
const styles = statusClasses[status];
|
|
29
|
+
return (_jsxs("div", { className: cn('relative flex', isHorizontal ? 'flex-1 flex-col items-center' : 'items-start gap-4'), children: [!isLast && (_jsx("div", { className: cn('absolute transition-colors', isHorizontal
|
|
30
|
+
? 'left-1/2 top-4 h-0.5 w-[calc(100%-2rem)]'
|
|
31
|
+
: 'left-4 top-9 h-[calc(100%-2rem)] w-0.5'), children: _jsx("div", { className: cn('h-full w-full', status === 'completed' ? styles.line : 'bg-sand/20 dark:bg-sand/20') }) })), _jsx("button", { type: 'button', disabled: step.disabled || !onStepClick, onClick: () => onStepClick?.(step), className: cn('relative z-10 flex h-8 w-8 items-center justify-center rounded-full text-sm font-semibold transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-sea focus-visible:ring-offset-2', styles.circle, onStepClick && !step.disabled && 'cursor-pointer', step.disabled && 'cursor-not-allowed opacity-50'), children: status === 'completed' ? _jsx(Check, { size: 16 }) : index + 1 }), _jsxs("div", { className: cn('mt-2 text-center', isHorizontal ? 'max-w-[8rem]' : 'text-left'), children: [_jsx("p", { className: cn('text-sm font-medium', status === 'active' ? 'text-text-primary dark:text-text-primary' : 'text-text-secondary dark:text-text-secondary'), children: step.label }), step.description && _jsx("p", { className: 'mt-0.5 text-xs text-text-secondary dark:text-text-secondary', children: step.description })] })] }, step.id));
|
|
32
|
+
}) }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SunburstNode {
|
|
2
|
+
name: string;
|
|
3
|
+
value?: number;
|
|
4
|
+
children?: SunburstNode[];
|
|
5
|
+
fill?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SunburstChartProps {
|
|
8
|
+
data: SunburstNode;
|
|
9
|
+
height?: number;
|
|
10
|
+
dataKey?: string;
|
|
11
|
+
nameKey?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function SunburstChart({ data, height, dataKey, nameKey, className }: SunburstChartProps): import("react/jsx-runtime").JSX.Element;
|