@eduardoalvarez/arrecife 0.7.0 → 0.9.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 +51 -0
- package/README.md +115 -41
- package/dist/brand/index.cjs +2 -2
- package/dist/brand/index.js +3 -3
- package/dist/chart/index.cjs +155 -2
- package/dist/chart/index.d.cts +136 -4
- package/dist/chart/index.d.ts +136 -4
- package/dist/chart/index.js +155 -5
- package/dist/{chunk-TA7TLWW4.js → chunk-5A5GH2PF.js} +1 -1
- package/dist/{chunk-727HCBD4.js → chunk-6IGD5REB.js} +1 -1
- package/dist/{chunk-2WPWEIMD.js → chunk-FAAGZG7A.js} +1 -1
- package/dist/{chunk-OMKSESQB.js → chunk-FGFNK72B.js} +3 -3
- package/dist/chunk-HOADZ6GS.js +72 -0
- package/dist/chunk-LXRGQKMG.js +145 -0
- package/dist/{chunk-JN3IS5OS.js → chunk-MPZBF2TZ.js} +2 -2
- package/dist/{chunk-WGNIRIN7.js → chunk-TRPBID2W.js} +1 -1
- package/dist/{chunk-E6KFUSKB.js → chunk-XXDATT3A.js} +1 -1
- package/dist/doctor.mjs +95 -13
- package/dist/form/index.cjs +2 -2
- package/dist/form/index.d.cts +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +4 -4
- package/dist/icons/index.cjs +2 -2
- package/dist/icons/index.d.cts +2 -2
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +2 -2
- package/dist/{index-DlAO2JZs.d.cts → index-BbRplw_B.d.cts} +15 -4
- package/dist/{index-DlAO2JZs.d.ts → index-BbRplw_B.d.ts} +15 -4
- package/dist/index.cjs +264 -264
- package/dist/index.d.cts +212 -126
- package/dist/index.d.ts +212 -126
- package/dist/index.js +153 -236
- package/dist/{label-MgHFKnFy.d.ts → label-DJ4HuD-R.d.cts} +3 -2
- package/dist/{label-MgHFKnFy.d.cts → label-DJ4HuD-R.d.ts} +3 -2
- package/dist/og/index.js +1 -1
- package/dist/shiki/index.js +1 -1
- package/dist/social/data.cjs +161 -0
- package/dist/social/data.d.cts +161 -0
- package/dist/social/data.d.ts +161 -0
- package/dist/social/data.js +2 -0
- package/dist/social/index.cjs +124 -38
- package/dist/social/index.d.cts +1 -1
- package/dist/social/index.d.ts +1 -1
- package/dist/social/index.js +2 -1
- package/dist/tokens/index.cjs +3 -3
- package/dist/tokens/index.d.cts +5 -5
- package/dist/tokens/index.d.ts +5 -5
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/theme.css +46 -19
- package/dist/variants/index.cjs +1 -1
- package/dist/variants/index.d.cts +2 -2
- package/dist/variants/index.d.ts +2 -2
- package/dist/variants/index.js +1 -1
- package/llms.txt +264 -140
- package/package.json +6 -1
- package/dist/chunk-45HVCTB7.js +0 -70
package/dist/chart/index.d.cts
CHANGED
|
@@ -22,9 +22,15 @@ import { Legend, Tooltip } from 'recharts';
|
|
|
22
22
|
* 3. The tooltip appears where it will stay: `isAnimationActive` is off
|
|
23
23
|
* everywhere, because the system does not animate position.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* Recharts' API, the project already knows it, and wrapping them would
|
|
27
|
-
* layer of names to keep in sync with the library's version.
|
|
25
|
+
* Recharts' data pieces — `Area`, `Line`, `XAxis` — are still NOT re-exported.
|
|
26
|
+
* They are Recharts' API, the project already knows it, and wrapping them would
|
|
27
|
+
* be a layer of names to keep in sync with the library's version.
|
|
28
|
+
*
|
|
29
|
+
* What IS published, since this version, are three CHART TYPES on top of that
|
|
30
|
+
* chassis: `AreaChart`, `BarChart` and `LineChart`. They are not wrappers over
|
|
31
|
+
* Recharts' components of the same name — they take `data`, `series` and `xKey`
|
|
32
|
+
* and draw the whole thing. See `docs/decisions/0.8.md` § 43 for why the names
|
|
33
|
+
* collide on purpose.
|
|
28
34
|
*/
|
|
29
35
|
/**
|
|
30
36
|
* The color of series `index`, as a custom property.
|
|
@@ -123,5 +129,131 @@ type ChartLegendContentProps = {
|
|
|
123
129
|
};
|
|
124
130
|
/** The legend, with the tooltip's same square swatch and the `label` scale. */
|
|
125
131
|
declare function ChartLegendContent({ payload, className }: ChartLegendContentProps): react.JSX.Element | null;
|
|
132
|
+
/**
|
|
133
|
+
* One series: which key of the datum it reads, what it is called, and — only if
|
|
134
|
+
* you insist — what color it is.
|
|
135
|
+
*
|
|
136
|
+
* `color` is there for the case the palette cannot serve: a status series where
|
|
137
|
+
* «pagado» has to be `success` and not «the first of the four». Leaving it out
|
|
138
|
+
* is the normal case and the right one — `seriesColor(i)` follows the mode, and
|
|
139
|
+
* a hard-coded hex does not. See the note on `seriesColor` above.
|
|
140
|
+
*/
|
|
141
|
+
type ChartSeries = {
|
|
142
|
+
/** The key this series reads in each datum. */
|
|
143
|
+
key: string;
|
|
144
|
+
/** What the legend and the tooltip call it. User-facing, so Spanish. */
|
|
145
|
+
label: string;
|
|
146
|
+
/** Overrides the palette. Defaults to `seriesColor(index)`. */
|
|
147
|
+
color?: string | undefined;
|
|
148
|
+
};
|
|
149
|
+
/** A row of the chart: the category key plus one value per series. */
|
|
150
|
+
type ChartDatum = Record<string, unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* What all three types take, and it is deliberately short: `data`, `series` and
|
|
153
|
+
* `xKey`, plus the container's own `label`.
|
|
154
|
+
*
|
|
155
|
+
* Everything that is NOT here is the part that was being copied — the gradient,
|
|
156
|
+
* the grid with no vertical lines, the axes with no line and no tick, the
|
|
157
|
+
* tooltip with no cursor. `cursos` wrote all of it four times, once per chart,
|
|
158
|
+
* and the fourth one would have had a different `strokeWidth` from the first.
|
|
159
|
+
* The drawing is the system's; the data is the project's.
|
|
160
|
+
*/
|
|
161
|
+
type SeriesChartProps = Omit<ChartContainerProps, 'children'> & {
|
|
162
|
+
data: readonly ChartDatum[];
|
|
163
|
+
series: readonly ChartSeries[];
|
|
164
|
+
/** The key on the category axis: the day, the month, the course. */
|
|
165
|
+
xKey: string;
|
|
166
|
+
/** Formats the value in the tooltip. The library imposes no locale. */
|
|
167
|
+
formatter?: ((value: unknown) => ReactNode) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Formats the TICK on the category axis. Returns a string, because an axis
|
|
170
|
+
* tick is an SVG `<text>` and not a place a node can go.
|
|
171
|
+
*
|
|
172
|
+
* It is separate from `formatter` because the two answer different questions.
|
|
173
|
+
* The tooltip has room for «15 de julio de 2026»; a tick on a 30-day series
|
|
174
|
+
* has room for «07-15», and without this the axis prints the raw key —
|
|
175
|
+
* `2026-07-15` repeated thirty times, overlapping into a grey band.
|
|
176
|
+
*
|
|
177
|
+
* The library imposes no format: a date key can be a day, a month or a course
|
|
178
|
+
* name, and only the project knows which. See `docs/decisions/0.9.md` § 50.
|
|
179
|
+
*/
|
|
180
|
+
xTickFormatter?: ((value: unknown) => string) | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Formats the tick on the VALUE axis — the currency symbol, the thousands
|
|
183
|
+
* separator, the percent sign.
|
|
184
|
+
*
|
|
185
|
+
* Same reason as `xTickFormatter` and the same shape. `formatter` reaches the
|
|
186
|
+
* tooltip only, so without this a revenue chart reads «1200» on the axis and
|
|
187
|
+
* «$1200» in the tooltip, and the axis is the one you read while comparing.
|
|
188
|
+
*/
|
|
189
|
+
yTickFormatter?: ((value: unknown) => string) | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Shows the legend. It defaults to «only when there is more than one series»:
|
|
192
|
+
* a legend naming the one line already named by the chart's own heading is a
|
|
193
|
+
* row of pixels that says nothing.
|
|
194
|
+
*/
|
|
195
|
+
legend?: boolean | undefined;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* A series over time, with the fill fading out underneath it.
|
|
199
|
+
*
|
|
200
|
+
* The gradient is the whole reason this is a component and not three lines at
|
|
201
|
+
* the call site: it needs a `<linearGradient>` with an id, the id has to be
|
|
202
|
+
* unique on the page, and the two projects that wrote it by hand both hardcoded
|
|
203
|
+
* one — a second chart on the same screen would have taken the first one's fill.
|
|
204
|
+
* `useId` settles it.
|
|
205
|
+
*
|
|
206
|
+
* 0.5 down to 0.05 is the ramp `cursos` arrived at, and `type="natural"` is its
|
|
207
|
+
* curve: a monotone spline reads as a measurement and a straight segment reads
|
|
208
|
+
* as a schedule. The stroke is 2, which is the one weight in the system that is
|
|
209
|
+
* neither a hairline nor a border.
|
|
210
|
+
*
|
|
211
|
+
* With more than one series the areas OVERLAP rather than stack, because a
|
|
212
|
+
* stacked area answers «how much in total» and this library has no way to know
|
|
213
|
+
* that is the question. When it is, pass `stacked`. When you want to compare
|
|
214
|
+
* rather than add up, the answer is `LineChart`.
|
|
215
|
+
*/
|
|
216
|
+
type AreaChartProps = SeriesChartProps & {
|
|
217
|
+
/** Adds the series up instead of overlaying them. */
|
|
218
|
+
stacked?: boolean | undefined;
|
|
219
|
+
};
|
|
220
|
+
declare function AreaChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
221
|
+
/**
|
|
222
|
+
* Bars, upright or lying down.
|
|
223
|
+
*
|
|
224
|
+
* `orientation` is named for what you SEE and not for what Recharts calls it,
|
|
225
|
+
* and the two are opposites: Recharts' `layout="vertical"` draws horizontal
|
|
226
|
+
* bars. That inversion is a coin flip every time somebody writes it, so it is
|
|
227
|
+
* settled here once — `vertical` means the bars grow upwards.
|
|
228
|
+
*
|
|
229
|
+
* `horizontal` is the shape for a ranking, which is what `cursos` uses it for:
|
|
230
|
+
* course names on the left, one bar each. It reserves 130px for the category
|
|
231
|
+
* axis and hides the value axis, because a ranking is read by comparing lengths
|
|
232
|
+
* and not by reading a number off a scale — the number is in the tooltip.
|
|
233
|
+
*
|
|
234
|
+
* The corner radius is `radius.chip`, the system's smallest. A bar is a chip
|
|
235
|
+
* lying down, and picking a number that is not a token is how a fifth radius
|
|
236
|
+
* gets into the system without anybody deciding it should.
|
|
237
|
+
*/
|
|
238
|
+
type BarChartProps = SeriesChartProps & {
|
|
239
|
+
/** `vertical` grows the bars upwards, which is the default. `horizontal` is a ranking. */
|
|
240
|
+
orientation?: 'vertical' | 'horizontal' | undefined;
|
|
241
|
+
/** Stacks the series instead of putting them side by side. */
|
|
242
|
+
stacked?: boolean | undefined;
|
|
243
|
+
};
|
|
244
|
+
declare function BarChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
245
|
+
/**
|
|
246
|
+
* Lines, for comparing series against each other.
|
|
247
|
+
*
|
|
248
|
+
* It is the type that does NOT add anything up, which is the whole reason it
|
|
249
|
+
* exists next to `AreaChart`: four filled areas on top of each other are a
|
|
250
|
+
* total, and four lines are four things you can tell apart.
|
|
251
|
+
*
|
|
252
|
+
* No dots at rest. A point per datum on a 90-day series is a dotted line, and
|
|
253
|
+
* the value is in the tooltip; the dot comes back on hover because that is
|
|
254
|
+
* where it means «this one».
|
|
255
|
+
*/
|
|
256
|
+
type LineChartProps = SeriesChartProps;
|
|
257
|
+
declare function LineChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
126
258
|
|
|
127
|
-
export { ChartContainer, type ChartContainerProps, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, SERIES_COLORS, seriesColor };
|
|
259
|
+
export { AreaChart, type AreaChartProps, BarChart, type BarChartProps, ChartContainer, type ChartContainerProps, type ChartDatum, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, type ChartSeries, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, LineChart, type LineChartProps, SERIES_COLORS, type SeriesChartProps, seriesColor };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -22,9 +22,15 @@ import { Legend, Tooltip } from 'recharts';
|
|
|
22
22
|
* 3. The tooltip appears where it will stay: `isAnimationActive` is off
|
|
23
23
|
* everywhere, because the system does not animate position.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* Recharts' API, the project already knows it, and wrapping them would
|
|
27
|
-
* layer of names to keep in sync with the library's version.
|
|
25
|
+
* Recharts' data pieces — `Area`, `Line`, `XAxis` — are still NOT re-exported.
|
|
26
|
+
* They are Recharts' API, the project already knows it, and wrapping them would
|
|
27
|
+
* be a layer of names to keep in sync with the library's version.
|
|
28
|
+
*
|
|
29
|
+
* What IS published, since this version, are three CHART TYPES on top of that
|
|
30
|
+
* chassis: `AreaChart`, `BarChart` and `LineChart`. They are not wrappers over
|
|
31
|
+
* Recharts' components of the same name — they take `data`, `series` and `xKey`
|
|
32
|
+
* and draw the whole thing. See `docs/decisions/0.8.md` § 43 for why the names
|
|
33
|
+
* collide on purpose.
|
|
28
34
|
*/
|
|
29
35
|
/**
|
|
30
36
|
* The color of series `index`, as a custom property.
|
|
@@ -123,5 +129,131 @@ type ChartLegendContentProps = {
|
|
|
123
129
|
};
|
|
124
130
|
/** The legend, with the tooltip's same square swatch and the `label` scale. */
|
|
125
131
|
declare function ChartLegendContent({ payload, className }: ChartLegendContentProps): react.JSX.Element | null;
|
|
132
|
+
/**
|
|
133
|
+
* One series: which key of the datum it reads, what it is called, and — only if
|
|
134
|
+
* you insist — what color it is.
|
|
135
|
+
*
|
|
136
|
+
* `color` is there for the case the palette cannot serve: a status series where
|
|
137
|
+
* «pagado» has to be `success` and not «the first of the four». Leaving it out
|
|
138
|
+
* is the normal case and the right one — `seriesColor(i)` follows the mode, and
|
|
139
|
+
* a hard-coded hex does not. See the note on `seriesColor` above.
|
|
140
|
+
*/
|
|
141
|
+
type ChartSeries = {
|
|
142
|
+
/** The key this series reads in each datum. */
|
|
143
|
+
key: string;
|
|
144
|
+
/** What the legend and the tooltip call it. User-facing, so Spanish. */
|
|
145
|
+
label: string;
|
|
146
|
+
/** Overrides the palette. Defaults to `seriesColor(index)`. */
|
|
147
|
+
color?: string | undefined;
|
|
148
|
+
};
|
|
149
|
+
/** A row of the chart: the category key plus one value per series. */
|
|
150
|
+
type ChartDatum = Record<string, unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* What all three types take, and it is deliberately short: `data`, `series` and
|
|
153
|
+
* `xKey`, plus the container's own `label`.
|
|
154
|
+
*
|
|
155
|
+
* Everything that is NOT here is the part that was being copied — the gradient,
|
|
156
|
+
* the grid with no vertical lines, the axes with no line and no tick, the
|
|
157
|
+
* tooltip with no cursor. `cursos` wrote all of it four times, once per chart,
|
|
158
|
+
* and the fourth one would have had a different `strokeWidth` from the first.
|
|
159
|
+
* The drawing is the system's; the data is the project's.
|
|
160
|
+
*/
|
|
161
|
+
type SeriesChartProps = Omit<ChartContainerProps, 'children'> & {
|
|
162
|
+
data: readonly ChartDatum[];
|
|
163
|
+
series: readonly ChartSeries[];
|
|
164
|
+
/** The key on the category axis: the day, the month, the course. */
|
|
165
|
+
xKey: string;
|
|
166
|
+
/** Formats the value in the tooltip. The library imposes no locale. */
|
|
167
|
+
formatter?: ((value: unknown) => ReactNode) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Formats the TICK on the category axis. Returns a string, because an axis
|
|
170
|
+
* tick is an SVG `<text>` and not a place a node can go.
|
|
171
|
+
*
|
|
172
|
+
* It is separate from `formatter` because the two answer different questions.
|
|
173
|
+
* The tooltip has room for «15 de julio de 2026»; a tick on a 30-day series
|
|
174
|
+
* has room for «07-15», and without this the axis prints the raw key —
|
|
175
|
+
* `2026-07-15` repeated thirty times, overlapping into a grey band.
|
|
176
|
+
*
|
|
177
|
+
* The library imposes no format: a date key can be a day, a month or a course
|
|
178
|
+
* name, and only the project knows which. See `docs/decisions/0.9.md` § 50.
|
|
179
|
+
*/
|
|
180
|
+
xTickFormatter?: ((value: unknown) => string) | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Formats the tick on the VALUE axis — the currency symbol, the thousands
|
|
183
|
+
* separator, the percent sign.
|
|
184
|
+
*
|
|
185
|
+
* Same reason as `xTickFormatter` and the same shape. `formatter` reaches the
|
|
186
|
+
* tooltip only, so without this a revenue chart reads «1200» on the axis and
|
|
187
|
+
* «$1200» in the tooltip, and the axis is the one you read while comparing.
|
|
188
|
+
*/
|
|
189
|
+
yTickFormatter?: ((value: unknown) => string) | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Shows the legend. It defaults to «only when there is more than one series»:
|
|
192
|
+
* a legend naming the one line already named by the chart's own heading is a
|
|
193
|
+
* row of pixels that says nothing.
|
|
194
|
+
*/
|
|
195
|
+
legend?: boolean | undefined;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* A series over time, with the fill fading out underneath it.
|
|
199
|
+
*
|
|
200
|
+
* The gradient is the whole reason this is a component and not three lines at
|
|
201
|
+
* the call site: it needs a `<linearGradient>` with an id, the id has to be
|
|
202
|
+
* unique on the page, and the two projects that wrote it by hand both hardcoded
|
|
203
|
+
* one — a second chart on the same screen would have taken the first one's fill.
|
|
204
|
+
* `useId` settles it.
|
|
205
|
+
*
|
|
206
|
+
* 0.5 down to 0.05 is the ramp `cursos` arrived at, and `type="natural"` is its
|
|
207
|
+
* curve: a monotone spline reads as a measurement and a straight segment reads
|
|
208
|
+
* as a schedule. The stroke is 2, which is the one weight in the system that is
|
|
209
|
+
* neither a hairline nor a border.
|
|
210
|
+
*
|
|
211
|
+
* With more than one series the areas OVERLAP rather than stack, because a
|
|
212
|
+
* stacked area answers «how much in total» and this library has no way to know
|
|
213
|
+
* that is the question. When it is, pass `stacked`. When you want to compare
|
|
214
|
+
* rather than add up, the answer is `LineChart`.
|
|
215
|
+
*/
|
|
216
|
+
type AreaChartProps = SeriesChartProps & {
|
|
217
|
+
/** Adds the series up instead of overlaying them. */
|
|
218
|
+
stacked?: boolean | undefined;
|
|
219
|
+
};
|
|
220
|
+
declare function AreaChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, stacked, ...container }: AreaChartProps): react.JSX.Element;
|
|
221
|
+
/**
|
|
222
|
+
* Bars, upright or lying down.
|
|
223
|
+
*
|
|
224
|
+
* `orientation` is named for what you SEE and not for what Recharts calls it,
|
|
225
|
+
* and the two are opposites: Recharts' `layout="vertical"` draws horizontal
|
|
226
|
+
* bars. That inversion is a coin flip every time somebody writes it, so it is
|
|
227
|
+
* settled here once — `vertical` means the bars grow upwards.
|
|
228
|
+
*
|
|
229
|
+
* `horizontal` is the shape for a ranking, which is what `cursos` uses it for:
|
|
230
|
+
* course names on the left, one bar each. It reserves 130px for the category
|
|
231
|
+
* axis and hides the value axis, because a ranking is read by comparing lengths
|
|
232
|
+
* and not by reading a number off a scale — the number is in the tooltip.
|
|
233
|
+
*
|
|
234
|
+
* The corner radius is `radius.chip`, the system's smallest. A bar is a chip
|
|
235
|
+
* lying down, and picking a number that is not a token is how a fifth radius
|
|
236
|
+
* gets into the system without anybody deciding it should.
|
|
237
|
+
*/
|
|
238
|
+
type BarChartProps = SeriesChartProps & {
|
|
239
|
+
/** `vertical` grows the bars upwards, which is the default. `horizontal` is a ranking. */
|
|
240
|
+
orientation?: 'vertical' | 'horizontal' | undefined;
|
|
241
|
+
/** Stacks the series instead of putting them side by side. */
|
|
242
|
+
stacked?: boolean | undefined;
|
|
243
|
+
};
|
|
244
|
+
declare function BarChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, orientation, stacked, ...container }: BarChartProps): react.JSX.Element;
|
|
245
|
+
/**
|
|
246
|
+
* Lines, for comparing series against each other.
|
|
247
|
+
*
|
|
248
|
+
* It is the type that does NOT add anything up, which is the whole reason it
|
|
249
|
+
* exists next to `AreaChart`: four filled areas on top of each other are a
|
|
250
|
+
* total, and four lines are four things you can tell apart.
|
|
251
|
+
*
|
|
252
|
+
* No dots at rest. A point per datum on a 90-day series is a dotted line, and
|
|
253
|
+
* the value is in the tooltip; the dot comes back on hover because that is
|
|
254
|
+
* where it means «this one».
|
|
255
|
+
*/
|
|
256
|
+
type LineChartProps = SeriesChartProps;
|
|
257
|
+
declare function LineChart({ data, series, xKey, formatter, xTickFormatter, yTickFormatter, legend, ...container }: LineChartProps): react.JSX.Element;
|
|
126
258
|
|
|
127
|
-
export { ChartContainer, type ChartContainerProps, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, SERIES_COLORS, seriesColor };
|
|
259
|
+
export { AreaChart, type AreaChartProps, BarChart, type BarChartProps, ChartContainer, type ChartContainerProps, type ChartDatum, ChartLegend, ChartLegendContent, type ChartLegendContentProps, type ChartPayloadItem, type ChartSeries, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, LineChart, type LineChartProps, SERIES_COLORS, type SeriesChartProps, seriesColor };
|
package/dist/chart/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { Text } from '../chunk-
|
|
2
|
+
import { Text } from '../chunk-TRPBID2W.js';
|
|
3
3
|
import '../chunk-ODBFN44D.js';
|
|
4
|
-
import { cn } from '../chunk-
|
|
5
|
-
import '../chunk-
|
|
4
|
+
import { cn } from '../chunk-FAAGZG7A.js';
|
|
5
|
+
import { radius } from '../chunk-FGFNK72B.js';
|
|
6
6
|
import '../chunk-MLKGABMK.js';
|
|
7
|
-
import {
|
|
7
|
+
import { useId } from 'react';
|
|
8
|
+
import { ResponsiveContainer, Tooltip, Legend, AreaChart as AreaChart$1, CartesianGrid, XAxis, YAxis, Area, BarChart as BarChart$1, Bar, LineChart as LineChart$1, Line } from 'recharts';
|
|
8
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
11
|
function seriesColor(index) {
|
|
@@ -101,5 +102,154 @@ function ChartLegendContent({ payload, className }) {
|
|
|
101
102
|
/* @__PURE__ */ jsx(Text, { as: "span", variant: "label", tone: "secondary", className: "font-normal", children: item.value })
|
|
102
103
|
] }, `${String(item.dataKey ?? item.value ?? i)}`)) });
|
|
103
104
|
}
|
|
105
|
+
var rows = (data) => data;
|
|
106
|
+
var color = (series, index) => series.color ?? seriesColor(index);
|
|
107
|
+
var MARGIN = { left: 0, right: 12, top: 8, bottom: 0 };
|
|
108
|
+
var AXIS = { tickLine: false, axisLine: false };
|
|
109
|
+
var tickOf = (format) => format ? { tickFormatter: format } : {};
|
|
110
|
+
var legendOf = (series, legend) => legend ?? series.length > 1 ? /* @__PURE__ */ jsx(ChartLegend, { content: /* @__PURE__ */ jsx(ChartLegendContent, {}) }, "legend") : null;
|
|
111
|
+
var tooltipOf = (formatter) => /* @__PURE__ */ jsx(
|
|
112
|
+
ChartTooltip,
|
|
113
|
+
{
|
|
114
|
+
cursor: false,
|
|
115
|
+
content: /* @__PURE__ */ jsx(ChartTooltipContent, { formatter: formatter ? (value) => formatter(value) : void 0 })
|
|
116
|
+
},
|
|
117
|
+
"tooltip"
|
|
118
|
+
);
|
|
119
|
+
function AreaChart({
|
|
120
|
+
data,
|
|
121
|
+
series,
|
|
122
|
+
xKey,
|
|
123
|
+
formatter,
|
|
124
|
+
xTickFormatter,
|
|
125
|
+
yTickFormatter,
|
|
126
|
+
legend,
|
|
127
|
+
stacked = false,
|
|
128
|
+
...container
|
|
129
|
+
}) {
|
|
130
|
+
const id = useId();
|
|
131
|
+
return /* @__PURE__ */ jsx(ChartContainer, { ...container, children: /* @__PURE__ */ jsxs(AreaChart$1, { data: rows(data), margin: MARGIN, children: [
|
|
132
|
+
/* @__PURE__ */ jsx("defs", { children: series.map((s, i) => /* @__PURE__ */ jsxs("linearGradient", { id: `${id}-${s.key}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
133
|
+
/* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: color(s, i), stopOpacity: 0.5 }),
|
|
134
|
+
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: color(s, i), stopOpacity: 0.05 })
|
|
135
|
+
] }, s.key)) }),
|
|
136
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false }),
|
|
137
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
138
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
139
|
+
tooltipOf(formatter),
|
|
140
|
+
legendOf(series, legend),
|
|
141
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
142
|
+
Area,
|
|
143
|
+
{
|
|
144
|
+
dataKey: s.key,
|
|
145
|
+
name: s.label,
|
|
146
|
+
type: "natural",
|
|
147
|
+
stroke: color(s, i),
|
|
148
|
+
strokeWidth: 2,
|
|
149
|
+
fill: `url(#${id}-${s.key})`,
|
|
150
|
+
isAnimationActive: false,
|
|
151
|
+
...stacked ? { stackId: "stack" } : {}
|
|
152
|
+
},
|
|
153
|
+
s.key
|
|
154
|
+
))
|
|
155
|
+
] }) });
|
|
156
|
+
}
|
|
157
|
+
function BarChart({
|
|
158
|
+
data,
|
|
159
|
+
series,
|
|
160
|
+
xKey,
|
|
161
|
+
formatter,
|
|
162
|
+
xTickFormatter,
|
|
163
|
+
yTickFormatter,
|
|
164
|
+
legend,
|
|
165
|
+
orientation = "vertical",
|
|
166
|
+
stacked = false,
|
|
167
|
+
...container
|
|
168
|
+
}) {
|
|
169
|
+
const lying = orientation === "horizontal";
|
|
170
|
+
return /* @__PURE__ */ jsx(ChartContainer, { ...container, children: /* @__PURE__ */ jsxs(
|
|
171
|
+
BarChart$1,
|
|
172
|
+
{
|
|
173
|
+
data: rows(data),
|
|
174
|
+
margin: MARGIN,
|
|
175
|
+
...lying ? { layout: "vertical" } : {},
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: lying, horizontal: !lying }),
|
|
178
|
+
lying ? [
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
YAxis,
|
|
181
|
+
{
|
|
182
|
+
dataKey: xKey,
|
|
183
|
+
type: "category",
|
|
184
|
+
...AXIS,
|
|
185
|
+
width: 130,
|
|
186
|
+
...tickOf(xTickFormatter)
|
|
187
|
+
},
|
|
188
|
+
"category"
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsx(XAxis, { type: "number", hide: true, ...tickOf(yTickFormatter) }, "value")
|
|
191
|
+
] : [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
XAxis,
|
|
194
|
+
{
|
|
195
|
+
dataKey: xKey,
|
|
196
|
+
...AXIS,
|
|
197
|
+
tickMargin: 8,
|
|
198
|
+
...tickOf(xTickFormatter)
|
|
199
|
+
},
|
|
200
|
+
"category"
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }, "value")
|
|
203
|
+
],
|
|
204
|
+
tooltipOf(formatter),
|
|
205
|
+
legendOf(series, legend),
|
|
206
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
207
|
+
Bar,
|
|
208
|
+
{
|
|
209
|
+
dataKey: s.key,
|
|
210
|
+
name: s.label,
|
|
211
|
+
fill: color(s, i),
|
|
212
|
+
radius: lying ? [0, radius.chip, radius.chip, 0] : [radius.chip, radius.chip, 0, 0],
|
|
213
|
+
isAnimationActive: false,
|
|
214
|
+
...stacked ? { stackId: "stack" } : {}
|
|
215
|
+
},
|
|
216
|
+
s.key
|
|
217
|
+
))
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
) });
|
|
221
|
+
}
|
|
222
|
+
function LineChart({
|
|
223
|
+
data,
|
|
224
|
+
series,
|
|
225
|
+
xKey,
|
|
226
|
+
formatter,
|
|
227
|
+
xTickFormatter,
|
|
228
|
+
yTickFormatter,
|
|
229
|
+
legend,
|
|
230
|
+
...container
|
|
231
|
+
}) {
|
|
232
|
+
return /* @__PURE__ */ jsx(ChartContainer, { ...container, children: /* @__PURE__ */ jsxs(LineChart$1, { data: rows(data), margin: MARGIN, children: [
|
|
233
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false }),
|
|
234
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: xKey, ...AXIS, tickMargin: 8, ...tickOf(xTickFormatter) }),
|
|
235
|
+
/* @__PURE__ */ jsx(YAxis, { ...AXIS, width: 40, ...tickOf(yTickFormatter) }),
|
|
236
|
+
tooltipOf(formatter),
|
|
237
|
+
legendOf(series, legend),
|
|
238
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
239
|
+
Line,
|
|
240
|
+
{
|
|
241
|
+
dataKey: s.key,
|
|
242
|
+
name: s.label,
|
|
243
|
+
type: "natural",
|
|
244
|
+
stroke: color(s, i),
|
|
245
|
+
strokeWidth: 2,
|
|
246
|
+
dot: false,
|
|
247
|
+
activeDot: { r: 4 },
|
|
248
|
+
isAnimationActive: false
|
|
249
|
+
},
|
|
250
|
+
s.key
|
|
251
|
+
))
|
|
252
|
+
] }) });
|
|
253
|
+
}
|
|
104
254
|
|
|
105
|
-
export { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, SERIES_COLORS, seriesColor };
|
|
255
|
+
export { AreaChart, BarChart, ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, LineChart, SERIES_COLORS, seriesColor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { naming, tagline, motion, shadow, series, syntax, gradient, size, spacing, control, radius, limits, typeScale, fonts, brand, colors } from './chunk-
|
|
1
|
+
import { naming, tagline, motion, shadow, series, syntax, gradient, size, spacing, control, radius, limits, typeScale, fonts, brand, colors } from './chunk-FGFNK72B.js';
|
|
2
2
|
|
|
3
3
|
// src/tokens/index.ts
|
|
4
4
|
var tokens = {
|
|
@@ -144,7 +144,7 @@ var typeScale = {
|
|
|
144
144
|
* (plankton 5.57:1 over abyss), which is the part that is not negotiable.
|
|
145
145
|
*
|
|
146
146
|
* At 13 the three badge families grew past the size of a small button and
|
|
147
|
-
* outweighed the title they accompany. See `docs/decisions
|
|
147
|
+
* outweighed the title they accompany. See `docs/decisions/`.
|
|
148
148
|
*/
|
|
149
149
|
chip: { family: "mono", size: 11.5, lineHeight: 1.4, weight: 400 },
|
|
150
150
|
/**
|
|
@@ -198,7 +198,7 @@ var control = {
|
|
|
198
198
|
* baseline; 28 would have been a fifth height that matches nothing.
|
|
199
199
|
*
|
|
200
200
|
* It does not replace `icon`. A page's primary action stays at 42; this is for
|
|
201
|
-
* a row of a table. See `docs/decisions.md` § 22.
|
|
201
|
+
* a row of a table. See `docs/decisions/0.6.md` § 22.
|
|
202
202
|
*/
|
|
203
203
|
iconSm: 32
|
|
204
204
|
};
|
|
@@ -221,7 +221,7 @@ var size = {
|
|
|
221
221
|
* together eat the top of the content area. 56 is what `cursos` had arrived at
|
|
222
222
|
* on its own, and it is the same reasoning as `control.iconSm`: the one admin
|
|
223
223
|
* app of the five is denser than the four reading sites. See
|
|
224
|
-
* `docs/decisions.md` § 30.
|
|
224
|
+
* `docs/decisions/0.7.md` § 30.
|
|
225
225
|
*/
|
|
226
226
|
navCompact: 56,
|
|
227
227
|
/**
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { gitHubGlyph, linkedInGlyph, xGlyph, instagramGlyph, discordGlyph, youTubeGlyph, rssGlyph, emailGlyph, newsletterGlyph, websiteGlyph, SOCIAL_STROKE_WIDTH, SOCIAL_VIEW_BOX } from './chunk-LXRGQKMG.js';
|
|
2
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/social/index.tsx
|
|
6
|
+
var social_exports = {};
|
|
7
|
+
__export(social_exports, {
|
|
8
|
+
Discord: () => Discord,
|
|
9
|
+
Email: () => Email,
|
|
10
|
+
GitHub: () => GitHub,
|
|
11
|
+
Instagram: () => Instagram,
|
|
12
|
+
LinkedIn: () => LinkedIn,
|
|
13
|
+
Newsletter: () => Newsletter,
|
|
14
|
+
Rss: () => Rss,
|
|
15
|
+
Website: () => Website,
|
|
16
|
+
X: () => X,
|
|
17
|
+
YouTube: () => YouTube
|
|
18
|
+
});
|
|
19
|
+
var SOLID = { fill: "currentColor", stroke: "none" };
|
|
20
|
+
function drawShape(shape, index) {
|
|
21
|
+
if (shape.tag === "path") {
|
|
22
|
+
return /* @__PURE__ */ jsx("path", { d: shape.d, ...shape.solid ? SOLID : {} }, index);
|
|
23
|
+
}
|
|
24
|
+
if (shape.tag === "circle") {
|
|
25
|
+
return /* @__PURE__ */ jsx("circle", { cx: shape.cx, cy: shape.cy, r: shape.r, ...shape.solid ? SOLID : {} }, index);
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"rect",
|
|
29
|
+
{
|
|
30
|
+
x: shape.x,
|
|
31
|
+
y: shape.y,
|
|
32
|
+
width: shape.width,
|
|
33
|
+
height: shape.height,
|
|
34
|
+
rx: shape.rx
|
|
35
|
+
},
|
|
36
|
+
index
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function Glyph({ glyph, ...props }) {
|
|
40
|
+
const brand = glyph.kind === "brand";
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"svg",
|
|
43
|
+
{
|
|
44
|
+
viewBox: SOCIAL_VIEW_BOX,
|
|
45
|
+
width: "1em",
|
|
46
|
+
height: "1em",
|
|
47
|
+
fill: brand ? "currentColor" : "none",
|
|
48
|
+
...brand ? {} : {
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeWidth: SOCIAL_STROKE_WIDTH,
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeLinejoin: "round"
|
|
53
|
+
},
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
focusable: "false",
|
|
56
|
+
...props,
|
|
57
|
+
children: glyph.shapes.map(drawShape)
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
var GitHub = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: gitHubGlyph, ...props });
|
|
62
|
+
var LinkedIn = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: linkedInGlyph, ...props });
|
|
63
|
+
var X = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: xGlyph, ...props });
|
|
64
|
+
var Instagram = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: instagramGlyph, ...props });
|
|
65
|
+
var Discord = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: discordGlyph, ...props });
|
|
66
|
+
var YouTube = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: youTubeGlyph, ...props });
|
|
67
|
+
var Rss = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: rssGlyph, ...props });
|
|
68
|
+
var Email = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: emailGlyph, ...props });
|
|
69
|
+
var Newsletter = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: newsletterGlyph, ...props });
|
|
70
|
+
var Website = (props) => /* @__PURE__ */ jsx(Glyph, { glyph: websiteGlyph, ...props });
|
|
71
|
+
|
|
72
|
+
export { Discord, Email, GitHub, Instagram, LinkedIn, Newsletter, Rss, Website, X, YouTube, social_exports };
|