@siyahi/ui 0.1.9-next.22 → 0.1.9-next.23

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 (80) hide show
  1. package/DESIGN.md +3 -2
  2. package/agents/examples/accordion.tsx +7 -7
  3. package/agents/examples/alert.tsx +16 -15
  4. package/agents/examples/badge.tsx +20 -12
  5. package/agents/examples/bar-list-labels.tsx +6 -6
  6. package/agents/examples/bar-list-sides.tsx +8 -8
  7. package/agents/examples/bar-list.tsx +8 -8
  8. package/agents/examples/breadcrumb.tsx +3 -3
  9. package/agents/examples/callout.tsx +15 -15
  10. package/agents/examples/card.tsx +3 -3
  11. package/agents/examples/change-bar.tsx +21 -21
  12. package/agents/examples/chart-area.tsx +11 -11
  13. package/agents/examples/chart-bar-flows.tsx +1 -1
  14. package/agents/examples/chart-bar-hourly.tsx +1 -1
  15. package/agents/examples/chart-bar-losses.tsx +3 -3
  16. package/agents/examples/chart-bar-teams.tsx +72 -0
  17. package/agents/examples/chart-bar-years.tsx +5 -5
  18. package/agents/examples/chart-bar.tsx +10 -10
  19. package/agents/examples/chart-category-ticks.tsx +6 -6
  20. package/agents/examples/chart-line.tsx +17 -17
  21. package/agents/examples/collapsible.tsx +4 -2
  22. package/agents/examples/command.tsx +6 -6
  23. package/agents/examples/context-menu.tsx +2 -2
  24. package/agents/examples/data-bar.tsx +32 -45
  25. package/agents/examples/data-table-compact.tsx +31 -30
  26. package/agents/examples/data-table-filters.tsx +20 -20
  27. package/agents/examples/data-table.tsx +31 -30
  28. package/agents/examples/dialog.tsx +3 -3
  29. package/agents/examples/distribution-bar-tug.tsx +15 -15
  30. package/agents/examples/dropdown-menu.tsx +2 -2
  31. package/agents/examples/heatmap-calendar.tsx +6 -6
  32. package/agents/examples/heatmap-status.tsx +1 -1
  33. package/agents/examples/heatmap-weekday.tsx +7 -7
  34. package/agents/examples/input-states.tsx +9 -9
  35. package/agents/examples/input.tsx +3 -3
  36. package/agents/examples/local-time.tsx +1 -1
  37. package/agents/examples/metric-strip.tsx +8 -8
  38. package/agents/examples/page-hero.tsx +2 -2
  39. package/agents/examples/popover.tsx +3 -3
  40. package/agents/examples/price-chart.tsx +3 -3
  41. package/agents/examples/progress-tone.tsx +10 -9
  42. package/agents/examples/progress.tsx +1 -1
  43. package/agents/examples/range-position-table.tsx +31 -31
  44. package/agents/examples/range-position.tsx +18 -18
  45. package/agents/examples/section-cards-select.tsx +11 -10
  46. package/agents/examples/section-cards-trend.tsx +4 -4
  47. package/agents/examples/section-cards.tsx +13 -13
  48. package/agents/examples/select.tsx +9 -9
  49. package/agents/examples/separator.tsx +3 -3
  50. package/agents/examples/sheet.tsx +1 -1
  51. package/agents/examples/slider.tsx +1 -1
  52. package/agents/examples/surfaces.tsx +16 -18
  53. package/agents/examples/tabs.tsx +7 -7
  54. package/agents/examples/target-rows.tsx +25 -23
  55. package/agents/examples/tooltip.tsx +2 -2
  56. package/agents/examples/treemap.tsx +27 -24
  57. package/agents/manifest.json +15 -15
  58. package/dist/components/registry/charts/bar-chart-card.d.ts +1 -1
  59. package/dist/components/registry/charts/line-chart-card.d.ts +1 -1
  60. package/dist/components/registry/charts/line-chart-card.js +1 -1
  61. package/dist/components/siyahi/callout.d.ts +5 -12
  62. package/dist/components/siyahi/callout.js +5 -11
  63. package/dist/components/siyahi/status-alert.d.ts +15 -0
  64. package/dist/components/siyahi/status-alert.js +29 -0
  65. package/dist/components/siyahi/status-badge.d.ts +15 -0
  66. package/dist/components/siyahi/status-badge.js +24 -0
  67. package/dist/components/siyahi/tone-progress.d.ts +1 -1
  68. package/dist/components/siyahi/tone-progress.js +1 -1
  69. package/dist/components/siyahi/treemap.d.ts +4 -4
  70. package/dist/components/siyahi/treemap.js +2 -2
  71. package/dist/index.d.ts +5 -4
  72. package/dist/index.js +3 -2
  73. package/dist/lib/chart-frame.js +1 -1
  74. package/dist/lib/chart-series.d.ts +1 -1
  75. package/dist/lib/tone.d.ts +36 -0
  76. package/dist/lib/tone.js +35 -0
  77. package/package.json +1 -1
  78. package/agents/examples/chart-bar-sectors.tsx +0 -72
  79. package/dist/components/siyahi/warning-alert.d.ts +0 -10
  80. package/dist/components/siyahi/warning-alert.js +0 -20
@@ -2,20 +2,20 @@ import { useState } from "react";
2
2
  import { BarChartCard, ToggleGroup, ToggleGroupItem, useFormat, type ChartSeries } from "@siyahi/ui";
3
3
 
4
4
  const data = [
5
- { quarter: "Q1", equity: 120000, debt: 40000, gold: 15000, cash: 9000, reits: 4000 },
6
- { quarter: "Q2", equity: 95000, debt: 52000, gold: 20000, cash: 6000, reits: 3000 },
7
- { quarter: "Q3", equity: 140000, debt: 38000, gold: 12000, cash: 11000, reits: 5000 },
8
- { quarter: "Q4", equity: 160000, debt: 45000, gold: 25000, cash: 7000, reits: 2000 },
5
+ { quarter: "Q1", online: 120000, retail: 40000, wholesale: 15000, marketplace: 9000, events: 4000 },
6
+ { quarter: "Q2", online: 95000, retail: 52000, wholesale: 20000, marketplace: 6000, events: 3000 },
7
+ { quarter: "Q3", online: 140000, retail: 38000, wholesale: 12000, marketplace: 11000, events: 5000 },
8
+ { quarter: "Q4", online: 160000, retail: 45000, wholesale: 25000, marketplace: 7000, events: 2000 },
9
9
  ];
10
10
 
11
11
  // Series take the slots in order: neighbours differ in lightness, slots two
12
12
  // apart differ in hue.
13
13
  const series: ChartSeries<(typeof data)[number]> = [
14
- { key: "equity", label: "Equity", color: "var(--chart-1)" },
15
- { key: "debt", label: "Debt", color: "var(--chart-2)" },
16
- { key: "gold", label: "Gold", color: "var(--chart-3)" },
17
- { key: "cash", label: "Cash", color: "var(--chart-4)" },
18
- { key: "reits", label: "REITs", color: "var(--chart-5)" },
14
+ { key: "online", label: "Online", color: "var(--chart-1)" },
15
+ { key: "retail", label: "Retail", color: "var(--chart-2)" },
16
+ { key: "wholesale", label: "Wholesale", color: "var(--chart-3)" },
17
+ { key: "marketplace", label: "Marketplace", color: "var(--chart-4)" },
18
+ { key: "events", label: "Events", color: "var(--chart-5)" },
19
19
  ];
20
20
 
21
21
  export default function ChartBarExample() {
@@ -23,7 +23,7 @@ export default function ChartBarExample() {
23
23
  const [layout, setLayout] = useState("grouped");
24
24
  return (
25
25
  <BarChartCard
26
- title="Money invested by quarter"
26
+ title="Revenue by channel and quarter"
27
27
  description={
28
28
  layout === "grouped"
29
29
  ? "All five chart colours side by side, in series order"
@@ -30,15 +30,15 @@ export default function ChartCategoryTicksExample() {
30
30
  height={300}
31
31
  />
32
32
  <BarChartCard
33
- title="Orders by sector"
33
+ title="Orders by category"
34
34
  description="Demo orders; one long category label on a narrow chart"
35
35
  data={[
36
- { sector: "Information Technology and Services", orders: 100 },
37
- { sector: "Other", orders: 50 },
38
- { sector: "Third", orders: 70 },
36
+ { category: "Home Appliances and Kitchen Equipment", orders: 100 },
37
+ { category: "Other", orders: 50 },
38
+ { category: "Third", orders: 70 },
39
39
  ]}
40
- xKey="sector"
41
- xTicks={["Information Technology and Services"]}
40
+ xKey="category"
41
+ xTicks={["Home Appliances and Kitchen Equipment"]}
42
42
  series={[{ key: "orders", label: "Orders", color: "var(--chart-1)" }]}
43
43
  horizontal
44
44
  height={220}
@@ -2,26 +2,26 @@ import { useState } from "react";
2
2
  import { LineChartCard, ToggleGroup, ToggleGroupItem, useFormat, type ChartSeries } from "@siyahi/ui";
3
3
 
4
4
  const cumulative = [
5
- { month: "May", portfolio: 0.012, index: 0.008 },
6
- { month: "Jun", portfolio: 0.021, index: 0.015 },
7
- { month: "Jul", portfolio: 0.034, index: 0.029 },
8
- { month: "Aug", portfolio: -0.006, index: 0.004 },
9
- { month: "Sep", portfolio: 0.041, index: 0.031 },
10
- { month: "Oct", portfolio: 0.052, index: 0.036 },
5
+ { month: "May", store: 0.012, category: 0.008 },
6
+ { month: "Jun", store: 0.021, category: 0.015 },
7
+ { month: "Jul", store: 0.034, category: 0.029 },
8
+ { month: "Aug", store: -0.006, category: 0.004 },
9
+ { month: "Sep", store: 0.041, category: 0.031 },
10
+ { month: "Oct", store: 0.052, category: 0.036 },
11
11
  ];
12
12
 
13
13
  const monthly = [
14
- { month: "May", portfolio: 0.012, index: 0.008 },
15
- { month: "Jun", portfolio: 0.009, index: 0.007 },
16
- { month: "Jul", portfolio: 0.013, index: 0.014 },
17
- { month: "Aug", portfolio: -0.039, index: -0.024 },
18
- { month: "Sep", portfolio: 0.047, index: 0.027 },
19
- { month: "Oct", portfolio: 0.011, index: 0.005 },
14
+ { month: "May", store: 0.012, category: 0.008 },
15
+ { month: "Jun", store: 0.009, category: 0.007 },
16
+ { month: "Jul", store: 0.013, category: 0.014 },
17
+ { month: "Aug", store: -0.039, category: -0.024 },
18
+ { month: "Sep", store: 0.047, category: 0.027 },
19
+ { month: "Oct", store: 0.011, category: 0.005 },
20
20
  ];
21
21
 
22
22
  const series: ChartSeries<(typeof cumulative)[number]> = [
23
- { key: "portfolio", label: "Portfolio", color: "var(--chart-1)" },
24
- { key: "index", label: "Nifty 50", color: "var(--chart-2)" },
23
+ { key: "store", label: "Our store", color: "var(--chart-1)" },
24
+ { key: "category", label: "Category average", color: "var(--chart-2)" },
25
25
  ];
26
26
 
27
27
  export default function ChartLineExample() {
@@ -29,7 +29,7 @@ export default function ChartLineExample() {
29
29
  const [mode, setMode] = useState("cumulative");
30
30
  return (
31
31
  <LineChartCard
32
- title="Return against the index"
32
+ title="Sales growth against the category"
33
33
  description={mode === "cumulative" ? "Cumulative, from the start of May" : "Each month on its own"}
34
34
  action={
35
35
  <ToggleGroup
@@ -42,8 +42,8 @@ export default function ChartLineExample() {
42
42
  size="sm"
43
43
  aria-label="Mode"
44
44
  >
45
- <ToggleGroupItem value="cumulative">Cumulative return</ToggleGroupItem>
46
- <ToggleGroupItem value="monthly">Monthly return</ToggleGroupItem>
45
+ <ToggleGroupItem value="cumulative">Cumulative growth</ToggleGroupItem>
46
+ <ToggleGroupItem value="monthly">Monthly growth</ToggleGroupItem>
47
47
  </ToggleGroup>
48
48
  }
49
49
  data={mode === "cumulative" ? cumulative : monthly}
@@ -6,10 +6,12 @@ export default function CollapsibleExample() {
6
6
  <Collapsible className="flex max-w-sm flex-col gap-2">
7
7
  <CollapsibleTrigger render={<Button variant="outline" className="w-fit" />}>
8
8
  <ChevronsUpDownIcon />
9
- How lots are matched
9
+ How refunds are counted
10
10
  </CollapsibleTrigger>
11
11
  <CollapsibleContent>
12
- <p className="text-muted-foreground">Sells are matched to the oldest buy first, as the tax rules require.</p>
12
+ <p className="text-muted-foreground">
13
+ A refund comes off the month the order was placed in, not the month it was paid.
14
+ </p>
13
15
  </CollapsibleContent>
14
16
  </Collapsible>
15
17
  );
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@siyahi/ui";
2
- import { ChartLineIcon, LandmarkIcon, WalletIcon } from "lucide-react";
2
+ import { ChartLineIcon, PackageIcon, UsersIcon } from "lucide-react";
3
3
 
4
4
  export default function CommandExample() {
5
5
  return (
@@ -10,16 +10,16 @@ export default function CommandExample() {
10
10
  <CommandEmpty>No page matches.</CommandEmpty>
11
11
  <CommandGroup heading="Pages">
12
12
  <CommandItem>
13
- <WalletIcon />
14
- Holdings
13
+ <PackageIcon />
14
+ Orders
15
15
  </CommandItem>
16
16
  <CommandItem>
17
17
  <ChartLineIcon />
18
- Realized
18
+ Revenue
19
19
  </CommandItem>
20
20
  <CommandItem>
21
- <LandmarkIcon />
22
- Cash flow
21
+ <UsersIcon />
22
+ Customers
23
23
  </CommandItem>
24
24
  </CommandGroup>
25
25
  </CommandList>
@@ -9,8 +9,8 @@ export default function ContextMenuExample() {
9
9
  </div>
10
10
  </ContextMenuTrigger>
11
11
  <ContextMenuContent>
12
- <ContextMenuItem>Copy symbol</ContextMenuItem>
13
- <ContextMenuItem>Open chart</ContextMenuItem>
12
+ <ContextMenuItem>Copy order number</ContextMenuItem>
13
+ <ContextMenuItem>Open order</ContextMenuItem>
14
14
  </ContextMenuContent>
15
15
  </ContextMenu>
16
16
  );
@@ -15,36 +15,27 @@ import {
15
15
  type DataTableColumnDef,
16
16
  } from "@siyahi/ui";
17
17
 
18
- interface Holding {
19
- symbol: string;
20
- value: number;
21
- gain: number;
22
- /** Closing prices over the last ten sessions, oldest first. */
23
- closes: number[];
18
+ interface Store {
19
+ store: string;
20
+ /** This month's sales, and their change on last month, in rupees; made-up figures. */
21
+ sales: number;
22
+ change: number;
23
+ /** Orders on each of the last ten days, oldest first. */
24
+ daily: number[];
24
25
  }
25
26
 
26
- const holdings: Holding[] = [
27
- { symbol: "ITC", value: 276000, gain: -18400, closes: [478, 474, 470, 471, 466, 463, 465, 461, 459, 460] },
28
- {
29
- symbol: "HDFCBANK",
30
- value: 262500,
31
- gain: 21300,
32
- closes: [1712, 1718, 1726, 1720, 1731, 1744, 1739, 1748, 1752, 1750],
33
- },
34
- {
35
- symbol: "ICICIBANK",
36
- value: 258000,
37
- gain: 44100,
38
- closes: [1250, 1262, 1258, 1271, 1266, 1280, 1284, 1279, 1288, 1290],
39
- },
40
- { symbol: "NIFTYBEES", value: 255600, gain: 12800, closes: [281, 282, 280, 283, 284, 283, 285, 284, 286, 284] },
41
- { symbol: "INFY", value: 224400, gain: 30900, closes: [1820, 1834, 1829, 1841, 1852, 1848, 1860, 1855, 1866, 1870] },
42
- { symbol: "TCS", value: 166000, gain: -2600, closes: [4180, 4172, 4165, 4170, 4158, 4150, 4161, 4155, 4148, 4150] },
27
+ const stores: Store[] = [
28
+ { store: "Delhi", sales: 276000, change: -18400, daily: [478, 474, 470, 471, 466, 463, 465, 461, 459, 460] },
29
+ { store: "Bengaluru", sales: 262500, change: 21300, daily: [312, 318, 326, 320, 331, 344, 339, 348, 352, 350] },
30
+ { store: "Chennai", sales: 258000, change: 44100, daily: [250, 262, 258, 271, 266, 280, 284, 279, 288, 290] },
31
+ { store: "Kolkata", sales: 255600, change: 12800, daily: [281, 282, 280, 283, 284, 283, 285, 284, 286, 284] },
32
+ { store: "Mumbai", sales: 224400, change: 30900, daily: [220, 234, 229, 241, 252, 248, 260, 255, 266, 270] },
33
+ { store: "Pune", sales: 166000, change: -2600, daily: [180, 172, 165, 170, 158, 150, 161, 155, 148, 150] },
43
34
  ];
44
35
 
45
36
  // Each bar is a share of its column's largest figure, so the rows draw to one scale.
46
- const largestValue = Math.max(...holdings.map((h) => h.value));
47
- const largestGain = Math.max(...holdings.map((h) => Math.abs(h.gain)));
37
+ const largestSales = Math.max(...stores.map((s) => s.sales));
38
+ const largestChange = Math.max(...stores.map((s) => Math.abs(s.change)));
48
39
 
49
40
  function Money({ amount }: { amount: number }) {
50
41
  return useFormat().money(amount);
@@ -52,41 +43,41 @@ function Money({ amount }: { amount: number }) {
52
43
 
53
44
  const header = () => <DataTableSortHeader />;
54
45
 
55
- const columns: DataTableColumnDef<Holding>[] = [
56
- { accessorKey: "symbol", header, size: 120, meta: { label: "Symbol" } },
46
+ const columns: DataTableColumnDef<Store>[] = [
47
+ { accessorKey: "store", header, size: 120, meta: { label: "Store" } },
57
48
  {
58
- accessorKey: "value",
49
+ accessorKey: "sales",
59
50
  header,
60
51
  size: 170,
61
- meta: { label: "Value", variant: "number" },
52
+ meta: { label: "Sales", variant: "number" },
62
53
  cell: ({ row }) => (
63
- <DataBar value={row.original.value} max={largestValue}>
64
- <Money amount={row.original.value} />
54
+ <DataBar value={row.original.sales} max={largestSales}>
55
+ <Money amount={row.original.sales} />
65
56
  </DataBar>
66
57
  ),
67
58
  },
68
59
  {
69
- accessorKey: "gain",
60
+ accessorKey: "change",
70
61
  header,
71
62
  size: 170,
72
- meta: { label: "Gain", variant: "number" },
63
+ meta: { label: "vs last month", variant: "number" },
73
64
  cell: ({ row }) => (
74
- <DataBar value={row.original.gain} max={largestGain} tone="sign">
75
- <Money amount={row.original.gain} />
65
+ <DataBar value={row.original.change} max={largestChange} tone="sign">
66
+ <Money amount={row.original.change} />
76
67
  </DataBar>
77
68
  ),
78
69
  },
79
70
  {
80
- id: "closes",
71
+ id: "daily",
81
72
  header: "10 days",
82
73
  size: 110,
83
74
  enableSorting: false,
84
75
  cell: ({ row }) => {
85
- const { closes } = row.original;
86
- const rising = (closes.at(-1) ?? 0) >= (closes[0] ?? 0);
76
+ const { daily } = row.original;
77
+ const rising = (daily.at(-1) ?? 0) >= (daily[0] ?? 0);
87
78
  return (
88
79
  <Sparkline
89
- data={closes}
80
+ data={daily}
90
81
  variant="line"
91
82
  color={rising ? "var(--positive)" : "var(--negative)"}
92
83
  animate={false}
@@ -101,15 +92,11 @@ export default function DataBarExample() {
101
92
  return (
102
93
  <Card>
103
94
  <CardHeader>
104
- <CardTitle>Holdings</CardTitle>
95
+ <CardTitle>Stores</CardTitle>
105
96
  <CardDescription>Bars give each figure's size against the column's largest</CardDescription>
106
97
  </CardHeader>
107
98
  <CardContent>
108
- <DataTableRoot
109
- data={holdings}
110
- columns={columns}
111
- initialState={{ columnPinning: { start: ["symbol"], end: [] } }}
112
- >
99
+ <DataTableRoot data={stores} columns={columns} initialState={{ columnPinning: { start: ["store"], end: [] } }}>
113
100
  <DataTable>
114
101
  <DataTableHeader />
115
102
  <DataTableBody />
@@ -18,52 +18,53 @@ import {
18
18
  type DataTableColumnDef,
19
19
  } from "@siyahi/ui";
20
20
 
21
- interface Holding {
22
- symbol: string;
23
- sector: string;
24
- quantity: number;
25
- value: number;
21
+ interface Product {
22
+ product: string;
23
+ category: string;
24
+ /** Units sold and revenue this month; change is the revenue against last week. Made-up figures. */
25
+ units: number;
26
+ revenue: number;
26
27
  change: number;
27
28
  }
28
29
 
29
- const holdings: Holding[] = [
30
- { symbol: "INFY", sector: "IT", quantity: 120, value: 224400, change: 0.018 },
31
- { symbol: "HDFCBANK", sector: "Banks", quantity: 150, value: 262500, change: -0.006 },
32
- { symbol: "TCS", sector: "IT", quantity: 40, value: 166000, change: 0.004 },
33
- { symbol: "ITC", sector: "Fast Moving Consumer Goods", quantity: 600, value: 276000, change: -0.012 },
30
+ const products: Product[] = [
31
+ { product: "Standing desk", category: "Furniture", units: 120, revenue: 224400, change: 0.018 },
32
+ { product: "Office chair", category: "Seating", units: 150, revenue: 262500, change: -0.006 },
33
+ { product: "Bookshelf", category: "Furniture", units: 40, revenue: 166000, change: 0.004 },
34
+ { product: "Dinner set", category: "Kitchen, Dining & Tableware", units: 600, revenue: 276000, change: -0.012 },
34
35
  ];
35
36
 
36
37
  const header = () => <DataTableSortHeader />;
37
38
 
38
- // While the Day column is hidden to fit, the day's move rides under the value it belongs to.
39
- function ValueCell({ holding }: { holding: Holding }) {
39
+ // While the Week column is hidden to fit, the week's change rides under the revenue it belongs to.
40
+ function RevenueCell({ product }: { product: Product }) {
40
41
  const format = useFormat();
41
- const { compactColumns } = useDataTable<Holding>();
42
- if (!compactColumns?.hidden.has("change")) return format.money(holding.value);
42
+ const { compactColumns } = useDataTable<Product>();
43
+ if (!compactColumns?.hidden.has("change")) return format.money(product.revenue);
43
44
  return (
44
45
  <div className="flex flex-col items-end">
45
- {format.money(holding.value)}
46
- <Delta value={holding.change} />
46
+ {format.money(product.revenue)}
47
+ <Delta value={product.change} />
47
48
  </div>
48
49
  );
49
50
  }
50
51
 
51
- const columns: DataTableColumnDef<Holding>[] = [
52
- { accessorKey: "symbol", header, size: 140, meta: { label: "Symbol", compact: true } },
53
- { accessorKey: "sector", header, size: 120, meta: { label: "Sector" } },
54
- { accessorKey: "quantity", header, size: 100, meta: { label: "Qty", variant: "number" } },
52
+ const columns: DataTableColumnDef<Product>[] = [
53
+ { accessorKey: "product", header, size: 140, meta: { label: "Product", compact: true } },
54
+ { accessorKey: "category", header, size: 120, meta: { label: "Category" } },
55
+ { accessorKey: "units", header, size: 100, meta: { label: "Units", variant: "number" } },
55
56
  {
56
- accessorKey: "value",
57
+ accessorKey: "revenue",
57
58
  header,
58
59
  size: 140,
59
- meta: { label: "Value", variant: "number", compact: true },
60
- cell: ({ row }) => <ValueCell holding={row.original} />,
60
+ meta: { label: "Revenue", variant: "number", compact: true },
61
+ cell: ({ row }) => <RevenueCell product={row.original} />,
61
62
  },
62
63
  {
63
64
  accessorKey: "change",
64
65
  header,
65
66
  size: 110,
66
- meta: { label: "Day", variant: "number" },
67
+ meta: { label: "Week", variant: "number" },
67
68
  cell: ({ row }) => <Delta value={row.original.change} />,
68
69
  },
69
70
  ];
@@ -72,19 +73,19 @@ export default function DataTableCompactExample() {
72
73
  return (
73
74
  <Card>
74
75
  <CardHeader>
75
- <CardTitle>Holdings on a phone</CardTitle>
76
+ <CardTitle>Products on a phone</CardTitle>
76
77
  <CardDescription>
77
- Symbol and value are the key columns. When the columns do not fit, the others hide from the right, and the
78
- day's move rides under the value once its column is gone; All columns brings back the rest
78
+ Product and revenue are the key columns. When the columns do not fit, the others hide from the right, and the
79
+ week's change rides under the revenue once its column is gone; All columns brings back the rest
79
80
  </CardDescription>
80
81
  </CardHeader>
81
82
  <CardContent>
82
- <DataTableRoot data={holdings} columns={columns}>
83
+ <DataTableRoot data={products} columns={columns}>
83
84
  <DataTableToolbarSection>
84
85
  <DataTableCompactColumnsToggle />
85
- <DataTableRowCount unit="holdings" />
86
+ <DataTableRowCount unit="products" />
86
87
  </DataTableToolbarSection>
87
- <DataTable aria-label="Holdings on a phone">
88
+ <DataTable aria-label="Products on a phone">
88
89
  <DataTableHeader />
89
90
  <DataTableBody />
90
91
  </DataTable>
@@ -26,30 +26,30 @@ import {
26
26
  type DataTableColumnDef,
27
27
  } from "@siyahi/ui";
28
28
 
29
- interface Holding {
30
- symbol: string;
31
- sector: string;
32
- broker: string;
29
+ interface Order {
30
+ order: string;
31
+ status: string;
32
+ warehouse: string;
33
33
  }
34
- const data: Holding[] = [
35
- { symbol: "INFY", sector: "Information technology", broker: "Kite" },
36
- { symbol: "HDFCBANK", sector: "Banks", broker: "Dhan" },
37
- { symbol: "TCS", sector: "Information technology", broker: "Dhan" },
34
+ const data: Order[] = [
35
+ { order: "ORD-1042", status: "Out for delivery", warehouse: "Bhiwandi" },
36
+ { order: "ORD-1043", status: "Packed", warehouse: "Hosur" },
37
+ { order: "ORD-1044", status: "Out for delivery", warehouse: "Hosur" },
38
38
  ];
39
39
  const header = () => <DataTableSortHeader />;
40
- const columns: DataTableColumnDef<Holding>[] = [
41
- { accessorKey: "symbol", header, size: 140, meta: { label: "Instrument" } },
42
- { accessorKey: "sector", header, meta: { label: "Sector" } },
43
- { accessorKey: "broker", header, meta: { label: "Broker" } },
40
+ const columns: DataTableColumnDef<Order>[] = [
41
+ { accessorKey: "order", header, size: 140, meta: { label: "Order" } },
42
+ { accessorKey: "status", header, meta: { label: "Status" } },
43
+ { accessorKey: "warehouse", header, meta: { label: "Warehouse" } },
44
44
  ];
45
45
 
46
46
  function Filters() {
47
- const { table, isCompact } = useDataTable<Holding>();
47
+ const { table, isCompact } = useDataTable<Order>();
48
48
  const active = table.state.columnFilters.length;
49
49
  const controls = (
50
50
  <div className="flex flex-wrap gap-2">
51
- <DataTableFacetedFilter accessorKey="sector" title="Sector" />
52
- <DataTableFacetedFilter accessorKey="broker" title="Broker" />
51
+ <DataTableFacetedFilter accessorKey="status" title="Status" />
52
+ <DataTableFacetedFilter accessorKey="warehouse" title="Warehouse" />
53
53
  </div>
54
54
  );
55
55
  if (!isCompact) return controls;
@@ -58,7 +58,7 @@ function Filters() {
58
58
  <SheetTrigger render={<Button variant="outline" size="sm" />}>Filters{active ? ` (${active})` : ""}</SheetTrigger>
59
59
  <SheetContent>
60
60
  <SheetHeader>
61
- <SheetTitle>Holding filters</SheetTitle>
61
+ <SheetTitle>Order filters</SheetTitle>
62
62
  <SheetDescription>Selections stay applied when this panel closes.</SheetDescription>
63
63
  </SheetHeader>
64
64
  <div className="overflow-y-auto px-4">{controls}</div>
@@ -77,7 +77,7 @@ export default function DataTableFiltersExample() {
77
77
  return (
78
78
  <Card>
79
79
  <CardHeader>
80
- <CardTitle>Holdings with compact filters</CardTitle>
80
+ <CardTitle>Orders with compact filters</CardTitle>
81
81
  <CardDescription>Search stays visible; secondary filters move into a panel in narrow space.</CardDescription>
82
82
  </CardHeader>
83
83
  <CardContent>
@@ -86,13 +86,13 @@ export default function DataTableFiltersExample() {
86
86
  <DataTableToolbarSection>
87
87
  <DataTableSearchFilter
88
88
  label="Search compact example"
89
- placeholder="Search holdings…"
89
+ placeholder="Search orders…"
90
90
  className="w-full flex-none sm:w-64"
91
91
  />
92
92
  <Filters />
93
- <DataTableRowCount unit="holdings" />
93
+ <DataTableRowCount unit="orders" />
94
94
  </DataTableToolbarSection>
95
- <DataTable aria-label="Holdings with compact filters">
95
+ <DataTable aria-label="Orders with compact filters">
96
96
  <DataTableHeader />
97
97
  <DataTableBody />
98
98
  </DataTable>
@@ -18,21 +18,22 @@ import {
18
18
  type DataTableColumnDef,
19
19
  } from "@siyahi/ui";
20
20
 
21
- interface Holding {
22
- symbol: string;
23
- sector: string;
24
- quantity: number;
25
- value: number;
21
+ interface Product {
22
+ product: string;
23
+ category: string;
24
+ /** Units sold and revenue this month; change is the revenue against last week. Made-up figures. */
25
+ units: number;
26
+ revenue: number;
26
27
  change: number;
27
28
  }
28
29
 
29
- const holdings: Holding[] = [
30
- { symbol: "INFY", sector: "IT", quantity: 120, value: 224400, change: 0.018 },
31
- { symbol: "HDFCBANK", sector: "Banks", quantity: 150, value: 262500, change: -0.006 },
32
- { symbol: "TCS", sector: "IT", quantity: 40, value: 166000, change: 0.004 },
33
- { symbol: "ITC", sector: "Fast Moving Consumer Goods", quantity: 600, value: 276000, change: -0.012 },
34
- { symbol: "ICICIBANK", sector: "Banks", quantity: 200, value: 258000, change: 0.022 },
35
- { symbol: "NIFTYBEES", sector: "ETF", quantity: 900, value: 255600, change: 0.009 },
30
+ const products: Product[] = [
31
+ { product: "Standing desk", category: "Furniture", units: 120, revenue: 224400, change: 0.018 },
32
+ { product: "Office chair", category: "Seating", units: 150, revenue: 262500, change: -0.006 },
33
+ { product: "Bookshelf", category: "Furniture", units: 40, revenue: 166000, change: 0.004 },
34
+ { product: "Dinner set", category: "Kitchen, Dining & Tableware", units: 600, revenue: 276000, change: -0.012 },
35
+ { product: "Kids chair", category: "Seating", units: 200, revenue: 258000, change: 0.022 },
36
+ { product: "Desk lamp", category: "Lighting", units: 900, revenue: 255600, change: 0.009 },
36
37
  ];
37
38
 
38
39
  // One click sorts largest (or Z) first; the title comes from meta.label.
@@ -42,22 +43,22 @@ function Money({ amount }: { amount: number }) {
42
43
  return useFormat().money(amount);
43
44
  }
44
45
 
45
- const columns: DataTableColumnDef<Holding>[] = [
46
- { accessorKey: "symbol", header, size: 140, meta: { label: "Symbol" } },
47
- { accessorKey: "sector", header, size: 120, meta: { label: "Sector" } },
48
- { accessorKey: "quantity", header, size: 100, meta: { label: "Qty", variant: "number" } },
46
+ const columns: DataTableColumnDef<Product>[] = [
47
+ { accessorKey: "product", header, size: 140, meta: { label: "Product" } },
48
+ { accessorKey: "category", header, size: 120, meta: { label: "Category" } },
49
+ { accessorKey: "units", header, size: 100, meta: { label: "Units", variant: "number" } },
49
50
  {
50
- accessorKey: "value",
51
+ accessorKey: "revenue",
51
52
  header,
52
53
  size: 140,
53
- meta: { label: "Value", variant: "number" },
54
- cell: ({ row }) => <Money amount={row.original.value} />,
54
+ meta: { label: "Revenue", variant: "number" },
55
+ cell: ({ row }) => <Money amount={row.original.revenue} />,
55
56
  },
56
57
  {
57
58
  accessorKey: "change",
58
59
  header,
59
60
  size: 110,
60
- meta: { label: "Day", variant: "number" },
61
+ meta: { label: "Week", variant: "number" },
61
62
  cell: ({ row }) => <Delta value={row.original.change} />,
62
63
  },
63
64
  ];
@@ -66,28 +67,28 @@ export default function DataTableExample() {
66
67
  return (
67
68
  <Card>
68
69
  <CardHeader>
69
- <CardTitle>Holdings</CardTitle>
70
+ <CardTitle>Products</CardTitle>
70
71
  <CardDescription>
71
- Search every column, filter by sector, sort any column in one click; the symbol stays put when the table
72
- scrolls in wide panels. In narrow panels every column scrolls, leaving room for the values
72
+ Search every column, filter by category, sort any column in one click; the product stays put when the table
73
+ scrolls in wide panels. In narrow panels every column scrolls, leaving room for the figures
73
74
  </CardDescription>
74
75
  </CardHeader>
75
76
  <CardContent>
76
77
  <DataTableRoot
77
- data={holdings}
78
+ data={products}
78
79
  columns={columns}
79
- initialState={{ columnPinning: { start: ["symbol"], end: [] } }}
80
+ initialState={{ columnPinning: { start: ["product"], end: [] } }}
80
81
  >
81
82
  <DataTableToolbarSection>
82
83
  <DataTableSearchFilter
83
- placeholder="Search holdings…"
84
- label="Filter holdings"
84
+ placeholder="Search products…"
85
+ label="Filter products"
85
86
  className="flex-none sm:w-64"
86
87
  />
87
- <DataTableFacetedFilter accessorKey="sector" title="Sector" />
88
- <DataTableRowCount unit="holdings" />
88
+ <DataTableFacetedFilter accessorKey="category" title="Category" />
89
+ <DataTableRowCount unit="products" />
89
90
  </DataTableToolbarSection>
90
- <DataTable aria-label="Holdings">
91
+ <DataTable aria-label="Products">
91
92
  <DataTableHeader />
92
93
  <DataTableBody />
93
94
  </DataTable>
@@ -13,11 +13,11 @@ import {
13
13
  export default function DialogExample() {
14
14
  return (
15
15
  <Dialog>
16
- <DialogTrigger render={<Button variant="outline" className="w-fit" />}>Show fills</DialogTrigger>
16
+ <DialogTrigger render={<Button variant="outline" className="w-fit" />}>Show parcels</DialogTrigger>
17
17
  <DialogContent>
18
18
  <DialogHeader>
19
- <DialogTitle>Fills for this sell</DialogTitle>
20
- <DialogDescription>Each lot this sale was matched against, oldest first.</DialogDescription>
19
+ <DialogTitle>Parcels for this order</DialogTitle>
20
+ <DialogDescription>Each parcel this order was split into, earliest first.</DialogDescription>
21
21
  </DialogHeader>
22
22
  <DialogFooter>
23
23
  <DialogClose render={<Button variant="outline" />}>Close</DialogClose>