@siyahi/ui 0.1.9-next.17 → 0.1.9-next.18
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 +77 -207
- package/agents/examples/accordion.tsx +39 -0
- package/agents/examples/alert.tsx +25 -0
- package/agents/examples/app-sidebar.tsx +38 -0
- package/agents/examples/avatar.tsx +14 -0
- package/agents/examples/badge.tsx +18 -0
- package/agents/examples/bar-list-labels.tsx +22 -0
- package/agents/examples/bar-list-sides.tsx +30 -0
- package/agents/examples/bar-list.tsx +24 -0
- package/agents/examples/breadcrumb.tsx +28 -0
- package/agents/examples/button.tsx +21 -0
- package/agents/examples/calendar.tsx +15 -0
- package/agents/examples/card.tsx +34 -0
- package/agents/examples/chart-area.tsx +38 -0
- package/agents/examples/chart-bar-flows.tsx +31 -0
- package/agents/examples/chart-bar-hourly.tsx +28 -0
- package/agents/examples/chart-bar-losses.tsx +29 -0
- package/agents/examples/chart-bar-sectors.tsx +70 -0
- package/agents/examples/chart-bar-years.tsx +40 -0
- package/agents/examples/chart-bar.tsx +56 -0
- package/agents/examples/chart-category-ticks.tsx +50 -0
- package/agents/examples/chart-line-events.tsx +47 -0
- package/agents/examples/chart-line-timeline.tsx +41 -0
- package/agents/examples/chart-line.tsx +57 -0
- package/agents/examples/code-block.tsx +38 -0
- package/agents/examples/collapsible.tsx +16 -0
- package/agents/examples/command.tsx +27 -0
- package/agents/examples/context-menu.tsx +15 -0
- package/agents/examples/copy-button.tsx +8 -0
- package/agents/examples/data-bar.tsx +121 -0
- package/agents/examples/data-table-filters.tsx +103 -0
- package/agents/examples/data-table.tsx +98 -0
- package/agents/examples/delta.tsx +13 -0
- package/agents/examples/dialog.tsx +28 -0
- package/agents/examples/distribution-bar-budget.tsx +30 -0
- package/agents/examples/distribution-bar-tug.tsx +72 -0
- package/agents/examples/dropdown-menu.tsx +31 -0
- package/agents/examples/formatters.tsx +42 -0
- package/agents/examples/heatmap-calendar.tsx +50 -0
- package/agents/examples/heatmap-status.tsx +51 -0
- package/agents/examples/heatmap-weekday.tsx +53 -0
- package/agents/examples/input.tsx +17 -0
- package/agents/examples/local-time.tsx +14 -0
- package/agents/examples/metric-strip.tsx +40 -0
- package/agents/examples/page-section.tsx +52 -0
- package/agents/examples/popover.tsx +23 -0
- package/agents/examples/price-chart.tsx +32 -0
- package/agents/examples/progress-tone.tsx +28 -0
- package/agents/examples/progress.tsx +10 -0
- package/agents/examples/scroll-area.tsx +20 -0
- package/agents/examples/section-cards-select.tsx +27 -0
- package/agents/examples/section-cards-trend.tsx +30 -0
- package/agents/examples/section-cards.tsx +48 -0
- package/agents/examples/select.tsx +27 -0
- package/agents/examples/separator.tsx +13 -0
- package/agents/examples/sheet.tsx +15 -0
- package/agents/examples/skeleton.tsx +11 -0
- package/agents/examples/slider.tsx +5 -0
- package/agents/examples/surfaces.tsx +115 -0
- package/agents/examples/table.tsx +50 -0
- package/agents/examples/tabs.tsx +16 -0
- package/agents/examples/toggle-group.tsx +12 -0
- package/agents/examples/toggle.tsx +11 -0
- package/agents/examples/tooltip.tsx +13 -0
- package/agents/examples/treemap.tsx +87 -0
- package/agents/manifest.json +931 -0
- package/agents/report-rules.json +7 -0
- package/dist/components/registry/charts/bar-chart-card.js +1 -0
- package/dist/components/registry/dashboardcn/bar-list.js +8 -7
- package/dist/components/registry/heatmap/calendar-heatmap.js +8 -1
- package/dist/components/registry/heatmap/status-heatmap.js +8 -1
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +6 -2
- package/dist/components/registry/heatmap/weekday-heatmap.js +56 -37
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +2 -0
- package/dist/components/registry/niko-table/core/data-table-context.js +21 -0
- package/dist/components/registry/niko-table/core/data-table-grouped-row.js +3 -1
- package/dist/components/registry/niko-table/core/data-table-structure.js +15 -12
- package/dist/components/registry/niko-table/core/data-table.d.ts +2 -2
- package/dist/components/registry/niko-table/core/data-table.js +5 -1
- package/dist/components/registry/niko-table/filters/table-search-filter.js +1 -1
- package/dist/components/registry/niko-table/lib/flex-columns.d.ts +1 -1
- package/dist/components/registry/niko-table/lib/flex-columns.js +3 -3
- package/dist/components/registry/niko-table/lib/styles.d.ts +1 -1
- package/dist/components/registry/niko-table/lib/styles.js +2 -2
- package/dist/components/registry/sidebar-07/nav-main.js +7 -1
- package/dist/components/siyahi/treemap.js +46 -4
- package/dist/lib/chart-frame.js +180 -124
- package/dist/lib/chart-series.d.ts +1 -1
- package/dist/lib/format.js +32 -13
- package/dist/lib/heatmap-navigation.d.ts +8 -0
- package/dist/lib/heatmap-navigation.js +49 -0
- package/package.json +3 -1
- package/styles/siyahi.css +24 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToggleGroup, ToggleGroupItem } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function ToggleGroupExample() {
|
|
4
|
+
return (
|
|
5
|
+
<ToggleGroup defaultValue={["1Y"]} variant="outline" size="sm" aria-label="Range">
|
|
6
|
+
<ToggleGroupItem value="1M">1M</ToggleGroupItem>
|
|
7
|
+
<ToggleGroupItem value="6M">6M</ToggleGroupItem>
|
|
8
|
+
<ToggleGroupItem value="1Y">1Y</ToggleGroupItem>
|
|
9
|
+
<ToggleGroupItem value="All">All</ToggleGroupItem>
|
|
10
|
+
</ToggleGroup>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@siyahi/ui";
|
|
2
|
+
import { InfoIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function TooltipExample() {
|
|
5
|
+
return (
|
|
6
|
+
<Tooltip>
|
|
7
|
+
<TooltipTrigger render={<Button variant="outline" size="icon" aria-label="About XIRR" />}>
|
|
8
|
+
<InfoIcon />
|
|
9
|
+
</TooltipTrigger>
|
|
10
|
+
<TooltipContent>XIRR weighs every cash flow by its date.</TooltipContent>
|
|
11
|
+
</Tooltip>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
Tooltip,
|
|
8
|
+
TooltipContent,
|
|
9
|
+
TooltipTrigger,
|
|
10
|
+
Treemap,
|
|
11
|
+
TreemapLegend,
|
|
12
|
+
useFormat,
|
|
13
|
+
type TreemapItem,
|
|
14
|
+
} from "@siyahi/ui";
|
|
15
|
+
import { useState } from "react";
|
|
16
|
+
|
|
17
|
+
interface Holding extends TreemapItem {
|
|
18
|
+
broker: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// change is the return since bought; LT came in as a transfer, with no cost basis.
|
|
22
|
+
const holdings: Holding[] = [
|
|
23
|
+
{ name: "INFY", key: "INFY-kite", broker: "Kite", group: "IT", weight: 224400, change: 0.38 },
|
|
24
|
+
{ name: "INFY", key: "INFY-dhan", broker: "Dhan", group: "IT", weight: 152000, change: 0.12 },
|
|
25
|
+
{ name: "TCS", broker: "Kite", group: "IT", weight: 166000, change: 0.09 },
|
|
26
|
+
{ name: "WIPRO", broker: "Dhan", group: "IT", weight: 98000, change: -0.21 },
|
|
27
|
+
{ name: "HDFCBANK", broker: "Kite", group: "Banks", weight: 262500, change: -0.06 },
|
|
28
|
+
{ name: "ICICIBANK", broker: "Kite", group: "Banks", weight: 258000, change: 0.44 },
|
|
29
|
+
{ name: "SBIN", broker: "Dhan", group: "Banks", weight: 87000, change: 0.58 },
|
|
30
|
+
{ name: "ITC", broker: "Kite", group: "FMCG", weight: 276000, change: 0.27 },
|
|
31
|
+
{ name: "ASIANPAINT", broker: "Dhan", group: "FMCG", weight: 64000, change: -0.33 },
|
|
32
|
+
{ name: "NIFTYBEES", broker: "Kite", group: "ETF", weight: 255600, change: 0.16 },
|
|
33
|
+
{ name: "LT", broker: "Dhan", group: "Construction", weight: 52000, change: null },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export default function TreemapExample() {
|
|
37
|
+
const [hovered, setHovered] = useState<Holding | null>(null);
|
|
38
|
+
const [selected, setSelected] = useState<Holding | null>(null);
|
|
39
|
+
const { money, pct } = useFormat();
|
|
40
|
+
const figures = (h: Holding) =>
|
|
41
|
+
`${money(h.weight)} · ${h.change === null ? "no cost basis" : `${h.change < 0 ? "▼" : "▲"} ${pct(Math.abs(h.change))}`}`;
|
|
42
|
+
return (
|
|
43
|
+
<Card>
|
|
44
|
+
<CardHeader>
|
|
45
|
+
<CardTitle>Holdings by sector</CardTitle>
|
|
46
|
+
<CardDescription>Area is the holding's value; colour is its return, deepest at ±60%</CardDescription>
|
|
47
|
+
</CardHeader>
|
|
48
|
+
<CardContent>
|
|
49
|
+
<Tooltip open={hovered !== null} trackCursorAxis="both">
|
|
50
|
+
<TooltipTrigger render={<div />}>
|
|
51
|
+
<Treemap
|
|
52
|
+
items={holdings}
|
|
53
|
+
height={320}
|
|
54
|
+
range={0.6}
|
|
55
|
+
onHover={setHovered}
|
|
56
|
+
selected={selected}
|
|
57
|
+
onSelect={setSelected}
|
|
58
|
+
/>
|
|
59
|
+
</TooltipTrigger>
|
|
60
|
+
<TooltipContent side="bottom" className="flex-col items-start gap-0 tabular-nums">
|
|
61
|
+
{hovered && (
|
|
62
|
+
<>
|
|
63
|
+
<span className="font-medium">
|
|
64
|
+
{hovered.name} · {hovered.broker}
|
|
65
|
+
</span>
|
|
66
|
+
<span>{figures(hovered)}</span>
|
|
67
|
+
</>
|
|
68
|
+
)}
|
|
69
|
+
</TooltipContent>
|
|
70
|
+
</Tooltip>
|
|
71
|
+
<TreemapLegend range={0.6} className="mt-3 ml-auto" />
|
|
72
|
+
<p data-slot="treemap-selection" aria-live="polite" className="mt-3 text-sm tabular-nums">
|
|
73
|
+
{selected ? (
|
|
74
|
+
<>
|
|
75
|
+
<span className="font-medium">
|
|
76
|
+
{selected.name} · {selected.broker}
|
|
77
|
+
</span>{" "}
|
|
78
|
+
· {figures(selected)}
|
|
79
|
+
</>
|
|
80
|
+
) : (
|
|
81
|
+
<span className="text-muted-foreground">Tap a tile for its figures</span>
|
|
82
|
+
)}
|
|
83
|
+
</p>
|
|
84
|
+
</CardContent>
|
|
85
|
+
</Card>
|
|
86
|
+
);
|
|
87
|
+
}
|