@skyfall_ai/aegis 0.1.0 → 0.2.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/dist/index.mjs CHANGED
@@ -3577,17 +3577,839 @@ function Banner({
3577
3577
  }
3578
3578
  );
3579
3579
  }
3580
+
3581
+ // src/charts/ChartCard.module.css
3582
+ var ChartCard_default = {};
3583
+
3584
+ // src/charts/ChartCard.tsx
3585
+ import { jsx as jsx59, jsxs as jsxs50 } from "react/jsx-runtime";
3586
+ var defaultEmpty = /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.placeholder, children: [
3587
+ /* @__PURE__ */ jsx59("div", { className: ChartCard_default.placeholderTitle, children: "No data available" }),
3588
+ /* @__PURE__ */ jsx59("div", { className: ChartCard_default.placeholderText, children: "There's nothing to display for the selected range." })
3589
+ ] });
3590
+ var defaultLoading = /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.placeholder, children: [
3591
+ /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.skeletonBars, "aria-hidden": "true", children: [
3592
+ /* @__PURE__ */ jsx59("span", {}),
3593
+ /* @__PURE__ */ jsx59("span", {}),
3594
+ /* @__PURE__ */ jsx59("span", {}),
3595
+ /* @__PURE__ */ jsx59("span", {}),
3596
+ /* @__PURE__ */ jsx59("span", {})
3597
+ ] }),
3598
+ /* @__PURE__ */ jsx59("div", { className: ChartCard_default.placeholderText, children: "Loading chart\u2026" })
3599
+ ] });
3600
+ var defaultError = /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.placeholder, role: "alert", children: [
3601
+ /* @__PURE__ */ jsx59("div", { className: ChartCard_default.placeholderTitle, children: "Unable to load chart" }),
3602
+ /* @__PURE__ */ jsx59("div", { className: ChartCard_default.placeholderText, children: "Something went wrong while loading this data. Try again in a moment." })
3603
+ ] });
3604
+ function ChartCard({
3605
+ title,
3606
+ subtitle,
3607
+ metric,
3608
+ trend,
3609
+ actions,
3610
+ footer,
3611
+ density = "comfortable",
3612
+ state = "ready",
3613
+ emptyState,
3614
+ loadingState,
3615
+ errorState,
3616
+ ariaLabel,
3617
+ className,
3618
+ children,
3619
+ ...props
3620
+ }) {
3621
+ const showHeader = title || subtitle || metric || trend || actions;
3622
+ return /* @__PURE__ */ jsxs50(
3623
+ "section",
3624
+ {
3625
+ className: cn(ChartCard_default.card, ChartCard_default[density], className),
3626
+ "aria-label": ariaLabel,
3627
+ ...props,
3628
+ children: [
3629
+ showHeader && /* @__PURE__ */ jsxs50("header", { className: ChartCard_default.header, children: [
3630
+ /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.headerText, children: [
3631
+ title && /* @__PURE__ */ jsx59("h3", { className: ChartCard_default.title, children: title }),
3632
+ subtitle && /* @__PURE__ */ jsx59("p", { className: ChartCard_default.subtitle, children: subtitle }),
3633
+ (metric || trend) && /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.metricRow, children: [
3634
+ metric && /* @__PURE__ */ jsx59("span", { className: ChartCard_default.metric, children: metric }),
3635
+ trend && /* @__PURE__ */ jsx59("span", { className: ChartCard_default.trendSlot, children: trend })
3636
+ ] })
3637
+ ] }),
3638
+ actions && /* @__PURE__ */ jsx59("div", { className: ChartCard_default.actions, children: actions })
3639
+ ] }),
3640
+ /* @__PURE__ */ jsxs50("div", { className: ChartCard_default.body, children: [
3641
+ state === "loading" && (loadingState ?? defaultLoading),
3642
+ state === "empty" && (emptyState ?? defaultEmpty),
3643
+ state === "error" && (errorState ?? defaultError),
3644
+ state === "ready" && children
3645
+ ] }),
3646
+ footer && /* @__PURE__ */ jsx59("footer", { className: ChartCard_default.footer, children: footer })
3647
+ ]
3648
+ }
3649
+ );
3650
+ }
3651
+
3652
+ // src/charts/chartTheme.ts
3653
+ var aegisSeriesPalette = [
3654
+ "var(--aegis-data-vis-1)",
3655
+ "var(--aegis-data-vis-2)",
3656
+ "var(--aegis-data-vis-3)",
3657
+ "var(--aegis-data-vis-4)",
3658
+ "var(--aegis-data-vis-5)"
3659
+ ];
3660
+ function getSeriesColor(index, override) {
3661
+ if (override) return override;
3662
+ return aegisSeriesPalette[index % aegisSeriesPalette.length];
3663
+ }
3664
+ var aegisChartTheme = {
3665
+ axis: {
3666
+ stroke: "var(--aegis-data-vis-axis)",
3667
+ fontSize: 12,
3668
+ fontFamily: "var(--aegis-font-family-sans)",
3669
+ tickColor: "var(--aegis-color-text-muted)"
3670
+ },
3671
+ grid: {
3672
+ stroke: "var(--aegis-data-vis-gridline)",
3673
+ strokeDasharray: "3 3"
3674
+ },
3675
+ tooltip: {
3676
+ background: "var(--aegis-color-surface-overlay)",
3677
+ border: "var(--aegis-color-border-default)",
3678
+ text: "var(--aegis-color-text-primary)",
3679
+ muted: "var(--aegis-color-text-secondary)"
3680
+ },
3681
+ reference: {
3682
+ stroke: "var(--aegis-color-text-muted)",
3683
+ strokeDasharray: "4 4"
3684
+ }
3685
+ };
3686
+ var defaultValueFormatter = (value) => {
3687
+ if (typeof value !== "number") return String(value);
3688
+ if (Math.abs(value) >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
3689
+ if (Math.abs(value) >= 1e3) return `${(value / 1e3).toFixed(1)}k`;
3690
+ return value.toLocaleString();
3691
+ };
3692
+
3693
+ // src/charts/ChartTooltip.module.css
3694
+ var ChartTooltip_default = {};
3695
+
3696
+ // src/charts/ChartTooltip.tsx
3697
+ import { jsx as jsx60, jsxs as jsxs51 } from "react/jsx-runtime";
3698
+ function ChartTooltip({
3699
+ active,
3700
+ payload,
3701
+ label,
3702
+ valueFormatter = defaultValueFormatter,
3703
+ labelFormatter
3704
+ }) {
3705
+ if (!active || !payload || payload.length === 0) return null;
3706
+ const displayLabel = labelFormatter && label != null ? labelFormatter(String(label)) : label;
3707
+ return /* @__PURE__ */ jsxs51("div", { className: ChartTooltip_default.tooltip, role: "tooltip", children: [
3708
+ displayLabel != null && /* @__PURE__ */ jsx60("div", { className: ChartTooltip_default.label, children: displayLabel }),
3709
+ /* @__PURE__ */ jsx60("ul", { className: ChartTooltip_default.list, children: payload.map((entry, index) => /* @__PURE__ */ jsxs51("li", { className: ChartTooltip_default.row, children: [
3710
+ /* @__PURE__ */ jsx60(
3711
+ "span",
3712
+ {
3713
+ className: ChartTooltip_default.swatch,
3714
+ style: { backgroundColor: entry.color },
3715
+ "aria-hidden": "true"
3716
+ }
3717
+ ),
3718
+ /* @__PURE__ */ jsx60("span", { className: ChartTooltip_default.name, children: entry.name }),
3719
+ /* @__PURE__ */ jsx60("span", { className: ChartTooltip_default.value, children: entry.value != null ? valueFormatter(entry.value) : "\u2014" })
3720
+ ] }, `${entry.dataKey}-${index}`)) })
3721
+ ] });
3722
+ }
3723
+
3724
+ // src/charts/ChartLegend.module.css
3725
+ var ChartLegend_default = {};
3726
+
3727
+ // src/charts/ChartLegend.tsx
3728
+ import { jsx as jsx61, jsxs as jsxs52 } from "react/jsx-runtime";
3729
+ function ChartLegend({ payload }) {
3730
+ if (!payload || payload.length === 0) return null;
3731
+ return /* @__PURE__ */ jsx61("ul", { className: ChartLegend_default.legend, children: payload.map((entry, index) => /* @__PURE__ */ jsxs52("li", { className: ChartLegend_default.item, children: [
3732
+ /* @__PURE__ */ jsx61(
3733
+ "span",
3734
+ {
3735
+ className: ChartLegend_default.swatch,
3736
+ style: { backgroundColor: entry.color },
3737
+ "aria-hidden": "true"
3738
+ }
3739
+ ),
3740
+ /* @__PURE__ */ jsx61("span", { className: ChartLegend_default.label, children: entry.value })
3741
+ ] }, `${entry.value}-${index}`)) });
3742
+ }
3743
+
3744
+ // src/charts/LineChart.tsx
3745
+ import {
3746
+ CartesianGrid,
3747
+ Legend,
3748
+ Line,
3749
+ LineChart as RechartsLineChart,
3750
+ ReferenceLine,
3751
+ ResponsiveContainer,
3752
+ Tooltip as Tooltip2,
3753
+ XAxis,
3754
+ YAxis
3755
+ } from "recharts";
3756
+ import { jsx as jsx62, jsxs as jsxs53 } from "react/jsx-runtime";
3757
+ function LineChart({
3758
+ data,
3759
+ xKey,
3760
+ series,
3761
+ height = 280,
3762
+ showLegend,
3763
+ showGrid = true,
3764
+ valueFormatter = defaultValueFormatter,
3765
+ referenceLines,
3766
+ smooth = true,
3767
+ state,
3768
+ ...cardProps
3769
+ }) {
3770
+ const effectiveState = state ?? (data.length === 0 ? "empty" : "ready");
3771
+ const showLegendFinal = showLegend ?? series.length > 1;
3772
+ return /* @__PURE__ */ jsx62(ChartCard, { state: effectiveState, ...cardProps, children: /* @__PURE__ */ jsx62(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs53(RechartsLineChart, { data, margin: { top: 8, right: 16, left: 0, bottom: 0 }, children: [
3773
+ showGrid && /* @__PURE__ */ jsx62(
3774
+ CartesianGrid,
3775
+ {
3776
+ vertical: false,
3777
+ stroke: aegisChartTheme.grid.stroke,
3778
+ strokeDasharray: aegisChartTheme.grid.strokeDasharray
3779
+ }
3780
+ ),
3781
+ /* @__PURE__ */ jsx62(
3782
+ XAxis,
3783
+ {
3784
+ dataKey: xKey,
3785
+ stroke: aegisChartTheme.axis.stroke,
3786
+ tick: { fill: aegisChartTheme.axis.tickColor, fontSize: aegisChartTheme.axis.fontSize },
3787
+ tickLine: false,
3788
+ axisLine: { stroke: aegisChartTheme.grid.stroke }
3789
+ }
3790
+ ),
3791
+ /* @__PURE__ */ jsx62(
3792
+ YAxis,
3793
+ {
3794
+ stroke: aegisChartTheme.axis.stroke,
3795
+ tick: { fill: aegisChartTheme.axis.tickColor, fontSize: aegisChartTheme.axis.fontSize },
3796
+ tickLine: false,
3797
+ axisLine: false,
3798
+ tickFormatter: (v) => valueFormatter(v),
3799
+ width: 48
3800
+ }
3801
+ ),
3802
+ /* @__PURE__ */ jsx62(
3803
+ Tooltip2,
3804
+ {
3805
+ cursor: { stroke: aegisChartTheme.grid.stroke, strokeWidth: 1 },
3806
+ content: /* @__PURE__ */ jsx62(ChartTooltip, { valueFormatter })
3807
+ }
3808
+ ),
3809
+ showLegendFinal && /* @__PURE__ */ jsx62(Legend, { content: /* @__PURE__ */ jsx62(ChartLegend, {}) }),
3810
+ referenceLines?.map((ref, i) => /* @__PURE__ */ jsx62(
3811
+ ReferenceLine,
3812
+ {
3813
+ y: ref.value,
3814
+ stroke: aegisChartTheme.reference.stroke,
3815
+ strokeDasharray: aegisChartTheme.reference.strokeDasharray,
3816
+ label: ref.label ? {
3817
+ value: ref.label,
3818
+ position: "insideTopRight",
3819
+ fill: aegisChartTheme.tooltip.muted,
3820
+ fontSize: 11
3821
+ } : void 0
3822
+ },
3823
+ `ref-${i}`
3824
+ )),
3825
+ series.map((s, index) => {
3826
+ const color = getSeriesColor(index, s.color);
3827
+ return /* @__PURE__ */ jsx62(
3828
+ Line,
3829
+ {
3830
+ type: smooth ? "monotone" : "linear",
3831
+ dataKey: s.dataKey,
3832
+ name: s.label ?? s.dataKey,
3833
+ stroke: color,
3834
+ strokeWidth: 2,
3835
+ dot: { r: 0, fill: color },
3836
+ activeDot: { r: 5, strokeWidth: 0 },
3837
+ isAnimationActive: false
3838
+ },
3839
+ s.dataKey
3840
+ );
3841
+ })
3842
+ ] }) }) });
3843
+ }
3844
+
3845
+ // src/charts/AreaChart.tsx
3846
+ import {
3847
+ Area,
3848
+ AreaChart as RechartsAreaChart,
3849
+ CartesianGrid as CartesianGrid2,
3850
+ Legend as Legend2,
3851
+ ReferenceLine as ReferenceLine2,
3852
+ ResponsiveContainer as ResponsiveContainer2,
3853
+ Tooltip as Tooltip3,
3854
+ XAxis as XAxis2,
3855
+ YAxis as YAxis2
3856
+ } from "recharts";
3857
+ import { jsx as jsx63, jsxs as jsxs54 } from "react/jsx-runtime";
3858
+ function AreaChart({
3859
+ data,
3860
+ xKey,
3861
+ series,
3862
+ height = 280,
3863
+ showLegend,
3864
+ showGrid = true,
3865
+ stacked = false,
3866
+ valueFormatter = defaultValueFormatter,
3867
+ referenceLines,
3868
+ state,
3869
+ ...cardProps
3870
+ }) {
3871
+ const effectiveState = state ?? (data.length === 0 ? "empty" : "ready");
3872
+ const showLegendFinal = showLegend ?? series.length > 1;
3873
+ return /* @__PURE__ */ jsx63(ChartCard, { state: effectiveState, ...cardProps, children: /* @__PURE__ */ jsx63(ResponsiveContainer2, { width: "100%", height, children: /* @__PURE__ */ jsxs54(RechartsAreaChart, { data, margin: { top: 8, right: 16, left: 0, bottom: 0 }, children: [
3874
+ /* @__PURE__ */ jsx63("defs", { children: series.map((s, index) => {
3875
+ const color = getSeriesColor(index, s.color);
3876
+ return /* @__PURE__ */ jsxs54(
3877
+ "linearGradient",
3878
+ {
3879
+ id: `aegis-area-${s.dataKey}`,
3880
+ x1: "0",
3881
+ y1: "0",
3882
+ x2: "0",
3883
+ y2: "1",
3884
+ children: [
3885
+ /* @__PURE__ */ jsx63("stop", { offset: "0%", stopColor: color, stopOpacity: 0.32 }),
3886
+ /* @__PURE__ */ jsx63("stop", { offset: "100%", stopColor: color, stopOpacity: 0.02 })
3887
+ ]
3888
+ },
3889
+ `grad-${s.dataKey}`
3890
+ );
3891
+ }) }),
3892
+ showGrid && /* @__PURE__ */ jsx63(
3893
+ CartesianGrid2,
3894
+ {
3895
+ vertical: false,
3896
+ stroke: aegisChartTheme.grid.stroke,
3897
+ strokeDasharray: aegisChartTheme.grid.strokeDasharray
3898
+ }
3899
+ ),
3900
+ /* @__PURE__ */ jsx63(
3901
+ XAxis2,
3902
+ {
3903
+ dataKey: xKey,
3904
+ stroke: aegisChartTheme.axis.stroke,
3905
+ tick: { fill: aegisChartTheme.axis.tickColor, fontSize: aegisChartTheme.axis.fontSize },
3906
+ tickLine: false,
3907
+ axisLine: { stroke: aegisChartTheme.grid.stroke }
3908
+ }
3909
+ ),
3910
+ /* @__PURE__ */ jsx63(
3911
+ YAxis2,
3912
+ {
3913
+ stroke: aegisChartTheme.axis.stroke,
3914
+ tick: { fill: aegisChartTheme.axis.tickColor, fontSize: aegisChartTheme.axis.fontSize },
3915
+ tickLine: false,
3916
+ axisLine: false,
3917
+ tickFormatter: (v) => valueFormatter(v),
3918
+ width: 48
3919
+ }
3920
+ ),
3921
+ /* @__PURE__ */ jsx63(
3922
+ Tooltip3,
3923
+ {
3924
+ cursor: { stroke: aegisChartTheme.grid.stroke, strokeWidth: 1 },
3925
+ content: /* @__PURE__ */ jsx63(ChartTooltip, { valueFormatter })
3926
+ }
3927
+ ),
3928
+ showLegendFinal && /* @__PURE__ */ jsx63(Legend2, { content: /* @__PURE__ */ jsx63(ChartLegend, {}) }),
3929
+ referenceLines?.map((ref, i) => /* @__PURE__ */ jsx63(
3930
+ ReferenceLine2,
3931
+ {
3932
+ y: ref.value,
3933
+ stroke: aegisChartTheme.reference.stroke,
3934
+ strokeDasharray: aegisChartTheme.reference.strokeDasharray,
3935
+ label: ref.label ? {
3936
+ value: ref.label,
3937
+ position: "insideTopRight",
3938
+ fill: aegisChartTheme.tooltip.muted,
3939
+ fontSize: 11
3940
+ } : void 0
3941
+ },
3942
+ `ref-${i}`
3943
+ )),
3944
+ series.map((s, index) => {
3945
+ const color = getSeriesColor(index, s.color);
3946
+ return /* @__PURE__ */ jsx63(
3947
+ Area,
3948
+ {
3949
+ type: "monotone",
3950
+ dataKey: s.dataKey,
3951
+ name: s.label ?? s.dataKey,
3952
+ stroke: color,
3953
+ strokeWidth: 2,
3954
+ fill: `url(#aegis-area-${s.dataKey})`,
3955
+ stackId: stacked ? "aegis-stack" : void 0,
3956
+ isAnimationActive: false,
3957
+ activeDot: { r: 5, strokeWidth: 0 }
3958
+ },
3959
+ s.dataKey
3960
+ );
3961
+ })
3962
+ ] }) }) });
3963
+ }
3964
+
3965
+ // src/charts/BarChart.tsx
3966
+ import {
3967
+ Bar,
3968
+ BarChart as RechartsBarChart,
3969
+ CartesianGrid as CartesianGrid3,
3970
+ Legend as Legend3,
3971
+ ReferenceLine as ReferenceLine3,
3972
+ ResponsiveContainer as ResponsiveContainer3,
3973
+ Tooltip as Tooltip4,
3974
+ XAxis as XAxis3,
3975
+ YAxis as YAxis3
3976
+ } from "recharts";
3977
+ import { Fragment as Fragment5, jsx as jsx64, jsxs as jsxs55 } from "react/jsx-runtime";
3978
+ function BarChart({
3979
+ data,
3980
+ xKey,
3981
+ series,
3982
+ height = 280,
3983
+ showLegend,
3984
+ showGrid = true,
3985
+ stacked = false,
3986
+ horizontal = false,
3987
+ valueFormatter = defaultValueFormatter,
3988
+ referenceLines,
3989
+ state,
3990
+ ...cardProps
3991
+ }) {
3992
+ const effectiveState = state ?? (data.length === 0 ? "empty" : "ready");
3993
+ const showLegendFinal = showLegend ?? series.length > 1;
3994
+ return /* @__PURE__ */ jsx64(ChartCard, { state: effectiveState, ...cardProps, children: /* @__PURE__ */ jsx64(ResponsiveContainer3, { width: "100%", height, children: /* @__PURE__ */ jsxs55(
3995
+ RechartsBarChart,
3996
+ {
3997
+ data,
3998
+ layout: horizontal ? "vertical" : "horizontal",
3999
+ margin: { top: 8, right: 16, left: 0, bottom: 0 },
4000
+ barCategoryGap: "22%",
4001
+ children: [
4002
+ showGrid && /* @__PURE__ */ jsx64(
4003
+ CartesianGrid3,
4004
+ {
4005
+ vertical: horizontal,
4006
+ horizontal: !horizontal,
4007
+ stroke: aegisChartTheme.grid.stroke,
4008
+ strokeDasharray: aegisChartTheme.grid.strokeDasharray
4009
+ }
4010
+ ),
4011
+ horizontal ? /* @__PURE__ */ jsxs55(Fragment5, { children: [
4012
+ /* @__PURE__ */ jsx64(
4013
+ XAxis3,
4014
+ {
4015
+ type: "number",
4016
+ stroke: aegisChartTheme.axis.stroke,
4017
+ tick: {
4018
+ fill: aegisChartTheme.axis.tickColor,
4019
+ fontSize: aegisChartTheme.axis.fontSize
4020
+ },
4021
+ tickLine: false,
4022
+ axisLine: false,
4023
+ tickFormatter: (v) => valueFormatter(v)
4024
+ }
4025
+ ),
4026
+ /* @__PURE__ */ jsx64(
4027
+ YAxis3,
4028
+ {
4029
+ type: "category",
4030
+ dataKey: xKey,
4031
+ stroke: aegisChartTheme.axis.stroke,
4032
+ tick: {
4033
+ fill: aegisChartTheme.axis.tickColor,
4034
+ fontSize: aegisChartTheme.axis.fontSize
4035
+ },
4036
+ tickLine: false,
4037
+ axisLine: { stroke: aegisChartTheme.grid.stroke },
4038
+ width: 96
4039
+ }
4040
+ )
4041
+ ] }) : /* @__PURE__ */ jsxs55(Fragment5, { children: [
4042
+ /* @__PURE__ */ jsx64(
4043
+ XAxis3,
4044
+ {
4045
+ dataKey: xKey,
4046
+ stroke: aegisChartTheme.axis.stroke,
4047
+ tick: {
4048
+ fill: aegisChartTheme.axis.tickColor,
4049
+ fontSize: aegisChartTheme.axis.fontSize
4050
+ },
4051
+ tickLine: false,
4052
+ axisLine: { stroke: aegisChartTheme.grid.stroke }
4053
+ }
4054
+ ),
4055
+ /* @__PURE__ */ jsx64(
4056
+ YAxis3,
4057
+ {
4058
+ stroke: aegisChartTheme.axis.stroke,
4059
+ tick: {
4060
+ fill: aegisChartTheme.axis.tickColor,
4061
+ fontSize: aegisChartTheme.axis.fontSize
4062
+ },
4063
+ tickLine: false,
4064
+ axisLine: false,
4065
+ tickFormatter: (v) => valueFormatter(v),
4066
+ width: 48
4067
+ }
4068
+ )
4069
+ ] }),
4070
+ /* @__PURE__ */ jsx64(
4071
+ Tooltip4,
4072
+ {
4073
+ cursor: { fill: "var(--aegis-state-hover-overlay)" },
4074
+ content: /* @__PURE__ */ jsx64(ChartTooltip, { valueFormatter })
4075
+ }
4076
+ ),
4077
+ showLegendFinal && /* @__PURE__ */ jsx64(Legend3, { content: /* @__PURE__ */ jsx64(ChartLegend, {}) }),
4078
+ referenceLines?.map((ref, i) => /* @__PURE__ */ jsx64(
4079
+ ReferenceLine3,
4080
+ {
4081
+ ...horizontal ? { x: ref.value } : { y: ref.value },
4082
+ stroke: aegisChartTheme.reference.stroke,
4083
+ strokeDasharray: aegisChartTheme.reference.strokeDasharray,
4084
+ label: ref.label ? {
4085
+ value: ref.label,
4086
+ position: "insideTopRight",
4087
+ fill: aegisChartTheme.tooltip.muted,
4088
+ fontSize: 11
4089
+ } : void 0
4090
+ },
4091
+ `ref-${i}`
4092
+ )),
4093
+ series.map((s, index) => {
4094
+ const color = getSeriesColor(index, s.color);
4095
+ return /* @__PURE__ */ jsx64(
4096
+ Bar,
4097
+ {
4098
+ dataKey: s.dataKey,
4099
+ name: s.label ?? s.dataKey,
4100
+ fill: color,
4101
+ radius: [4, 4, 0, 0],
4102
+ stackId: stacked ? "aegis-stack" : void 0,
4103
+ isAnimationActive: false
4104
+ },
4105
+ s.dataKey
4106
+ );
4107
+ })
4108
+ ]
4109
+ }
4110
+ ) }) });
4111
+ }
4112
+
4113
+ // src/charts/StackedBarChart.tsx
4114
+ import { jsx as jsx65 } from "react/jsx-runtime";
4115
+ function StackedBarChart(props) {
4116
+ return /* @__PURE__ */ jsx65(BarChart, { ...props, stacked: true });
4117
+ }
4118
+
4119
+ // src/charts/DonutChart.tsx
4120
+ import { Cell, Pie, PieChart as RechartsPieChart, ResponsiveContainer as ResponsiveContainer4, Tooltip as Tooltip5 } from "recharts";
4121
+
4122
+ // src/charts/DonutChart.module.css
4123
+ var DonutChart_default = {};
4124
+
4125
+ // src/charts/DonutChart.tsx
4126
+ import { jsx as jsx66, jsxs as jsxs56 } from "react/jsx-runtime";
4127
+ function DonutChart({
4128
+ data,
4129
+ centerLabel,
4130
+ centerSublabel,
4131
+ variant = "donut",
4132
+ height = 280,
4133
+ valueFormatter = defaultValueFormatter,
4134
+ showLegend = true,
4135
+ state,
4136
+ ...cardProps
4137
+ }) {
4138
+ const effectiveState = state ?? (data.length === 0 ? "empty" : "ready");
4139
+ const total = data.reduce((sum, d) => sum + d.value, 0);
4140
+ return /* @__PURE__ */ jsx66(ChartCard, { state: effectiveState, ...cardProps, children: /* @__PURE__ */ jsxs56("div", { className: DonutChart_default.layout, children: [
4141
+ /* @__PURE__ */ jsxs56("div", { className: DonutChart_default.chartWrap, style: { height }, children: [
4142
+ /* @__PURE__ */ jsx66(ResponsiveContainer4, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs56(RechartsPieChart, { children: [
4143
+ /* @__PURE__ */ jsx66(
4144
+ Pie,
4145
+ {
4146
+ data,
4147
+ dataKey: "value",
4148
+ nameKey: "name",
4149
+ cx: "50%",
4150
+ cy: "50%",
4151
+ innerRadius: variant === "donut" ? "64%" : 0,
4152
+ outerRadius: "92%",
4153
+ paddingAngle: variant === "donut" ? 2 : 0,
4154
+ stroke: "var(--aegis-color-surface-default)",
4155
+ strokeWidth: 2,
4156
+ isAnimationActive: false,
4157
+ children: data.map((entry, index) => /* @__PURE__ */ jsx66(Cell, { fill: getSeriesColor(index, entry.color) }, `cell-${index}`))
4158
+ }
4159
+ ),
4160
+ /* @__PURE__ */ jsx66(Tooltip5, { content: /* @__PURE__ */ jsx66(ChartTooltip, { valueFormatter }) })
4161
+ ] }) }),
4162
+ variant === "donut" && (centerLabel || centerSublabel) && /* @__PURE__ */ jsxs56("div", { className: DonutChart_default.center, "aria-hidden": "true", children: [
4163
+ centerLabel && /* @__PURE__ */ jsx66("div", { className: DonutChart_default.centerLabel, children: centerLabel }),
4164
+ centerSublabel && /* @__PURE__ */ jsx66("div", { className: DonutChart_default.centerSub, children: centerSublabel })
4165
+ ] })
4166
+ ] }),
4167
+ showLegend && /* @__PURE__ */ jsx66("ul", { className: DonutChart_default.legend, children: data.map((entry, index) => {
4168
+ const color = getSeriesColor(index, entry.color);
4169
+ const pct = total > 0 ? entry.value / total * 100 : 0;
4170
+ return /* @__PURE__ */ jsxs56("li", { className: DonutChart_default.legendItem, children: [
4171
+ /* @__PURE__ */ jsx66(
4172
+ "span",
4173
+ {
4174
+ className: DonutChart_default.swatch,
4175
+ style: { backgroundColor: color },
4176
+ "aria-hidden": "true"
4177
+ }
4178
+ ),
4179
+ /* @__PURE__ */ jsx66("span", { className: DonutChart_default.legendLabel, children: entry.name }),
4180
+ /* @__PURE__ */ jsxs56("span", { className: DonutChart_default.legendValue, children: [
4181
+ valueFormatter(entry.value),
4182
+ /* @__PURE__ */ jsxs56("span", { className: DonutChart_default.legendPct, children: [
4183
+ pct.toFixed(0),
4184
+ "%"
4185
+ ] })
4186
+ ] })
4187
+ ] }, `${entry.name}-${index}`);
4188
+ }) })
4189
+ ] }) });
4190
+ }
4191
+
4192
+ // src/charts/Sparkline.tsx
4193
+ import {
4194
+ Area as Area2,
4195
+ AreaChart as AreaChart2,
4196
+ Line as Line2,
4197
+ LineChart as LineChart2,
4198
+ ResponsiveContainer as ResponsiveContainer5
4199
+ } from "recharts";
4200
+ import { jsx as jsx67, jsxs as jsxs57 } from "react/jsx-runtime";
4201
+ function Sparkline({
4202
+ data,
4203
+ dataKey = "value",
4204
+ variant = "line",
4205
+ width = 120,
4206
+ height = 36,
4207
+ color,
4208
+ strokeWidth = 2,
4209
+ ariaLabel
4210
+ }) {
4211
+ const normalized = typeof data[0] === "number" ? data.map((v, i) => ({ x: i, [dataKey]: v })) : data;
4212
+ const stroke = getSeriesColor(0, color);
4213
+ const gradientId = `aegis-spark-${dataKey}-${Math.random().toString(36).slice(2, 8)}`;
4214
+ return /* @__PURE__ */ jsx67(
4215
+ "div",
4216
+ {
4217
+ style: { width, height, display: "inline-block" },
4218
+ role: ariaLabel ? "img" : void 0,
4219
+ "aria-label": ariaLabel,
4220
+ children: /* @__PURE__ */ jsx67(ResponsiveContainer5, { width: "100%", height: "100%", children: variant === "area" ? /* @__PURE__ */ jsxs57(AreaChart2, { data: normalized, margin: { top: 2, right: 2, left: 2, bottom: 2 }, children: [
4221
+ /* @__PURE__ */ jsx67("defs", { children: /* @__PURE__ */ jsxs57("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
4222
+ /* @__PURE__ */ jsx67("stop", { offset: "0%", stopColor: stroke, stopOpacity: 0.32 }),
4223
+ /* @__PURE__ */ jsx67("stop", { offset: "100%", stopColor: stroke, stopOpacity: 0 })
4224
+ ] }) }),
4225
+ /* @__PURE__ */ jsx67(
4226
+ Area2,
4227
+ {
4228
+ type: "monotone",
4229
+ dataKey,
4230
+ stroke,
4231
+ strokeWidth,
4232
+ fill: `url(#${gradientId})`,
4233
+ isAnimationActive: false,
4234
+ dot: false
4235
+ }
4236
+ )
4237
+ ] }) : /* @__PURE__ */ jsx67(LineChart2, { data: normalized, margin: { top: 2, right: 2, left: 2, bottom: 2 }, children: /* @__PURE__ */ jsx67(
4238
+ Line2,
4239
+ {
4240
+ type: "monotone",
4241
+ dataKey,
4242
+ stroke,
4243
+ strokeWidth,
4244
+ dot: false,
4245
+ isAnimationActive: false
4246
+ }
4247
+ ) }) })
4248
+ }
4249
+ );
4250
+ }
4251
+
4252
+ // src/charts/KpiStatCard.module.css
4253
+ var KpiStatCard_default = {};
4254
+
4255
+ // src/charts/KpiStatCard.tsx
4256
+ import { jsx as jsx68, jsxs as jsxs58 } from "react/jsx-runtime";
4257
+ function inferTrend(change) {
4258
+ if (change == null || change === 0) return "neutral";
4259
+ return change > 0 ? "up" : "down";
4260
+ }
4261
+ var trendIcons2 = {
4262
+ up: /* @__PURE__ */ jsx68("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx68("path", { d: "M3 11l5-6 5 6H3z" }) }),
4263
+ down: /* @__PURE__ */ jsx68("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx68("path", { d: "M3 5l5 6 5-6H3z" }) }),
4264
+ neutral: /* @__PURE__ */ jsx68("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx68("path", { d: "M3 7h10v2H3z" }) })
4265
+ };
4266
+ function KpiStatCard({
4267
+ label,
4268
+ value,
4269
+ unit,
4270
+ change,
4271
+ changeLabel,
4272
+ trend,
4273
+ inverse = false,
4274
+ icon,
4275
+ sparklineData,
4276
+ sparklineColor,
4277
+ sparklineVariant = "area",
4278
+ density = "comfortable",
4279
+ className,
4280
+ ...props
4281
+ }) {
4282
+ const direction = trend ?? inferTrend(change);
4283
+ const semantic2 = inverse && direction === "up" ? "down" : inverse && direction === "down" ? "up" : direction;
4284
+ const formattedChange = change !== void 0 ? `${change > 0 ? "+" : ""}${change}%` : void 0;
4285
+ return /* @__PURE__ */ jsxs58("div", { className: cn(KpiStatCard_default.card, KpiStatCard_default[density], className), ...props, children: [
4286
+ /* @__PURE__ */ jsxs58("div", { className: KpiStatCard_default.header, children: [
4287
+ /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.label, children: label }),
4288
+ icon && /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.icon, "aria-hidden": "true", children: icon })
4289
+ ] }),
4290
+ /* @__PURE__ */ jsxs58("div", { className: KpiStatCard_default.valueRow, children: [
4291
+ /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.value, children: value }),
4292
+ unit && /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.unit, children: unit })
4293
+ ] }),
4294
+ (formattedChange || sparklineData) && /* @__PURE__ */ jsxs58("div", { className: KpiStatCard_default.footer, children: [
4295
+ formattedChange && /* @__PURE__ */ jsxs58("div", { className: cn(KpiStatCard_default.trend, KpiStatCard_default[semantic2]), children: [
4296
+ /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.trendIcon, children: trendIcons2[direction] }),
4297
+ /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.trendValue, children: formattedChange }),
4298
+ changeLabel && /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.changeLabel, children: changeLabel }),
4299
+ /* @__PURE__ */ jsx68("span", { className: KpiStatCard_default.srOnly, children: direction === "up" ? "increase" : direction === "down" ? "decrease" : "no change" })
4300
+ ] }),
4301
+ sparklineData && /* @__PURE__ */ jsx68("div", { className: KpiStatCard_default.sparkSlot, children: /* @__PURE__ */ jsx68(
4302
+ Sparkline,
4303
+ {
4304
+ data: sparklineData,
4305
+ color: sparklineColor,
4306
+ variant: sparklineVariant,
4307
+ width: "100%",
4308
+ height: 40,
4309
+ ariaLabel: `${label} trend`
4310
+ }
4311
+ ) })
4312
+ ] })
4313
+ ] });
4314
+ }
4315
+
4316
+ // src/charts/TrendStatCard.tsx
4317
+ import {
4318
+ Area as Area3,
4319
+ AreaChart as AreaChart3,
4320
+ ResponsiveContainer as ResponsiveContainer6,
4321
+ Tooltip as Tooltip6,
4322
+ XAxis as XAxis4,
4323
+ YAxis as YAxis4
4324
+ } from "recharts";
4325
+
4326
+ // src/charts/TrendStatCard.module.css
4327
+ var TrendStatCard_default = {};
4328
+
4329
+ // src/charts/TrendStatCard.tsx
4330
+ import { jsx as jsx69, jsxs as jsxs59 } from "react/jsx-runtime";
4331
+ function inferTrend2(change) {
4332
+ if (change == null || change === 0) return "neutral";
4333
+ return change > 0 ? "up" : "down";
4334
+ }
4335
+ var trendIcons3 = {
4336
+ up: /* @__PURE__ */ jsx69("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx69("path", { d: "M3 11l5-6 5 6H3z" }) }),
4337
+ down: /* @__PURE__ */ jsx69("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx69("path", { d: "M3 5l5 6 5-6H3z" }) }),
4338
+ neutral: /* @__PURE__ */ jsx69("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx69("path", { d: "M3 7h10v2H3z" }) })
4339
+ };
4340
+ function TrendStatCard({
4341
+ label,
4342
+ value,
4343
+ unit,
4344
+ data,
4345
+ xKey,
4346
+ yKey,
4347
+ change,
4348
+ changeLabel,
4349
+ inverse = false,
4350
+ color,
4351
+ valueFormatter = defaultValueFormatter,
4352
+ chartHeight = 80,
4353
+ className,
4354
+ ...props
4355
+ }) {
4356
+ const direction = inferTrend2(change);
4357
+ const semantic2 = inverse && direction === "up" ? "down" : inverse && direction === "down" ? "up" : direction;
4358
+ const stroke = getSeriesColor(0, color);
4359
+ const formattedChange = change !== void 0 ? `${change > 0 ? "+" : ""}${change}%` : void 0;
4360
+ const gradientId = `trend-stat-${String(yKey)}-${Math.random().toString(36).slice(2, 8)}`;
4361
+ return /* @__PURE__ */ jsxs59("div", { className: cn(TrendStatCard_default.card, className), ...props, children: [
4362
+ /* @__PURE__ */ jsxs59("div", { className: TrendStatCard_default.header, children: [
4363
+ /* @__PURE__ */ jsx69("span", { className: TrendStatCard_default.label, children: label }),
4364
+ formattedChange && /* @__PURE__ */ jsxs59("span", { className: cn(TrendStatCard_default.chip, TrendStatCard_default[semantic2]), children: [
4365
+ trendIcons3[direction],
4366
+ /* @__PURE__ */ jsx69("span", { children: formattedChange })
4367
+ ] })
4368
+ ] }),
4369
+ /* @__PURE__ */ jsxs59("div", { className: TrendStatCard_default.valueRow, children: [
4370
+ /* @__PURE__ */ jsx69("span", { className: TrendStatCard_default.value, children: value }),
4371
+ unit && /* @__PURE__ */ jsx69("span", { className: TrendStatCard_default.unit, children: unit })
4372
+ ] }),
4373
+ changeLabel && /* @__PURE__ */ jsx69("div", { className: TrendStatCard_default.changeLabel, children: changeLabel }),
4374
+ /* @__PURE__ */ jsx69("div", { className: TrendStatCard_default.chartWrap, style: { height: chartHeight }, children: /* @__PURE__ */ jsx69(ResponsiveContainer6, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs59(AreaChart3, { data, margin: { top: 4, right: 0, left: 0, bottom: 0 }, children: [
4375
+ /* @__PURE__ */ jsx69("defs", { children: /* @__PURE__ */ jsxs59("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
4376
+ /* @__PURE__ */ jsx69("stop", { offset: "0%", stopColor: stroke, stopOpacity: 0.32 }),
4377
+ /* @__PURE__ */ jsx69("stop", { offset: "100%", stopColor: stroke, stopOpacity: 0 })
4378
+ ] }) }),
4379
+ /* @__PURE__ */ jsx69(XAxis4, { dataKey: xKey, hide: true }),
4380
+ /* @__PURE__ */ jsx69(YAxis4, { hide: true }),
4381
+ /* @__PURE__ */ jsx69(Tooltip6, { content: /* @__PURE__ */ jsx69(ChartTooltip, { valueFormatter }) }),
4382
+ /* @__PURE__ */ jsx69(
4383
+ Area3,
4384
+ {
4385
+ type: "monotone",
4386
+ dataKey: yKey,
4387
+ stroke,
4388
+ strokeWidth: 2,
4389
+ fill: `url(#${gradientId})`,
4390
+ isAnimationActive: false,
4391
+ dot: false
4392
+ }
4393
+ )
4394
+ ] }) }) })
4395
+ ] });
4396
+ }
3580
4397
  export {
3581
4398
  Accordion,
3582
4399
  Alert,
3583
4400
  AppointmentCard,
4401
+ AreaChart,
3584
4402
  Autocomplete,
3585
4403
  Avatar,
3586
4404
  Badge,
3587
4405
  Banner,
4406
+ BarChart,
3588
4407
  Breadcrumbs,
3589
4408
  Button,
3590
4409
  Card,
4410
+ ChartCard,
4411
+ ChartLegend,
4412
+ ChartTooltip,
3591
4413
  Checkbox,
3592
4414
  CheckboxGroup,
3593
4415
  ClinicalBanner,
@@ -3597,6 +4419,7 @@ export {
3597
4419
  DatePicker,
3598
4420
  DescriptionList,
3599
4421
  Divider,
4422
+ DonutChart,
3600
4423
  Drawer,
3601
4424
  EmptyState,
3602
4425
  FileUpload,
@@ -3605,8 +4428,10 @@ export {
3605
4428
  IconButton,
3606
4429
  Input,
3607
4430
  InsuranceCard,
4431
+ KpiStatCard,
3608
4432
  LabResultRow,
3609
4433
  Label,
4434
+ LineChart,
3610
4435
  List,
3611
4436
  ListItem,
3612
4437
  MedicationRow,
@@ -3625,7 +4450,9 @@ export {
3625
4450
  SideNav,
3626
4451
  Skeleton,
3627
4452
  Slider,
4453
+ Sparkline,
3628
4454
  Spinner,
4455
+ StackedBarChart,
3629
4456
  StatCard,
3630
4457
  StatusBadge,
3631
4458
  Stepper,
@@ -3642,7 +4469,10 @@ export {
3642
4469
  Toast,
3643
4470
  Tooltip,
3644
4471
  TopNav,
4472
+ TrendStatCard,
3645
4473
  accentTeal,
4474
+ aegisChartTheme,
4475
+ aegisSeriesPalette,
3646
4476
  border,
3647
4477
  borderStyle,
3648
4478
  borderWidth,
@@ -3651,12 +4481,14 @@ export {
3651
4481
  container,
3652
4482
  controlSize,
3653
4483
  dataVis,
4484
+ defaultValueFormatter,
3654
4485
  duration,
3655
4486
  easing,
3656
4487
  focusRing,
3657
4488
  fontFamily,
3658
4489
  fontSize,
3659
4490
  fontWeight,
4491
+ getSeriesColor,
3660
4492
  grid,
3661
4493
  iconSize,
3662
4494
  lineHeight,