@tribepad/themis 1.0.17 → 1.0.19
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/elements/Accordion/Accordion.d.ts +3 -1
- package/dist/elements/Accordion/Accordion.d.ts.map +1 -1
- package/dist/elements/Accordion/index.js +1 -1
- package/dist/elements/Accordion/index.js.map +1 -1
- package/dist/elements/Accordion/index.mjs +1 -1
- package/dist/elements/Accordion/index.mjs.map +1 -1
- package/dist/elements/AlertDialog/index.js +1 -1
- package/dist/elements/AlertDialog/index.js.map +1 -1
- package/dist/elements/AlertDialog/index.mjs +1 -1
- package/dist/elements/AlertDialog/index.mjs.map +1 -1
- package/dist/elements/Breadcrumbs/index.js +1 -1
- package/dist/elements/Breadcrumbs/index.js.map +1 -1
- package/dist/elements/Breadcrumbs/index.mjs +1 -1
- package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
- package/dist/elements/Button/Button.d.ts.map +1 -1
- package/dist/elements/Button/index.js +1 -1
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Button/index.mjs +1 -1
- package/dist/elements/Button/index.mjs.map +1 -1
- package/dist/elements/Card/Card.d.ts +21 -1
- package/dist/elements/Card/Card.d.ts.map +1 -1
- package/dist/elements/Card/Card.types.d.ts +36 -0
- package/dist/elements/Card/Card.types.d.ts.map +1 -1
- package/dist/elements/Card/index.d.ts +10 -3
- package/dist/elements/Card/index.d.ts.map +1 -1
- package/dist/elements/Card/index.js +1 -1
- package/dist/elements/Card/index.js.map +1 -1
- package/dist/elements/Card/index.mjs +1 -1
- package/dist/elements/Card/index.mjs.map +1 -1
- package/dist/elements/Carousel/Carousel.d.ts.map +1 -1
- package/dist/elements/Carousel/index.js +1 -1
- package/dist/elements/Carousel/index.js.map +1 -1
- package/dist/elements/Carousel/index.mjs +1 -1
- package/dist/elements/Carousel/index.mjs.map +1 -1
- package/dist/elements/Chart/Chart.d.ts.map +1 -1
- package/dist/elements/Chart/Chart.types.d.ts +21 -4
- package/dist/elements/Chart/Chart.types.d.ts.map +1 -1
- package/dist/elements/Chart/ChartAreaSeries.d.ts +32 -0
- package/dist/elements/Chart/ChartAreaSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartContext.d.ts +4 -1
- package/dist/elements/Chart/ChartContext.d.ts.map +1 -1
- package/dist/elements/Chart/ChartLegend.d.ts +2 -2
- package/dist/elements/Chart/ChartLegend.d.ts.map +1 -1
- package/dist/elements/Chart/ChartPieSeries.d.ts +28 -0
- package/dist/elements/Chart/ChartPieSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartRadarSeries.d.ts +28 -0
- package/dist/elements/Chart/ChartRadarSeries.d.ts.map +1 -0
- package/dist/elements/Chart/ChartSVG.d.ts +7 -1
- package/dist/elements/Chart/ChartSVG.d.ts.map +1 -1
- package/dist/elements/Chart/ChartScatterSeries.d.ts +31 -0
- package/dist/elements/Chart/ChartScatterSeries.d.ts.map +1 -0
- package/dist/elements/Chart/index.js +1 -1
- package/dist/elements/Chart/index.js.map +1 -1
- package/dist/elements/Chart/index.mjs +1 -1
- package/dist/elements/Chart/index.mjs.map +1 -1
- package/dist/elements/Checkbox/index.js +1 -1
- package/dist/elements/Checkbox/index.js.map +1 -1
- package/dist/elements/Checkbox/index.mjs +1 -1
- package/dist/elements/Checkbox/index.mjs.map +1 -1
- package/dist/elements/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/elements/ColorPicker/ColorPicker.styles.d.ts +3 -1
- package/dist/elements/ColorPicker/ColorPicker.styles.d.ts.map +1 -1
- package/dist/elements/ColorPicker/index.js +1 -1
- package/dist/elements/ColorPicker/index.js.map +1 -1
- package/dist/elements/ColorPicker/index.mjs +1 -1
- package/dist/elements/ColorPicker/index.mjs.map +1 -1
- package/dist/elements/Combobox/Combobox.d.ts +1 -1
- package/dist/elements/Combobox/Combobox.d.ts.map +1 -1
- package/dist/elements/Combobox/Combobox.styles.d.ts.map +1 -1
- package/dist/elements/Combobox/index.js +1 -1
- package/dist/elements/Combobox/index.js.map +1 -1
- package/dist/elements/Combobox/index.mjs +1 -1
- package/dist/elements/Combobox/index.mjs.map +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/index.js +1 -1
- package/dist/elements/DatePicker/index.js.map +1 -1
- package/dist/elements/DatePicker/index.mjs +1 -1
- package/dist/elements/DatePicker/index.mjs.map +1 -1
- package/dist/elements/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/elements/Dropdown/index.js +1 -1
- package/dist/elements/Dropdown/index.js.map +1 -1
- package/dist/elements/Dropdown/index.mjs +1 -1
- package/dist/elements/Dropdown/index.mjs.map +1 -1
- package/dist/elements/FileField/index.js +1 -1
- package/dist/elements/FileField/index.js.map +1 -1
- package/dist/elements/FileField/index.mjs +1 -1
- package/dist/elements/FileField/index.mjs.map +1 -1
- package/dist/elements/Modal/Modal.d.ts +2 -1
- package/dist/elements/Modal/Modal.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -1
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Modal/index.mjs +1 -1
- package/dist/elements/Modal/index.mjs.map +1 -1
- package/dist/elements/NumberField/NumberField.d.ts.map +1 -1
- package/dist/elements/NumberField/NumberField.types.d.ts +1 -1
- package/dist/elements/NumberField/NumberField.variants.d.ts.map +1 -1
- package/dist/elements/NumberField/index.js +1 -1
- package/dist/elements/NumberField/index.js.map +1 -1
- package/dist/elements/NumberField/index.mjs +1 -1
- package/dist/elements/NumberField/index.mjs.map +1 -1
- package/dist/elements/OTPInput/index.js +1 -1
- package/dist/elements/OTPInput/index.js.map +1 -1
- package/dist/elements/OTPInput/index.mjs +1 -1
- package/dist/elements/OTPInput/index.mjs.map +1 -1
- package/dist/elements/Pagination/index.js +1 -1
- package/dist/elements/Pagination/index.js.map +1 -1
- package/dist/elements/Pagination/index.mjs +1 -1
- package/dist/elements/Pagination/index.mjs.map +1 -1
- package/dist/elements/Panel/index.js +1 -1
- package/dist/elements/Panel/index.js.map +1 -1
- package/dist/elements/Panel/index.mjs +1 -1
- package/dist/elements/Panel/index.mjs.map +1 -1
- package/dist/elements/PasswordField/index.js +1 -1
- package/dist/elements/PasswordField/index.js.map +1 -1
- package/dist/elements/PasswordField/index.mjs +1 -1
- package/dist/elements/PasswordField/index.mjs.map +1 -1
- package/dist/elements/Progress/index.js +1 -1
- package/dist/elements/Progress/index.js.map +1 -1
- package/dist/elements/Progress/index.mjs +1 -1
- package/dist/elements/Progress/index.mjs.map +1 -1
- package/dist/elements/RatingScale/index.js +1 -1
- package/dist/elements/RatingScale/index.js.map +1 -1
- package/dist/elements/RatingScale/index.mjs +1 -1
- package/dist/elements/RatingScale/index.mjs.map +1 -1
- package/dist/elements/Resizable/index.js +1 -1
- package/dist/elements/Resizable/index.js.map +1 -1
- package/dist/elements/Resizable/index.mjs +1 -1
- package/dist/elements/Resizable/index.mjs.map +1 -1
- package/dist/elements/SearchField/index.js +1 -1
- package/dist/elements/SearchField/index.js.map +1 -1
- package/dist/elements/SearchField/index.mjs +1 -1
- package/dist/elements/SearchField/index.mjs.map +1 -1
- package/dist/elements/Select/Select.d.ts.map +1 -1
- package/dist/elements/Select/Select.styles.d.ts.map +1 -1
- package/dist/elements/Select/index.js +1 -1
- package/dist/elements/Select/index.js.map +1 -1
- package/dist/elements/Select/index.mjs +1 -1
- package/dist/elements/Select/index.mjs.map +1 -1
- package/dist/elements/SituationalJudgement/index.js +1 -1
- package/dist/elements/SituationalJudgement/index.js.map +1 -1
- package/dist/elements/SituationalJudgement/index.mjs +1 -1
- package/dist/elements/SituationalJudgement/index.mjs.map +1 -1
- package/dist/elements/Table/index.js +1 -1
- package/dist/elements/Table/index.js.map +1 -1
- package/dist/elements/Table/index.mjs +1 -1
- package/dist/elements/Table/index.mjs.map +1 -1
- package/dist/elements/Tabs/index.js +1 -1
- package/dist/elements/Tabs/index.js.map +1 -1
- package/dist/elements/Tabs/index.mjs +1 -1
- package/dist/elements/Tabs/index.mjs.map +1 -1
- package/dist/elements/TextField/TextField.d.ts.map +1 -1
- package/dist/elements/TextField/TextField.styles.d.ts.map +1 -1
- package/dist/elements/TextField/index.js +1 -1
- package/dist/elements/TextField/index.js.map +1 -1
- package/dist/elements/TextField/index.mjs +1 -1
- package/dist/elements/TextField/index.mjs.map +1 -1
- package/dist/elements/TimeField/TimeField.d.ts.map +1 -1
- package/dist/elements/TimeField/TimeField.types.d.ts.map +1 -1
- package/dist/elements/TimeField/index.js +1 -1
- package/dist/elements/TimeField/index.js.map +1 -1
- package/dist/elements/TimeField/index.mjs +1 -1
- package/dist/elements/TimeField/index.mjs.map +1 -1
- package/dist/elements/Toast/Toast.d.ts +21 -43
- package/dist/elements/Toast/Toast.d.ts.map +1 -1
- package/dist/elements/Toast/Toast.types.d.ts +27 -1
- package/dist/elements/Toast/Toast.types.d.ts.map +1 -1
- package/dist/elements/Toast/Toaster.d.ts +0 -12
- package/dist/elements/Toast/Toaster.d.ts.map +1 -1
- package/dist/elements/Toast/index.d.ts +1 -1
- package/dist/elements/Toast/index.d.ts.map +1 -1
- package/dist/elements/Toast/index.js +1 -1
- package/dist/elements/Toast/index.js.map +1 -1
- package/dist/elements/Toast/index.mjs +1 -1
- package/dist/elements/Toast/index.mjs.map +1 -1
- package/dist/elements/Tooltip/index.js +1 -1
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/Tooltip/index.mjs +1 -1
- package/dist/elements/Tooltip/index.mjs.map +1 -1
- package/dist/elements/index.d.ts +1 -1
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles/animations.css +110 -0
- package/dist/styles/defaults.css +32 -0
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/index.mjs +1 -1
- package/dist/styles/index.mjs.map +1 -1
- package/dist/styles/shared-variants.d.ts +21 -2
- package/dist/styles/shared-variants.d.ts.map +1 -1
- package/package.json +35 -34
- package/src/elements/Chart/Chart.stories.tsx +186 -2
- package/src/elements/Modal/Modal.stories.tsx +6 -9
- package/src/elements/Toast/Toast.stories.tsx +745 -648
|
@@ -48,6 +48,12 @@ export interface ChartSVGProps {
|
|
|
48
48
|
onPointHover: (seriesIndex: number, pointIndex: number) => void;
|
|
49
49
|
/** Point hover end handler */
|
|
50
50
|
onPointHoverEnd: () => void;
|
|
51
|
+
/** Stack area series (area charts only) */
|
|
52
|
+
stacked?: boolean;
|
|
53
|
+
/** Inner radius for pie/donut */
|
|
54
|
+
innerRadius?: number;
|
|
55
|
+
/** Point size for scatter */
|
|
56
|
+
pointSize?: number;
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* ChartSVG - Main SVG container
|
|
@@ -55,7 +61,7 @@ export interface ChartSVGProps {
|
|
|
55
61
|
* Sets up the SVG with proper accessibility attributes and
|
|
56
62
|
* composes the grid, axes, and data series.
|
|
57
63
|
*/
|
|
58
|
-
export declare function ChartSVG({ type, data, dimensions, scales, titleId, descId, showGrid, xAxisLabel, yAxisLabel, getSeriesColor, getTabIndex, selectedPoint, formatValue, onKeyDown, onPointFocus, onPointBlur, onPointHover, onPointHoverEnd, }: ChartSVGProps): ReactElement;
|
|
64
|
+
export declare function ChartSVG({ type, data, dimensions, scales, titleId, descId, showGrid, xAxisLabel, yAxisLabel, getSeriesColor, getTabIndex, selectedPoint, formatValue, onKeyDown, onPointFocus, onPointBlur, onPointHover, onPointHoverEnd, stacked, innerRadius, pointSize, }: ChartSVGProps): ReactElement;
|
|
59
65
|
export declare namespace ChartSVG {
|
|
60
66
|
var displayName: string;
|
|
61
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartSVG.d.ts","sourceRoot":"","sources":["../../../src/elements/Chart/ChartSVG.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChartSVG.d.ts","sourceRoot":"","sources":["../../../src/elements/Chart/ChartSVG.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAS9D,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,SAAS,EAEV,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,aAAa;IAC5B,iBAAiB;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,wBAAwB;IACxB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,wBAAwB;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,+BAA+B;IAC/B,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,qBAAqB;IACrB,aAAa,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD,sBAAsB;IACtB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,6BAA6B;IAC7B,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,0BAA0B;IAC1B,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,yBAAyB;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0BAA0B;IAC1B,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,8BAA8B;IAC9B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,OAAe,EACf,WAAe,EACf,SAAa,GACd,EAAE,aAAa,GAAG,YAAY,CAgL9B;yBAtMe,QAAQ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChartScatterSeries Component
|
|
3
|
+
*
|
|
4
|
+
* Renders scatter plot points. Uses the categorical X-axis (label index)
|
|
5
|
+
* for positioning — each label is treated as an X category.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactElement, type KeyboardEvent } from 'react';
|
|
8
|
+
import type { DataSeries, ScaleInfo } from './Chart.types';
|
|
9
|
+
export interface ChartScatterSeriesProps {
|
|
10
|
+
series: DataSeries;
|
|
11
|
+
seriesIndex: number;
|
|
12
|
+
scales: ScaleInfo;
|
|
13
|
+
color: string;
|
|
14
|
+
pointSize: number;
|
|
15
|
+
getTabIndex: (seriesIndex: number, pointIndex: number) => 0 | -1;
|
|
16
|
+
selectedPoint: {
|
|
17
|
+
series: number;
|
|
18
|
+
point: number;
|
|
19
|
+
} | null;
|
|
20
|
+
onPointFocus?: (seriesIndex: number, pointIndex: number) => void;
|
|
21
|
+
onPointBlur?: () => void;
|
|
22
|
+
onPointHover?: (seriesIndex: number, pointIndex: number) => void;
|
|
23
|
+
onPointHoverEnd?: () => void;
|
|
24
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
25
|
+
formatValue: (value: number) => string;
|
|
26
|
+
}
|
|
27
|
+
export declare function ChartScatterSeries({ series, seriesIndex, scales, color, pointSize: _pointSize, getTabIndex, selectedPoint, onPointFocus, onPointBlur, onPointHover, onPointHoverEnd, onKeyDown, formatValue, }: ChartScatterSeriesProps): ReactElement;
|
|
28
|
+
export declare namespace ChartScatterSeries {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ChartScatterSeries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartScatterSeries.d.ts","sourceRoot":"","sources":["../../../src/elements/Chart/ChartScatterSeries.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,aAAa,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,WAAW,EACX,MAAM,EACN,KAAK,EACL,SAAS,EAAE,UAAU,EACrB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,EAAE,uBAAuB,GAAG,YAAY,CAgDxC;yBA9De,kBAAkB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),reactAria=require('react-aria');require('react-aria-components');var zod=require('zod');function se(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var Ee=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-lg border",{variants:{variant:{default:"border-[var(--border)] bg-[var(--content-background)]",muted:"border-[var(--accent-background)] bg-[var(--accent-background)]/50"}},defaultVariants:{variant:"default"}}),Ae=classVarianceAuthority.cva("cursor-pointer focus-visible:outline-none",{variants:{type:{bar:"",line:"stroke-2"},state:{default:"",focused:"",selected:"opacity-80"}},defaultVariants:{type:"bar",state:"default"}});classVarianceAuthority.cva("pointer-events-none",{variants:{visible:{true:"opacity-100",false:"opacity-0"}},defaultVariants:{visible:false}});var Je=classVarianceAuthority.cva("flex flex-wrap items-center justify-center gap-4 px-4 py-2",{variants:{visible:{true:"",false:"hidden"}},defaultVariants:{visible:true}});var _={top:20,right:20,bottom:60,left:60},xe=300,ye=169,Vt=.2,Le=.1,Ft=20,le=4,et=2,ce=6;var te={solid:"none",dashed:"8 4",dotted:"2 4"};var tt="var(--border)",ot=1,nt=.7,ue="var(--border)",de=1,me=6,oe=12,rt=44,X=4,Ne=2,Me=["var(--chart-1, hsl(221 83% 53%))","var(--chart-2, hsl(142 71% 45%))","var(--chart-3, hsl(38 92% 50%))","var(--chart-4, hsl(262 83% 58%))","var(--chart-5, hsl(0 84% 60%))"];function je(o,t){let e=Math.floor(Math.log10(o)),a=o/Math.pow(10,e),n;return t?a<1.5?n=1:a<3?n=2:a<7?n=5:n=10:a<=1?n=1:a<=2?n=2:a<=5?n=5:n=10,n*Math.pow(10,e)}function at(o,t,e=5){if(o===t){if(o===0)return [0,25,50,75,100];o=o*.9,t=t*1.1;}let a=je(t-o,false),n=je(a/(e-1),true),s=Math.floor(o/n)*n,r=Math.ceil(t/n)*n,i=[];for(let c=s;c<=r;c+=n)i.push(c);return i}function it(o,t,e,a=0){let n=o/t,s=n*(1-Vt),r=Math.max(Ft,s/e*(1-Le));return {barWidth:r,groupWidth:n,getBarX:(c,p)=>{let f=a+n*c+n/2,u=e*r+(e-1)*(Le*r);return f-u/2+p*(r+Le*r)}}}function st(o){let[t,e]=react.useState({width:xe,height:ye,padding:_,plotArea:{x:_.left,y:_.top,width:xe-_.left-_.right,height:ye-_.top-_.bottom}});return react.useEffect(()=>{let a=o.current;if(!a)return;let n=r=>{let i=Math.max(r,xe),c=Math.max(i*.5625,ye),p={x:_.left,y:_.top,width:i-_.left-_.right,height:c-_.top-_.bottom};e({width:i,height:c,padding:_,plotArea:p});},s=new ResizeObserver(r=>{let i=r[0];i&&n(i.contentRect.width);});return n(a.getBoundingClientRect().width),s.observe(a),()=>{s.disconnect();}},[o]),t}function Ce(o){let{rows:t,cols:e,initialRow:a=0,initialCol:n=0,wrap:s=false,onFocusChange:r}=o,[i,c]=react.useState(a),[p,f]=react.useState(n),u=react.useCallback(h=>typeof e=="function"?e(h):e,[e]),b=react.useCallback((h,d)=>{r?.(h,d);},[r]),S=react.useCallback(()=>{f(h=>{let d=u(i)-1,l=h+1;return l>d&&(l=s?0:d),l!==h&&b(i,l),l});},[i,u,s,b]),m=react.useCallback(()=>{f(h=>{let d=h-1,l=u(i)-1;return d<0&&(d=s?l:0),d!==h&&b(i,d),d});},[i,u,s,b]),x=react.useCallback(()=>{c(h=>{let d=h+1;if(d>=t&&(d=s?0:t-1),d!==h){let l=u(d)-1;f(v=>{let g=Math.min(v,l);return b(d,g),g});}return d});},[t,u,s,b]),E=react.useCallback(()=>{c(h=>{let d=h-1;if(d<0&&(d=s?t-1:0),d!==h){let l=u(d)-1;f(v=>{let g=Math.min(v,l);return b(d,g),g});}return d});},[t,u,s,b]),D=react.useCallback(()=>{f(0),b(i,0);},[i,b]),A=react.useCallback(()=>{let h=u(i)-1;f(h),b(i,h);},[i,u,b]),C=react.useCallback((h,d)=>{let l=Math.max(0,Math.min(h,t-1)),v=u(l)-1,g=Math.max(0,Math.min(d,v));c(l),f(g),b(l,g);},[t,u,b]),T=react.useCallback((h,d)=>h===i&&d===p?0:-1,[i,p]);return react.useMemo(()=>({focusedRow:i,focusedCol:p,moveRight:S,moveLeft:m,moveDown:x,moveUp:E,moveToStart:D,moveToEnd:A,setFocus:C,getTabIndex:T}),[i,p,S,m,x,E,D,A,C,T])}var ct=react.createContext(null);function Te(){let o=react.useContext(ct);if(!o)throw new Error("useChartContext must be used within a ChartProvider");return o}function Wt(o){let t=new Set;return o.forEach(e=>{e.data.forEach(a=>{t.add(a.label);});}),Array.from(t)}function Ut(o,t,e){let a=Wt(o),{plotArea:n}=t,s=1/0,r=-1/0;o.forEach(m=>{m.data.forEach(x=>{s=Math.min(s,x.value),r=Math.max(r,x.value);});}),(!isFinite(s)||!isFinite(r))&&(s=0,r=100);let i=e?Math.min(0,s):s,c=at(i,r),p=c[c.length-1]||r,f=c[0]||i,u=m=>{if(a.length<=1)return n.x+n.width/2;let x=n.width/a.length;return n.x+x*m+x/2},b=p-f||1;return {allLabels:a,xScale:u,yScale:m=>{let x=(m-f)/b;return n.y+n.height*(1-x)},yMin:f,yMax:p,yTicks:c}}function ut({children:o,containerRef:t,data:e,type:a,title:n,description:s,xAxisLabel:r,yAxisLabel:i,showTooltip:c,showGrid:p,showLegend:f,announceTrends:u,trendUpFormat:b,trendDownFormat:S,startAtZero:m,reducedMotion:x=false,onPointFocus:E,onPointSelect:D}){let[A,C]=react.useState(null),[T,h]=react.useState(""),[d,l]=react.useState(false),[v,g]=react.useState(null),[L,I]=react.useState(null),[k,V]=react.useState(null),G=st(t),F=react.useMemo(()=>Ut(e,G,m),[e,G,m]);react.useMemo(()=>Math.max(...e.map(y=>y.data.length)),[e]);let re=react.useCallback((y,P)=>(P?b:S).replace("{percent}",String(y)),[b,S]),we=(y,P)=>{if(!u||P<=0)return null;let w=e[y];if(!w)return null;let N=w.data[P],M=w.data[P-1];if(!N||!M||M.value===0)return null;let Z=(N.value-M.value)/Math.abs(M.value)*100,Q=Z>=0,ie=Math.abs(Math.round(Z));return {text:re(ie,Q),direction:Q?"up":"down"}},B=Ce({rows:e.length,cols:y=>e[y]?.data.length||0,onFocusChange:(y,P)=>{let w=e[y],N=w?.data[P];if(!w||!N)return;let M=we(y,P);I(M?.text??null),V(M?.direction??null);let Z=`${P+1} of ${w.data.length}`,Q=e.length>1?`${w.name}: `:"",ie=z(N.value),Mt=M?`, ${M.text}`:"";h(`${Q}${N.label}, ${ie}${Mt}. ${Z}.`),c&&(l(true),g({series:y,point:P})),E?.(N,y,P);}}),ae=react.useMemo(()=>{let y=typeof navigator<"u"?navigator.language:"en-US";return new Intl.NumberFormat(y)},[]),z=react.useCallback(y=>ae.format(y),[ae]),ee=react.useCallback((y,P)=>{if(!u||P<=0)return null;let w=e[y];if(!w)return null;let N=w.data[P],M=w.data[P-1];if(!N||!M||M.value===0)return null;let Z=(N.value-M.value)/Math.abs(M.value)*100,Q=Z>=0,ie=Math.abs(Math.round(Z));return {text:re(ie,Q),direction:Q?"up":"down"}},[e,u,re]),ge=react.useCallback(y=>Me[y%Me.length]??"var(--chart-1)",[]),O=react.useCallback((y,P)=>{let w=e[y],N=w?.data[P];if(!w||!N)return null;let M=F.allLabels.indexOf(N.label);return M===-1?null:{x:F.xScale(M),y:F.yScale(N.value)}},[e,F]),U=react.useCallback((y,P)=>{B.setFocus(y,P);},[B]),Xe=react.useCallback((y,P)=>{C({series:y,point:P});let w=e[y],N=w?.data[P];w&&N&&D?.(N,y,P);},[e,D]),Ye=react.useCallback(()=>{C(null);},[]),qe=react.useCallback(y=>{h(y);},[]),Ze=react.useCallback((y,P)=>{if(c){l(true),g({series:y,point:P});let w=ee(y,P);I(w?.text??null),V(w?.direction??null);}},[c,ee]),Qe=react.useCallback(()=>{l(false),g(null);},[]),Nt=react.useMemo(()=>({focusedSeries:B.focusedRow,focusedPoint:B.focusedCol,selectedPoint:A,announcement:T,isTooltipVisible:d,tooltipPoint:v,currentTrend:L,currentTrendDirection:k,dimensions:G,scales:F,data:e,type:a,title:n,description:s,xAxisLabel:r,yAxisLabel:i,showTooltip:c,showGrid:p,showLegend:f,announceTrends:u,trendUpFormat:b,trendDownFormat:S,startAtZero:m,reducedMotion:x,setFocus:U,selectPoint:Xe,clearSelection:Ye,announce:qe,showTooltipAt:Ze,hideTooltip:Qe,getTabIndex:B.getTabIndex,formatValue:z,getSeriesColor:ge,getPointCoordinates:O}),[B.focusedRow,B.focusedCol,B.getTabIndex,A,T,d,v,L,k,G,F,e,a,n,s,r,i,c,p,f,u,b,S,m,x,U,Xe,Ye,qe,Ze,Qe,z,ge,O]);return jsxRuntime.jsx(ct.Provider,{value:Nt,children:o})}function _e({yTicks:o,yScale:t,plotX:e,plotWidth:a,visible:n}){return n?jsxRuntime.jsx("g",{className:"chart-grid","aria-hidden":"true","data-testid":"chart-grid",children:o.map(s=>{let r=t(s);return jsxRuntime.jsx("line",{x1:e,y1:r,x2:e+a,y2:r,stroke:tt,strokeWidth:ot,strokeOpacity:nt},s)})}):null}_e.displayName="ChartGrid";function Ve({allLabels:o,yTicks:t,xScale:e,yScale:a,plotArea:n,xAxisLabel:s,yAxisLabel:r,formatValue:i}){let{x:c,y:p,width:f,height:u}=n;return jsxRuntime.jsxs("g",{className:"chart-axis","aria-hidden":"true","data-testid":"chart-axis",children:[jsxRuntime.jsx("line",{x1:c,y1:p+u,x2:c+f,y2:p+u,stroke:ue,strokeWidth:de}),jsxRuntime.jsx("line",{x1:c,y1:p,x2:c,y2:p+u,stroke:ue,strokeWidth:de}),o.map((b,S)=>{let m=e(S),x=p+u;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:m,y1:x,x2:m,y2:x+me,stroke:ue,strokeWidth:de}),jsxRuntime.jsx("text",{x:m,y:x+me+oe,textAnchor:"middle",fontSize:oe,fill:"currentColor",className:"text-[var(--content-foreground)]",children:b})]},b)}),t.map(b=>{let S=c,m=a(b);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:S-me,y1:m,x2:S,y2:m,stroke:ue,strokeWidth:de}),jsxRuntime.jsx("text",{x:S-me-4,y:m,textAnchor:"end",dominantBaseline:"middle",fontSize:oe,fill:"currentColor",className:"text-[var(--content-foreground)]",children:i(b)})]},b)}),jsxRuntime.jsx("text",{x:c+f/2,y:p+u+45,textAnchor:"middle",fontSize:oe,fill:"currentColor",className:"text-[var(--content-foreground)] font-medium",children:s}),jsxRuntime.jsx("text",{x:15,y:p+u/2,textAnchor:"middle",fontSize:oe,fill:"currentColor",className:"text-[var(--content-foreground)] font-medium",transform:`rotate(-90, 15, ${p+u/2})`,children:r})]})}Ve.displayName="ChartAxis";function be({type:o,x:t,y:e,width:a=ce*2,height:n=ce*2,color:s,seriesIndex:r,pointIndex:i,tabIndex:c,label:p,isSelected:f=false,onFocus:u,onBlur:b,onHover:S,onHoverEnd:m,onKeyDown:x}){let E=react.useRef(null),{isFocusVisible:D,focusProps:A}=reactAria.useFocusRing();react.useEffect(()=>{c===0&&E.current&&document.activeElement?.closest('[role="graphics-document"]')!==null&&E.current.focus();},[c]);let C=Math.max(rt,a,n),T=o==="bar"?t-(C-a)/2:t-C/2,h=o==="bar"?e-(C-n)/2:e-C/2,d=I=>{A.onFocus?.(I),u?.(r,i);},l=I=>{A.onBlur?.(I),b?.();},v=I=>{S?.(r,i);},g=I=>{m?.();};return jsxRuntime.jsxs("g",{ref:E,role:"listitem",tabIndex:c,"aria-label":p,className:Ae({type:o,state:f?"selected":D?"focused":"default"}),onFocus:d,onBlur:l,onMouseEnter:v,onMouseLeave:g,onKeyDown:x,"data-testid":`chart-point-${r}-${i}`,children:[jsxRuntime.jsx("rect",{x:T,y:h,width:C,height:C,fill:"transparent",className:"cursor-pointer"}),o==="bar"?jsxRuntime.jsx("rect",{x:t,y:e,width:a,height:n,rx:le,ry:le,fill:s,className:"chart-bar"}):jsxRuntime.jsx("circle",{cx:t,cy:e,r:ce,fill:s,className:"chart-point"}),D&&(o==="bar"?jsxRuntime.jsx("rect",{x:t-X,y:e-X,width:a+X*2,height:n+X*2,rx:le+X,ry:le+X,fill:"none",stroke:"var(--ring)",strokeWidth:Ne,className:"chart-focus-ring"}):jsxRuntime.jsx("circle",{cx:t,cy:e,r:ce+X,fill:"none",stroke:"var(--ring)",strokeWidth:Ne,className:"chart-focus-ring"}))]})}be.displayName="ChartDataPoint";function Fe({series:o,seriesIndex:t,totalSeries:e,dimensions:a,scales:n,color:s,getTabIndex:r,selectedPoint:i,onPointFocus:c,onPointBlur:p,onPointHover:f,onPointHoverEnd:u,onKeyDown:b,formatValue:S}){let{plotArea:m}=a,{allLabels:x,xScale:E,yScale:D,yMin:A}=n,{barWidth:C,getBarX:T}=it(m.width,x.length,e,m.x),h=D(Math.max(0,A));return jsxRuntime.jsx("g",{className:"chart-bar-series",role:"list","aria-label":`${o.name} series`,"data-testid":`chart-series-${t}`,children:o.data.map((d,l)=>{let v=x.indexOf(d.label);if(v===-1)return null;let g=T(v,t),L=D(d.value),I=Math.abs(h-L),k=d.value>=0?L:h,V=i?.series===t&&i?.point===l,G=`${o.name}: ${d.label}, ${S(d.value)}`;return jsxRuntime.jsx(be,{type:"bar",x:g,y:k,width:C,height:I,color:s,seriesIndex:t,pointIndex:l,tabIndex:r(t,l),label:G,isSelected:V,onFocus:c,onBlur:p,onHover:f,onHoverEnd:u,onKeyDown:b},`${d.label}-${l}`)})})}Fe.displayName="ChartBarSeries";var pt="(prefers-reduced-motion: reduce)";function jt(){return typeof window>"u"?false:window.matchMedia(pt).matches}function bt(){let[o,t]=react.useState(jt);return react.useEffect(()=>{let e=window.matchMedia(pt);t(e.matches);let a=n=>{t(n.matches);};return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[]),o}var oo=1e3,no=200,ro="cubic-bezier(0.16, 1, 0.3, 1)";function Oe({series:o,seriesIndex:t,scales:e,color:a,pattern:n,getTabIndex:s,selectedPoint:r,onPointFocus:i,onPointBlur:c,onPointHover:p,onPointHoverEnd:f,onKeyDown:u,formatValue:b}){let{allLabels:S,xScale:m,yScale:x}=e,{reducedMotion:E}=Te(),D=bt(),A=!E&&!D,C=react.useRef(null),T=react.useMemo(()=>o.data.map((l,v)=>{let g=S.indexOf(l.label);return g===-1?null:{x:m(g),y:x(l.value),point:l,pointIndex:v,labelIndex:g}}).filter(l=>l!==null).sort((l,v)=>l.labelIndex-v.labelIndex),[o.data,S,m,x]),h=react.useMemo(()=>T.length===0?"":T.map((l,v)=>`${v===0?"M":"L"} ${l.x} ${l.y}`).join(" "),[T]);react.useEffect(()=>{let l=C.current;if(!A||!l||!h||typeof l.animate!="function")return;let v=l.getTotalLength();l.style.strokeDasharray=String(v),l.style.strokeDashoffset=String(v);let g=l.animate([{strokeDashoffset:String(v)},{strokeDashoffset:"0"}],{duration:oo,delay:t*no,easing:ro,fill:"forwards"});return g.onfinish=()=>{l.style.strokeDasharray="",l.style.strokeDashoffset="";},()=>{g.cancel(),l.style.strokeDasharray="",l.style.strokeDashoffset="";}},[A,h,t]);let d=te[n]==="none"?void 0:te[n];return jsxRuntime.jsxs("g",{className:"chart-line-series",role:"list","aria-label":`${o.name} series`,"data-testid":`chart-series-${t}`,children:[jsxRuntime.jsx("path",{ref:C,d:h,fill:"none",stroke:a,strokeWidth:et,strokeDasharray:d,strokeLinecap:"round",strokeLinejoin:"round",className:"chart-line","aria-hidden":"true"}),T.map(({x:l,y:v,point:g,pointIndex:L})=>{let I=r?.series===t&&r?.point===L,k=`${o.name}: ${g.label}, ${b(g.value)}`;return jsxRuntime.jsx(be,{type:"line",x:l,y:v,color:a,seriesIndex:t,pointIndex:L,tabIndex:s(t,L),label:k,isSelected:I,onFocus:i,onBlur:c,onHover:p,onHoverEnd:f,onKeyDown:u},`${g.label}-${L}`)})]})}Oe.displayName="ChartLineSeries";function He({type:o,data:t,dimensions:e,scales:a,titleId:n,descId:s,showGrid:r,xAxisLabel:i,yAxisLabel:c,getSeriesColor:p,getTabIndex:f,selectedPoint:u,formatValue:b,onKeyDown:S,onPointFocus:m,onPointBlur:x,onPointHover:E,onPointHoverEnd:D}){let{width:A,height:C,plotArea:T}=e,{allLabels:h,xScale:d,yScale:l,yTicks:v}=a;return jsxRuntime.jsxs("svg",{role:"graphics-document","aria-roledescription":`${o} chart`,"aria-labelledby":n,"aria-describedby":s,viewBox:`0 0 ${A} ${C}`,className:"h-full w-full",style:{maxHeight:C},"data-testid":"chart-svg",children:[jsxRuntime.jsx(_e,{yTicks:v,yScale:l,plotX:T.x,plotWidth:T.width,visible:r}),jsxRuntime.jsx(Ve,{allLabels:h,yTicks:v,xScale:d,yScale:l,plotArea:T,xAxisLabel:i,yAxisLabel:c,formatValue:b}),t.map((g,L)=>{let I=g.color||p(L),k=g.pattern||"solid";return o==="bar"?jsxRuntime.jsx(Fe,{series:g,seriesIndex:L,totalSeries:t.length,dimensions:e,scales:a,color:I,getTabIndex:f,selectedPoint:u,onPointFocus:m,onPointBlur:x,onPointHover:E,onPointHoverEnd:D,onKeyDown:S,formatValue:b},g.name):jsxRuntime.jsx(Oe,{series:g,seriesIndex:L,scales:a,color:I,pattern:k,getTabIndex:f,selectedPoint:u,onPointFocus:m,onPointBlur:x,onPointHover:E,onPointHoverEnd:D,onKeyDown:S,formatValue:b},g.name)})]})}He.displayName="ChartSVG";var Be=classVarianceAuthority.cva(["z-50 overflow-hidden rounded-md px-3 py-1.5 text-sm shadow-md","bg-[var(--content-foreground)] text-[var(--content-background)]","animate-in fade-in-0","data-[exiting]:animate-out data-[exiting]:fade-out-0"],{variants:{side:{top:["motion-safe:slide-in-from-bottom-2","data-[exiting]:motion-safe:slide-out-to-bottom-2"],bottom:["motion-safe:slide-in-from-top-2","data-[exiting]:motion-safe:slide-out-to-top-2"],left:["motion-safe:slide-in-from-right-2","data-[exiting]:motion-safe:slide-out-to-right-2"],right:["motion-safe:slide-in-from-left-2","data-[exiting]:motion-safe:slide-out-to-left-2"]}},defaultVariants:{side:"top"}});classVarianceAuthority.cva("fill-[var(--content-foreground)]",{variants:{side:{top:"rotate-180",bottom:"rotate-0",left:"rotate-90",right:"-rotate-90"}},defaultVariants:{side:"top"}});var Ct=8;function $e({visible:o,x:t,y:e,seriesName:a,label:n,value:s,chartWidth:r,chartHeight:i,trend:c,trendDirection:p}){let f=react.useRef(null),[u,b]=react.useState({left:0,top:0}),[S,m]=react.useState("top");return react.useEffect(()=>{if(!o||!f.current)return;let E=f.current.getBoundingClientRect(),D=E.width||120,A=E.height||50,C=t-D/2,T=e-A-Ct,h="top";T<0&&(T=e+Ct+16,h="bottom"),C<0&&(C=0),C+D>r&&(C=r-D),b({left:C,top:T}),m(h);},[o,t,e,r]),o?jsxRuntime.jsxs("div",{ref:f,"aria-hidden":"true",className:Be({side:S}),style:{position:"absolute",left:u.left,top:u.top,pointerEvents:"none"},"data-testid":"chart-tooltip",children:[jsxRuntime.jsx("div",{className:"font-medium",children:a}),jsxRuntime.jsxs("div",{className:"opacity-80",children:[n,": ",jsxRuntime.jsx("span",{className:"font-semibold",children:s})]}),c&&jsxRuntime.jsxs("div",{className:"text-xs opacity-70 mt-1 flex items-center gap-1",children:[p==="up"?jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-3 w-3 text-green-500",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M10 17a.75.75 0 01-.75-.75V5.612L5.29 9.77a.75.75 0 01-1.08-1.04l5.25-5.5a.75.75 0 011.08 0l5.25 5.5a.75.75 0 11-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0110 17z",clipRule:"evenodd"})}):p==="down"?jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-3 w-3 text-red-500",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.75.75v10.638l3.96-4.158a.75.75 0 111.08 1.04l-5.25 5.5a.75.75 0 01-1.08 0l-5.25-5.5a.75.75 0 111.08-1.04l3.96 4.158V3.75A.75.75 0 0110 3z",clipRule:"evenodd"})}):null,jsxRuntime.jsx("span",{children:c})]})]}):null}$e.displayName="ChartTooltip";function We({data:o,visible:t,type:e,getSeriesColor:a}){return t?jsxRuntime.jsx("div",{className:Je({visible:t}),role:"list","aria-label":"Chart legend","data-testid":"chart-legend",children:o.map((n,s)=>{let r=n.color||a(s),i=n.pattern||"solid";return jsxRuntime.jsxs("div",{role:"listitem",className:"flex items-center gap-2",children:[e==="bar"?jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:r},"data-testid":`legend-color-${s}`,"aria-hidden":"true"}):jsxRuntime.jsx("svg",{width:"24",height:"12","aria-hidden":"true","data-testid":`legend-color-${s}`,children:jsxRuntime.jsx("line",{x1:"0",y1:"6",x2:"24",y2:"6",stroke:r,strokeWidth:"2",strokeDasharray:te[i]==="none"?void 0:te[i]})}),jsxRuntime.jsx("span",{className:"text-sm text-[var(--content-foreground)]",children:n.name})]},n.name)})}):null}We.displayName="ChartLegend";function Ue({announcement:o}){return jsxRuntime.jsx(reactAria.VisuallyHidden,{children:jsxRuntime.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chart-announcer",children:o})})}Ue.displayName="ChartAnnouncer";function ze({data:o,title:t,xAxisLabel:e,yAxisLabel:a,formatValue:n,allLabels:s}){let r=o.length===1;return jsxRuntime.jsx(reactAria.VisuallyHidden,{children:jsxRuntime.jsxs("table",{"data-testid":"chart-data-table",children:[jsxRuntime.jsxs("caption",{children:[t," data table"]}),jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",children:e}),r?jsxRuntime.jsx("th",{scope:"col",children:a}):o.map(i=>jsxRuntime.jsxs("th",{scope:"col",children:[i.name," (",a,")"]},i.name))]})}),jsxRuntime.jsx("tbody",{children:s.map(i=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"row",children:i}),o.map(c=>{let p=c.data.find(f=>f.label===i);return jsxRuntime.jsx("td",{children:p?n(p.value):"\u2014"},c.name)})]},i))})]})})}ze.displayName="ChartDataTable";function Tt(o){let{roving:t,onSelect:e,onClear:a,disabled:n=false}=o;return {onKeyDown:react.useCallback(r=>{if(!n)switch(r.key){case "ArrowRight":r.preventDefault(),t.moveRight();break;case "ArrowLeft":r.preventDefault(),t.moveLeft();break;case "ArrowDown":r.preventDefault(),t.moveDown();break;case "ArrowUp":r.preventDefault(),t.moveUp();break;case "Home":r.preventDefault(),t.moveToStart();break;case "End":r.preventDefault(),t.moveToEnd();break;case "Enter":case " ":r.preventDefault(),e?.();break;case "Escape":r.preventDefault(),a?.();break;}},[t,e,a,n])}}function Io({chartId:o}){let t=Te(),{data:e,type:a,title:n,xAxisLabel:s,yAxisLabel:r,showTooltip:i,showGrid:c,showLegend:p,dimensions:f,scales:u,announcement:b,isTooltipVisible:S,tooltipPoint:m,currentTrend:x,currentTrendDirection:E,selectedPoint:D,getTabIndex:A,formatValue:C,getSeriesColor:T,getPointCoordinates:h,setFocus:d,selectPoint:l,clearSelection:v,showTooltipAt:g,hideTooltip:L}=t,I=`${o}-title`,k=`${o}-desc`,V=Ce({rows:e.length,cols:O=>e[O]?.data.length||0,onFocusChange:(O,U)=>{d(O,U);}}),{onKeyDown:G}=Tt({roving:V,onSelect:()=>{l(V.focusedRow,V.focusedCol);},onClear:()=>{v();}}),F=react.useCallback((O,U)=>{V.setFocus(O,U),g(O,U);},[V,g]),re=react.useCallback(()=>{},[]),we=react.useCallback((O,U)=>{g(O,U);},[g]),B=react.useCallback(()=>{L();},[L]),ae=react.useMemo(()=>m?h(m.series,m.point)||{x:0,y:0}:{x:0,y:0},[m,h]),z=react.useMemo(()=>m?e[m.series]:null,[m,e]),ee=react.useMemo(()=>m?z?.data[m.point]:null,[m,z]),ge=react.useMemo(()=>p??e.length>1,[p,e.length]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ue,{announcement:b}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"relative z-0",children:jsxRuntime.jsx(He,{type:a,data:e,dimensions:f,scales:u,titleId:I,descId:k,showGrid:c,xAxisLabel:s,yAxisLabel:r,getSeriesColor:T,getTabIndex:A,selectedPoint:D,formatValue:C,onKeyDown:G,onPointFocus:F,onPointBlur:re,onPointHover:we,onPointHoverEnd:B})}),i&&ee&&z&&jsxRuntime.jsx($e,{visible:S,x:ae.x,y:ae.y,seriesName:z.name,label:ee.label,value:C(ee.value),chartWidth:f.width,chartHeight:f.height,trend:x,trendDirection:E})]}),jsxRuntime.jsx(We,{data:e,visible:ge,type:a,getSeriesColor:T}),jsxRuntime.jsx(ze,{data:e,title:n,xAxisLabel:s,yAxisLabel:r,formatValue:C,allLabels:u.allLabels})]})}var Pt=react.forwardRef(({data:o,type:t,title:e,description:a,xAxisLabel:n,yAxisLabel:s,variant:r="default",className:i,showTooltip:c=true,showGrid:p=true,showLegend:f,announceTrends:u=false,trendUpFormat:b="up {percent}% from previous",trendDownFormat:S="down {percent}% from previous",startAtZero:m=true,reducedMotion:x,onPointFocus:E,onPointSelect:D,id:A,"aria-label":C,"aria-labelledby":T,"aria-describedby":h,"data-testid":d,...l},v)=>{let g=react.useRef(null),L=react.useId(),I=A||`chart-${L}`,k=`${I}-title`,V=`${I}-desc`,G=f??o.length>1;return jsxRuntime.jsxs("figure",{ref:F=>{typeof v=="function"?v(F):v&&(v.current=F),g.current=F;},id:I,role:"figure","aria-label":C,"aria-labelledby":T||k,"aria-describedby":h||V,"data-testid":d,className:se(Ee({variant:r}),"p-4",i),...l,children:[jsxRuntime.jsxs("figcaption",{className:"sr-only",children:[jsxRuntime.jsx("span",{id:k,children:e}),jsxRuntime.jsx("span",{id:V,children:a})]}),jsxRuntime.jsx(ut,{containerRef:g,data:o,type:t,title:e,description:a,xAxisLabel:n,yAxisLabel:s,showTooltip:c,showGrid:p,showLegend:G,announceTrends:u,trendUpFormat:b,trendDownFormat:S,startAtZero:m,reducedMotion:x,onPointFocus:E,onPointSelect:D,children:jsxRuntime.jsx(Io,{chartId:I})})]})});Pt.displayName="Chart";var Rt=react.memo(Pt);Rt.displayName="Chart";var Dt=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var It=zod.z.object({label:zod.z.string().min(1,"Label is required"),value:zod.z.number(),description:zod.z.string().optional()}),wt=zod.z.enum(["solid","dashed","dotted"]),Et=zod.z.object({name:zod.z.string().min(1,"Series name is required"),color:zod.z.string().optional(),pattern:wt.optional().default("solid"),data:zod.z.array(It).min(1,"At least one data point required")}),At=zod.z.enum(["bar","line"]),Lt=zod.z.enum(["default","muted"]),Eo=Dt.extend({data:zod.z.array(Et).min(1,"At least one data series required").max(5,"Maximum 5 series allowed"),type:At,title:zod.z.string().min(1,"Title is required"),description:zod.z.string().min(1,"Description is required"),xAxisLabel:zod.z.string().min(1,"X-axis label is required"),yAxisLabel:zod.z.string().min(1,"Y-axis label is required"),variant:Lt.optional().default("default"),showTooltip:zod.z.boolean().optional().default(true),showGrid:zod.z.boolean().optional().default(true),showLegend:zod.z.boolean().optional(),announceTrends:zod.z.boolean().optional().default(false),trendUpFormat:zod.z.string().optional().default("up {percent}% from previous"),trendDownFormat:zod.z.string().optional().default("down {percent}% from previous"),startAtZero:zod.z.boolean().optional().default(true),reducedMotion:zod.z.boolean().optional(),onPointFocus:zod.z.unknown().optional(),onPointSelect:zod.z.unknown().optional()});exports.Chart=Rt;exports.ChartPropsSchema=Eo;exports.ChartTypeSchema=At;exports.ChartVariantSchema=Lt;exports.DataPointSchema=It;exports.DataSeriesSchema=Et;exports.LinePatternSchema=wt;exports.chartVariants=Ee;exports.dataPointVariants=Ae;//# sourceMappingURL=index.js.map
|
|
2
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),reactAria=require('react-aria');require('react-aria-components');var zod=require('zod');function de(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var Me=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-lg border",{variants:{variant:{default:"border-[var(--border)] bg-[var(--content-background)]",muted:"border-[var(--accent-background)] bg-[var(--accent-background)]/50"}},defaultVariants:{variant:"default"}}),Ne=classVarianceAuthority.cva("cursor-pointer focus-visible:outline-none",{variants:{type:{bar:"",line:"stroke-2"},state:{default:"",focused:"",selected:"opacity-80"}},defaultVariants:{type:"bar",state:"default"}});classVarianceAuthority.cva("pointer-events-none",{variants:{visible:{true:"opacity-100",false:"opacity-0"}},defaultVariants:{visible:false}});var pt=classVarianceAuthority.cva("flex flex-wrap items-center justify-center gap-4 px-4 py-2",{variants:{visible:{true:"",false:"hidden"}},defaultVariants:{visible:true}});var K={top:20,right:20,bottom:60,left:60},Te=300,Ie=169,on=.2,$e=.1,rn=20,me=4,Re=2,pe=6;var se={solid:"none",dashed:"8 4",dotted:"2 4"};var ft="var(--border)",ht=1,xt=.7,be="var(--border)",fe=1,he=6,le=12,gt=44,Q=4,_e=2,Ve=["var(--chart-1, hsl(221 83% 53%))","var(--chart-2, hsl(142 71% 45%))","var(--chart-3, hsl(38 92% 50%))","var(--chart-4, hsl(262 83% 58%))","var(--chart-5, hsl(0 84% 60%))"];function bt(t,e){let n=Math.floor(Math.log10(t)),r=t/Math.pow(10,n),o;return e?r<1.5?o=1:r<3?o=2:r<7?o=5:o=10:r<=1?o=1:r<=2?o=2:r<=5?o=5:o=10,o*Math.pow(10,n)}function vt(t,e,n=5){if(t===e){if(t===0)return [0,25,50,75,100];t=t*.9,e=e*1.1;}let r=bt(e-t,false),o=bt(r/(n-1),true),l=Math.floor(t/o)*o,a=Math.ceil(e/o)*o,i=[];for(let m=l;m<=a;m+=o)i.push(m);return i}function yt(t,e,n,r=0){let o=t/e,l=o*(1-on),a=Math.max(rn,l/n*(1-$e));return {barWidth:a,groupWidth:o,getBarX:(m,g)=>{let v=r+o*m+o/2,c=n*a+(n-1)*($e*a);return v-c/2+g*(a+$e*a)}}}function Ct(t){let[e,n]=react.useState({width:Te,height:Ie,padding:K,plotArea:{x:K.left,y:K.top,width:Te-K.left-K.right,height:Ie-K.top-K.bottom}});return react.useEffect(()=>{let r=t.current;if(!r)return;let o=a=>{let i=Math.max(a,Te),m=Math.max(i*.5625,Ie),g={x:K.left,y:K.top,width:i-K.left-K.right,height:m-K.top-K.bottom};n({width:i,height:m,padding:K,plotArea:g});},l=new ResizeObserver(a=>{let i=a[0];i&&o(i.contentRect.width);});return o(r.getBoundingClientRect().width),l.observe(r),()=>{l.disconnect();}},[t]),e}function De(t){let{rows:e,cols:n,initialRow:r=0,initialCol:o=0,wrap:l=false,onFocusChange:a}=t,[i,m]=react.useState(r),[g,v]=react.useState(o),c=react.useCallback(f=>typeof n=="function"?n(f):n,[n]),p=react.useCallback((f,d)=>{a?.(f,d);},[a]),P=react.useCallback(()=>{v(f=>{let d=c(i)-1,h=f+1;return h>d&&(h=l?0:d),h!==f&&p(i,h),h});},[i,c,l,p]),u=react.useCallback(()=>{v(f=>{let d=f-1,h=c(i)-1;return d<0&&(d=l?h:0),d!==f&&p(i,d),d});},[i,c,l,p]),s=react.useCallback(()=>{m(f=>{let d=f+1;if(d>=e&&(d=l?0:e-1),d!==f){let h=c(d)-1;v(C=>{let S=Math.min(C,h);return p(d,S),S});}return d});},[e,c,l,p]),y=react.useCallback(()=>{m(f=>{let d=f-1;if(d<0&&(d=l?e-1:0),d!==f){let h=c(d)-1;v(C=>{let S=Math.min(C,h);return p(d,S),S});}return d});},[e,c,l,p]),x=react.useCallback(()=>{v(0),p(i,0);},[i,p]),I=react.useCallback(()=>{let f=c(i)-1;v(f),p(i,f);},[i,c,p]),b=react.useCallback((f,d)=>{let h=Math.max(0,Math.min(f,e-1)),C=c(h)-1,S=Math.max(0,Math.min(d,C));m(h),v(S),p(h,S);},[e,c,p]),T=react.useCallback((f,d)=>f===i&&d===g?0:-1,[i,g]);return react.useMemo(()=>({focusedRow:i,focusedCol:g,moveRight:P,moveLeft:u,moveDown:s,moveUp:y,moveToStart:x,moveToEnd:I,setFocus:b,getTabIndex:T}),[i,g,P,u,s,y,x,I,b,T])}var Pt=react.createContext(null);function J(){let t=react.useContext(Pt);if(!t)throw new Error("useChartContext must be used within a ChartProvider");return t}function mn(t){let e=new Set;return t.forEach(n=>{n.data.forEach(r=>{e.add(r.label);});}),Array.from(e)}function pn(t,e,n){let r=mn(t),{plotArea:o}=e,l=1/0,a=-1/0;t.forEach(u=>{u.data.forEach(s=>{l=Math.min(l,s.value),a=Math.max(a,s.value);});}),(!isFinite(l)||!isFinite(a))&&(l=0,a=100);let i=n?Math.min(0,l):l,m=vt(i,a),g=m[m.length-1]||a,v=m[0]||i,c=u=>{if(r.length<=1)return o.x+o.width/2;let s=o.width/r.length;return o.x+s*u+s/2},p=g-v||1;return {allLabels:r,xScale:c,yScale:u=>{let s=(u-v)/p;return o.y+o.height*(1-s)},yMin:v,yMax:g,yTicks:m}}function Tt({children:t,containerRef:e,data:n,type:r,title:o,description:l,xAxisLabel:a,yAxisLabel:i,showTooltip:m,showGrid:g,showLegend:v,announceTrends:c,trendUpFormat:p,trendDownFormat:P,startAtZero:u,stacked:s=false,innerRadius:y=0,pointSize:x=8,reducedMotion:I=false,onPointFocus:b,onPointSelect:T}){let[f,d]=react.useState(null),[h,C]=react.useState(""),[S,R]=react.useState(false),[A,E]=react.useState(null),[D,N]=react.useState(null),[$,F]=react.useState(null),H=Ct(e),B=react.useMemo(()=>pn(n,H,u),[n,H,u]);react.useMemo(()=>Math.max(...n.map(w=>w.data.length)),[n]);let U=react.useCallback((w,k)=>(k?p:P).replace("{percent}",String(w)),[p,P]),q=(w,k)=>{if(!c||k<=0)return null;let M=n[w];if(!M)return null;let _=M.data[k],V=M.data[k-1];if(!_||!V||V.value===0)return null;let oe=(_.value-V.value)/Math.abs(V.value)*100,re=oe>=0,ue=Math.abs(Math.round(oe));return {text:U(ue,re),direction:re?"up":"down"}},O=De({rows:n.length,cols:w=>n[w]?.data.length||0,onFocusChange:(w,k)=>{let M=n[w],_=M?.data[k];if(!M||!_)return;let V=q(w,k);N(V?.text??null),F(V?.direction??null);let oe=`${k+1} of ${M.data.length}`,re=n.length>1?`${M.name}: `:"",ue=G(_.value),en=V?`, ${V.text}`:"";C(`${re}${_.label}, ${ue}${en}. ${oe}.`),m&&(R(true),E({series:w,point:k})),b?.(_,w,k);}}),Se=react.useMemo(()=>{let w=typeof navigator<"u"?navigator.language:"en-US";return new Intl.NumberFormat(w)},[]),G=react.useCallback(w=>Se.format(w),[Se]),j=react.useCallback((w,k)=>{if(!c||k<=0)return null;let M=n[w];if(!M)return null;let _=M.data[k],V=M.data[k-1];if(!_||!V||V.value===0)return null;let oe=(_.value-V.value)/Math.abs(V.value)*100,re=oe>=0,ue=Math.abs(Math.round(oe));return {text:U(ue,re),direction:re?"up":"down"}},[n,c,U]),at=react.useCallback(w=>Ve[w%Ve.length]??"var(--chart-1)",[]),it=react.useCallback((w,k)=>{let M=n[w],_=M?.data[k];if(!M||!_)return null;let V=B.allLabels.indexOf(_.label);return V===-1?null:{x:B.xScale(V),y:B.yScale(_.value)}},[n,B]),st=react.useCallback((w,k)=>{O.setFocus(w,k);},[O]),lt=react.useCallback((w,k)=>{d({series:w,point:k});let M=n[w],_=M?.data[k];M&&_&&T?.(_,w,k);},[n,T]),ct=react.useCallback(()=>{d(null);},[]),ut=react.useCallback(w=>{C(w);},[]),dt=react.useCallback((w,k)=>{if(m){R(true),E({series:w,point:k});let M=j(w,k);N(M?.text??null),F(M?.direction??null);}},[m,j]),mt=react.useCallback(()=>{R(false),E(null);},[]),Jt=react.useMemo(()=>({focusedSeries:O.focusedRow,focusedPoint:O.focusedCol,selectedPoint:f,announcement:h,isTooltipVisible:S,tooltipPoint:A,currentTrend:D,currentTrendDirection:$,dimensions:H,scales:B,data:n,type:r,title:o,description:l,xAxisLabel:a,yAxisLabel:i,showTooltip:m,showGrid:g,showLegend:v,announceTrends:c,trendUpFormat:p,trendDownFormat:P,startAtZero:u,stacked:s,innerRadius:y,pointSize:x,reducedMotion:I,setFocus:st,selectPoint:lt,clearSelection:ct,announce:ut,showTooltipAt:dt,hideTooltip:mt,getTabIndex:O.getTabIndex,formatValue:G,getSeriesColor:at,getPointCoordinates:it}),[O.focusedRow,O.focusedCol,O.getTabIndex,f,h,S,A,D,$,H,B,n,r,o,l,a,i,m,g,v,c,p,P,u,s,y,x,I,st,lt,ct,ut,dt,mt,G,at,it]);return jsxRuntime.jsx(Pt.Provider,{value:Jt,children:t})}function He({yTicks:t,yScale:e,plotX:n,plotWidth:r,visible:o}){return o?jsxRuntime.jsx("g",{className:"chart-grid","aria-hidden":"true","data-testid":"chart-grid",children:t.map(l=>{let a=e(l);return jsxRuntime.jsx("line",{x1:n,y1:a,x2:n+r,y2:a,stroke:ft,strokeWidth:ht,strokeOpacity:xt},l)})}):null}He.displayName="ChartGrid";function Fe({allLabels:t,yTicks:e,xScale:n,yScale:r,plotArea:o,xAxisLabel:l,yAxisLabel:a,formatValue:i}){let{x:m,y:g,width:v,height:c}=o;return jsxRuntime.jsxs("g",{className:"chart-axis","aria-hidden":"true","data-testid":"chart-axis",children:[jsxRuntime.jsx("line",{x1:m,y1:g+c,x2:m+v,y2:g+c,stroke:be,strokeWidth:fe}),jsxRuntime.jsx("line",{x1:m,y1:g,x2:m,y2:g+c,stroke:be,strokeWidth:fe}),t.map((p,P)=>{let u=n(P),s=g+c;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:u,y1:s,x2:u,y2:s+he,stroke:be,strokeWidth:fe}),jsxRuntime.jsx("text",{x:u,y:s+he+le,textAnchor:"middle",fontSize:le,fill:"currentColor",className:"text-[var(--content-foreground)]",children:p})]},p)}),e.map(p=>{let P=m,u=r(p);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:P-he,y1:u,x2:P,y2:u,stroke:be,strokeWidth:fe}),jsxRuntime.jsx("text",{x:P-he-4,y:u,textAnchor:"end",dominantBaseline:"middle",fontSize:le,fill:"currentColor",className:"text-[var(--content-foreground)]",children:i(p)})]},p)}),jsxRuntime.jsx("text",{x:m+v/2,y:g+c+45,textAnchor:"middle",fontSize:le,fill:"currentColor",className:"text-[var(--content-foreground)] font-medium",children:l}),jsxRuntime.jsx("text",{x:15,y:g+c/2,textAnchor:"middle",fontSize:le,fill:"currentColor",className:"text-[var(--content-foreground)] font-medium",transform:`rotate(-90, 15, ${g+c/2})`,children:a})]})}Fe.displayName="ChartAxis";function z({type:t,x:e,y:n,width:r=pe*2,height:o=pe*2,color:l,seriesIndex:a,pointIndex:i,tabIndex:m,label:g,isSelected:v=false,onFocus:c,onBlur:p,onHover:P,onHoverEnd:u,onKeyDown:s}){let y=react.useRef(null),{isFocusVisible:x,focusProps:I}=reactAria.useFocusRing();react.useEffect(()=>{m===0&&y.current&&document.activeElement?.closest('[role="graphics-document"]')!==null&&y.current.focus();},[m]);let b=Math.max(gt,r,o),T=t==="bar"?e-(b-r)/2:e-b/2,f=t==="bar"?n-(b-o)/2:n-b/2,d=A=>{I.onFocus?.(A),c?.(a,i);},h=A=>{I.onBlur?.(A),p?.();},C=A=>{P?.(a,i);},S=A=>{u?.();};return jsxRuntime.jsxs("g",{ref:y,role:"listitem",tabIndex:m,"aria-label":g,className:Ne({type:t,state:v?"selected":x?"focused":"default"}),onFocus:d,onBlur:h,onMouseEnter:C,onMouseLeave:S,onKeyDown:s,"data-testid":`chart-point-${a}-${i}`,children:[jsxRuntime.jsx("rect",{x:T,y:f,width:b,height:b,fill:"transparent",className:"cursor-pointer"}),t==="bar"?jsxRuntime.jsx("rect",{x:e,y:n,width:r,height:o,rx:me,ry:me,fill:l,className:"chart-bar"}):jsxRuntime.jsx("circle",{cx:e,cy:n,r:pe,fill:l,className:"chart-point"}),x&&(t==="bar"?jsxRuntime.jsx("rect",{x:e-Q,y:n-Q,width:r+Q*2,height:o+Q*2,rx:me+Q,ry:me+Q,fill:"none",stroke:"var(--ring)",strokeWidth:_e,className:"chart-focus-ring"}):jsxRuntime.jsx("circle",{cx:e,cy:n,r:pe+Q,fill:"none",stroke:"var(--ring)",strokeWidth:_e,className:"chart-focus-ring"}))]})}z.displayName="ChartDataPoint";function Ke({series:t,seriesIndex:e,totalSeries:n,dimensions:r,scales:o,color:l,getTabIndex:a,selectedPoint:i,onPointFocus:m,onPointBlur:g,onPointHover:v,onPointHoverEnd:c,onKeyDown:p,formatValue:P}){let{plotArea:u}=r,{allLabels:s,xScale:y,yScale:x,yMin:I}=o,{barWidth:b,getBarX:T}=yt(u.width,s.length,n,u.x),f=x(Math.max(0,I));return jsxRuntime.jsx("g",{className:"chart-bar-series",role:"list","aria-label":`${t.name} series`,"data-testid":`chart-series-${e}`,children:t.data.map((d,h)=>{let C=s.indexOf(d.label);if(C===-1)return null;let S=T(C,e),R=x(d.value),A=Math.abs(f-R),E=d.value>=0?R:f,D=i?.series===e&&i?.point===h,N=`${t.name}: ${d.label}, ${P(d.value)}`;return jsxRuntime.jsx(z,{type:"bar",x:S,y:E,width:b,height:A,color:l,seriesIndex:e,pointIndex:h,tabIndex:a(e,h),label:N,isSelected:D,onFocus:m,onBlur:g,onHover:v,onHoverEnd:c,onKeyDown:p},`${d.label}-${h}`)})})}Ke.displayName="ChartBarSeries";var Dt="(prefers-reduced-motion: reduce)";function Cn(){return typeof window>"u"?false:window.matchMedia(Dt).matches}function wt(){let[t,e]=react.useState(Cn);return react.useEffect(()=>{let n=window.matchMedia(Dt);e(n.matches);let r=o=>{e(o.matches);};return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),t}var Tn=1e3,In=200,Rn="cubic-bezier(0.16, 1, 0.3, 1)";function Be({series:t,seriesIndex:e,scales:n,color:r,pattern:o,getTabIndex:l,selectedPoint:a,onPointFocus:i,onPointBlur:m,onPointHover:g,onPointHoverEnd:v,onKeyDown:c,formatValue:p}){let{allLabels:P,xScale:u,yScale:s}=n,{reducedMotion:y}=J(),x=wt(),I=!y&&!x,b=react.useRef(null),T=react.useMemo(()=>t.data.map((h,C)=>{let S=P.indexOf(h.label);return S===-1?null:{x:u(S),y:s(h.value),point:h,pointIndex:C,labelIndex:S}}).filter(h=>h!==null).sort((h,C)=>h.labelIndex-C.labelIndex),[t.data,P,u,s]),f=react.useMemo(()=>T.length===0?"":T.map((h,C)=>`${C===0?"M":"L"} ${h.x} ${h.y}`).join(" "),[T]);react.useEffect(()=>{let h=b.current;if(!I||!h||!f||typeof h.animate!="function")return;let C=h.getTotalLength();h.style.strokeDasharray=String(C),h.style.strokeDashoffset=String(C);let S=h.animate([{strokeDashoffset:String(C)},{strokeDashoffset:"0"}],{duration:Tn,delay:e*In,easing:Rn,fill:"forwards"});return S.onfinish=()=>{h.style.strokeDasharray="",h.style.strokeDashoffset="";},()=>{S.cancel(),h.style.strokeDasharray="",h.style.strokeDashoffset="";}},[I,f,e]);let d=se[o]==="none"?void 0:se[o];return jsxRuntime.jsxs("g",{className:"chart-line-series",role:"list","aria-label":`${t.name} series`,"data-testid":`chart-series-${e}`,children:[jsxRuntime.jsx("path",{ref:b,d:f,fill:"none",stroke:r,strokeWidth:Re,strokeDasharray:d,strokeLinecap:"round",strokeLinejoin:"round",className:"chart-line","aria-hidden":"true"}),T.map(({x:h,y:C,point:S,pointIndex:R})=>{let A=a?.series===e&&a?.point===R,E=`${t.name}: ${S.label}, ${p(S.value)}`;return jsxRuntime.jsx(z,{type:"line",x:h,y:C,color:r,seriesIndex:e,pointIndex:R,tabIndex:l(e,R),label:E,isSelected:A,onFocus:i,onBlur:m,onHover:g,onHoverEnd:v,onKeyDown:c},`${S.label}-${R}`)})]})}Be.displayName="ChartLineSeries";function ze({series:t,seriesIndex:e,scales:n,color:r,baseline:o,getTabIndex:l,selectedPoint:a,onPointFocus:i,onPointBlur:m,onPointHover:g,onPointHoverEnd:v,onKeyDown:c,formatValue:p}){let{allLabels:P,xScale:u,yScale:s}=n,y=react.useMemo(()=>t.data.map((b,T)=>{let f=P.indexOf(b.label);if(f===-1)return null;let d=o?o[f]??0:0;return {x:u(f),y:s(b.value+d),baseY:s(d),point:b,pointIndex:T,labelIndex:f}}).filter(b=>b!==null).sort((b,T)=>b.labelIndex-T.labelIndex),[t.data,P,u,s,o]),x=react.useMemo(()=>{if(y.length===0)return "";let b=y.map((f,d)=>`${d===0?"M":"L"} ${f.x} ${f.y}`).join(" "),T=[...y].reverse().map((f,d)=>`L ${f.x} ${f.baseY}`).join(" ");return `${b} ${T} Z`},[y]),I=react.useMemo(()=>y.length===0?"":y.map((b,T)=>`${T===0?"M":"L"} ${b.x} ${b.y}`).join(" "),[y]);return jsxRuntime.jsxs("g",{className:"chart-area-series",role:"list","aria-label":`${t.name} series`,"data-testid":`chart-series-${e}`,children:[jsxRuntime.jsx("path",{d:x,fill:r,fillOpacity:.2,stroke:"none","aria-hidden":"true"}),jsxRuntime.jsx("path",{d:I,fill:"none",stroke:r,strokeWidth:Re,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"}),y.map(({x:b,y:T,point:f,pointIndex:d})=>jsxRuntime.jsx(z,{type:"line",x:b,y:T,color:r,seriesIndex:e,pointIndex:d,tabIndex:l(e,d),label:`${t.name}: ${f.label}, ${p(f.value)}`,isSelected:a?.series===e&&a?.point===d,onFocus:i,onBlur:m,onHover:g,onHoverEnd:v,onKeyDown:c},`${f.label}-${d}`))]})}ze.displayName="ChartAreaSeries";function Ue({series:t,seriesIndex:e,scales:n,color:r,pointSize:o,getTabIndex:l,selectedPoint:a,onPointFocus:i,onPointBlur:m,onPointHover:g,onPointHoverEnd:v,onKeyDown:c,formatValue:p}){let{allLabels:P,xScale:u,yScale:s}=n,y=react.useMemo(()=>t.data.map((x,I)=>{let b=P.indexOf(x.label);return b===-1?null:{x:u(b),y:s(x.value),point:x,pointIndex:I,labelIndex:b}}).filter(x=>x!==null),[t.data,P,u,s]);return jsxRuntime.jsx("g",{className:"chart-scatter-series",role:"list","aria-label":`${t.name} series`,"data-testid":`chart-series-${e}`,children:y.map(({x,y:I,point:b,pointIndex:T})=>jsxRuntime.jsx(z,{type:"line",x,y:I,color:r,seriesIndex:e,pointIndex:T,tabIndex:l(e,T),label:`${t.name}: ${b.label}, ${p(b.value)}`,isSelected:a?.series===e&&a?.point===T,onFocus:i,onBlur:m,onHover:g,onHoverEnd:v,onKeyDown:c},`${b.label}-${T}`))})}Ue.displayName="ChartScatterSeries";function ge(t,e,n,r){let o=(r-90)*Math.PI/180;return {x:t+n*Math.cos(o),y:e+n*Math.sin(o)}}function An(t,e,n,r,o,l){let i=l-o>180?1:0,m=ge(t,e,n,o),g=ge(t,e,n,l),v=ge(t,e,r,o),c=ge(t,e,r,l);return r===0?[`M ${m.x} ${m.y}`,`A ${n} ${n} 0 ${i} 1 ${g.x} ${g.y}`,`L ${t} ${e}`,"Z"].join(" "):[`M ${m.x} ${m.y}`,`A ${n} ${n} 0 ${i} 1 ${g.x} ${g.y}`,`L ${c.x} ${c.y}`,`A ${r} ${r} 0 ${i} 0 ${v.x} ${v.y}`,"Z"].join(" ")}var kt=["var(--data, #1e40af)","var(--data-alt, #c2410c)","#0891b2","#7c3aed","#059669"];function Ye({series:t,innerRadius:e,getTabIndex:n,selectedPoint:r,onPointFocus:o,onPointBlur:l,onPointHover:a,onPointHoverEnd:i,onKeyDown:m,formatValue:g}){let{dimensions:v}=J(),c=v.plotArea,p=react.useMemo(()=>{let s=[];for(let y=0;y<t.length;y++){let x=t[y];for(let I=0;I<x.data.length;I++){let b=x.data[I];s.push({...b,color:x.color??kt[s.length%kt.length],seriesIndex:y,pointIndex:I});}}return s},[t]),P=react.useMemo(()=>p.reduce((s,y)=>s+y.value,0),[p]),u=react.useMemo(()=>{if(P===0)return [];let s=c.x+c.width/2,y=c.y+c.height/2,x=Math.min(c.width,c.height)/2-4,I=e>0?Math.min(e,x*.8):0,b=0;return p.map(T=>{let f=T.value/P*360,d=b,h=b+f;b=h;let C=d+f/2,S=I>0?(x+I)/2:x*.65,{x:R,y:A}=ge(s,y,S,C);return {point:T,pointIndex:T.pointIndex,startAngle:d,endAngle:h,color:T.color,path:An(s,y,x,I,d,h),labelX:R,labelY:A}})},[p,P,c,e]);return jsxRuntime.jsx("g",{className:"chart-pie-series",role:"list","aria-label":"Pie chart","data-testid":"chart-series-pie",children:u.map((s,y)=>{let x=P>0?Math.round(s.point.value/P*100):0,I=r?.series===0&&r?.point===s.pointIndex;return jsxRuntime.jsxs("g",{role:"listitem",tabIndex:n(0,s.pointIndex),"aria-label":`${s.point.label}: ${g(s.point.value)} (${x}%)`,onFocus:()=>o?.(0,s.pointIndex),onBlur:()=>l?.(),onMouseEnter:()=>a?.(0,s.pointIndex),onMouseLeave:()=>i?.(),onKeyDown:b=>m?.(b),className:"outline-none",children:[jsxRuntime.jsx("path",{d:s.path,fill:s.color,stroke:"var(--content-background, #fff)",strokeWidth:2,className:`transition-opacity ${I?"opacity-100":"opacity-85 hover:opacity-100"}`}),x>=5&&jsxRuntime.jsxs("text",{x:s.labelX,y:s.labelY,textAnchor:"middle",dominantBaseline:"central",className:"fill-[var(--content-foreground)] text-[11px] font-semibold pointer-events-none",children:[x,"%"]})]},`${s.point.label}-${y}`)})})}Ye.displayName="ChartPieSeries";function Ee(t,e,n,r){let o=(r-90)*Math.PI/180;return {x:t+n*Math.cos(o),y:e+n*Math.sin(o)}}var $t=4;function qe({allSeries:t,scales:e,getSeriesColor:n,getTabIndex:r,selectedPoint:o,onPointFocus:l,onPointBlur:a,onPointHover:i,onPointHoverEnd:m,onKeyDown:g,formatValue:v}){let{dimensions:c}=J(),p=c.plotArea,{allLabels:P}=e,u=p.x+p.width/2,s=p.y+p.height/2,y=Math.min(p.width,p.height)/2-24,x=P.length,I=e.yMin??0,b=e.yMax??100,T=C=>{let S=b!==I?(C-I)/(b-I):0;return Math.max(0,Math.min(1,S))*y},f=react.useMemo(()=>Array.from({length:$t},(C,S)=>{let R=y/$t*(S+1);return Array.from({length:x},(E,D)=>{let N=360/x*D;return Ee(u,s,R,N)}).map(E=>`${E.x},${E.y}`).join(" ")}),[u,s,y,x]),d=react.useMemo(()=>Array.from({length:x},(C,S)=>{let R=360/x*S;return Ee(u,s,y,R)}),[u,s,y,x]),h=react.useMemo(()=>P.map((C,S)=>{let R=360/x*S,{x:A,y:E}=Ee(u,s,y+16,R);return {label:C,x:A,y:E}}),[P,u,s,y,x]);return jsxRuntime.jsxs("g",{className:"chart-radar-series","data-testid":"chart-series-radar",children:[f.map((C,S)=>jsxRuntime.jsx("polygon",{points:C,fill:"none",stroke:"var(--border, #e5e7eb)",strokeWidth:1,opacity:.5},`ring-${S}`)),d.map((C,S)=>jsxRuntime.jsx("line",{x1:u,y1:s,x2:C.x,y2:C.y,stroke:"var(--border, #e5e7eb)",strokeWidth:1,opacity:.3},`spoke-${S}`)),h.map(C=>jsxRuntime.jsx("text",{x:C.x,y:C.y,textAnchor:"middle",dominantBaseline:"central",className:"fill-[var(--muted-foreground)] text-[11px]",children:C.label},C.label)),t.map((C,S)=>{let R=C.color??n(S),A=C.data.map((D,N)=>{let $=P.indexOf(D.label);if($===-1)return null;let F=360/x*$,H=T(D.value),{x:B,y:U}=Ee(u,s,H,F);return {x:B,y:U,point:D,pointIndex:N,labelIndex:$}}).filter(D=>D!==null),E=A.map(D=>`${D.x},${D.y}`).join(" ");return jsxRuntime.jsxs("g",{role:"list","aria-label":`${C.name} series`,children:[jsxRuntime.jsx("polygon",{points:E,fill:R,fillOpacity:.2,stroke:R,strokeWidth:2,"aria-hidden":"true"}),A.map(({x:D,y:N,point:$,pointIndex:F})=>jsxRuntime.jsx(z,{type:"line",x:D,y:N,color:R,seriesIndex:S,pointIndex:F,tabIndex:r(S,F),label:`${C.name}: ${$.label}, ${v($.value)}`,isSelected:o?.series===S&&o?.point===F,onFocus:l,onBlur:a,onHover:i,onHoverEnd:m,onKeyDown:g},`${$.label}-${F}`))]},C.name)})]})}qe.displayName="ChartRadarSeries";function je({type:t,data:e,dimensions:n,scales:r,titleId:o,descId:l,showGrid:a,xAxisLabel:i,yAxisLabel:m,getSeriesColor:g,getTabIndex:v,selectedPoint:c,formatValue:p,onKeyDown:P,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,stacked:I=false,innerRadius:b=0,pointSize:T=8}){let{width:f,height:d,plotArea:h}=n,{allLabels:C,xScale:S,yScale:R,yTicks:A}=r;return jsxRuntime.jsxs("svg",{role:"graphics-document","aria-roledescription":`${t} chart`,"aria-labelledby":o,"aria-describedby":l,viewBox:`0 0 ${f} ${d}`,className:"h-full w-full",style:{maxHeight:d},"data-testid":"chart-svg",children:[t!=="pie"&&t!=="radar"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(He,{yTicks:A,yScale:R,plotX:h.x,plotWidth:h.width,visible:a}),jsxRuntime.jsx(Fe,{allLabels:C,yTicks:A,xScale:S,yScale:R,plotArea:h,xAxisLabel:i,yAxisLabel:m,formatValue:p})]}),t==="pie"&&jsxRuntime.jsx(Ye,{series:e,innerRadius:b,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p}),t==="radar"&&jsxRuntime.jsx(qe,{allSeries:e,scales:r,getSeriesColor:g,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p}),t!=="pie"&&t!=="radar"&&e.map((E,D)=>{let N=E.color||g(D),$=E.pattern||"solid";if(t==="bar")return jsxRuntime.jsx(Ke,{series:E,seriesIndex:D,totalSeries:e.length,dimensions:n,scales:r,color:N,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p},E.name);if(t==="area"){let F=I?(()=>{let H=new Array(C.length).fill(0);for(let B=0;B<D;B++){let U=e[B];for(let q of U.data){let O=C.indexOf(q.label);O!==-1&&(H[O]=(H[O]??0)+q.value);}}return H})():null;return jsxRuntime.jsx(ze,{series:E,seriesIndex:D,scales:r,color:N,baseline:F,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p},E.name)}return t==="scatter"?jsxRuntime.jsx(Ue,{series:E,seriesIndex:D,scales:r,color:N,pointSize:T,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p},E.name):jsxRuntime.jsx(Be,{series:E,seriesIndex:D,scales:r,color:N,pattern:$,getTabIndex:v,selectedPoint:c,onPointFocus:u,onPointBlur:s,onPointHover:y,onPointHoverEnd:x,onKeyDown:P,formatValue:p},E.name)})]})}je.displayName="ChartSVG";var Je=classVarianceAuthority.cva(["z-50 overflow-hidden rounded-md px-3 py-1.5 text-sm shadow-md","bg-[var(--content-foreground)] text-[var(--content-background)]","motion-safe:animate-in motion-safe:fade-in-0","data-[exiting]:motion-safe:animate-out data-[exiting]:motion-safe:fade-out-0"],{variants:{side:{top:["motion-safe:slide-in-from-bottom-2","data-[exiting]:motion-safe:slide-out-to-bottom-2"],bottom:["motion-safe:slide-in-from-top-2","data-[exiting]:motion-safe:slide-out-to-top-2"],left:["motion-safe:slide-in-from-right-2","data-[exiting]:motion-safe:slide-out-to-right-2"],right:["motion-safe:slide-in-from-left-2","data-[exiting]:motion-safe:slide-out-to-left-2"]}},defaultVariants:{side:"top"}});classVarianceAuthority.cva("fill-[var(--content-foreground)]",{variants:{side:{top:"rotate-180",bottom:"rotate-0",left:"rotate-90",right:"-rotate-90"}},defaultVariants:{side:"top"}});var Bt=8;function tt({visible:t,x:e,y:n,seriesName:r,label:o,value:l,chartWidth:a,chartHeight:i,trend:m,trendDirection:g}){let v=react.useRef(null),[c,p]=react.useState({left:0,top:0}),[P,u]=react.useState("top");return react.useEffect(()=>{if(!t||!v.current)return;let y=v.current.getBoundingClientRect(),x=y.width||120,I=y.height||50,b=e-x/2,T=n-I-Bt,f="top";T<0&&(T=n+Bt+16,f="bottom"),b<0&&(b=0),b+x>a&&(b=a-x),p({left:b,top:T}),u(f);},[t,e,n,a]),t?jsxRuntime.jsxs("div",{ref:v,"aria-hidden":"true",className:Je({side:P}),style:{position:"absolute",left:c.left,top:c.top,pointerEvents:"none"},"data-testid":"chart-tooltip",children:[jsxRuntime.jsx("div",{className:"font-medium",children:r}),jsxRuntime.jsxs("div",{className:"opacity-80",children:[o,": ",jsxRuntime.jsx("span",{className:"font-semibold",children:l})]}),m&&jsxRuntime.jsxs("div",{className:"text-xs opacity-70 mt-1 flex items-center gap-1",children:[g==="up"?jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-3 w-3 text-green-500",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M10 17a.75.75 0 01-.75-.75V5.612L5.29 9.77a.75.75 0 01-1.08-1.04l5.25-5.5a.75.75 0 011.08 0l5.25 5.5a.75.75 0 11-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0110 17z",clipRule:"evenodd"})}):g==="down"?jsxRuntime.jsx("svg",{"aria-hidden":"true",className:"h-3 w-3 text-red-500",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.75.75v10.638l3.96-4.158a.75.75 0 111.08 1.04l-5.25 5.5a.75.75 0 01-1.08 0l-5.25-5.5a.75.75 0 111.08-1.04l3.96 4.158V3.75A.75.75 0 0110 3z",clipRule:"evenodd"})}):null,jsxRuntime.jsx("span",{children:m})]})]}):null}tt.displayName="ChartTooltip";function nt({data:t,visible:e,type:n,getSeriesColor:r}){return e?jsxRuntime.jsx("div",{className:pt({visible:e}),role:"list","aria-label":"Chart legend","data-testid":"chart-legend",children:t.map((o,l)=>{let a=o.color||r(l),i=o.pattern||"solid";return jsxRuntime.jsxs("div",{role:"listitem",className:"flex items-center gap-2",children:[n==="bar"?jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:a},"data-testid":`legend-color-${l}`,"aria-hidden":"true"}):jsxRuntime.jsx("svg",{width:"24",height:"12","aria-hidden":"true","data-testid":`legend-color-${l}`,children:jsxRuntime.jsx("line",{x1:"0",y1:"6",x2:"24",y2:"6",stroke:a,strokeWidth:"2",strokeDasharray:se[i]==="none"?void 0:se[i]})}),jsxRuntime.jsx("span",{className:"text-sm text-[var(--content-foreground)]",children:o.name})]},o.name)})}):null}nt.displayName="ChartLegend";function ot({announcement:t}){return jsxRuntime.jsx(reactAria.VisuallyHidden,{children:jsxRuntime.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"chart-announcer",children:t})})}ot.displayName="ChartAnnouncer";function rt({data:t,title:e,xAxisLabel:n,yAxisLabel:r,formatValue:o,allLabels:l}){let a=t.length===1;return jsxRuntime.jsx(reactAria.VisuallyHidden,{children:jsxRuntime.jsxs("table",{"data-testid":"chart-data-table",children:[jsxRuntime.jsxs("caption",{children:[e," data table"]}),jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",children:n}),a?jsxRuntime.jsx("th",{scope:"col",children:r}):t.map(i=>jsxRuntime.jsxs("th",{scope:"col",children:[i.name," (",r,")"]},i.name))]})}),jsxRuntime.jsx("tbody",{children:l.map(i=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"row",children:i}),t.map(m=>{let g=m.data.find(v=>v.label===i);return jsxRuntime.jsx("td",{children:g?o(g.value):"\u2014"},m.name)})]},i))})]})})}rt.displayName="ChartDataTable";function Wt(t){let{roving:e,onSelect:n,onClear:r,disabled:o=false}=t;return {onKeyDown:react.useCallback(a=>{if(!o)switch(a.key){case "ArrowRight":a.preventDefault(),e.moveRight();break;case "ArrowLeft":a.preventDefault(),e.moveLeft();break;case "ArrowDown":a.preventDefault(),e.moveDown();break;case "ArrowUp":a.preventDefault(),e.moveUp();break;case "Home":a.preventDefault(),e.moveToStart();break;case "End":a.preventDefault(),e.moveToEnd();break;case "Enter":case " ":a.preventDefault(),n?.();break;case "Escape":a.preventDefault(),r?.();break;}},[e,n,r,o])}}function jn({chartId:t}){let e=J(),{data:n,type:r,title:o,xAxisLabel:l,yAxisLabel:a,showTooltip:i,showGrid:m,showLegend:g,dimensions:v,scales:c,announcement:p,isTooltipVisible:P,tooltipPoint:u,currentTrend:s,currentTrendDirection:y,selectedPoint:x,getTabIndex:I,formatValue:b,getSeriesColor:T,getPointCoordinates:f,setFocus:d,selectPoint:h,clearSelection:C,showTooltipAt:S,hideTooltip:R}=e,A=`${t}-title`,E=`${t}-desc`,D=De({rows:n.length,cols:G=>n[G]?.data.length||0,onFocusChange:(G,j)=>{d(G,j);}}),{onKeyDown:N}=Wt({roving:D,onSelect:()=>{h(D.focusedRow,D.focusedCol);},onClear:()=>{C();}}),$=react.useCallback((G,j)=>{D.setFocus(G,j),S(G,j);},[D,S]),F=react.useCallback(()=>{},[]),H=react.useCallback((G,j)=>{S(G,j);},[S]),B=react.useCallback(()=>{R();},[R]),U=react.useMemo(()=>u?f(u.series,u.point)||{x:0,y:0}:{x:0,y:0},[u,f]),q=react.useMemo(()=>u?n[u.series]:null,[u,n]),O=react.useMemo(()=>u?q?.data[u.point]:null,[u,q]),Se=react.useMemo(()=>g??n.length>1,[g,n.length]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ot,{announcement:p}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"relative z-0",children:jsxRuntime.jsx(je,{type:r,data:n,dimensions:v,scales:c,titleId:A,descId:E,showGrid:m,xAxisLabel:l??"",yAxisLabel:a??"",getSeriesColor:T,getTabIndex:I,selectedPoint:x,formatValue:b,onKeyDown:N,onPointFocus:$,onPointBlur:F,onPointHover:H,onPointHoverEnd:B,stacked:e.stacked,innerRadius:e.innerRadius,pointSize:e.pointSize})}),i&&O&&q&&jsxRuntime.jsx(tt,{visible:P,x:U.x,y:U.y,seriesName:q.name,label:O.label,value:b(O.value),chartWidth:v.width,chartHeight:v.height,trend:s,trendDirection:y})]}),jsxRuntime.jsx(nt,{data:n,visible:Se,type:r,getSeriesColor:T}),jsxRuntime.jsx(rt,{data:n,title:o,xAxisLabel:l,yAxisLabel:a,formatValue:b,allLabels:c.allLabels})]})}var zt=react.forwardRef(({data:t,type:e,title:n,description:r,xAxisLabel:o,yAxisLabel:l,variant:a="default",className:i,showTooltip:m=true,showGrid:g=true,showLegend:v,announceTrends:c=false,trendUpFormat:p="up {percent}% from previous",trendDownFormat:P="down {percent}% from previous",startAtZero:u=true,stacked:s=false,innerRadius:y=0,pointSize:x=8,reducedMotion:I,onPointFocus:b,onPointSelect:T,id:f,"aria-label":d,"aria-labelledby":h,"aria-describedby":C,"data-testid":S},R)=>{let A=react.useRef(null),E=react.useId(),D=f||`chart-${E}`,N=`${D}-title`,$=`${D}-desc`,F=v??t.length>1;return jsxRuntime.jsxs("figure",{ref:H=>{typeof R=="function"?R(H):R&&(R.current=H),A.current=H;},id:D,role:"figure","aria-label":d,"aria-labelledby":h||N,"aria-describedby":C||$,"data-testid":S,className:de(Me({variant:a}),"p-4",i),children:[jsxRuntime.jsxs("figcaption",{className:"sr-only",children:[jsxRuntime.jsx("span",{id:N,children:n}),jsxRuntime.jsx("span",{id:$,children:r})]}),jsxRuntime.jsx(Tt,{containerRef:A,data:t,type:e,title:n,description:r,xAxisLabel:o??"",yAxisLabel:l??"",showTooltip:m,showGrid:g,showLegend:F,announceTrends:c,trendUpFormat:p,trendDownFormat:P,startAtZero:u,stacked:s,innerRadius:y,pointSize:x,reducedMotion:I,onPointFocus:b,onPointSelect:T,children:jsxRuntime.jsx(jn,{chartId:D})})]})});zt.displayName="Chart";var Ut=react.memo(zt);Ut.displayName="Chart";var Xt=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var Yt=zod.z.object({label:zod.z.string().min(1,"Label is required"),value:zod.z.number(),description:zod.z.string().optional()}),Zt=zod.z.enum(["solid","dashed","dotted"]),qt=zod.z.object({name:zod.z.string().min(1,"Series name is required"),color:zod.z.string().optional(),pattern:Zt.optional().default("solid"),data:zod.z.array(Yt).min(1,"At least one data point required")}),jt=zod.z.enum(["bar","line","area","scatter","pie","radar"]),Qt=zod.z.enum(["default","muted"]),Jn=Xt.extend({data:zod.z.array(qt).min(1,"At least one data series required").max(5,"Maximum 5 series allowed"),type:jt,title:zod.z.string().min(1,"Title is required"),description:zod.z.string().min(1,"Description is required"),xAxisLabel:zod.z.string().optional().default(""),yAxisLabel:zod.z.string().optional().default(""),variant:Qt.optional().default("default"),showTooltip:zod.z.boolean().optional().default(true),showGrid:zod.z.boolean().optional().default(true),showLegend:zod.z.boolean().optional(),announceTrends:zod.z.boolean().optional().default(false),trendUpFormat:zod.z.string().optional().default("up {percent}% from previous"),trendDownFormat:zod.z.string().optional().default("down {percent}% from previous"),startAtZero:zod.z.boolean().optional().default(true),stacked:zod.z.boolean().optional().default(false),innerRadius:zod.z.number().min(0).optional().default(0),pointSize:zod.z.number().min(2).optional().default(8),reducedMotion:zod.z.boolean().optional(),onPointFocus:zod.z.unknown().optional(),onPointSelect:zod.z.unknown().optional()});exports.Chart=Ut;exports.ChartPropsSchema=Jn;exports.ChartTypeSchema=jt;exports.ChartVariantSchema=Qt;exports.DataPointSchema=Yt;exports.DataSeriesSchema=qt;exports.LinePatternSchema=Zt;exports.chartVariants=Me;exports.dataPointVariants=Ne;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|