@siyahi/ui 0.1.9-next.32 → 0.1.9-next.34
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/DESIGN.md +20 -7
- package/agents/examples/chart-panels-three.tsx +51 -0
- package/agents/examples/context-menu.tsx +14 -4
- package/agents/examples/overview-dashboard.tsx +2 -2
- package/agents/examples/{page-hero.tsx → page-header.tsx} +4 -4
- package/agents/examples/select.tsx +2 -1
- package/agents/manifest.json +16 -3
- package/dist/components/registry/charts/area-chart-card.d.ts +2 -2
- package/dist/components/registry/charts/area-chart-card.js +1 -0
- package/dist/components/registry/charts/bar-chart-card.d.ts +4 -4
- package/dist/components/registry/charts/bar-chart-card.js +0 -2
- package/dist/components/registry/charts/line-chart-card.d.ts +1 -1
- package/dist/components/registry/dashboard-01/section-cards.d.ts +4 -4
- package/dist/components/registry/dashboardcn/bar-list.d.ts +8 -8
- package/dist/components/registry/dashboardcn/distribution-bar.d.ts +11 -11
- package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +4 -4
- package/dist/components/registry/dashboardcn/sparkline.d.ts +6 -6
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +50 -50
- package/dist/components/registry/heatmap/calendar-heatmap.js +1 -1
- package/dist/components/registry/heatmap/status-heatmap.d.ts +44 -44
- package/dist/components/registry/heatmap/status-heatmap.js +1 -1
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +53 -53
- package/dist/components/registry/heatmap/weekday-heatmap.js +1 -1
- package/dist/components/registry/minidev/copy-button.d.ts +2 -2
- package/dist/components/registry/niko-table/components/data-table-column-actions.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-column-filter.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-empty-state.d.ts +7 -7
- package/dist/components/registry/niko-table/components/data-table-faceted-filter.d.ts +5 -5
- package/dist/components/registry/niko-table/components/data-table-grouped-rows.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-row-context-menu.d.ts +1 -1
- package/dist/components/registry/niko-table/config/feature-detection.d.ts +13 -13
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +5 -5
- package/dist/components/registry/niko-table/core/data-table-error-boundary.d.ts +3 -3
- package/dist/components/registry/niko-table/core/data-table-grouped-row.d.ts +2 -2
- package/dist/components/registry/niko-table/core/data-table-root.d.ts +36 -35
- package/dist/components/registry/niko-table/core/data-table-structure.d.ts +22 -22
- package/dist/components/registry/niko-table/core/data-table-structure.js +6 -0
- package/dist/components/registry/niko-table/core/data-table.d.ts +3 -3
- package/dist/components/registry/niko-table/core/data-table.js +1 -1
- package/dist/components/registry/niko-table/filters/table-column-actions.d.ts +5 -5
- package/dist/components/registry/niko-table/filters/table-column-sort.d.ts +6 -6
- package/dist/components/registry/niko-table/filters/table-column-sort.js +2 -2
- package/dist/components/registry/niko-table/filters/table-column-title.d.ts +2 -2
- package/dist/components/registry/niko-table/filters/table-faceted-filter.d.ts +9 -9
- package/dist/components/registry/niko-table/filters/table-faceted-filter.js +1 -1
- package/dist/components/registry/niko-table/filters/table-search-filter.d.ts +7 -7
- package/dist/components/registry/niko-table/hooks/use-generated-options.d.ts +7 -7
- package/dist/components/registry/niko-table/lib/build-faceted-options.d.ts +2 -2
- package/dist/components/registry/niko-table/lib/column-resize-handle.d.ts +3 -3
- package/dist/components/registry/niko-table/lib/column-resize-handle.js +1 -1
- package/dist/components/registry/niko-table/lib/create-scroll-handler.d.ts +4 -4
- package/dist/components/registry/niko-table/types/index.d.ts +29 -29
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +6 -5
- package/dist/components/registry/sidebar-07/nav-main.d.ts +4 -4
- package/dist/components/registry/sidebar-07/nav-user.js +16 -19
- package/dist/components/siyahi/callout.d.ts +1 -1
- package/dist/components/siyahi/change-bar.d.ts +3 -3
- package/dist/components/siyahi/change-grid.d.ts +6 -6
- package/dist/components/siyahi/data-bar.d.ts +2 -2
- package/dist/components/siyahi/data-list.d.ts +1 -1
- package/dist/components/siyahi/data-table-row-count.d.ts +1 -1
- package/dist/components/siyahi/data-table-sort-header.d.ts +1 -1
- package/dist/components/siyahi/delta.d.ts +2 -2
- package/dist/components/siyahi/drawdown-chart.d.ts +2 -2
- package/dist/components/siyahi/histogram-chart.d.ts +5 -5
- package/dist/components/siyahi/local-time.d.ts +1 -1
- package/dist/components/siyahi/{page-hero.d.ts → page-header.d.ts} +3 -3
- package/dist/components/siyahi/{page-hero.js → page-header.js} +4 -4
- package/dist/components/siyahi/page-section.d.ts +1 -1
- package/dist/components/siyahi/page-toc.d.ts +2 -2
- package/dist/components/siyahi/panel-grid.d.ts +7 -4
- package/dist/components/siyahi/panel-grid.js +1 -1
- package/dist/components/siyahi/price-chart.d.ts +1 -1
- package/dist/components/siyahi/range-position.d.ts +5 -5
- package/dist/components/siyahi/range-position.js +1 -1
- package/dist/components/siyahi/scale-toggle.d.ts +2 -2
- package/dist/components/siyahi/scatter-chart.d.ts +15 -15
- package/dist/components/siyahi/scatter-chart.js +14 -1
- package/dist/components/siyahi/siyahi-provider.d.ts +3 -2
- package/dist/components/siyahi/siyahi-provider.js +1 -4
- package/dist/components/siyahi/slope-chart.d.ts +4 -4
- package/dist/components/siyahi/status-alert.d.ts +1 -1
- package/dist/components/siyahi/status-badge.d.ts +1 -1
- package/dist/components/siyahi/target-rows.d.ts +6 -6
- package/dist/components/siyahi/target-rows.js +2 -2
- package/dist/components/siyahi/treemap.d.ts +8 -8
- package/dist/components/siyahi/treemap.js +0 -3
- package/dist/components/siyahi/waterfall-chart.d.ts +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/chart-frame.d.ts +48 -20
- package/dist/lib/chart-frame.js +60 -30
- package/dist/lib/chart-marks.d.ts +2 -2
- package/dist/lib/chart-series.d.ts +25 -24
- package/dist/lib/format.d.ts +1 -1
- package/dist/lib/optional.d.ts +7 -0
- package/dist/lib/optional.js +0 -0
- package/dist/lib/scatter.d.ts +7 -7
- package/dist/lib/ticks.d.ts +9 -0
- package/dist/lib/ticks.js +25 -3
- package/dist/lib/treemap.d.ts +1 -1
- package/dist/lib/use-render-when-fonts-load.d.ts +11 -0
- package/dist/lib/use-render-when-fonts-load.js +49 -0
- package/package.json +2 -2
- package/report.css +1 -0
- package/styles/siyahi.css +51 -4
package/DESIGN.md
CHANGED
|
@@ -24,7 +24,9 @@ a meaning:
|
|
|
24
24
|
inside a 1px border of the same colour all round. Large marks follow the same
|
|
25
25
|
rule: every bar is a tint inside a 1px full-colour edge, not a solid slab.
|
|
26
26
|
A bar is read by its edge, which reaches 3:1 against the card; the tint is a
|
|
27
|
-
fill carried by that edge
|
|
27
|
+
fill carried by that edge: half its colour (`--bar-tint`, 50%), strong
|
|
28
|
+
enough that a thin stacked segment, mostly edge, still shows its colour
|
|
29
|
+
against the next, and a pale slot's bar does not read as the card.
|
|
28
30
|
- **Never a stripe down one side.** Do not mark a notice, card, row or quote
|
|
29
31
|
with a left (or any single-side) coloured border; tint the box or add an
|
|
30
32
|
icon. 1px neutral dividers between columns are separators, not accents, and
|
|
@@ -83,10 +85,15 @@ mono face and the link colour, so the text can point to one.
|
|
|
83
85
|
## Shape
|
|
84
86
|
|
|
85
87
|
- **Square corners everywhere**: panels, cards, buttons, fields, badges,
|
|
86
|
-
toggles, menus,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
toggles, menus, bars and tracks (data bars, progress, a slider's track and
|
|
89
|
+
thumb, a scrollbar's thumb), heatmap cells, treemap tiles and the colour
|
|
90
|
+
chips of charts and legends alike (`--radius` is 0). Only what is round by
|
|
91
|
+
nature stays round: an avatar, a status dot, a line's end dot, a spinner,
|
|
92
|
+
and a signed calendar heatmap's loss day, whose shape carries its sign.
|
|
93
|
+
Never add a `rounded-*` class to a box.
|
|
94
|
+
- **Floating surfaces lie flat.** A menu, a select's list, a popover, a
|
|
95
|
+
dialog, a sheet and a chart's tooltip take no drop shadow and the card's
|
|
96
|
+
hairline for their edge, so they read as a sheet of the page.
|
|
90
97
|
- **Joined toggles.** The items of a `ToggleGroup` sit flush and share their
|
|
91
98
|
borders, one control; the pressed item fills with the foreground.
|
|
92
99
|
- **A code block's copy button sits in a header row** (`CodeBlockHeader`),
|
|
@@ -97,7 +104,7 @@ mono face and the link colour, so the text can point to one.
|
|
|
97
104
|
|
|
98
105
|
## Page header
|
|
99
106
|
|
|
100
|
-
An app page opens on its masthead, `
|
|
107
|
+
An app page opens on its masthead, `PageHeader`: a small mark and eyebrow in the
|
|
101
108
|
mono face and link colour, the title, one muted line saying what the page is,
|
|
102
109
|
the actions at the right, and a hairline under it. One per page; no hero card.
|
|
103
110
|
|
|
@@ -186,7 +193,8 @@ from the catalogue.
|
|
|
186
193
|
|
|
187
194
|
- **Labels are small monospaced capitals**: a stat tile's label and footer
|
|
188
195
|
lines, a `MetricStrip` label, a table's column heads, a sidebar group's
|
|
189
|
-
label,
|
|
196
|
+
label, a group's label in a menu, a select's list or the command palette,
|
|
197
|
+
and a form field's label (muted, above the field). The components and
|
|
190
198
|
the theme set them; never set a label in this style by hand elsewhere, and
|
|
191
199
|
never set a figure or a title in it.
|
|
192
200
|
- **A total row reads as a ledger's**: in `TableFooter`, one rule above it and
|
|
@@ -211,6 +219,11 @@ from the catalogue.
|
|
|
211
219
|
a stack's grey bands read in the legend's order, bottom to top.
|
|
212
220
|
- **No fill under overlapping areas**: from three series on, fills bury each
|
|
213
221
|
other. A stack fills each band with a flat tint, never a gradient.
|
|
222
|
+
- **The value axis just covers the data.** Unless the page fixes it, it ends
|
|
223
|
+
on the round tick just past what is drawn (a 46,800 peak at 50,000, by
|
|
224
|
+
10,000s), a stack's totals for a stack. Bars and stacks reach zero, since
|
|
225
|
+
their length is the value; lines and overlapping areas need not, so a
|
|
226
|
+
revenue line from ₹38L to ₹45L fills the plot rather than its top fifth.
|
|
214
227
|
- **Forecast and today.** `forecastFrom` dashes every line from that point,
|
|
215
228
|
hatches the stretch faintly behind lines on card-coloured halos, labels it
|
|
216
229
|
FORECAST and hollows the end dots (a stack keeps solid edges and no hatching:
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AreaChartCard, BarChartCard, LineChartCard, PanelGrid, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// One fund over six months: its month-end growth, its value and what was added each month.
|
|
4
|
+
const months = [
|
|
5
|
+
{ month: "May", growth: 0, value: 410000, added: 20000 },
|
|
6
|
+
{ month: "Jun", growth: 0.025, value: 432000, added: 15000 },
|
|
7
|
+
{ month: "Jul", growth: 0.061, value: 455000, added: 10000 },
|
|
8
|
+
{ month: "Aug", growth: 0.047, value: 461000, added: 25000 },
|
|
9
|
+
{ month: "Sep", growth: 0.11, value: 498000, added: 15000 },
|
|
10
|
+
{ month: "Oct", growth: 0.156, value: 527000, added: 20000 },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
// Three short panels in a reading column about as wide as an article (max-w-4xl, 56rem): three across from 42rem.
|
|
14
|
+
export default function ChartPanelsThreeExample() {
|
|
15
|
+
const { pct, money, moneyCompact } = useFormat();
|
|
16
|
+
return (
|
|
17
|
+
<div className="max-w-4xl">
|
|
18
|
+
<PanelGrid columns={3}>
|
|
19
|
+
<LineChartCard
|
|
20
|
+
title="Growth"
|
|
21
|
+
description="Since May, month-end"
|
|
22
|
+
data={months}
|
|
23
|
+
xKey="month"
|
|
24
|
+
series={[{ key: "growth", label: "Growth", color: "var(--chart-1)" }]}
|
|
25
|
+
valueFormatter={pct}
|
|
26
|
+
height={160}
|
|
27
|
+
/>
|
|
28
|
+
<AreaChartCard
|
|
29
|
+
title="Value"
|
|
30
|
+
description="Month-end, ₹"
|
|
31
|
+
data={months}
|
|
32
|
+
xKey="month"
|
|
33
|
+
series={[{ key: "value", label: "Value", color: "var(--chart-1)" }]}
|
|
34
|
+
valueFormatter={money}
|
|
35
|
+
yTickFormatter={moneyCompact}
|
|
36
|
+
height={160}
|
|
37
|
+
/>
|
|
38
|
+
<BarChartCard
|
|
39
|
+
title="Added"
|
|
40
|
+
description="Each month, ₹"
|
|
41
|
+
data={months}
|
|
42
|
+
xKey="month"
|
|
43
|
+
series={[{ key: "added", label: "Added", color: "var(--chart-1)" }]}
|
|
44
|
+
valueFormatter={money}
|
|
45
|
+
yTickFormatter={moneyCompact}
|
|
46
|
+
height={160}
|
|
47
|
+
/>
|
|
48
|
+
</PanelGrid>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ContextMenu,
|
|
3
|
+
ContextMenuContent,
|
|
4
|
+
ContextMenuGroup,
|
|
5
|
+
ContextMenuItem,
|
|
6
|
+
ContextMenuLabel,
|
|
7
|
+
ContextMenuTrigger,
|
|
8
|
+
} from "@siyahi/ui";
|
|
2
9
|
|
|
3
10
|
export default function ContextMenuExample() {
|
|
4
11
|
return (
|
|
5
12
|
<ContextMenu>
|
|
6
13
|
<ContextMenuTrigger className="w-full">
|
|
7
|
-
<div className="flex h-24 items-center justify-center
|
|
14
|
+
<div className="flex h-24 items-center justify-center border text-muted-foreground">
|
|
8
15
|
Right-click or long-press here
|
|
9
16
|
</div>
|
|
10
17
|
</ContextMenuTrigger>
|
|
11
18
|
<ContextMenuContent>
|
|
12
|
-
<
|
|
13
|
-
|
|
19
|
+
<ContextMenuGroup>
|
|
20
|
+
<ContextMenuLabel>Order</ContextMenuLabel>
|
|
21
|
+
<ContextMenuItem>Copy order number</ContextMenuItem>
|
|
22
|
+
<ContextMenuItem>Open order</ContextMenuItem>
|
|
23
|
+
</ContextMenuGroup>
|
|
14
24
|
</ContextMenuContent>
|
|
15
25
|
</ContextMenu>
|
|
16
26
|
);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
CardTitle,
|
|
10
10
|
Delta,
|
|
11
11
|
Input,
|
|
12
|
-
|
|
12
|
+
PageHeader,
|
|
13
13
|
PanelGrid,
|
|
14
14
|
StatusBadge,
|
|
15
15
|
Table,
|
|
@@ -126,7 +126,7 @@ export default function OverviewDashboard() {
|
|
|
126
126
|
const shown = holdings.filter((row) => row.name.toLowerCase().includes(query.trim().toLowerCase()));
|
|
127
127
|
return (
|
|
128
128
|
<div className="flex flex-col gap-6">
|
|
129
|
-
<
|
|
129
|
+
<PageHeader
|
|
130
130
|
mark={<InkDrop />}
|
|
131
131
|
eyebrow="The Book"
|
|
132
132
|
title="Holdings"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, PageHeader } from "@siyahi/ui";
|
|
2
2
|
import { ArrowRightIcon } from "lucide-react";
|
|
3
3
|
|
|
4
|
-
// The catalogue's own ink drop, painted with currentColor so the
|
|
4
|
+
// The catalogue's own ink drop, painted with currentColor so the header tints it.
|
|
5
5
|
function InkDrop() {
|
|
6
6
|
return (
|
|
7
7
|
<svg viewBox="0 0 16 16">
|
|
@@ -14,9 +14,9 @@ function InkDrop() {
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default function
|
|
17
|
+
export default function PageHeaderExample() {
|
|
18
18
|
return (
|
|
19
|
-
<
|
|
19
|
+
<PageHeader
|
|
20
20
|
eyebrow="@siyahi/ui"
|
|
21
21
|
title="Siyahi"
|
|
22
22
|
lead="Ink for numbers. A design system for pages people read figures from: dashboards, ledgers, reports."
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@siyahi/ui";
|
|
1
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@siyahi/ui";
|
|
2
2
|
|
|
3
3
|
const stores = [
|
|
4
4
|
{ label: "All stores", value: "all" },
|
|
@@ -15,6 +15,7 @@ export default function SelectExample() {
|
|
|
15
15
|
</SelectTrigger>
|
|
16
16
|
<SelectContent>
|
|
17
17
|
<SelectGroup>
|
|
18
|
+
<SelectLabel>Sales channel</SelectLabel>
|
|
18
19
|
{stores.map((store) => (
|
|
19
20
|
<SelectItem key={store.value} value={store.value}>
|
|
20
21
|
{store.label}
|
package/agents/manifest.json
CHANGED
|
@@ -671,6 +671,16 @@
|
|
|
671
671
|
"useFormat"
|
|
672
672
|
]
|
|
673
673
|
},
|
|
674
|
+
{
|
|
675
|
+
"file": "agents/examples/chart-panels-three.tsx",
|
|
676
|
+
"components": [
|
|
677
|
+
"AreaChartCard",
|
|
678
|
+
"BarChartCard",
|
|
679
|
+
"LineChartCard",
|
|
680
|
+
"PanelGrid",
|
|
681
|
+
"useFormat"
|
|
682
|
+
]
|
|
683
|
+
},
|
|
674
684
|
{
|
|
675
685
|
"file": "agents/examples/chart-panels.tsx",
|
|
676
686
|
"components": [
|
|
@@ -717,7 +727,9 @@
|
|
|
717
727
|
"components": [
|
|
718
728
|
"ContextMenu",
|
|
719
729
|
"ContextMenuContent",
|
|
730
|
+
"ContextMenuGroup",
|
|
720
731
|
"ContextMenuItem",
|
|
732
|
+
"ContextMenuLabel",
|
|
721
733
|
"ContextMenuTrigger"
|
|
722
734
|
]
|
|
723
735
|
},
|
|
@@ -1038,7 +1050,7 @@
|
|
|
1038
1050
|
"CardTitle",
|
|
1039
1051
|
"Delta",
|
|
1040
1052
|
"Input",
|
|
1041
|
-
"
|
|
1053
|
+
"PageHeader",
|
|
1042
1054
|
"PanelGrid",
|
|
1043
1055
|
"StatusBadge",
|
|
1044
1056
|
"Table",
|
|
@@ -1054,10 +1066,10 @@
|
|
|
1054
1066
|
]
|
|
1055
1067
|
},
|
|
1056
1068
|
{
|
|
1057
|
-
"file": "agents/examples/page-
|
|
1069
|
+
"file": "agents/examples/page-header.tsx",
|
|
1058
1070
|
"components": [
|
|
1059
1071
|
"Button",
|
|
1060
|
-
"
|
|
1072
|
+
"PageHeader"
|
|
1061
1073
|
]
|
|
1062
1074
|
},
|
|
1063
1075
|
{
|
|
@@ -1208,6 +1220,7 @@
|
|
|
1208
1220
|
"SelectContent",
|
|
1209
1221
|
"SelectGroup",
|
|
1210
1222
|
"SelectItem",
|
|
1223
|
+
"SelectLabel",
|
|
1211
1224
|
"SelectTrigger",
|
|
1212
1225
|
"SelectValue"
|
|
1213
1226
|
]
|
|
@@ -2,8 +2,8 @@ import { ChartCurve, LineMarksProps, NumericXProps, SeriesChartProps, ValueScale
|
|
|
2
2
|
//#region src/components/registry/charts/area-chart-card.d.ts
|
|
3
3
|
export interface AreaChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K>, NumericXProps, ValueScaleProps, LineMarksProps<T, K> {
|
|
4
4
|
/** Stack the series into a total instead of overlapping them. */
|
|
5
|
-
stacked?: boolean;
|
|
6
|
-
curve?: ChartCurve;
|
|
5
|
+
stacked?: boolean | undefined;
|
|
6
|
+
curve?: ChartCurve | undefined;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Values over an ordered axis: overlapping series drawn as lines, or stacked into a total as tinted bands. A
|
|
@@ -18,6 +18,7 @@ function AreaChartCard({ stacked = false, curve = "monotone", ...props }) {
|
|
|
18
18
|
return /* @__PURE__ */ jsxs(ChartFrame, {
|
|
19
19
|
chart: AreaChart,
|
|
20
20
|
logBlocked: stacked ? "Log cannot show stacked areas" : void 0,
|
|
21
|
+
stackOffset: stacked ? "none" : void 0,
|
|
21
22
|
endLabels: !stacked,
|
|
22
23
|
forecastHatch: !stacked,
|
|
23
24
|
curve,
|
|
@@ -2,13 +2,13 @@ import { SeriesChartProps } from "../../../lib/chart-series.js";
|
|
|
2
2
|
//#region src/components/registry/charts/bar-chart-card.d.ts
|
|
3
3
|
export interface BarChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K> {
|
|
4
4
|
/** Stack the series in one bar per point instead of side by side. */
|
|
5
|
-
stacked?: boolean;
|
|
5
|
+
stacked?: boolean | undefined;
|
|
6
6
|
/** Bars run sideways, categories down the left: for long names, such as product categories. */
|
|
7
|
-
horizontal?: boolean;
|
|
7
|
+
horizontal?: boolean | undefined;
|
|
8
8
|
/** The picked category's x value: its bars stay solid and the rest fade. */
|
|
9
|
-
selected?: T[K] | null;
|
|
9
|
+
selected?: T[K] | null | undefined;
|
|
10
10
|
/** Called with a clicked category's x value, or null when the picked one is clicked again. */
|
|
11
|
-
onSelect?: (value: T[K] | null) => void;
|
|
11
|
+
onSelect?: ((value: T[K] | null) => void) | undefined;
|
|
12
12
|
}
|
|
13
13
|
/** Values over an ordered axis as bars: one series, or several grouped or stacked. */
|
|
14
14
|
export declare function BarChartCard<T extends object, K extends keyof T>({ stacked, selected, onSelect, ...props }: BarChartCardProps<T, K>): import("react").JSX.Element;
|
|
@@ -3,13 +3,11 @@ import { ChartFrame, barFill, seriesFill } from "../../../lib/chart-frame.js";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Bar, BarChart, Cell } from "recharts";
|
|
5
5
|
//#region src/components/registry/charts/bar-chart-card.tsx
|
|
6
|
-
const DOWN_FROM_ZERO = ["auto", 0];
|
|
7
6
|
/** Values over an ordered axis as bars: one series, or several grouped or stacked. */
|
|
8
7
|
function BarChartCard({ stacked = false, selected = null, onSelect, ...props }) {
|
|
9
8
|
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
10
9
|
chart: BarChart,
|
|
11
10
|
...props,
|
|
12
|
-
yDomain: props.yDomain ?? (props.data.some((row) => props.series.some(({ key }) => Number(row[key]) > 0)) ? void 0 : DOWN_FROM_ZERO),
|
|
13
11
|
stackOffset: stacked ? "sign" : void 0,
|
|
14
12
|
onClick: onSelect ? ({ activeTooltipIndex, isTooltipActive }) => {
|
|
15
13
|
if (!isTooltipActive || activeTooltipIndex == null) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartCurve, LineMarksProps, NumericXProps, SeriesChartProps, ValueScaleProps } from "../../../lib/chart-series.js";
|
|
2
2
|
//#region src/components/registry/charts/line-chart-card.d.ts
|
|
3
3
|
export interface LineChartCardProps<T extends object, K extends keyof T> extends SeriesChartProps<T, K>, NumericXProps, ValueScaleProps, LineMarksProps<T, K> {
|
|
4
|
-
curve?: ChartCurve;
|
|
4
|
+
curve?: ChartCurve | undefined;
|
|
5
5
|
}
|
|
6
6
|
/** Values over an ordered axis as lines: one series, or several to compare, such as sales against a target. */
|
|
7
7
|
export declare function LineChartCard<T extends object, K extends keyof T>({ curve, ...props }: LineChartCardProps<T, K>): import("react").JSX.Element;
|
|
@@ -13,18 +13,18 @@ export interface SectionCard {
|
|
|
13
13
|
/** Muted second footer line. */
|
|
14
14
|
detail?: React$1.ReactNode;
|
|
15
15
|
/** In a picker, a tile that cannot be picked, such as one with nothing in it: faded, and its button disabled. */
|
|
16
|
-
disabled?: boolean;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
17
|
/** Marks the tile as the exception on the page: a faint wash of the colour and an outline of it. */
|
|
18
|
-
tone?: "negative" | "warning";
|
|
18
|
+
tone?: "negative" | "warning" | undefined;
|
|
19
19
|
/** Marks the tile's data as old, with since when, such as "3 Nov": the tile greys out and says so. */
|
|
20
20
|
stale?: React$1.ReactNode;
|
|
21
21
|
}
|
|
22
22
|
export interface SectionCardsProps {
|
|
23
23
|
items: SectionCard[];
|
|
24
24
|
/** The label of the picked tile. */
|
|
25
|
-
selected?: string;
|
|
25
|
+
selected?: string | undefined;
|
|
26
26
|
/** Makes each tile one button, so keep tile content non-interactive; gets the label of the tile picked. */
|
|
27
|
-
onSelect?: (label: string) => void;
|
|
27
|
+
onSelect?: ((label: string) => void) | undefined;
|
|
28
28
|
}
|
|
29
29
|
export declare function SectionCards({ items, selected, onSelect }: SectionCardsProps): React$1.JSX.Element;
|
|
30
30
|
//#endregion
|
|
@@ -4,24 +4,24 @@ export interface BarListItem {
|
|
|
4
4
|
name: string;
|
|
5
5
|
value: number;
|
|
6
6
|
/** Renders the label as a link. */
|
|
7
|
-
href?: string;
|
|
7
|
+
href?: string | undefined;
|
|
8
8
|
icon?: React$1.ReactNode;
|
|
9
9
|
/** Secondary figure after the label, such as a `Delta`. */
|
|
10
10
|
detail?: React$1.ReactNode;
|
|
11
11
|
/** Stable key when names can repeat. */
|
|
12
|
-
key?: string;
|
|
12
|
+
key?: string | undefined;
|
|
13
13
|
}
|
|
14
14
|
export interface BarListProps extends React$1.ComponentProps<"div"> {
|
|
15
15
|
data: BarListItem[];
|
|
16
|
-
valueFormatter?: (value: number) => string;
|
|
17
|
-
sortOrder?: "descending" | "ascending" | "none";
|
|
16
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
17
|
+
sortOrder?: "descending" | "ascending" | "none" | undefined;
|
|
18
18
|
/** Any CSS color. Defaults to chart-1. */
|
|
19
|
-
color?: string;
|
|
19
|
+
color?: string | undefined;
|
|
20
20
|
/** Show each row's share of the total next to its value. */
|
|
21
|
-
showPercentage?: boolean;
|
|
21
|
+
showPercentage?: boolean | undefined;
|
|
22
22
|
/** The value a full-width bar stands for. Give two lists the same max to draw them on one scale. Defaults to the largest value. */
|
|
23
|
-
max?: number;
|
|
24
|
-
onItemClick?: (item: BarListItem) => void;
|
|
23
|
+
max?: number | undefined;
|
|
24
|
+
onItemClick?: ((item: BarListItem) => void) | undefined;
|
|
25
25
|
}
|
|
26
26
|
declare function BarList({ data, valueFormatter, sortOrder, color, showPercentage, max: scale, onItemClick, className, ...props }: BarListProps): React$1.JSX.Element;
|
|
27
27
|
//#endregion
|
|
@@ -5,33 +5,33 @@ export interface DistributionSegment {
|
|
|
5
5
|
name: string;
|
|
6
6
|
value: number;
|
|
7
7
|
/** Defaults to chart-1 through chart-5 in order; var(--muted) for space that is free. */
|
|
8
|
-
color?: ChartColor | "var(--muted)";
|
|
8
|
+
color?: ChartColor | "var(--muted)" | undefined;
|
|
9
9
|
/** Stable key when names can repeat. */
|
|
10
|
-
key?: string;
|
|
10
|
+
key?: string | undefined;
|
|
11
11
|
}
|
|
12
12
|
export interface DistributionMarker {
|
|
13
13
|
/** The value the line marks, on the bar's scale. */
|
|
14
14
|
at: number;
|
|
15
|
-
label?: string;
|
|
15
|
+
label?: string | undefined;
|
|
16
16
|
}
|
|
17
17
|
export interface DistributionBarProps extends Omit<React$1.ComponentProps<"div">, "onMouseLeave"> {
|
|
18
18
|
segments: DistributionSegment[];
|
|
19
|
-
valueFormatter?: (value: number) => string;
|
|
20
|
-
showLegend?: boolean;
|
|
19
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
20
|
+
showLegend?: boolean | undefined;
|
|
21
21
|
/** Show absolute values in the legend in addition to the share. */
|
|
22
|
-
showValues?: boolean;
|
|
22
|
+
showValues?: boolean | undefined;
|
|
23
23
|
/** The value the bar's right end stands for. Defaults to the positive segments' total. */
|
|
24
|
-
max?: number;
|
|
24
|
+
max?: number | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* The value the bar's left end stands for. Defaults to the negative segments' total, or 0 when there are none.
|
|
27
27
|
* Above zero, segments (which start at zero) fall off the bar.
|
|
28
28
|
*/
|
|
29
|
-
min?: number;
|
|
30
|
-
markers?: DistributionMarker[];
|
|
29
|
+
min?: number | undefined;
|
|
30
|
+
markers?: DistributionMarker[] | undefined;
|
|
31
31
|
/** The key (or name) of the one segment to keep solid; the rest fade. */
|
|
32
|
-
highlighted?: string | null;
|
|
32
|
+
highlighted?: string | null | undefined;
|
|
33
33
|
/** Called with the segment under the pointer, and null when it leaves the bar. */
|
|
34
|
-
onHover?: (segment: DistributionSegment | null) => void;
|
|
34
|
+
onHover?: ((segment: DistributionSegment | null) => void) | undefined;
|
|
35
35
|
}
|
|
36
36
|
declare function DistributionBar({ segments, valueFormatter, showLegend, showValues, max, min, markers, highlighted, onHover, className, "aria-label": ariaLabel, ...props }: DistributionBarProps): React$1.JSX.Element;
|
|
37
37
|
//#endregion
|
|
@@ -7,14 +7,14 @@ export interface MetricStripItem {
|
|
|
7
7
|
/** The figure, formatted by the page: money(4512300). */
|
|
8
8
|
value: React$1.ReactNode;
|
|
9
9
|
/** The signed change, drawn as a Delta under the figure; its sign colours the trend. For "pct", a fraction. */
|
|
10
|
-
change?: number;
|
|
11
|
-
changeFormat?: "pct" | "money";
|
|
10
|
+
change?: number | undefined;
|
|
11
|
+
changeFormat?: "pct" | "money" | undefined;
|
|
12
12
|
/** Muted words after the change, such as "vs last month". */
|
|
13
13
|
note?: React$1.ReactNode;
|
|
14
14
|
/** Recent values, oldest first, drawn as a sparkline beside the figure. */
|
|
15
|
-
trend?: number[];
|
|
15
|
+
trend?: number[] | undefined;
|
|
16
16
|
/** Marks the figure as the exception on the page: a faint wash of the colour and an outline of it. */
|
|
17
|
-
tone?: "negative" | "warning";
|
|
17
|
+
tone?: "negative" | "warning" | undefined;
|
|
18
18
|
}
|
|
19
19
|
export interface MetricStripProps extends Omit<React$1.ComponentProps<typeof Card>, "title"> {
|
|
20
20
|
title?: React$1.ReactNode;
|
|
@@ -4,18 +4,18 @@ import * as React$1 from "react";
|
|
|
4
4
|
export interface SparklineProps extends React$1.ComponentProps<"div"> {
|
|
5
5
|
/** Series to plot, oldest first. */
|
|
6
6
|
data: number[];
|
|
7
|
-
variant?: "area" | "line";
|
|
7
|
+
variant?: "area" | "line" | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* The last step and the dot on the latest value: a chart slot, or var(--positive) or var(--negative) for a gain or
|
|
10
10
|
* a loss. Defaults to var(--chart-1). The run before it is muted.
|
|
11
11
|
*/
|
|
12
|
-
color?: ChartColor;
|
|
13
|
-
curve?: "monotone" | "linear" | "step";
|
|
12
|
+
color?: ChartColor | undefined;
|
|
13
|
+
curve?: "monotone" | "linear" | "step" | undefined;
|
|
14
14
|
/** The run's line; the last step is 2px. */
|
|
15
|
-
strokeWidth?: number;
|
|
15
|
+
strokeWidth?: number | undefined;
|
|
16
16
|
/** Animate after hydration and when data changes. Respects reduced motion. */
|
|
17
|
-
animate?: boolean;
|
|
18
|
-
animationDuration?: number;
|
|
17
|
+
animate?: boolean | undefined;
|
|
18
|
+
animationDuration?: number | undefined;
|
|
19
19
|
}
|
|
20
20
|
declare function Sparkline({ data, variant, color, curve, strokeWidth, animate, animationDuration, className, ...props }: SparklineProps): React$1.JSX.Element;
|
|
21
21
|
//#endregion
|
|
@@ -9,41 +9,41 @@ type ActivityWithLevel = Activity & {
|
|
|
9
9
|
level: number;
|
|
10
10
|
};
|
|
11
11
|
export type Labels = {
|
|
12
|
-
months?: string[];
|
|
13
|
-
weekdays?: string[];
|
|
14
|
-
stat?: string;
|
|
15
|
-
cellLabel?: string;
|
|
16
|
-
heatmapLabel?: string;
|
|
17
|
-
legendLabel?: string;
|
|
18
|
-
legendLevelLabel?: string;
|
|
12
|
+
months?: string[] | undefined;
|
|
13
|
+
weekdays?: string[] | undefined;
|
|
14
|
+
stat?: string | undefined;
|
|
15
|
+
cellLabel?: string | undefined;
|
|
16
|
+
heatmapLabel?: string | undefined;
|
|
17
|
+
legendLabel?: string | undefined;
|
|
18
|
+
legendLevelLabel?: string | undefined;
|
|
19
19
|
};
|
|
20
20
|
export type ColorConfig = {
|
|
21
|
-
empty?: string;
|
|
22
|
-
scale?: string;
|
|
21
|
+
empty?: string | undefined;
|
|
22
|
+
scale?: string | undefined;
|
|
23
23
|
};
|
|
24
24
|
export type CalendarHeatmapProps = HTMLAttributes<HTMLDivElement> & {
|
|
25
25
|
data: Activity[];
|
|
26
|
-
weekStart?: Day;
|
|
27
|
-
continuousMonths?: boolean;
|
|
28
|
-
hasEmptyColumn?: boolean;
|
|
29
|
-
blockSize?: number;
|
|
30
|
-
blockMargin?: number;
|
|
31
|
-
blockRadius?: number;
|
|
32
|
-
blockAspectRatio?: number;
|
|
33
|
-
levels?: number;
|
|
34
|
-
isNormalized?: boolean;
|
|
26
|
+
weekStart?: Day | undefined;
|
|
27
|
+
continuousMonths?: boolean | undefined;
|
|
28
|
+
hasEmptyColumn?: boolean | undefined;
|
|
29
|
+
blockSize?: number | undefined;
|
|
30
|
+
blockMargin?: number | undefined;
|
|
31
|
+
blockRadius?: number | undefined;
|
|
32
|
+
blockAspectRatio?: number | undefined;
|
|
33
|
+
levels?: number | undefined;
|
|
34
|
+
isNormalized?: boolean | undefined;
|
|
35
35
|
/** Colour each day green or red by its sign, deeper the larger it is, for a daily gain or loss. */
|
|
36
|
-
signed?: boolean;
|
|
36
|
+
signed?: boolean | undefined;
|
|
37
37
|
/** With signed: the size that takes the deepest step. Defaults to the largest day's. */
|
|
38
|
-
range?: number;
|
|
39
|
-
colors?: ColorConfig;
|
|
40
|
-
locale?: Locale;
|
|
41
|
-
labels?: Labels;
|
|
42
|
-
fontSize?: number;
|
|
38
|
+
range?: number | undefined;
|
|
39
|
+
colors?: ColorConfig | undefined;
|
|
40
|
+
locale?: Locale | undefined;
|
|
41
|
+
labels?: Labels | undefined;
|
|
42
|
+
fontSize?: number | undefined;
|
|
43
43
|
emptyState?: ReactNode;
|
|
44
|
-
totalCount?: number;
|
|
45
|
-
style?: CSSProperties;
|
|
46
|
-
className?: string;
|
|
44
|
+
totalCount?: number | undefined;
|
|
45
|
+
style?: CSSProperties | undefined;
|
|
46
|
+
className?: string | undefined;
|
|
47
47
|
children: ReactNode;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -82,60 +82,60 @@ export type CalendarHeatmapProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
82
82
|
export declare const CalendarHeatmap: ({ data, weekStart, continuousMonths, hasEmptyColumn, blockSize: blockSizeProp, blockMargin, blockRadius, blockAspectRatio, levels: levelsProp, isNormalized, signed, range, colors, locale, labels: labelsProp, fontSize, emptyState, totalCount: totalCountProp, style, className, children, ...props }: CalendarHeatmapProps) => string | number | bigint | true | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
|
|
83
83
|
export type CalendarHeatmapBlockProps = HTMLAttributes<SVGRectElement> & {
|
|
84
84
|
/** The cell the page has picked: drawn with a ring and announced as pressed. */
|
|
85
|
-
selected?: boolean;
|
|
85
|
+
selected?: boolean | undefined;
|
|
86
86
|
activity: ActivityWithLevel;
|
|
87
87
|
dayIndex: number;
|
|
88
88
|
weekIndex: number;
|
|
89
|
-
highlighted?: boolean;
|
|
90
|
-
onCellClick?: (activity: ActivityWithLevel) => void;
|
|
91
|
-
onCellHover?: (activity: ActivityWithLevel | null) => void;
|
|
89
|
+
highlighted?: boolean | undefined;
|
|
90
|
+
onCellClick?: ((activity: ActivityWithLevel) => void) | undefined;
|
|
91
|
+
onCellHover?: ((activity: ActivityWithLevel | null) => void) | undefined;
|
|
92
92
|
};
|
|
93
93
|
export declare function CalendarHeatmapBlock({ ref, activity, dayIndex, weekIndex, highlighted, selected, onCellClick, onCellHover, onClick, onKeyDown, onMouseEnter, onMouseLeave, className, style: styleProp, ...props }: CalendarHeatmapBlockProps & {
|
|
94
|
-
ref?: React.RefObject<SVGRectElement | null
|
|
94
|
+
ref?: React.RefObject<SVGRectElement | null> | undefined;
|
|
95
95
|
}): import("react").JSX.Element;
|
|
96
96
|
export declare namespace CalendarHeatmapBlock {
|
|
97
97
|
var displayName: string;
|
|
98
98
|
}
|
|
99
99
|
export type CalendarHeatmapBodyProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
100
|
-
hideMonthLabels?: boolean;
|
|
101
|
-
hideWeekdayLabels?: boolean;
|
|
102
|
-
hideYearLabels?: boolean;
|
|
103
|
-
className?: string;
|
|
104
|
-
labelClassName?: string;
|
|
105
|
-
yearClassName?: string;
|
|
100
|
+
hideMonthLabels?: boolean | undefined;
|
|
101
|
+
hideWeekdayLabels?: boolean | undefined;
|
|
102
|
+
hideYearLabels?: boolean | undefined;
|
|
103
|
+
className?: string | undefined;
|
|
104
|
+
labelClassName?: string | undefined;
|
|
105
|
+
yearClassName?: string | undefined;
|
|
106
106
|
children: (props: {
|
|
107
107
|
activity: ActivityWithLevel;
|
|
108
108
|
dayIndex: number;
|
|
109
109
|
weekIndex: number;
|
|
110
110
|
}) => ReactNode;
|
|
111
|
-
renderYearFooter?: (props: {
|
|
111
|
+
renderYearFooter?: ((props: {
|
|
112
112
|
year: number;
|
|
113
113
|
totalCount: number;
|
|
114
|
-
}) => ReactNode;
|
|
114
|
+
}) => ReactNode) | undefined;
|
|
115
115
|
};
|
|
116
116
|
export declare const CalendarHeatmapBody: ({ hideMonthLabels, hideWeekdayLabels, hideYearLabels, className, labelClassName, yearClassName, children, renderYearFooter, ...props }: CalendarHeatmapBodyProps) => import("react").JSX.Element;
|
|
117
117
|
export type CalendarHeatmapFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
118
118
|
export declare const CalendarHeatmapFooter: ({ className, ...props }: CalendarHeatmapFooterProps) => import("react").JSX.Element;
|
|
119
119
|
export type CalendarHeatmapStatProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
120
|
-
compute?: (data: ActivityWithLevel[]) => number | string;
|
|
121
|
-
label?: string;
|
|
122
|
-
children?: (result: {
|
|
120
|
+
compute?: ((data: ActivityWithLevel[]) => number | string) | undefined;
|
|
121
|
+
label?: string | undefined;
|
|
122
|
+
children?: ((result: {
|
|
123
123
|
value: number | string;
|
|
124
124
|
data: ActivityWithLevel[];
|
|
125
125
|
year: number;
|
|
126
|
-
}) => ReactNode;
|
|
126
|
+
}) => ReactNode) | undefined;
|
|
127
127
|
};
|
|
128
128
|
export declare const CalendarHeatmapStat: ({ compute, label, className, children, ...props }: CalendarHeatmapStatProps) => import("react").JSX.Element;
|
|
129
129
|
export type CalendarHeatmapLegendProps = Omit<HTMLAttributes<HTMLFieldSetElement>, "children"> & {
|
|
130
130
|
labels?: {
|
|
131
|
-
less?: string;
|
|
132
|
-
more?: string;
|
|
133
|
-
};
|
|
131
|
+
less?: string | undefined;
|
|
132
|
+
more?: string | undefined;
|
|
133
|
+
} | undefined;
|
|
134
134
|
/** A signed heatmap's figures in the legend's scale line, such as useFormat().money. */
|
|
135
|
-
valueFormatter?: (value: number) => string;
|
|
136
|
-
children?: (props: {
|
|
135
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
136
|
+
children?: ((props: {
|
|
137
137
|
level: number;
|
|
138
|
-
}) => ReactNode;
|
|
138
|
+
}) => ReactNode) | undefined;
|
|
139
139
|
};
|
|
140
140
|
export declare const CalendarHeatmapLegend: ({ labels: labelsProp, valueFormatter, className, children, ...props }: CalendarHeatmapLegendProps) => import("react").JSX.Element;
|
|
141
141
|
//#endregion
|
|
@@ -226,7 +226,7 @@ const getMonthLabels = (weeks, monthNames = generateMonthLabels(), yearTicks = f
|
|
|
226
226
|
* @param levels - Total number of legend cells (including empty when not normalized). Default: 5
|
|
227
227
|
* @param isNormalized - When true, uses min-max normalization across the dataset (suitable for signed values). When false (default), treats 0 as empty and scales from 0 to max.
|
|
228
228
|
*/
|
|
229
|
-
const CalendarHeatmap = ({ data, weekStart = 0, continuousMonths = true, hasEmptyColumn = false, blockSize: blockSizeProp, blockMargin = 4, blockRadius =
|
|
229
|
+
const CalendarHeatmap = ({ data, weekStart = 0, continuousMonths = true, hasEmptyColumn = false, blockSize: blockSizeProp, blockMargin = 4, blockRadius = 0, blockAspectRatio = 1, levels: levelsProp = 5, isNormalized = false, signed = false, range, colors, locale, labels: labelsProp, fontSize = 14, emptyState, totalCount: totalCountProp, style = EMPTY_STYLE, className, children, ...props }) => {
|
|
230
230
|
const levels = Math.max(1, levelsProp);
|
|
231
231
|
const [rootRef, rootWidth] = useElementWidth();
|
|
232
232
|
const dataWithLevels = useMemo(() => {
|