@siyahi/ui 0.1.9-next.3 → 0.1.9-next.30
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 +170 -0
- package/README.md +94 -177
- package/THIRD_PARTY_NOTICES.md +11 -11
- package/agents/examples/accordion.tsx +39 -0
- package/agents/examples/alert.tsx +24 -0
- package/agents/examples/app-sidebar.tsx +40 -0
- package/agents/examples/avatar.tsx +24 -0
- package/agents/examples/badge.tsx +26 -0
- package/agents/examples/bar-list-labels.tsx +22 -0
- package/agents/examples/bar-list-sides.tsx +40 -0
- package/agents/examples/bar-list.tsx +24 -0
- package/agents/examples/breadcrumb.tsx +28 -0
- package/agents/examples/button-states.tsx +23 -0
- package/agents/examples/button.tsx +21 -0
- package/agents/examples/calendar.tsx +11 -0
- package/agents/examples/callout.tsx +33 -0
- package/agents/examples/card.tsx +36 -0
- package/agents/examples/change-bar.tsx +104 -0
- package/agents/examples/change-grid-money.tsx +36 -0
- package/agents/examples/change-grid.tsx +42 -0
- package/agents/examples/chart-area-log.tsx +45 -0
- package/agents/examples/chart-area.tsx +39 -0
- package/agents/examples/chart-bar-flows.tsx +32 -0
- package/agents/examples/chart-bar-hourly.tsx +28 -0
- package/agents/examples/chart-bar-losses.tsx +29 -0
- package/agents/examples/chart-bar-teams.tsx +72 -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-forecast.tsx +36 -0
- package/agents/examples/chart-line-log.tsx +39 -0
- package/agents/examples/chart-line-quiet.tsx +114 -0
- package/agents/examples/chart-line-timeline.tsx +41 -0
- package/agents/examples/chart-line.tsx +57 -0
- package/agents/examples/chart-panels.tsx +94 -0
- package/agents/examples/code-block.tsx +40 -0
- package/agents/examples/collapsible.tsx +18 -0
- package/agents/examples/command.tsx +29 -0
- package/agents/examples/context-menu.tsx +17 -0
- package/agents/examples/copy-button.tsx +8 -0
- package/agents/examples/data-bar.tsx +108 -0
- package/agents/examples/data-table-compact.tsx +96 -0
- package/agents/examples/data-table-filters.tsx +103 -0
- package/agents/examples/data-table.tsx +99 -0
- package/agents/examples/delta.tsx +18 -0
- package/agents/examples/dialog.tsx +28 -0
- package/agents/examples/distribution-bar-budget.tsx +30 -0
- package/agents/examples/distribution-bar-tug.tsx +74 -0
- package/agents/examples/drawdown-chart.tsx +35 -0
- package/agents/examples/dropdown-menu.tsx +31 -0
- package/agents/examples/field.tsx +108 -0
- package/agents/examples/formatters.tsx +42 -0
- package/agents/examples/heatmap-calendar-signed.tsx +67 -0
- package/agents/examples/heatmap-calendar.tsx +62 -0
- package/agents/examples/heatmap-status.tsx +61 -0
- package/agents/examples/heatmap-weekday.tsx +72 -0
- package/agents/examples/histogram-chart.tsx +28 -0
- package/agents/examples/input-states.tsx +23 -0
- package/agents/examples/input.tsx +17 -0
- package/agents/examples/local-time.tsx +14 -0
- package/agents/examples/metric-strip.tsx +46 -0
- package/agents/examples/overview-dashboard.tsx +180 -0
- package/agents/examples/page-hero.tsx +38 -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 +29 -0
- package/agents/examples/progress.tsx +10 -0
- package/agents/examples/range-position-table.tsx +101 -0
- package/agents/examples/range-position.tsx +55 -0
- package/agents/examples/scatter-chart-quadrants.tsx +63 -0
- package/agents/examples/scatter-chart-scales.tsx +46 -0
- package/agents/examples/scatter-chart.tsx +78 -0
- package/agents/examples/scroll-area.tsx +22 -0
- package/agents/examples/section-cards-select.tsx +28 -0
- package/agents/examples/section-cards-trend.tsx +32 -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/slope-chart-market.tsx +33 -0
- package/agents/examples/slope-chart.tsx +26 -0
- package/agents/examples/stale-blocks.tsx +56 -0
- package/agents/examples/surfaces.tsx +116 -0
- package/agents/examples/table.tsx +60 -0
- package/agents/examples/tabs.tsx +16 -0
- package/agents/examples/target-rows.tsx +74 -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 +93 -0
- package/agents/examples/waterfall-chart-stores.tsx +27 -0
- package/agents/examples/waterfall-chart.tsx +37 -0
- package/agents/manifest.json +1391 -0
- package/agents/report-rules.json +7 -0
- package/dist/components/registry/charts/area-chart-card.d.ts +7 -3
- package/dist/components/registry/charts/area-chart-card.js +56 -10
- package/dist/components/registry/charts/bar-chart-card.d.ts +1 -1
- package/dist/components/registry/charts/bar-chart-card.js +20 -22
- package/dist/components/registry/charts/line-chart-card.d.ts +3 -3
- package/dist/components/registry/charts/line-chart-card.js +44 -9
- package/dist/components/registry/dashboard-01/section-cards.d.ts +6 -0
- package/dist/components/registry/dashboard-01/section-cards.js +51 -35
- package/dist/components/registry/dashboardcn/bar-list.js +17 -10
- package/dist/components/registry/dashboardcn/distribution-bar.js +6 -4
- package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +29 -0
- package/dist/components/registry/dashboardcn/kpi-row-card.js +81 -0
- package/dist/components/registry/dashboardcn/sparkline.d.ts +22 -0
- package/dist/components/registry/dashboardcn/sparkline.js +117 -0
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +11 -3
- package/dist/components/registry/heatmap/calendar-heatmap.js +164 -45
- package/dist/components/registry/heatmap/status-heatmap.d.ts +5 -3
- package/dist/components/registry/heatmap/status-heatmap.js +115 -54
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +9 -3
- package/dist/components/registry/heatmap/weekday-heatmap.js +83 -53
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +18 -1
- package/dist/components/registry/niko-table/core/data-table-context.js +7 -1
- package/dist/components/registry/niko-table/core/data-table-grouped-row.js +3 -1
- package/dist/components/registry/niko-table/core/data-table-root.js +39 -4
- package/dist/components/registry/niko-table/core/data-table-structure.js +17 -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-faceted-filter.js +5 -5
- 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 +3 -3
- package/dist/components/registry/niko-table/types/index.d.ts +9 -0
- package/dist/components/registry/niko-table/ui/table.js +2 -2
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +1 -1
- package/dist/components/registry/sidebar-07/app-sidebar.js +3 -1
- package/dist/components/registry/sidebar-07/nav-main.d.ts +2 -1
- package/dist/components/registry/sidebar-07/nav-main.js +16 -3
- package/dist/components/siyahi/callout.d.ts +17 -0
- package/dist/components/siyahi/callout.js +34 -0
- package/dist/components/siyahi/change-bar.d.ts +21 -0
- package/dist/components/siyahi/change-bar.js +35 -0
- package/dist/components/siyahi/change-grid.d.ts +31 -0
- package/dist/components/siyahi/change-grid.js +74 -0
- package/dist/components/siyahi/data-bar.d.ts +19 -0
- package/dist/components/siyahi/data-bar.js +29 -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/drawdown-chart.d.ts +34 -0
- package/dist/components/siyahi/drawdown-chart.js +102 -0
- package/dist/components/siyahi/histogram-chart.d.ts +57 -0
- package/dist/components/siyahi/histogram-chart.js +134 -0
- package/dist/components/siyahi/page-hero.d.ts +23 -0
- package/dist/components/siyahi/page-hero.js +43 -0
- package/dist/components/siyahi/page-section.d.ts +4 -1
- package/dist/components/siyahi/page-section.js +6 -3
- package/dist/components/siyahi/page-toc.d.ts +20 -0
- package/dist/components/siyahi/page-toc.js +76 -0
- package/dist/components/siyahi/panel-grid.d.ts +24 -0
- package/dist/components/siyahi/panel-grid.js +37 -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/scale-toggle.d.ts +32 -0
- package/dist/components/siyahi/scale-toggle.js +61 -0
- package/dist/components/siyahi/scatter-chart.d.ts +69 -0
- package/dist/components/siyahi/scatter-chart.js +395 -0
- package/dist/components/siyahi/siyahi-provider.d.ts +15 -2
- package/dist/components/siyahi/siyahi-provider.js +17 -4
- package/dist/components/siyahi/slope-chart.d.ts +35 -0
- package/dist/components/siyahi/slope-chart.js +159 -0
- package/dist/components/siyahi/stale-note.d.ts +9 -0
- package/dist/components/siyahi/stale-note.js +12 -0
- package/dist/components/siyahi/status-alert.d.ts +15 -0
- package/dist/components/siyahi/status-alert.js +29 -0
- package/dist/components/siyahi/status-badge.d.ts +15 -0
- package/dist/components/siyahi/status-badge.js +24 -0
- package/dist/components/siyahi/target-rows.d.ts +34 -0
- package/dist/components/siyahi/target-rows.js +97 -0
- package/dist/components/siyahi/tone-progress.d.ts +1 -1
- package/dist/components/siyahi/tone-progress.js +1 -1
- package/dist/components/siyahi/treemap.d.ts +8 -5
- package/dist/components/siyahi/treemap.js +80 -34
- package/dist/components/siyahi/waterfall-chart.d.ts +51 -0
- package/dist/components/siyahi/waterfall-chart.js +147 -0
- package/dist/components/ui/accordion.js +5 -5
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +2 -2
- package/dist/components/ui/button.js +10 -10
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/card.js +4 -4
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/code-block.js +13 -12
- package/dist/components/ui/command.js +7 -6
- package/dist/components/ui/context-menu.js +7 -7
- package/dist/components/ui/dialog.js +5 -5
- package/dist/components/ui/dropdown-menu.js +8 -8
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +109 -0
- package/dist/components/ui/input-group.js +11 -11
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.js +13 -0
- package/dist/components/ui/popover.js +3 -3
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/select.js +6 -6
- package/dist/components/ui/sheet.js +5 -5
- package/dist/components/ui/sidebar.js +17 -18
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +2 -2
- package/dist/components/ui/table.js +2 -2
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.js +4 -4
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/index.d.ts +35 -8
- package/dist/index.js +30 -4
- package/dist/lib/chart-frame.d.ts +51 -7
- package/dist/lib/chart-frame.js +390 -133
- package/dist/lib/chart-marks.d.ts +83 -0
- package/dist/lib/chart-marks.js +216 -0
- package/dist/lib/chart-series.d.ts +42 -10
- package/dist/lib/compact-columns.d.ts +19 -0
- package/dist/lib/compact-columns.js +55 -0
- package/dist/lib/fit-text.d.ts +6 -0
- package/dist/lib/fit-text.js +11 -0
- package/dist/lib/format.d.ts +8 -3
- package/dist/lib/format.js +55 -17
- package/dist/lib/heat.d.ts +7 -0
- package/dist/lib/heat.js +14 -0
- package/dist/lib/heatmap-navigation.d.ts +8 -0
- package/dist/lib/heatmap-navigation.js +49 -0
- package/dist/lib/scatter.d.ts +88 -0
- package/dist/lib/scatter.js +179 -0
- package/dist/lib/ticks.d.ts +27 -0
- package/dist/lib/ticks.js +67 -0
- package/dist/lib/tone.d.ts +36 -0
- package/dist/lib/tone.js +35 -0
- package/dist/lib/treemap.d.ts +0 -5
- package/dist/lib/treemap.js +1 -11
- package/dist/lib/use-element-width.d.ts +5 -0
- package/dist/lib/use-element-width.js +15 -0
- package/package.json +5 -1
- package/registry.lock.json +16 -0
- package/report.css +63 -47
- package/styles/siyahi.css +708 -55
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppSidebar, SidebarProvider } from "@siyahi/ui";
|
|
2
|
+
import {
|
|
3
|
+
BlocksIcon,
|
|
4
|
+
ChartAreaIcon,
|
|
5
|
+
CodeIcon,
|
|
6
|
+
FileTextIcon,
|
|
7
|
+
HouseIcon,
|
|
8
|
+
LayersIcon,
|
|
9
|
+
PaletteIcon,
|
|
10
|
+
SlidersHorizontalIcon,
|
|
11
|
+
} from "lucide-react";
|
|
12
|
+
|
|
13
|
+
// No `items` on a view, so each one is a plain link.
|
|
14
|
+
const views = [
|
|
15
|
+
{ title: "Overview", url: "#/overview", icon: <HouseIcon /> },
|
|
16
|
+
{ title: "Foundations", url: "#/foundations", icon: <PaletteIcon /> },
|
|
17
|
+
{ title: "Components", url: "#/components", icon: <LayersIcon /> },
|
|
18
|
+
{ title: "Inputs and overlays", url: "#/inputs", icon: <SlidersHorizontalIcon /> },
|
|
19
|
+
{ title: "Data", url: "#/data", icon: <ChartAreaIcon /> },
|
|
20
|
+
{ title: "Blocks", url: "#/blocks", icon: <BlocksIcon />, isActive: true },
|
|
21
|
+
{ title: "Reports", url: "#/reports", icon: <FileTextIcon /> },
|
|
22
|
+
// linkProps go onto the anchor: here a new tab, in an app often onMouseEnter to prefetch the view's data.
|
|
23
|
+
{
|
|
24
|
+
title: "Source",
|
|
25
|
+
url: "https://github.com/jatinbansal1998/siyahi",
|
|
26
|
+
icon: <CodeIcon />,
|
|
27
|
+
linkProps: { target: "_blank", rel: "noreferrer" },
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default function AppSidebarExample() {
|
|
32
|
+
return (
|
|
33
|
+
// In an app, AppSidebar sits fixed at the edge; collapsible="none" draws it in place here.
|
|
34
|
+
<SidebarProvider className="min-h-0">
|
|
35
|
+
<div className="flex overflow-hidden rounded-lg border">
|
|
36
|
+
<AppSidebar collapsible="none" navMain={views} navLabel="Views" />
|
|
37
|
+
</div>
|
|
38
|
+
</SidebarProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function AvatarExample() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex items-center gap-6">
|
|
6
|
+
<Avatar>
|
|
7
|
+
<AvatarFallback>JB</AvatarFallback>
|
|
8
|
+
</Avatar>
|
|
9
|
+
{/* A group overlaps its avatars; the first one's badge stays over its neighbour. */}
|
|
10
|
+
<AvatarGroup>
|
|
11
|
+
<Avatar>
|
|
12
|
+
<AvatarFallback>JB</AvatarFallback>
|
|
13
|
+
<AvatarBadge aria-label="Online" />
|
|
14
|
+
</Avatar>
|
|
15
|
+
<Avatar>
|
|
16
|
+
<AvatarFallback>HU</AvatarFallback>
|
|
17
|
+
</Avatar>
|
|
18
|
+
<Avatar>
|
|
19
|
+
<AvatarFallback>AK</AvatarFallback>
|
|
20
|
+
</Avatar>
|
|
21
|
+
</AvatarGroup>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Badge, Delta, StatusBadge } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
export default function BadgeExample() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex flex-col gap-3">
|
|
6
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
7
|
+
<StatusBadge tone="positive">Paid</StatusBadge>
|
|
8
|
+
<StatusBadge tone="warning">Pending</StatusBadge>
|
|
9
|
+
<StatusBadge tone="negative">Failed</StatusBadge>
|
|
10
|
+
<StatusBadge tone="accent">New</StatusBadge>
|
|
11
|
+
<StatusBadge>Draft</StatusBadge>
|
|
12
|
+
</div>
|
|
13
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
14
|
+
<Badge>Active</Badge>
|
|
15
|
+
<Badge variant="secondary">Archived</Badge>
|
|
16
|
+
<Badge variant="outline">Engineering</Badge>
|
|
17
|
+
<Badge variant="outline">
|
|
18
|
+
<Delta value={0.042} />
|
|
19
|
+
</Badge>
|
|
20
|
+
<Badge variant="outline">
|
|
21
|
+
<Delta value={-0.013} />
|
|
22
|
+
</Badge>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
const categories = [
|
|
4
|
+
{ name: "Home Appliances and Kitchen Equipment", value: 100 },
|
|
5
|
+
{ name: "Health, Beauty and Personal Care", value: 70 },
|
|
6
|
+
{ name: "Books, Stationery and Office Supplies", value: 50 },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export default function BarListLabelsExample() {
|
|
10
|
+
const { count } = useFormat();
|
|
11
|
+
return (
|
|
12
|
+
<Card>
|
|
13
|
+
<CardHeader>
|
|
14
|
+
<CardTitle>Orders by category, ranked</CardTitle>
|
|
15
|
+
<CardDescription>Full labels and order counts stay readable in narrow panels</CardDescription>
|
|
16
|
+
</CardHeader>
|
|
17
|
+
<CardContent>
|
|
18
|
+
<BarList data={categories} valueFormatter={count} />
|
|
19
|
+
</CardContent>
|
|
20
|
+
</Card>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// This quarter's revenue against last quarter's, by city: the biggest rises and falls; made-up figures.
|
|
4
|
+
const gains = [
|
|
5
|
+
{ name: "Mumbai", value: 84000 },
|
|
6
|
+
{ name: "Bengaluru", value: 52000 },
|
|
7
|
+
{ name: "Pune", value: 31000 },
|
|
8
|
+
];
|
|
9
|
+
const losses = [
|
|
10
|
+
{ name: "Kolkata", value: 18400 },
|
|
11
|
+
{ name: "Jaipur", value: 7600 },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default function BarListSidesExample() {
|
|
15
|
+
const { money } = useFormat();
|
|
16
|
+
// One scale for both lists, so a small loss draws a short bar beside a large gain.
|
|
17
|
+
const max = Math.max(...[...gains, ...losses].map((row) => row.value));
|
|
18
|
+
return (
|
|
19
|
+
<Card>
|
|
20
|
+
<CardHeader>
|
|
21
|
+
<CardTitle>What moved revenue</CardTitle>
|
|
22
|
+
<CardDescription>The biggest ₹ rises and falls by city, on one scale</CardDescription>
|
|
23
|
+
</CardHeader>
|
|
24
|
+
{/* Each list is a column of its own, headed and ruled off, with its figures at its own right edge, so a
|
|
25
|
+
gain's figure never reads as the label of the loss beside it. */}
|
|
26
|
+
<CardContent>
|
|
27
|
+
<div className="grid gap-6 md:grid-cols-2 md:gap-0 md:divide-x">
|
|
28
|
+
<div className="md:pr-6">
|
|
29
|
+
<h3 className="text-muted-foreground mb-2 text-xs font-medium">Gains</h3>
|
|
30
|
+
<BarList data={gains} max={max} color="var(--positive)" valueFormatter={(v) => money(v)} />
|
|
31
|
+
</div>
|
|
32
|
+
<div className="md:pl-6">
|
|
33
|
+
<h3 className="text-muted-foreground mb-2 text-xs font-medium">Losses</h3>
|
|
34
|
+
<BarList data={losses} max={max} color="var(--negative)" valueFormatter={(v) => money(v)} />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</CardContent>
|
|
38
|
+
</Card>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BarList, Card, CardContent, CardDescription, CardHeader, CardTitle, Delta, useFormat } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// value is the drop in a customer's monthly spend; detail is that drop as a share of last month's.
|
|
4
|
+
const largestDrops = [
|
|
5
|
+
{ name: "Sharma Textiles", value: 18400, detail: <Delta value={-0.062} /> },
|
|
6
|
+
{ name: "Bluepine Logistics", value: 12900, detail: <Delta value={-0.047} /> },
|
|
7
|
+
{ name: "Lakeview Clinics", value: 7600, detail: <Delta value={-0.072} /> },
|
|
8
|
+
{ name: "Coastal Foods (India)", value: 4100, detail: <Delta value={-0.06} /> },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export default function BarListExample() {
|
|
12
|
+
const { money } = useFormat();
|
|
13
|
+
return (
|
|
14
|
+
<Card>
|
|
15
|
+
<CardHeader>
|
|
16
|
+
<CardTitle>Needs attention</CardTitle>
|
|
17
|
+
<CardDescription>Customers whose spend fell most this month</CardDescription>
|
|
18
|
+
</CardHeader>
|
|
19
|
+
<CardContent>
|
|
20
|
+
<BarList data={largestDrops} valueFormatter={(v) => money(v)} showPercentage />
|
|
21
|
+
</CardContent>
|
|
22
|
+
</Card>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Breadcrumb,
|
|
3
|
+
BreadcrumbItem,
|
|
4
|
+
BreadcrumbLink,
|
|
5
|
+
BreadcrumbList,
|
|
6
|
+
BreadcrumbPage,
|
|
7
|
+
BreadcrumbSeparator,
|
|
8
|
+
} from "@siyahi/ui";
|
|
9
|
+
|
|
10
|
+
export default function BreadcrumbExample() {
|
|
11
|
+
return (
|
|
12
|
+
<Breadcrumb>
|
|
13
|
+
<BreadcrumbList>
|
|
14
|
+
<BreadcrumbItem>
|
|
15
|
+
<BreadcrumbLink href="#/components">Projects</BreadcrumbLink>
|
|
16
|
+
</BreadcrumbItem>
|
|
17
|
+
<BreadcrumbSeparator />
|
|
18
|
+
<BreadcrumbItem>
|
|
19
|
+
<BreadcrumbLink href="#/components">Website</BreadcrumbLink>
|
|
20
|
+
</BreadcrumbItem>
|
|
21
|
+
<BreadcrumbSeparator />
|
|
22
|
+
<BreadcrumbItem>
|
|
23
|
+
<BreadcrumbPage>Checkout redesign</BreadcrumbPage>
|
|
24
|
+
</BreadcrumbItem>
|
|
25
|
+
</BreadcrumbList>
|
|
26
|
+
</Breadcrumb>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Button, Toggle } from "@siyahi/ui";
|
|
2
|
+
import { DownloadIcon, Loader2Icon, PinIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function ButtonStatesExample() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
7
|
+
<Button disabled>Save</Button>
|
|
8
|
+
<Button variant="outline" disabled>
|
|
9
|
+
<DownloadIcon />
|
|
10
|
+
Export
|
|
11
|
+
</Button>
|
|
12
|
+
{/* Busy: the label stays and the icon spins, so the button keeps its width while the work runs. */}
|
|
13
|
+
<Button disabled aria-busy>
|
|
14
|
+
<Loader2Icon className="motion-safe:animate-spin" />
|
|
15
|
+
Saving
|
|
16
|
+
</Button>
|
|
17
|
+
<Toggle variant="outline" defaultPressed aria-label="Pin to top">
|
|
18
|
+
<PinIcon />
|
|
19
|
+
Pinned
|
|
20
|
+
</Toggle>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Button } from "@siyahi/ui";
|
|
2
|
+
import { DownloadIcon, RefreshCwIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function ButtonExample() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
7
|
+
<Button>Save</Button>
|
|
8
|
+
<Button variant="outline">
|
|
9
|
+
<DownloadIcon />
|
|
10
|
+
Export
|
|
11
|
+
</Button>
|
|
12
|
+
<Button variant="secondary">Secondary</Button>
|
|
13
|
+
<Button variant="ghost">Ghost</Button>
|
|
14
|
+
<Button variant="destructive">Delete</Button>
|
|
15
|
+
<Button variant="link">Link</Button>
|
|
16
|
+
<Button variant="outline" size="icon" aria-label="Refresh">
|
|
17
|
+
<RefreshCwIcon />
|
|
18
|
+
</Button>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Calendar } from "@siyahi/ui";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
export default function CalendarExample() {
|
|
5
|
+
const [date, setDate] = useState<Date | undefined>(new Date(2026, 9, 20));
|
|
6
|
+
return (
|
|
7
|
+
<div className="w-fit rounded-lg border">
|
|
8
|
+
<Calendar mode="single" selected={date} onSelect={setDate} defaultMonth={new Date(2026, 9, 1)} />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AlertDescription, AlertTitle, Callout, Quote, StatusAlert } from "@siyahi/ui";
|
|
2
|
+
import { LightbulbIcon, InfoIcon, TriangleAlertIcon, TrendingUpIcon, TrendingDownIcon } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
export default function CalloutExample() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="grid max-w-2xl gap-3">
|
|
7
|
+
<Callout tone="accent" icon={<LightbulbIcon />} title="The takeaway">
|
|
8
|
+
Two of eleven pricing tests raised revenue; <strong>none</strong> held up in both regions.
|
|
9
|
+
</Callout>
|
|
10
|
+
<Callout icon={<InfoIcon />} title="How the tests were run">
|
|
11
|
+
Four weeks each on a random tenth of new visitors, with refunds and payment fees taken off.
|
|
12
|
+
</Callout>
|
|
13
|
+
<Callout tone="warning" icon={<TriangleAlertIcon />} title="Do not use the combined result">
|
|
14
|
+
It counted orders placed before the test began, so its revenue claims are withdrawn.
|
|
15
|
+
</Callout>
|
|
16
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
17
|
+
<Callout tone="positive" icon={<TrendingUpIcon />} title="Best test">
|
|
18
|
+
Annual plan shown first: <strong className="whitespace-nowrap">+₹10,616</strong> a week.
|
|
19
|
+
</Callout>
|
|
20
|
+
<Callout tone="negative" icon={<TrendingDownIcon />} title="Worst test">
|
|
21
|
+
Free delivery only above ₹999: <strong className="whitespace-nowrap">−₹70,679</strong> a week.
|
|
22
|
+
</Callout>
|
|
23
|
+
</div>
|
|
24
|
+
<Quote source="The hosting provider's incident report, 21 Oct 2026">
|
|
25
|
+
Requests to the Mumbai region failed for 42 minutes after a configuration change, which has been rolled back.
|
|
26
|
+
</Quote>
|
|
27
|
+
<StatusAlert tone="warning">
|
|
28
|
+
<AlertTitle>Order history is incomplete</AlertTitle>
|
|
29
|
+
<AlertDescription>The old shop's export starts in April 2024; earlier orders are missing.</AlertDescription>
|
|
30
|
+
</StatusAlert>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Card,
|
|
4
|
+
CardAction,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardFooter,
|
|
8
|
+
CardHeader,
|
|
9
|
+
CardTitle,
|
|
10
|
+
useFormat,
|
|
11
|
+
} from "@siyahi/ui";
|
|
12
|
+
import { DownloadIcon } from "lucide-react";
|
|
13
|
+
|
|
14
|
+
export default function CardExample() {
|
|
15
|
+
const { money } = useFormat();
|
|
16
|
+
return (
|
|
17
|
+
<Card>
|
|
18
|
+
<CardHeader>
|
|
19
|
+
<CardTitle>Revenue this quarter</CardTitle>
|
|
20
|
+
<CardDescription>Across all stores</CardDescription>
|
|
21
|
+
<CardAction>
|
|
22
|
+
<Button variant="outline" size="sm">
|
|
23
|
+
<DownloadIcon />
|
|
24
|
+
CSV
|
|
25
|
+
</Button>
|
|
26
|
+
</CardAction>
|
|
27
|
+
</CardHeader>
|
|
28
|
+
<CardContent>
|
|
29
|
+
<p className="text-3xl font-semibold">{money(4512300)}</p>
|
|
30
|
+
</CardContent>
|
|
31
|
+
<CardFooter>
|
|
32
|
+
<p className="text-muted-foreground">Updated every night at midnight</p>
|
|
33
|
+
</CardFooter>
|
|
34
|
+
</Card>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
ChangeBar,
|
|
8
|
+
DataTable,
|
|
9
|
+
DataTableBody,
|
|
10
|
+
DataTableCompactColumnsToggle,
|
|
11
|
+
DataTableFootnote,
|
|
12
|
+
DataTableHeader,
|
|
13
|
+
DataTableRoot,
|
|
14
|
+
DataTableSortHeader,
|
|
15
|
+
DataTableToolbarSection,
|
|
16
|
+
useFormat,
|
|
17
|
+
type DataTableColumnDef,
|
|
18
|
+
} from "@siyahi/ui";
|
|
19
|
+
|
|
20
|
+
interface Region {
|
|
21
|
+
region: string;
|
|
22
|
+
/** Revenue in January and in February, in rupees; made-up figures. */
|
|
23
|
+
january: number;
|
|
24
|
+
february: number;
|
|
25
|
+
change: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const region = (name: string, january: number, february: number): Region => ({
|
|
29
|
+
region: name,
|
|
30
|
+
january,
|
|
31
|
+
february,
|
|
32
|
+
change: february / january - 1,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const regions: Region[] = [
|
|
36
|
+
region("West", 231900, 258000),
|
|
37
|
+
region("South", 248300, 262500),
|
|
38
|
+
region("Central", 161300, 166000),
|
|
39
|
+
region("East", 250400, 255600),
|
|
40
|
+
region("Northeast", 283100, 276000),
|
|
41
|
+
region("North", 241800, 224400),
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// Every bar is a share of the column's largest move, and the column holds gains and losses, so the bars diverge.
|
|
45
|
+
const largestChange = Math.max(...regions.map((r) => Math.abs(r.change)));
|
|
46
|
+
const diverging = regions.some((r) => r.change < 0) && regions.some((r) => r.change > 0);
|
|
47
|
+
|
|
48
|
+
function Money({ amount, muted = false }: { amount: number; muted?: boolean }) {
|
|
49
|
+
const text = useFormat().money(amount);
|
|
50
|
+
return muted ? <span className="text-muted-foreground">{text}</span> : text;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const header = () => <DataTableSortHeader />;
|
|
54
|
+
|
|
55
|
+
const columns: DataTableColumnDef<Region>[] = [
|
|
56
|
+
{ accessorKey: "region", header, size: 130, meta: { label: "Region", compact: true } },
|
|
57
|
+
{
|
|
58
|
+
accessorKey: "january",
|
|
59
|
+
header,
|
|
60
|
+
size: 130,
|
|
61
|
+
meta: { label: "January", variant: "number" },
|
|
62
|
+
cell: ({ row }) => <Money amount={row.original.january} muted />,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
accessorKey: "february",
|
|
66
|
+
header,
|
|
67
|
+
size: 130,
|
|
68
|
+
meta: { label: "February", variant: "number", compact: true },
|
|
69
|
+
cell: ({ row }) => <Money amount={row.original.february} />,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
accessorKey: "change",
|
|
73
|
+
header,
|
|
74
|
+
size: 150,
|
|
75
|
+
meta: { label: "Change", variant: "number", compact: true },
|
|
76
|
+
cell: ({ row }) => <ChangeBar value={row.original.change} max={largestChange} diverging={diverging} />,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
export default function ChangeBarExample() {
|
|
81
|
+
return (
|
|
82
|
+
<Card>
|
|
83
|
+
<CardHeader>
|
|
84
|
+
<CardTitle>The West grew 11.3% in February, the North fell 7.2%</CardTitle>
|
|
85
|
+
<CardDescription>Each region's revenue in February against January</CardDescription>
|
|
86
|
+
</CardHeader>
|
|
87
|
+
<CardContent>
|
|
88
|
+
<DataTableRoot data={regions} columns={columns}>
|
|
89
|
+
<DataTableToolbarSection>
|
|
90
|
+
<DataTableCompactColumnsToggle />
|
|
91
|
+
</DataTableToolbarSection>
|
|
92
|
+
<DataTable aria-label="February against January">
|
|
93
|
+
<DataTableHeader />
|
|
94
|
+
<DataTableBody />
|
|
95
|
+
<DataTableFootnote>
|
|
96
|
+
Each percent is the change on January's value, and the bar is its size against the largest move. Gains run
|
|
97
|
+
right of the centre line, losses left.
|
|
98
|
+
</DataTableFootnote>
|
|
99
|
+
</DataTable>
|
|
100
|
+
</DataTableRoot>
|
|
101
|
+
</CardContent>
|
|
102
|
+
</Card>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, ChangeGrid, type ChangeGridRow } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// Profit or loss per store per quarter; made-up figures.
|
|
4
|
+
const quarters = ["Q1", "Q2", "Q3", "Q4"];
|
|
5
|
+
const stores: [string, number[]][] = [
|
|
6
|
+
["Koramangala", [412_000, 386_000, 455_000, 520_000]],
|
|
7
|
+
["Indiranagar", [218_000, -42_000, 131_000, 264_000]],
|
|
8
|
+
["Whitefield", [-86_000, -124_000, 38_000, 61_000]],
|
|
9
|
+
["Online", [305_000, 344_000, 398_000, 471_000]],
|
|
10
|
+
["Jayanagar", [96_000, -158_000, -212_000, -64_000]],
|
|
11
|
+
];
|
|
12
|
+
const rows: ChangeGridRow[] = stores.map(([label, values]) => ({
|
|
13
|
+
label,
|
|
14
|
+
values,
|
|
15
|
+
total: values.reduce((sum, value) => sum + value, 0),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
export default function ChangeGridMoneyExample() {
|
|
19
|
+
return (
|
|
20
|
+
<Card>
|
|
21
|
+
<CardHeader>
|
|
22
|
+
<CardTitle>Profit by store and quarter</CardTitle>
|
|
23
|
+
<CardDescription>After rent and wages. The year adds its quarters.</CardDescription>
|
|
24
|
+
</CardHeader>
|
|
25
|
+
<CardContent>
|
|
26
|
+
<ChangeGrid
|
|
27
|
+
label="Profit by store and quarter"
|
|
28
|
+
columns={quarters}
|
|
29
|
+
rows={rows}
|
|
30
|
+
format="money"
|
|
31
|
+
totalLabel="Year"
|
|
32
|
+
/>
|
|
33
|
+
</CardContent>
|
|
34
|
+
</Card>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, ChangeGrid, type ChangeGridRow } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// A café chain's sales growth on the month before, per financial year (April to March); made-up figures.
|
|
4
|
+
const months = ["Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar"];
|
|
5
|
+
const growth: Omit<ChangeGridRow, "total">[] = [
|
|
6
|
+
{
|
|
7
|
+
label: "FY24",
|
|
8
|
+
values: [0.031, 0.012, -0.024, 0.008, 0.017, -0.006, 0.041, 0.052, 0.063, -0.038, 0.004, 0.022],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "FY25",
|
|
12
|
+
values: [0.018, -0.011, -0.032, 0.014, 0.009, 0, 0.036, 0.047, 0.071, -0.044, -0.008, 0.019],
|
|
13
|
+
},
|
|
14
|
+
// The year is under way: months still to come have no figure.
|
|
15
|
+
{
|
|
16
|
+
label: "FY26",
|
|
17
|
+
values: [0.026, 0.015, -0.018, 0.021, 0.012, 0.007, 0.044, null, null, null, null, null],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// Months compound: a year's growth is the product of (1 + each month), less one.
|
|
22
|
+
const rows: ChangeGridRow[] = growth.map(({ label, values }) => ({
|
|
23
|
+
label,
|
|
24
|
+
values,
|
|
25
|
+
total: values.reduce<number>((year, month) => year * (1 + (month ?? 0)), 1) - 1,
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export default function ChangeGridExample() {
|
|
29
|
+
return (
|
|
30
|
+
<Card>
|
|
31
|
+
<CardHeader>
|
|
32
|
+
<CardTitle>Sales growth by month</CardTitle>
|
|
33
|
+
<CardDescription>
|
|
34
|
+
Each month against the one before. Deeper tints are larger changes; the year compounds its months.
|
|
35
|
+
</CardDescription>
|
|
36
|
+
</CardHeader>
|
|
37
|
+
<CardContent>
|
|
38
|
+
<ChangeGrid label="Sales growth by month and financial year" columns={months} rows={rows} totalLabel="Year" />
|
|
39
|
+
</CardContent>
|
|
40
|
+
</Card>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AreaChartCard, ToggleGroup, ToggleGroupItem, useFormat, type ChartSeries } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// Money a new fund manages, month by month from launch, made up for the catalogue: ₹2L to ₹3.1Cr.
|
|
4
|
+
const data = [
|
|
5
|
+
{ month: "Nov", managed: 200000 },
|
|
6
|
+
{ month: "Dec", managed: 450000 },
|
|
7
|
+
{ month: "Jan", managed: 900000 },
|
|
8
|
+
{ month: "Feb", managed: 1600000 },
|
|
9
|
+
{ month: "Mar", managed: 2400000 },
|
|
10
|
+
{ month: "Apr", managed: 3900000 },
|
|
11
|
+
{ month: "May", managed: 5800000 },
|
|
12
|
+
{ month: "Jun", managed: 8200000 },
|
|
13
|
+
{ month: "Jul", managed: 12500000 },
|
|
14
|
+
{ month: "Aug", managed: 17000000 },
|
|
15
|
+
{ month: "Sep", managed: 23500000 },
|
|
16
|
+
{ month: "Oct", managed: 31000000 },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const series: ChartSeries<(typeof data)[number]> = [
|
|
20
|
+
{ key: "managed", label: "Money managed", color: "var(--chart-1)" },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export default function ChartAreaLogExample() {
|
|
24
|
+
const { money, moneyCompact } = useFormat();
|
|
25
|
+
return (
|
|
26
|
+
<AreaChartCard
|
|
27
|
+
title="₹3.1Cr managed a year after launch"
|
|
28
|
+
description="Linear shows the size today; Log shows the early months, when it grew fastest."
|
|
29
|
+
action={
|
|
30
|
+
<ToggleGroup defaultValue={["1Y"]} variant="outline" size="sm" aria-label="Range">
|
|
31
|
+
<ToggleGroupItem value="6M">6M</ToggleGroupItem>
|
|
32
|
+
<ToggleGroupItem value="1Y">1Y</ToggleGroupItem>
|
|
33
|
+
</ToggleGroup>
|
|
34
|
+
}
|
|
35
|
+
data={data}
|
|
36
|
+
xKey="month"
|
|
37
|
+
series={series}
|
|
38
|
+
// Linear is selected first; the buttons after the range toggle let the reader switch to log.
|
|
39
|
+
yScaleToggle
|
|
40
|
+
valueFormatter={money}
|
|
41
|
+
yTickFormatter={moneyCompact}
|
|
42
|
+
height={256}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AreaChartCard, ToggleGroup, ToggleGroupItem, useFormat, type ChartSeries } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ month: "May", revenue: 3820000, target: 3600000 },
|
|
5
|
+
{ month: "Jun", revenue: 3950000, target: 3685000 },
|
|
6
|
+
{ month: "Jul", revenue: 4110000, target: 3770000 },
|
|
7
|
+
{ month: "Aug", revenue: 4020000, target: 3855000 },
|
|
8
|
+
{ month: "Sep", revenue: 4380000, target: 3940000 },
|
|
9
|
+
{ month: "Oct", revenue: 4512300, target: 4025000 },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
// The title states the finding, not the measure: what the reader would say after looking.
|
|
13
|
+
// The first series fills; the target draws as a line over it.
|
|
14
|
+
const series: ChartSeries<(typeof data)[number]> = [
|
|
15
|
+
{ key: "revenue", label: "Revenue", color: "var(--chart-1)" },
|
|
16
|
+
{ key: "target", label: "Target", color: "var(--chart-2)" },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export default function ChartAreaExample() {
|
|
20
|
+
const { money, moneyCompact } = useFormat();
|
|
21
|
+
return (
|
|
22
|
+
<AreaChartCard
|
|
23
|
+
title="October revenue ₹4.9L ahead of target"
|
|
24
|
+
description="Each month's revenue against its target"
|
|
25
|
+
action={
|
|
26
|
+
<ToggleGroup defaultValue={["6M"]} variant="outline" size="sm" aria-label="Range">
|
|
27
|
+
<ToggleGroupItem value="6M">6M</ToggleGroupItem>
|
|
28
|
+
<ToggleGroupItem value="1Y">1Y</ToggleGroupItem>
|
|
29
|
+
</ToggleGroup>
|
|
30
|
+
}
|
|
31
|
+
data={data}
|
|
32
|
+
xKey="month"
|
|
33
|
+
series={series}
|
|
34
|
+
valueFormatter={money}
|
|
35
|
+
yTickFormatter={moneyCompact}
|
|
36
|
+
height={256}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BarChartCard, useFormat, type ChartSeries } from "@siyahi/ui";
|
|
2
|
+
|
|
3
|
+
// Money into and out of a shop's bank account each month; out is negative. Made-up figures.
|
|
4
|
+
const data = [
|
|
5
|
+
{ month: "Jul", in: 84000, out: -52000 },
|
|
6
|
+
{ month: "Aug", in: 61000, out: -73000 },
|
|
7
|
+
{ month: "Sep", in: 92000, out: -48000 },
|
|
8
|
+
{ month: "Oct", in: 70000, out: -66000 },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
// Money moving is not a gain or a loss, so in and out take chart colours, not green and red.
|
|
12
|
+
const series: ChartSeries<(typeof data)[number]> = [
|
|
13
|
+
{ key: "in", label: "In", color: "var(--chart-1)" },
|
|
14
|
+
{ key: "out", label: "Out", color: "var(--chart-2)" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export default function ChartBarFlowsExample() {
|
|
18
|
+
const { money, moneyCompact } = useFormat();
|
|
19
|
+
return (
|
|
20
|
+
<BarChartCard
|
|
21
|
+
title="Cash in and out by month"
|
|
22
|
+
description="Money in above the line, money out below it"
|
|
23
|
+
data={data}
|
|
24
|
+
xKey="month"
|
|
25
|
+
series={series}
|
|
26
|
+
stacked
|
|
27
|
+
valueFormatter={money}
|
|
28
|
+
yTickFormatter={moneyCompact}
|
|
29
|
+
height={256}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|