@aortl/admin-react 0.13.2 → 0.14.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.
@@ -0,0 +1,59 @@
1
+ import { ComponentProps } from 'react';
2
+ import { ChartDatum, ChartSize } from './chart-internal';
3
+ export type BarChartVariant = "primary" | "success" | "warning" | "danger" | "info";
4
+ export type BarChartOrientation = "horizontal" | "vertical";
5
+ export interface BarChartContainerProps extends ComponentProps<"div"> {
6
+ orientation?: BarChartOrientation;
7
+ size?: ChartSize;
8
+ /** Show per-bar value labels (`.chart-values`). */
9
+ showValues?: boolean;
10
+ /** Inline-flex, em-sized micro-viz for table cells. */
11
+ inline?: boolean;
12
+ /** Single-series fill colour. Per-bar `color` still overrides individual bars. */
13
+ variant?: BarChartVariant;
14
+ }
15
+ /**
16
+ * The bare bar-chart grid — no bars. Compose `<BarChart.Bar>` children by hand
17
+ * (e.g. to interleave a reference line). Sets `role="img"`; pass `aria-label`.
18
+ */
19
+ declare function BarChartContainer({ orientation, size, showValues, inline, variant, className, ...rest }: BarChartContainerProps): import("react/jsx-runtime").JSX.Element;
20
+ export interface BarProps extends Omit<ComponentProps<"div">, "color"> {
21
+ /** Auto-fills label / value / title / colour from a datum. */
22
+ datum?: ChartDatum;
23
+ /** Raw value when composing without a datum. */
24
+ value?: number;
25
+ /** Category label when composing without a datum. */
26
+ label?: string;
27
+ /** Explicit bar colour (`--bar-color`). Overrides the single-series fill. */
28
+ color?: string;
29
+ }
30
+ /**
31
+ * One bar. Renders a label (only when present), the fill (with a native
32
+ * `title`), and an always-present value cell (hidden by CSS unless the chart
33
+ * carries `.chart-values`). Stays `currentColor` unless an explicit colour is
34
+ * given — single-series bars never cycle the SERIES palette.
35
+ */
36
+ declare function Bar({ datum, value, label, color, className, style, ...rest }: BarProps): import("react/jsx-runtime").JSX.Element;
37
+ export interface BarChartProps extends ComponentProps<"div"> {
38
+ data: ChartDatum[];
39
+ /** Override the computed max (the 100% reference). Defaults to the largest value. */
40
+ max?: number;
41
+ orientation?: BarChartOrientation;
42
+ size?: ChartSize;
43
+ showValues?: boolean;
44
+ inline?: boolean;
45
+ variant?: BarChartVariant;
46
+ }
47
+ /**
48
+ * Single-series bar chart. Computes the max, sets `--chart-max` on the
49
+ * container (bars inherit it), and generates an overridable `aria-label`.
50
+ * Horizontal by default; pass `orientation="vertical"` for columns. For
51
+ * hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`.
52
+ */
53
+ declare function BarChartRoot({ data, max, orientation, size, showValues, inline, variant, style, "aria-label": ariaLabel, ...rest }: BarChartProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare const BarChart: typeof BarChartRoot & {
55
+ Container: typeof BarChartContainer;
56
+ Bar: typeof Bar;
57
+ };
58
+ export {};
59
+ //# sourceMappingURL=BarChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../src/BarChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EAKf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AACpF,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACnE,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;GAGG;AACH,iBAAS,iBAAiB,CAAC,EACzB,WAA0B,EAC1B,IAAW,EACX,UAAU,EACV,MAAM,EACN,OAAmB,EACnB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,sBAAsB,2CAsBxB;AAED,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACpE,8DAA8D;IAC9D,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,iBAAS,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,2CAgB/E;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC1D,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,qFAAqF;IACrF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,EACpB,IAAI,EACJ,GAAG,EACH,WAA0B,EAC1B,IAAW,EACX,UAAU,EACV,MAAM,EACN,OAAmB,EACnB,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,GAAG,IAAI,EACR,EAAE,aAAa,2CAkBf;AAED,eAAO,MAAM,QAAQ;;;CAGnB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from 'react';
2
+ import { ChartDatum } from './chart-internal';
3
+ export interface ChartLegendProps extends ComponentProps<"ul"> {
4
+ data: ChartDatum[];
5
+ }
6
+ /**
7
+ * Shared legend for `<Donut>` and `<StackedBar>` — one swatch + label per
8
+ * datum. Each row carries its own `title`, which is where the donut's
9
+ * per-slice read-out lives (a conic-gradient slice has no element to hang a
10
+ * `title` on). The swatch colour mirrors `seriesColor`, so legend and chart
11
+ * stay in sync.
12
+ */
13
+ export declare function ChartLegend({ data, className, ...rest }: ChartLegendProps): import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=ChartLegend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../src/ChartLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,kBAAkB,CAAC;AAExF,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAC5D,IAAI,EAAE,UAAU,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,2CAezE"}
@@ -0,0 +1,48 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { ChartLegend } from './ChartLegend';
3
+ import { ChartDatum, ChartSize } from './chart-internal';
4
+ export interface DonutFigureProps extends ComponentProps<"div"> {
5
+ size?: ChartSize;
6
+ }
7
+ /** Square positioning context that overlays the centre label on the ring. */
8
+ declare function Figure({ size, className, ...rest }: DonutFigureProps): import("react/jsx-runtime").JSX.Element;
9
+ export interface DonutRingProps extends Omit<ComponentProps<"div">, "color"> {
10
+ data: ChartDatum[];
11
+ /** Solid pie — no hole. */
12
+ pie?: boolean;
13
+ /** Ring width as a % of diameter (default "33%"). Ignored when `pie`. */
14
+ thickness?: string;
15
+ }
16
+ /** The masked conic-gradient ring. Builds `--donut-segments` from the data. */
17
+ declare function Ring({ data, pie, thickness, className, style, ...rest }: DonutRingProps): import("react/jsx-runtime").JSX.Element;
18
+ /** Centred overlay (a total, a label). Not a child of the ring — masks clip subtrees. */
19
+ declare function Center({ className, ...rest }: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
20
+ export interface DonutProps extends Omit<ComponentProps<"div">, "color"> {
21
+ data: ChartDatum[];
22
+ size?: ChartSize;
23
+ /** Ring width as a % of diameter (default "33%"). Ignored when `pie`. */
24
+ thickness?: string;
25
+ /** Solid pie — no hole. */
26
+ pie?: boolean;
27
+ /** Centred overlay content (a total, a label). */
28
+ centerLabel?: ReactNode;
29
+ /** Render a legend from the data labels. */
30
+ legend?: boolean;
31
+ inline?: boolean;
32
+ }
33
+ /**
34
+ * Donut (or `pie`) breakdown. Builds the cumulative conic-gradient string from
35
+ * `data`, overlays an optional `centerLabel`, and generates an overridable
36
+ * `aria-label`. Per-slice read-outs live on the optional `legend` rows — a
37
+ * conic slice has no element to carry a `title`. Resize by overriding
38
+ * `--chart-size` (it inherits to the figure) or via `size`.
39
+ */
40
+ declare function DonutRoot({ data, size, thickness, pie, centerLabel, legend, inline, className, "aria-label": ariaLabel, ...rest }: DonutProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare const Donut: typeof DonutRoot & {
42
+ Figure: typeof Figure;
43
+ Ring: typeof Ring;
44
+ Center: typeof Center;
45
+ Legend: typeof ChartLegend;
46
+ };
47
+ export {};
48
+ //# sourceMappingURL=Donut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../src/Donut.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EAIf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,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AE,UAAU,2CAkBZ;AAED,eAAO,MAAM,KAAK;;;;;CAKhB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { ComponentProps } from 'react';
2
+ import { ChartLegend } from './ChartLegend';
3
+ import { ChartDatum } from './chart-internal';
4
+ export type StackedBarTrackProps = ComponentProps<"div">;
5
+ /** The bare proportion track — compose `<StackedBar.Segment>` children by hand. */
6
+ declare function Track({ className, ...rest }: StackedBarTrackProps): import("react/jsx-runtime").JSX.Element;
7
+ export interface SegmentProps extends Omit<ComponentProps<"div">, "color"> {
8
+ /** Auto-fills value / title / colour from a datum. */
9
+ datum?: ChartDatum;
10
+ /** Index into the SERIES palette (used when the datum has no `color`). */
11
+ index?: number;
12
+ /** Raw value when composing without a datum. */
13
+ value?: number;
14
+ /** Explicit segment colour (`--segment-color`). */
15
+ color?: string;
16
+ }
17
+ /**
18
+ * One proportion segment, sized by `flex: var(--value)`. Multi-series by
19
+ * default: takes its colour from `seriesColor` (SERIES cycle or `datum.color`).
20
+ */
21
+ declare function Segment({ datum, index, value, color, className, style, ...rest }: SegmentProps): import("react/jsx-runtime").JSX.Element;
22
+ export interface StackedBarProps extends Omit<ComponentProps<"div">, "color"> {
23
+ data: ChartDatum[];
24
+ /** Render a legend from the data labels. */
25
+ legend?: boolean;
26
+ inline?: boolean;
27
+ }
28
+ /**
29
+ * Single horizontal proportion bar — a "60% A / 30% B / 10% C" breakdown.
30
+ * Segments are sized by their flex ratios (no max needed) and coloured from the
31
+ * SERIES palette by default. Generates an overridable `aria-label`.
32
+ */
33
+ declare function StackedBarRoot({ data, legend, inline, className, "aria-label": ariaLabel, ...rest }: StackedBarProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare const StackedBar: typeof StackedBarRoot & {
35
+ Track: typeof Track;
36
+ Segment: typeof Segment;
37
+ Legend: typeof ChartLegend;
38
+ };
39
+ export {};
40
+ //# sourceMappingURL=StackedBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackedBar.d.ts","s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28 +103,6 @@
103
103
  syntax: "*";
104
104
  inherits: false;
105
105
  }
106
- @property --tw-leading {
107
- syntax: "*";
108
- inherits: false;
109
- }
110
- @property --tw-font-weight {
111
- syntax: "*";
112
- inherits: false;
113
- }
114
- @property --tw-border-style {
115
- syntax: "*";
116
- inherits: false;
117
- initial-value: solid;
118
- }
119
- @property --tw-outline-style {
120
- syntax: "*";
121
- inherits: false;
122
- initial-value: solid;
123
- }
124
- @property --tw-duration {
125
- syntax: "*";
126
- inherits: false;
127
- }
128
106
  @property --tw-shadow {
129
107
  syntax: "*";
130
108
  inherits: false;
@@ -190,6 +168,28 @@
190
168
  inherits: false;
191
169
  initial-value: 0 0 #0000;
192
170
  }
171
+ @property --tw-leading {
172
+ syntax: "*";
173
+ inherits: false;
174
+ }
175
+ @property --tw-font-weight {
176
+ syntax: "*";
177
+ inherits: false;
178
+ }
179
+ @property --tw-border-style {
180
+ syntax: "*";
181
+ inherits: false;
182
+ initial-value: solid;
183
+ }
184
+ @property --tw-outline-style {
185
+ syntax: "*";
186
+ inherits: false;
187
+ initial-value: solid;
188
+ }
189
+ @property --tw-duration {
190
+ syntax: "*";
191
+ inherits: false;
192
+ }
193
193
  @property --tw-translate-x {
194
194
  syntax: "*";
195
195
  inherits: false;
@@ -249,11 +249,6 @@
249
249
  --tw-numeric-figure: initial;
250
250
  --tw-numeric-spacing: initial;
251
251
  --tw-numeric-fraction: initial;
252
- --tw-leading: initial;
253
- --tw-font-weight: initial;
254
- --tw-border-style: solid;
255
- --tw-outline-style: solid;
256
- --tw-duration: initial;
257
252
  --tw-shadow: 0 0 #0000;
258
253
  --tw-shadow-color: initial;
259
254
  --tw-shadow-alpha: 100%;
@@ -268,6 +263,11 @@
268
263
  --tw-ring-offset-width: 0px;
269
264
  --tw-ring-offset-color: #fff;
270
265
  --tw-ring-offset-shadow: 0 0 #0000;
266
+ --tw-leading: initial;
267
+ --tw-font-weight: initial;
268
+ --tw-border-style: solid;
269
+ --tw-outline-style: solid;
270
+ --tw-duration: initial;
271
271
  --tw-translate-x: 0;
272
272
  --tw-translate-y: 0;
273
273
  --tw-translate-z: 0;
@@ -4037,6 +4037,218 @@
4037
4037
  white-space: pre;
4038
4038
  word-wrap: normal;
4039
4039
  }
4040
+ :scope._ao-chart, :scope ._ao-chart {
4041
+ --chart-max: 100;
4042
+ --chart-height: 8rem;
4043
+ --chart-size: 8rem;
4044
+ --chart-gap: 0.25rem;
4045
+ color: var(--color-primary);
4046
+ }
4047
+ :scope._ao-chart-success, :scope ._ao-chart-success {
4048
+ color: var(--color-success);
4049
+ }
4050
+ :scope._ao-chart-warning, :scope ._ao-chart-warning {
4051
+ color: var(--color-warning);
4052
+ }
4053
+ :scope._ao-chart-danger, :scope ._ao-chart-danger {
4054
+ color: var(--color-danger);
4055
+ }
4056
+ :scope._ao-chart-info, :scope ._ao-chart-info {
4057
+ color: var(--color-info);
4058
+ }
4059
+ :scope._ao-chart-bars, :scope ._ao-chart-bars {
4060
+ display: grid;
4061
+ grid-template-columns: auto 1fr auto;
4062
+ row-gap: var(--chart-gap);
4063
+ align-items: center;
4064
+ inline-size: 100%;
4065
+ }
4066
+ :scope._ao-chart-bar, :scope ._ao-chart-bar {
4067
+ display: grid;
4068
+ grid-template-columns: subgrid;
4069
+ grid-column: 1 / -1;
4070
+ align-items: center;
4071
+ }
4072
+ :scope._ao-chart-bar-label, :scope ._ao-chart-bar-label {
4073
+ font-size: var(--text-xs);
4074
+ line-height: var(--tw-leading, var(--text-xs--line-height));
4075
+ color: var(--color-text-muted);
4076
+ grid-column: 1;
4077
+ text-align: end;
4078
+ padding-inline-end: 0.5rem;
4079
+ white-space: nowrap;
4080
+ }
4081
+ :scope._ao-chart-bar-track, :scope ._ao-chart-bar-track {
4082
+ grid-column: 2;
4083
+ min-inline-size: 0;
4084
+ }
4085
+ :scope._ao-chart-bar-fill, :scope ._ao-chart-bar-fill {
4086
+ block-size: 0.75rem;
4087
+ inline-size: calc(var(--value) / var(--chart-max) * 100%);
4088
+ background: var(--bar-color, currentColor);
4089
+ border-radius: 2px;
4090
+ transition: inline-size 200ms ease, block-size 200ms ease;
4091
+ }
4092
+ :scope._ao-chart-bar-value, :scope ._ao-chart-bar-value {
4093
+ font-size: var(--text-xs);
4094
+ line-height: var(--tw-leading, var(--text-xs--line-height));
4095
+ color: var(--color-text-muted);
4096
+ --tw-numeric-spacing: tabular-nums;
4097
+ font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
4098
+ grid-column: 3;
4099
+ text-align: end;
4100
+ padding-inline-start: 0.5rem;
4101
+ white-space: nowrap;
4102
+ }
4103
+ :scope._ao-chart:not(._ao-chart-values) ._ao-chart-bar-value, :scope ._ao-chart:not(._ao-chart-values) ._ao-chart-bar-value {
4104
+ display: none;
4105
+ }
4106
+ :scope._ao-chart-bars-vertical, :scope ._ao-chart-bars-vertical {
4107
+ display: flex;
4108
+ flex-direction: row;
4109
+ align-items: stretch;
4110
+ gap: var(--chart-gap);
4111
+ block-size: var(--chart-height);
4112
+ inline-size: 100%;
4113
+ }
4114
+ :scope._ao-chart-bars-vertical ._ao-chart-bar, :scope ._ao-chart-bars-vertical ._ao-chart-bar {
4115
+ display: flex;
4116
+ flex-direction: column;
4117
+ flex: 1 1 0;
4118
+ min-inline-size: 0;
4119
+ align-items: stretch;
4120
+ gap: 0.25rem;
4121
+ }
4122
+ :scope._ao-chart-bars-vertical ._ao-chart-bar-value, :scope ._ao-chart-bars-vertical ._ao-chart-bar-value {
4123
+ order: 0;
4124
+ grid-column: auto;
4125
+ text-align: center;
4126
+ padding: 0;
4127
+ }
4128
+ :scope._ao-chart-bars-vertical ._ao-chart-bar-track, :scope ._ao-chart-bars-vertical ._ao-chart-bar-track {
4129
+ order: 1;
4130
+ flex: 1 1 auto;
4131
+ min-block-size: 0;
4132
+ display: flex;
4133
+ flex-direction: column;
4134
+ justify-content: end;
4135
+ }
4136
+ :scope._ao-chart-bars-vertical ._ao-chart-bar-fill, :scope ._ao-chart-bars-vertical ._ao-chart-bar-fill {
4137
+ inline-size: 100%;
4138
+ block-size: calc(var(--value) / var(--chart-max) * 100%);
4139
+ }
4140
+ :scope._ao-chart-bars-vertical ._ao-chart-bar-label, :scope ._ao-chart-bars-vertical ._ao-chart-bar-label {
4141
+ order: 2;
4142
+ text-align: center;
4143
+ padding: 0;
4144
+ }
4145
+ :scope._ao-chart-stack, :scope ._ao-chart-stack {
4146
+ display: flex;
4147
+ flex-direction: row;
4148
+ inline-size: 100%;
4149
+ block-size: 0.75rem;
4150
+ border-radius: 9999px;
4151
+ overflow: hidden;
4152
+ background: var(--color-surface-strong);
4153
+ }
4154
+ :scope._ao-chart-segment, :scope ._ao-chart-segment {
4155
+ flex: var(--value) 1 0;
4156
+ min-inline-size: 0;
4157
+ background: var(--segment-color, currentColor);
4158
+ transition: flex-grow 200ms ease;
4159
+ }
4160
+ :scope._ao-chart-segment + ._ao-chart-segment, :scope ._ao-chart-segment + ._ao-chart-segment {
4161
+ box-shadow: -1px 0 0 0 var(--color-surface);
4162
+ }
4163
+ :scope._ao-chart-donut-figure, :scope ._ao-chart-donut-figure {
4164
+ position: relative;
4165
+ inline-size: var(--chart-size);
4166
+ aspect-ratio: 1;
4167
+ display: inline-grid;
4168
+ place-items: center;
4169
+ }
4170
+ :scope._ao-chart-donut, :scope ._ao-chart-donut {
4171
+ --donut-thickness: 33%;
4172
+ inline-size: var(--chart-size);
4173
+ aspect-ratio: 1;
4174
+ border-radius: 50%;
4175
+ background: conic-gradient(var(--donut-segments, currentColor 0 100%));
4176
+ -webkit-mask: radial-gradient( circle at center, transparent calc(50% - var(--donut-thickness)), #000 calc(50% - var(--donut-thickness)) );
4177
+ mask: radial-gradient( circle at center, transparent calc(50% - var(--donut-thickness)), #000 calc(50% - var(--donut-thickness)) );
4178
+ }
4179
+ :scope._ao-chart-donut-figure > ._ao-chart-donut, :scope ._ao-chart-donut-figure > ._ao-chart-donut {
4180
+ grid-area: 1 / 1;
4181
+ inline-size: 100%;
4182
+ }
4183
+ :scope._ao-chart-donut-pie, :scope ._ao-chart-donut-pie {
4184
+ --donut-thickness: 50%;
4185
+ }
4186
+ :scope._ao-chart-donut-center, :scope ._ao-chart-donut-center {
4187
+ text-align: center;
4188
+ font-size: var(--text-sm);
4189
+ line-height: var(--tw-leading, var(--text-sm--line-height));
4190
+ --tw-leading: var(--leading-tight);
4191
+ line-height: var(--leading-tight);
4192
+ --tw-font-weight: var(--font-weight-semibold);
4193
+ font-weight: var(--font-weight-semibold);
4194
+ --tw-numeric-spacing: tabular-nums;
4195
+ font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
4196
+ grid-area: 1 / 1;
4197
+ z-index: 1;
4198
+ pointer-events: none;
4199
+ }
4200
+ :scope._ao-chart-legend, :scope ._ao-chart-legend {
4201
+ display: flex;
4202
+ flex-wrap: wrap;
4203
+ align-items: center;
4204
+ column-gap: calc(var(--spacing) * 3);
4205
+ row-gap: calc(var(--spacing) * 1);
4206
+ font-size: var(--text-xs);
4207
+ line-height: var(--tw-leading, var(--text-xs--line-height));
4208
+ color: var(--color-text-muted);
4209
+ list-style: none;
4210
+ margin: 0;
4211
+ padding: 0;
4212
+ }
4213
+ :scope._ao-chart-legend-item, :scope ._ao-chart-legend-item {
4214
+ display: inline-flex;
4215
+ align-items: center;
4216
+ gap: calc(var(--spacing) * 1.5);
4217
+ }
4218
+ :scope._ao-chart-legend-item::before, :scope ._ao-chart-legend-item::before {
4219
+ content: "";
4220
+ inline-size: 0.625rem;
4221
+ block-size: 0.625rem;
4222
+ border-radius: 2px;
4223
+ background: var(--legend-color, currentColor);
4224
+ flex-shrink: 0;
4225
+ }
4226
+ :scope._ao-chart-sm, :scope ._ao-chart-sm {
4227
+ --chart-height: 4rem;
4228
+ --chart-size: 4rem;
4229
+ }
4230
+ :scope._ao-chart-lg, :scope ._ao-chart-lg {
4231
+ --chart-height: 12rem;
4232
+ --chart-size: 12rem;
4233
+ }
4234
+ :scope._ao-chart-inline, :scope ._ao-chart-inline {
4235
+ display: inline-flex;
4236
+ vertical-align: middle;
4237
+ --chart-height: 1em;
4238
+ --chart-size: 1.25em;
4239
+ }
4240
+ :scope._ao-chart-inline ._ao-chart-stack, :scope ._ao-chart-inline ._ao-chart-stack {
4241
+ inline-size: 6em;
4242
+ block-size: 0.5em;
4243
+ }
4244
+ :scope._ao-chart-inline ._ao-chart-bars, :scope ._ao-chart-inline ._ao-chart-bars, :scope._ao-chart-inline._ao-chart-bars, :scope ._ao-chart-inline._ao-chart-bars {
4245
+ inline-size: 6em;
4246
+ }
4247
+ @media (prefers-reduced-motion: reduce) {
4248
+ :scope._ao-chart-bar-fill, :scope ._ao-chart-bar-fill, :scope._ao-chart-segment, :scope ._ao-chart-segment {
4249
+ transition: none;
4250
+ }
4251
+ }
4040
4252
  :scope._ao-collapse, :scope ._ao-collapse {
4041
4253
  visibility: collapse;
4042
4254
  }
@@ -4127,6 +4339,10 @@
4127
4339
  --tw-numeric-spacing: tabular-nums;
4128
4340
  font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
4129
4341
  }
4342
+ :scope._ao-ring, :scope ._ao-ring {
4343
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
4344
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
4345
+ }
4130
4346
  :scope._ao-select-all, :scope ._ao-select-all {
4131
4347
  -webkit-user-select: all;
4132
4348
  user-select: all;
@@ -0,0 +1,40 @@
1
+ import { CSSProperties } from 'react';
2
+ /** A single data point. Only `value` is required. */
3
+ export interface ChartDatum {
4
+ /** Category name. When present, renders a label (and feeds the aria-label). */
5
+ label?: string;
6
+ /** The magnitude. Bars normalise it against the chart max; donut/stack sum it. */
7
+ value: number;
8
+ /** Per-segment colour override (any CSS colour). Defaults to the SERIES cycle. */
9
+ color?: string;
10
+ }
11
+ export type ChartSize = "sm" | "md" | "lg";
12
+ export type ChartType = "bar" | "stack" | "donut" | "pie";
13
+ /**
14
+ * Multi-series palette — references EXISTING Flexoki palette tokens, NOT a new
15
+ * token layer. Cycled by index (`SERIES[i % len]`); a datum's own `color`
16
+ * overrides. Vanilla authors copy the same sequence (it's documented), so both
17
+ * bundles render identical colours. Single-series charts ignore this entirely
18
+ * and follow `currentColor`.
19
+ */
20
+ export declare const SERIES: readonly ["var(--color-blue-500)", "var(--color-orange-400)", "var(--color-green-500)", "var(--color-purple-400)", "var(--color-cyan-500)", "var(--color-magenta-400)", "var(--color-yellow-500)", "var(--color-red-400)"];
21
+ /** Resolve a segment's colour: explicit `datum.color` wins, else cycle SERIES. */
22
+ export declare function seriesColor(datum: ChartDatum, index: number): string;
23
+ /** Largest value, floored at 1 so the bar calc never divides by zero. */
24
+ export declare function computeMax(data: ChartDatum[], explicit?: number): number;
25
+ /**
26
+ * Build the cumulative `conic-gradient` stop string for a donut/pie:
27
+ * `<color> <from>deg <to>deg, …`. Degrees accumulate across segments. A
28
+ * non-positive total yields a single neutral fill so the ring isn't blank.
29
+ */
30
+ export declare function buildDonutSegments(data: ChartDatum[]): string;
31
+ /**
32
+ * Auto-generated summary for the chart root's `aria-label`. Callers that pass
33
+ * their own `aria-label` skip this. Example: "Bar chart. Mon: 80, Tue: 52."
34
+ */
35
+ export declare function buildAriaLabel(type: ChartType, data: ChartDatum[]): string;
36
+ /** Native `title` text for a bar/segment/legend row. */
37
+ export declare function datumTitle(datum: ChartDatum): string;
38
+ /** Merge admin custom-property vars with an incoming `style` (incoming wins). */
39
+ export declare function mergeStyle(vars: Record<string, string | number>, incoming?: CSSProperties): CSSProperties;
40
+ //# sourceMappingURL=chart-internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-internal.d.ts","sourceRoot":"","sources":["../src/chart-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,qDAAqD;AACrD,MAAM,WAAW,UAAU;IACzB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,4NAST,CAAC;AAEX,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAa7D;AASD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAG1E;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEpD;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,aAAa,GACvB,aAAa,CAEf"}