@siyahi/ui 0.1.9-next.20 → 0.1.9-next.22
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 +42 -0
- package/README.md +3 -3
- package/agents/examples/alert.tsx +4 -6
- package/agents/examples/app-sidebar.tsx +3 -1
- package/agents/examples/bar-list-sides.tsx +13 -3
- package/agents/examples/button-states.tsx +23 -0
- package/agents/examples/calendar.tsx +3 -7
- package/agents/examples/callout.tsx +33 -0
- package/agents/examples/card.tsx +3 -1
- package/agents/examples/change-bar.tsx +104 -0
- package/agents/examples/chart-area.tsx +5 -4
- package/agents/examples/chart-bar-flows.tsx +3 -2
- package/agents/examples/chart-bar-sectors.tsx +2 -0
- package/agents/examples/collapsible.tsx +2 -2
- package/agents/examples/command.tsx +22 -20
- package/agents/examples/context-menu.tsx +4 -2
- package/agents/examples/data-table-compact.tsx +95 -0
- package/agents/examples/distribution-bar-tug.tsx +24 -22
- package/agents/examples/heatmap-calendar.tsx +19 -7
- package/agents/examples/heatmap-status.tsx +19 -11
- package/agents/examples/heatmap-weekday.tsx +34 -15
- package/agents/examples/input-states.tsx +33 -0
- package/agents/examples/metric-strip.tsx +9 -3
- package/agents/examples/overview-dashboard.tsx +18 -0
- package/agents/examples/page-hero.tsx +38 -0
- package/agents/examples/price-chart.tsx +2 -2
- package/agents/examples/range-position-table.tsx +101 -0
- package/agents/examples/range-position.tsx +55 -0
- package/agents/examples/scroll-area.tsx +12 -10
- package/agents/examples/section-cards-select.tsx +8 -5
- package/agents/examples/surfaces.tsx +7 -4
- package/agents/examples/target-rows.tsx +72 -0
- package/agents/examples/treemap.tsx +13 -10
- package/agents/manifest.json +153 -3
- package/dist/components/registry/charts/area-chart-card.js +25 -7
- package/dist/components/registry/charts/bar-chart-card.d.ts +0 -1
- package/dist/components/registry/charts/bar-chart-card.js +15 -4
- package/dist/components/registry/charts/line-chart-card.js +2 -2
- package/dist/components/registry/dashboard-01/section-cards.js +1 -1
- package/dist/components/registry/dashboardcn/bar-list.js +11 -5
- package/dist/components/registry/dashboardcn/distribution-bar.js +5 -3
- package/dist/components/registry/dashboardcn/kpi-row-card.js +2 -2
- package/dist/components/registry/dashboardcn/sparkline.d.ts +5 -1
- package/dist/components/registry/dashboardcn/sparkline.js +40 -18
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +4 -2
- package/dist/components/registry/heatmap/calendar-heatmap.js +67 -33
- package/dist/components/registry/heatmap/status-heatmap.d.ts +5 -3
- package/dist/components/registry/heatmap/status-heatmap.js +31 -16
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +4 -2
- package/dist/components/registry/heatmap/weekday-heatmap.js +28 -12
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +16 -1
- package/dist/components/registry/niko-table/core/data-table-context.js +5 -20
- package/dist/components/registry/niko-table/core/data-table-root.js +39 -4
- package/dist/components/registry/niko-table/core/data-table-structure.js +2 -0
- package/dist/components/registry/niko-table/lib/styles.js +1 -1
- package/dist/components/registry/niko-table/types/index.d.ts +9 -0
- package/dist/components/registry/sidebar-07/nav-main.d.ts +1 -0
- package/dist/components/registry/sidebar-07/nav-main.js +9 -2
- package/dist/components/siyahi/callout.d.ts +24 -0
- package/dist/components/siyahi/callout.js +40 -0
- package/dist/components/siyahi/change-bar.d.ts +21 -0
- package/dist/components/siyahi/change-bar.js +35 -0
- package/dist/components/siyahi/data-table-compact-columns-toggle.d.ts +4 -0
- package/dist/components/siyahi/data-table-compact-columns-toggle.js +19 -0
- package/dist/components/siyahi/data-table-footnote.d.ts +12 -0
- package/dist/components/siyahi/data-table-footnote.js +35 -0
- package/dist/components/siyahi/default-sidebar-open.d.ts +8 -0
- package/dist/components/siyahi/default-sidebar-open.js +13 -0
- package/dist/components/siyahi/delta.d.ts +5 -1
- package/dist/components/siyahi/delta.js +14 -9
- package/dist/components/siyahi/page-hero.d.ts +25 -0
- package/dist/components/siyahi/page-hero.js +41 -0
- package/dist/components/siyahi/page-toc.d.ts +20 -0
- package/dist/components/siyahi/page-toc.js +76 -0
- package/dist/components/siyahi/quote.d.ts +12 -0
- package/dist/components/siyahi/quote.js +23 -0
- package/dist/components/siyahi/range-position.d.ts +24 -0
- package/dist/components/siyahi/range-position.js +105 -0
- package/dist/components/siyahi/siyahi-provider.d.ts +1 -1
- package/dist/components/siyahi/siyahi-provider.js +1 -1
- package/dist/components/siyahi/target-rows.d.ts +34 -0
- package/dist/components/siyahi/target-rows.js +97 -0
- package/dist/components/siyahi/treemap.d.ts +4 -1
- package/dist/components/siyahi/treemap.js +36 -28
- package/dist/components/siyahi/warning-alert.d.ts +10 -0
- package/dist/components/siyahi/warning-alert.js +20 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +12 -1
- package/dist/lib/chart-frame.d.ts +12 -2
- package/dist/lib/chart-frame.js +51 -7
- package/dist/lib/chart-series.d.ts +5 -2
- package/dist/lib/compact-columns.d.ts +19 -0
- package/dist/lib/compact-columns.js +55 -0
- package/dist/lib/format.d.ts +8 -3
- package/dist/lib/format.js +25 -6
- package/dist/lib/treemap.js +6 -1
- package/dist/lib/use-element-width.d.ts +5 -0
- package/dist/lib/use-element-width.js +15 -0
- package/package.json +2 -1
- package/report.css +37 -36
- package/styles/siyahi.css +243 -55
package/agents/manifest.json
CHANGED
|
@@ -108,6 +108,29 @@
|
|
|
108
108
|
"DataBar"
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
"need": "A table column of changes that should rank by eye, and a note on how to read the table",
|
|
113
|
+
"guidance": "`ChangeBar` in the column's cell, `diverging` when it holds both signs; `DataTableFootnote` after `DataTableBody`",
|
|
114
|
+
"components": [
|
|
115
|
+
"ChangeBar",
|
|
116
|
+
"DataTableFootnote",
|
|
117
|
+
"DataTableBody"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"need": "Figures against their targets, such as allocation against plan",
|
|
122
|
+
"guidance": "`TargetRows`, with neutral `bands` and a `status` per row",
|
|
123
|
+
"components": [
|
|
124
|
+
"TargetRows"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"need": "Where a value sits in its range, such as a price in its 52-week range",
|
|
129
|
+
"guidance": "`RangePosition`; `variant=\"compact\"` in a table cell",
|
|
130
|
+
"components": [
|
|
131
|
+
"RangePosition"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
111
134
|
{
|
|
112
135
|
"need": "One instrument's price history",
|
|
113
136
|
"guidance": "`PriceChart`",
|
|
@@ -283,7 +306,8 @@
|
|
|
283
306
|
"components": [
|
|
284
307
|
"Alert",
|
|
285
308
|
"AlertDescription",
|
|
286
|
-
"AlertTitle"
|
|
309
|
+
"AlertTitle",
|
|
310
|
+
"WarningAlert"
|
|
287
311
|
]
|
|
288
312
|
},
|
|
289
313
|
{
|
|
@@ -355,6 +379,13 @@
|
|
|
355
379
|
"BreadcrumbSeparator"
|
|
356
380
|
]
|
|
357
381
|
},
|
|
382
|
+
{
|
|
383
|
+
"file": "agents/examples/button-states.tsx",
|
|
384
|
+
"components": [
|
|
385
|
+
"Button",
|
|
386
|
+
"Toggle"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
358
389
|
{
|
|
359
390
|
"file": "agents/examples/button.tsx",
|
|
360
391
|
"components": [
|
|
@@ -367,6 +398,16 @@
|
|
|
367
398
|
"Calendar"
|
|
368
399
|
]
|
|
369
400
|
},
|
|
401
|
+
{
|
|
402
|
+
"file": "agents/examples/callout.tsx",
|
|
403
|
+
"components": [
|
|
404
|
+
"Callout",
|
|
405
|
+
"Quote",
|
|
406
|
+
"WarningAlert",
|
|
407
|
+
"AlertDescription",
|
|
408
|
+
"AlertTitle"
|
|
409
|
+
]
|
|
410
|
+
},
|
|
370
411
|
{
|
|
371
412
|
"file": "agents/examples/card.tsx",
|
|
372
413
|
"components": [
|
|
@@ -381,6 +422,26 @@
|
|
|
381
422
|
"useFormat"
|
|
382
423
|
]
|
|
383
424
|
},
|
|
425
|
+
{
|
|
426
|
+
"file": "agents/examples/change-bar.tsx",
|
|
427
|
+
"components": [
|
|
428
|
+
"Card",
|
|
429
|
+
"CardContent",
|
|
430
|
+
"CardDescription",
|
|
431
|
+
"CardHeader",
|
|
432
|
+
"CardTitle",
|
|
433
|
+
"ChangeBar",
|
|
434
|
+
"DataTable",
|
|
435
|
+
"DataTableBody",
|
|
436
|
+
"DataTableCompactColumnsToggle",
|
|
437
|
+
"DataTableFootnote",
|
|
438
|
+
"DataTableHeader",
|
|
439
|
+
"DataTableRoot",
|
|
440
|
+
"DataTableSortHeader",
|
|
441
|
+
"DataTableToolbarSection",
|
|
442
|
+
"useFormat"
|
|
443
|
+
]
|
|
444
|
+
},
|
|
384
445
|
{
|
|
385
446
|
"file": "agents/examples/chart-area.tsx",
|
|
386
447
|
"components": [
|
|
@@ -528,6 +589,27 @@
|
|
|
528
589
|
"useFormat"
|
|
529
590
|
]
|
|
530
591
|
},
|
|
592
|
+
{
|
|
593
|
+
"file": "agents/examples/data-table-compact.tsx",
|
|
594
|
+
"components": [
|
|
595
|
+
"Card",
|
|
596
|
+
"CardContent",
|
|
597
|
+
"CardDescription",
|
|
598
|
+
"CardHeader",
|
|
599
|
+
"CardTitle",
|
|
600
|
+
"DataTable",
|
|
601
|
+
"DataTableBody",
|
|
602
|
+
"DataTableCompactColumnsToggle",
|
|
603
|
+
"DataTableHeader",
|
|
604
|
+
"DataTableRoot",
|
|
605
|
+
"DataTableRowCount",
|
|
606
|
+
"DataTableSortHeader",
|
|
607
|
+
"DataTableToolbarSection",
|
|
608
|
+
"Delta",
|
|
609
|
+
"useDataTable",
|
|
610
|
+
"useFormat"
|
|
611
|
+
]
|
|
612
|
+
},
|
|
531
613
|
{
|
|
532
614
|
"file": "agents/examples/data-table-filters.tsx",
|
|
533
615
|
"components": [
|
|
@@ -654,6 +736,8 @@
|
|
|
654
736
|
"CalendarHeatmap",
|
|
655
737
|
"CalendarHeatmapBlock",
|
|
656
738
|
"CalendarHeatmapBody",
|
|
739
|
+
"CalendarHeatmapFooter",
|
|
740
|
+
"CalendarHeatmapLegend",
|
|
657
741
|
"useFormat",
|
|
658
742
|
"Card",
|
|
659
743
|
"CardContent",
|
|
@@ -672,7 +756,9 @@
|
|
|
672
756
|
"CardTitle",
|
|
673
757
|
"StatusHeatmap",
|
|
674
758
|
"StatusHeatmapBlock",
|
|
675
|
-
"StatusHeatmapBody"
|
|
759
|
+
"StatusHeatmapBody",
|
|
760
|
+
"StatusHeatmapFooter",
|
|
761
|
+
"StatusHeatmapLegend"
|
|
676
762
|
]
|
|
677
763
|
},
|
|
678
764
|
{
|
|
@@ -686,7 +772,14 @@
|
|
|
686
772
|
"CardTitle",
|
|
687
773
|
"WeekdayHeatmap",
|
|
688
774
|
"WeekdayHeatmapBlock",
|
|
689
|
-
"WeekdayHeatmapBody"
|
|
775
|
+
"WeekdayHeatmapBody",
|
|
776
|
+
"WeekdayHeatmapLegend"
|
|
777
|
+
]
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"file": "agents/examples/input-states.tsx",
|
|
781
|
+
"components": [
|
|
782
|
+
"Input"
|
|
690
783
|
]
|
|
691
784
|
},
|
|
692
785
|
{
|
|
@@ -714,6 +807,17 @@
|
|
|
714
807
|
"useFormat"
|
|
715
808
|
]
|
|
716
809
|
},
|
|
810
|
+
{
|
|
811
|
+
"file": "agents/examples/overview-dashboard.tsx",
|
|
812
|
+
"components": []
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"file": "agents/examples/page-hero.tsx",
|
|
816
|
+
"components": [
|
|
817
|
+
"Button",
|
|
818
|
+
"PageHero"
|
|
819
|
+
]
|
|
820
|
+
},
|
|
717
821
|
{
|
|
718
822
|
"file": "agents/examples/page-section.tsx",
|
|
719
823
|
"components": [
|
|
@@ -768,6 +872,39 @@
|
|
|
768
872
|
"ProgressValue"
|
|
769
873
|
]
|
|
770
874
|
},
|
|
875
|
+
{
|
|
876
|
+
"file": "agents/examples/range-position-table.tsx",
|
|
877
|
+
"components": [
|
|
878
|
+
"Card",
|
|
879
|
+
"CardContent",
|
|
880
|
+
"CardDescription",
|
|
881
|
+
"CardHeader",
|
|
882
|
+
"CardTitle",
|
|
883
|
+
"DataTable",
|
|
884
|
+
"DataTableBody",
|
|
885
|
+
"DataTableCompactColumnsToggle",
|
|
886
|
+
"DataTableHeader",
|
|
887
|
+
"DataTableRoot",
|
|
888
|
+
"DataTableSortHeader",
|
|
889
|
+
"DataTableToolbarSection",
|
|
890
|
+
"RangePosition",
|
|
891
|
+
"useFormat"
|
|
892
|
+
]
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"file": "agents/examples/range-position.tsx",
|
|
896
|
+
"components": [
|
|
897
|
+
"Card",
|
|
898
|
+
"CardContent",
|
|
899
|
+
"CardDescription",
|
|
900
|
+
"CardHeader",
|
|
901
|
+
"CardTitle",
|
|
902
|
+
"DataList",
|
|
903
|
+
"DataListItem",
|
|
904
|
+
"RangePosition",
|
|
905
|
+
"useFormat"
|
|
906
|
+
]
|
|
907
|
+
},
|
|
771
908
|
{
|
|
772
909
|
"file": "agents/examples/scroll-area.tsx",
|
|
773
910
|
"components": [
|
|
@@ -780,6 +917,7 @@
|
|
|
780
917
|
"components": [
|
|
781
918
|
"Delta",
|
|
782
919
|
"SectionCards",
|
|
920
|
+
"SiyahiProvider",
|
|
783
921
|
"useFormat"
|
|
784
922
|
]
|
|
785
923
|
},
|
|
@@ -889,6 +1027,18 @@
|
|
|
889
1027
|
"TabsTrigger"
|
|
890
1028
|
]
|
|
891
1029
|
},
|
|
1030
|
+
{
|
|
1031
|
+
"file": "agents/examples/target-rows.tsx",
|
|
1032
|
+
"components": [
|
|
1033
|
+
"Card",
|
|
1034
|
+
"CardContent",
|
|
1035
|
+
"CardDescription",
|
|
1036
|
+
"CardHeader",
|
|
1037
|
+
"CardTitle",
|
|
1038
|
+
"TargetRows",
|
|
1039
|
+
"useFormat"
|
|
1040
|
+
]
|
|
1041
|
+
},
|
|
892
1042
|
{
|
|
893
1043
|
"file": "agents/examples/toggle-group.tsx",
|
|
894
1044
|
"components": [
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ChartFrame } from "../../../lib/chart-frame.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ChartFrame, endDot } from "../../../lib/chart-frame.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId } from "react";
|
|
4
5
|
import { Area, AreaChart } from "recharts";
|
|
5
6
|
//#region src/components/registry/charts/area-chart-card.tsx
|
|
6
7
|
/** Values over an ordered axis as filled areas: one series, or several overlapping or stacked. */
|
|
7
8
|
function AreaChartCard({ stacked = false, curve = "monotone", ...props }) {
|
|
8
|
-
|
|
9
|
+
const id = useId();
|
|
10
|
+
return /* @__PURE__ */ jsxs(ChartFrame, {
|
|
9
11
|
chart: AreaChart,
|
|
10
12
|
...props,
|
|
11
|
-
children: props.series.map(({ key, color }) => /* @__PURE__ */
|
|
13
|
+
children: [/* @__PURE__ */ jsx("defs", { children: props.series.map(({ key, color }, index) => /* @__PURE__ */ jsxs("linearGradient", {
|
|
14
|
+
id: `${id}-${index}`,
|
|
15
|
+
x1: "0",
|
|
16
|
+
y1: "0",
|
|
17
|
+
x2: "0",
|
|
18
|
+
y2: "1",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
20
|
+
offset: "0%",
|
|
21
|
+
stopColor: color,
|
|
22
|
+
stopOpacity: stacked ? .5 : .32
|
|
23
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
24
|
+
offset: "100%",
|
|
25
|
+
stopColor: color,
|
|
26
|
+
stopOpacity: stacked ? .15 : .02
|
|
27
|
+
})]
|
|
28
|
+
}, key)) }), props.series.map(({ key, color }, index) => /* @__PURE__ */ jsx(Area, {
|
|
12
29
|
dataKey: key,
|
|
13
30
|
type: curve,
|
|
14
|
-
fill:
|
|
15
|
-
fillOpacity: stacked ? .4 : .2,
|
|
31
|
+
fill: stacked || index === 0 ? `url(#${id}-${index})` : "none",
|
|
16
32
|
stroke: color,
|
|
33
|
+
strokeWidth: 2,
|
|
34
|
+
dot: endDot(color, props.data.length),
|
|
17
35
|
stackId: stacked ? "stack" : void 0
|
|
18
|
-
}, key))
|
|
36
|
+
}, key))]
|
|
19
37
|
});
|
|
20
38
|
}
|
|
21
39
|
//#endregion
|
|
@@ -10,6 +10,5 @@ export interface BarChartCardProps<T extends object, K extends keyof T> extends
|
|
|
10
10
|
/** Called with a clicked category's x value, or null when the picked one is clicked again. */
|
|
11
11
|
onSelect?: (value: T[K] | null) => void;
|
|
12
12
|
}
|
|
13
|
-
/** Values over an ordered axis as bars: one series, or several grouped or stacked. */
|
|
14
13
|
export declare function BarChartCard<T extends object, K extends keyof T>({ stacked, selected, onSelect, ...props }: BarChartCardProps<T, K>): import("react").JSX.Element;
|
|
15
14
|
//#endregion
|
|
@@ -5,6 +5,8 @@ import { Bar, BarChart, Cell } from "recharts";
|
|
|
5
5
|
//#region src/components/registry/charts/bar-chart-card.tsx
|
|
6
6
|
const DOWN_FROM_ZERO = ["auto", 0];
|
|
7
7
|
/** Values over an ordered axis as bars: one series, or several grouped or stacked. */
|
|
8
|
+
const dimUnselected = (color, isSelected) => isSelected ? color : `color-mix(in oklab, ${color} 55%, var(--card))`;
|
|
9
|
+
const signedFill = (color, isSelected) => `color-mix(in oklab, ${color} ${isSelected ? 35 : 15}%, var(--card))`;
|
|
8
10
|
function BarChartCard({ stacked = false, selected = null, onSelect, ...props }) {
|
|
9
11
|
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
10
12
|
chart: BarChart,
|
|
@@ -35,10 +37,19 @@ function BarChartCard({ stacked = false, selected = null, onSelect, ...props })
|
|
|
35
37
|
0,
|
|
36
38
|
0
|
|
37
39
|
] : 0,
|
|
38
|
-
children: (negativeColor || selected !== null) && props.data.map((row, i) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
children: (negativeColor || selected !== null) && props.data.map((row, i) => {
|
|
41
|
+
const isSelected = selected === null || row[props.xKey] === selected;
|
|
42
|
+
const tone = negativeColor && Number(row[key]) < 0 ? negativeColor : color;
|
|
43
|
+
return negativeColor ? /* @__PURE__ */ jsx(Cell, {
|
|
44
|
+
fill: signedFill(tone, isSelected),
|
|
45
|
+
stroke: tone,
|
|
46
|
+
strokeWidth: 1.5
|
|
47
|
+
}, i) : /* @__PURE__ */ jsx(Cell, {
|
|
48
|
+
fill: dimUnselected(tone, isSelected),
|
|
49
|
+
stroke: tone,
|
|
50
|
+
strokeWidth: 1.5
|
|
51
|
+
}, i);
|
|
52
|
+
})
|
|
42
53
|
}, key);
|
|
43
54
|
})
|
|
44
55
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ChartFrame } from "../../../lib/chart-frame.js";
|
|
2
|
+
import { ChartFrame, endDot } from "../../../lib/chart-frame.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Line, LineChart } from "recharts";
|
|
5
5
|
//#region src/components/registry/charts/line-chart-card.tsx
|
|
@@ -13,7 +13,7 @@ function LineChartCard({ curve = "monotone", ...props }) {
|
|
|
13
13
|
type: curve,
|
|
14
14
|
stroke: color,
|
|
15
15
|
strokeWidth: 2,
|
|
16
|
-
dot:
|
|
16
|
+
dot: endDot(color, props.data.length)
|
|
17
17
|
}, key))
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -31,7 +31,7 @@ function SectionCards({ items, selected, onSelect }) {
|
|
|
31
31
|
"aria-pressed": item.label === selected,
|
|
32
32
|
disabled: item.disabled,
|
|
33
33
|
onClick: () => onSelect(item.label),
|
|
34
|
-
className: "absolute inset-0 z-10 rounded-[inherit] outline-none focus-visible:ring-3 focus-visible:ring-ring
|
|
34
|
+
className: "absolute inset-0 z-10 rounded-[inherit] outline-none focus-visible:ring-3 focus-visible:ring-ring focus-visible:ring-inset"
|
|
35
35
|
}),
|
|
36
36
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
37
37
|
/* @__PURE__ */ jsx(CardDescription, { children: item.label }),
|
|
@@ -20,7 +20,7 @@ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(
|
|
|
20
20
|
const total = items.reduce((sum, item) => sum + item.value, 0);
|
|
21
21
|
return /* @__PURE__ */ jsx("div", {
|
|
22
22
|
"data-slot": "bar-list",
|
|
23
|
-
className: cn("@container/bar-list
|
|
23
|
+
className: cn("@container/bar-list grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1.5", className),
|
|
24
24
|
...props,
|
|
25
25
|
children: items.map((item) => {
|
|
26
26
|
const width = max > 0 ? item.value / max * 100 : 0;
|
|
@@ -29,16 +29,22 @@ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(
|
|
|
29
29
|
const Label = item.href ? "a" : onItemClick ? "button" : "div";
|
|
30
30
|
return /* @__PURE__ */ jsxs("div", {
|
|
31
31
|
"data-slot": "bar-list-row",
|
|
32
|
-
className: "
|
|
32
|
+
className: "col-span-2 grid grid-cols-subgrid items-center text-sm @max-sm/bar-list:items-start",
|
|
33
33
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
34
34
|
className: "relative flex h-8 min-w-0 flex-1 items-center @max-sm/bar-list:h-auto @max-sm/bar-list:min-h-8 @max-sm/bar-list:items-start @max-sm/bar-list:pb-3",
|
|
35
35
|
children: [
|
|
36
36
|
/* @__PURE__ */ jsx("div", {
|
|
37
|
+
"data-slot": "bar-list-track",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
className: "bg-muted/60 absolute inset-0 rounded-md @max-sm/bar-list:inset-y-auto @max-sm/bar-list:bottom-0 @max-sm/bar-list:h-1.5"
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "bar-list-bar",
|
|
37
43
|
"aria-hidden": "true",
|
|
38
44
|
className: "absolute inset-y-0 left-0 rounded-md transition-[width] duration-300 @max-sm/bar-list:inset-y-auto @max-sm/bar-list:bottom-0 @max-sm/bar-list:h-1.5",
|
|
39
45
|
style: {
|
|
40
46
|
width: `${width}%`,
|
|
41
|
-
backgroundColor: `color-mix(in oklab, ${color}
|
|
47
|
+
backgroundColor: item.detail ? "color-mix(in oklab, var(--muted-foreground) 20%, transparent)" : `color-mix(in oklab, ${color} 32%, transparent)`
|
|
42
48
|
}
|
|
43
49
|
}),
|
|
44
50
|
/* @__PURE__ */ jsxs(Label, {
|
|
@@ -47,7 +53,7 @@ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(
|
|
|
47
53
|
type: "button",
|
|
48
54
|
onClick: () => onItemClick(item)
|
|
49
55
|
} : {},
|
|
50
|
-
className: cn("relative flex min-w-0 items-center gap-2 px-2 text-left", interactive && "hover:underline"),
|
|
56
|
+
className: cn("text-foreground relative flex min-w-0 items-center gap-2 px-2 text-left", interactive && "hover:underline"),
|
|
51
57
|
children: [item.icon ? /* @__PURE__ */ jsx("span", {
|
|
52
58
|
className: "text-muted-foreground shrink-0 [&>svg]:size-4",
|
|
53
59
|
children: item.icon
|
|
@@ -63,7 +69,7 @@ function BarList({ data, valueFormatter, sortOrder = "descending", color = "var(
|
|
|
63
69
|
}) : null
|
|
64
70
|
]
|
|
65
71
|
}), /* @__PURE__ */ jsxs("div", {
|
|
66
|
-
className: "flex
|
|
72
|
+
className: "flex items-center justify-end gap-2 tabular-nums",
|
|
67
73
|
children: [/* @__PURE__ */ jsx("span", {
|
|
68
74
|
className: "font-medium",
|
|
69
75
|
children: format(item.value)
|
|
@@ -66,12 +66,14 @@ function DistributionBar({ segments, valueFormatter, showLegend = true, showValu
|
|
|
66
66
|
onMouseLeave: onHover ? () => onHover(null) : void 0,
|
|
67
67
|
children: resolved.map((segment) => segment.width > 0 ? /* @__PURE__ */ jsx("div", {
|
|
68
68
|
"data-slot": "distribution-segment",
|
|
69
|
-
className: "border-card absolute inset-y-0 border-x transition-[width,left,
|
|
69
|
+
className: "border-card absolute inset-y-0 border-x transition-[width,left,background-color] duration-300",
|
|
70
70
|
style: {
|
|
71
71
|
left: `${segment.left}%`,
|
|
72
72
|
width: `${segment.width}%`,
|
|
73
|
-
backgroundColor: segment.color
|
|
74
|
-
|
|
73
|
+
...highlighted === null || highlighted === segment.key ? { backgroundColor: segment.color } : {
|
|
74
|
+
backgroundColor: `color-mix(in oklab, ${segment.color} 35%, var(--card))`,
|
|
75
|
+
boxShadow: `inset 0 0 0 1px ${segment.color}`
|
|
76
|
+
}
|
|
75
77
|
},
|
|
76
78
|
onMouseEnter: onHover ? () => onHover(segment) : void 0
|
|
77
79
|
}, segment.key) : null)
|
|
@@ -39,7 +39,7 @@ function MetricStrip({ title, description, action, items, footer, className, ...
|
|
|
39
39
|
className: "-mt-px -ml-px flex flex-wrap",
|
|
40
40
|
children: items.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
41
41
|
"data-slot": "metric-strip-item",
|
|
42
|
-
className: cn("flex min-w-0 flex-col gap-1 border-t border-l px-4 py-
|
|
42
|
+
className: cn("flex min-w-0 flex-col gap-1.5 border-t border-l px-4 py-4", columns),
|
|
43
43
|
children: [/* @__PURE__ */ jsx("div", {
|
|
44
44
|
className: "truncate text-xs text-muted-foreground",
|
|
45
45
|
children: item.label
|
|
@@ -64,7 +64,7 @@ function MetricStrip({ title, description, action, items, footer, className, ...
|
|
|
64
64
|
data: item.trend,
|
|
65
65
|
variant: "line",
|
|
66
66
|
color: trendColor(item.change),
|
|
67
|
-
className: "h-
|
|
67
|
+
className: "h-9 w-20 shrink-0"
|
|
68
68
|
})]
|
|
69
69
|
})]
|
|
70
70
|
}, item.label))
|
|
@@ -5,9 +5,13 @@ export interface SparklineProps extends React$1.ComponentProps<"div"> {
|
|
|
5
5
|
/** Series to plot, oldest first. */
|
|
6
6
|
data: number[];
|
|
7
7
|
variant?: "area" | "line";
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
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
|
+
* a loss. Defaults to var(--chart-1). The run before it is muted.
|
|
11
|
+
*/
|
|
9
12
|
color?: ChartColor;
|
|
10
13
|
curve?: "monotone" | "linear" | "step";
|
|
14
|
+
/** The run's line; the last step is 2px. */
|
|
11
15
|
strokeWidth?: number;
|
|
12
16
|
/** Animate after hydration and when data changes. Respects reduced motion. */
|
|
13
17
|
animate?: boolean;
|
|
@@ -15,24 +15,41 @@ function getReducedMotionSnapshot() {
|
|
|
15
15
|
function getReducedMotionServerSnapshot() {
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
|
-
function Sparkline({ data, variant = "area", color = "var(--chart-1)", curve = "
|
|
18
|
+
function Sparkline({ data, variant = "area", color = "var(--chart-1)", curve = "linear", strokeWidth = 1.25, animate = true, animationDuration = 500, className, ...props }) {
|
|
19
19
|
const id = React$1.useId();
|
|
20
20
|
const reducedMotion = React$1.useSyncExternalStore(subscribeToReducedMotion, getReducedMotionSnapshot, getReducedMotionServerSnapshot);
|
|
21
21
|
const animationActive = animate && !reducedMotion;
|
|
22
22
|
const points = React$1.useMemo(() => data.map((y, i) => ({
|
|
23
23
|
i,
|
|
24
|
-
y
|
|
24
|
+
y,
|
|
25
|
+
now: i >= data.length - 2 ? y : void 0
|
|
25
26
|
})), [data]);
|
|
26
27
|
const margin = {
|
|
27
|
-
top:
|
|
28
|
-
right:
|
|
29
|
-
bottom:
|
|
28
|
+
top: 3,
|
|
29
|
+
right: 3,
|
|
30
|
+
bottom: 3,
|
|
30
31
|
left: 0
|
|
31
32
|
};
|
|
32
33
|
const axis = /* @__PURE__ */ jsx(YAxis, {
|
|
33
34
|
hide: true,
|
|
34
35
|
domain: ["dataMin", "dataMax"]
|
|
35
36
|
});
|
|
37
|
+
const now = /* @__PURE__ */ jsx(Line, {
|
|
38
|
+
className: "sparkline-now",
|
|
39
|
+
type: curve,
|
|
40
|
+
dataKey: "now",
|
|
41
|
+
stroke: color,
|
|
42
|
+
strokeWidth: 2,
|
|
43
|
+
dot: (dot) => dot.index === data.length - 1 ? /* @__PURE__ */ jsx("circle", {
|
|
44
|
+
cx: dot.cx,
|
|
45
|
+
cy: dot.cy,
|
|
46
|
+
r: 3,
|
|
47
|
+
fill: color
|
|
48
|
+
}, "now") : /* @__PURE__ */ jsx("g", {}, dot.index),
|
|
49
|
+
isAnimationActive: animationActive,
|
|
50
|
+
animationBegin: animationDuration,
|
|
51
|
+
animationDuration: 150
|
|
52
|
+
});
|
|
36
53
|
return /* @__PURE__ */ jsx("div", {
|
|
37
54
|
"data-slot": "sparkline",
|
|
38
55
|
"aria-hidden": "true",
|
|
@@ -44,16 +61,20 @@ function Sparkline({ data, variant = "area", color = "var(--chart-1)", curve = "
|
|
|
44
61
|
children: variant === "line" ? /* @__PURE__ */ jsxs(LineChart, {
|
|
45
62
|
data: points,
|
|
46
63
|
margin,
|
|
47
|
-
children: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
children: [
|
|
65
|
+
axis,
|
|
66
|
+
/* @__PURE__ */ jsx(Line, {
|
|
67
|
+
type: curve,
|
|
68
|
+
dataKey: "y",
|
|
69
|
+
stroke: "var(--muted-foreground)",
|
|
70
|
+
strokeWidth,
|
|
71
|
+
dot: false,
|
|
72
|
+
isAnimationActive: animationActive,
|
|
73
|
+
animationDuration,
|
|
74
|
+
animationEasing: "ease-out"
|
|
75
|
+
}),
|
|
76
|
+
now
|
|
77
|
+
]
|
|
57
78
|
}) : /* @__PURE__ */ jsxs(AreaChart, {
|
|
58
79
|
data: points,
|
|
59
80
|
margin,
|
|
@@ -68,7 +89,7 @@ function Sparkline({ data, variant = "area", color = "var(--chart-1)", curve = "
|
|
|
68
89
|
children: [/* @__PURE__ */ jsx("stop", {
|
|
69
90
|
offset: "0%",
|
|
70
91
|
stopColor: color,
|
|
71
|
-
stopOpacity: .
|
|
92
|
+
stopOpacity: .18
|
|
72
93
|
}), /* @__PURE__ */ jsx("stop", {
|
|
73
94
|
offset: "100%",
|
|
74
95
|
stopColor: color,
|
|
@@ -78,14 +99,15 @@ function Sparkline({ data, variant = "area", color = "var(--chart-1)", curve = "
|
|
|
78
99
|
/* @__PURE__ */ jsx(Area, {
|
|
79
100
|
type: curve,
|
|
80
101
|
dataKey: "y",
|
|
81
|
-
stroke:
|
|
102
|
+
stroke: "var(--muted-foreground)",
|
|
82
103
|
strokeWidth,
|
|
83
104
|
fill: `url(#${id})`,
|
|
84
105
|
dot: false,
|
|
85
106
|
isAnimationActive: animationActive,
|
|
86
107
|
animationDuration,
|
|
87
108
|
animationEasing: "ease-out"
|
|
88
|
-
})
|
|
109
|
+
}),
|
|
110
|
+
now
|
|
89
111
|
]
|
|
90
112
|
})
|
|
91
113
|
})
|
|
@@ -75,8 +75,10 @@ export type CalendarHeatmapProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
75
75
|
* @param levels - Total number of legend cells (including empty when not normalized). Default: 5
|
|
76
76
|
* @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.
|
|
77
77
|
*/
|
|
78
|
-
export declare const CalendarHeatmap: ({ data, weekStart, continuousMonths, hasEmptyColumn, blockSize, blockMargin, blockRadius, blockAspectRatio, levels: levelsProp, isNormalized, 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;
|
|
78
|
+
export declare const CalendarHeatmap: ({ data, weekStart, continuousMonths, hasEmptyColumn, blockSize: blockSizeProp, blockMargin, blockRadius, blockAspectRatio, levels: levelsProp, isNormalized, 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;
|
|
79
79
|
export type CalendarHeatmapBlockProps = HTMLAttributes<SVGRectElement> & {
|
|
80
|
+
/** The cell the page has picked: drawn with a ring and announced as pressed. */
|
|
81
|
+
selected?: boolean;
|
|
80
82
|
activity: ActivityWithLevel;
|
|
81
83
|
dayIndex: number;
|
|
82
84
|
weekIndex: number;
|
|
@@ -84,7 +86,7 @@ export type CalendarHeatmapBlockProps = HTMLAttributes<SVGRectElement> & {
|
|
|
84
86
|
onCellClick?: (activity: ActivityWithLevel) => void;
|
|
85
87
|
onCellHover?: (activity: ActivityWithLevel | null) => void;
|
|
86
88
|
};
|
|
87
|
-
export declare function CalendarHeatmapBlock({ ref, activity, dayIndex, weekIndex, highlighted, onCellClick, onCellHover, onClick, onKeyDown, onMouseEnter, onMouseLeave, className, style: styleProp, ...props }: CalendarHeatmapBlockProps & {
|
|
89
|
+
export declare function CalendarHeatmapBlock({ ref, activity, dayIndex, weekIndex, highlighted, selected, onCellClick, onCellHover, onClick, onKeyDown, onMouseEnter, onMouseLeave, className, style: styleProp, ...props }: CalendarHeatmapBlockProps & {
|
|
88
90
|
ref?: React.RefObject<SVGRectElement | null>;
|
|
89
91
|
}): import("react").JSX.Element;
|
|
90
92
|
export declare namespace CalendarHeatmapBlock {
|