@eduardoalvarez/arrecife 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +706 -470
- package/dist/brand/index.cjs +112 -95
- package/dist/brand/index.d.cts +40 -39
- package/dist/brand/index.d.ts +40 -39
- package/dist/brand/index.js +5 -4
- package/dist/catalog-D13txprv.d.cts +78 -0
- package/dist/catalog-D13txprv.d.ts +78 -0
- package/dist/chart/index.cjs +100 -83
- package/dist/chart/index.d.cts +66 -66
- package/dist/chart/index.d.ts +66 -66
- package/dist/chart/index.js +14 -12
- package/dist/chunk-25YNFCIF.js +141 -0
- package/dist/{chunk-YZ2SDOVZ.js → chunk-6O3KWB6P.js} +30 -30
- package/dist/chunk-CKRSQPTX.js +36 -0
- package/dist/{chunk-ZEOQKRQ7.js → chunk-DKCN7BAL.js} +1 -1
- package/dist/chunk-GCRII2KQ.js +86 -0
- package/dist/chunk-JMOOFZ3B.js +42 -0
- package/dist/chunk-O4TAH7YJ.js +276 -0
- package/dist/chunk-ODBFN44D.js +45 -0
- package/dist/{chunk-VPT32GPG.js → chunk-PMN7NR3G.js} +2 -2
- package/dist/chunk-XKYHTOUJ.js +27 -0
- package/dist/form/index.cjs +109 -92
- package/dist/form/index.d.cts +43 -42
- package/dist/form/index.d.ts +43 -42
- package/dist/form/index.js +25 -23
- package/dist/index.cjs +1068 -929
- package/dist/index.d.cts +770 -773
- package/dist/index.d.ts +770 -773
- package/dist/index.js +629 -675
- package/dist/{label-DuTvJGxD.d.ts → label-MgHFKnFy.d.cts} +3 -3
- package/dist/{label-DuTvJGxD.d.cts → label-MgHFKnFy.d.ts} +3 -3
- package/dist/og/index.cjs +130 -130
- package/dist/og/index.d.cts +93 -89
- package/dist/og/index.d.ts +93 -89
- package/dist/og/index.js +106 -106
- package/dist/shiki/index.cjs +28 -30
- package/dist/shiki/index.d.cts +4 -4
- package/dist/shiki/index.d.ts +4 -4
- package/dist/shiki/index.js +12 -12
- package/dist/theme/index.cjs +97 -0
- package/dist/theme/index.d.cts +144 -0
- package/dist/theme/index.d.ts +144 -0
- package/dist/theme/index.js +2 -0
- package/dist/tokens/index.cjs +133 -86
- package/dist/tokens/index.d.cts +246 -161
- package/dist/tokens/index.d.ts +246 -161
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/theme.css +133 -98
- package/dist/variants/index.cjs +192 -0
- package/dist/variants/index.d.cts +192 -0
- package/dist/variants/index.d.ts +192 -0
- package/dist/variants/index.js +3 -0
- package/llms.txt +810 -744
- package/package.json +20 -11
- package/dist/catalogo-Du5ID-Hi.d.cts +0 -77
- package/dist/catalogo-Du5ID-Hi.d.ts +0 -77
- package/dist/chunk-E3OMP2DL.js +0 -36
- package/dist/chunk-KPZNNMV5.js +0 -83
- package/dist/chunk-NHS7ETKJ.js +0 -27
- package/dist/chunk-TSPJOM6K.js +0 -229
- package/dist/chunk-UOWIDFCB.js +0 -81
- package/dist/tema/index.cjs +0 -94
- package/dist/tema/index.d.cts +0 -110
- package/dist/tema/index.d.ts +0 -110
- package/dist/tema/index.js +0 -2
package/dist/chart/index.d.cts
CHANGED
|
@@ -3,93 +3,93 @@ import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
|
3
3
|
import { Legend, Tooltip } from 'recharts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* The chassis for charts: container, tooltip and legend in the system's
|
|
7
|
+
* vocabulary. Recharts paints; this decides how it looks.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* It is published at `@eduardoalvarez/arrecife/chart` and NOT at the root.
|
|
10
|
+
* Recharts is heavy, and only one of the five projects draws metrics: hanging it
|
|
11
|
+
* off the main index would force the other four to install it just so their
|
|
12
|
+
* bundler could resolve an import they never execute. It is an OPTIONAL peer
|
|
13
|
+
* dependency, by the same criterion that keeps `./og` and `./shiki` React-free.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* What this layer adds — and what was lost by copying shadcn's `chart.tsx` into
|
|
16
|
+
* each project — are three things that drift on their own:
|
|
17
17
|
*
|
|
18
|
-
* 1.
|
|
19
|
-
*
|
|
20
|
-
* 2.
|
|
21
|
-
*
|
|
22
|
-
* 3.
|
|
23
|
-
*
|
|
18
|
+
* 1. The series palette comes from `tokens.series` and follows the mode. There
|
|
19
|
+
* are four and they are told apart by hue, not by lightness.
|
|
20
|
+
* 2. The grid, the axes and the cursor use `hairline` and `textMuted`, not
|
|
21
|
+
* Recharts' default greys, which are not part of this identity.
|
|
22
|
+
* 3. The tooltip appears where it will stay: `isAnimationActive` is off
|
|
23
|
+
* everywhere, because the system does not animate position.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The data pieces — `BarChart`, `Line`, `XAxis` — are NOT re-exported. They are
|
|
26
|
+
* Recharts' API, the project already knows it, and wrapping them would be a
|
|
27
|
+
* layer of names to keep in sync with the library's version.
|
|
28
28
|
*/
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* The color of series `index`, as a custom property.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* It returns `var(--color-series-N)` and not the hexadecimal: read in JS, the
|
|
33
|
+
* hex would be the one from whichever mode was active when the component
|
|
34
|
+
* mounted, and it would not change when the theme is toggled. The variable is
|
|
35
|
+
* resolved by the browser on every paint.
|
|
35
36
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* It wraps around past four. Two series sharing a color is a visible failure,
|
|
38
|
+
* and that is the correct signal: the chart has more categories than this
|
|
39
|
+
* identity can tell apart, and what to do is group them into «otros».
|
|
39
40
|
*/
|
|
40
|
-
declare function
|
|
41
|
-
/**
|
|
42
|
-
declare const
|
|
41
|
+
declare function seriesColor(index: number): string;
|
|
42
|
+
/** All four, in order, to hand to a `Pie` with `Cell` in one go. */
|
|
43
|
+
declare const SERIES_COLORS: string[];
|
|
43
44
|
type ChartContainerProps = Omit<ComponentPropsWithoutRef<'figure'>, 'title'> & {
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* What the chart shows, in one sentence. Mandatory, like `Progress`'s `label`:
|
|
47
|
+
* a bar `<svg>` with no accessible name is not «a chart without a label», it
|
|
48
|
+
* is an empty region.
|
|
48
49
|
*/
|
|
49
50
|
label: string;
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
-
* visualmente.
|
|
52
|
+
* What the chart says, in words. It goes in a visually hidden `figcaption`.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* caída en mayo
|
|
54
|
+
* It does not replace the chart: Recharts' accessibility layer already lets
|
|
55
|
+
* you walk the points with the keyboard. It is the headline — «sube de 24 a 52
|
|
56
|
+
* con una caída en mayo» — that no point-by-point walk gives you.
|
|
57
57
|
*/
|
|
58
58
|
summary?: ReactNode;
|
|
59
|
-
/**
|
|
59
|
+
/** Height in pixels. Recharts needs a concrete one to measure itself. */
|
|
60
60
|
height?: number;
|
|
61
61
|
children: ReactNode;
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Wraps the chart in a `<figure>` with an accessible name and gives Recharts the
|
|
65
|
+
* concrete height it needs to measure itself.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* The `<figure>` carries NO `role`: it already has its implicit one, and putting
|
|
68
|
+
* `group` on top of it is a role not allowed for the element — axe flags it.
|
|
69
|
+
* What it does carry is `aria-label`, which is what names it.
|
|
70
70
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
71
|
+
* And the content is NOT `aria-hidden`. That was the first thing tried, with the
|
|
72
|
+
* argument that announcing every tick does not tell what the chart tells, and it
|
|
73
|
+
* is wrong for two reasons: Recharts' accessibility layer makes the chart
|
|
74
|
+
* walkable with the keyboard, and hiding a subtree containing focusable elements
|
|
75
|
+
* is a violation in itself — focus lands on something that does not exist for
|
|
76
|
+
* whoever is listening. The summary adds to that, it does not replace it.
|
|
77
77
|
*/
|
|
78
78
|
declare function ChartContainer({ label, summary, height, className, children, ...props }: ChartContainerProps): react.JSX.Element;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Recharts' `Tooltip` with the system's defaults: no animation, and the cursor
|
|
81
|
+
* tinted `surfaceRaised`.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
83
|
+
* You pass `content={<ChartTooltipContent />}` for the box.
|
|
84
84
|
*/
|
|
85
85
|
declare function ChartTooltip(props: ComponentPropsWithoutRef<typeof Tooltip>): react.JSX.Element;
|
|
86
86
|
declare function ChartLegend(props: ComponentPropsWithoutRef<typeof Legend>): react.JSX.Element;
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* What Recharts passes to a `content`, declared here in short form.
|
|
89
89
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
90
|
+
* Recharts' types for this are open and drag in generics that add nothing at the
|
|
91
|
+
* call site; `any` is banned in this repo, so what is actually read is declared
|
|
92
|
+
* and the value is treated as `unknown`.
|
|
93
93
|
*/
|
|
94
94
|
type ChartPayloadItem = {
|
|
95
95
|
name?: string | number | undefined;
|
|
@@ -101,27 +101,27 @@ type ChartTooltipContentProps = {
|
|
|
101
101
|
active?: boolean | undefined;
|
|
102
102
|
payload?: readonly ChartPayloadItem[] | undefined;
|
|
103
103
|
label?: ReactNode;
|
|
104
|
-
/**
|
|
105
|
-
formatter?: ((
|
|
106
|
-
/**
|
|
104
|
+
/** Formats the value. Without it, it is printed as is: the library imposes no locale. */
|
|
105
|
+
formatter?: ((value: unknown, item: ChartPayloadItem) => ReactNode) | undefined;
|
|
106
|
+
/** Hides the header, for a single-category chart. */
|
|
107
107
|
hideLabel?: boolean;
|
|
108
108
|
className?: string;
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
111
|
+
* The tooltip's box. It is a system card — `surface`, control border, standard
|
|
112
|
+
* shadow — and not Recharts' white box, which in dark mode is a white rectangle
|
|
113
|
+
* on top of a dark panel.
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* The color swatch is an 8px square, not a circle: it is the same mark the
|
|
116
|
+
* legend uses, and at 8 pixels a circle and a square are harder to tell apart
|
|
117
|
+
* from each other than two colors of the palette are.
|
|
118
118
|
*/
|
|
119
119
|
declare function ChartTooltipContent({ active, payload, label, formatter, hideLabel, className, }: ChartTooltipContentProps): react.JSX.Element | null;
|
|
120
120
|
type ChartLegendContentProps = {
|
|
121
121
|
payload?: readonly ChartPayloadItem[] | undefined;
|
|
122
122
|
className?: string;
|
|
123
123
|
};
|
|
124
|
-
/**
|
|
124
|
+
/** The legend, with the tooltip's same square swatch and the `label` scale. */
|
|
125
125
|
declare function ChartLegendContent({ payload, className }: ChartLegendContentProps): react.JSX.Element | null;
|
|
126
126
|
|
|
127
|
-
export {
|
|
127
|
+
export { ChartContainer, type ChartContainerProps, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, SERIES_COLORS, seriesColor };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -3,93 +3,93 @@ import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
|
3
3
|
import { Legend, Tooltip } from 'recharts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* The chassis for charts: container, tooltip and legend in the system's
|
|
7
|
+
* vocabulary. Recharts paints; this decides how it looks.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* It is published at `@eduardoalvarez/arrecife/chart` and NOT at the root.
|
|
10
|
+
* Recharts is heavy, and only one of the five projects draws metrics: hanging it
|
|
11
|
+
* off the main index would force the other four to install it just so their
|
|
12
|
+
* bundler could resolve an import they never execute. It is an OPTIONAL peer
|
|
13
|
+
* dependency, by the same criterion that keeps `./og` and `./shiki` React-free.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* What this layer adds — and what was lost by copying shadcn's `chart.tsx` into
|
|
16
|
+
* each project — are three things that drift on their own:
|
|
17
17
|
*
|
|
18
|
-
* 1.
|
|
19
|
-
*
|
|
20
|
-
* 2.
|
|
21
|
-
*
|
|
22
|
-
* 3.
|
|
23
|
-
*
|
|
18
|
+
* 1. The series palette comes from `tokens.series` and follows the mode. There
|
|
19
|
+
* are four and they are told apart by hue, not by lightness.
|
|
20
|
+
* 2. The grid, the axes and the cursor use `hairline` and `textMuted`, not
|
|
21
|
+
* Recharts' default greys, which are not part of this identity.
|
|
22
|
+
* 3. The tooltip appears where it will stay: `isAnimationActive` is off
|
|
23
|
+
* everywhere, because the system does not animate position.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The data pieces — `BarChart`, `Line`, `XAxis` — are NOT re-exported. They are
|
|
26
|
+
* Recharts' API, the project already knows it, and wrapping them would be a
|
|
27
|
+
* layer of names to keep in sync with the library's version.
|
|
28
28
|
*/
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* The color of series `index`, as a custom property.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* It returns `var(--color-series-N)` and not the hexadecimal: read in JS, the
|
|
33
|
+
* hex would be the one from whichever mode was active when the component
|
|
34
|
+
* mounted, and it would not change when the theme is toggled. The variable is
|
|
35
|
+
* resolved by the browser on every paint.
|
|
35
36
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* It wraps around past four. Two series sharing a color is a visible failure,
|
|
38
|
+
* and that is the correct signal: the chart has more categories than this
|
|
39
|
+
* identity can tell apart, and what to do is group them into «otros».
|
|
39
40
|
*/
|
|
40
|
-
declare function
|
|
41
|
-
/**
|
|
42
|
-
declare const
|
|
41
|
+
declare function seriesColor(index: number): string;
|
|
42
|
+
/** All four, in order, to hand to a `Pie` with `Cell` in one go. */
|
|
43
|
+
declare const SERIES_COLORS: string[];
|
|
43
44
|
type ChartContainerProps = Omit<ComponentPropsWithoutRef<'figure'>, 'title'> & {
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* What the chart shows, in one sentence. Mandatory, like `Progress`'s `label`:
|
|
47
|
+
* a bar `<svg>` with no accessible name is not «a chart without a label», it
|
|
48
|
+
* is an empty region.
|
|
48
49
|
*/
|
|
49
50
|
label: string;
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
-
* visualmente.
|
|
52
|
+
* What the chart says, in words. It goes in a visually hidden `figcaption`.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* caída en mayo
|
|
54
|
+
* It does not replace the chart: Recharts' accessibility layer already lets
|
|
55
|
+
* you walk the points with the keyboard. It is the headline — «sube de 24 a 52
|
|
56
|
+
* con una caída en mayo» — that no point-by-point walk gives you.
|
|
57
57
|
*/
|
|
58
58
|
summary?: ReactNode;
|
|
59
|
-
/**
|
|
59
|
+
/** Height in pixels. Recharts needs a concrete one to measure itself. */
|
|
60
60
|
height?: number;
|
|
61
61
|
children: ReactNode;
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Wraps the chart in a `<figure>` with an accessible name and gives Recharts the
|
|
65
|
+
* concrete height it needs to measure itself.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* The `<figure>` carries NO `role`: it already has its implicit one, and putting
|
|
68
|
+
* `group` on top of it is a role not allowed for the element — axe flags it.
|
|
69
|
+
* What it does carry is `aria-label`, which is what names it.
|
|
70
70
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
71
|
+
* And the content is NOT `aria-hidden`. That was the first thing tried, with the
|
|
72
|
+
* argument that announcing every tick does not tell what the chart tells, and it
|
|
73
|
+
* is wrong for two reasons: Recharts' accessibility layer makes the chart
|
|
74
|
+
* walkable with the keyboard, and hiding a subtree containing focusable elements
|
|
75
|
+
* is a violation in itself — focus lands on something that does not exist for
|
|
76
|
+
* whoever is listening. The summary adds to that, it does not replace it.
|
|
77
77
|
*/
|
|
78
78
|
declare function ChartContainer({ label, summary, height, className, children, ...props }: ChartContainerProps): react.JSX.Element;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
80
|
+
* Recharts' `Tooltip` with the system's defaults: no animation, and the cursor
|
|
81
|
+
* tinted `surfaceRaised`.
|
|
82
82
|
*
|
|
83
|
-
*
|
|
83
|
+
* You pass `content={<ChartTooltipContent />}` for the box.
|
|
84
84
|
*/
|
|
85
85
|
declare function ChartTooltip(props: ComponentPropsWithoutRef<typeof Tooltip>): react.JSX.Element;
|
|
86
86
|
declare function ChartLegend(props: ComponentPropsWithoutRef<typeof Legend>): react.JSX.Element;
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* What Recharts passes to a `content`, declared here in short form.
|
|
89
89
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
90
|
+
* Recharts' types for this are open and drag in generics that add nothing at the
|
|
91
|
+
* call site; `any` is banned in this repo, so what is actually read is declared
|
|
92
|
+
* and the value is treated as `unknown`.
|
|
93
93
|
*/
|
|
94
94
|
type ChartPayloadItem = {
|
|
95
95
|
name?: string | number | undefined;
|
|
@@ -101,27 +101,27 @@ type ChartTooltipContentProps = {
|
|
|
101
101
|
active?: boolean | undefined;
|
|
102
102
|
payload?: readonly ChartPayloadItem[] | undefined;
|
|
103
103
|
label?: ReactNode;
|
|
104
|
-
/**
|
|
105
|
-
formatter?: ((
|
|
106
|
-
/**
|
|
104
|
+
/** Formats the value. Without it, it is printed as is: the library imposes no locale. */
|
|
105
|
+
formatter?: ((value: unknown, item: ChartPayloadItem) => ReactNode) | undefined;
|
|
106
|
+
/** Hides the header, for a single-category chart. */
|
|
107
107
|
hideLabel?: boolean;
|
|
108
108
|
className?: string;
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
111
|
+
* The tooltip's box. It is a system card — `surface`, control border, standard
|
|
112
|
+
* shadow — and not Recharts' white box, which in dark mode is a white rectangle
|
|
113
|
+
* on top of a dark panel.
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* The color swatch is an 8px square, not a circle: it is the same mark the
|
|
116
|
+
* legend uses, and at 8 pixels a circle and a square are harder to tell apart
|
|
117
|
+
* from each other than two colors of the palette are.
|
|
118
118
|
*/
|
|
119
119
|
declare function ChartTooltipContent({ active, payload, label, formatter, hideLabel, className, }: ChartTooltipContentProps): react.JSX.Element | null;
|
|
120
120
|
type ChartLegendContentProps = {
|
|
121
121
|
payload?: readonly ChartPayloadItem[] | undefined;
|
|
122
122
|
className?: string;
|
|
123
123
|
};
|
|
124
|
-
/**
|
|
124
|
+
/** The legend, with the tooltip's same square swatch and the `label` scale. */
|
|
125
125
|
declare function ChartLegendContent({ payload, className }: ChartLegendContentProps): react.JSX.Element | null;
|
|
126
126
|
|
|
127
|
-
export {
|
|
127
|
+
export { ChartContainer, type ChartContainerProps, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, SERIES_COLORS, seriesColor };
|
package/dist/chart/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '../chunk-
|
|
1
|
+
'use client';
|
|
2
|
+
import { Text } from '../chunk-JMOOFZ3B.js';
|
|
3
|
+
import '../chunk-ODBFN44D.js';
|
|
4
|
+
import { cn } from '../chunk-XKYHTOUJ.js';
|
|
5
|
+
import '../chunk-O4TAH7YJ.js';
|
|
4
6
|
import '../chunk-MLKGABMK.js';
|
|
5
7
|
import { ResponsiveContainer, Tooltip, Legend } from 'recharts';
|
|
6
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
9
|
|
|
8
|
-
function
|
|
9
|
-
return `var(--color-
|
|
10
|
+
function seriesColor(index) {
|
|
11
|
+
return `var(--color-series-${Math.abs(index) % 4 + 1})`;
|
|
10
12
|
}
|
|
11
|
-
var
|
|
13
|
+
var SERIES_COLORS = [0, 1, 2, 3].map(seriesColor);
|
|
12
14
|
function ChartContainer({
|
|
13
15
|
label,
|
|
14
16
|
summary,
|
|
@@ -23,9 +25,9 @@ function ChartContainer({
|
|
|
23
25
|
"aria-label": label,
|
|
24
26
|
className: cn(
|
|
25
27
|
"w-full",
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
28
|
+
// The grid and the axes, with the system's tokens instead of Recharts'
|
|
29
|
+
// default greys. They go as descendant variants because the nodes are
|
|
30
|
+
// painted by the library and there is nowhere to put a class on them.
|
|
29
31
|
"[&_.recharts-cartesian-grid_line]:stroke-hairline",
|
|
30
32
|
"[&_.recharts-cartesian-axis-line]:stroke-hairline",
|
|
31
33
|
"[&_.recharts-cartesian-axis-tick_text]:fill-text-muted",
|
|
@@ -75,7 +77,7 @@ function ChartTooltipContent({
|
|
|
75
77
|
{
|
|
76
78
|
"aria-hidden": "true",
|
|
77
79
|
className: "rounded-chip size-2 shrink-0",
|
|
78
|
-
style: { backgroundColor: item.color ??
|
|
80
|
+
style: { backgroundColor: item.color ?? seriesColor(i) }
|
|
79
81
|
}
|
|
80
82
|
),
|
|
81
83
|
/* @__PURE__ */ jsx(Text, { as: "span", variant: "label", tone: "secondary", className: "font-normal", children: item.name }),
|
|
@@ -93,11 +95,11 @@ function ChartLegendContent({ payload, className }) {
|
|
|
93
95
|
{
|
|
94
96
|
"aria-hidden": "true",
|
|
95
97
|
className: "rounded-chip size-2 shrink-0",
|
|
96
|
-
style: { backgroundColor: item.color ??
|
|
98
|
+
style: { backgroundColor: item.color ?? seriesColor(i) }
|
|
97
99
|
}
|
|
98
100
|
),
|
|
99
101
|
/* @__PURE__ */ jsx(Text, { as: "span", variant: "label", tone: "secondary", className: "font-normal", children: item.value })
|
|
100
102
|
] }, `${String(item.dataKey ?? item.value ?? i)}`)) });
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
export {
|
|
105
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, SERIES_COLORS, seriesColor };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
// src/variants/button.ts
|
|
4
|
+
var button = cva(
|
|
5
|
+
[
|
|
6
|
+
"inline-flex cursor-pointer items-center justify-center gap-step-xs whitespace-nowrap select-none",
|
|
7
|
+
"rounded-control font-sans font-medium",
|
|
8
|
+
"transition-standard",
|
|
9
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
10
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
11
|
+
"[&_svg]:shrink-0"
|
|
12
|
+
],
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
primary: [
|
|
17
|
+
"bg-accent text-accent-on hover:bg-accent-hover",
|
|
18
|
+
"light:bg-brand-hull light:text-accent-on light:hover:bg-text-secondary"
|
|
19
|
+
],
|
|
20
|
+
conversion: "bg-warm text-warm-on hover:bg-warm-hover",
|
|
21
|
+
secondary: [
|
|
22
|
+
"border-hairline-hover border bg-transparent text-text-primary",
|
|
23
|
+
"hover:border-accent hover:text-accent"
|
|
24
|
+
],
|
|
25
|
+
tertiary: [
|
|
26
|
+
"bg-transparent font-mono font-normal text-text-secondary",
|
|
27
|
+
"hover:text-accent hover:underline hover:underline-offset-4"
|
|
28
|
+
],
|
|
29
|
+
/** Irreversible only. Never for «cancel» on a form. */
|
|
30
|
+
destructive: "bg-danger text-danger-on hover:bg-danger-hover",
|
|
31
|
+
destructiveOutline: [
|
|
32
|
+
"border-danger text-danger border bg-transparent",
|
|
33
|
+
"hover:bg-danger hover:text-danger-on"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
sm: "h-8 px-control-sm text-label",
|
|
38
|
+
md: "h-10 px-control-md text-ui",
|
|
39
|
+
lg: "h-12 px-control-lg text-lead",
|
|
40
|
+
/** A 42×42 square, no text. `aria-label` is mandatory on it. */
|
|
41
|
+
icon: "size-control-icon p-0",
|
|
42
|
+
/** 32×32, for a table row. Same height as `sm`, and same mandatory `aria-label`. */
|
|
43
|
+
"icon-sm": "size-control-icon-sm p-0"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
compoundVariants: [
|
|
47
|
+
/**
|
|
48
|
+
* The tertiary has no box: neither horizontal padding nor control height.
|
|
49
|
+
* It goes here rather than as `px-0` on the variant so it beats the size's
|
|
50
|
+
* `px-*` without depending on the order cva concatenates classes in.
|
|
51
|
+
*/
|
|
52
|
+
{ variant: "tertiary", size: ["sm", "md", "lg"], class: "h-auto px-0" }
|
|
53
|
+
],
|
|
54
|
+
defaultVariants: { variant: "primary", size: "md" }
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
var badge = cva(
|
|
58
|
+
["inline-flex items-center gap-step-xs", "rounded-chip px-step-xs py-0.5", "font-sans text-tag", "transition-standard"],
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
variant: {
|
|
62
|
+
neutral: "bg-surface-raised text-text-secondary",
|
|
63
|
+
accent: "bg-accent/8 text-text-primary",
|
|
64
|
+
warm: "bg-warm/8 text-text-primary",
|
|
65
|
+
success: "bg-success/8 text-text-primary",
|
|
66
|
+
warning: "bg-warning/8 text-text-primary",
|
|
67
|
+
error: "bg-error/8 text-text-primary"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: { variant: "neutral" }
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
var category = cva(
|
|
74
|
+
[
|
|
75
|
+
"inline-flex items-center gap-step-xs",
|
|
76
|
+
"rounded-pill px-step-sm py-0.5",
|
|
77
|
+
"font-mono text-chip",
|
|
78
|
+
"border transition-standard"
|
|
79
|
+
],
|
|
80
|
+
{
|
|
81
|
+
variants: {
|
|
82
|
+
active: {
|
|
83
|
+
false: "border-warm/28 bg-transparent text-warm",
|
|
84
|
+
true: "border-warm bg-warm text-warm-on"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: { active: false }
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
var metric = ["inline-flex items-center gap-step-xs", "rounded-pill", "font-mono text-chip text-text-muted"];
|
|
91
|
+
var alert = cva("w-full rounded-card border p-step-md font-sans text-ui", {
|
|
92
|
+
variants: {
|
|
93
|
+
variant: {
|
|
94
|
+
accent: "text-text-secondary",
|
|
95
|
+
success: "text-text-secondary",
|
|
96
|
+
warning: "text-text-secondary",
|
|
97
|
+
error: "text-text-secondary"
|
|
98
|
+
},
|
|
99
|
+
emphasis: {
|
|
100
|
+
subtle: "",
|
|
101
|
+
strong: ""
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
compoundVariants: [
|
|
105
|
+
{ variant: "accent", emphasis: "subtle", class: "border-accent/22 bg-accent/8" },
|
|
106
|
+
{ variant: "success", emphasis: "subtle", class: "border-success/22 bg-success/8" },
|
|
107
|
+
{ variant: "warning", emphasis: "subtle", class: "border-warning/22 bg-warning/8" },
|
|
108
|
+
{ variant: "error", emphasis: "subtle", class: "border-error/22 bg-error/8" },
|
|
109
|
+
{ variant: "accent", emphasis: "strong", class: "border-accent bg-accent/10" },
|
|
110
|
+
{ variant: "success", emphasis: "strong", class: "border-success bg-success/10" },
|
|
111
|
+
{ variant: "warning", emphasis: "strong", class: "border-warning bg-warning/10" },
|
|
112
|
+
{ variant: "error", emphasis: "strong", class: "border-error bg-error/10" }
|
|
113
|
+
],
|
|
114
|
+
defaultVariants: { variant: "accent", emphasis: "subtle" }
|
|
115
|
+
});
|
|
116
|
+
var avatar = cva(
|
|
117
|
+
"relative flex shrink-0 overflow-hidden rounded-pill bg-surface-raised border border-hairline",
|
|
118
|
+
{
|
|
119
|
+
variants: {
|
|
120
|
+
size: {
|
|
121
|
+
sm: "size-8",
|
|
122
|
+
md: "size-10",
|
|
123
|
+
lg: "size-14",
|
|
124
|
+
xl: "size-24"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
defaultVariants: { size: "md" }
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
// src/variants/card.ts
|
|
132
|
+
var CARD_SURFACE = "rounded-card border-hairline bg-surface border";
|
|
133
|
+
var CARD_HOVER = "transition-standard hover:border-hairline-hover";
|
|
134
|
+
var CARD = [
|
|
135
|
+
"group block cursor-pointer",
|
|
136
|
+
CARD_SURFACE,
|
|
137
|
+
CARD_HOVER,
|
|
138
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
export { CARD, CARD_HOVER, CARD_SURFACE, alert, avatar, badge, button, category, metric };
|