@meetreeve/ui 0.27.0 → 0.33.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/README.md +21 -2
- package/dist/charts/index.d.mts +12 -1
- package/dist/charts/index.d.ts +12 -1
- package/dist/charts/index.js +96 -6
- package/dist/charts/index.mjs +111 -7
- package/dist/index.d.mts +51 -13
- package/dist/index.d.ts +51 -13
- package/dist/index.js +357 -225
- package/dist/index.mjs +262 -130
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,6 +95,7 @@ An optional compact list above the pages, e.g. recent chats. Rows are buttons: s
|
|
|
95
95
|
moreHref: "/chats", // optional; "More" shows when items exceed `limit` or `hasMore`
|
|
96
96
|
hasMore,
|
|
97
97
|
// label: "Recent", limit: 6 (defaults)
|
|
98
|
+
// href: "/chats", // optional (DEV-19583): the heading becomes a link there
|
|
98
99
|
}}
|
|
99
100
|
/>
|
|
100
101
|
```
|
|
@@ -105,6 +106,8 @@ The list sits between `topItem` and the pages, outside the measured ladder nav.
|
|
|
105
106
|
|
|
106
107
|
A folded group's row opens a horizontal flyout on hover (desktop) or click (keyboard/touch parity): `aria-expanded` + menu roles, focus moves to the first child on open, Esc closes and returns focus to the trigger. If the active route's module is inside a folded group, the group's own row shows the active state and the flyout highlights the specific child. No open/close transition under `prefers-reduced-motion`.
|
|
107
108
|
|
|
109
|
+
A ladder group can carry its own page (`href`, DEV-19583; an app path starting with one `/`, zod-checked). The row then splits in two: the label is a link through `linkComponent` (click or Enter navigates, hover still opens the panel) and a chevron button beside it is the disclosure (Enter/Space/click, focus to the first child, Esc back to the chevron). The group is also active on its own href. On the collapsed icon rail the row stays one button and the panel's first row links to the group's page. Without `href` the row is the single button it always was.
|
|
110
|
+
|
|
108
111
|
## ResponsiveHeader
|
|
109
112
|
|
|
110
113
|
```tsx
|
|
@@ -280,11 +283,23 @@ clips gets no clip and no 404.
|
|
|
280
283
|
(`aspect-video`) with `object-contain`, so a clip of another shape
|
|
281
284
|
letterboxes instead of cropping. Border and background are the paired
|
|
282
285
|
`border-border bg-muted` tokens.
|
|
286
|
+
- While it can play, a corner toggle pauses and resumes it (DEV-19403).
|
|
283
287
|
- `prefers-reduced-motion` never starts playback, including on the first
|
|
284
288
|
client render after SSR, and turning it on mid-loop pauses the clip. The
|
|
285
|
-
poster and
|
|
289
|
+
poster shows and the toggle offers Play, so it plays only when asked
|
|
290
|
+
(DEV-19583).
|
|
286
291
|
- If the browser refuses autoplay (iOS Low Power Mode), native controls
|
|
287
|
-
|
|
292
|
+
replace the toggle until a later `play()` succeeds.
|
|
293
|
+
|
|
294
|
+
Card mode (DEV-19583), same files:
|
|
295
|
+
|
|
296
|
+
- `fit="cover"` crops to fill the 16:9 box (default `"contain"`).
|
|
297
|
+
- `playWhenVisible` attaches the sources only once a quarter of the clip is
|
|
298
|
+
on screen, so off-screen clips download nothing but the poster; it plays
|
|
299
|
+
only while visible and pauses when it leaves.
|
|
300
|
+
- `overlay` paints a node over the frame (e.g. a title on a dark fade); clicks
|
|
301
|
+
pass through it.
|
|
302
|
+
- `posterOnly` renders just the poster `<img>`, with no video or sources.
|
|
288
303
|
|
|
289
304
|
`usePrefersReducedMotion()` is the live OS setting it reads. It is exported
|
|
290
305
|
from the package root and, as before, from `@meetreeve/ui/charts`.
|
|
@@ -657,6 +672,10 @@ chart in a tenant's brand colours, set those variables. Hosts that don't import
|
|
|
657
672
|
(`BAR_CATEGORY_GAP = "8.33%"` per side), no y-axis, the value above each bar.
|
|
658
673
|
An all-negative series tops out at 0 (DEV-16977). Hand-rolled Recharts bar
|
|
659
674
|
charts spread `BAR_STANDARD` and render `<LabelList content={barValueLabel(fmt)} />`.
|
|
675
|
+
- **Funnels:** `<BarChart funnel />` adds a faint silhouette behind the bars
|
|
676
|
+
that slopes from each bar's top to the next (DEV-19691). Single series
|
|
677
|
+
only (ignored otherwise); no tooltip or legend entry. Use it only when the
|
|
678
|
+
steps are a real funnel, each a subset of the one before.
|
|
660
679
|
- **Reduced motion:** entry animations are off under `prefers-reduced-motion`.
|
|
661
680
|
- **`KpiCard`:** `delta` is a fraction (0.12 = +12%). `polarity` decides
|
|
662
681
|
whether a rise is green or red. `state="empty" | "setup"` replaces raw errors;
|
package/dist/charts/index.d.mts
CHANGED
|
@@ -63,6 +63,8 @@ interface TooltipPayloadItem {
|
|
|
63
63
|
name: string;
|
|
64
64
|
value: number;
|
|
65
65
|
color: string;
|
|
66
|
+
/** The item's `tooltipType`; "none" keeps it out of the tooltip, as in Recharts' default content. */
|
|
67
|
+
type?: string;
|
|
66
68
|
}
|
|
67
69
|
interface ChartTooltipContentProps {
|
|
68
70
|
active?: boolean;
|
|
@@ -178,9 +180,18 @@ interface BarChartProps {
|
|
|
178
180
|
* (e.g. it is read against a scale rather than per-bar values).
|
|
179
181
|
*/
|
|
180
182
|
showYAxis?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Funnel silhouette (DEV-19691, GA4-style): a soft, low-alpha shape behind
|
|
185
|
+
* the bars that slopes from each bar's top to the next bar's top, so the
|
|
186
|
+
* drop-off between steps reads without the numbers. The bars, value labels,
|
|
187
|
+
* tooltip and cursor are unchanged, and the shape has no tooltip or legend
|
|
188
|
+
* entry. Single series only: with more than one series it is ignored.
|
|
189
|
+
* Default false.
|
|
190
|
+
*/
|
|
191
|
+
funnel?: boolean;
|
|
181
192
|
loading?: boolean;
|
|
182
193
|
}
|
|
183
|
-
declare function BarChart({ data, xKey, series, height, showGrid, showLegend, tooltipFormatter, labelFormatter, showValueLabels, showYAxis, loading, }: BarChartProps): react.JSX.Element;
|
|
194
|
+
declare function BarChart({ data, xKey, series, height, showGrid, showLegend, tooltipFormatter, labelFormatter, showValueLabels, showYAxis, funnel, loading, }: BarChartProps): react.JSX.Element;
|
|
184
195
|
|
|
185
196
|
interface DonutDataItem {
|
|
186
197
|
name: string;
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ interface TooltipPayloadItem {
|
|
|
63
63
|
name: string;
|
|
64
64
|
value: number;
|
|
65
65
|
color: string;
|
|
66
|
+
/** The item's `tooltipType`; "none" keeps it out of the tooltip, as in Recharts' default content. */
|
|
67
|
+
type?: string;
|
|
66
68
|
}
|
|
67
69
|
interface ChartTooltipContentProps {
|
|
68
70
|
active?: boolean;
|
|
@@ -178,9 +180,18 @@ interface BarChartProps {
|
|
|
178
180
|
* (e.g. it is read against a scale rather than per-bar values).
|
|
179
181
|
*/
|
|
180
182
|
showYAxis?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Funnel silhouette (DEV-19691, GA4-style): a soft, low-alpha shape behind
|
|
185
|
+
* the bars that slopes from each bar's top to the next bar's top, so the
|
|
186
|
+
* drop-off between steps reads without the numbers. The bars, value labels,
|
|
187
|
+
* tooltip and cursor are unchanged, and the shape has no tooltip or legend
|
|
188
|
+
* entry. Single series only: with more than one series it is ignored.
|
|
189
|
+
* Default false.
|
|
190
|
+
*/
|
|
191
|
+
funnel?: boolean;
|
|
181
192
|
loading?: boolean;
|
|
182
193
|
}
|
|
183
|
-
declare function BarChart({ data, xKey, series, height, showGrid, showLegend, tooltipFormatter, labelFormatter, showValueLabels, showYAxis, loading, }: BarChartProps): react.JSX.Element;
|
|
194
|
+
declare function BarChart({ data, xKey, series, height, showGrid, showLegend, tooltipFormatter, labelFormatter, showValueLabels, showYAxis, funnel, loading, }: BarChartProps): react.JSX.Element;
|
|
184
195
|
|
|
185
196
|
interface DonutDataItem {
|
|
186
197
|
name: string;
|
package/dist/charts/index.js
CHANGED
|
@@ -161,7 +161,8 @@ function ChartSkeleton({ height = 300 }) {
|
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
function ChartTooltipContent({ active, payload, label, formatter }) {
|
|
164
|
-
|
|
164
|
+
const entries = payload?.filter((entry) => entry.type !== "none");
|
|
165
|
+
if (!active || !entries?.length) return null;
|
|
165
166
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
166
167
|
"div",
|
|
167
168
|
{
|
|
@@ -169,7 +170,7 @@ function ChartTooltipContent({ active, payload, label, formatter }) {
|
|
|
169
170
|
style: { background: chartConfig.tooltip.background, border: `1px solid ${chartConfig.tooltip.border}` },
|
|
170
171
|
children: [
|
|
171
172
|
label != null && label !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mb-1 font-medium", style: { color: chartConfig.tooltip.label }, children: label }),
|
|
172
|
-
|
|
173
|
+
entries.map((entry, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "flex items-center gap-2", style: { color: chartConfig.tooltip.text }, children: [
|
|
173
174
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "inline-block h-2 w-2 rounded-full", style: { backgroundColor: entry.color } }),
|
|
174
175
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { color: chartConfig.tooltip.label }, children: [
|
|
175
176
|
entry.name,
|
|
@@ -385,6 +386,7 @@ function LineChart({
|
|
|
385
386
|
|
|
386
387
|
// src/charts/bar-chart.tsx
|
|
387
388
|
var import_recharts4 = require("recharts");
|
|
389
|
+
var import_react5 = require("react");
|
|
388
390
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
389
391
|
var BAR_CATEGORY_GAP = "8.33%";
|
|
390
392
|
var BAR_LABEL_FONT_SIZE = chartConfig.axis.fontSize;
|
|
@@ -428,6 +430,89 @@ function barValueLabel(format = (v) => v.toLocaleString(), {
|
|
|
428
430
|
return BarValueLabel;
|
|
429
431
|
}
|
|
430
432
|
var GROUPED_BAR_GAP = 4;
|
|
433
|
+
var FUNNEL_ALPHA = 12;
|
|
434
|
+
var BAR_ANIMATION_MS = 400;
|
|
435
|
+
var BAR_GAP_FRACTION = parseFloat(BAR_CATEGORY_GAP) / 100;
|
|
436
|
+
function barEdges(band) {
|
|
437
|
+
const inset = band * BAR_GAP_FRACTION;
|
|
438
|
+
const raw = band - 2 * inset;
|
|
439
|
+
const width = raw > 1 ? Math.floor(raw) : raw;
|
|
440
|
+
return { right: inset + width - band / 2, left: band / 2 - inset };
|
|
441
|
+
}
|
|
442
|
+
var funnelCurve = (context) => {
|
|
443
|
+
let line = NaN;
|
|
444
|
+
let count = 0;
|
|
445
|
+
let prev = [0, 0];
|
|
446
|
+
return {
|
|
447
|
+
areaStart() {
|
|
448
|
+
line = 0;
|
|
449
|
+
},
|
|
450
|
+
areaEnd() {
|
|
451
|
+
line = NaN;
|
|
452
|
+
},
|
|
453
|
+
lineStart() {
|
|
454
|
+
count = 0;
|
|
455
|
+
},
|
|
456
|
+
lineEnd() {
|
|
457
|
+
if (line || line !== 0 && count === 1) context.closePath();
|
|
458
|
+
line = 1 - line;
|
|
459
|
+
},
|
|
460
|
+
point(x, y) {
|
|
461
|
+
if (count++ === 0) {
|
|
462
|
+
if (line) context.lineTo(x, y);
|
|
463
|
+
else context.moveTo(x, y);
|
|
464
|
+
} else {
|
|
465
|
+
const [px, py] = prev;
|
|
466
|
+
const dir = Math.sign(x - px);
|
|
467
|
+
const { right, left } = barEdges(Math.abs(x - px));
|
|
468
|
+
context.lineTo(px + dir * right, py);
|
|
469
|
+
context.lineTo(x - dir * left, y);
|
|
470
|
+
context.lineTo(x, y);
|
|
471
|
+
}
|
|
472
|
+
prev = [x, y];
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
function BandCursor({ bands, fill, points, top = 0, width = 0, height = 0, className }) {
|
|
477
|
+
const x = points?.[0]?.x;
|
|
478
|
+
if (x == null || bands < 1) return null;
|
|
479
|
+
const band = width / bands;
|
|
480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts4.ZIndexLayer, { zIndex: import_recharts4.DefaultZIndexes.cursorRectangle, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
481
|
+
import_recharts4.Rectangle,
|
|
482
|
+
{
|
|
483
|
+
x: x - band / 2,
|
|
484
|
+
y: top + 0.5,
|
|
485
|
+
width: band,
|
|
486
|
+
height: height - 1,
|
|
487
|
+
fill,
|
|
488
|
+
stroke: "none",
|
|
489
|
+
pointerEvents: "none",
|
|
490
|
+
className
|
|
491
|
+
}
|
|
492
|
+
) });
|
|
493
|
+
}
|
|
494
|
+
function FunnelSilhouette({ series, animate }) {
|
|
495
|
+
const [entered, setEntered] = (0, import_react5.useState)(false);
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
497
|
+
import_recharts4.Area,
|
|
498
|
+
{
|
|
499
|
+
dataKey: series.dataKey,
|
|
500
|
+
name: series.name,
|
|
501
|
+
type: funnelCurve,
|
|
502
|
+
fill: withAlpha(series.color ?? chartColor(0), FUNNEL_ALPHA),
|
|
503
|
+
fillOpacity: 1,
|
|
504
|
+
stroke: "none",
|
|
505
|
+
dot: false,
|
|
506
|
+
activeDot: false,
|
|
507
|
+
tooltipType: "none",
|
|
508
|
+
legendType: "none",
|
|
509
|
+
isAnimationActive: animate,
|
|
510
|
+
animationBegin: entered ? 0 : BAR_ANIMATION_MS,
|
|
511
|
+
animationDuration: BAR_ANIMATION_MS,
|
|
512
|
+
onAnimationEnd: () => setEntered(true)
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
}
|
|
431
516
|
function BarChart({
|
|
432
517
|
data,
|
|
433
518
|
xKey,
|
|
@@ -439,13 +524,17 @@ function BarChart({
|
|
|
439
524
|
labelFormatter,
|
|
440
525
|
showValueLabels = true,
|
|
441
526
|
showYAxis = false,
|
|
527
|
+
funnel = false,
|
|
442
528
|
loading = false
|
|
443
529
|
}) {
|
|
444
530
|
const animate = !usePrefersReducedMotion();
|
|
445
531
|
const grouped = series.length > 1;
|
|
532
|
+
const silhouette = funnel && series.length === 1;
|
|
446
533
|
const formatLabel = labelFormatter ?? tooltipFormatter ?? ((v) => v.toLocaleString());
|
|
534
|
+
const cursorFill = withAlpha(chartColor(0), 6);
|
|
535
|
+
const Chart = silhouette ? import_recharts4.ComposedChart : import_recharts4.BarChart;
|
|
447
536
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChartContainer, { height, loading, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
448
|
-
|
|
537
|
+
Chart,
|
|
449
538
|
{
|
|
450
539
|
data,
|
|
451
540
|
barCategoryGap: BAR_CATEGORY_GAP,
|
|
@@ -489,10 +578,11 @@ function BarChart({
|
|
|
489
578
|
import_recharts4.Tooltip,
|
|
490
579
|
{
|
|
491
580
|
content: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChartTooltipContent, { formatter: tooltipFormatter }),
|
|
492
|
-
cursor:
|
|
581
|
+
cursor: silhouette ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BandCursor, { bands: data.length, fill: cursorFill }) : { fill: cursorFill }
|
|
493
582
|
}
|
|
494
583
|
),
|
|
495
584
|
showLegend && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts4.Legend, { wrapperStyle: { fontSize: 12, color: chartTokens.muted, paddingTop: 8 } }),
|
|
585
|
+
silhouette && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FunnelSilhouette, { series: series[0], animate }),
|
|
496
586
|
series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
497
587
|
import_recharts4.Bar,
|
|
498
588
|
{
|
|
@@ -594,11 +684,11 @@ function RadialChart({ data, max = 100, height = 220, centerValue, centerLabel,
|
|
|
594
684
|
}
|
|
595
685
|
|
|
596
686
|
// src/charts/sparkline.tsx
|
|
597
|
-
var
|
|
687
|
+
var import_react6 = require("react");
|
|
598
688
|
var import_recharts7 = require("recharts");
|
|
599
689
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
600
690
|
function Sparkline({ values, color = chartColor(0), height = 32, filled = true }) {
|
|
601
|
-
const chartId = `spark-${(0,
|
|
691
|
+
const chartId = `spark-${(0, import_react6.useId)().replace(/:/g, "")}`;
|
|
602
692
|
const data = values.filter(Number.isFinite).map((v, i) => ({ i, v }));
|
|
603
693
|
if (data.length < 2) return null;
|
|
604
694
|
const id = fillId(chartId, "v", "gradient");
|
package/dist/charts/index.mjs
CHANGED
|
@@ -109,7 +109,8 @@ function ChartSkeleton({ height = 300 }) {
|
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
function ChartTooltipContent({ active, payload, label, formatter }) {
|
|
112
|
-
|
|
112
|
+
const entries = payload?.filter((entry) => entry.type !== "none");
|
|
113
|
+
if (!active || !entries?.length) return null;
|
|
113
114
|
return /* @__PURE__ */ jsxs(
|
|
114
115
|
"div",
|
|
115
116
|
{
|
|
@@ -117,7 +118,7 @@ function ChartTooltipContent({ active, payload, label, formatter }) {
|
|
|
117
118
|
style: { background: chartConfig.tooltip.background, border: `1px solid ${chartConfig.tooltip.border}` },
|
|
118
119
|
children: [
|
|
119
120
|
label != null && label !== "" && /* @__PURE__ */ jsx("p", { className: "mb-1 font-medium", style: { color: chartConfig.tooltip.label }, children: label }),
|
|
120
|
-
|
|
121
|
+
entries.map((entry, i) => /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2", style: { color: chartConfig.tooltip.text }, children: [
|
|
121
122
|
/* @__PURE__ */ jsx("span", { className: "inline-block h-2 w-2 rounded-full", style: { backgroundColor: entry.color } }),
|
|
122
123
|
/* @__PURE__ */ jsxs("span", { style: { color: chartConfig.tooltip.label }, children: [
|
|
123
124
|
entry.name,
|
|
@@ -332,7 +333,22 @@ function LineChart({
|
|
|
332
333
|
}
|
|
333
334
|
|
|
334
335
|
// src/charts/bar-chart.tsx
|
|
335
|
-
import {
|
|
336
|
+
import {
|
|
337
|
+
Area as Area2,
|
|
338
|
+
Bar,
|
|
339
|
+
BarChart as RechartsBarChart,
|
|
340
|
+
CartesianGrid as CartesianGrid3,
|
|
341
|
+
ComposedChart,
|
|
342
|
+
DefaultZIndexes,
|
|
343
|
+
LabelList,
|
|
344
|
+
Legend as Legend3,
|
|
345
|
+
Rectangle,
|
|
346
|
+
Tooltip as Tooltip4,
|
|
347
|
+
XAxis as XAxis3,
|
|
348
|
+
YAxis as YAxis3,
|
|
349
|
+
ZIndexLayer
|
|
350
|
+
} from "recharts";
|
|
351
|
+
import { useState } from "react";
|
|
336
352
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
337
353
|
var BAR_CATEGORY_GAP = "8.33%";
|
|
338
354
|
var BAR_LABEL_FONT_SIZE = chartConfig.axis.fontSize;
|
|
@@ -376,6 +392,89 @@ function barValueLabel(format = (v) => v.toLocaleString(), {
|
|
|
376
392
|
return BarValueLabel;
|
|
377
393
|
}
|
|
378
394
|
var GROUPED_BAR_GAP = 4;
|
|
395
|
+
var FUNNEL_ALPHA = 12;
|
|
396
|
+
var BAR_ANIMATION_MS = 400;
|
|
397
|
+
var BAR_GAP_FRACTION = parseFloat(BAR_CATEGORY_GAP) / 100;
|
|
398
|
+
function barEdges(band) {
|
|
399
|
+
const inset = band * BAR_GAP_FRACTION;
|
|
400
|
+
const raw = band - 2 * inset;
|
|
401
|
+
const width = raw > 1 ? Math.floor(raw) : raw;
|
|
402
|
+
return { right: inset + width - band / 2, left: band / 2 - inset };
|
|
403
|
+
}
|
|
404
|
+
var funnelCurve = (context) => {
|
|
405
|
+
let line = NaN;
|
|
406
|
+
let count = 0;
|
|
407
|
+
let prev = [0, 0];
|
|
408
|
+
return {
|
|
409
|
+
areaStart() {
|
|
410
|
+
line = 0;
|
|
411
|
+
},
|
|
412
|
+
areaEnd() {
|
|
413
|
+
line = NaN;
|
|
414
|
+
},
|
|
415
|
+
lineStart() {
|
|
416
|
+
count = 0;
|
|
417
|
+
},
|
|
418
|
+
lineEnd() {
|
|
419
|
+
if (line || line !== 0 && count === 1) context.closePath();
|
|
420
|
+
line = 1 - line;
|
|
421
|
+
},
|
|
422
|
+
point(x, y) {
|
|
423
|
+
if (count++ === 0) {
|
|
424
|
+
if (line) context.lineTo(x, y);
|
|
425
|
+
else context.moveTo(x, y);
|
|
426
|
+
} else {
|
|
427
|
+
const [px, py] = prev;
|
|
428
|
+
const dir = Math.sign(x - px);
|
|
429
|
+
const { right, left } = barEdges(Math.abs(x - px));
|
|
430
|
+
context.lineTo(px + dir * right, py);
|
|
431
|
+
context.lineTo(x - dir * left, y);
|
|
432
|
+
context.lineTo(x, y);
|
|
433
|
+
}
|
|
434
|
+
prev = [x, y];
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
};
|
|
438
|
+
function BandCursor({ bands, fill, points, top = 0, width = 0, height = 0, className }) {
|
|
439
|
+
const x = points?.[0]?.x;
|
|
440
|
+
if (x == null || bands < 1) return null;
|
|
441
|
+
const band = width / bands;
|
|
442
|
+
return /* @__PURE__ */ jsx5(ZIndexLayer, { zIndex: DefaultZIndexes.cursorRectangle, children: /* @__PURE__ */ jsx5(
|
|
443
|
+
Rectangle,
|
|
444
|
+
{
|
|
445
|
+
x: x - band / 2,
|
|
446
|
+
y: top + 0.5,
|
|
447
|
+
width: band,
|
|
448
|
+
height: height - 1,
|
|
449
|
+
fill,
|
|
450
|
+
stroke: "none",
|
|
451
|
+
pointerEvents: "none",
|
|
452
|
+
className
|
|
453
|
+
}
|
|
454
|
+
) });
|
|
455
|
+
}
|
|
456
|
+
function FunnelSilhouette({ series, animate }) {
|
|
457
|
+
const [entered, setEntered] = useState(false);
|
|
458
|
+
return /* @__PURE__ */ jsx5(
|
|
459
|
+
Area2,
|
|
460
|
+
{
|
|
461
|
+
dataKey: series.dataKey,
|
|
462
|
+
name: series.name,
|
|
463
|
+
type: funnelCurve,
|
|
464
|
+
fill: withAlpha(series.color ?? chartColor(0), FUNNEL_ALPHA),
|
|
465
|
+
fillOpacity: 1,
|
|
466
|
+
stroke: "none",
|
|
467
|
+
dot: false,
|
|
468
|
+
activeDot: false,
|
|
469
|
+
tooltipType: "none",
|
|
470
|
+
legendType: "none",
|
|
471
|
+
isAnimationActive: animate,
|
|
472
|
+
animationBegin: entered ? 0 : BAR_ANIMATION_MS,
|
|
473
|
+
animationDuration: BAR_ANIMATION_MS,
|
|
474
|
+
onAnimationEnd: () => setEntered(true)
|
|
475
|
+
}
|
|
476
|
+
);
|
|
477
|
+
}
|
|
379
478
|
function BarChart({
|
|
380
479
|
data,
|
|
381
480
|
xKey,
|
|
@@ -387,13 +486,17 @@ function BarChart({
|
|
|
387
486
|
labelFormatter,
|
|
388
487
|
showValueLabels = true,
|
|
389
488
|
showYAxis = false,
|
|
489
|
+
funnel = false,
|
|
390
490
|
loading = false
|
|
391
491
|
}) {
|
|
392
492
|
const animate = !usePrefersReducedMotion();
|
|
393
493
|
const grouped = series.length > 1;
|
|
494
|
+
const silhouette = funnel && series.length === 1;
|
|
394
495
|
const formatLabel = labelFormatter ?? tooltipFormatter ?? ((v) => v.toLocaleString());
|
|
496
|
+
const cursorFill = withAlpha(chartColor(0), 6);
|
|
497
|
+
const Chart = silhouette ? ComposedChart : RechartsBarChart;
|
|
395
498
|
return /* @__PURE__ */ jsx5(ChartContainer, { height, loading, children: /* @__PURE__ */ jsxs5(
|
|
396
|
-
|
|
499
|
+
Chart,
|
|
397
500
|
{
|
|
398
501
|
data,
|
|
399
502
|
barCategoryGap: BAR_CATEGORY_GAP,
|
|
@@ -437,10 +540,11 @@ function BarChart({
|
|
|
437
540
|
Tooltip4,
|
|
438
541
|
{
|
|
439
542
|
content: /* @__PURE__ */ jsx5(ChartTooltipContent, { formatter: tooltipFormatter }),
|
|
440
|
-
cursor: {
|
|
543
|
+
cursor: silhouette ? /* @__PURE__ */ jsx5(BandCursor, { bands: data.length, fill: cursorFill }) : { fill: cursorFill }
|
|
441
544
|
}
|
|
442
545
|
),
|
|
443
546
|
showLegend && /* @__PURE__ */ jsx5(Legend3, { wrapperStyle: { fontSize: 12, color: chartTokens.muted, paddingTop: 8 } }),
|
|
547
|
+
silhouette && /* @__PURE__ */ jsx5(FunnelSilhouette, { series: series[0], animate }),
|
|
444
548
|
series.map((s, i) => /* @__PURE__ */ jsx5(
|
|
445
549
|
Bar,
|
|
446
550
|
{
|
|
@@ -543,7 +647,7 @@ function RadialChart({ data, max = 100, height = 220, centerValue, centerLabel,
|
|
|
543
647
|
|
|
544
648
|
// src/charts/sparkline.tsx
|
|
545
649
|
import { useId as useId4 } from "react";
|
|
546
|
-
import { Area as
|
|
650
|
+
import { Area as Area3, AreaChart as RechartsAreaChart2, YAxis as YAxis4 } from "recharts";
|
|
547
651
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
548
652
|
function Sparkline({ values, color = chartColor(0), height = 32, filled = true }) {
|
|
549
653
|
const chartId = `spark-${useId4().replace(/:/g, "")}`;
|
|
@@ -554,7 +658,7 @@ function Sparkline({ values, color = chartColor(0), height = 32, filled = true }
|
|
|
554
658
|
/* @__PURE__ */ jsx8("defs", { children: /* @__PURE__ */ jsx8(AreaFill, { id, variant: "gradient", color }) }),
|
|
555
659
|
/* @__PURE__ */ jsx8(YAxis4, { hide: true, domain: ["dataMin", "dataMax"] }),
|
|
556
660
|
/* @__PURE__ */ jsx8(
|
|
557
|
-
|
|
661
|
+
Area3,
|
|
558
662
|
{
|
|
559
663
|
type: "monotone",
|
|
560
664
|
dataKey: "v",
|
package/dist/index.d.mts
CHANGED
|
@@ -212,17 +212,19 @@ declare function useResponsivePlaceholder(desktop: string, mobile?: string): str
|
|
|
212
212
|
* looping seconds of the other app's screen, shown where a step sends someone
|
|
213
213
|
* there. Generalised from the Docs share strip's ShareClip (DEV-18388).
|
|
214
214
|
*
|
|
215
|
-
* Muted and looping
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
215
|
+
* Muted and looping. A corner toggle pauses and resumes it (DEV-19403, WCAG
|
|
216
|
+
* 2.2.2). Reduced motion never starts it (and turning it on mid-loop pauses
|
|
217
|
+
* it): the poster shows and the toggle offers Play, so it plays only when the
|
|
218
|
+
* viewer asks (DEV-19583). A browser that refuses autoplay (iOS Low Power
|
|
219
|
+
* Mode) gets the native controls instead of the toggle, until a later play()
|
|
220
|
+
* succeeds, so there is never a second set. A browser whose play() returns no
|
|
221
|
+
* promise (or has no play()) is judged by whether the clip actually left the
|
|
222
|
+
* paused state. A pause made with the toggle outlasts a reduced-motion change
|
|
223
|
+
* and a scroll away, but not a new clip.
|
|
221
224
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* change but not a new clip.
|
|
225
|
+
* Card mode (DEV-19583): `fit`, `overlay`, `playWhenVisible` (no download and
|
|
226
|
+
* no playback until the clip is on screen) and `posterOnly` (the poster image,
|
|
227
|
+
* no video at all).
|
|
226
228
|
*/
|
|
227
229
|
interface HowToClipProps {
|
|
228
230
|
/** File stem: `${clipBaseUrl}/${slug}.webm|.mp4` and `${clipBaseUrl}/${slug}-poster.jpg`. Must match /^[a-z0-9-]{1,64}$/ or nothing renders. */
|
|
@@ -231,9 +233,21 @@ interface HowToClipProps {
|
|
|
231
233
|
label: string;
|
|
232
234
|
/** Where the clip files are served from, e.g. "/how-to" or "https://cdn.example/how-to" (no query or hash). Omitted or blank → renders null. A trailing slash is dropped. */
|
|
233
235
|
clipBaseUrl?: string;
|
|
236
|
+
/** How the frame fills the 16:9 box: `"contain"` (default) letterboxes, `"cover"` crops to fill, for cards. */
|
|
237
|
+
fit?: "contain" | "cover";
|
|
238
|
+
/**
|
|
239
|
+
* Attach the sources only once a quarter of the clip is first on screen
|
|
240
|
+
* (an off-screen clip downloads nothing but its poster), then play only
|
|
241
|
+
* while it stays that visible and pause when it leaves.
|
|
242
|
+
*/
|
|
243
|
+
playWhenVisible?: boolean;
|
|
244
|
+
/** Painted over the frame, inside its rounded box (e.g. a title on a dark fade). Clicks pass through it. */
|
|
245
|
+
overlay?: ReactNode;
|
|
246
|
+
/** Only the poster, as an image named by `label`: no video, no sources, no toggle. */
|
|
247
|
+
posterOnly?: boolean;
|
|
234
248
|
className?: string;
|
|
235
249
|
}
|
|
236
|
-
declare function HowToClip({ slug, label, clipBaseUrl, className }: HowToClipProps): react.JSX.Element | null;
|
|
250
|
+
declare function HowToClip({ slug, label, clipBaseUrl, fit, playWhenVisible, overlay, posterOnly, className, }: HowToClipProps): react.JSX.Element | null;
|
|
237
251
|
|
|
238
252
|
interface SiteFooterLink {
|
|
239
253
|
href: string;
|
|
@@ -328,6 +342,11 @@ interface GroupRungItem {
|
|
|
328
342
|
icon: string;
|
|
329
343
|
/** moduleIds folded into this group. Non-empty (zod-enforced). */
|
|
330
344
|
children: string[];
|
|
345
|
+
/** DEV-19583: the group's own page — an app path ("/explore"), never another
|
|
346
|
+
* origin: zod rejects anything not starting with one "/", and any
|
|
347
|
+
* backslash, whitespace or control character (browsers fold those into "//").
|
|
348
|
+
* Set, the group's label links there and the row is active on it too. */
|
|
349
|
+
href?: string;
|
|
331
350
|
}
|
|
332
351
|
type RungItem = AppRungItem | GroupRungItem;
|
|
333
352
|
interface SidebarRung {
|
|
@@ -367,6 +386,7 @@ declare const zSidebarLadder: z.ZodObject<{
|
|
|
367
386
|
label: z.ZodString;
|
|
368
387
|
icon: z.ZodString;
|
|
369
388
|
children: z.ZodArray<z.ZodString>;
|
|
389
|
+
href: z.ZodOptional<z.ZodString>;
|
|
370
390
|
}, z.core.$strip>], "type">>;
|
|
371
391
|
}, z.core.$strip>>;
|
|
372
392
|
}, z.core.$strip>;
|
|
@@ -433,6 +453,9 @@ interface AppSidebarRecent {
|
|
|
433
453
|
onSelect: (id: string) => void;
|
|
434
454
|
/** Section heading. Default `"Recent"`. */
|
|
435
455
|
label?: string;
|
|
456
|
+
/** DEV-19583: where the heading goes (e.g. the full chats page). Set, the
|
|
457
|
+
* heading renders as a link through `linkComponent`, same text and id. */
|
|
458
|
+
href?: string;
|
|
436
459
|
/** Rows shown before "More". Default 6; floored to a whole number >= 1, and a non-finite value uses the default. */
|
|
437
460
|
limit?: number;
|
|
438
461
|
/** Where "More" goes (rendered through `linkComponent`). No href, no More. */
|
|
@@ -598,7 +621,22 @@ interface FlyoutProps {
|
|
|
598
621
|
active: boolean;
|
|
599
622
|
children: FlyoutChild[];
|
|
600
623
|
/**
|
|
601
|
-
*
|
|
624
|
+
* DEV-19583: the group's own page. Set, the label becomes a link to it
|
|
625
|
+
* (through `linkComponent`), so a click or Enter navigates while hover
|
|
626
|
+
* still opens the panel; a separate chevron button beside it is the
|
|
627
|
+
* disclosure (`aria-expanded`, Enter/Space/click toggle the panel, Esc
|
|
628
|
+
* closes it and returns focus to the chevron). Omitted, the row is the
|
|
629
|
+
* single disclosure button it always was, markup unchanged.
|
|
630
|
+
*
|
|
631
|
+
* On the `collapsed` rail there is no room for two controls, so the row
|
|
632
|
+
* stays the single icon button and the panel opens with a first row
|
|
633
|
+
* linking to `href`, named by `label`.
|
|
634
|
+
*/
|
|
635
|
+
href?: string;
|
|
636
|
+
/** DEV-19583: the current page is `href` itself (not a child), so its link carries `aria-current="page"`. */
|
|
637
|
+
hrefActive?: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Link renderer for the panel's child rows (and the `href` label). Defaults to a bare `"a"` so
|
|
602
640
|
* the package stays framework-agnostic; consumers pass their router's
|
|
603
641
|
* link (e.g. `next/link`) for client-side navigation. Flyout is
|
|
604
642
|
* independently exported (see src/index.ts), so it carries its own copy
|
|
@@ -672,7 +710,7 @@ interface FlyoutProps {
|
|
|
672
710
|
* than working around it. jsdom never computes real scrollable-overflow
|
|
673
711
|
* geometry, so no unit test caught this — only an actual browser render did.
|
|
674
712
|
*/
|
|
675
|
-
declare function Flyout({ label, icon, active, children, linkComponent, collapsed, onOpenChange, forceClosed, hoverOpenDelayMs, className, }: FlyoutProps): react.JSX.Element;
|
|
713
|
+
declare function Flyout({ label, icon, active, children, href, hrefActive, linkComponent, collapsed, onOpenChange, forceClosed, hoverOpenDelayMs, className, }: FlyoutProps): react.JSX.Element;
|
|
676
714
|
|
|
677
715
|
/**
|
|
678
716
|
* ContextSwitcher (DEV-4408) — promoted out of reeve-frontend's
|