@siyahi/ui 0.1.9-next.2 → 0.1.9-next.20

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.
Files changed (149) hide show
  1. package/README.md +82 -176
  2. package/THIRD_PARTY_NOTICES.md +11 -11
  3. package/agents/examples/accordion.tsx +39 -0
  4. package/agents/examples/alert.tsx +25 -0
  5. package/agents/examples/app-sidebar.tsx +38 -0
  6. package/agents/examples/avatar.tsx +14 -0
  7. package/agents/examples/badge.tsx +18 -0
  8. package/agents/examples/bar-list-labels.tsx +22 -0
  9. package/agents/examples/bar-list-sides.tsx +30 -0
  10. package/agents/examples/bar-list.tsx +24 -0
  11. package/agents/examples/breadcrumb.tsx +28 -0
  12. package/agents/examples/button.tsx +21 -0
  13. package/agents/examples/calendar.tsx +15 -0
  14. package/agents/examples/card.tsx +34 -0
  15. package/agents/examples/chart-area.tsx +38 -0
  16. package/agents/examples/chart-bar-flows.tsx +31 -0
  17. package/agents/examples/chart-bar-hourly.tsx +28 -0
  18. package/agents/examples/chart-bar-losses.tsx +29 -0
  19. package/agents/examples/chart-bar-sectors.tsx +70 -0
  20. package/agents/examples/chart-bar-years.tsx +40 -0
  21. package/agents/examples/chart-bar.tsx +56 -0
  22. package/agents/examples/chart-category-ticks.tsx +50 -0
  23. package/agents/examples/chart-line-events.tsx +47 -0
  24. package/agents/examples/chart-line-timeline.tsx +41 -0
  25. package/agents/examples/chart-line.tsx +57 -0
  26. package/agents/examples/code-block.tsx +38 -0
  27. package/agents/examples/collapsible.tsx +16 -0
  28. package/agents/examples/command.tsx +27 -0
  29. package/agents/examples/context-menu.tsx +15 -0
  30. package/agents/examples/copy-button.tsx +8 -0
  31. package/agents/examples/data-bar.tsx +121 -0
  32. package/agents/examples/data-table-filters.tsx +103 -0
  33. package/agents/examples/data-table.tsx +98 -0
  34. package/agents/examples/delta.tsx +13 -0
  35. package/agents/examples/dialog.tsx +28 -0
  36. package/agents/examples/distribution-bar-budget.tsx +30 -0
  37. package/agents/examples/distribution-bar-tug.tsx +72 -0
  38. package/agents/examples/dropdown-menu.tsx +31 -0
  39. package/agents/examples/formatters.tsx +42 -0
  40. package/agents/examples/heatmap-calendar.tsx +50 -0
  41. package/agents/examples/heatmap-status.tsx +51 -0
  42. package/agents/examples/heatmap-weekday.tsx +53 -0
  43. package/agents/examples/input.tsx +17 -0
  44. package/agents/examples/local-time.tsx +14 -0
  45. package/agents/examples/metric-strip.tsx +40 -0
  46. package/agents/examples/page-section.tsx +52 -0
  47. package/agents/examples/popover.tsx +23 -0
  48. package/agents/examples/price-chart.tsx +32 -0
  49. package/agents/examples/progress-tone.tsx +28 -0
  50. package/agents/examples/progress.tsx +10 -0
  51. package/agents/examples/scroll-area.tsx +20 -0
  52. package/agents/examples/section-cards-select.tsx +27 -0
  53. package/agents/examples/section-cards-trend.tsx +30 -0
  54. package/agents/examples/section-cards.tsx +48 -0
  55. package/agents/examples/select.tsx +27 -0
  56. package/agents/examples/separator.tsx +13 -0
  57. package/agents/examples/sheet.tsx +15 -0
  58. package/agents/examples/skeleton.tsx +11 -0
  59. package/agents/examples/slider.tsx +5 -0
  60. package/agents/examples/surfaces.tsx +115 -0
  61. package/agents/examples/table.tsx +50 -0
  62. package/agents/examples/tabs.tsx +16 -0
  63. package/agents/examples/toggle-group.tsx +12 -0
  64. package/agents/examples/toggle.tsx +11 -0
  65. package/agents/examples/tooltip.tsx +13 -0
  66. package/agents/examples/treemap.tsx +87 -0
  67. package/agents/manifest.json +931 -0
  68. package/agents/report-rules.json +7 -0
  69. package/dist/components/registry/charts/bar-chart-card.js +33 -26
  70. package/dist/components/registry/dashboard-01/section-cards.d.ts +2 -0
  71. package/dist/components/registry/dashboard-01/section-cards.js +42 -35
  72. package/dist/components/registry/dashboardcn/bar-list.js +9 -8
  73. package/dist/components/registry/dashboardcn/distribution-bar.js +1 -1
  74. package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +29 -0
  75. package/dist/components/registry/dashboardcn/kpi-row-card.js +81 -0
  76. package/dist/components/registry/dashboardcn/sparkline.d.ts +18 -0
  77. package/dist/components/registry/dashboardcn/sparkline.js +95 -0
  78. package/dist/components/registry/heatmap/calendar-heatmap.js +8 -1
  79. package/dist/components/registry/heatmap/status-heatmap.js +8 -1
  80. package/dist/components/registry/heatmap/weekday-heatmap.d.ts +6 -2
  81. package/dist/components/registry/heatmap/weekday-heatmap.js +56 -37
  82. package/dist/components/registry/niko-table/core/data-table-context.d.ts +2 -0
  83. package/dist/components/registry/niko-table/core/data-table-context.js +21 -0
  84. package/dist/components/registry/niko-table/core/data-table-grouped-row.js +3 -1
  85. package/dist/components/registry/niko-table/core/data-table-structure.js +15 -12
  86. package/dist/components/registry/niko-table/core/data-table.d.ts +2 -2
  87. package/dist/components/registry/niko-table/core/data-table.js +5 -1
  88. package/dist/components/registry/niko-table/filters/table-faceted-filter.js +4 -4
  89. package/dist/components/registry/niko-table/filters/table-search-filter.js +1 -1
  90. package/dist/components/registry/niko-table/lib/flex-columns.d.ts +1 -1
  91. package/dist/components/registry/niko-table/lib/flex-columns.js +3 -3
  92. package/dist/components/registry/niko-table/lib/styles.d.ts +1 -1
  93. package/dist/components/registry/niko-table/lib/styles.js +2 -2
  94. package/dist/components/registry/niko-table/ui/table.js +2 -2
  95. package/dist/components/registry/sidebar-07/app-sidebar.d.ts +1 -1
  96. package/dist/components/registry/sidebar-07/app-sidebar.js +3 -1
  97. package/dist/components/registry/sidebar-07/nav-main.d.ts +1 -1
  98. package/dist/components/registry/sidebar-07/nav-main.js +7 -1
  99. package/dist/components/siyahi/data-bar.d.ts +19 -0
  100. package/dist/components/siyahi/data-bar.js +29 -0
  101. package/dist/components/siyahi/page-section.d.ts +4 -1
  102. package/dist/components/siyahi/page-section.js +6 -3
  103. package/dist/components/siyahi/panel-grid.d.ts +22 -0
  104. package/dist/components/siyahi/panel-grid.js +34 -0
  105. package/dist/components/siyahi/siyahi-provider.d.ts +13 -2
  106. package/dist/components/siyahi/siyahi-provider.js +17 -4
  107. package/dist/components/siyahi/treemap.js +46 -4
  108. package/dist/components/ui/accordion.js +5 -5
  109. package/dist/components/ui/alert.js +2 -2
  110. package/dist/components/ui/badge.js +1 -1
  111. package/dist/components/ui/breadcrumb.js +2 -2
  112. package/dist/components/ui/button.js +10 -10
  113. package/dist/components/ui/calendar.js +1 -1
  114. package/dist/components/ui/card.js +4 -4
  115. package/dist/components/ui/chart.js +1 -1
  116. package/dist/components/ui/code-block.js +13 -12
  117. package/dist/components/ui/command.js +7 -6
  118. package/dist/components/ui/context-menu.js +7 -7
  119. package/dist/components/ui/dialog.js +5 -5
  120. package/dist/components/ui/dropdown-menu.js +8 -8
  121. package/dist/components/ui/input-group.js +11 -11
  122. package/dist/components/ui/input.js +1 -1
  123. package/dist/components/ui/popover.js +3 -3
  124. package/dist/components/ui/progress.js +1 -1
  125. package/dist/components/ui/select.js +6 -6
  126. package/dist/components/ui/sheet.js +5 -5
  127. package/dist/components/ui/sidebar.js +17 -18
  128. package/dist/components/ui/skeleton.js +1 -1
  129. package/dist/components/ui/slider.js +2 -2
  130. package/dist/components/ui/table.js +2 -2
  131. package/dist/components/ui/tabs.js +2 -2
  132. package/dist/components/ui/textarea.js +1 -1
  133. package/dist/components/ui/toggle-group.js +2 -2
  134. package/dist/components/ui/toggle.js +4 -4
  135. package/dist/components/ui/tooltip.js +2 -2
  136. package/dist/index.d.ts +7 -4
  137. package/dist/index.js +7 -4
  138. package/dist/lib/chart-frame.d.ts +13 -5
  139. package/dist/lib/chart-frame.js +207 -127
  140. package/dist/lib/chart-series.d.ts +7 -4
  141. package/dist/lib/format.js +32 -13
  142. package/dist/lib/heatmap-navigation.d.ts +8 -0
  143. package/dist/lib/heatmap-navigation.js +49 -0
  144. package/package.json +3 -1
  145. package/registry.lock.json +16 -0
  146. package/report.css +11 -11
  147. package/styles/siyahi.css +77 -11
  148. package/dist/lib/recharts.d.ts +0 -2
  149. package/dist/lib/recharts.js +0 -1
@@ -0,0 +1,53 @@
1
+ import { useState } from "react";
2
+ import {
3
+ useFormat,
4
+ Card,
5
+ CardContent,
6
+ CardDescription,
7
+ CardHeader,
8
+ CardTitle,
9
+ WeekdayHeatmap,
10
+ WeekdayHeatmapBlock,
11
+ WeekdayHeatmapBody,
12
+ } from "@siyahi/ui";
13
+
14
+ // Orders placed by weekday and hour of the trading session.
15
+ const data = [1, 2, 3, 4, 5].flatMap((weekday) =>
16
+ [9, 10, 11, 12, 13, 14, 15].map((hour) => ({
17
+ weekday,
18
+ hour,
19
+ value: ((weekday * 5 + hour * 3) % 9) + (hour === 9 ? 6 : 0),
20
+ })),
21
+ );
22
+
23
+ export default function HeatmapWeekdayExample() {
24
+ const [selected, setSelected] = useState<string | null>(null);
25
+ const { count } = useFormat();
26
+ return (
27
+ <Card>
28
+ <CardHeader>
29
+ <CardTitle>When orders are placed</CardTitle>
30
+ <CardDescription>Weekday by hour in India Standard Time, market hours only</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>
33
+ <WeekdayHeatmap data={data} hours={[9, 10, 11, 12, 13, 14, 15]} weekdays={[1, 2, 3, 4, 5]}>
34
+ <WeekdayHeatmapBody>
35
+ {({ activity }) => (
36
+ <WeekdayHeatmapBlock
37
+ activity={activity}
38
+ onCellClick={(cell) =>
39
+ setSelected(
40
+ `${["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][cell.weekday]}, ${String(cell.hour).padStart(2, "0")}:00 IST: ${count(cell.value)} orders`,
41
+ )
42
+ }
43
+ />
44
+ )}
45
+ </WeekdayHeatmapBody>
46
+ </WeekdayHeatmap>
47
+ <p aria-live="polite" className="mt-3 text-sm">
48
+ {selected ?? "Select a cell for its order count. Use arrow keys to move between cells."}
49
+ </p>
50
+ </CardContent>
51
+ </Card>
52
+ );
53
+ }
@@ -0,0 +1,17 @@
1
+ import { Input, InputGroup, InputGroupAddon, InputGroupInput, Textarea } from "@siyahi/ui";
2
+ import { SearchIcon } from "lucide-react";
3
+
4
+ export default function InputExample() {
5
+ return (
6
+ <div className="flex max-w-sm flex-col gap-3">
7
+ <Input placeholder="Folio number" aria-label="Folio number" />
8
+ <InputGroup>
9
+ <InputGroupAddon>
10
+ <SearchIcon />
11
+ </InputGroupAddon>
12
+ <InputGroupInput placeholder="Search symbols" aria-label="Search symbols" />
13
+ </InputGroup>
14
+ <Textarea placeholder="Note for this trade" aria-label="Note" />
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,14 @@
1
+ import { LocalTime } from "@siyahi/ui";
2
+
3
+ export default function LocalTimeExample() {
4
+ return (
5
+ <>
6
+ <p>
7
+ Prices as of <LocalTime value="2026-10-20T10:00:00Z" />. Hover the time to see it on your own clock.
8
+ </p>
9
+ <p>
10
+ Daily snapshot of <LocalTime value="2026-06-26T04:11:00Z" withDate />.
11
+ </p>
12
+ </>
13
+ );
14
+ }
@@ -0,0 +1,40 @@
1
+ import { MetricStrip, ToggleGroup, ToggleGroupItem, useFormat, type MetricStripItem } from "@siyahi/ui";
2
+
3
+ export default function MetricStripExample() {
4
+ const { money, moneyCompact, pct, count } = useFormat();
5
+ // trend is each figure's month-end run, oldest first.
6
+ const items: MetricStripItem[] = [
7
+ {
8
+ label: "Portfolio value",
9
+ value: money(4512300),
10
+ change: 0.031,
11
+ note: "vs Sep",
12
+ trend: [3820000, 3950000, 4110000, 4020000, 4380000, 4512300],
13
+ },
14
+ {
15
+ label: "Invested",
16
+ value: moneyCompact(4025000),
17
+ change: 85000,
18
+ changeFormat: "money",
19
+ trend: [3600000, 3685000, 3770000, 3855000, 3940000, 4025000],
20
+ },
21
+ { label: "XIRR", value: pct(0.142), change: -0.004, trend: [0.151, 0.149, 0.152, 0.144, 0.146, 0.142] },
22
+ { label: "Realised", value: moneyCompact(-61200), change: -61200, changeFormat: "money" },
23
+ { label: "Dividends", value: moneyCompact(38400), change: 0.18, trend: [4100, 0, 12800, 3300, 9900, 8300] },
24
+ { label: "Holdings", value: count(42), note: "3 bought in Oct" },
25
+ ];
26
+ return (
27
+ <MetricStrip
28
+ title="October"
29
+ description="Month-end figures with the six-month run behind each"
30
+ action={
31
+ <ToggleGroup defaultValue={["1M"]} variant="outline" size="sm" aria-label="Period">
32
+ <ToggleGroupItem value="1M">1M</ToggleGroupItem>
33
+ <ToggleGroupItem value="1Y">1Y</ToggleGroupItem>
34
+ </ToggleGroup>
35
+ }
36
+ items={items}
37
+ footer={<p className="text-muted-foreground">Valued at the last close, 31 Oct 2026</p>}
38
+ />
39
+ );
40
+ }
@@ -0,0 +1,52 @@
1
+ import {
2
+ Button,
3
+ Card,
4
+ CardContent,
5
+ CardHeader,
6
+ CardTitle,
7
+ DataList,
8
+ DataListItem,
9
+ InlineCode,
10
+ PageSection,
11
+ PageSubheading,
12
+ } from "@siyahi/ui";
13
+ import { ArrowDownIcon } from "lucide-react";
14
+
15
+ export default function PageSectionExample() {
16
+ return (
17
+ <PageSection
18
+ id="toolkit"
19
+ eyebrow="Part 2"
20
+ title="The toolkit"
21
+ lead={
22
+ <p>
23
+ One command, <InlineCode>vp</InlineCode>, builds, tests and lints; it replaces the separate config of each.
24
+ </p>
25
+ }
26
+ action={
27
+ <Button variant="outline" size="sm">
28
+ <ArrowDownIcon data-icon="inline-start" />
29
+ Skip to the commands
30
+ </Button>
31
+ }
32
+ >
33
+ <PageSubheading>What each tool does</PageSubheading>
34
+ <Card>
35
+ <CardHeader>
36
+ <CardTitle>Vite+</CardTitle>
37
+ </CardHeader>
38
+ <CardContent>
39
+ <DataList>
40
+ <DataListItem label="In Java terms">Maven, the compiler plugin and Surefire in one binary.</DataListItem>
41
+ <DataListItem label="How it is set up">
42
+ One <InlineCode>vite.config.ts</InlineCode> at the root of the repo.
43
+ </DataListItem>
44
+ <DataListItem label="Remember">
45
+ <InlineCode>vp check</InlineCode>
46
+ </DataListItem>
47
+ </DataList>
48
+ </CardContent>
49
+ </Card>
50
+ </PageSection>
51
+ );
52
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ Button,
3
+ Popover,
4
+ PopoverContent,
5
+ PopoverDescription,
6
+ PopoverHeader,
7
+ PopoverTitle,
8
+ PopoverTrigger,
9
+ } from "@siyahi/ui";
10
+
11
+ export default function PopoverExample() {
12
+ return (
13
+ <Popover>
14
+ <PopoverTrigger render={<Button variant="outline" className="w-fit" />}>How is this priced?</PopoverTrigger>
15
+ <PopoverContent align="start">
16
+ <PopoverHeader>
17
+ <PopoverTitle>Last close</PopoverTitle>
18
+ <PopoverDescription>Holdings are valued at the exchange's last closing price.</PopoverDescription>
19
+ </PopoverHeader>
20
+ </PopoverContent>
21
+ </Popover>
22
+ );
23
+ }
@@ -0,0 +1,32 @@
1
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, PriceChart } from "@siyahi/ui";
2
+
3
+ // A made-up daily close series for one year.
4
+ const data = Array.from({ length: 250 }, (_, i) => {
5
+ const day = new Date(Date.UTC(2025, 9, 20 + Math.floor((i * 7) / 5)));
6
+ return { time: day.toISOString().slice(0, 10), value: 1500 + i * 1.2 + Math.sin(i / 9) * 60 + Math.sin(i / 3) * 18 };
7
+ });
8
+
9
+ export default function PriceChartExample() {
10
+ return (
11
+ <Card>
12
+ <CardHeader>
13
+ <CardTitle>INFY</CardTitle>
14
+ <CardDescription>Daily close, one year</CardDescription>
15
+ </CardHeader>
16
+ <CardContent>
17
+ <PriceChart data={data} height={256} />
18
+ </CardContent>
19
+ <CardFooter className="text-xs text-muted-foreground">
20
+ <span>
21
+ Chart by{" "}
22
+ <a
23
+ className="text-link underline-offset-4 hover:underline"
24
+ href="https://www.tradingview.com/lightweight-charts/"
25
+ >
26
+ TradingView Lightweight Charts
27
+ </a>
28
+ </span>
29
+ </CardFooter>
30
+ </Card>
31
+ );
32
+ }
@@ -0,0 +1,28 @@
1
+ import { ToneProgress, useFormat } from "@siyahi/ui";
2
+
3
+ const positions = [
4
+ { symbol: "INFY", realized: 84200, share: 0.41 },
5
+ { symbol: "ITC", realized: -61200, share: 0.3 },
6
+ { symbol: "TCS", realized: 21000, share: 0.1 },
7
+ ];
8
+
9
+ export default function ProgressToneExample() {
10
+ const { pct } = useFormat();
11
+ return (
12
+ <div className="flex max-w-sm flex-col gap-3 text-sm">
13
+ {positions.map((p) => (
14
+ <div key={p.symbol} className="flex items-center gap-3">
15
+ <span className="w-16 font-medium">{p.symbol}</span>
16
+ <ToneProgress
17
+ tone={p.realized >= 0 ? "positive" : "negative"}
18
+ value={p.share * 100}
19
+ aria-label={`${p.symbol}'s share of the booked P&L`}
20
+ getAriaValueText={() => pct(p.share)}
21
+ className="w-24"
22
+ />
23
+ <span className="tabular-nums">{pct(p.share)}</span>
24
+ </div>
25
+ ))}
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1,10 @@
1
+ import { Progress, ProgressLabel, ProgressValue } from "@siyahi/ui";
2
+
3
+ export default function ProgressExample() {
4
+ return (
5
+ <Progress value={64} className="max-w-sm">
6
+ <ProgressLabel>Statements imported</ProgressLabel>
7
+ <ProgressValue />
8
+ </Progress>
9
+ );
10
+ }
@@ -0,0 +1,20 @@
1
+ import { ScrollArea, Separator } from "@siyahi/ui";
2
+
3
+ const months = Array.from({ length: 24 }, (_, i) =>
4
+ new Date(2025, i, 1).toLocaleString("en-IN", { month: "long", year: "numeric" }),
5
+ );
6
+
7
+ export default function ScrollAreaExample() {
8
+ return (
9
+ <ScrollArea className="h-48 w-56 rounded-lg border">
10
+ <div className="p-4">
11
+ {months.map((month) => (
12
+ <div key={month}>
13
+ <div className="text-sm">{month}</div>
14
+ <Separator className="my-2" />
15
+ </div>
16
+ ))}
17
+ </div>
18
+ </ScrollArea>
19
+ );
20
+ }
@@ -0,0 +1,27 @@
1
+ import { Delta, SectionCards, useFormat, type SectionCard } from "@siyahi/ui";
2
+ import { useState } from "react";
3
+
4
+ const classes = [
5
+ { label: "All", net: 110200, positions: 181 },
6
+ { label: "Equity", net: 171400, positions: 164 },
7
+ { label: "Gold bonds", net: 0, positions: 0 },
8
+ { label: "F&O", net: -61200, positions: 17 },
9
+ ];
10
+
11
+ export default function SectionCardsSelectExample() {
12
+ const [scope, setScope] = useState("All");
13
+ const { count } = useFormat();
14
+ const items: SectionCard[] = classes.map((c) => ({
15
+ label: c.label,
16
+ value: <Delta value={c.net} format="money" />,
17
+ detail: `${count(c.positions)} positions`,
18
+ // Nothing to show for a class with no positions, so it cannot be picked.
19
+ disabled: c.positions === 0,
20
+ }));
21
+ return (
22
+ <div className="flex flex-col gap-3">
23
+ <SectionCards items={items} selected={scope} onSelect={setScope} />
24
+ <p className="text-sm text-muted-foreground">Showing {scope}</p>
25
+ </div>
26
+ );
27
+ }
@@ -0,0 +1,30 @@
1
+ import { Delta, SectionCards, Sparkline, useFormat, type SectionCard } from "@siyahi/ui";
2
+
3
+ export default function SectionCardsTrendExample() {
4
+ const { money, moneyCompact } = useFormat();
5
+ const items: SectionCard[] = [
6
+ {
7
+ label: "Portfolio value",
8
+ value: money(4512300),
9
+ badge: <Delta value={0.031} />,
10
+ trend: <Sparkline data={[3820000, 3950000, 4110000, 4020000, 4380000, 4512300]} />,
11
+ detail: "Month-end, last six months",
12
+ },
13
+ {
14
+ label: "Realised this year",
15
+ value: moneyCompact(-61200),
16
+ badge: <Delta value={-61200} format="money" />,
17
+ // A run of losses: the meaning colour, not a chart slot.
18
+ trend: <Sparkline data={[0, -8200, -14100, -30400, -52800, -61200]} color="var(--negative)" />,
19
+ detail: "Running total since April",
20
+ },
21
+ {
22
+ label: "Dividends this year",
23
+ value: moneyCompact(38400),
24
+ badge: <Delta value={0.18} />,
25
+ trend: <Sparkline data={[4100, 0, 12800, 3300, 9900, 8300]} variant="line" curve="linear" />,
26
+ detail: "Credited each month",
27
+ },
28
+ ];
29
+ return <SectionCards items={items} />;
30
+ }
@@ -0,0 +1,48 @@
1
+ import { Delta, SectionCards, type SectionCard, useFormat } from "@siyahi/ui";
2
+
3
+ export default function SectionCardsExample() {
4
+ const { money, moneyCompact } = useFormat();
5
+ const items: SectionCard[] = [
6
+ {
7
+ label: "Portfolio value",
8
+ value: money(4512300),
9
+ badge: <Delta value={0.031} />,
10
+ headline: "Up for the third month",
11
+ detail: "Valued at the last close",
12
+ },
13
+ {
14
+ label: "Invested",
15
+ value: money(4025000),
16
+ headline: "SIPs on the 5th and 20th",
17
+ detail: "Across 4 accounts",
18
+ },
19
+ {
20
+ label: "Unrealised gain",
21
+ value: moneyCompact(487300),
22
+ badge: <Delta value={0.121} />,
23
+ headline: "XIRR 14.2%",
24
+ detail: "Since the first buy",
25
+ },
26
+ {
27
+ label: "Realised this year",
28
+ value: moneyCompact(-61200),
29
+ badge: <Delta value={-61200} format="money" />,
30
+ headline: "Two loss-making exits",
31
+ detail: "Before tax",
32
+ },
33
+ {
34
+ label: "Dividends this year",
35
+ value: moneyCompact(38400),
36
+ badge: <Delta value={0.18} />,
37
+ headline: "From 11 holdings",
38
+ detail: "Credited to the bank",
39
+ },
40
+ ];
41
+ return (
42
+ <div className="flex flex-col gap-6">
43
+ <SectionCards items={items.slice(0, 3)} />
44
+ <SectionCards items={items.slice(0, 4)} />
45
+ <SectionCards items={items} />
46
+ </div>
47
+ );
48
+ }
@@ -0,0 +1,27 @@
1
+ import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@siyahi/ui";
2
+
3
+ const accounts = [
4
+ { label: "All accounts", value: "all" },
5
+ { label: "Equity", value: "equity" },
6
+ { label: "Mutual funds", value: "funds" },
7
+ { label: "Bonds", value: "bonds" },
8
+ ];
9
+
10
+ export default function SelectExample() {
11
+ return (
12
+ <Select items={accounts} defaultValue="all">
13
+ <SelectTrigger className="w-48">
14
+ <SelectValue />
15
+ </SelectTrigger>
16
+ <SelectContent>
17
+ <SelectGroup>
18
+ {accounts.map((account) => (
19
+ <SelectItem key={account.value} value={account.value}>
20
+ {account.label}
21
+ </SelectItem>
22
+ ))}
23
+ </SelectGroup>
24
+ </SelectContent>
25
+ </Select>
26
+ );
27
+ }
@@ -0,0 +1,13 @@
1
+ import { Separator } from "@siyahi/ui";
2
+
3
+ export default function SeparatorExample() {
4
+ return (
5
+ <div className="flex h-6 items-center gap-4 text-sm">
6
+ <span>Equity</span>
7
+ <Separator orientation="vertical" />
8
+ <span>Debt</span>
9
+ <Separator orientation="vertical" />
10
+ <span>Gold</span>
11
+ </div>
12
+ );
13
+ }
@@ -0,0 +1,15 @@
1
+ import { Button, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "@siyahi/ui";
2
+
3
+ export default function SheetExample() {
4
+ return (
5
+ <Sheet>
6
+ <SheetTrigger render={<Button variant="outline" className="w-fit" />}>Filters</SheetTrigger>
7
+ <SheetContent>
8
+ <SheetHeader>
9
+ <SheetTitle>Filters</SheetTitle>
10
+ <SheetDescription>Narrow the ledger by account, symbol or date.</SheetDescription>
11
+ </SheetHeader>
12
+ </SheetContent>
13
+ </Sheet>
14
+ );
15
+ }
@@ -0,0 +1,11 @@
1
+ import { Skeleton } from "@siyahi/ui";
2
+
3
+ export default function SkeletonExample() {
4
+ return (
5
+ <div className="flex max-w-sm flex-col gap-2">
6
+ <Skeleton className="h-4 w-32" />
7
+ <Skeleton className="h-8 w-48" />
8
+ <Skeleton className="h-4 w-full" />
9
+ </div>
10
+ );
11
+ }
@@ -0,0 +1,5 @@
1
+ import { Slider } from "@siyahi/ui";
2
+
3
+ export default function SliderExample() {
4
+ return <Slider defaultValue={[20, 80]} max={100} step={5} aria-label="Allocation band" className="max-w-sm" />;
5
+ }
@@ -0,0 +1,115 @@
1
+ import {
2
+ BarChartCard,
3
+ Card,
4
+ CardContent,
5
+ CardDescription,
6
+ CardHeader,
7
+ CardTitle,
8
+ MetricStrip,
9
+ PanelGrid,
10
+ SiyahiProvider,
11
+ Table,
12
+ TableBody,
13
+ TableCell,
14
+ TableHead,
15
+ TableHeader,
16
+ TableRow,
17
+ ToggleGroup,
18
+ ToggleGroupItem,
19
+ useFormat,
20
+ type MetricStripItem,
21
+ type Surface,
22
+ } from "@siyahi/ui";
23
+ import { useState } from "react";
24
+
25
+ const orders = [
26
+ { hour: 9, orders: 42 },
27
+ { hour: 10, orders: 31 },
28
+ { hour: 11, orders: 18 },
29
+ { hour: 12, orders: 12 },
30
+ { hour: 13, orders: 15 },
31
+ { hour: 14, orders: 24 },
32
+ { hour: 15, orders: 38 },
33
+ ];
34
+
35
+ const holdings = [
36
+ { symbol: "ITC", value: 276000 },
37
+ { symbol: "INFY", value: 224400 },
38
+ { symbol: "TCS", value: 166000 },
39
+ ];
40
+
41
+ function Dashboard() {
42
+ const { money, moneyCompact, pct } = useFormat();
43
+ const kpis: MetricStripItem[] = [
44
+ { label: "Portfolio value", value: money(4512300), change: 0.031 },
45
+ { label: "Invested", value: moneyCompact(4025000), change: 85000, changeFormat: "money" },
46
+ { label: "XIRR", value: pct(0.142), change: -0.004 },
47
+ { label: "Realised", value: moneyCompact(-61200), change: -61200, changeFormat: "money" },
48
+ ];
49
+ return (
50
+ <div className="flex flex-col gap-6">
51
+ <MetricStrip items={kpis} />
52
+ <PanelGrid>
53
+ <BarChartCard
54
+ title="Orders by hour"
55
+ description="Today, IST"
56
+ data={orders}
57
+ xKey="hour"
58
+ xFormatter={(hour) => `${String(hour).padStart(2, "0")}:00`}
59
+ series={[{ key: "orders", label: "Orders", color: "var(--chart-1)" }]}
60
+ height={200}
61
+ />
62
+ <Card>
63
+ <CardHeader>
64
+ <CardTitle>Holdings</CardTitle>
65
+ <CardDescription>Largest three</CardDescription>
66
+ </CardHeader>
67
+ <CardContent>
68
+ <Table>
69
+ <TableHeader>
70
+ <TableRow>
71
+ <TableHead>Symbol</TableHead>
72
+ <TableHead>Value</TableHead>
73
+ </TableRow>
74
+ </TableHeader>
75
+ <TableBody>
76
+ {holdings.map((row) => (
77
+ <TableRow key={row.symbol}>
78
+ <TableCell className="font-mono">{row.symbol}</TableCell>
79
+ <TableCell className="tabular-nums">{money(row.value)}</TableCell>
80
+ </TableRow>
81
+ ))}
82
+ </TableBody>
83
+ </Table>
84
+ </CardContent>
85
+ </Card>
86
+ </PanelGrid>
87
+ </div>
88
+ );
89
+ }
90
+
91
+ export default function SurfacesExample() {
92
+ const [surface, setSurface] = useState<Surface>("ruled");
93
+ return (
94
+ <div className="flex flex-col gap-4">
95
+ <ToggleGroup
96
+ value={[surface]}
97
+ onValueChange={([next]) => {
98
+ // Pressing the selected surface again would leave none selected; keep it.
99
+ if (next) setSurface(next as Surface);
100
+ }}
101
+ variant="outline"
102
+ size="sm"
103
+ aria-label="Surface"
104
+ >
105
+ <ToggleGroupItem value="ruled">Ruled</ToggleGroupItem>
106
+ <ToggleGroupItem value="open">Open</ToggleGroupItem>
107
+ <ToggleGroupItem value="card">Card</ToggleGroupItem>
108
+ </ToggleGroup>
109
+ {/* A nested provider sets the surface for its part of the page. */}
110
+ <SiyahiProvider surface={surface}>
111
+ <Dashboard />
112
+ </SiyahiProvider>
113
+ </div>
114
+ );
115
+ }
@@ -0,0 +1,50 @@
1
+ import {
2
+ Card,
3
+ CardContent,
4
+ CardHeader,
5
+ CardTitle,
6
+ Table,
7
+ TableBody,
8
+ TableCell,
9
+ TableHead,
10
+ TableHeader,
11
+ TableRow,
12
+ useFormat,
13
+ } from "@siyahi/ui";
14
+
15
+ const rows = [
16
+ { month: "July", in: 85000, out: 12000 },
17
+ { month: "August", in: 85000, out: 64000 },
18
+ { month: "September", in: 92000, out: 8000 },
19
+ ];
20
+
21
+ export default function TableExample() {
22
+ const { money } = useFormat();
23
+ return (
24
+ <Card>
25
+ <CardHeader>
26
+ <CardTitle>Cash flow</CardTitle>
27
+ </CardHeader>
28
+ <CardContent>
29
+ <Table>
30
+ <TableHeader>
31
+ <TableRow>
32
+ <TableHead>Month</TableHead>
33
+ <TableHead className="text-right">In</TableHead>
34
+ <TableHead className="text-right">Out</TableHead>
35
+ </TableRow>
36
+ </TableHeader>
37
+ <TableBody>
38
+ {rows.map((row) => (
39
+ <TableRow key={row.month}>
40
+ <TableCell>{row.month}</TableCell>
41
+ <TableCell className="text-right">{money(row.in)}</TableCell>
42
+ <TableCell className="text-right">{money(row.out)}</TableCell>
43
+ </TableRow>
44
+ ))}
45
+ </TableBody>
46
+ </Table>
47
+ </CardContent>
48
+ </Card>
49
+ );
50
+ }
@@ -0,0 +1,16 @@
1
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@siyahi/ui";
2
+
3
+ export default function TabsExample() {
4
+ return (
5
+ <Tabs defaultValue="holdings">
6
+ <TabsList>
7
+ <TabsTrigger value="holdings">Holdings</TabsTrigger>
8
+ <TabsTrigger value="realized">Realized</TabsTrigger>
9
+ <TabsTrigger value="cash">Cash flow</TabsTrigger>
10
+ </TabsList>
11
+ <TabsContent value="holdings">What you own today, valued at the last close.</TabsContent>
12
+ <TabsContent value="realized">Gains and losses booked by selling.</TabsContent>
13
+ <TabsContent value="cash">Money in and out of every account.</TabsContent>
14
+ </Tabs>
15
+ );
16
+ }